|
| 1 | +@inherits AppPageBase |
| 2 | + |
| 3 | +<BitModal @bind-IsOpen="isOpen" Blocking AutoToggleScroll="false"> |
| 4 | + <section> |
| 5 | + <BitStack> |
| 6 | + <BitStack Horizontal VerticalAlign="BitAlignment.Center" Gap="0.5rem"> |
| 7 | + <BitButton Variant="BitVariant.Text" |
| 8 | + Href="@Urls.CategoriesPage" |
| 9 | + IconName="@BitIconName.Back" |
| 10 | + Title="@Localizer[nameof(AppStrings.Back)]" /> |
| 11 | + <BitText Typography="BitTypography.H5"> |
| 12 | + @if (category.Id == default) |
| 13 | + { |
| 14 | + @Localizer[nameof(AppStrings.AddCategory)] |
| 15 | + } |
| 16 | + else |
| 17 | + { |
| 18 | + @Localizer[nameof(AppStrings.EditCategory)] |
| 19 | + } |
| 20 | + </BitText> |
| 21 | + </BitStack> |
| 22 | + <BitCard FullSize> |
| 23 | + <EditForm Model="category" OnValidSubmit="WrapHandled(Save)" novalidate> |
| 24 | + <AppDataAnnotationsValidator @ref="validatorRef" /> |
| 25 | + |
| 26 | + <BitStack Gap="0.25rem"> |
| 27 | + <BitTextField @bind-Value="category.Name" |
| 28 | + Label="@Localizer[nameof(AppStrings.Name)]" |
| 29 | + Placeholder="@Localizer[nameof(AppStrings.EnterCategoryName)]" /> |
| 30 | + <ValidationMessage For="() => category.Name" /> |
| 31 | + <br /> |
| 32 | + <BitLabel For="catColorInput">@Localizer[nameof(AppStrings.Color)]</BitLabel> |
| 33 | + |
| 34 | + <BitStack> |
| 35 | + <BitStack Horizontal> |
| 36 | + @foreach (var color in new[] { "#FFCD56", "#FF6384", "#4BC0C0", "#FF9124", "#2B88D8", "#C7E0F4" }) |
| 37 | + { |
| 38 | + <button @onclick="() => SetCategoryColor(color)" |
| 39 | + type="button" |
| 40 | + style="background-color: @color" |
| 41 | + class="color-btn @(category.Color == color ? "color-btn--active" : null)" /> |
| 42 | + } |
| 43 | + </BitStack> |
| 44 | + |
| 45 | + <BitStack Horizontal> |
| 46 | + <div class="color-square selected" style="background-color: @category.Color"></div> |
| 47 | + <BitToggleButton @bind-IsChecked="isColorPickerOpen" Variant="BitVariant.Outline"> |
| 48 | + @Localizer[(nameof(AppStrings.CustomColor))] |
| 49 | + </BitToggleButton> |
| 50 | + </BitStack> |
| 51 | + |
| 52 | + @if (isColorPickerOpen) |
| 53 | + { |
| 54 | + <div class="color-picker-container"> |
| 55 | + <BitColorPicker @bind-Color="category.Color" Id="catColorInput" ShowPreview="true"> |
| 56 | + @Localizer[nameof(AppStrings.DefaultColorPicker)] |
| 57 | + </BitColorPicker> |
| 58 | + </div> |
| 59 | + } |
| 60 | + </BitStack> |
| 61 | + <ValidationMessage For="() => category.Color" /> |
| 62 | + <br /> |
| 63 | + <BitStack Horizontal> |
| 64 | + <BitButton ButtonType="BitButtonType.Button" Href="@Urls.CategoriesPage" Variant="BitVariant.Outline"> |
| 65 | + @Localizer[nameof(AppStrings.Cancel)] |
| 66 | + </BitButton> |
| 67 | + |
| 68 | + <BitButton IsLoading=isSaving ButtonType="BitButtonType.Submit"> |
| 69 | + @Localizer[nameof(AppStrings.Save)] |
| 70 | + </BitButton> |
| 71 | + </BitStack> |
| 72 | + </BitStack> |
| 73 | + </EditForm> |
| 74 | + </BitCard> |
| 75 | + </BitStack> |
| 76 | + </section> |
| 77 | +</BitModal> |
0 commit comments