@page "/take/order"
@code {
@inject IOrderInfoDao orderInfoDao;
@inject DialogService dialogService;
@inject Toolbelt.Blazor.I18nText.I18nText I18nText;
RadzenDataGrid grid;
bool isLoading;
int count;
private IEnumerable? _forecasts;
string OrderNo;
DateTime OrderDate;
private I18nText.local myText = new I18nText.local();
protected override async Task OnInitializedAsync()
{
myText = await I18nText.GetTextTableAsync(this);
}
void OnCurrentDateChanged(DateTime args)
{
OrderDate = new DateTime(args.Year, args.Month, args.Day);
}
async Task LoadData(LoadDataArgs args)
{
isLoading = true;
var result = await orderInfoDao.GetAllOrderInfo(OrderNo, OrderDate, args.Top, args.Skip);
// Update the Data property
_forecasts = result.Desserts;
// Update the count
count = result.TotalDesserts;
isLoading = false;
}
async Task reloadGrid()
{
OrderNo = "";
OrderDate = DateTime.MinValue;
await grid.Reload();
}
async Task OrderSelected(OrderInfo oi)
{
var b = await dialogService.OpenAsync(
myText.OrderDetail,
new Dictionary() { { "order", oi } },
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
);
if(b)
{
await reloadGrid();
}
}
}