refactor: remove stock management fields from BulkEdit and related logic; adjust layout in ProductFormDialog and CreateDialog
Build and Deploy / build (push) Failing after 15s
Build and Deploy / build (push) Failing after 15s
This commit is contained in:
@@ -46,14 +46,6 @@
|
||||
Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudNumericField @bind-Value="Model.InitialCount"
|
||||
Label="موجودی اولیه *"
|
||||
Required="true"
|
||||
Min="0"
|
||||
Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudNumericField @bind-Value="Model.SortOrder"
|
||||
Label="ترتیب نمایش"
|
||||
|
||||
@@ -126,28 +126,6 @@
|
||||
|
||||
<MudDivider />
|
||||
|
||||
<MudText Typo="Typo.subtitle2">موجودی</MudText>
|
||||
|
||||
<MudSelect T="StockUpdateType?"
|
||||
Label="نوع تغییر موجودی"
|
||||
Clearable="true"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense"
|
||||
@bind-Value="_stockUpdateType">
|
||||
<MudSelectItem Value="@(StockUpdateType.Set)">تنظیم روی مقدار ثابت</MudSelectItem>
|
||||
<MudSelectItem Value="@(StockUpdateType.Add)">افزایش به مقدار فعلی</MudSelectItem>
|
||||
<MudSelectItem Value="@(StockUpdateType.Subtract)">کاهش از مقدار فعلی</MudSelectItem>
|
||||
</MudSelect>
|
||||
|
||||
<MudNumericField T="int?"
|
||||
HideSpinButtons="true"
|
||||
Label="مقدار موجودی"
|
||||
@bind-Value="_stockQuantity"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense" />
|
||||
|
||||
<MudDivider />
|
||||
|
||||
<MudText Typo="Typo.subtitle2">وضعیت</MudText>
|
||||
|
||||
<MudSelect T="bool?"
|
||||
|
||||
@@ -24,9 +24,6 @@ public partial class BulkEdit
|
||||
private int? _newDiscount;
|
||||
private int? _newClubDiscountPercent;
|
||||
|
||||
private StockUpdateType? _stockUpdateType;
|
||||
private int? _stockQuantity;
|
||||
|
||||
private bool? _statusEnable;
|
||||
|
||||
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
||||
@@ -98,8 +95,6 @@ public partial class BulkEdit
|
||||
_newPrice = null;
|
||||
_newDiscount = null;
|
||||
_newClubDiscountPercent = null;
|
||||
_stockUpdateType = null;
|
||||
_stockQuantity = null;
|
||||
_statusEnable = null;
|
||||
}
|
||||
|
||||
@@ -112,16 +107,15 @@ public partial class BulkEdit
|
||||
}
|
||||
|
||||
var hasPriceChanges = _newPrice.HasValue;
|
||||
var hasStockChanges = _stockUpdateType.HasValue && _stockQuantity.HasValue && _stockQuantity.Value > 0;
|
||||
var hasStatusChange = _statusEnable.HasValue;
|
||||
|
||||
if (!hasPriceChanges && !hasStockChanges && !hasStatusChange)
|
||||
if (!hasPriceChanges && !hasStatusChange)
|
||||
{
|
||||
Snackbar.Add("هیچ تغییری برای اعمال انتخاب نشده است.", Severity.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var confirmationText = BuildConfirmationText(hasPriceChanges, hasStockChanges, hasStatusChange);
|
||||
var confirmationText = BuildConfirmationText(hasPriceChanges, hasStatusChange);
|
||||
|
||||
var options = new DialogOptions { CloseOnEscapeKey = true, MaxWidth = MaxWidth.Small };
|
||||
bool? confirmed = await DialogService.ShowMessageBox(
|
||||
@@ -178,32 +172,6 @@ public partial class BulkEdit
|
||||
}
|
||||
}
|
||||
|
||||
if (hasStockChanges)
|
||||
{
|
||||
var stockRequest = new BulkUpdateProductStockRequest
|
||||
{
|
||||
UpdateType = _stockUpdateType!.Value
|
||||
};
|
||||
|
||||
foreach (var id in _selectedProductIds)
|
||||
{
|
||||
stockRequest.Products.Add(new ProductStockUpdate
|
||||
{
|
||||
ProductId = id,
|
||||
Quantity = _stockQuantity!.Value
|
||||
});
|
||||
}
|
||||
|
||||
var stockResponse = await ProductsContract.BulkUpdateProductStockAsync(stockRequest);
|
||||
|
||||
if (stockResponse != null)
|
||||
{
|
||||
total += stockResponse.Total;
|
||||
succeeded += stockResponse.Succeeded;
|
||||
failed += stockResponse.Failed;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasStatusChange)
|
||||
{
|
||||
var toggleRequest = new ToggleProductStatusRequest
|
||||
@@ -247,7 +215,7 @@ public partial class BulkEdit
|
||||
}
|
||||
}
|
||||
|
||||
private string BuildConfirmationText(bool hasPriceChanges, bool hasStockChanges, bool hasStatusChange)
|
||||
private string BuildConfirmationText(bool hasPriceChanges, bool hasStatusChange)
|
||||
{
|
||||
var parts = new List<string>();
|
||||
|
||||
@@ -264,19 +232,6 @@ public partial class BulkEdit
|
||||
parts.Add(pricePart);
|
||||
}
|
||||
|
||||
if (hasStockChanges)
|
||||
{
|
||||
var stockAction = _stockUpdateType switch
|
||||
{
|
||||
StockUpdateType.Set => "تنظیم موجودی روی",
|
||||
StockUpdateType.Add => "افزایش موجودی به میزان",
|
||||
StockUpdateType.Subtract => "کاهش موجودی به میزان",
|
||||
_ => "تغییر موجودی"
|
||||
};
|
||||
|
||||
parts.Add($"• {stockAction} {_stockQuantity}");
|
||||
}
|
||||
|
||||
if (hasStatusChange)
|
||||
{
|
||||
var statusText = _statusEnable == true ? "فعالسازی" : "غیرفعالسازی";
|
||||
|
||||
@@ -57,12 +57,9 @@
|
||||
</MudStack>
|
||||
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||
<MudItem xs="6">
|
||||
<MudItem xs="12">
|
||||
<MudNumericField T="int" HideSpinButtons="true" @bind-Value="Model.Discount" Disabled="_isLoading" Label="تخفیف (%)" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||
</MudItem>
|
||||
<MudItem xs="6">
|
||||
<MudNumericField T="int" HideSpinButtons="true" @bind-Value="Model.RemainingCount" Disabled="_isLoading" Label="تعداد موجودی" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||
</MudItem>
|
||||
</MudStack>
|
||||
|
||||
<MudTextField T="string" @bind-Value="Model.ShortInfomation" Disabled="_isLoading" Label="خلاصه" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||
|
||||
@@ -43,12 +43,9 @@
|
||||
</MudStack>
|
||||
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||
<MudItem xs="6">
|
||||
<MudItem xs="12">
|
||||
<MudNumericField T="int" HideSpinButtons="true" @bind-Value="Model.Discount" Disabled="_isLoading" Label="تخفیف (%)" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||
</MudItem>
|
||||
<MudItem xs="6">
|
||||
<MudNumericField T="int" HideSpinButtons="true" @bind-Value="Model.RemainingCount" Disabled="_isLoading" Label="تعداد موجودی" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||
</MudItem>
|
||||
</MudStack>
|
||||
|
||||
<MudTextField T="string" @bind-Value="Model.ShortInfomation" Disabled="_isLoading" Label="خلاصه" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||
|
||||
Reference in New Issue
Block a user