-
-
Notifications
You must be signed in to change notification settings - Fork 752
Expand file tree
/
Copy pathAddEditExtendedAttributeModal.razor
More file actions
106 lines (103 loc) · 6.09 KB
/
AddEditExtendedAttributeModal.razor
File metadata and controls
106 lines (103 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
@using BlazorHero.CleanArchitecture.Domain.Enums
@inject Microsoft.Extensions.Localization.IStringLocalizer<AddEditExtendedAttributeModalLocalization> _localizer
@typeparam TId
@typeparam TEntityId
@typeparam TEntity
@typeparam TExtendedAttribute
<EditForm Model="@AddEditExtendedAttributeModel" OnValidSubmit="SaveAsync">
<FluentValidationValidator @ref="_fluentValidationValidator" />
<MudDialog>
<TitleContent>
@{
if (AddEditExtendedAttributeModel.Id.Equals(default))
{
<MudText Typo="Typo.h6">
<MudIcon Icon="@Icons.Material.Filled.Add" Class="mr-3 mb-n1" />
@_localizer["Add Extended Attribute"]
</MudText>
}
else
{
<MudText Typo="Typo.h6">
<MudIcon Icon="@Icons.Material.Filled.Update" Class="mr-3 mb-n1" />
@_localizer["Update Extended Attribute"]
</MudText>
}
}
</TitleContent>
<DialogContent>
<MudGrid>
@if (AddEditExtendedAttributeModel.Id.Equals(default) != true)
{
<MudItem xs="12" md="6">
<MudTextField Disabled For="@(() => AddEditExtendedAttributeModel.Id)" @bind-Value="AddEditExtendedAttributeModel.Id" Label="@_localizer["Id"]" />
</MudItem>
}
<MudItem xs="12" md="6">
<MudTextField Disabled For="@(() => AddEditExtendedAttributeModel.EntityId)" @bind-Value="AddEditExtendedAttributeModel.EntityId" Label="@_localizer["Entity Id"]" />
</MudItem>
<MudItem xs="12" md="6">
<MudSelect T="EntityExtendedAttributeType" Label="@_localizer["Type"]" For="@(() => AddEditExtendedAttributeModel.Type)" @bind-Value="AddEditExtendedAttributeModel.Type" Variant="Variant.Filled">
@foreach (var typeName in Enum.GetNames(typeof(EntityExtendedAttributeType)))
{
<MudSelectItem T="EntityExtendedAttributeType" Value="@(Enum.GetValues<EntityExtendedAttributeType>().FirstOrDefault(x => x.ToString() == typeName))">@typeName</MudSelectItem>
}
</MudSelect>
</MudItem>
<MudItem xs="12" md="6">
<MudTextField For="@(() => AddEditExtendedAttributeModel.Key)" @bind-Value="AddEditExtendedAttributeModel.Key" Label="@_localizer["Key"]" />
</MudItem>
@if (AddEditExtendedAttributeModel.Type == EntityExtendedAttributeType.Decimal)
{
<MudItem xs="12" md="6">
<MudNumericField For="@(() => AddEditExtendedAttributeModel.Decimal)" @bind-Value="AddEditExtendedAttributeModel.Decimal" Label="@_localizer["Decimal"]" />
</MudItem>
}
else if (AddEditExtendedAttributeModel.Type == EntityExtendedAttributeType.Text)
{
<MudItem xs="12" md="6">
<MudTextField For="@(() => AddEditExtendedAttributeModel.Text)" @bind-Value="AddEditExtendedAttributeModel.Text" Label="@_localizer["Text"]" />
</MudItem>
}
else if (AddEditExtendedAttributeModel.Type == EntityExtendedAttributeType.DateTime)
{
<MudItem xs="12" md="6">
<MudDatePicker For="@(() => AddEditExtendedAttributeModel.Date)" @ref="_datePicker" Label="@_localizer["Date"]" @bind-Date="AddEditExtendedAttributeModel.Date">
</MudDatePicker>
<MudTimePicker @ref="_timePicker" Label="@_localizer["Time"]" @bind-Time="AddEditExtendedAttributeModel.Time" Disabled="TimePickerDisabled">
</MudTimePicker>
</MudItem>
}
else if (AddEditExtendedAttributeModel.Type == EntityExtendedAttributeType.Json)
{
<MudItem xs="12" md="6">
<MudTextField For="@(() => AddEditExtendedAttributeModel.Json)" @bind-Value="AddEditExtendedAttributeModel.Json" Label="@_localizer["Json"]" Variant="Variant.Outlined" Lines="10" />
</MudItem>
}
<MudItem xs="12" md="6">
<MudTextField T="string" For="@(() => AddEditExtendedAttributeModel.ExternalId)" @bind-Value="AddEditExtendedAttributeModel.ExternalId" Label="@_localizer["External Id"]" />
</MudItem>
<MudItem xs="12" md="6">
<MudTextField T="string" For="@(() => AddEditExtendedAttributeModel.Group)" @bind-Value="AddEditExtendedAttributeModel.Group" Label="@_localizer["Group"]" />
</MudItem>
<MudItem xs="12" md="6">
<MudTextField For="@(() => AddEditExtendedAttributeModel.Description)" @bind-Value="AddEditExtendedAttributeModel.Description" Label="@_localizer["Description"]" />
</MudItem>
<MudItem xs="12" md="6">
<MudCheckBox For="@(() => AddEditExtendedAttributeModel.IsActive)" @bind-Checked="@AddEditExtendedAttributeModel.IsActive" Color="Color.Secondary" Label="@_localizer["Is Active"]" />
</MudItem>
</MudGrid>
</DialogContent>
<DialogActions>
<MudButton Variant="Variant.Filled" OnClick="Cancel">@_localizer["Cancel"]</MudButton>
@if (AddEditExtendedAttributeModel.Id.Equals(default) != true)
{
<MudButton Variant="Variant.Filled" ButtonType="ButtonType.Submit" Disabled="@(!Validated)" Color="Color.Secondary">@_localizer["Update"]</MudButton>
}
else
{
<MudButton Variant="Variant.Filled" ButtonType="ButtonType.Submit" Disabled="@(!Validated)" Color="Color.Success">@_localizer["Save"]</MudButton>
}
</DialogActions>
</MudDialog>
</EditForm>