@using Shared.DTOs
<Grid TItem="InvoicePaymentDTO"
      Class="table table-hover table-bordered table-striped"
      DataProvider="DataProvider"
      AllowPaging="true"
      PageSize="10"
      OnRowClick="OnRowClick"
      Responsive="true">

    <GridColumn TItem="InvoicePaymentDTO" HeaderText="شناسه">
        @context.ID
    </GridColumn>
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="شماره سوییچ">
        @context.iinn
    </GridColumn>
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="شماره پذیرنده">
        @context.acn
    </GridColumn>
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="شماره پایانه">
        @context.trmn
    </GridColumn>
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="روش پرداخت">
        @context.pmt
    </GridColumn>
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="شماره پیگیری">
        @context.trn
    </GridColumn>
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="شماره کارت پرداخت کننده">
        @context.pcn
    </GridColumn>
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="شناسه پرداخت کننده">
        @context.pid
    </GridColumn>
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="تاریخ و زمان پرداخت">
        @context.PaymentDateTime
    </GridColumn>
@*     <GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ بعد از تخفیف">
        @context.adis
    </GridColumn> *@
    <GridColumn TItem="InvoicePaymentDTO" HeaderText="مبلغ پرداختی">
        @context.pv
    </GridColumn>
</Grid>


@code {
    [Inject] ModalService ModalService { get; set; } = default!;
    [Parameter] public IEnumerable<InvoicePaymentDTO> InvoicePays { get; set; }
    private async Task<GridDataProviderResult<InvoicePaymentDTO>> DataProvider(GridDataProviderRequest<InvoicePaymentDTO> request)
    {
        if (InvoicePays is null) // pull employees only one time for client-side filtering, sorting, and paging
            InvoicePays = GetInvoicePays(); // call a service or an API to pull the employees

        return await Task.FromResult(request.ApplyTo(InvoicePays));
    }
    private async Task OnRowClick(GridRowEventArgs<InvoicePaymentDTO> args)
    {
        await ModalService.ShowAsync(new ModalOption { Type = ModalType.Primary, Title = "Event: Row Click", Message = $"Id: {args.Item.ID}, Name: {args.Item.PaymentDateTime}" });
    }
    private IEnumerable<InvoicePaymentDTO> GetInvoicePays()
    {
        return new List<InvoicePaymentDTO>();
       
    }

}