@hmcts/ccd-case-ui-toolkit 7.2.34 → 7.2.35-multiple-followup

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.
Files changed (27) hide show
  1. package/esm2022/lib/app.config.mjs +2 -1
  2. package/esm2022/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.mjs +5 -2
  3. package/esm2022/lib/shared/components/palette/query-management/components/query-details/query-details.component.mjs +55 -8
  4. package/esm2022/lib/shared/components/palette/query-management/models/case-queries-collection.model.mjs +1 -1
  5. package/esm2022/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.mjs +43 -7
  6. package/esm2022/lib/shared/components/palette/query-management/read-query-management-field.component.mjs +77 -24
  7. package/esm2022/lib/shared/components/palette/query-management/services/query-management.service.mjs +2 -2
  8. package/esm2022/lib/shared/components/palette/query-management/utils/query-management.utils.mjs +12 -4
  9. package/esm2022/lib/shared/utils.mjs +1 -1
  10. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +179 -40
  11. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  12. package/lib/app.config.d.ts +2 -0
  13. package/lib/app.config.d.ts.map +1 -1
  14. package/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.d.ts +2 -1
  15. package/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.d.ts.map +1 -1
  16. package/lib/shared/components/palette/query-management/components/query-details/query-details.component.d.ts +15 -3
  17. package/lib/shared/components/palette/query-management/components/query-details/query-details.component.d.ts.map +1 -1
  18. package/lib/shared/components/palette/query-management/models/case-queries-collection.model.d.ts +1 -0
  19. package/lib/shared/components/palette/query-management/models/case-queries-collection.model.d.ts.map +1 -1
  20. package/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.d.ts +1 -0
  21. package/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.d.ts.map +1 -1
  22. package/lib/shared/components/palette/query-management/read-query-management-field.component.d.ts +15 -3
  23. package/lib/shared/components/palette/query-management/read-query-management-field.component.d.ts.map +1 -1
  24. package/lib/shared/components/palette/query-management/utils/query-management.utils.d.ts +1 -1
  25. package/lib/shared/components/palette/query-management/utils/query-management.utils.d.ts.map +1 -1
  26. package/lib/shared/utils.d.ts +1 -1
  27. package/package.json +1 -1
@@ -1326,6 +1326,7 @@ class CaseEditorConfig {
1326
1326
  icp_enabled;
1327
1327
  icp_jurisdictions;
1328
1328
  events_to_hide;
1329
+ enable_service_specific_multi_followups;
1329
1330
  }
1330
1331
 
1331
1332
  class HttpError {
@@ -20666,6 +20667,7 @@ class QueryListItem {
20666
20667
  createdBy;
20667
20668
  parentId;
20668
20669
  isClosed;
20670
+ messageType;
20669
20671
  children = [];
20670
20672
  messageIndexInParent = null;
20671
20673
  get lastSubmittedMessage() {
@@ -20692,14 +20694,34 @@ class QueryListItem {
20692
20694
  }
20693
20695
  get lastSubmittedDate() {
20694
20696
  const childrenCount = this.children.length;
20695
- if (childrenCount <= 1) {
20697
+ const lastChild = this.children[childrenCount - 1];
20698
+ // 1. Check for legacy: <= 1 child with no messageType
20699
+ const allChildrenLackMessageType = this.children.every((child) => !child.messageType);
20700
+ if (childrenCount <= 1 && allChildrenLackMessageType) {
20696
20701
  return new Date(this.lastSubmittedMessage.createdOn);
20697
20702
  }
20698
- let index;
20699
- if (childrenCount > 1) {
20700
- index = childrenCount % 2 === 0 ? childrenCount - 1 : childrenCount - 2;
20703
+ // 2. Check if any RESPOND exists
20704
+ const hasRespond = this.children.some((child) => child.messageType === QueryCreateContext.RESPOND);
20705
+ // 3. Check if all children are FOLLOWUPs and none are RESPONDs
20706
+ const onlyFollowUps = this.children.every((child) => child.messageType === QueryCreateContext.FOLLOWUP);
20707
+ if (onlyFollowUps && !hasRespond) {
20708
+ return new Date(lastChild.createdOn);
20701
20709
  }
20702
- return new Date(this.children[index].createdOn);
20710
+ // 4. If RESPOND exists, get latest FOLLOWUP
20711
+ // If no RESPOND, but there is at least one FOLLOWUP, return the last FOLLOWUP
20712
+ const lastFollowUp = [...this.children]
20713
+ .reverse()
20714
+ .find((child) => child.messageType === QueryCreateContext.FOLLOWUP);
20715
+ if (lastFollowUp) {
20716
+ return new Date(lastFollowUp.createdOn);
20717
+ }
20718
+ // 5. Legacy fallback: no messageType at all
20719
+ if (allChildrenLackMessageType) {
20720
+ const index = childrenCount % 2 === 0 ? childrenCount - 1 : childrenCount - 2;
20721
+ return new Date(this.children[index]?.createdOn);
20722
+ }
20723
+ // 6. Final fallback: return last child's date
20724
+ return new Date(this.lastSubmittedMessage.createdOn);
20703
20725
  }
20704
20726
  get lastResponseBy() {
20705
20727
  return this.children?.length > 0 ? this.lastSubmittedMessage.name : '';
@@ -20709,6 +20731,11 @@ class QueryListItem {
20709
20731
  if (childrenCount === 0) {
20710
20732
  return null;
20711
20733
  }
20734
+ const lastChild = this.children[childrenCount - 1];
20735
+ if (lastChild?.messageType === QueryCreateContext.FOLLOWUP &&
20736
+ !this.children.some((child) => child.messageType === QueryCreateContext.RESPOND)) {
20737
+ return null;
20738
+ }
20712
20739
  let index;
20713
20740
  if (childrenCount === 1) {
20714
20741
  index = 0;
@@ -20723,11 +20750,20 @@ class QueryListItem {
20723
20750
  if (item.isClosed === 'Yes') {
20724
20751
  return true;
20725
20752
  }
20726
- return item.children?.some(child => isThreadClosed(child)) || false;
20753
+ return item.children?.some((child) => isThreadClosed(child)) || false;
20727
20754
  };
20728
20755
  if (isThreadClosed(this)) {
20729
20756
  return QueryItemResponseStatus.CLOSED;
20730
20757
  }
20758
+ const lastMessageType = this.children?.length
20759
+ ? this.children[this.children.length - 1]?.messageType
20760
+ : undefined;
20761
+ if (lastMessageType && lastMessageType === QueryCreateContext.RESPOND) {
20762
+ return QueryItemResponseStatus.RESPONDED;
20763
+ }
20764
+ else if (lastMessageType && lastMessageType === QueryCreateContext.FOLLOWUP) {
20765
+ return QueryItemResponseStatus.AWAITING;
20766
+ }
20731
20767
  if (this.messageIndexInParent !== null) {
20732
20768
  return this.messageIndexInParent % 2 === 0
20733
20769
  ? QueryItemResponseStatus.RESPONDED
@@ -20816,16 +20852,22 @@ class QueryManagementUtils {
20816
20852
  isHearingRelated,
20817
20853
  hearingDate,
20818
20854
  createdOn: new Date(),
20819
- createdBy: currentUserId
20855
+ createdBy: currentUserId,
20856
+ messageType: QueryCreateContext.FOLLOWUP // Default to value new queries will be FOLLOWUP
20820
20857
  };
20821
20858
  }
20822
- static getRespondOrFollowupQueryData(formGroup, queryItem, currentUserDetails) {
20859
+ static getRespondOrFollowupQueryData(formGroup, queryItem, currentUserDetails, messageTypeParam) {
20823
20860
  const currentUserId = currentUserDetails?.uid || currentUserDetails?.id;
20824
20861
  const currentUserName = currentUserDetails?.name || `${currentUserDetails?.forename} ${currentUserDetails?.surname}`;
20825
20862
  const body = formGroup.get('body').value.trim();
20826
20863
  const attachments = formGroup.get('attachments').value;
20827
20864
  const formDocument = attachments.map((document) => this.documentToCollectionFormDocument(document));
20828
20865
  const isClosed = formGroup.get('closeQuery').value ? 'Yes' : 'No';
20866
+ const messageType = messageTypeParam === QueryCreateContext.RESPOND
20867
+ ? QueryCreateContext.RESPOND
20868
+ : messageTypeParam === QueryCreateContext.FOLLOWUP
20869
+ ? QueryCreateContext.FOLLOWUP
20870
+ : undefined;
20829
20871
  return {
20830
20872
  id: v4(),
20831
20873
  subject: queryItem.subject.trim(),
@@ -20837,7 +20879,8 @@ class QueryManagementUtils {
20837
20879
  createdOn: new Date(),
20838
20880
  createdBy: currentUserId,
20839
20881
  parentId: queryItem.id,
20840
- isClosed
20882
+ isClosed,
20883
+ messageType
20841
20884
  };
20842
20885
  }
20843
20886
  static isObject(elem) {
@@ -20885,7 +20928,7 @@ class QueryManagementService {
20885
20928
  }
20886
20929
  const caseMessage = queryCreateContext === QueryCreateContext.NEW_QUERY
20887
20930
  ? QueryManagementUtils.getNewQueryData(formGroup, currentUserDetails)
20888
- : QueryManagementUtils.getRespondOrFollowupQueryData(formGroup, queryItem, currentUserDetails);
20931
+ : QueryManagementUtils.getRespondOrFollowupQueryData(formGroup, queryItem, currentUserDetails, queryCreateContext);
20889
20932
  const isNewQuery = queryCreateContext === QueryCreateContext.NEW_QUERY; // Check if this is a new query
20890
20933
  // Check if the field ID has been set dynamically
20891
20934
  if (!this.fieldId) {
@@ -21624,6 +21667,7 @@ class QueryCheckYourAnswersComponent {
21624
21667
  queryItem;
21625
21668
  queryCreateContext;
21626
21669
  eventData = null;
21670
+ multipleFollowUpFeature;
21627
21671
  qmCaseQueriesCollectionData;
21628
21672
  backClicked = new EventEmitter();
21629
21673
  querySubmitted = new EventEmitter();
@@ -21817,7 +21861,7 @@ class QueryCheckYourAnswersComponent {
21817
21861
  this.queryManagementService.setCaseQueriesCollectionData(this.eventData, this.queryCreateContext, this.caseDetails, this.messageId);
21818
21862
  }
21819
21863
  static ɵfac = function QueryCheckYourAnswersComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || QueryCheckYourAnswersComponent)(i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(WorkAllocationService), i0.ɵɵdirectiveInject(QualifyingQuestionService), i0.ɵɵdirectiveInject(QueryManagementService), i0.ɵɵdirectiveInject(ErrorNotifierService), i0.ɵɵdirectiveInject(AlertService)); };
21820
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryCheckYourAnswersComponent, selectors: [["ccd-query-check-your-answers"]], inputs: { formGroup: "formGroup", queryItem: "queryItem", queryCreateContext: "queryCreateContext", eventData: "eventData", qmCaseQueriesCollectionData: "qmCaseQueriesCollectionData" }, outputs: { backClicked: "backClicked", querySubmitted: "querySubmitted", callbackConfirmationMessage: "callbackConfirmationMessage" }, decls: 1, vars: 1, consts: [["defaultCheckYourAnswersTitle", ""], ["isHearingRelatedFalse", ""], ["class", "govuk-grid-row", 4, "ngIf"], [1, "govuk-grid-row"], [1, "govuk-grid-column-two-thirds-from-desktop"], ["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], ["class", "error-summary", "role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 4, "ngIf"], [3, "callbackErrorsSubject"], [4, "ngIf"], [1, "govuk-heading-l"], [4, "ngIf", "ngIfElse"], [1, "govuk-!-margin-bottom-4"], [3, "caseDetails"], ["class", "govuk-summary-list govuk-!-margin-bottom-0", 4, "ngIf"], [1, "govuk-summary-list", "govuk-!-margin-bottom-0"], [1, "govuk-summary-list__row"], [1, "govuk-summary-list__key"], [1, "govuk-summary-list__value"], [1, "govuk-summary-list__actions"], ["href", "javascript:void(0)", 1, "govuk-link", 3, "click"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-button--secondary", "govuk-!-margin-right-3", 3, "click"], ["data-module", "govuk-button", "type", "submit", 1, "govuk-button", 3, "click"], [3, "eventCompletionParams"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["href", "javascript:void(0)", 1, "validation-error", 3, "id"], ["role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 1, "error-summary"], ["id", "event_error-summary-heading", 1, "heading-h3", "error-summary-heading"], ["class", "error-summary-list", 4, "ngIf"], [1, "error-summary-list"], ["class", "ccd-error-summary-li", 4, "ngFor", "ngForOf"], [1, "ccd-error-summary-li"], [1, "govuk-caption-l"], ["href", "javascript:void(0)", "class", "govuk-link", 3, "click", 4, "ngIf"], ["class", "govuk-summary-list__row", 4, "ngIf"], [1, "govuk-summary-list__value", "govuk-summary-list__value--documentAttached"], [3, "attachments", 4, "ngIf"], [3, "attachments"]], template: function QueryCheckYourAnswersComponent_Template(rf, ctx) { if (rf & 1) {
21864
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryCheckYourAnswersComponent, selectors: [["ccd-query-check-your-answers"]], inputs: { formGroup: "formGroup", queryItem: "queryItem", queryCreateContext: "queryCreateContext", eventData: "eventData", multipleFollowUpFeature: "multipleFollowUpFeature", qmCaseQueriesCollectionData: "qmCaseQueriesCollectionData" }, outputs: { backClicked: "backClicked", querySubmitted: "querySubmitted", callbackConfirmationMessage: "callbackConfirmationMessage" }, decls: 1, vars: 1, consts: [["defaultCheckYourAnswersTitle", ""], ["isHearingRelatedFalse", ""], ["class", "govuk-grid-row", 4, "ngIf"], [1, "govuk-grid-row"], [1, "govuk-grid-column-two-thirds-from-desktop"], ["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], ["class", "error-summary", "role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 4, "ngIf"], [3, "callbackErrorsSubject"], [4, "ngIf"], [1, "govuk-heading-l"], [4, "ngIf", "ngIfElse"], [1, "govuk-!-margin-bottom-4"], [3, "caseDetails"], ["class", "govuk-summary-list govuk-!-margin-bottom-0", 4, "ngIf"], [1, "govuk-summary-list", "govuk-!-margin-bottom-0"], [1, "govuk-summary-list__row"], [1, "govuk-summary-list__key"], [1, "govuk-summary-list__value"], [1, "govuk-summary-list__actions"], ["href", "javascript:void(0)", 1, "govuk-link", 3, "click"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-button--secondary", "govuk-!-margin-right-3", 3, "click"], ["data-module", "govuk-button", "type", "submit", 1, "govuk-button", 3, "click"], [3, "eventCompletionParams"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["href", "javascript:void(0)", 1, "validation-error", 3, "id"], ["role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 1, "error-summary"], ["id", "event_error-summary-heading", 1, "heading-h3", "error-summary-heading"], ["class", "error-summary-list", 4, "ngIf"], [1, "error-summary-list"], ["class", "ccd-error-summary-li", 4, "ngFor", "ngForOf"], [1, "ccd-error-summary-li"], [1, "govuk-caption-l"], ["href", "javascript:void(0)", "class", "govuk-link", 3, "click", 4, "ngIf"], ["class", "govuk-summary-list__row", 4, "ngIf"], [1, "govuk-summary-list__value", "govuk-summary-list__value--documentAttached"], [3, "attachments", 4, "ngIf"], [3, "attachments"]], template: function QueryCheckYourAnswersComponent_Template(rf, ctx) { if (rf & 1) {
21821
21865
  i0.ɵɵtemplate(0, QueryCheckYourAnswersComponent_div_0_Template, 36, 25, "div", 2);
21822
21866
  } if (rf & 2) {
21823
21867
  i0.ɵɵproperty("ngIf", ctx.readyToSubmit);
@@ -21834,6 +21878,8 @@ class QueryCheckYourAnswersComponent {
21834
21878
  type: Input
21835
21879
  }], eventData: [{
21836
21880
  type: Input
21881
+ }], multipleFollowUpFeature: [{
21882
+ type: Input
21837
21883
  }], qmCaseQueriesCollectionData: [{
21838
21884
  type: Input
21839
21885
  }], backClicked: [{
@@ -22055,10 +22101,12 @@ function QueryDetailsComponent_ng_container_0_ng_container_44_ng_container_1_Tem
22055
22101
  i0.ɵɵtemplate(1, QueryDetailsComponent_ng_container_0_ng_container_44_ng_container_1_ng_container_1_Template, 23, 19, "ng-container", 15)(2, QueryDetailsComponent_ng_container_0_ng_container_44_ng_container_1_ng_template_2_Template, 27, 22, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
22056
22102
  i0.ɵɵelementContainerEnd();
22057
22103
  } if (rf & 2) {
22104
+ const child_r3 = ctx.$implicit;
22058
22105
  const i_r4 = ctx.index;
22059
22106
  const followUpMessage_r5 = i0.ɵɵreference(3);
22107
+ const ctx_r1 = i0.ɵɵnextContext(3);
22060
22108
  i0.ɵɵadvance();
22061
- i0.ɵɵproperty("ngIf", i_r4 % 2 === 0)("ngIfElse", followUpMessage_r5);
22109
+ i0.ɵɵproperty("ngIf", i_r4 % 2 === 0 && !(child_r3 == null ? null : child_r3.messageType) || child_r3 && (child_r3 == null ? null : child_r3.messageType) === ctx_r1.respondToQuery)("ngIfElse", followUpMessage_r5);
22062
22110
  } }
22063
22111
  function QueryDetailsComponent_ng_container_0_ng_container_44_Template(rf, ctx) { if (rf & 1) {
22064
22112
  i0.ɵɵelementContainerStart(0);
@@ -22162,6 +22210,8 @@ class QueryDetailsComponent {
22162
22210
  sessionStorageService;
22163
22211
  route;
22164
22212
  router;
22213
+ abstractConfig;
22214
+ caseNotifier;
22165
22215
  query;
22166
22216
  caseId;
22167
22217
  queryResponseStatus;
@@ -22171,10 +22221,18 @@ class QueryDetailsComponent {
22171
22221
  static QUERY_ITEM_RESPOND = '3';
22172
22222
  static QUERY_ITEM_FOLLOW_UP = '4';
22173
22223
  queryItemId;
22174
- constructor(sessionStorageService, route, router) {
22224
+ followUpQuery = QueryCreateContext.FOLLOWUP;
22225
+ respondToQuery = QueryCreateContext.RESPOND;
22226
+ enableServiceSpecificMultiFollowups;
22227
+ currentJurisdictionId;
22228
+ isMultipleFollowUpEnabled = false;
22229
+ caseSubscription;
22230
+ constructor(sessionStorageService, route, router, abstractConfig, caseNotifier) {
22175
22231
  this.sessionStorageService = sessionStorageService;
22176
22232
  this.route = route;
22177
22233
  this.router = router;
22234
+ this.abstractConfig = abstractConfig;
22235
+ this.caseNotifier = caseNotifier;
22178
22236
  }
22179
22237
  onBack() {
22180
22238
  this.backClicked.emit(true);
@@ -22182,10 +22240,23 @@ class QueryDetailsComponent {
22182
22240
  isInternalUser() {
22183
22241
  return isInternalUser(this.sessionStorageService);
22184
22242
  }
22243
+ ngOnInit() {
22244
+ this.enableServiceSpecificMultiFollowups = this.abstractConfig.getEnableServiceSpecificMultiFollowups() || [];
22245
+ this.caseSubscription = this.caseNotifier.caseView.subscribe((caseView) => {
22246
+ if (caseView?.case_type?.jurisdiction?.id) {
22247
+ this.currentJurisdictionId = caseView.case_type.jurisdiction.id;
22248
+ this.isMultipleFollowUpEnabled = this.enableServiceSpecificMultiFollowups.includes(this.currentJurisdictionId);
22249
+ this.hasRespondedToQuery();
22250
+ }
22251
+ });
22252
+ }
22185
22253
  ngOnChanges() {
22186
22254
  this.toggleLinkVisibility();
22187
22255
  this.hasRespondedToQuery();
22188
22256
  }
22257
+ ngOnDestroy() {
22258
+ this.caseSubscription?.unsubscribe();
22259
+ }
22189
22260
  toggleLinkVisibility() {
22190
22261
  this.queryItemId = this.route.snapshot.params.qid;
22191
22262
  if (this.queryItemId === QueryDetailsComponent.QUERY_ITEM_RESPOND || this.queryItemId === QueryDetailsComponent.QUERY_ITEM_FOLLOW_UP) {
@@ -22198,6 +22269,24 @@ class QueryDetailsComponent {
22198
22269
  this.hasResponded.emit(true);
22199
22270
  return true;
22200
22271
  }
22272
+ const lastChild = this.query?.children?.[this.query.children.length - 1];
22273
+ const lastMessageType = this.query?.children?.length
22274
+ ? this.query.children[this.query.children.length - 1]?.messageType
22275
+ : this.query?.messageType;
22276
+ const isFollowUp = lastMessageType === this.followUpQuery;
22277
+ const isRespond = lastChild?.messageType === this.respondToQuery;
22278
+ if (this.queryResponseStatus === QueryItemResponseStatus.CLOSED) {
22279
+ this.hasResponded.emit(true);
22280
+ return true;
22281
+ }
22282
+ if (isFollowUp && this.isMultipleFollowUpEnabled) {
22283
+ this.hasResponded.emit(false);
22284
+ return false;
22285
+ }
22286
+ if (isRespond) {
22287
+ this.hasResponded.emit(false);
22288
+ return false;
22289
+ }
22201
22290
  if (this.isInternalUser()) {
22202
22291
  if (isAwaiting) {
22203
22292
  this.hasResponded.emit(false);
@@ -22213,7 +22302,7 @@ class QueryDetailsComponent {
22213
22302
  this.hasResponded.emit(false);
22214
22303
  return false;
22215
22304
  }
22216
- static ɵfac = function QueryDetailsComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || QueryDetailsComponent)(i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(i1$1.Router)); };
22305
+ static ɵfac = function QueryDetailsComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || QueryDetailsComponent)(i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(CaseNotifier)); };
22217
22306
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryDetailsComponent, selectors: [["ccd-query-details"]], inputs: { query: "query", caseId: "caseId", queryResponseStatus: "queryResponseStatus" }, outputs: { backClicked: "backClicked", hasResponded: "hasResponded" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["followUpMessage", ""], [4, "ngIf"], [1, "govuk-table", "query-details-table"], [1, "govuk-table__caption", "govuk-table__caption--l"], [1, "govuk-table__body"], [1, "govuk-table__row"], ["scope", "row", 1, "govuk-table__header"], [1, "govuk-table__cell"], ["class", "govuk-table__row govuk-table__row--isHearingRelated", 4, "ngIf"], ["class", "govuk-table__row", 4, "ngIf"], ["href", "javascript:void(0)", 1, "govuk-link", 3, "click"], [1, "govuk-table__row", "govuk-table__row--isHearingRelated"], [3, "attachments", 4, "ngIf"], [3, "attachments"], [4, "ngFor", "ngForOf"], [4, "ngIf", "ngIfElse"]], template: function QueryDetailsComponent_Template(rf, ctx) { if (rf & 1) {
22218
22307
  i0.ɵɵtemplate(0, QueryDetailsComponent_ng_container_0_Template, 45, 41, "ng-container", 1);
22219
22308
  } if (rf & 2) {
@@ -22222,8 +22311,8 @@ class QueryDetailsComponent {
22222
22311
  }
22223
22312
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(QueryDetailsComponent, [{
22224
22313
  type: Component,
22225
- args: [{ selector: 'ccd-query-details', template: "<ng-container *ngIf=\"query\">\n <p *ngIf=\"showItem\">\n <br />\n <a class=\"govuk-link\" href=\"javascript:void(0)\" (click)=\"onBack()\">{{ 'Back to query list' | rpxTranslate }}</a>\n </p>\n <div>\n <table class=\"govuk-table query-details-table\" [attr.aria-describedby]=\"'Details of the query' | rpxTranslate\">\n <caption class=\"govuk-table__caption govuk-table__caption--l\">\n <div>{{ 'Query details' | rpxTranslate }}</div>\n </caption>\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Last submitted by' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.lastSubmittedBy }}</td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Submission date' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.createdOn | date: 'dd MMMM YYYY HH:mm' }}</td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Query subject' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.subject }}</td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Query body' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.body }}</td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\" [class.govuk-table__header--no-border]=\"query.isHearingRelated\">\n {{ 'Is the query hearing related?' | rpxTranslate }}\n </th>\n <td class=\"govuk-table__cell\" [class.govuk-table__cell--no-border]=\"query.isHearingRelated\">\n {{ 'Is the query hearing related?' | rpxTranslate: null : (query.isHearingRelated) }}</td>\n </tr>\n <tr class=\"govuk-table__row govuk-table__row--isHearingRelated\" *ngIf=\"query.isHearingRelated === 'Yes'\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'What is the date of the hearing?' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.hearingDate | date: 'dd MMM yyyy' }}</td>\n </tr>\n <tr class=\"govuk-table__row\" *ngIf=\"query.attachments.length > 0\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Attachments' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">\n <ccd-query-attachments-read\n *ngIf=\"query.attachments\"\n [attachments]=\"query.attachments\"\n >\n </ccd-query-attachments-read>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <ng-container *ngIf=\"query.children?.length > 0\">\n <ng-container *ngFor=\"let child of query.children; let i = index;\">\n <ng-container *ngIf=\"i % 2 === 0; else followUpMessage\">\n <table class=\"govuk-table query-details-table\" [attr.aria-describedby]=\"'Response of the query' | rpxTranslate\">\n <caption class=\"govuk-table__caption govuk-table__caption--l\">\n <div>{{ 'Response' | rpxTranslate }}</div>\n </caption>\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Last response date' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.createdOn | date: 'dd MMMM YYYY HH:mm' }}</td>\n </tr>\n\n <tr *ngIf=\"isInternalUser()\" class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Caseworker name' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.name }}</td>\n </tr>\n\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Response detail' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.body }}</td>\n </tr>\n\n <tr class=\"govuk-table__row\" *ngIf=\"child.attachments.length > 0\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Attachments' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">\n <ccd-query-attachments-read\n *ngIf=\"child.attachments\"\n [attachments]=\"child.attachments\"\n >\n </ccd-query-attachments-read>\n </td>\n </tr>\n </tbody>\n </table>\n </ng-container>\n\n <ng-template #followUpMessage>\n <!-- <div class=\"query_details_caption\">{{ 'Follow-up' | rpxTranslate }}</div> -->\n <table class=\"govuk-table query-details-table\"\n [attr.aria-describedby]=\"'Follow-up of the response' | rpxTranslate\">\n <caption class=\"govuk-table__caption govuk-table__caption--l\">\n <div>{{ 'Follow up query' | rpxTranslate }}</div>\n </caption>\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Last submission date' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.createdOn | date: 'dd MMMM YYYY HH:mm'}}</td>\n </tr>\n\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Last submitted by' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.name }}</td>\n </tr>\n\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Query detail' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.body }}</td>\n </tr>\n\n <tr class=\"govuk-table__row\" *ngIf=\"child.attachments.length > 0\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Attachments' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">\n <ccd-query-attachments-read\n *ngIf=\"child.attachments\"\n [attachments]=\"child.attachments\"\n >\n </ccd-query-attachments-read>\n </td>\n </tr>\n </tbody>\n </table>\n </ng-template>\n </ng-container>\n </ng-container>\n</ng-container>\n", styles: [".query-details-table .govuk-table__header{width:330px}\n"] }]
22226
- }], () => [{ type: SessionStorageService }, { type: i1$1.ActivatedRoute }, { type: i1$1.Router }], { query: [{
22314
+ args: [{ selector: 'ccd-query-details', template: "<ng-container *ngIf=\"query\">\n <p *ngIf=\"showItem\">\n <br />\n <a class=\"govuk-link\" href=\"javascript:void(0)\" (click)=\"onBack()\">{{ 'Back to query list' | rpxTranslate }}</a>\n </p>\n <div>\n <table class=\"govuk-table query-details-table\" [attr.aria-describedby]=\"'Details of the query' | rpxTranslate\">\n <caption class=\"govuk-table__caption govuk-table__caption--l\">\n <div>{{ 'Query details' | rpxTranslate }}</div>\n </caption>\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Last submitted by' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.lastSubmittedBy }}</td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Submission date' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.createdOn | date: 'dd MMMM YYYY HH:mm' }}</td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Query subject' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.subject }}</td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Query body' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.body }}</td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\" [class.govuk-table__header--no-border]=\"query.isHearingRelated\">\n {{ 'Is the query hearing related?' | rpxTranslate }}\n </th>\n <td class=\"govuk-table__cell\" [class.govuk-table__cell--no-border]=\"query.isHearingRelated\">\n {{ 'Is the query hearing related?' | rpxTranslate: null : (query.isHearingRelated) }}</td>\n </tr>\n <tr class=\"govuk-table__row govuk-table__row--isHearingRelated\" *ngIf=\"query.isHearingRelated === 'Yes'\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'What is the date of the hearing?' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ query.hearingDate | date: 'dd MMM yyyy' }}</td>\n </tr>\n <tr class=\"govuk-table__row\" *ngIf=\"query.attachments.length > 0\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Attachments' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">\n <ccd-query-attachments-read\n *ngIf=\"query.attachments\"\n [attachments]=\"query.attachments\"\n >\n </ccd-query-attachments-read>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <ng-container *ngIf=\"query.children?.length > 0\">\n <ng-container *ngFor=\"let child of query.children; let i = index;\">\n <ng-container *ngIf=\"(i % 2 === 0 && !child?.messageType) || (child && child?.messageType === respondToQuery); else followUpMessage\">\n <table class=\"govuk-table query-details-table\" [attr.aria-describedby]=\"'Response of the query' | rpxTranslate\">\n <caption class=\"govuk-table__caption govuk-table__caption--l\">\n <div>{{ 'Response' | rpxTranslate }}</div>\n </caption>\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Last response date' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.createdOn | date: 'dd MMMM YYYY HH:mm' }}</td>\n </tr>\n\n <tr *ngIf=\"isInternalUser()\" class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Caseworker name' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.name }}</td>\n </tr>\n\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Response detail' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.body }}</td>\n </tr>\n\n <tr class=\"govuk-table__row\" *ngIf=\"child.attachments.length > 0\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Attachments' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">\n <ccd-query-attachments-read\n *ngIf=\"child.attachments\"\n [attachments]=\"child.attachments\"\n >\n </ccd-query-attachments-read>\n </td>\n </tr>\n </tbody>\n </table>\n </ng-container>\n\n <ng-template #followUpMessage>\n <!-- <div class=\"query_details_caption\">{{ 'Follow-up' | rpxTranslate }}</div> -->\n <table class=\"govuk-table query-details-table\"\n [attr.aria-describedby]=\"'Follow-up of the response' | rpxTranslate\">\n <caption class=\"govuk-table__caption govuk-table__caption--l\">\n <div>{{ 'Follow up query' | rpxTranslate }}</div>\n </caption>\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Last submission date' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.createdOn | date: 'dd MMMM YYYY HH:mm'}}</td>\n </tr>\n\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Last submitted by' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.name }}</td>\n </tr>\n\n <tr class=\"govuk-table__row\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Query detail' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">{{ child.body }}</td>\n </tr>\n\n <tr class=\"govuk-table__row\" *ngIf=\"child.attachments.length > 0\">\n <th scope=\"row\" class=\"govuk-table__header\">{{ 'Attachments' | rpxTranslate }}</th>\n <td class=\"govuk-table__cell\">\n <ccd-query-attachments-read\n *ngIf=\"child.attachments\"\n [attachments]=\"child.attachments\"\n >\n </ccd-query-attachments-read>\n </td>\n </tr>\n </tbody>\n </table>\n </ng-template>\n </ng-container>\n </ng-container>\n</ng-container>\n", styles: [".query-details-table .govuk-table__header{width:330px}\n"] }]
22315
+ }], () => [{ type: SessionStorageService }, { type: i1$1.ActivatedRoute }, { type: i1$1.Router }, { type: AbstractAppConfig }, { type: CaseNotifier }], { query: [{
22227
22316
  type: Input
22228
22317
  }], caseId: [{
22229
22318
  type: Input
@@ -22234,7 +22323,7 @@ class QueryDetailsComponent {
22234
22323
  }], hasResponded: [{
22235
22324
  type: Output
22236
22325
  }] }); })();
22237
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryDetailsComponent, { className: "QueryDetailsComponent", filePath: "lib/shared/components/palette/query-management/components/query-details/query-details.component.ts", lineNumber: 14 }); })();
22326
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryDetailsComponent, { className: "QueryDetailsComponent", filePath: "lib/shared/components/palette/query-management/components/query-details/query-details.component.ts", lineNumber: 17 }); })();
22238
22327
 
22239
22328
  class QueryEventCompletionComponent {
22240
22329
  eventCompletionParams;
@@ -23310,7 +23399,7 @@ class CloseQueryComponent {
23310
23399
  const _c0$B = (a0, a1) => ["/query-management", "query", a0, "4", a1];
23311
23400
  function ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_div_1_Template(rf, ctx) { if (rf & 1) {
23312
23401
  const _r1 = i0.ɵɵgetCurrentView();
23313
- i0.ɵɵelementStart(0, "div", 5)(1, "ccd-query-list", 6);
23402
+ i0.ɵɵelementStart(0, "div", 6)(1, "ccd-query-list", 7);
23314
23403
  i0.ɵɵlistener("selectedQuery", function ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_div_1_Template_ccd_query_list_selectedQuery_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.setQuery($event)); });
23315
23404
  i0.ɵɵelementEnd()();
23316
23405
  } if (rf & 2) {
@@ -23320,7 +23409,7 @@ function ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_div_1_T
23320
23409
  } }
23321
23410
  function ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_Template(rf, ctx) { if (rf & 1) {
23322
23411
  i0.ɵɵelementContainerStart(0);
23323
- i0.ɵɵtemplate(1, ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_div_1_Template, 2, 1, "div", 4);
23412
+ i0.ɵɵtemplate(1, ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_div_1_Template, 2, 1, "div", 5);
23324
23413
  i0.ɵɵelementContainerEnd();
23325
23414
  } if (rf & 2) {
23326
23415
  const ctx_r1 = i0.ɵɵnextContext(2);
@@ -23329,7 +23418,7 @@ function ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_Templat
23329
23418
  } }
23330
23419
  function ReadQueryManagementFieldComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
23331
23420
  i0.ɵɵelementContainerStart(0);
23332
- i0.ɵɵtemplate(1, ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_Template, 2, 1, "ng-container", 3);
23421
+ i0.ɵɵtemplate(1, ReadQueryManagementFieldComponent_ng_container_0_ng_container_1_Template, 2, 1, "ng-container", 4);
23333
23422
  i0.ɵɵelementContainerEnd();
23334
23423
  } if (rf & 2) {
23335
23424
  const ctx_r1 = i0.ɵɵnextContext();
@@ -23338,7 +23427,7 @@ function ReadQueryManagementFieldComponent_ng_container_0_Template(rf, ctx) { if
23338
23427
  } }
23339
23428
  function ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_container_1_Template(rf, ctx) { if (rf & 1) {
23340
23429
  i0.ɵɵelementContainerStart(0);
23341
- i0.ɵɵelementStart(1, "button", 9);
23430
+ i0.ɵɵelementStart(1, "button", 10);
23342
23431
  i0.ɵɵtext(2);
23343
23432
  i0.ɵɵpipe(3, "rpxTranslate");
23344
23433
  i0.ɵɵelementEnd();
@@ -23350,8 +23439,22 @@ function ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_conta
23350
23439
  i0.ɵɵadvance();
23351
23440
  i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 2, "Ask a follow-up question"), " ");
23352
23441
  } }
23353
- function ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_template_2_Template(rf, ctx) { if (rf & 1) {
23354
- i0.ɵɵelementStart(0, "div")(1, "p", 10);
23442
+ function ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_template_2_ng_container_0_Template(rf, ctx) { if (rf & 1) {
23443
+ i0.ɵɵelementContainerStart(0);
23444
+ i0.ɵɵelementStart(1, "button", 10);
23445
+ i0.ɵɵtext(2);
23446
+ i0.ɵɵpipe(3, "rpxTranslate");
23447
+ i0.ɵɵelementEnd();
23448
+ i0.ɵɵelementContainerEnd();
23449
+ } if (rf & 2) {
23450
+ const ctx_r1 = i0.ɵɵnextContext(4);
23451
+ i0.ɵɵadvance();
23452
+ i0.ɵɵproperty("routerLink", i0.ɵɵpureFunction2(4, _c0$B, ctx_r1.caseId, ctx_r1.query.id));
23453
+ i0.ɵɵadvance();
23454
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 2, "Ask a follow-up question"), " ");
23455
+ } }
23456
+ function ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_template_2_ng_template_1_Template(rf, ctx) { if (rf & 1) {
23457
+ i0.ɵɵelementStart(0, "div")(1, "p", 11);
23355
23458
  i0.ɵɵtext(2);
23356
23459
  i0.ɵɵpipe(3, "rpxTranslate");
23357
23460
  i0.ɵɵelementEnd();
@@ -23365,25 +23468,32 @@ function ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_templ
23365
23468
  i0.ɵɵadvance(3);
23366
23469
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(6, 4, "Our team will read your query and respond. Do not submit the same query more than once."));
23367
23470
  } }
23471
+ function ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_template_2_Template(rf, ctx) { if (rf & 1) {
23472
+ i0.ɵɵtemplate(0, ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_template_2_ng_container_0_Template, 4, 7, "ng-container", 3)(1, ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_template_2_ng_template_1_Template, 7, 6, "ng-template", null, 2, i0.ɵɵtemplateRefExtractor);
23473
+ } if (rf & 2) {
23474
+ const queryIsInReview_r5 = i0.ɵɵreference(2);
23475
+ const ctx_r1 = i0.ɵɵnextContext(3);
23476
+ i0.ɵɵproperty("ngIf", (ctx_r1.query == null ? null : ctx_r1.query.children == null ? null : ctx_r1.query.children.length) > 0 && (ctx_r1.query == null ? null : ctx_r1.query.children == null ? null : ctx_r1.query.children.length) % 2 === 1)("ngIfElse", queryIsInReview_r5);
23477
+ } }
23368
23478
  function ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_Template(rf, ctx) { if (rf & 1) {
23369
23479
  i0.ɵɵelementContainerStart(0);
23370
- i0.ɵɵtemplate(1, ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_container_1_Template, 4, 7, "ng-container", 2)(2, ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_template_2_Template, 7, 6, "ng-template", null, 1, i0.ɵɵtemplateRefExtractor);
23480
+ i0.ɵɵtemplate(1, ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_container_1_Template, 4, 7, "ng-container", 3)(2, ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_ng_template_2_Template, 3, 2, "ng-template", null, 1, i0.ɵɵtemplateRefExtractor);
23371
23481
  i0.ɵɵelementContainerEnd();
23372
23482
  } if (rf & 2) {
23373
- const queryIsInReview_r5 = i0.ɵɵreference(3);
23483
+ const sequentialQuery_r6 = i0.ɵɵreference(3);
23374
23484
  const ctx_r1 = i0.ɵɵnextContext(2);
23375
23485
  i0.ɵɵadvance();
23376
- i0.ɵɵproperty("ngIf", (ctx_r1.query == null ? null : ctx_r1.query.children == null ? null : ctx_r1.query.children.length) > 0 && (ctx_r1.query == null ? null : ctx_r1.query.children == null ? null : ctx_r1.query.children.length) % 2 === 1)("ngIfElse", queryIsInReview_r5);
23486
+ i0.ɵɵproperty("ngIf", ctx_r1.messageType && ctx_r1.messageType === ctx_r1.followUpQuery && ctx_r1.isMultipleFollowUpEnabled || ctx_r1.messageType && ctx_r1.messageType === ctx_r1.respondToQuery)("ngIfElse", sequentialQuery_r6);
23377
23487
  } }
23378
23488
  function ReadQueryManagementFieldComponent_ng_template_1_ng_container_2_Template(rf, ctx) { if (rf & 1) {
23379
23489
  i0.ɵɵelementContainerStart(0);
23380
- i0.ɵɵelementStart(1, "div", 11)(2, "span", 12);
23490
+ i0.ɵɵelementStart(1, "div", 12)(2, "span", 13);
23381
23491
  i0.ɵɵtext(3, "!");
23382
23492
  i0.ɵɵelementEnd();
23383
- i0.ɵɵelementStart(4, "strong", 13)(5, "span", 14);
23493
+ i0.ɵɵelementStart(4, "strong", 14)(5, "span", 15);
23384
23494
  i0.ɵɵtext(6, "Warning");
23385
23495
  i0.ɵɵelementEnd();
23386
- i0.ɵɵelementStart(7, "p", 15);
23496
+ i0.ɵɵelementStart(7, "p", 16);
23387
23497
  i0.ɵɵtext(8);
23388
23498
  i0.ɵɵpipe(9, "rpxTranslate");
23389
23499
  i0.ɵɵelementEnd()()();
@@ -23394,10 +23504,10 @@ function ReadQueryManagementFieldComponent_ng_template_1_ng_container_2_Template
23394
23504
  } }
23395
23505
  function ReadQueryManagementFieldComponent_ng_template_1_Template(rf, ctx) { if (rf & 1) {
23396
23506
  const _r4 = i0.ɵɵgetCurrentView();
23397
- i0.ɵɵelementStart(0, "ccd-query-details", 7);
23507
+ i0.ɵɵelementStart(0, "ccd-query-details", 8);
23398
23508
  i0.ɵɵlistener("backClicked", function ReadQueryManagementFieldComponent_ng_template_1_Template_ccd_query_details_backClicked_0_listener() { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.showQueryList = true); });
23399
23509
  i0.ɵɵelementEnd();
23400
- i0.ɵɵtemplate(1, ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_Template, 4, 2, "ng-container", 8)(2, ReadQueryManagementFieldComponent_ng_template_1_ng_container_2_Template, 10, 3, "ng-container", 8);
23510
+ i0.ɵɵtemplate(1, ReadQueryManagementFieldComponent_ng_template_1_ng_container_1_Template, 4, 2, "ng-container", 9)(2, ReadQueryManagementFieldComponent_ng_template_1_ng_container_2_Template, 10, 3, "ng-container", 9);
23401
23511
  } if (rf & 2) {
23402
23512
  const ctx_r1 = i0.ɵɵnextContext();
23403
23513
  i0.ɵɵproperty("query", ctx_r1.query)("caseId", ctx_r1.caseId);
@@ -23410,19 +23520,36 @@ class ReadQueryManagementFieldComponent extends AbstractFieldReadComponent {
23410
23520
  route;
23411
23521
  sessionStorageService;
23412
23522
  caseNotifier;
23523
+ abstractConfig;
23413
23524
  caseQueriesCollections;
23414
23525
  query;
23415
23526
  showQueryList = true;
23416
23527
  caseId;
23528
+ messageType;
23529
+ followUpQuery = QueryCreateContext.FOLLOWUP;
23530
+ respondToQuery = QueryCreateContext.RESPOND;
23417
23531
  isQueryClosed = false;
23418
- constructor(route, sessionStorageService, caseNotifier) {
23532
+ value;
23533
+ isMultipleFollowUpEnabled = false;
23534
+ currentJurisdictionId;
23535
+ enableServiceSpecificMultiFollowups = [];
23536
+ caseSubscription;
23537
+ constructor(route, sessionStorageService, caseNotifier, abstractConfig) {
23419
23538
  super();
23420
23539
  this.route = route;
23421
23540
  this.sessionStorageService = sessionStorageService;
23422
23541
  this.caseNotifier = caseNotifier;
23542
+ this.abstractConfig = abstractConfig;
23423
23543
  }
23424
23544
  ngOnInit() {
23425
23545
  this.caseId = this.route.snapshot.params.cid;
23546
+ this.enableServiceSpecificMultiFollowups = this.abstractConfig.getEnableServiceSpecificMultiFollowups() || [];
23547
+ this.caseSubscription = this.caseNotifier.caseView.subscribe((caseDetails) => {
23548
+ if (caseDetails?.case_type?.jurisdiction?.id) {
23549
+ this.currentJurisdictionId = caseDetails.case_type.jurisdiction.id;
23550
+ this.isMultipleFollowUpEnabled = this.enableServiceSpecificMultiFollowups.includes(this.currentJurisdictionId);
23551
+ }
23552
+ });
23426
23553
  if (this.context === PaletteContext.DEFAULT) {
23427
23554
  // EUI-8303 Using mock data until CCD is ready with the API and data contract
23428
23555
  // this.caseQueriesCollections = caseMessagesMockData;
@@ -23448,9 +23575,13 @@ class ReadQueryManagementFieldComponent extends AbstractFieldReadComponent {
23448
23575
  // QueryManagementUtils.extractCaseQueriesFromCaseField();
23449
23576
  }
23450
23577
  }
23578
+ ngOnDestroy() {
23579
+ this.caseSubscription?.unsubscribe();
23580
+ }
23451
23581
  setQuery(query) {
23452
23582
  this.showQueryList = false;
23453
23583
  this.query = query;
23584
+ this.messageType = this.getMessageType(query);
23454
23585
  this.isQueryClosed = this.query?.children?.some((queryItem) => queryItem?.isClosed === 'Yes');
23455
23586
  }
23456
23587
  backToQueryListPage() {
@@ -23460,19 +23591,27 @@ class ReadQueryManagementFieldComponent extends AbstractFieldReadComponent {
23460
23591
  isInternalUser() {
23461
23592
  return isInternalUser(this.sessionStorageService);
23462
23593
  }
23463
- static ɵfac = function ReadQueryManagementFieldComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ReadQueryManagementFieldComponent)(i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(CaseNotifier)); };
23464
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ReadQueryManagementFieldComponent, selectors: [["ccd-read-query-management-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 2, consts: [["singleQueryDetails", ""], ["queryIsInReview", ""], [4, "ngIf", "ngIfElse"], [4, "ngFor", "ngForOf"], ["class", "govuk-!-margin-top-8 govuk-!-margin-bottom-8", 4, "ngIf"], [1, "govuk-!-margin-top-8", "govuk-!-margin-bottom-8"], [3, "selectedQuery", "caseQueriesCollection"], [3, "backClicked", "query", "caseId"], [4, "ngIf"], ["id", "ask-follow-up-question", "data-module", "govuk-button", 1, "govuk-button", 3, "routerLink"], [1, "govuk-!-font-weight-bold"], [1, "govuk-warning-text"], ["aria-hidden", "true", 1, "govuk-warning-text__icon"], [1, "govuk-warning-text__text"], [1, "govuk-visually-hidden"], [1, "qm-service-message", "govuk-!-font-weight-bold"]], template: function ReadQueryManagementFieldComponent_Template(rf, ctx) { if (rf & 1) {
23465
- i0.ɵɵtemplate(0, ReadQueryManagementFieldComponent_ng_container_0_Template, 2, 1, "ng-container", 2)(1, ReadQueryManagementFieldComponent_ng_template_1_Template, 3, 4, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
23594
+ getMessageType(query) {
23595
+ if (!query) {
23596
+ return undefined;
23597
+ }
23598
+ return query.children?.length
23599
+ ? query.children[query.children.length - 1]?.messageType
23600
+ : query?.messageType;
23601
+ }
23602
+ static ɵfac = function ReadQueryManagementFieldComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ReadQueryManagementFieldComponent)(i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(AbstractAppConfig)); };
23603
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ReadQueryManagementFieldComponent, selectors: [["ccd-read-query-management-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 2, consts: [["singleQueryDetails", ""], ["sequentialQuery", ""], ["queryIsInReview", ""], [4, "ngIf", "ngIfElse"], [4, "ngFor", "ngForOf"], ["class", "govuk-!-margin-top-8 govuk-!-margin-bottom-8", 4, "ngIf"], [1, "govuk-!-margin-top-8", "govuk-!-margin-bottom-8"], [3, "selectedQuery", "caseQueriesCollection"], [3, "backClicked", "query", "caseId"], [4, "ngIf"], ["id", "ask-follow-up-question", "data-module", "govuk-button", 1, "govuk-button", 3, "routerLink"], [1, "govuk-!-font-weight-bold"], [1, "govuk-warning-text"], ["aria-hidden", "true", 1, "govuk-warning-text__icon"], [1, "govuk-warning-text__text"], [1, "govuk-visually-hidden"], [1, "qm-service-message", "govuk-!-font-weight-bold"]], template: function ReadQueryManagementFieldComponent_Template(rf, ctx) { if (rf & 1) {
23604
+ i0.ɵɵtemplate(0, ReadQueryManagementFieldComponent_ng_container_0_Template, 2, 1, "ng-container", 3)(1, ReadQueryManagementFieldComponent_ng_template_1_Template, 3, 4, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
23466
23605
  } if (rf & 2) {
23467
- const singleQueryDetails_r6 = i0.ɵɵreference(2);
23468
- i0.ɵɵproperty("ngIf", ctx.showQueryList)("ngIfElse", singleQueryDetails_r6);
23606
+ const singleQueryDetails_r7 = i0.ɵɵreference(2);
23607
+ i0.ɵɵproperty("ngIf", ctx.showQueryList)("ngIfElse", singleQueryDetails_r7);
23469
23608
  } }, encapsulation: 2 });
23470
23609
  }
23471
23610
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadQueryManagementFieldComponent, [{
23472
23611
  type: Component,
23473
- args: [{ selector: 'ccd-read-query-management-field', template: "<ng-container *ngIf=\"showQueryList; else singleQueryDetails\">\n <ng-container *ngFor=\"let caseQueriesCollection of caseQueriesCollections\">\n <div *ngIf=\"showQueryList\" class=\"govuk-!-margin-top-8 govuk-!-margin-bottom-8\">\n <ccd-query-list (selectedQuery)=\"setQuery($event)\" [caseQueriesCollection]=\"caseQueriesCollection\"></ccd-query-list>\n </div>\n </ng-container>\n</ng-container>\n\n<ng-template #singleQueryDetails>\n <ccd-query-details\n [query]=\"query\"\n (backClicked)=\"showQueryList = true\"\n [caseId]=\"caseId\"\n ></ccd-query-details>\n\n <ng-container *ngIf=\"!isInternalUser() && !isQueryClosed\">\n <ng-container *ngIf=\"query?.children?.length > 0 && query?.children?.length % 2 === 1; else queryIsInReview\">\n <button id=\"ask-follow-up-question\" class=\"govuk-button\" data-module=\"govuk-button\"\n [routerLink]=\"['/query-management', 'query', caseId, '4', query.id]\">\n {{ 'Ask a follow-up question' | rpxTranslate }}\n </button>\n </ng-container>\n\n <ng-template #queryIsInReview>\n <div>\n <p class=\"govuk-!-font-weight-bold\">{{ 'Your query is under review' | rpxTranslate }}</p>\n <p>{{ 'Our team will read your query and respond. Do not submit the same query more than once.' | rpxTranslate }}</p>\n </div>\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"isQueryClosed\">\n <div class=\"govuk-warning-text\">\n <span aria-hidden=\"true\" class=\"govuk-warning-text__icon\">!</span>\n <strong class=\"govuk-warning-text__text\">\n <span class=\"govuk-visually-hidden\">Warning</span>\n <p class=\"qm-service-message govuk-!-font-weight-bold\">{{ 'This query has been closed by HMCTS staff.' | rpxTranslate }}</p>\n </strong>\n </div>\n </ng-container>\n</ng-template>\n" }]
23474
- }], () => [{ type: i1$1.ActivatedRoute }, { type: SessionStorageService }, { type: CaseNotifier }], null); })();
23475
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ReadQueryManagementFieldComponent, { className: "ReadQueryManagementFieldComponent", filePath: "lib/shared/components/palette/query-management/read-query-management-field.component.ts", lineNumber: 15 }); })();
23612
+ args: [{ selector: 'ccd-read-query-management-field', template: "<ng-container *ngIf=\"showQueryList; else singleQueryDetails\">\n <ng-container *ngFor=\"let caseQueriesCollection of caseQueriesCollections\">\n <div *ngIf=\"showQueryList\" class=\"govuk-!-margin-top-8 govuk-!-margin-bottom-8\">\n <ccd-query-list (selectedQuery)=\"setQuery($event)\" [caseQueriesCollection]=\"caseQueriesCollection\"></ccd-query-list>\n </div>\n </ng-container>\n</ng-container>\n\n<ng-template #singleQueryDetails>\n <ccd-query-details\n [query]=\"query\"\n (backClicked)=\"showQueryList = true\"\n [caseId]=\"caseId\"\n ></ccd-query-details>\n\n <ng-container *ngIf=\"!isInternalUser() && !isQueryClosed\">\n <ng-container *ngIf=\"(messageType && messageType === followUpQuery && isMultipleFollowUpEnabled) || (messageType && messageType === respondToQuery); else sequentialQuery\">\n <button id=\"ask-follow-up-question\" class=\"govuk-button\" data-module=\"govuk-button\"\n [routerLink]=\"['/query-management', 'query', caseId, '4', query.id]\">\n {{ 'Ask a follow-up question' | rpxTranslate }}\n </button>\n </ng-container>\n <ng-template #sequentialQuery>\n <ng-container *ngIf=\"query?.children?.length > 0 && query?.children?.length % 2 === 1; else queryIsInReview\">\n <button id=\"ask-follow-up-question\" class=\"govuk-button\" data-module=\"govuk-button\"\n [routerLink]=\"['/query-management', 'query', caseId, '4', query.id]\">\n {{ 'Ask a follow-up question' | rpxTranslate }}\n </button>\n </ng-container>\n\n <ng-template #queryIsInReview>\n <div>\n <p class=\"govuk-!-font-weight-bold\">{{ 'Your query is under review' | rpxTranslate }}</p>\n <p>{{ 'Our team will read your query and respond. Do not submit the same query more than once.' | rpxTranslate }}</p>\n </div>\n </ng-template>\n </ng-template>\n\n </ng-container>\n <ng-container *ngIf=\"isQueryClosed\">\n <div class=\"govuk-warning-text\">\n <span aria-hidden=\"true\" class=\"govuk-warning-text__icon\">!</span>\n <strong class=\"govuk-warning-text__text\">\n <span class=\"govuk-visually-hidden\">Warning</span>\n <p class=\"qm-service-message govuk-!-font-weight-bold\">{{ 'This query has been closed by HMCTS staff.' | rpxTranslate }}</p>\n </strong>\n </div>\n </ng-container>\n</ng-template>\n" }]
23613
+ }], () => [{ type: i1$1.ActivatedRoute }, { type: SessionStorageService }, { type: CaseNotifier }, { type: AbstractAppConfig }], null); })();
23614
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ReadQueryManagementFieldComponent, { className: "ReadQueryManagementFieldComponent", filePath: "lib/shared/components/palette/query-management/read-query-management-field.component.ts", lineNumber: 18 }); })();
23476
23615
 
23477
23616
  class ReadTextAreaFieldComponent extends AbstractFieldReadComponent {
23478
23617
  static ɵfac = /*@__PURE__*/ (() => { let ɵReadTextAreaFieldComponent_BaseFactory; return function ReadTextAreaFieldComponent_Factory(__ngFactoryType__) { return (ɵReadTextAreaFieldComponent_BaseFactory || (ɵReadTextAreaFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadTextAreaFieldComponent)))(__ngFactoryType__ || ReadTextAreaFieldComponent); }; })();