FruitBankHybridApp/FruitBankHybrid.Shared/Pages/MeasuringIn.razor

190 lines
8.4 KiB
Plaintext

@page "/MeasuringIn"
@using AyCode.Utils.Extensions
@using DevExpress.Blazor
@using DevExpress.Blazor.Internal
@using FruitBank.Common.Entities
@using FruitBank.Common.SignalRs
@using FruitBankHybrid.Shared.Components
@using FruitBankHybrid.Shared.Services
@using Mango.Nop.Core.Dtos
<h3>Bejövő mérés</h3>
<div style="margin-top: 50px;">
<DxLoadingPanel @bind-Visible="LoadingPanelVisible"
IsContentBlocked="true"
ApplyBackgroundShading="true"
IndicatorAreaVisible="true"
IsContentVisible="true"
IndicatorAnimationType="WaitIndicatorAnimationType.Spin"
Text="Adatok szinkronizálása folyamatban...">
<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
<DxFormLayoutItem Caption="Dátum" ColSpanMd="2" CaptionCssClass="@(SelectedShipping != null && _measuringDates.Where(x => MeasurementService.DaysEqual(x.DateTime, SelectedShipping.ShippingDate)).All(x => x.IsMeasured) ? "text-success" : "")">
<DxDateEdit CssClass="cw-320"
DisplayFormat="m"
Format="m"
Context="ctxShippingDate"
Date="@(SelectedShipping?.ShippingDate.Date ?? DateTime.Now.Date)"
CustomDisabledDate="@OnCustomDisabledMeasuringDate"
DateChanged="@((DateTime newValue) => OnMeasuringDateChanged(newValue))"
InputId="deDisabledDates"
PickerDisplayMode="DatePickerDisplayMode.Calendar">
<DayCellTemplate>
@{
var cssClass = GetMeasuringDateCssClassNames(ctxShippingDate);
if (!cssClass.IsNullOrWhiteSpace())
{
<a class="@GetMeasuringDateCssClassNames(ctxShippingDate)">@ctxShippingDate.Day.ToString()</a>
}
else
{
<a>@ctxShippingDate.Day.ToString()</a>
}
}
</DayCellTemplate>
</DxDateEdit>
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Rendszám:" ColSpanMd="2" CaptionCssClass="@(SelectedShipping?.IsAllMeasured == true ? "text-success" : "")">
<DxComboBox Data="@NotMeasuredShippings"
@bind-Value="@SelectedShipping"
Text="Select licence plate"
ValueFieldName="@nameof(Shipping.Id)"
TextFieldName="@nameof(Shipping.LicencePlate)"
CssClass="cw-480"
DropDownBodyCssClass="dd-body-class"
Context="ctxShipping"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<Shipping> args) => OnSelectedShippingChanged(args))"
InputId="cbNotMeasuredShippings">
<ItemDisplayTemplate>
<span class="@(ctxShipping.DataItem.IsAllMeasured ? "text-success" : "")">@ctxShipping.DisplayText</span>
</ItemDisplayTemplate>
</DxComboBox>
</DxFormLayoutItem>
@* <DxFormLayoutItem Caption="Partner:" ColSpanMd="3" CaptionCssClass="@(SelectedShippingDocument?.IsAllMeasured == true ? "text-success" : "")">
<DxComboBox Data="@SelectedShipping?.ShippingDocuments"
@bind-Value="@SelectedShippingDocument"
Text="Select partner"
ValueFieldName="@nameof(ShippingDocument.Id)"
TextFieldName="@(nameof(ShippingDocument.Partner) + '.' + nameof(Partner.Name))"
CssClass="cw-480"
DropDownBodyCssClass="dd-body-class"
Context="ctxShippingDocument"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<ShippingDocument> args) => OnSelectedShippingDocumentChanged(args))"
InputId="cbShippingDocument">
<ItemDisplayTemplate>
<span class="@(ctxShippingDocument.DataItem.IsAllMeasured ? "text-success" : "")">@ctxShippingDocument.DisplayText</span>
</ItemDisplayTemplate>
</DxComboBox>
</DxFormLayoutItem>
*@
<DxFormLayoutItem Caption="Termék:" ColSpanMd="5" CaptionCssClass="@(SelectedShippingItem?.IsMeasured == true ? "text-success" : "")">
<DxComboBox Data="@_shippingItemsDataSource"
@bind-Value="@SelectedShippingItem"
Text="Select item"
ValueFieldName="@nameof(ShippingItem.Id)"
TextFieldName="@(nameof(ShippingItem.ProductName))"
CssClass="cw-480"
SearchMode="ListSearchMode.AutoSearch"
SearchFilterCondition="ListSearchFilterCondition.Contains"
SearchTextParseMode="ListSearchTextParseMode.GroupWordsByAnd"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
DropDownTriggerMode="DropDownTriggerMode.Click"
ListRenderMode="ListRenderMode.Entire"
ShowDropDownButton="false"
DropDownBodyCssClass="dd-body-class"
Context="ctxShippingitem"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<ShippingItem> args) => OnSelectedShippingItemChanged(args))"
InputId="cbShippingItem">
<ItemDisplayTemplate>
@* <div class="combobox-item-template">
<img src="/images/ok_green_lt.jpg" alt="" />
<span class="icon counter-icon" aria-hidden="true"></span>
<div class="combobox-item-template-text">
<span>@ctxShippingitem.DisplayText</span>
</div>
</div>
*@
<span class="@(ctxShippingitem.DataItem.IsMeasured ? "text-success" : "")">@ctxShippingitem.DisplayText)</span>
</ItemDisplayTemplate>
<Buttons>
<DxEditorButton IconCssClass="editor-icon editor-icon-add" Text="R" Tooltip="Adatok frissítése..."
Click="() => OnOrdersRefreshClick()" />
</Buttons>
</DxComboBox>
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Partner:" ColSpanMd="3" CaptionCssClass="@(SelectedShippingItem?.ShippingDocument?.IsAllMeasured == true ? "text-success" : "")">
@{
var sd = SelectedShippingItem?.ShippingDocument;
if (sd != null)
{
var partnerName = sd.Partner?.Name;
<span class="@(sd.IsAllMeasured == true ? " text-success" : "")">
@($"{partnerName}, {sd.ShippingItems?.Count(si => si.IsMeasured) ?? 0}/{sd.ShippingItems?.Count ?? 0} kész.")
</span>
}
}
</DxFormLayoutItem>
</DxFormLayout>
<div style="margin-top: 50px;">
@if (SelectedShippingItem is { ProductId: > 0 })
{
<h3 style="margin-bottom: 30px;" class="@(SelectedShippingItem.IsMeasured && SelectedShippingItem.ShippingItemPallets!.All(x => x.IsMeasuredAndValid(SelectedShippingItem.IsMeasurable)) ? "text-success" : "")">
#@(SelectedShippingItem.ProductId). @(SelectedShippingItem.ProductName)
</h3>
<DxFormLayout Data="@SelectedShippingItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
<DxFormLayoutItem Context="ctxShippingItemFromLayoutItem" ColSpanMd="12">
@for (var index = 0; index < (SelectedShippingItem?.ShippingItemPallets?.Count ?? 0); index++)
{
var localI = index + 1;
var currentShippingItemPallet = SelectedShippingItem!.ShippingItemPallets![index];
<PalletItemComponent IsMeasurable="@SelectedShippingItem.IsMeasurable"
MeasuringIndex="@localI"
PalletItem="@currentShippingItemPallet"
ProductId="@SelectedShippingItem.ProductId!.Value"
AddOrUpdateSignalRTag="SignalRTags.AddOrUpdateMeasuredShippingItemPallet"
OnPalletItemSaved="pallet => OnShippingItemPalletSaved(pallet)"
OnPalletItemValueChanged="pallet => OnShippingItemPalletValueChanged(pallet, SelectedShippingItem)">
</PalletItemComponent>
}
</DxFormLayoutItem>
<DxFormLayoutItem Context="vfdfgfd" ColSpanMd="12" BeginRow="true">
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem ColSpanMd="1" BeginRow="false"><strong>TOTAL:</strong></DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="2" BeginRow="false" Visible="@(SelectedShippingItem.IsMeasurable)" />
<DxFormLayoutItem ColSpanMd="2" BeginRow="false" Visible="@(SelectedShippingItem.IsMeasurable)" />
<DxFormLayoutItem ColSpanMd="2" BeginRow="false"><strong>Rekesz: @(SelectedShippingItem.MeasuredQuantity) db</strong></DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="2" BeginRow="false" Visible="@(SelectedShippingItem.IsMeasurable)"><strong>Br: @(SelectedShippingItem.MeasuredGrossWeight) kg</strong></DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="1" BeginRow="false" Visible="@(SelectedShippingItem.IsMeasurable)"><strong>Net: @(SelectedShippingItem.MeasuredNetWeight) kg</strong></DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="1" BeginRow="false" />
</DxFormLayout>
</DxFormLayoutItem>
@* <DxFormLayoutItem ColSpanMd="12" BeginRow="true">
<ValidationSummary/>
</DxFormLayoutItem> *@
@if (!_errorText.IsNullOrWhiteSpace())
{
<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
<text>HIBA! @_errorText</text>
</DxFormLayoutItem>
//_errorText = string.Empty;
}
</DxFormLayout>
}
</div>
</DxLoadingPanel>
</div>