feat: enhance category selection in ProductFormDialog with multi-selection text and improved error handling
Build and Deploy / build (push) Failing after 16s
Build and Deploy / build (push) Failing after 16s
This commit is contained in:
@@ -116,6 +116,7 @@
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense"
|
||||
MultiSelection="true"
|
||||
MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionText))"
|
||||
Disabled="_loading"
|
||||
T="long">
|
||||
@foreach (var category in _categories)
|
||||
@@ -193,9 +194,11 @@
|
||||
{
|
||||
var tree = await CategoryService.GetCategoriesAsync(isActive: true);
|
||||
_categories = FlattenCategories(tree);
|
||||
Console.WriteLine($"Loaded {_categories.Count} categories");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Error loading categories: {ex}");
|
||||
Snackbar.Add($"خطا در بارگذاری دستهبندیها: {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
@@ -226,6 +229,14 @@
|
||||
return category.Title;
|
||||
}
|
||||
|
||||
private string GetMultiSelectionText(List<string> selectedValues)
|
||||
{
|
||||
if (selectedValues == null || !selectedValues.Any())
|
||||
return "دستهبندی انتخاب نشده";
|
||||
|
||||
return $"{selectedValues.Count} دستهبندی انتخاب شده";
|
||||
}
|
||||
|
||||
private async Task OnMainImageSelected(IBrowserFile? file)
|
||||
{
|
||||
_mainImageFile = file;
|
||||
|
||||
Reference in New Issue
Block a user