121 lines
4.9 KiB
Plaintext
121 lines
4.9 KiB
Plaintext
@page "/add/invoice"
|
||
|
||
|
||
<div class="container-fluid">
|
||
<div class="row">
|
||
<div class="col-12 mb-4">
|
||
|
||
<form onsubmit="@(() => grid.Reload())">
|
||
<RadzenFieldset Text="@myText.Search">
|
||
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
||
<RadzenRow AlignItems="AlignItems.Center">
|
||
<RadzenColumn Size="4">
|
||
<RadzenLabel Text="@myText.InvoiceNo" Component="InvoiceNo" />
|
||
</RadzenColumn>
|
||
<RadzenColumn Size="8">
|
||
<RadzenTextBox @bind-Value="InvoiceNo" Style="width: 100%;" Name="InvoiceNo"></RadzenTextBox>
|
||
</RadzenColumn>
|
||
</RadzenRow>
|
||
<RadzenRow AlignItems="AlignItems.Center">
|
||
<RadzenColumn Size="4">
|
||
<RadzenLabel Text="@myText.ApplyDate" Component="InvoiceDate" />
|
||
</RadzenColumn>
|
||
<RadzenColumn Size="8">
|
||
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" @bind-Value="InvoiceDate" Style="width: 100%;" Name="InvoiceDate" />
|
||
</RadzenColumn>
|
||
</RadzenRow>
|
||
|
||
<RadzenRow AlignItems="AlignItems.Center">
|
||
<RadzenColumn Size="12">
|
||
<RadzenButton Size="ButtonSize.Large" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="@myText.Search" />
|
||
<RadzenButton Size="ButtonSize.Large" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="@myText.Restore" ButtonStyle="ButtonStyle.Warning" />
|
||
</RadzenColumn>
|
||
</RadzenRow>
|
||
</RadzenStack>
|
||
</RadzenFieldset>
|
||
</form>
|
||
</div>
|
||
<div class="col-12 mb-4">
|
||
|
||
<RadzenDataGrid @ref="grid"
|
||
LoadData="@LoadData"
|
||
RowSelect="@((InOutInvoice oi) => { InvoiceSelected(oi); })"
|
||
IsLoading="@isLoading"
|
||
Count="@count"
|
||
EmptyText="@myText.NoDate"
|
||
Data="@_forecasts"
|
||
AllowColumnResize="true" AllowAlternatingRows="false"
|
||
SelectionMode="DataGridSelectionMode.Single"
|
||
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} <20><>{2}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>">
|
||
<Columns>
|
||
<RadzenDataGridColumn Frozen="true" Title="@myText.InvoiceNo" Property="InvoiceNo"></RadzenDataGridColumn>
|
||
<RadzenDataGridColumn Width="170px" Title="@myText.Date" Property="InvoiceDate"></RadzenDataGridColumn>
|
||
<RadzenDataGridColumn Title="@myText.ApplyPharmacy" Property="InPharmacyId"></RadzenDataGridColumn>
|
||
<RadzenDataGridColumn Title="@myText.SendPharamacy" Property="OutPharmacyId"></RadzenDataGridColumn>
|
||
</Columns>
|
||
</RadzenDataGrid>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
@code {
|
||
@inject IInOutInvoiceDao inOutInvoiceDao;
|
||
@inject DialogService dialogService;
|
||
@inject Toolbelt.Blazor.I18nText.I18nText I18nText;
|
||
private I18nText.local myText = new I18nText.local();
|
||
RadzenDataGrid<InOutInvoice> grid;
|
||
bool isLoading;
|
||
int count;
|
||
private IEnumerable<InOutInvoice>? _forecasts;
|
||
string InvoiceNo;
|
||
DateTime InvoiceDate = DateTime.MinValue;
|
||
protected override async Task OnInitializedAsync()
|
||
{
|
||
myText = await I18nText.GetTextTableAsync<I18nText.local>(this);
|
||
base.OnInitializedAsync();
|
||
}
|
||
void OnCurrentDateChanged(DateTime args)
|
||
{
|
||
InvoiceDate = new DateTime(args.Year, args.Month, args.Day);
|
||
}
|
||
|
||
async Task LoadData(LoadDataArgs args)
|
||
{
|
||
isLoading = true;
|
||
|
||
var result = await inOutInvoiceDao.GetAllInvoiceByType(InvoiceNo, InvoiceDate, args.Top, args.Skip, 1);
|
||
// Update the Data property
|
||
_forecasts = result.Desserts;
|
||
// Update the count
|
||
count = result.TotalDesserts;
|
||
|
||
isLoading = false;
|
||
}
|
||
|
||
async Task reloadGrid()
|
||
{
|
||
InvoiceNo = "";
|
||
InvoiceDate = DateTime.MinValue;
|
||
await grid.Reload();
|
||
}
|
||
|
||
async Task InvoiceSelected(InOutInvoice oi)
|
||
{
|
||
|
||
var b = await dialogService.OpenAsync<InvoiceAddDialog>(
|
||
myText.InvoiceInDetail,
|
||
new Dictionary<string, object>() { { "invoice", oi } },
|
||
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
|
||
);
|
||
if (b)
|
||
{
|
||
await reloadGrid();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
}
|