initial commit

This commit is contained in:
2026-07-21 14:14:44 +07:00
commit fa7dbb970d
1359 changed files with 104110 additions and 0 deletions
@@ -0,0 +1,98 @@
@using Indotalent.ConfigBackEnd.Extensions
@using Indotalent.Features.Inventory.StockCount
@using Indotalent.Features.Inventory.StockCount.Cqrs
@using MudBlazor
@using Indotalent.Features.Root.Shared
@inject StockCountService StockCountService
@inject IDialogService DialogService
@inject ISnackbar Snackbar
<MudPaper Elevation="0" Outlined="true" Style="border-radius: 12px; border: 1px solid #E5E7EB;">
<div style="padding: 16px; border-bottom: 1px solid #E5E7EB; display: flex; justify-content: space-between; align-items: center; background-color: #ffffff;">
<MudText Typo="Typo.button" Color="Color.Primary" Style="font-weight: 600;">Audit Items</MudText>
@if (!ReadOnly)
{
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Add" OnClick="OnAddClick" Size="Size.Small" Style="text-transform: none; font-weight: 500; border-radius: 6px;">
Add Item
</MudButton>
}
</div>
<MudTable Class="mud-table-styled" Striped="true" Items="Items" Hover="true" Elevation="0" Dense="true" T="StockCountItemResponse">
<HeaderContent>
<MudTh Style="font-weight: 500; letter-spacing: 0.05em;">Product</MudTh>
<MudTh Style="font-weight: 500; text-align: right; letter-spacing: 0.05em;">System Qty</MudTh>
<MudTh Style="font-weight: 500; text-align: right; letter-spacing: 0.05em;">Actual Qty</MudTh>
<MudTh Style="font-weight: 500; text-align: right; letter-spacing: 0.05em;">Delta</MudTh>
@if (!ReadOnly)
{
<MudTh Style="width: 100px; text-align: right; font-weight: 500; letter-spacing: 0.05em;">Actions</MudTh>
}
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Product">@context.ProductName</MudTd>
<MudTd DataLabel="Sys Qty" Style="text-align: right;">@context.QtySCSys</MudTd>
<MudTd DataLabel="Actual Qty" Style="text-align: right; font-weight: 500;">@context.QtySCCount</MudTd>
<MudTd DataLabel="Delta" Style="text-align: right;">
<MudText Typo="Typo.body2" Color="@(context.QtySCDelta == 0 ? Color.Default : Color.Error)" Style="font-weight: 500;">@context.QtySCDelta</MudText>
</MudTd>
@if (!ReadOnly)
{
<MudTd Style="text-align: right;">
<MudIconButton Icon="@Icons.Material.Filled.Edit" Size="Size.Small" Color="Color.Primary" OnClick="@(() => OnEditClick(context))" />
<MudIconButton Icon="@Icons.Material.Filled.Delete" Size="Size.Small" Color="Color.Error" OnClick="@(() => OnDeleteClick(context))" />
</MudTd>
}
</RowTemplate>
</MudTable>
</MudPaper>
<style>
.mud-table-styled .mud-table-row:hover { background-color: #F9FAFB !important; }
.mud-table-styled .mud-table-cell { padding-top: 0.75rem; padding-bottom: 0.75rem; color: #6B7280; font-size: 0.875rem; }
.mud-table-styled .mud-table-cell .mud-text-body2 { font-weight: 600; color: #374151; }
.mud-input-outlined-border { border-radius: 8px !important; }
.custom-select-dense .mud-input-control { margin-top: 0 !important; }
.custom-select-dense .mud-input-slot { padding-top: 4px !important; padding-bottom: 4px !important; padding-left: 8px !important; font-size: 12px !important; }
</style>
@code {
[Parameter] public string StockCountId { get; set; } = string.Empty;
[Parameter] public List<StockCountItemResponse> Items { get; set; } = new();
[Parameter] public bool ReadOnly { get; set; } = false;
[Parameter] public EventCallback OnChanged { get; set; }
private async Task OnAddClick()
{
var parameters = new DialogParameters { ["StockCountId"] = StockCountId };
var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true };
var dialog = await DialogService.ShowAsync<_StockCountItemCreateForm>("Add Audit Item", parameters, options);
var result = await dialog.Result;
if (result != null && !result.Canceled) await OnChanged.InvokeAsync();
}
private async Task OnEditClick(StockCountItemResponse item)
{
var parameters = new DialogParameters { ["Data"] = item };
var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true };
var dialog = await DialogService.ShowAsync<_StockCountItemUpdateForm>("Edit Audit Item", parameters, options);
var result = await dialog.Result;
if (result != null && !result.Canceled) await OnChanged.InvokeAsync();
}
private async Task OnDeleteClick(StockCountItemResponse item)
{
var parameters = new DialogParameters { ["ContentText"] = $"Are you sure you want to remove this item?" };
var dialog = await DialogService.ShowAsync<_DeleteConfirmation>("Delete Confirmation", parameters, new DialogOptions { MaxWidth = MaxWidth.ExtraSmall, FullWidth = true });
var result = await dialog.Result;
if (result != null && !result.Canceled)
{
var success = await StockCountService.DeleteStockCountItemAsync(item.Id!);
if (success)
{
Snackbar.Add("Removed successfully", Severity.Success);
await OnChanged.InvokeAsync();
}
}
}
}