@using Indotalent.Features.Purchase.PaymentDisburse.Cqrs
@using MudBlazor

<MudPaper Elevation="0" Outlined="true" Style="border-radius: 12px; border: 1px solid #E5E7EB;">
    <div style="padding: 16px; border-bottom: 1px solid #E5E7EB; background-color: #F9FAFB;">
        <MudText Typo="Typo.button" Style="font-weight: 600;">Referenced Bill Items</MudText>
    </div>

    <MudTable Striped="true" Class="mud-table-styled" Items="Items" Hover="true" Elevation="0" Dense="true" T="PaymentDisburseItemResponse">
        <HeaderContent>
            <MudTh Style="font-weight: 700; color: #111827;">Product</MudTh>
            <MudTh Style="font-weight: 700; color: #111827; text-align: right;">UnitPrice</MudTh>
            <MudTh Style="font-weight: 600; color: #6B7280; text-transform: uppercase; font-size: 0.6875rem; letter-spacing: 0.05em; text-align: right;">Quantity</MudTh>
            <MudTh Style="font-weight: 600; color: #6B7280; text-transform: uppercase; font-size: 0.6875rem; letter-spacing: 0.05em; text-align: right;">Total</MudTh>
        </HeaderContent>
        <RowTemplate>
            <MudTd DataLabel="Product" Style="padding-top: 0.75rem; padding-bottom: 0.75rem; color: #6B7280; font-size: 0.875rem;">
                <MudText Typo="Typo.body2" Style="font-weight: 600;">@context.ProductName</MudText>
                @if (!string.IsNullOrEmpty(context.Summary))
                {
                    <MudText Typo="Typo.caption" Color="Color.Secondary">@context.Summary</MudText>
                }
            </MudTd>
            <MudTd DataLabel="UnitPrice" Style="text-align: right;">@context.UnitPrice.ToString("N2")</MudTd>
            <MudTd DataLabel="Quantity" Style="text-align: right;">@context.Quantity</MudTd>
            <MudTd DataLabel="Total" Style="text-align: right; font-weight: 700;">@context.Total.ToString("N2")</MudTd>
        </RowTemplate>
    </MudTable>
</MudPaper>


<style>
    .mud-table-styled .mud-table-row:hover { background-color: #F9FAFB !important; }
</style>

@code {
    [Parameter] public List<PaymentDisburseItemResponse> Items { get; set; } = new();
}