From 2ece3401812f8909046246773d9e4f0133720e2a Mon Sep 17 00:00:00 2001 From: VS Date: Wed, 21 Aug 2024 09:37:42 +0100 Subject: [PATCH] When Indefinite Right To Work is checked, hiding ValidTo date --- .../Enrolments/Components/RightToWork.razor | 59 +++++++++++-------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor index 36162def..e7ac649a 100644 --- a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor +++ b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor @@ -10,27 +10,27 @@ if (RightToWorkDtos is not null && RightToWorkDtos.Length > 0) { - Right To Work supporting documentation already updated + Right To Work supporting documentation already updated - + @foreach (var c in RightToWorkDtos) { - @c.FileName + @c.FileName - } + } - + Add New } else { - + For anyone recorded on PNomis / NDelius as non-British / non-Irish, documentation is required to support their Right to Work. More information on this requirement can be found in the CFO Enrolment Guidance. @@ -38,22 +38,24 @@ To your knowledge, is any Right to Work (RTW) documentation required for the enrolment of this person? - Yes, Right to Work is required - No, Right to Work is not required + Yes, Right to Work is required + No, Right to Work is not required - @if (_isRequired) { + - - + @bind-Date="Model.ValidFrom" Required /> + @if (_isIndefiniteRtwChecked == false) + { + + }
@@ -63,7 +65,7 @@ StartIcon="@Icons.Material.Filled.Upload"> @if (_uploading) { - + @ConstantString.Uploading } else @@ -84,13 +86,11 @@ private bool _isRequired = true; private bool _uploading = false; - private bool _disabled = false; - private MudDatePicker? _dpValidTo; - MudCheckBox IndefiniteRtw { get; set; } = default!; + private bool _isIndefiniteRtwChecked { get; set; } = false; [EditorRequired] [Parameter] - public AddRightToWork.Command? Model { get; set; } + public AddRightToWork.Command? Model { get; set; } [Parameter] public RightToWorkDto[]? RightToWorkDtos { get; set; } @@ -143,16 +143,27 @@ } } - private void IndefiniteRtwOnValueChanged() + private void RightToWorkRequiredOnClick() + { + _isRequired = true; + + IndefiniteRtwOnValueChanged(_isIndefiniteRtwChecked); + } + private void NoRightToWorkRequiredOnClick() + { + _isRequired = false; + + IndefiniteRtwOnValueChanged(_isIndefiniteRtwChecked); + } + private void IndefiniteRtwOnValueChanged(bool isIndefiniteRtwChecked) { - if (IndefiniteRtw.Value) + _isIndefiniteRtwChecked = isIndefiniteRtwChecked; + if (_isIndefiniteRtwChecked) { - _disabled = true; Model!.ValidTo = new DateTime(9999, 12, 31); } else { - _disabled = false; Model!.ValidTo = null; } }