initial commit

This commit is contained in:
2026-07-21 14:22:06 +07:00
commit 2d7959f202
572 changed files with 45295 additions and 0 deletions
@@ -0,0 +1,93 @@
@using Indotalent.Features.Multitenant.Tenant
@using Indotalent.Features.Multitenant.Tenant.Cqrs
@using MudBlazor
@using Features.Root.Shared
@inject TenantService TenantService
@inject IDialogService DialogService
@inject ISnackbar Snackbar
<MudPaper Elevation="0" Outlined="true" Style="border-radius: 0px; border: 1px solid #E5E7EB;">
<div style="padding: 16px; border-bottom: 1px solid #E5E7EB; display: flex; justify-content: space-between; align-items: center; background-color: #F8FAFC;">
<MudText Typo="Typo.button" Color="Color.Primary" Style="font-weight: 600;">Tenant Users</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 User
</MudButton>
}
</div>
<MudTable Items="Users" Hover="true" Striped="true" Class="mud-table-styled" Elevation="0" Dense="true" T="TenantUserItemResponse">
<HeaderContent>
<MudTh Style="font-weight: 700;">User ID</MudTh>
<MudTh Style="font-weight: 700;">Summary</MudTh>
<MudTh Style="font-weight: 700; text-align: center;">Is Active</MudTh>
@if (!ReadOnly)
{
<MudTh Style="width: 100px; text-align: right; font-weight: 700;">Actions</MudTh>
}
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="UserId">@context.UserId</MudTd>
<MudTd DataLabel="Summary">@context.Summary</MudTd>
<MudTd DataLabel="IsActive" Style="text-align: center;">
@if (context.IsActive)
{
<MudChip T="string" Color="Color.Success" Size="Size.Small" Variant="Variant.Text" Style="font-weight: 600;">ACTIVE</MudChip>
}
else
{
<MudChip T="string" Color="Color.Error" Size="Size.Small" Variant="Variant.Text" Style="font-weight: 600;">INACTIVE</MudChip>
}
</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>
@code {
[Parameter] public string TenantId { get; set; } = string.Empty;
[Parameter] public List<TenantUserItemResponse> Users { get; set; } = new();
[Parameter] public bool ReadOnly { get; set; } = false;
[Parameter] public EventCallback OnChanged { get; set; }
private async Task OnAddClick()
{
var parameters = new DialogParameters { ["TenantId"] = TenantId };
var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true };
var dialog = await DialogService.ShowAsync<_TenantUserCreateForm>("Add Tenant User", parameters, options);
var result = await dialog.Result;
if (result != null && !result.Canceled) await OnChanged.InvokeAsync();
}
private async Task OnEditClick(TenantUserItemResponse item)
{
var parameters = new DialogParameters { ["Data"] = item };
var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true };
var dialog = await DialogService.ShowAsync<_TenantUserUpdateForm>("Edit Tenant User", parameters, options);
var result = await dialog.Result;
if (result != null && !result.Canceled) await OnChanged.InvokeAsync();
}
private async Task OnDeleteClick(TenantUserItemResponse item)
{
var parameters = new DialogParameters { ["ContentText"] = $"Are you sure you want to remove this user?" };
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 TenantService.DeleteTenantUserAsync(item.Id!);
if (success)
{
Snackbar.Add("User removed successfully", Severity.Success);
await OnChanged.InvokeAsync();
}
}
}
}