Skip to content

Commit 8eb12f7

Browse files
author
Jani Giannoudis
committed
new case input attributes hiddenDates, startHidden and endHidden
fixed attributes startReadOnly and endReadOnly fixed culture on case start/end date/time pickers fixed case field set initialisation of default value message box dialog: icon added updated MudBlazor to 8.3.0 updated version to 0.9.0-beta.3
1 parent cc80fdf commit 8eb12f7

22 files changed

+232
-129
lines changed

Core/IUserNotificationService.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ public interface IUserNotificationService
6868
/// <param name="yesText">The yes button text</param>
6969
/// <param name="noText">The no button text</param>
7070
/// <param name="cancelText">The cancel button text</param>
71-
Task<bool> ShowMessageBoxAsync(Localizer localizer, string title, string message, string yesText = null,
72-
string noText = null, string cancelText = null);
71+
/// <param name="icon">Display icon</param>
72+
Task<bool> ShowMessageBoxAsync(Localizer localizer, string title,
73+
string message, string yesText = null,
74+
string noText = null, string cancelText = null,
75+
string icon = null);
7376

7477
/// <summary>
7578
/// Show a message box
@@ -80,8 +83,11 @@ Task<bool> ShowMessageBoxAsync(Localizer localizer, string title, string message
8083
/// <param name="yesText">The yes button text</param>
8184
/// <param name="noText">The no button text</param>
8285
/// <param name="cancelText">The cancel button text</param>
83-
Task<bool> ShowMessageBoxAsync(Localizer localizer, string title, MarkupString message, string yesText = null,
84-
string noText = null, string cancelText = null);
86+
/// <param name="icon">Display icon</param>
87+
Task<bool> ShowMessageBoxAsync(Localizer localizer, string title,
88+
MarkupString message, string yesText = null,
89+
string noText = null, string cancelText = null,
90+
string icon = null);
8591

8692
/// <summary>
8793
/// Show a delete confirmation message box

Core/InputAttributes.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public static class InputAttributes
1717
#region Case Field General
1818

1919
public static readonly string Hidden = $"{Prefix}hidden";
20+
public static readonly string HiddenDates = $"{Prefix}hiddenDates";
2021
public static readonly string ShowDescription = $"{Prefix}showDescription";
2122

2223
#endregion
@@ -26,7 +27,8 @@ public static class InputAttributes
2627
public static readonly string StartLabel = $"{Prefix}startLabel";
2728
public static readonly string StartHelp = $"{Prefix}startHelp";
2829
public static readonly string StartRequired = $"{Prefix}startRequired";
29-
public static readonly string StartReadOnly = $"{Prefix}startReadOny";
30+
public static readonly string StartReadOnly = $"{Prefix}startReadOnly";
31+
public static readonly string StartHidden = $"{Prefix}startHidden";
3032
public static readonly string StartFormat = $"{Prefix}startFormat";
3133
public static readonly string StartPickerOpen = $"{Prefix}startPickerOpen";
3234
public static readonly string StartPickerType = $"{Prefix}startPickerType";
@@ -38,7 +40,8 @@ public static class InputAttributes
3840
public static readonly string EndLabel = $"{Prefix}endLabel";
3941
public static readonly string EndHelp = $"{Prefix}endHelp";
4042
public static readonly string EndRequired = $"{Prefix}endRequired";
41-
public static readonly string EndReadOnly = $"{Prefix}endReadOny";
43+
public static readonly string EndReadOnly = $"{Prefix}endReadOnly";
44+
public static readonly string EndHidden = $"{Prefix}endHidden";
4245
public static readonly string EndFormat = $"{Prefix}endFormat";
4346
public static readonly string EndPickerOpen = $"{Prefix}endPickerOpen";
4447
public static readonly string EndPickerType = $"{Prefix}endPickerType";

Core/InputAttributesExtensions.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public static string GetIcon(this Dictionary<string, object> attributes, Culture
2626
public static bool? GetHidden(this Dictionary<string, object> attributes, CultureInfo culture) =>
2727
attributes.GetBooleanAttributeValue(InputAttributes.Hidden, culture.Name);
2828

29+
public static bool? GetHiddenDates(this Dictionary<string, object> attributes, CultureInfo culture) =>
30+
attributes.GetBooleanAttributeValue(InputAttributes.HiddenDates, culture.Name);
31+
2932
public static bool? GetShowDescription(this Dictionary<string, object> attributes, CultureInfo culture) =>
3033
attributes.GetBooleanAttributeValue(InputAttributes.ShowDescription, culture.Name);
3134

@@ -34,7 +37,10 @@ public static string GetIcon(this Dictionary<string, object> attributes, Culture
3437
#region Case Field Start
3538

3639
public static bool? GetStartReadOnly(this Dictionary<string, object> attributes, CultureInfo culture) =>
37-
attributes.GetBooleanAttributeValue(InputAttributes.StartPickerOpen, culture.Name);
40+
attributes.GetBooleanAttributeValue(InputAttributes.StartReadOnly, culture.Name);
41+
42+
public static bool? GetStartHidden(this Dictionary<string, object> attributes, CultureInfo culture) =>
43+
attributes.GetBooleanAttributeValue(InputAttributes.StartHidden, culture.Name);
3844

3945
public static DatePickerType? GetStartPickerOpen(this Dictionary<string, object> attributes, CultureInfo culture) =>
4046
attributes.GetEnumAttributeValue<DatePickerType>(InputAttributes.StartPickerOpen, culture.Name);
@@ -69,7 +75,10 @@ public static string GetStartRequired(this Dictionary<string, object> attributes
6975
#region Case Field End
7076

7177
public static bool? GetEndReadOnly(this Dictionary<string, object> attributes, CultureInfo culture) =>
72-
attributes.GetBooleanAttributeValue(InputAttributes.EndPickerOpen, culture.Name);
78+
attributes.GetBooleanAttributeValue(InputAttributes.EndReadOnly, culture.Name);
79+
80+
public static bool? GetEndHidden(this Dictionary<string, object> attributes, CultureInfo culture) =>
81+
attributes.GetBooleanAttributeValue(InputAttributes.EndHidden, culture.Name);
7382

7483
public static DatePickerType? GetEndPickerOpen(this Dictionary<string, object> attributes, CultureInfo culture) =>
7584
attributes.GetEnumAttributeValue<DatePickerType>(InputAttributes.EndPickerOpen, culture.Name);

Core/PayrollEngine.WebApp.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="PayrollEngine.Client.Core" Version="0.9.0-beta.1" />
15+
<PackageReference Include="PayrollEngine.Client.Core" Version="0.9.0-beta.3" />
1616
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.2" />
1717
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
1818
<PackageReference Include="Microsoft.JSInterop" Version="9.0.2" />

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>0.9.0-beta.2</Version>
5+
<Version>0.9.0-beta.3</Version>
66
<FileVersion>0.9.0</FileVersion>
77
<InformationalVersion></InformationalVersion>
88
<Authors>Jani Giannoudis</Authors>

Input-Attributes.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
# Input Attributes
2-
The case input attributes can be used to control the behaviour of user input.
2+
The case input attributes can be used to control the behavior of user input.
33

44
| Name | Description | Type | Default | Supported by |
55
|--|--|--|--|--|
66
| <b>General</b> |
77
`input.icon` | Custom item icon <sup>11)</sup> | string | false | Case |
88
`input.priority` | Item priority <sup>12)</sup> | string | normal | Case |
99
`input.hidden` | Input is hidden | bool | false | all |
10+
`input.hiddenDates` | Hidden start and end dates | bool | false | Case field |
1011
`input.showDescription` | Input description is visible | bool | false | all |
1112
| <b>Start</b> |
1213
`input.startLabel` | Start date input label | string | Start | all |
1314
`input.startHelp` | Start date help text | string | - | all |
1415
`input.startRequired` | Start date required error text | string | Start | all |
15-
`input.startReadOnly` | Start date is read only | bool | false | all (start date) |
16+
`input.startReadOnly` | Start date input to read only | bool | false | all (start date) |
17+
`input.startHidden` | Hide start date | bool | false | all (start date) |
1618
`input.startFormat` | Start date input format <sup>4)</sup> | string | system | date, date-time |
1719
`input.startPickerOpen` | Start date picker open mode <sup>2)</sup> | string | day | date |
1820
`input.startPickerType` | Start date datetime type <sup>5)</sup> | string | date | all |
1921
| <b>End</b> |
2022
`input.endLabel` | End date input label | string | End | all |
2123
`input.endHelp` | End date help text | string | - | all |
2224
`input.endRequired` | End date required error text | string | Start | all |
23-
`input.endReadOnly` | End date is read only | bool | false | all (end date) |
25+
`input.endReadOnly` | End date input to read only | bool | false | all (end date) |
26+
`input.endHidden` | Hide end date | bool | false | all (start date) |
2427
`input.endFormat` | End date input format <sup>4)</sup> | string | system | date, date-time |
2528
`input.endPickerOpen` | End date picker date type <sup>2)</sup> | string | day | date |
2629
`input.endPickerType` | End date datetime type <sup>5)</sup> | string | date | all |

Presentation/Case/CaseEndDatePicker.razor

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
@using PayrollEngine.WebApp.Shared
22
@inherits PayrollEngine.WebApp.Presentation.Field.DateTimePickerBase
33

4-
<MudDatePicker Date="@Date"
5-
DateChanged="DateChanged"
6-
MinDate="@MinDate"
7-
MaxDate="@MaxDate"
8-
DateFormat="@Format"
9-
Label="@Label"
10-
Mask="@Mask"
11-
ReadOnly="@ReadOnly"
12-
Error="@Error"
13-
Required="@Required"
14-
RequiredError="@RequiredError"
15-
HelperText="@Help"
16-
Margin="@(Dense ? Margin.Dense : Margin.Normal)"
17-
Variant="@Variant"
18-
Class="@Class"
19-
Style="@Style"
20-
Editable="true" />
4+
@if (!Hidden)
5+
{
6+
<MudDatePicker Date="@Date"
7+
DateChanged="DateChanged"
8+
MinDate="@MinDate"
9+
MaxDate="@MaxDate"
10+
Culture="@Culture"
11+
DateFormat="@Format"
12+
Label="@Label"
13+
Mask="@Mask"
14+
ReadOnly="@ReadOnly"
15+
Error="@Error"
16+
Required="@Required"
17+
RequiredError="@RequiredError"
18+
HelperText="@Help"
19+
Margin="@(Dense ? Margin.Dense : Margin.Normal)"
20+
Variant="@Variant"
21+
Class="@Class"
22+
Style="@Style"
23+
Editable="true" />
24+
}
2125

2226
@code {
2327
[Parameter] public DateTime? Date { get; set; }
@@ -39,6 +43,8 @@
3943
(Field.Start.HasValue || !string.IsNullOrWhiteSpace(Field.Value));
4044

4145
private bool Error => !Field.Validator.ValidateEnd();
46+
private bool Hidden => (Attributes.GetHiddenDates(Culture) ?? false) ||
47+
(Attributes.GetEndHidden(Culture) ?? false);
4248

4349
protected override DatePickerType DatePickerType =>
4450
Attributes.GetEndPickerOpen(Culture) ?? DatePickerType.Day;

Presentation/Case/CaseEndDateTimePicker.razor

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
@using PayrollEngine.WebApp.Shared
22
@inherits PayrollEngine.WebApp.Presentation.Field.DateTimePickerBase
33

4-
<MudStack Row="true" Spacing="0" Class="align-baseline">
5-
<MudDatePicker @bind-Date="@Date"
6-
MinDate="@MinDate"
7-
MaxDate="@MaxDate"
8-
DateFormat="@DateFormat"
9-
Label="@DateLabel"
10-
Mask="@Mask"
11-
ReadOnly="@ReadOnly"
12-
Error="@Error"
13-
RequiredError="@RequiredError"
14-
HelperText="@Help"
15-
Required="@Required"
16-
Margin="@(Dense ? Margin.Dense : Margin.Normal)"
17-
Variant="@Variant"
18-
Class="@Class"
19-
Editable="true" />
20-
<MudTimePicker Class="pl-4"
21-
@bind-Time="@Time"
22-
Error="@Error"
23-
TimeFormat="@TimeFormat"
24-
Required="@Required"
25-
ReadOnly="@ReadOnly"
26-
Editable="true" />
27-
</MudStack>
4+
@if (!Hidden)
5+
{
6+
<MudStack Row="true" Spacing="0" Class="align-baseline">
7+
<MudDatePicker @bind-Date="@Date"
8+
MinDate="@MinDate"
9+
MaxDate="@MaxDate"
10+
Culture="@Culture"
11+
DateFormat="@DateFormat"
12+
Label="@DateLabel"
13+
Mask="@Mask"
14+
ReadOnly="@ReadOnly"
15+
Error="@Error"
16+
RequiredError="@RequiredError"
17+
HelperText="@Help"
18+
Required="@Required"
19+
Margin="@(Dense ? Margin.Dense : Margin.Normal)"
20+
Variant="@Variant"
21+
Class="@Class"
22+
Editable="true" />
23+
<MudTimePicker Class="pl-4"
24+
@bind-Time="@Time"
25+
Error="@Error"
26+
Culture="@Culture"
27+
TimeFormat="@TimeFormat"
28+
Required="@Required"
29+
ReadOnly="@ReadOnly"
30+
Editable="true" />
31+
</MudStack>
32+
}
2833

2934
@code {
3035
[Parameter] public DateTime? DateTime { get; set; }
@@ -46,6 +51,8 @@
4651
Field.EndMandatory && (Field.Start.HasValue || !string.IsNullOrWhiteSpace(Field.Value));
4752

4853
private bool Error => !Field.Validator.ValidateEnd();
54+
private bool Hidden => (Attributes.GetHiddenDates(Culture) ?? false) ||
55+
(Attributes.GetEndHidden(Culture) ?? false);
4956

5057
private DateTime? Date
5158
{

Presentation/Case/CaseField.razor

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
<div class="d-flex">
1414

1515
@* field name *@
16-
<MudTooltip Delay="1000" Text="@Field.GetLocalizedDescription(Culture)" Placement="Placement.Top">
17-
<MudText Class="pr-4">@Field.GetLocalizedName(Culture)</MudText>
18-
</MudTooltip>
16+
@if (!HiddenDates)
17+
{
18+
<MudTooltip Delay="1000" Text="@Field.GetLocalizedDescription(Culture)" Placement="Placement.Top">
19+
<MudText Class="pr-4">@Field.GetLocalizedName(Culture)</MudText>
20+
</MudTooltip>
21+
}
1922

2023
@* field actions *@
2124
<div class="d-flex flex-grow-1 justify-end">

Presentation/Case/CaseField.razor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public partial class CaseField
2727

2828
private Localizer Localizer => LocalizerService.Localizer;
2929

30+
private bool HiddenDates => Field.Attributes.GetHiddenDates(Culture) ?? false;
31+
3032
#region Change History
3133

3234
private bool UseChangeHistory { get; set; } = true;

0 commit comments

Comments
 (0)