96 lines
4.0 KiB
Plaintext
96 lines
4.0 KiB
Plaintext
@page "/admin"
|
|
|
|
@using SytelineSaAppEfDataModel.Dtos
|
|
@using Syncfusion.Blazor.Cards
|
|
@using Syncfusion.Blazor.Grids
|
|
@using Action = Syncfusion.Blazor.Grids.Action
|
|
|
|
@inject EdiCustomerOrderTranslateService EdiCustomerOrderTranslateService
|
|
|
|
<div class="h-100 d-flex justify-content-center align-items-start">
|
|
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
|
<CardHeader>
|
|
<h3 class="text-primary">Zarządzanie powiązaniami zamówień z DELFORami</h3>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<SfGrid DataSource="@OrderTranslations"
|
|
AllowFiltering="true"
|
|
AllowPaging="true"
|
|
AllowSorting="true"
|
|
AllowSelection="true"
|
|
EnableAdaptiveUI="true"
|
|
EnablePersistence="true"
|
|
AdaptiveUIMode="AdaptiveMode.Both"
|
|
Toolbar="@(new List<string> { "Edit", "Delete", "Cancel", "Update" })">
|
|
<GridColumns>
|
|
<GridColumn Field=@nameof(EdiCustomerOrderTranslateDto.Id) AllowEditing="false" IsPrimaryKey="true" Visible="false" HeaderText="Id"
|
|
Width="100"></GridColumn>
|
|
<GridColumn Field=@nameof(EdiCustomerOrderTranslateDto.ScheduleOrderId) HeaderText="DELFOR Id" Width="150"></GridColumn>
|
|
<GridColumn Field=@nameof(EdiCustomerOrderTranslateDto.EdiCoCoNum) HeaderText="Numer zamówienia EDI" Width="150"></GridColumn>
|
|
<GridColumn Field=@nameof(EdiCustomerOrderTranslateDto.CoCoNum) HeaderText="Numer zamówienia SL" Width="200"></GridColumn>
|
|
<GridColumn Field=@nameof(EdiCustomerOrderTranslateDto.CreatedDate) AllowEditing="false" HeaderText="Data utworzenia"
|
|
Width="150"></GridColumn>
|
|
</GridColumns>
|
|
<GridEditSettings AllowDeleting="true"
|
|
ShowDeleteConfirmDialog="true"
|
|
AllowEditing="true">
|
|
</GridEditSettings>
|
|
<GridEvents OnActionBegin="OnActionBegin"
|
|
OnActionComplete="OnActionComplete"
|
|
TValue="EdiCustomerOrderTranslateDto">
|
|
</GridEvents>
|
|
<GridPageSettings PageSize="10"></GridPageSettings>
|
|
<GridFilterSettings Type="FilterType.Excel"/>
|
|
</SfGrid>
|
|
</CardContent>
|
|
<CardFooter>
|
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
|
</CardFooter>
|
|
</SfCard>
|
|
</div>
|
|
|
|
@code {
|
|
private List<EdiCustomerOrderTranslateDto> OrderTranslations { get; set; } = new();
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender)
|
|
{
|
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
|
//
|
|
// if (currentUser.Identity?.IsAuthenticated == false || currentUser.Identity?.Name != "pkus")
|
|
// {
|
|
// NavigationManager.NavigateTo("/Unauthorized");
|
|
// }
|
|
// else
|
|
// {
|
|
await LoadTranslations();
|
|
StateHasChanged();
|
|
// }
|
|
}
|
|
}
|
|
|
|
public async Task OnActionBegin(ActionEventArgs<EdiCustomerOrderTranslateDto> args)
|
|
{
|
|
if (args.RequestType.Equals(Action.Delete))
|
|
{
|
|
await EdiCustomerOrderTranslateService.DeleteEdiCustomerOrderTranslateAsync(args.Data);
|
|
}
|
|
}
|
|
|
|
private async Task LoadTranslations()
|
|
{
|
|
OrderTranslations = (await EdiCustomerOrderTranslateService.GetEdiCustomerOrdersTranslationsAsync() ?? Array.Empty<EdiCustomerOrderTranslateDto>()).OrderByDescending(x => x.CreatedDate).ToList();
|
|
}
|
|
|
|
private async Task OnActionComplete(ActionEventArgs<EdiCustomerOrderTranslateDto> args)
|
|
{
|
|
switch (args.RequestType)
|
|
{
|
|
case Action.Delete:
|
|
await LoadTranslations();
|
|
break;
|
|
}
|
|
}
|
|
|
|
} |