This commit is contained in:
@@ -46,61 +46,44 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudDataGrid T="Contract"
|
||||
Items="@contracts"
|
||||
Dense="true"
|
||||
Hover="true"
|
||||
Striped="true"
|
||||
|
||||
RowsPerPage="30"
|
||||
SelectedItem="@selectedContract"
|
||||
SelectedItemChanged="OnRowSelected"
|
||||
Class="admin-grid">
|
||||
<Columns>
|
||||
<PropertyColumn Property="x => x.Id" Title="ID" Sortable="true" />
|
||||
<TemplateColumn Title="고객">
|
||||
<CellTemplate>
|
||||
@if (clientMap.TryGetValue(context.Item.ClientId, out var clientName))
|
||||
{
|
||||
@clientName
|
||||
}
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<PropertyColumn Property="x => x.ContractNumber" Title="계약번호" />
|
||||
<PropertyColumn Property="x => x.ServiceType" Title="서비스 유형" />
|
||||
<PropertyColumn Property="x => x.MonthlyFee" Title="월 수수료" Format="C" />
|
||||
<TemplateColumn Title="계약기간">
|
||||
<CellTemplate>
|
||||
@context.Item.StartDate.ToString("yyyy-MM-dd")
|
||||
@if (context.Item.EndDate.HasValue)
|
||||
{
|
||||
<span>~@context.Item.EndDate.Value.ToString("yyyy-MM-dd")</span>
|
||||
}
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="상태">
|
||||
<CellTemplate>
|
||||
@{
|
||||
var isActive = !context.Item.EndDate.HasValue || context.Item.EndDate.Value >= DateTime.Today;
|
||||
}
|
||||
@if (isActive)
|
||||
{
|
||||
<MudChip Size="Size.Small" Color="Color.Success" Variant="Variant.Filled">활성</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip Size="Size.Small" Color="Color.Default" Variant="Variant.Outlined">만료</MudChip>
|
||||
}
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="작업" Sortable="false">
|
||||
<CellTemplate>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Delete" Color="Color.Error" Size="Size.Small"
|
||||
OnClick="@(async () => await DeleteContract(context.Item.Id))" />
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</Columns>
|
||||
</MudDataGrid>
|
||||
<table class="admin-grid table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>고객</th>
|
||||
<th>계약번호</th>
|
||||
<th>서비스 유형</th>
|
||||
<th>월 수수료</th>
|
||||
<th>계약기간</th>
|
||||
<th>상태</th>
|
||||
<th>작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in contracts)
|
||||
{
|
||||
var isActive = !item.EndDate.HasValue || item.EndDate.Value >= DateTime.Today;
|
||||
<tr @onclick="() => OnRowSelected(item)" style="cursor:pointer;">
|
||||
<td>@item.Id</td>
|
||||
<td>@clientMap.GetValueOrDefault(item.ClientId)</td>
|
||||
<td>@item.ContractNumber</td>
|
||||
<td>@item.ServiceType</td>
|
||||
<td>@(item.MonthlyFee?.ToString("C") ?? string.Empty)</td>
|
||||
<td>
|
||||
@item.StartDate.ToString("yyyy-MM-dd")
|
||||
@if (item.EndDate.HasValue)
|
||||
{
|
||||
<span>~@item.EndDate.Value.ToString("yyyy-MM-dd")</span>
|
||||
}
|
||||
</td>
|
||||
<td>@(isActive ? "활성" : "만료")</td>
|
||||
<td>
|
||||
<button type="button" class="mud-button-root mud-button mud-button-text mud-ripple" @onclick:stopPropagation="true" @onclick="@(async () => await DeleteContract(item.Id))">삭제</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</MudItem>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user