442 lines
26 KiB
Plaintext
442 lines
26 KiB
Plaintext
@using static EgwCoreLib.Lux.Core.Enums
|
|
|
|
@if (addFromTemplate)
|
|
{
|
|
<AddFromTemplate BaseImgUrl="@($"{apiUrl}/{imgBasePath}")" EC_Close="ClosePopup" EC_ReqAdd="DoAddOrderRow" ListCataloghi="@ListCataloghi" ListTemplateAll="@ListTemplateAll"></AddFromTemplate>
|
|
}
|
|
|
|
@if (EditRecord != null && (CurrEditMode == EditMode.SerStruc || CurrEditMode == EditMode.File))
|
|
{
|
|
if (EditRecord.Envir == EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW || CurrEditMode == EditMode.SerStruc)
|
|
{
|
|
<WebWindowComplex.TableComp ListPayload="SetupList"
|
|
LiveData="CurrData"
|
|
EC_ActionReq="DoAction"
|
|
EC_DoUpdate="ExecRequest"
|
|
EC_OnClose="CloseEditJwd">
|
|
</WebWindowComplex.TableComp>
|
|
}
|
|
else
|
|
{
|
|
<BtlPreview CurrItem="EditRecord"
|
|
ApiUrl="@apiUrl"
|
|
CalcTag="@calcTag"
|
|
GenericBasePath="@genericBasePath"
|
|
ImgBasePath="@imgBasePath"
|
|
EC_ReqSave="SaveFile"
|
|
EC_OnClose="CloseEdit">
|
|
</BtlPreview>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<div class="card shadow">
|
|
<div class="card-header bg-success bg-opacity-50 bg-gradient d-flex justify-content-between">
|
|
@if (DisplayMode == DisplayMode.Preview)
|
|
{
|
|
<div class="px-0 d-flex justify-content-between">
|
|
<div class="px-1">
|
|
<b>@CurrRecord.OfferCode</b> <span class="small text-secondary">@CurrRecord.Envir</span>
|
|
</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="px-0 d-flex">
|
|
<div class="px-1">
|
|
<button class="btn btn-sm btn-success" @onclick="() => DoSelectItem()">Prodotto a Catalogo <i class="fa-solid fa-plus"></i></button>
|
|
</div>
|
|
<div class="px-1">
|
|
<button class="btn btn-sm @noteCss" @onclick="() => DoAddNote()">Nota <i class="fa-solid fa-plus"></i></button>
|
|
</div>
|
|
</div>
|
|
}
|
|
<div class="px-0 d-flex justify-content-end">
|
|
@if (DisplayMode == DisplayMode.Preview)
|
|
{
|
|
<div class="px-1">
|
|
<b>@CurrRecord.CustomerNav.FirstName</b> @CurrRecord.CustomerNav.LastName
|
|
</div>
|
|
}
|
|
else if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<div class="px-1">
|
|
<button class="btn btn-sm btn-primary" @onclick="() => OfferForceParameters()">Forza Parametri <i class="fa-solid fa-hammer"></i></button>
|
|
</div>
|
|
<div class="px-1">
|
|
<button class="btn btn-sm btn-primary" @onclick="() => OfferUpdatePrices()">Aggiorna Prezzi <i class="fa-solid fa-calculator"></i></button>
|
|
</div>
|
|
<div class="px-1">
|
|
<button class="btn btn-sm btn-primary" @onclick="() => OfferUpdateAllCosting()">Ricalcolo Completo <i class="fa-solid fa-calculator"></i></button>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
<div class="cad-body px-2">
|
|
@if (isLoading || ListRecords == null)
|
|
{
|
|
<LoadingData></LoadingData>
|
|
}
|
|
else if (totalCount == 0)
|
|
{
|
|
<div class="alert alert-info text-center fs-5">Nessun record trovato</div>
|
|
}
|
|
else
|
|
{
|
|
<table class="table table-sm table-striped">
|
|
<thead>
|
|
<tr>
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<th>
|
|
<button class="btn btn-sm btn-primary" style="min-width: 6rem;" @onclick="ForceReloadData"><i class="fa-solid fa-rotate-right"></i></button>
|
|
</th>
|
|
<th>Preview</th>
|
|
}
|
|
else
|
|
{
|
|
<th>ID</th>
|
|
}
|
|
<th>Codice</th>
|
|
<th>Descrizione</th>
|
|
<th class="text-end" title="Quantità Articoli">Qty <i class="fa-regular fa-file-lines"></i></th>
|
|
<th class="text-end">Importo</th>
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<th class="text-end" title="Cambio Materiali">Mat.</th>
|
|
<th class="text-end" title="Ciclo Lavoro">Lav.</th>
|
|
<th class="text-end" title="# Componenti Riga (Make + Buy)"><i class="fa-solid fa-folder-tree"></i></th>
|
|
}
|
|
<th class="text-end">Totale</th>
|
|
<th class="text-end">Marg.</th>
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<th></th>
|
|
}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in ListRecords)
|
|
{
|
|
<tr class="@RowClass(item)">
|
|
<td class="text-nowrap">
|
|
@if (DisplayMode == DisplayMode.Preview)
|
|
{
|
|
if (item.CalcEnabled)
|
|
{
|
|
if (item.Envir == EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW)
|
|
{
|
|
<img class="img-fluid image-hover-pop p-1" src="@(imgUrl(item.ImgType, item.ImgUID, $"{item.Envir}"))" width="48" @onclick="() => ReqEditRow()" title="Edit Item" />
|
|
}
|
|
else
|
|
{
|
|
<img class="img-fluid image-hover-pop" src="@(imgUrl(item.ImgType, item.ImgUID, $"{item.Envir}"))" width="64" @onclick="() => ReqEditRow()" title="Edit Item" />
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!item.IsNote)
|
|
{
|
|
|
|
<img class="img-fluid p-1" src="@(imgUrl(item.ImgType, item.ImgUID, $"{item.Envir}"))" width="48" @onclick="() => ReqEditRow()" />
|
|
}
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
<span class="px-1">
|
|
<button class="btn btn-sm btn-primary" @onclick="() => DoSelect(item)"><i class="fa-solid fa-magnifying-glass"></i></button>
|
|
</span>
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
if (CurrEditMode == EditMode.None)
|
|
{
|
|
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(item)"><i class="fa-solid fa-pencil"></i></button>
|
|
<button class="btn btn-sm btn-warning" @onclick="() => DoClone(item)"><i class="fa-solid fa-wand-magic" title="Duplica Articoo (Riga Offerta)"></i></button>
|
|
}
|
|
else
|
|
{
|
|
if (EditRecord != null && EditRecord.OfferRowID == item.OfferRowID)
|
|
{
|
|
<button class="btn btn-sm btn-success" title="Salva Modifiche" @onclick="() => DoSave(item)"><i class="fa-solid fa-floppy-disk"></i></button>
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
@item.RowNum
|
|
}
|
|
}
|
|
</td>
|
|
@if (item.IsNote)
|
|
{
|
|
<td colspan="10" class="small">
|
|
@if (CurrEditMode == EditMode.RecData && EditRecord != null && EditRecord.OfferRowID == item.OfferRowID)
|
|
{
|
|
<div class="input-group">
|
|
<textarea class="form-input w-100" style="height: 4rem;" type="text" @bind="@item.Note" />
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
@HtmlConv(item.Note)
|
|
}
|
|
</td>
|
|
}
|
|
else
|
|
{
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<td>
|
|
@if (item.CalcEnabled)
|
|
{
|
|
if (item.Envir == EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW)
|
|
{
|
|
<img class="img-fluid image-hover-pop p-1" src="@(imgUrl(item.ImgType, item.ImgUID, $"{item.Envir}"))" width="64" @onclick="() => DoEditJwd(item)" title="Edit Item" />
|
|
}
|
|
else
|
|
{
|
|
<img class="img-fluid image-hover-pop" src="@(imgUrl(item.ImgType, item.ImgUID, $"{item.Envir}"))" width="150" @onclick="() => DoEditFile(item)" title="Edit Item" />
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!item.IsNote)
|
|
{
|
|
<img class="img-fluid p-1" src="@(imgUrl(item.ImgType, item.ImgUID, $"{item.Envir}"))" width="64" />
|
|
}
|
|
}
|
|
</td>
|
|
}
|
|
<td>
|
|
<ul class="list-group">
|
|
<li class="list-group-item d-flex justify-content-between align-items-start align-items-center px-2 py-1">
|
|
<div class="fw-bold">@item.OfferRowUID</div>
|
|
@if (ShowBom(item))
|
|
{
|
|
@if (CurrEditMode == EditMode.None)
|
|
{
|
|
<button class="btn btn-sm btn-primary" @onclick="() => RequestBom(item)" title="Richiesta ricalcolo BOM">
|
|
BOM <i class="fa-solid fa-arrow-right-arrow-left pe-2"></i>
|
|
@if (item.AwaitBom)
|
|
{
|
|
<span class="text-warning spinner-grow spinner-grow-sm" aria-hidden="true"></span>
|
|
}
|
|
</button>
|
|
}
|
|
else
|
|
{
|
|
<button class="btn btn-sm btn-secondary disabled">
|
|
BOM <i class="fa-solid fa-arrow-right-arrow-left pe-2"></i>
|
|
@if (item.AwaitBom)
|
|
{
|
|
<span class="text-warning spinner-grow spinner-grow-sm" aria-hidden="true"></span>
|
|
}
|
|
</button>
|
|
}
|
|
}
|
|
</li>
|
|
@if (item.CalcEnabled)
|
|
{
|
|
@if (item.Envir != EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW || !string.IsNullOrEmpty(item.FileName))
|
|
{
|
|
<li class="list-group-item d-flex justify-content-between align-items-start px-2 py-1 small">
|
|
<div class="mx-0">
|
|
<div class="">@item.FileName</div>
|
|
</div>
|
|
<span class="small">@fSize(item.FileSize)</span>
|
|
</li>
|
|
}
|
|
}
|
|
@if (DisplayMode != DisplayMode.Preview)
|
|
{
|
|
<li class="list-group-item px-2 py-1 small"><a href="@(DownloadUrl(item.OfferRowUID))" target="_blank" class="btn btn-sm btn-success">Download <i class="fa-solid fa-download"></i></a></li>
|
|
}
|
|
</ul>
|
|
</td>
|
|
@if (CurrEditMode == EditMode.RecData && EditRecord != null && EditRecord.OfferRowID == item.OfferRowID)
|
|
{
|
|
<td>
|
|
<div class="input-group">
|
|
<input class="form-control w-100" style="width: 16rem;" type="text" @bind="@item.Note" />
|
|
</div>
|
|
</td>
|
|
<td class="text-end">
|
|
<input class="form-control text-end" style="width: 4rem;" type="number" @bind="@item.Qty" />
|
|
</td>
|
|
}
|
|
else
|
|
{
|
|
<td>@item.Note</td>
|
|
<td class="text-end fs-4">
|
|
<b>@item.Qty</b>
|
|
</td>
|
|
}
|
|
<td class="text-end text-nowrap">
|
|
<div class="fw-bold" title="Prezzo Finito">
|
|
@if (!(item.BomOk && item.ItemOk))
|
|
{
|
|
<span class="text-danger me-2" title=""><i class="fa-solid fa-triangle-exclamation"></i></span>
|
|
}
|
|
@if (item.AwaitPrice)
|
|
{
|
|
<span class="text-warning spinner-grow spinner-grow-sm" aria-hidden="true"></span>
|
|
}
|
|
@($"{item.UnitPrice:C2}")
|
|
</div>
|
|
<div class="small text-secondary" title="RockBottom Price">(@item.UnitCost.ToString("C2"))</div>
|
|
</td>
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<td class="text-center">
|
|
@if (!string.IsNullOrEmpty(item.ItemBOM))
|
|
{
|
|
<div>
|
|
<button class="btn btn-sm btn-info" title="Cambio materiali assegnati" @onclick="() => DoSwapMat(item)"><i class="fa-solid fa-arrow-right-arrow-left"></i></button>
|
|
</div>
|
|
}
|
|
<diiv class="small">
|
|
@item.ProdItemQty
|
|
</diiv>
|
|
</td>
|
|
<td class="text-center">
|
|
@if (!string.IsNullOrEmpty(item.ItemSteps))
|
|
{
|
|
<button class="btn btn-sm btn-info" title="Verifica Ciclo/Fasi di Lavoro" @onclick="() => DoSwapJobCycle(item)"><i class="fa-solid fa-arrow-right-arrow-left"></i></button>
|
|
}
|
|
</td>
|
|
<td class="text-end">
|
|
@item.ProdItemQtyTot
|
|
</td>
|
|
}
|
|
<td class="text-end text-nowrap">
|
|
<div class="fw-bold" title="Prezzo Finito">
|
|
@if (item.AwaitPrice)
|
|
{
|
|
<span class="text-warning spinner-grow spinner-grow-sm" aria-hidden="true"></span>
|
|
}
|
|
@($"{item.TotalPrice:C2}")
|
|
</div>
|
|
<div class="small text-secondary" title="RockBottom Price">(@item.TotalCost.ToString("C2"))</div>
|
|
</td>
|
|
<td class="text-end text-nowrap" title="Margine / Sconto MAX applicabile">
|
|
@item.MaxDiscount.ToString("P2")
|
|
</td>
|
|
}
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<td>
|
|
@if (CurrEditMode == EditMode.RecData && EditRecord != null && EditRecord.OfferRowID == item.OfferRowID)
|
|
{
|
|
<button class="btn btn-sm btn-warning" title="Annulla Modifiche" @onclick="DoCancel"><i class="fa-solid fa-ban"></i></button>
|
|
}
|
|
else
|
|
{
|
|
<button class="btn btn-sm btn-danger" title="Eliminazione riga" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
|
}
|
|
</td>
|
|
}
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
<tfoot>
|
|
<tr class="table-success">
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<td colspan="4"></td>
|
|
}
|
|
else
|
|
{
|
|
<td colspan="3"></td>
|
|
}
|
|
<td class="text-end">@($"{GrandTotQty:N0}")</td>
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<td colspan="3"></td>
|
|
<td class="text-end">@($"{GrandTotNumItems:N0}")</td>
|
|
}
|
|
else
|
|
{
|
|
<td colspan="1"></td>
|
|
}
|
|
<th class="text-end">
|
|
@($"{GrandTotPrice:C2}")
|
|
<div class="small text-secondary" title="RockBottom Price">(@($"{GrandTotCost:C2}"))</div>
|
|
</th>
|
|
<th class="text-end">@($"{GrandTotMargin:P2}")</th>
|
|
@if (DisplayMode == DisplayMode.Edit)
|
|
{
|
|
<th></th>
|
|
}
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
@if (EditRecord != null)
|
|
{
|
|
if (CurrEditMode == EditMode.BOM)
|
|
{
|
|
<div class="modal" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" role="dialog">
|
|
<div class="modal-dialog modal-xl">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<div class="row w-100">
|
|
<div class="col-4 fs-3">
|
|
Materiali (BOM)
|
|
</div>
|
|
<div class="col-4 text-center text-bg-secondary bg-gradient border border-2 rounded">
|
|
<div class="fw-bold">@EditRecord.Note</div>
|
|
<small class="small">@EditRecord.OfferRowUID</small>
|
|
</div>
|
|
<div class="col-4 text-end fs-4">
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="ClosePopup">
|
|
</button>
|
|
<div class="form-check form-switch small" title="Abilita editing massivo">
|
|
<input class="form-check-input" type="checkbox" role="switch" @bind="enableMassEdit">
|
|
<label class="form-check-label">Mass Edit</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-body">
|
|
<EditBom CurrRowRec="@EditRecord" MassEdit="enableMassEdit" BomList="CurrBomList" EC_Updated="UpdateBom"></EditBom>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
else if (CurrEditMode == EditMode.JobCycle)
|
|
{
|
|
|
|
<div class="modal" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" role="dialog">
|
|
<div class="modal-dialog modal-xl">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<div class="row w-100">
|
|
<div class="col-4 fs-3">
|
|
Lavorazioni (Cicli)
|
|
</div>
|
|
<div class="col-4 text-center border border-2 rounded">
|
|
<div class="fw-bold">@EditRecord.Note</div>
|
|
<small class="small">@EditRecord.OfferRowUID</small>
|
|
</div>
|
|
<div class="col-4 text-end fs-4">
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="ClosePopup">
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-body">
|
|
<EditJob></EditJob>
|
|
@* <EditBom BomList="@CurrBomList" EC_Updated="UpdateBom"></EditBom> *@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|