@hmcts/ccd-case-ui-toolkit 6.10.7-manage-support-first-step-text-changes → 6.10.7-manage-case-flags-valid-status-progression

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12802,7 +12802,7 @@
12802
12802
  };
12803
12803
  WriteCaseFlagFieldComponent.prototype.updateFlagInCollection = function () {
12804
12804
  var _this = this;
12805
- var _a, _b, _c, _d;
12805
+ var _a, _b, _c, _d, _e;
12806
12806
  // Ensure no more than one flag is being updated at a time, by iterating through each Flags case field and resetting
12807
12807
  // the description, comments, status, and date/time modified (if present) for each entry in the details array, with
12808
12808
  // original values from the corresponding formatted_value property. (This scenario occurs if the user repeats the
@@ -12864,7 +12864,7 @@
12864
12864
  ? (_b = this.caseFlagParentFormGroup.get(exports.CaseFlagFormFields.OTHER_FLAG_DESCRIPTION_WELSH)) === null || _b === void 0 ? void 0 : _b.value : null,
12865
12865
  flagDetailToUpdate.value.flagComment = (_c = this.caseFlagParentFormGroup.get(exports.CaseFlagFormFields.COMMENTS)) === null || _c === void 0 ? void 0 : _c.value;
12866
12866
  flagDetailToUpdate.value.flagComment_cy = (_d = this.caseFlagParentFormGroup.get(exports.CaseFlagFormFields.COMMENTS_WELSH)) === null || _d === void 0 ? void 0 : _d.value;
12867
- flagDetailToUpdate.value.status = this.selectedFlag.flagDetailDisplay.flagDetail.status;
12867
+ flagDetailToUpdate.value.status = exports.CaseFlagStatus[(_e = this.caseFlagParentFormGroup.get(exports.CaseFlagFormFields.STATUS)) === null || _e === void 0 ? void 0 : _e.value];
12868
12868
  flagDetailToUpdate.value.dateTimeModified = new Date().toISOString();
12869
12869
  }
12870
12870
  }
@@ -20351,6 +20351,7 @@
20351
20351
  this.selectedControlName = 'selectedManageCaseLocation';
20352
20352
  this.updateMode = '#ARGUMENT(UPDATE)';
20353
20353
  this.updateExternalMode = '#ARGUMENT(UPDATE,EXTERNAL)';
20354
+ this.excludedFlagStatuses = [exports.CaseFlagStatus.INACTIVE, exports.CaseFlagStatus.NOT_APPROVED];
20354
20355
  }
20355
20356
  ManageCaseFlagsComponent.prototype.ngOnInit = function () {
20356
20357
  var _this = this;
@@ -20359,10 +20360,16 @@
20359
20360
  if (this.flagsData) {
20360
20361
  this.flagsDisplayData = this.flagsData.reduce(function (displayData, flagsInstance) {
20361
20362
  if (flagsInstance.flags.details && flagsInstance.flags.details.length > 0) {
20362
- displayData = __spread(displayData, flagsInstance.flags.details.map(function (detail) { return _this.mapFlagDetailForDisplay(detail, flagsInstance); }));
20363
+ displayData = __spread(displayData, flagsInstance.flags.details.map(function (detail) {
20364
+ // Only map flags instances where the status is neither "Inactive" nor "Not approved"
20365
+ // This will result in some undefined mappings, which need to be filtered out after the reduce operation
20366
+ if (!_this.excludedFlagStatuses.includes(detail.status)) {
20367
+ return _this.mapFlagDetailForDisplay(detail, flagsInstance);
20368
+ }
20369
+ }));
20363
20370
  }
20364
20371
  return displayData;
20365
- }, []);
20372
+ }, []).filter(function (flagDetailDisplay) { return !!flagDetailDisplay; });
20366
20373
  this.flagsDisplayData.forEach(function (flagDisplayData) {
20367
20374
  flagDisplayData.label = _this.processLabel(flagDisplayData);
20368
20375
  });
@@ -20596,10 +20603,10 @@
20596
20603
  i0__namespace.ɵɵadvance(1);
20597
20604
  i0__namespace.ɵɵproperty("for", ctx_r2.caseFlagFormFields.STATUS + "_" + status_r5);
20598
20605
  i0__namespace.ɵɵadvance(1);
20599
- i0__namespace.ɵɵtextInterpolate1(" ", status_r5, " ");
20606
+ i0__namespace.ɵɵtextInterpolate1(" ", ctx_r2.caseFlagStatusEnum[status_r5], " ");
20600
20607
  }
20601
20608
  }
20602
- function UpdateFlagComponent_div_27_Template(rf, ctx) {
20609
+ function UpdateFlagComponent_div_26_Template(rf, ctx) {
20603
20610
  if (rf & 1) {
20604
20611
  i0__namespace.ɵɵelementStart(0, "div", 35);
20605
20612
  i0__namespace.ɵɵelementStart(1, "span", 30);
@@ -20614,7 +20621,7 @@
20614
20621
  i0__namespace.ɵɵtextInterpolate1(" ", ctx_r3.statusReasonNotEnteredErrorMessage, " ");
20615
20622
  }
20616
20623
  }
20617
- function UpdateFlagComponent_div_28_Template(rf, ctx) {
20624
+ function UpdateFlagComponent_div_27_Template(rf, ctx) {
20618
20625
  if (rf & 1) {
20619
20626
  i0__namespace.ɵɵelementStart(0, "div", 36);
20620
20627
  i0__namespace.ɵɵelementStart(1, "span", 30);
@@ -20640,22 +20647,39 @@
20640
20647
  this.statusReasonNotEnteredErrorMessage = null;
20641
20648
  this.statusReasonCharLimitErrorMessage = null;
20642
20649
  this.updateFlagStepEnum = exports.UpdateFlagStep;
20643
- this.caseFlagStatuses = exports.CaseFlagStatus;
20650
+ this.caseFlagStatusEnum = exports.CaseFlagStatus;
20644
20651
  this.caseFlagFormFields = exports.CaseFlagFormFields;
20645
20652
  this.textMaxCharLimit = 200;
20646
20653
  }
20647
20654
  UpdateFlagComponent.prototype.ngOnInit = function () {
20655
+ var _this = this;
20648
20656
  if (this.selectedFlag && this.selectedFlag.flagDetailDisplay && this.selectedFlag.flagDetailDisplay.flagDetail) {
20649
20657
  this.flagDetail = this.selectedFlag.flagDetailDisplay.flagDetail;
20658
+ var currentFlagStatusKey = Object.keys(exports.CaseFlagStatus).find(function (key) { return exports.CaseFlagStatus[key] === _this.flagDetail.status; });
20650
20659
  // Populate flag comments text area with existing comments
20651
20660
  this.formGroup.addControl(exports.CaseFlagFormFields.COMMENTS, new i1$2.FormControl(this.flagDetail.flagComment));
20652
- this.formGroup.addControl(exports.CaseFlagFormFields.STATUS, new i1$2.FormControl(this.flagDetail.status));
20661
+ this.formGroup.addControl(exports.CaseFlagFormFields.STATUS, new i1$2.FormControl(currentFlagStatusKey));
20653
20662
  this.formGroup.addControl(exports.CaseFlagFormFields.STATUS_CHANGE_REASON, new i1$2.FormControl(''));
20654
20663
  this.formGroup.addControl(exports.CaseFlagFormFields.IS_WELSH_TRANSLATION_NEEDED, new i1$2.FormControl(false));
20655
20664
  if (this.flagDetail.name) {
20656
20665
  this.updateFlagTitle =
20657
20666
  exports.CaseFlagWizardStepTitle.UPDATE_FLAG_TITLE + " \"" + this.flagDetail.name + (this.flagDetail.subTypeValue ? ", " + this.flagDetail.subTypeValue + "\"" : '"');
20658
20667
  }
20668
+ // Set the valid status options for display, based on current status of the selected flag. "Active" flags can
20669
+ // remain "Active" or move to "Inactive" only; "Requested" flags can remain "Requested" or move to "Active",
20670
+ // "Inactive", or "Not approved". No other status progressions are valid
20671
+ if (currentFlagStatusKey) {
20672
+ switch (currentFlagStatusKey) {
20673
+ case 'ACTIVE':
20674
+ this.validStatusProgressions = Object.keys(exports.CaseFlagStatus).filter(function (key) { return !['REQUESTED', 'NOT_APPROVED'].includes(key); });
20675
+ break;
20676
+ case 'REQUESTED':
20677
+ this.validStatusProgressions = Object.keys(exports.CaseFlagStatus);
20678
+ break;
20679
+ default:
20680
+ this.validStatusProgressions = [];
20681
+ }
20682
+ }
20659
20683
  }
20660
20684
  };
20661
20685
  UpdateFlagComponent.prototype.onNext = function () {
@@ -20696,7 +20720,8 @@
20696
20720
  });
20697
20721
  }
20698
20722
  var statusReason = this.formGroup.get(exports.CaseFlagFormFields.STATUS_CHANGE_REASON).value;
20699
- if (this.formGroup.get(exports.CaseFlagFormFields.STATUS).value === exports.CaseFlagStatus.NOT_APPROVED && !statusReason) {
20723
+ var flagStatusNotApprovedKey = Object.keys(exports.CaseFlagStatus).find(function (key) { return exports.CaseFlagStatus[key] === exports.CaseFlagStatus.NOT_APPROVED; });
20724
+ if (this.formGroup.get(exports.CaseFlagFormFields.STATUS).value === flagStatusNotApprovedKey && !statusReason) {
20700
20725
  this.statusReasonNotEnteredErrorMessage = exports.UpdateFlagErrorMessage.STATUS_REASON_NOT_ENTERED;
20701
20726
  this.errorMessages.push({
20702
20727
  title: '',
@@ -20716,7 +20741,7 @@
20716
20741
  return UpdateFlagComponent;
20717
20742
  }());
20718
20743
  UpdateFlagComponent.ɵfac = function UpdateFlagComponent_Factory(t) { return new (t || UpdateFlagComponent)(); };
20719
- UpdateFlagComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: UpdateFlagComponent, selectors: [["ccd-update-flag"]], inputs: { formGroup: "formGroup", selectedFlag: "selectedFlag" }, outputs: { caseFlagStateEmitter: "caseFlagStateEmitter" }, decls: 42, vars: 30, consts: [[3, "formGroup"], ["data-module", "govuk-character-count", "data-maxlength", "200", 1, "govuk-character-count"], [1, "govuk-form-group", 3, "ngClass"], [1, "govuk-label-wrapper", "govuk-!-margin-bottom-6"], [1, "govuk-label", "govuk-label--l"], [1, "govuk-!-margin-bottom-4"], [1, "govuk-label", "govuk-label--s", 3, "for"], ["id", "update-flag-hint", 1, "govuk-hint"], ["id", "update-flag-not-entered-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "update-flag-char-limit-error", "class", "govuk-error-message", 4, "ngIf"], ["rows", "5", "aria-describedby", "update-flag-hint update-flag-char-limit-info update-flag-char-limit-error", 1, "govuk-textarea", 3, "id", "name", "formControlName"], ["id", "update-flag-comments-char-limit-info", "aria-live", "polite", 1, "govuk-hint", "govuk-character-count__message"], ["aria-describedby", "update-flag-status-heading", 1, "govuk-fieldset"], [1, "govuk-fieldset__legend", "govuk-fieldset__legend--s"], ["id", "update-flag-status-heading", 1, "govuk-fieldset__heading"], ["data-module", "govuk-radios", 1, "govuk-radios", "govuk-radios--conditional", "govuk-!-margin-bottom-4", 3, "id"], ["class", "govuk-radios__item", 4, "ngFor", "ngForOf"], ["id", "update-flag-status-hint", 1, "govuk-hint"], ["id", "update-flag-status-reason-not-entered-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "update-flag-status-reason-char-limit-error", "class", "govuk-error-message", 4, "ngIf"], ["rows", "5", 1, "govuk-textarea", 3, "id", "name", "formControlName"], ["id", "update-flag-status-reason-char-limit-info", "aria-live", "polite", 1, "govuk-hint", "govuk-character-count__message"], [1, "govuk-!-margin-bottom-6"], ["data-module", "govuk-checkboxes", 1, "govuk-checkboxes"], [1, "govuk-checkboxes__item"], ["type", "checkbox", 1, "govuk-checkboxes__input", 3, "formControlName", "id", "name"], [1, "govuk-label", "govuk-checkboxes__label", 3, "for"], [1, "govuk-button-group"], ["id", "updateFlagNextButton", "type", "button", 1, "govuk-button", 3, "click"], ["id", "update-flag-not-entered-error-message", 1, "govuk-error-message"], [1, "govuk-visually-hidden"], ["id", "update-flag-char-limit-error", 1, "govuk-error-message"], [1, "govuk-radios__item"], ["type", "radio", 1, "govuk-radios__input", 3, "id", "name", "formControlName", "value"], [1, "govuk-label", "govuk-radios__label", 3, "for"], ["id", "update-flag-status-reason-not-entered-error-message", 1, "govuk-error-message"], ["id", "update-flag-status-reason-char-limit-error", 1, "govuk-error-message"]], template: function UpdateFlagComponent_Template(rf, ctx) {
20744
+ UpdateFlagComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: UpdateFlagComponent, selectors: [["ccd-update-flag"]], inputs: { formGroup: "formGroup", selectedFlag: "selectedFlag" }, outputs: { caseFlagStateEmitter: "caseFlagStateEmitter" }, decls: 41, vars: 28, consts: [[3, "formGroup"], ["data-module", "govuk-character-count", "data-maxlength", "200", 1, "govuk-character-count"], [1, "govuk-form-group", 3, "ngClass"], [1, "govuk-label-wrapper", "govuk-!-margin-bottom-6"], [1, "govuk-label", "govuk-label--l"], [1, "govuk-!-margin-bottom-4"], [1, "govuk-label", "govuk-label--s", 3, "for"], ["id", "update-flag-hint", 1, "govuk-hint"], ["id", "update-flag-not-entered-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "update-flag-char-limit-error", "class", "govuk-error-message", 4, "ngIf"], ["rows", "5", "aria-describedby", "update-flag-hint update-flag-char-limit-info update-flag-char-limit-error", 1, "govuk-textarea", 3, "id", "name", "formControlName"], ["id", "update-flag-comments-char-limit-info", "aria-live", "polite", 1, "govuk-hint", "govuk-character-count__message"], ["aria-describedby", "update-flag-status-heading", 1, "govuk-fieldset"], [1, "govuk-fieldset__legend", "govuk-fieldset__legend--s"], ["id", "update-flag-status-heading", 1, "govuk-fieldset__heading"], ["data-module", "govuk-radios", 1, "govuk-radios", "govuk-radios--conditional", "govuk-!-margin-bottom-4", 3, "id"], ["class", "govuk-radios__item", 4, "ngFor", "ngForOf"], ["id", "update-flag-status-hint", 1, "govuk-hint"], ["id", "update-flag-status-reason-not-entered-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "update-flag-status-reason-char-limit-error", "class", "govuk-error-message", 4, "ngIf"], ["rows", "5", 1, "govuk-textarea", 3, "id", "name", "formControlName"], ["id", "update-flag-status-reason-char-limit-info", "aria-live", "polite", 1, "govuk-hint", "govuk-character-count__message"], [1, "govuk-!-margin-bottom-6"], ["data-module", "govuk-checkboxes", 1, "govuk-checkboxes"], [1, "govuk-checkboxes__item"], ["type", "checkbox", 1, "govuk-checkboxes__input", 3, "formControlName", "id", "name"], [1, "govuk-label", "govuk-checkboxes__label", 3, "for"], [1, "govuk-button-group"], ["id", "updateFlagNextButton", "type", "button", 1, "govuk-button", 3, "click"], ["id", "update-flag-not-entered-error-message", 1, "govuk-error-message"], [1, "govuk-visually-hidden"], ["id", "update-flag-char-limit-error", 1, "govuk-error-message"], [1, "govuk-radios__item"], ["type", "radio", 1, "govuk-radios__input", 3, "id", "name", "formControlName", "value"], [1, "govuk-label", "govuk-radios__label", 3, "for"], ["id", "update-flag-status-reason-not-entered-error-message", 1, "govuk-error-message"], ["id", "update-flag-status-reason-char-limit-error", 1, "govuk-error-message"]], template: function UpdateFlagComponent_Template(rf, ctx) {
20720
20745
  if (rf & 1) {
20721
20746
  i0__namespace.ɵɵelementContainerStart(0, 0);
20722
20747
  i0__namespace.ɵɵelementStart(1, "div", 1);
@@ -20751,27 +20776,26 @@
20751
20776
  i0__namespace.ɵɵelementEnd();
20752
20777
  i0__namespace.ɵɵelementStart(22, "div", 15);
20753
20778
  i0__namespace.ɵɵtemplate(23, UpdateFlagComponent_div_23_Template, 4, 6, "div", 16);
20754
- i0__namespace.ɵɵpipe(24, "enumDisplayDescription");
20755
20779
  i0__namespace.ɵɵelementEnd();
20756
20780
  i0__namespace.ɵɵelementEnd();
20757
- i0__namespace.ɵɵelementStart(25, "div", 17);
20758
- i0__namespace.ɵɵtext(26);
20781
+ i0__namespace.ɵɵelementStart(24, "div", 17);
20782
+ i0__namespace.ɵɵtext(25);
20759
20783
  i0__namespace.ɵɵelementEnd();
20760
- i0__namespace.ɵɵtemplate(27, UpdateFlagComponent_div_27_Template, 4, 1, "div", 18);
20761
- i0__namespace.ɵɵtemplate(28, UpdateFlagComponent_div_28_Template, 4, 1, "div", 19);
20762
- i0__namespace.ɵɵelementStart(29, "textarea", 20);
20763
- i0__namespace.ɵɵtext(30, " ");
20784
+ i0__namespace.ɵɵtemplate(26, UpdateFlagComponent_div_26_Template, 4, 1, "div", 18);
20785
+ i0__namespace.ɵɵtemplate(27, UpdateFlagComponent_div_27_Template, 4, 1, "div", 19);
20786
+ i0__namespace.ɵɵelementStart(28, "textarea", 20);
20787
+ i0__namespace.ɵɵtext(29, " ");
20764
20788
  i0__namespace.ɵɵelementEnd();
20765
- i0__namespace.ɵɵelementStart(31, "div", 21);
20766
- i0__namespace.ɵɵtext(32);
20789
+ i0__namespace.ɵɵelementStart(30, "div", 21);
20790
+ i0__namespace.ɵɵtext(31);
20767
20791
  i0__namespace.ɵɵelementEnd();
20768
20792
  i0__namespace.ɵɵelementEnd();
20769
- i0__namespace.ɵɵelementStart(33, "div", 22);
20770
- i0__namespace.ɵɵelementStart(34, "div", 23);
20771
- i0__namespace.ɵɵelementStart(35, "div", 24);
20772
- i0__namespace.ɵɵelement(36, "input", 25);
20773
- i0__namespace.ɵɵelementStart(37, "label", 26);
20774
- i0__namespace.ɵɵtext(38, " I need to add a translation ");
20793
+ i0__namespace.ɵɵelementStart(32, "div", 22);
20794
+ i0__namespace.ɵɵelementStart(33, "div", 23);
20795
+ i0__namespace.ɵɵelementStart(34, "div", 24);
20796
+ i0__namespace.ɵɵelement(35, "input", 25);
20797
+ i0__namespace.ɵɵelementStart(36, "label", 26);
20798
+ i0__namespace.ɵɵtext(37, " I need to add a translation ");
20775
20799
  i0__namespace.ɵɵelementEnd();
20776
20800
  i0__namespace.ɵɵelementEnd();
20777
20801
  i0__namespace.ɵɵelementEnd();
@@ -20779,17 +20803,17 @@
20779
20803
  i0__namespace.ɵɵelementEnd();
20780
20804
  i0__namespace.ɵɵelementEnd();
20781
20805
  i0__namespace.ɵɵelementContainerEnd();
20782
- i0__namespace.ɵɵelementStart(39, "div", 27);
20783
- i0__namespace.ɵɵelementStart(40, "button", 28);
20784
- i0__namespace.ɵɵlistener("click", function UpdateFlagComponent_Template_button_click_40_listener() { return ctx.onNext(); });
20785
- i0__namespace.ɵɵtext(41, " Next ");
20806
+ i0__namespace.ɵɵelementStart(38, "div", 27);
20807
+ i0__namespace.ɵɵelementStart(39, "button", 28);
20808
+ i0__namespace.ɵɵlistener("click", function UpdateFlagComponent_Template_button_click_39_listener() { return ctx.onNext(); });
20809
+ i0__namespace.ɵɵtext(40, " Next ");
20786
20810
  i0__namespace.ɵɵelementEnd();
20787
20811
  i0__namespace.ɵɵelementEnd();
20788
20812
  }
20789
20813
  if (rf & 2) {
20790
20814
  i0__namespace.ɵɵproperty("formGroup", ctx.formGroup);
20791
20815
  i0__namespace.ɵɵadvance(2);
20792
- i0__namespace.ɵɵproperty("ngClass", i0__namespace.ɵɵpureFunction1(28, _c0$n, ctx.errorMessages.length > 0));
20816
+ i0__namespace.ɵɵproperty("ngClass", i0__namespace.ɵɵpureFunction1(26, _c0$n, ctx.errorMessages.length > 0));
20793
20817
  i0__namespace.ɵɵadvance(3);
20794
20818
  i0__namespace.ɵɵtextInterpolate1(" ", ctx.updateFlagTitle, " ");
20795
20819
  i0__namespace.ɵɵadvance(2);
@@ -20811,8 +20835,8 @@
20811
20835
  i0__namespace.ɵɵadvance(1);
20812
20836
  i0__namespace.ɵɵproperty("id", ctx.caseFlagFormFields.STATUS);
20813
20837
  i0__namespace.ɵɵadvance(1);
20814
- i0__namespace.ɵɵproperty("ngForOf", i0__namespace.ɵɵpipeBind1(24, 26, ctx.caseFlagStatuses));
20815
- i0__namespace.ɵɵadvance(3);
20838
+ i0__namespace.ɵɵproperty("ngForOf", ctx.validStatusProgressions);
20839
+ i0__namespace.ɵɵadvance(2);
20816
20840
  i0__namespace.ɵɵtextInterpolate1(" ", ctx.updateFlagStepEnum.STATUS_HINT_TEXT, " ");
20817
20841
  i0__namespace.ɵɵadvance(1);
20818
20842
  i0__namespace.ɵɵproperty("ngIf", ctx.statusReasonNotEnteredErrorMessage);
@@ -20827,7 +20851,7 @@
20827
20851
  i0__namespace.ɵɵadvance(1);
20828
20852
  i0__namespace.ɵɵproperty("for", ctx.caseFlagFormFields.IS_WELSH_TRANSLATION_NEEDED);
20829
20853
  }
20830
- }, directives: [i1__namespace$3.NgControlStatusGroup, i1__namespace$3.FormGroupDirective, i1__namespace.NgClass, i1__namespace.NgIf, i1__namespace$3.DefaultValueAccessor, i1__namespace$3.NgControlStatus, i1__namespace$3.FormControlName, i1__namespace.NgForOf, i1__namespace$3.CheckboxControlValueAccessor, i1__namespace$3.RadioControlValueAccessor], pipes: [EnumDisplayDescriptionPipe], encapsulation: 2 });
20854
+ }, directives: [i1__namespace$3.NgControlStatusGroup, i1__namespace$3.FormGroupDirective, i1__namespace.NgClass, i1__namespace.NgIf, i1__namespace$3.DefaultValueAccessor, i1__namespace$3.NgControlStatus, i1__namespace$3.FormControlName, i1__namespace.NgForOf, i1__namespace$3.CheckboxControlValueAccessor, i1__namespace$3.RadioControlValueAccessor], encapsulation: 2 });
20831
20855
  (function () {
20832
20856
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(UpdateFlagComponent, [{
20833
20857
  type: i0.Component,