Files

179 lines
8.8 KiB
Plaintext

<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-0">
<div class="d-flex">
<div class="px-0">
<h3>Articoli</h3>
</div>
<div class="px-2">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" @bind="OnlyActive">
<label class="form-check-label">@actMessage</label>
</div>
</div>
<div class="px-2">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" @bind="ShowRemn">
<label class="form-check-label">@remnMessage</label>
</div>
</div>
</div>
</div>
<div class="px-0">
<div class="d-flex">
<div class="px-2">
@if (CurrItem == null)
{
<button class="btn btn-success" @onclick="()=>CreateNew()"><i class="fa-solid fa-square-plus"></i> Add New</button>
}
else
{
<button class="btn btn-warning" @onclick="()=> DoEdit(null)"><i class="fa-solid fa-ban"></i> Cancel</button>
}
</div>
</div>
</div>
</div>
@if (CurrItem != null)
{
<hr />
<ItemEdit CurrRecord="CurrItem" KeyNum="@KeyNum" EC_update="ForceReload"></ItemEdit>
}
</div>
<div class="card-body p-1">
@if (ListRecords == null || isLoading)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-info">Nessun record trovato</div>
}
else
{
<table class="table table-striped table-sm text-start">
<thead>
<tr class="">
<th>
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(null)"><i class="fa-solid fa-rotate"></i></button>
</th>
<th class="text-end">Qty <Sorter ParamName="Qty" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th>ID <Sorter ParamName="RawItemId" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th>A/S <Sorter ParamName="IsRemn" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th>Note <Sorter ParamName="Note" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th>Posizione <Sorter ParamName="Location" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
@if (MaterialSel.IsWall)
{
<th class="text-end">W (mm) <Sorter ParamName="W" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
}
@* <th class="text-end">H (mm) <Sorter ParamName="H" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th> *@
<th class="text-end">L (mm) <Sorter ParamName="L" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<AuthorizeView Roles="SuperAdmin, Admin">
<Authorized>
<th></th>
</Authorized>
</AuthorizeView>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecords)
{
string cssRow = item.IsDeleted ? "text-strike" : "";
<tr class="align-middle @CheckSel(item) @cssRow">
<td>
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
@if (item.IsDeleted)
{
<button class="btn btn-warning btn-sm" @onclick="() => ReactivRecord(item)" title="Riattivazione Record"><i class="fa-regular fa-thumbs-up"></i></button>
}
else
{
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
}
</td>
<td class="text-end fs-5">
<b>@item.QtyAvail</b>
</td>
<td>
@if (item.IsDeleted)
{
<span class="border border-info rounded px-1">
<i class="fa-regular fa-thumbs-down"></i>
</span>
}
else
{
<span class="border border-primary rounded px-1">
<i class="fa-regular fa-thumbs-up"></i>
</span>
}
&nbsp;@item.RawItemId
</td>
<td>
@if (item.IsRemn)
{
<i class="fas fa-not-equal" title="Spezzone"></i>
}
else
{
<i class="fas fa-equals" title="Acquisto"></i>
}
</td>
<td>
@item.Note
</td>
<td>
@item.Location
</td>
@if (MaterialSel.IsWall)
{
<td class="text-end">
@if (hasDecimal(item.WMm))
{
@($"{item.WMm:N2}")
}
else
{
@($"{item.WMm:N0}")
}
</td>
}
<td class="text-end">
@if (hasDecimal(item.LMm))
{
@($"{item.LMm:N2}")
}
else
{
@($"{item.LMm:N0}")
}
</td>
<AuthorizeView Roles="SuperAdmin, Admin, SuperUser">
<Authorized>
<td class="text-end">
@if (item.QtyAvail <= 0 && !item.IsDeleted)
{
<button class="btn btn-danger btn-sm" @onclick="() => DeleteRecord(item)"><i class="fa-solid fa-trash"></i></button>
}
else
{
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
}
</td>
</Authorized>
</AuthorizeView>
</tr>
}
</tbody>
</table>
}
</div>
<div class="card-footer">
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
</div>
</div>