ngx-t-forms 3.1.1 → 3.1.3

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 (115) hide show
  1. package/fesm2022/{ngx-t-forms-api-endpoint-config.component-CZm3Z_7B.mjs → ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs} +15 -13
  2. package/fesm2022/ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs.map +1 -0
  3. package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-IciY6hb3.mjs → ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs} +2 -2
  4. package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-IciY6hb3.mjs.map → ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs.map} +1 -1
  5. package/fesm2022/{ngx-t-forms-basic-input-input-element.component-CykKxWu0.mjs → ngx-t-forms-basic-input-input-element.component-o6l7xW3J.mjs} +3 -3
  6. package/fesm2022/{ngx-t-forms-basic-input-input-element.component-CykKxWu0.mjs.map → ngx-t-forms-basic-input-input-element.component-o6l7xW3J.mjs.map} +1 -1
  7. package/fesm2022/{ngx-t-forms-calculated-field-rules.component-CwI-WEX7.mjs → ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs} +2 -2
  8. package/fesm2022/{ngx-t-forms-calculated-field-rules.component-CwI-WEX7.mjs.map → ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs.map} +1 -1
  9. package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-CO_3EQ_v.mjs → ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs} +2 -2
  10. package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-CO_3EQ_v.mjs.map → ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs.map} +1 -1
  11. package/fesm2022/{ngx-t-forms-conditional-display-config.component-Cmf7gDfO.mjs → ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs} +2 -2
  12. package/fesm2022/{ngx-t-forms-conditional-display-config.component-Cmf7gDfO.mjs.map → ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs.map} +1 -1
  13. package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-BHiOEQe4.mjs → ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs} +2 -2
  14. package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-BHiOEQe4.mjs.map → ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs.map} +1 -1
  15. package/fesm2022/{ngx-t-forms-data-source-picker.component-CN51SdCK.mjs → ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs} +6 -6
  16. package/fesm2022/{ngx-t-forms-data-source-picker.component-CN51SdCK.mjs.map → ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs.map} +1 -1
  17. package/fesm2022/{ngx-t-forms-date-picker-input-element.component-c3OSDXWw.mjs → ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs} +2 -2
  18. package/fesm2022/{ngx-t-forms-date-picker-input-element.component-c3OSDXWw.mjs.map → ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs.map} +1 -1
  19. package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-C-4fqOF0.mjs → ngx-t-forms-date-range-picker-input-element.component-CATduVDL.mjs} +2 -2
  20. package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-C-4fqOF0.mjs.map → ngx-t-forms-date-range-picker-input-element.component-CATduVDL.mjs.map} +1 -1
  21. package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-DLzba2AQ.mjs → ngx-t-forms-document-list-label-config-editor.component-BU0QJYNH.mjs} +3 -3
  22. package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-DLzba2AQ.mjs.map → ngx-t-forms-document-list-label-config-editor.component-BU0QJYNH.mjs.map} +1 -1
  23. package/fesm2022/{ngx-t-forms-document-picker.component-9clYsOcl.mjs → ngx-t-forms-document-picker.component-3mqXc4s6.mjs} +2 -2
  24. package/fesm2022/{ngx-t-forms-document-picker.component-9clYsOcl.mjs.map → ngx-t-forms-document-picker.component-3mqXc4s6.mjs.map} +1 -1
  25. package/fesm2022/{ngx-t-forms-editor-js-input.component-02HnmInT.mjs → ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs} +46 -191
  26. package/fesm2022/ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs.map +1 -0
  27. package/fesm2022/{ngx-t-forms-file-upload-input-element.component-BF7KbSPb.mjs → ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs} +2 -2
  28. package/fesm2022/{ngx-t-forms-file-upload-input-element.component-BF7KbSPb.mjs.map → ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs.map} +1 -1
  29. package/fesm2022/{ngx-t-forms-form-input-selector.component-vCj2SCxs.mjs → ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs} +2 -3
  30. package/fesm2022/{ngx-t-forms-form-input-selector.component-vCj2SCxs.mjs.map → ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs.map} +1 -1
  31. package/fesm2022/{ngx-t-forms-form-json-view.component-Cmw1hHGZ.mjs → ngx-t-forms-form-json-view.component-DsEizrc-.mjs} +2 -2
  32. package/fesm2022/{ngx-t-forms-form-json-view.component-Cmw1hHGZ.mjs.map → ngx-t-forms-form-json-view.component-DsEizrc-.mjs.map} +1 -1
  33. package/fesm2022/{ngx-t-forms-form-section-stepper.component-CFdwgxRl.mjs → ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs} +4 -4
  34. package/fesm2022/{ngx-t-forms-form-section-stepper.component-CFdwgxRl.mjs.map → ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs.map} +1 -1
  35. package/fesm2022/{ngx-t-forms-forms-builder-menu.component-DisrOv5x.mjs → ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs} +4 -4
  36. package/fesm2022/{ngx-t-forms-forms-builder-menu.component-DisrOv5x.mjs.map → ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs.map} +1 -1
  37. package/fesm2022/{ngx-t-forms-geo-location.component-D-BhLdx6.mjs → ngx-t-forms-geo-location.component-Cml0Do4m.mjs} +2 -2
  38. package/fesm2022/{ngx-t-forms-geo-location.component-D-BhLdx6.mjs.map → ngx-t-forms-geo-location.component-Cml0Do4m.mjs.map} +1 -1
  39. package/fesm2022/{ngx-t-forms-header-template-editor.component-Z5frEhho.mjs → ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs} +2 -3
  40. package/fesm2022/{ngx-t-forms-header-template-editor.component-Z5frEhho.mjs.map → ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs.map} +1 -1
  41. package/fesm2022/{ngx-t-forms-image-capture-input-element.component-CoJTXMbL.mjs → ngx-t-forms-image-capture-input-element.component-IFval472.mjs} +2 -2
  42. package/fesm2022/{ngx-t-forms-image-capture-input-element.component-CoJTXMbL.mjs.map → ngx-t-forms-image-capture-input-element.component-IFval472.mjs.map} +1 -1
  43. package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs +2 -0
  44. package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs.map +1 -0
  45. package/fesm2022/{ngx-t-forms-input-custom.component-s1ryJQy4.mjs → ngx-t-forms-input-custom.component-q8jPq7KI.mjs} +2 -2
  46. package/fesm2022/{ngx-t-forms-input-custom.component-s1ryJQy4.mjs.map → ngx-t-forms-input-custom.component-q8jPq7KI.mjs.map} +1 -1
  47. package/fesm2022/{ngx-t-forms-input-editor.component-oIzCTmbx.mjs → ngx-t-forms-input-editor.component-zL4cp2gq.mjs} +3 -4
  48. package/fesm2022/{ngx-t-forms-input-editor.component-oIzCTmbx.mjs.map → ngx-t-forms-input-editor.component-zL4cp2gq.mjs.map} +1 -1
  49. package/fesm2022/{ngx-t-forms-map-mat-options-keys-C1kxlZS_.mjs → ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs} +2 -2
  50. package/fesm2022/{ngx-t-forms-map-mat-options-keys-C1kxlZS_.mjs.map → ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs.map} +1 -1
  51. package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-wskkKr4y.mjs → ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs} +2 -2
  52. package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-wskkKr4y.mjs.map → ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs.map} +1 -1
  53. package/fesm2022/{ngx-t-forms-missing-form-configs.component-C1XuXRdn.mjs → ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs} +2 -2
  54. package/fesm2022/{ngx-t-forms-missing-form-configs.component-C1XuXRdn.mjs.map → ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs.map} +1 -1
  55. package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BJrOTRuQ.mjs → ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs} +2 -2
  56. package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BJrOTRuQ.mjs.map → ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs.map} +1 -1
  57. package/fesm2022/ngx-t-forms-mscoa-config.component-CmIR92zj.mjs +594 -0
  58. package/fesm2022/ngx-t-forms-mscoa-config.component-CmIR92zj.mjs.map +1 -0
  59. package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-GyKF31Ve.mjs → ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs} +2 -2
  60. package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-GyKF31Ve.mjs.map → ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs.map} +1 -1
  61. package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-BrPJPR2R.mjs → ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs} +34 -30
  62. package/fesm2022/ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs.map +1 -0
  63. package/fesm2022/{ngx-t-forms-ngx-t-forms-DqAcUfN4.mjs → ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs} +1079 -67
  64. package/fesm2022/ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs.map +1 -0
  65. package/fesm2022/{ngx-t-forms-paginated-selection-table-Bk77dBo9.mjs → ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs} +2 -2
  66. package/fesm2022/{ngx-t-forms-paginated-selection-table-Bk77dBo9.mjs.map → ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs.map} +1 -1
  67. package/fesm2022/{ngx-t-forms-payload-template-editor.component-CVzOTLYE.mjs → ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs} +2 -3
  68. package/fesm2022/{ngx-t-forms-payload-template-editor.component-CVzOTLYE.mjs.map → ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs.map} +1 -1
  69. package/fesm2022/{ngx-t-forms-pipeline-generator.component-7Vfwaqnx.mjs → ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs} +2 -2
  70. package/fesm2022/{ngx-t-forms-pipeline-generator.component-7Vfwaqnx.mjs.map → ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs.map} +1 -1
  71. package/fesm2022/ngx-t-forms-quill-input.component-CKYNVDDV.mjs +731 -0
  72. package/fesm2022/ngx-t-forms-quill-input.component-CKYNVDDV.mjs.map +1 -0
  73. package/fesm2022/{ngx-t-forms-record-list-manager.component-CfZdqKhY.mjs → ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs} +2 -2
  74. package/fesm2022/{ngx-t-forms-record-list-manager.component-CfZdqKhY.mjs.map → ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs.map} +1 -1
  75. package/fesm2022/{ngx-t-forms-required-inputs.component-CK7NIhbq.mjs → ngx-t-forms-required-inputs.component-D_cQIScV.mjs} +2 -3
  76. package/fesm2022/{ngx-t-forms-required-inputs.component-CK7NIhbq.mjs.map → ngx-t-forms-required-inputs.component-D_cQIScV.mjs.map} +1 -1
  77. package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-YChv7Arm.mjs → ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs} +150 -3
  78. package/fesm2022/ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs.map +1 -0
  79. package/fesm2022/{ngx-t-forms-section-report.component-DhSaf85h.mjs → ngx-t-forms-section-report.component-m2Z6qA3j.mjs} +2 -2
  80. package/fesm2022/{ngx-t-forms-section-report.component-DhSaf85h.mjs.map → ngx-t-forms-section-report.component-m2Z6qA3j.mjs.map} +1 -1
  81. package/fesm2022/{ngx-t-forms-select-input-element.component-D5HFzh35.mjs → ngx-t-forms-select-input-element.component-DH5knOzd.mjs} +2 -2
  82. package/fesm2022/{ngx-t-forms-select-input-element.component-D5HFzh35.mjs.map → ngx-t-forms-select-input-element.component-DH5knOzd.mjs.map} +1 -1
  83. package/fesm2022/{ngx-t-forms-selection-options-editor.component-BhmmJOco.mjs → ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs} +2 -2
  84. package/fesm2022/{ngx-t-forms-selection-options-editor.component-BhmmJOco.mjs.map → ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs.map} +1 -1
  85. package/fesm2022/{ngx-t-forms-textarea-input-element.component-DWEADTsz.mjs → ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs} +2 -2
  86. package/fesm2022/{ngx-t-forms-textarea-input-element.component-DWEADTsz.mjs.map → ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs.map} +1 -1
  87. package/fesm2022/{ngx-t-forms-toggle-input-element.component-XZi6kPnL.mjs → ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs} +2 -2
  88. package/fesm2022/{ngx-t-forms-toggle-input-element.component-XZi6kPnL.mjs.map → ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs.map} +1 -1
  89. package/fesm2022/ngx-t-forms-token-binding-menu.component-CLpjkUnf.mjs +109 -0
  90. package/fesm2022/ngx-t-forms-token-binding-menu.component-CLpjkUnf.mjs.map +1 -0
  91. package/fesm2022/ngx-t-forms-token-text-input.component-BQADsnFn.mjs +296 -0
  92. package/fesm2022/ngx-t-forms-token-text-input.component-BQADsnFn.mjs.map +1 -0
  93. package/fesm2022/{ngx-t-forms-validators-config.component-0_Y6bvtE.mjs → ngx-t-forms-validators-config.component-qO6Y4x1v.mjs} +2 -2
  94. package/fesm2022/{ngx-t-forms-validators-config.component-0_Y6bvtE.mjs.map → ngx-t-forms-validators-config.component-qO6Y4x1v.mjs.map} +1 -1
  95. package/fesm2022/ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs +2096 -0
  96. package/fesm2022/ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs.map +1 -0
  97. package/fesm2022/ngx-t-forms.mjs +1 -1
  98. package/package.json +2 -2
  99. package/styles/_tokens.scss +6 -0
  100. package/types/ngx-t-forms.d.ts +53 -1
  101. package/fesm2022/ngx-t-forms-api-endpoint-config.component-CZm3Z_7B.mjs.map +0 -1
  102. package/fesm2022/ngx-t-forms-editor-input-element.component-BGdZ4evj.mjs +0 -417
  103. package/fesm2022/ngx-t-forms-editor-input-element.component-BGdZ4evj.mjs.map +0 -1
  104. package/fesm2022/ngx-t-forms-editor-js-input.component-02HnmInT.mjs.map +0 -1
  105. package/fesm2022/ngx-t-forms-getInputIcon-B4ADgevZ.mjs +0 -31
  106. package/fesm2022/ngx-t-forms-getInputIcon-B4ADgevZ.mjs.map +0 -1
  107. package/fesm2022/ngx-t-forms-index-D8xr_Sxp.mjs +0 -2
  108. package/fesm2022/ngx-t-forms-index-D8xr_Sxp.mjs.map +0 -1
  109. package/fesm2022/ngx-t-forms-multiple-input-input-element.component-BrPJPR2R.mjs.map +0 -1
  110. package/fesm2022/ngx-t-forms-ngx-t-forms-DqAcUfN4.mjs.map +0 -1
  111. package/fesm2022/ngx-t-forms-rest-api-call-setup.component-YChv7Arm.mjs.map +0 -1
  112. package/fesm2022/ngx-t-forms-token-transform-D_wsFbNc.mjs +0 -173
  113. package/fesm2022/ngx-t-forms-token-transform-D_wsFbNc.mjs.map +0 -1
  114. package/fesm2022/ngx-t-forms-workflow-adjudication.component-Gkimmw-X.mjs +0 -1303
  115. package/fesm2022/ngx-t-forms-workflow-adjudication.component-Gkimmw-X.mjs.map +0 -1
@@ -0,0 +1,2096 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, ViewEncapsulation, ChangeDetectionStrategy, Component, computed, signal, inject, DestroyRef, output, effect, ElementRef } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { ReactiveFormsModule, FormsModule, FormBuilder, FormControl, Validators, NgControl } from '@angular/forms';
5
+ import * as i2$2 from '@angular/material/form-field';
6
+ import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
7
+ import * as i3 from '@angular/material/icon';
8
+ import { MatIconModule } from '@angular/material/icon';
9
+ import * as i2 from '@angular/material/button';
10
+ import { MatButtonModule } from '@angular/material/button';
11
+ import * as i5 from '@angular/material/tooltip';
12
+ import { MatTooltipModule } from '@angular/material/tooltip';
13
+ import { N as NGX_T_FORMS_CONFIG_TOKEN, b as getInputIcon, _ as _isEqual, D as DaysAgoPipe, B as BaseCustomInput, a1 as getInputErrorMessage, a2 as TFormInputStatusComponent } from './ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs';
14
+ import { AsyncPipe, DecimalPipe, TitleCasePipe } from '@angular/common';
15
+ import { AdjudicationSteps, InputDataTypes } from 'ngx-t-forms-types';
16
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
17
+ import * as i2$1 from '@angular/cdk/text-field';
18
+ import { TextFieldModule } from '@angular/cdk/text-field';
19
+ import * as i5$1 from '@angular/material/autocomplete';
20
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
21
+ import * as i2$3 from '@angular/material/input';
22
+ import { MatInputModule } from '@angular/material/input';
23
+ import * as i8 from '@angular/material/select';
24
+ import { MatSelectModule } from '@angular/material/select';
25
+ import * as i2$4 from '@angular/material/sort';
26
+ import { MatSortModule } from '@angular/material/sort';
27
+ import * as i5$2 from '@angular/material/table';
28
+ import { MatTableModule } from '@angular/material/table';
29
+ import { tap, switchMap, take, map, catchError, of, startWith, shareReplay, BehaviorSubject, combineLatest } from 'rxjs';
30
+ import { v4 } from 'uuid';
31
+ import * as i2$5 from '@angular/cdk/overlay';
32
+ import { OverlayModule } from '@angular/cdk/overlay';
33
+ import * as i1$1 from '@angular/material/dialog';
34
+ import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angular/material/dialog';
35
+ import * as i4 from '@angular/material/progress-spinner';
36
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
37
+ import * as i7 from '@angular/material/core';
38
+ import { MatRippleModule } from '@angular/material/core';
39
+ import { Q as QuillInputComponent } from './ngx-t-forms-quill-input.component-CKYNVDDV.mjs';
40
+ import * as i1$2 from '@angular/material/progress-bar';
41
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
42
+ import * as i5$3 from '@angular/material/expansion';
43
+ import { MatExpansionModule } from '@angular/material/expansion';
44
+ import { MatDividerModule } from '@angular/material/divider';
45
+ import * as i6 from '@angular/material/list';
46
+
47
+ /**
48
+ * Compact horizontal-bar chart shared by the adjudication steps: one aligned
49
+ * grid of name · track · figures per row, reference lines and a shaded zone
50
+ * spanning the whole track column, and per-row notes for anything that needs
51
+ * a reviewer's eye. Pure presentation — every number arrives precomputed on
52
+ * the {@link AdjChartVm}.
53
+ *
54
+ * @example
55
+ * <lib-adjudication-chart [vm]="chart" />
56
+ */
57
+ class AdjudicationChartComponent {
58
+ constructor() {
59
+ /** The prepared chart model. */
60
+ this.vm = input.required(...(ngDevMode ? [{ debugName: "vm" }] : /* istanbul ignore next */ []));
61
+ }
62
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: AdjudicationChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
63
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: AdjudicationChartComponent, isStandalone: true, selector: "lib-adjudication-chart", inputs: { vm: { classPropertyName: "vm", publicName: "vm", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "lib-adjudication-chart" }, ngImport: i0, template: "@if (vm().caption) {\n <p class=\"chart-caption\">{{ vm().caption }}</p>\n}\n\n<div class=\"plot\">\n <!-- Zone + reference lines span the track column only (the fixed name and\n figure columns are excluded via the CSS column variables). -->\n <div class=\"overlay\" aria-hidden=\"true\">\n @if (vm().zonePct != null) {\n <div class=\"zone\" [style.width.%]=\"vm().zonePct\"></div>\n }\n @for (ref of vm().refs; track ref.label) {\n <div class=\"ref\" [class.warning]=\"ref.kind === 'warning'\" [style.left.%]=\"ref.pct\">\n <span>{{ ref.label }}</span>\n </div>\n }\n </div>\n\n @for (row of vm().rows; track row.id) {\n <div class=\"row\"\n [class.warning]=\"row.state === 'warning'\"\n [class.muted]=\"row.state === 'muted'\">\n <span class=\"name\" [matTooltip]=\"row.name\">{{ row.name }}</span>\n <div class=\"track\">\n <div class=\"bar primary\" [style.width.%]=\"row.primaryPct\"></div>\n @if (row.secondaryPct != null) {\n <div class=\"bar secondary\" [style.width.%]=\"row.secondaryPct\"></div>\n }\n </div>\n <span class=\"figures\">\n <span class=\"figure\">{{ row.primaryLabel }}</span>\n @if (row.secondaryLabel) {\n <span class=\"figure secondary-figure\">{{ row.secondaryLabel }}</span>\n }\n </span>\n @if (row.note) {\n <span class=\"note\">{{ row.note }}</span>\n }\n </div>\n }\n</div>\n\n@if (vm().legend.length) {\n <div class=\"legend\">\n @for (item of vm().legend; track item.label) {\n <span class=\"legend-item\">\n <span class=\"swatch\" [class]=\"'swatch ' + item.kind\"></span>{{ item.label }}\n </span>\n }\n </div>\n}\n@if (vm().footnote) {\n <p class=\"footnote\">{{ vm().footnote }}</p>\n}\n", styles: [":host{--adj-chart-name-col: 8.5rem;--adj-chart-fig-col: 8rem;display:block;padding:.25rem 0 1rem;font-variant-numeric:tabular-nums}.chart-caption{font-size:.8125rem;line-height:1.6;color:var(--lib-forms-on-surface-variant);max-width:38rem;margin:0 0 1.5rem}.plot{position:relative;padding-top:1.125rem}.overlay{position:absolute;top:0;bottom:0;left:calc(var(--adj-chart-name-col) + .75rem);right:calc(var(--adj-chart-fig-col) + .75rem);pointer-events:none}.zone{position:absolute;inset:1.125rem auto 0 0;background:color-mix(in srgb,var(--lib-forms-warning) 6%,transparent);border-radius:var(--lib-forms-radius-sm)}.ref{position:absolute;top:1.125rem;bottom:0;border-left:1px dashed color-mix(in srgb,var(--lib-forms-outline) 60%,transparent)}.ref span{position:absolute;top:-1.125rem;left:50%;transform:translate(-50%);font-size:.5625rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;white-space:nowrap;color:var(--lib-forms-on-surface-variant)}.ref.warning{border-left-color:color-mix(in srgb,var(--lib-forms-warning) 70%,transparent)}.ref.warning span{color:var(--lib-forms-warning)}.row{display:grid;grid-template-columns:var(--adj-chart-name-col) 1fr var(--adj-chart-fig-col);grid-template-areas:\"name track figures\" \". note note\";align-items:center;column-gap:.75rem;padding:.375rem 0}.name{grid-area:name;font-size:.8125rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.track{grid-area:track;display:flex;flex-direction:column;gap:.1875rem;min-width:0}.figures{grid-area:figures;display:flex;flex-direction:column;align-items:flex-end;font-size:.75rem;line-height:1.35;color:var(--lib-forms-on-surface)}.secondary-figure{color:var(--lib-forms-on-surface-variant);font-size:.6875rem}.note{grid-area:note;font-size:.6875rem;line-height:1.4;color:var(--lib-forms-on-surface-variant);padding-top:.125rem}.row.warning .note{color:var(--lib-forms-warning);font-weight:600}.bar{height:.4375rem;border-radius:999px;background:var(--lib-forms-primary);transition:width .6s cubic-bezier(.16,1,.3,1);min-width:2px}.bar.secondary{height:.1875rem;background:color-mix(in srgb,var(--lib-forms-primary) 30%,transparent)}.row.warning .bar.primary{background:var(--lib-forms-warning)}.row.muted .name{text-decoration:line-through;opacity:.55}.row.muted .bar{opacity:.3}.row.muted .figures{opacity:.55}.legend{display:flex;flex-wrap:wrap;gap:.5rem 1.25rem;margin-top:1.25rem;font-size:.6875rem;color:var(--lib-forms-on-surface-variant)}.swatch{display:inline-block;width:1rem;height:.4375rem;border-radius:999px;margin-right:.375rem;vertical-align:middle}.swatch.primary{background:var(--lib-forms-primary)}.swatch.warning{background:var(--lib-forms-warning)}.swatch.secondary{background:color-mix(in srgb,var(--lib-forms-primary) 30%,transparent);height:.1875rem}.footnote{font-size:.6875rem;opacity:.7;margin:.75rem 0 0}@media(max-width:640px){:host{--adj-chart-name-col: 5.5rem;--adj-chart-fig-col: 5.5rem}}\n"], dependencies: [{ kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
64
+ }
65
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: AdjudicationChartComponent, decorators: [{
66
+ type: Component,
67
+ args: [{ selector: 'lib-adjudication-chart', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: { 'class': 'lib-adjudication-chart' }, imports: [MatTooltipModule], template: "@if (vm().caption) {\n <p class=\"chart-caption\">{{ vm().caption }}</p>\n}\n\n<div class=\"plot\">\n <!-- Zone + reference lines span the track column only (the fixed name and\n figure columns are excluded via the CSS column variables). -->\n <div class=\"overlay\" aria-hidden=\"true\">\n @if (vm().zonePct != null) {\n <div class=\"zone\" [style.width.%]=\"vm().zonePct\"></div>\n }\n @for (ref of vm().refs; track ref.label) {\n <div class=\"ref\" [class.warning]=\"ref.kind === 'warning'\" [style.left.%]=\"ref.pct\">\n <span>{{ ref.label }}</span>\n </div>\n }\n </div>\n\n @for (row of vm().rows; track row.id) {\n <div class=\"row\"\n [class.warning]=\"row.state === 'warning'\"\n [class.muted]=\"row.state === 'muted'\">\n <span class=\"name\" [matTooltip]=\"row.name\">{{ row.name }}</span>\n <div class=\"track\">\n <div class=\"bar primary\" [style.width.%]=\"row.primaryPct\"></div>\n @if (row.secondaryPct != null) {\n <div class=\"bar secondary\" [style.width.%]=\"row.secondaryPct\"></div>\n }\n </div>\n <span class=\"figures\">\n <span class=\"figure\">{{ row.primaryLabel }}</span>\n @if (row.secondaryLabel) {\n <span class=\"figure secondary-figure\">{{ row.secondaryLabel }}</span>\n }\n </span>\n @if (row.note) {\n <span class=\"note\">{{ row.note }}</span>\n }\n </div>\n }\n</div>\n\n@if (vm().legend.length) {\n <div class=\"legend\">\n @for (item of vm().legend; track item.label) {\n <span class=\"legend-item\">\n <span class=\"swatch\" [class]=\"'swatch ' + item.kind\"></span>{{ item.label }}\n </span>\n }\n </div>\n}\n@if (vm().footnote) {\n <p class=\"footnote\">{{ vm().footnote }}</p>\n}\n", styles: [":host{--adj-chart-name-col: 8.5rem;--adj-chart-fig-col: 8rem;display:block;padding:.25rem 0 1rem;font-variant-numeric:tabular-nums}.chart-caption{font-size:.8125rem;line-height:1.6;color:var(--lib-forms-on-surface-variant);max-width:38rem;margin:0 0 1.5rem}.plot{position:relative;padding-top:1.125rem}.overlay{position:absolute;top:0;bottom:0;left:calc(var(--adj-chart-name-col) + .75rem);right:calc(var(--adj-chart-fig-col) + .75rem);pointer-events:none}.zone{position:absolute;inset:1.125rem auto 0 0;background:color-mix(in srgb,var(--lib-forms-warning) 6%,transparent);border-radius:var(--lib-forms-radius-sm)}.ref{position:absolute;top:1.125rem;bottom:0;border-left:1px dashed color-mix(in srgb,var(--lib-forms-outline) 60%,transparent)}.ref span{position:absolute;top:-1.125rem;left:50%;transform:translate(-50%);font-size:.5625rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;white-space:nowrap;color:var(--lib-forms-on-surface-variant)}.ref.warning{border-left-color:color-mix(in srgb,var(--lib-forms-warning) 70%,transparent)}.ref.warning span{color:var(--lib-forms-warning)}.row{display:grid;grid-template-columns:var(--adj-chart-name-col) 1fr var(--adj-chart-fig-col);grid-template-areas:\"name track figures\" \". note note\";align-items:center;column-gap:.75rem;padding:.375rem 0}.name{grid-area:name;font-size:.8125rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.track{grid-area:track;display:flex;flex-direction:column;gap:.1875rem;min-width:0}.figures{grid-area:figures;display:flex;flex-direction:column;align-items:flex-end;font-size:.75rem;line-height:1.35;color:var(--lib-forms-on-surface)}.secondary-figure{color:var(--lib-forms-on-surface-variant);font-size:.6875rem}.note{grid-area:note;font-size:.6875rem;line-height:1.4;color:var(--lib-forms-on-surface-variant);padding-top:.125rem}.row.warning .note{color:var(--lib-forms-warning);font-weight:600}.bar{height:.4375rem;border-radius:999px;background:var(--lib-forms-primary);transition:width .6s cubic-bezier(.16,1,.3,1);min-width:2px}.bar.secondary{height:.1875rem;background:color-mix(in srgb,var(--lib-forms-primary) 30%,transparent)}.row.warning .bar.primary{background:var(--lib-forms-warning)}.row.muted .name{text-decoration:line-through;opacity:.55}.row.muted .bar{opacity:.3}.row.muted .figures{opacity:.55}.legend{display:flex;flex-wrap:wrap;gap:.5rem 1.25rem;margin-top:1.25rem;font-size:.6875rem;color:var(--lib-forms-on-surface-variant)}.swatch{display:inline-block;width:1rem;height:.4375rem;border-radius:999px;margin-right:.375rem;vertical-align:middle}.swatch.primary{background:var(--lib-forms-primary)}.swatch.warning{background:var(--lib-forms-warning)}.swatch.secondary{background:color-mix(in srgb,var(--lib-forms-primary) 30%,transparent);height:.1875rem}.footnote{font-size:.6875rem;opacity:.7;margin:.75rem 0 0}@media(max-width:640px){:host{--adj-chart-name-col: 5.5rem;--adj-chart-fig-col: 5.5rem}}\n"] }]
68
+ }], propDecorators: { vm: [{ type: i0.Input, args: [{ isSignal: true, alias: "vm", required: true }] }] } });
69
+
70
+ /**
71
+ * The in-component guide to the adjudication rules: one compact term/text list
72
+ * per step type, assembled from {@link AdjudicationDocsContext} so the content
73
+ * matches the step in view (its system, its price key, its compliance limit).
74
+ * Short by design — every line is one sentence a reviewer can act on.
75
+ *
76
+ * @example
77
+ * <lib-adjudication-docs [context]="{ step: AdjudicationSteps.SubMissionReview }" />
78
+ */
79
+ class AdjudicationDocsComponent {
80
+ constructor() {
81
+ /** The step to explain, plus its live configuration. */
82
+ this.context = input.required(...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
83
+ this.heading = computed(() => {
84
+ switch (this.context().step) {
85
+ case AdjudicationSteps.ScoreCreation: return 'Building the score sheet';
86
+ case AdjudicationSteps.PointAssignment: return 'Assigning points';
87
+ case AdjudicationSteps.SupplierSelection: return 'Selecting the supplier';
88
+ default: return 'Reviewing submissions';
89
+ }
90
+ }, ...(ngDevMode ? [{ debugName: "heading" }] : /* istanbul ignore next */ []));
91
+ /** The step-specific rule lines, shortest useful form. */
92
+ this.rules = computed(() => {
93
+ const ctx = this.context();
94
+ switch (ctx.step) {
95
+ case AdjudicationSteps.ScoreCreation:
96
+ return [
97
+ { term: 'Score sheet', text: 'The criteria reviewers will score every compliant bid against; each carries its maximum points.' },
98
+ { term: 'Point types', text: 'Group criteria (e.g. technical, price) — each group becomes its own tab at point assignment.' },
99
+ { term: 'Linked fields', text: 'Link a criterion to a form field to score what bidders actually submitted; or type a custom one.' },
100
+ { term: 'Practice', text: 'Finalise the sheet before bids open, keep descriptions unambiguous, keep totals realistic.' },
101
+ ];
102
+ case AdjudicationSteps.PointAssignment:
103
+ return [
104
+ { term: 'Task', text: 'Score every compliant bid against the score sheet, one criterion at a time.' },
105
+ { term: 'Groups', text: 'Criteria appear grouped by point type; a bid\'s total is the sum across all groups.' },
106
+ { term: 'Feeds into', text: 'Totals carry into supplier selection, scaled onto the specific-goals portion of the final score.' },
107
+ { term: 'Practice', text: 'Score all bids on one criterion before moving to the next, and note the reasoning as you go.' },
108
+ ];
109
+ case AdjudicationSteps.SupplierSelection: {
110
+ const split = ctx.system ?? '80/20 or 90/10';
111
+ return [
112
+ { term: 'Final score', text: `Points for price plus score-sheet points scaled onto the ${split} split — a total out of 100.` },
113
+ { term: 'Award', text: 'The highest total is appointed; equal totals fall to the higher specific-goals score.' },
114
+ { term: 'Practice', text: 'Resolve every open flag before appointing, and record resolution notes with the appointment.' },
115
+ ];
116
+ }
117
+ default: {
118
+ const scale = ctx.system?.slice(0, 2) ?? '80';
119
+ const rules = [
120
+ { term: 'Benchmark', text: `The lowest compliant price earns the full ${scale} points; each 1% above it costs 0.${scale} points, floored at 0, shown to two decimals.` },
121
+ { term: 'System', text: 'R50 million or less → 80/20; above → 90/10. Picked from the step\'s formula, else the tender estimate, else the lowest compliant bid.' },
122
+ { term: 'Non-compliant', text: 'The verdict removes a bid from the pool. If it held the lowest price, the benchmark shifts and every score — including saved ones — recalculates instantly.' },
123
+ { term: 'Abnormally low', text: 'A bid more than 15% below the median compliant price (the middle price — immune to one extreme bid) is flagged amber. The flag means investigate; it never auto-rejects.' },
124
+ { term: 'Practice', text: 'Preview before judging · investigate every amber flag · note each verdict · never hand-adjust scores.' },
125
+ ];
126
+ if (ctx.complianceLimit) {
127
+ rules.splice(3, 0, {
128
+ term: 'Limit',
129
+ text: `At most ${ctx.complianceLimit} bid(s) may end compliant — once reached, the rest are marked non-compliant automatically.`,
130
+ });
131
+ }
132
+ return rules;
133
+ }
134
+ }
135
+ }, ...(ngDevMode ? [{ debugName: "rules" }] : /* istanbul ignore next */ []));
136
+ /** Live-config chips shown under the heading, one per known fact. */
137
+ this.facts = computed(() => {
138
+ const ctx = this.context();
139
+ const facts = [];
140
+ if (ctx.system)
141
+ facts.push(`${ctx.system} system in effect`);
142
+ if (ctx.priceKey)
143
+ facts.push(`prices read from “${ctx.priceKey}”`);
144
+ if (ctx.complianceLimit)
145
+ facts.push(`compliance limit ${ctx.complianceLimit}`);
146
+ if (ctx.hasScoreSheet)
147
+ facts.push('score sheet configured');
148
+ return facts;
149
+ }, ...(ngDevMode ? [{ debugName: "facts" }] : /* istanbul ignore next */ []));
150
+ }
151
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: AdjudicationDocsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
152
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: AdjudicationDocsComponent, isStandalone: true, selector: "lib-adjudication-docs", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "lib-adjudication-docs" }, ngImport: i0, template: "<section class=\"docs\">\n <span class=\"eyebrow\">Guide</span>\n <h4 class=\"heading\">{{ heading() }}</h4>\n @if (facts().length) {\n <div class=\"facts\">\n @for (fact of facts(); track fact) {\n <span class=\"fact\">{{ fact }}</span>\n }\n </div>\n }\n\n <dl class=\"rules\">\n @for (rule of rules(); track rule.term) {\n <div class=\"rule\">\n <dt>{{ rule.term }}</dt>\n <dd>{{ rule.text }}</dd>\n </div>\n }\n </dl>\n\n <p class=\"fineprint\">PPR 2022 regs 3\u20135 \u00B7 National Treasury Implementation Guide, March 2023.\n Abnormally-low detection uses the 15% best-practice band; SA guidance requires judgment, not automatic rejection.</p>\n</section>\n", styles: [":host{display:block}.docs{max-width:42rem;padding:.25rem .25rem 1.5rem}.eyebrow{display:block;font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant);margin-bottom:.5rem}.heading{font-size:1.125rem;font-weight:500;letter-spacing:-.01em;margin:0 0 .75rem}.facts{display:flex;flex-wrap:wrap;gap:.375rem;margin-bottom:1.25rem}.fact{font-size:.6875rem;line-height:1;padding:.375rem .625rem;border-radius:999px;background:var(--lib-forms-surface-container-low);color:var(--lib-forms-on-surface-variant)}.rules{margin:0}.rule{display:grid;grid-template-columns:7.5rem 1fr;column-gap:1rem;padding:.625rem 0}.rule dt{font-size:.75rem;font-weight:600;letter-spacing:.02em;color:var(--lib-forms-on-surface);padding-top:.0625rem}.rule dd{margin:0;font-size:.8125rem;line-height:1.6;color:var(--lib-forms-on-surface-variant)}.fineprint{font-size:.6875rem;line-height:1.5;opacity:.65;margin:1.5rem 0 0}@media(max-width:520px){.rule{grid-template-columns:1fr;row-gap:.125rem}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
153
+ }
154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: AdjudicationDocsComponent, decorators: [{
155
+ type: Component,
156
+ args: [{ selector: 'lib-adjudication-docs', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: { 'class': 'lib-adjudication-docs' }, imports: [], template: "<section class=\"docs\">\n <span class=\"eyebrow\">Guide</span>\n <h4 class=\"heading\">{{ heading() }}</h4>\n @if (facts().length) {\n <div class=\"facts\">\n @for (fact of facts(); track fact) {\n <span class=\"fact\">{{ fact }}</span>\n }\n </div>\n }\n\n <dl class=\"rules\">\n @for (rule of rules(); track rule.term) {\n <div class=\"rule\">\n <dt>{{ rule.term }}</dt>\n <dd>{{ rule.text }}</dd>\n </div>\n }\n </dl>\n\n <p class=\"fineprint\">PPR 2022 regs 3\u20135 \u00B7 National Treasury Implementation Guide, March 2023.\n Abnormally-low detection uses the 15% best-practice band; SA guidance requires judgment, not automatic rejection.</p>\n</section>\n", styles: [":host{display:block}.docs{max-width:42rem;padding:.25rem .25rem 1.5rem}.eyebrow{display:block;font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant);margin-bottom:.5rem}.heading{font-size:1.125rem;font-weight:500;letter-spacing:-.01em;margin:0 0 .75rem}.facts{display:flex;flex-wrap:wrap;gap:.375rem;margin-bottom:1.25rem}.fact{font-size:.6875rem;line-height:1;padding:.375rem .625rem;border-radius:999px;background:var(--lib-forms-surface-container-low);color:var(--lib-forms-on-surface-variant)}.rules{margin:0}.rule{display:grid;grid-template-columns:7.5rem 1fr;column-gap:1rem;padding:.625rem 0}.rule dt{font-size:.75rem;font-weight:600;letter-spacing:.02em;color:var(--lib-forms-on-surface);padding-top:.0625rem}.rule dd{margin:0;font-size:.8125rem;line-height:1.6;color:var(--lib-forms-on-surface-variant)}.fineprint{font-size:.6875rem;line-height:1.5;opacity:.65;margin:1.5rem 0 0}@media(max-width:520px){.rule{grid-template-columns:1fr;row-gap:.125rem}}\n"] }]
157
+ }], propDecorators: { context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: true }] }] } });
158
+
159
+ /**
160
+ * The frame every adjudication step renders inside: a thin identity bar
161
+ * (step label + system chip), the view switch (working view · chart · guide),
162
+ * and a fullscreen toggle for dense pools. The working view is projected; the
163
+ * chart and the guide are rendered here from their prepared models, so all
164
+ * four step types share one behaviour and one look.
165
+ *
166
+ * Fullscreen is a CSS takeover (fixed, inset 0) rather than the browser
167
+ * Fullscreen API — SSR-safe, no permission prompt, Escape exits.
168
+ *
169
+ * @example
170
+ * <lib-adjudication-shell label="Submission review" [system]="vm.priceSystem"
171
+ * [docsContext]="vm.docsContext" [chart]="vm.priceChart">
172
+ * ...working view...
173
+ * </lib-adjudication-shell>
174
+ */
175
+ class AdjudicationShellComponent {
176
+ constructor() {
177
+ /** Step name shown in the identity bar (e.g. "Submission review"). */
178
+ this.label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
179
+ /** Preference point system chip ("80/20" / "90/10"), when known. */
180
+ this.system = input(undefined, ...(ngDevMode ? [{ debugName: "system" }] : /* istanbul ignore next */ []));
181
+ /** Context the guide adapts its content to. */
182
+ this.docsContext = input.required(...(ngDevMode ? [{ debugName: "docsContext" }] : /* istanbul ignore next */ []));
183
+ /** Chart model; the chart button only appears when one is provided. */
184
+ this.chart = input(undefined, ...(ngDevMode ? [{ debugName: "chart" }] : /* istanbul ignore next */ []));
185
+ /** Which face is showing. Presentational only — no step state changes. */
186
+ this.view = signal('main', ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
187
+ /** CSS takeover state; host gets the `fullscreen` class. */
188
+ this.fullscreen = signal(false, ...(ngDevMode ? [{ debugName: "fullscreen" }] : /* istanbul ignore next */ []));
189
+ }
190
+ onEscape() {
191
+ if (this.fullscreen())
192
+ this.fullscreen.set(false);
193
+ }
194
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: AdjudicationShellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
195
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: AdjudicationShellComponent, isStandalone: true, selector: "lib-adjudication-shell", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, system: { classPropertyName: "system", publicName: "system", isSignal: true, isRequired: false, transformFunction: null }, docsContext: { classPropertyName: "docsContext", publicName: "docsContext", isSignal: true, isRequired: true, transformFunction: null }, chart: { classPropertyName: "chart", publicName: "chart", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:keydown.escape": "onEscape()" }, properties: { "class.fullscreen": "fullscreen()" }, classAttribute: "lib-adjudication-shell" }, ngImport: i0, template: "<header class=\"shell-bar\">\n <div class=\"shell-id\">\n <span class=\"shell-label\">{{ label() }}</span>\n @if (system()) {\n <span class=\"shell-system\"\n matTooltip=\"Preference point system in effect (PPR 2022): points for price are computed automatically against the lowest compliant bid.\">\n {{ system() }}\n </span>\n }\n </div>\n <div class=\"shell-actions\">\n <button mat-icon-button type=\"button\" [class.active]=\"view() === 'main'\"\n matTooltip=\"Review table\" aria-label=\"Review table\"\n [attr.aria-pressed]=\"view() === 'main'\" (click)=\"view.set('main')\">\n <mat-icon>table_rows</mat-icon>\n </button>\n @if (chart()) {\n <button mat-icon-button type=\"button\" [class.active]=\"view() === 'chart'\"\n matTooltip=\"Chart\" aria-label=\"Records by price chart\"\n [attr.aria-pressed]=\"view() === 'chart'\" (click)=\"view.set('chart')\">\n <mat-icon>insights</mat-icon>\n </button>\n }\n <button mat-icon-button type=\"button\" [class.active]=\"view() === 'docs'\"\n matTooltip=\"Guide\" aria-label=\"How scoring works\"\n [attr.aria-pressed]=\"view() === 'docs'\" (click)=\"view.set('docs')\">\n <mat-icon>menu_book</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" class=\"fullscreen-toggle\"\n [matTooltip]=\"fullscreen() ? 'Exit full screen (Esc)' : 'Full screen'\"\n [attr.aria-label]=\"fullscreen() ? 'Exit full screen' : 'Full screen'\"\n [attr.aria-pressed]=\"fullscreen()\" (click)=\"fullscreen.set(!fullscreen())\">\n <mat-icon>{{ fullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>\n </button>\n </div>\n</header>\n\n<div class=\"shell-body\">\n @switch (view()) {\n @case ('docs') {\n <lib-adjudication-docs [context]=\"docsContext()\" />\n }\n @case ('chart') {\n @if (chart(); as chartVm) {\n <lib-adjudication-chart [vm]=\"chartVm\" />\n }\n }\n @default {\n <ng-content />\n }\n }\n</div>\n", styles: [":host{display:block}:host(.fullscreen){position:fixed;inset:0;z-index:1000;background:var(--lib-forms-surface);overflow:auto;padding:1rem 1.5rem 2rem}.shell-bar{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:.75rem}.shell-id{display:flex;align-items:baseline;gap:.625rem;min-width:0}.shell-label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant);white-space:nowrap}.shell-system{font-size:.6875rem;font-weight:600;line-height:1;padding:.3125rem .5625rem;border-radius:999px;background:var(--lib-forms-surface-container-low);color:var(--lib-forms-on-surface-variant);font-variant-numeric:tabular-nums;cursor:default}.shell-actions{display:flex;align-items:center;gap:.25rem}.shell-actions button{opacity:.5;transition:opacity .4s cubic-bezier(.16,1,.3,1)}.shell-actions button.active{opacity:1;color:var(--lib-forms-primary)}.shell-actions button.fullscreen-toggle{opacity:.7}.shell-body{min-width:0}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: AdjudicationChartComponent, selector: "lib-adjudication-chart", inputs: ["vm"] }, { kind: "component", type: AdjudicationDocsComponent, selector: "lib-adjudication-docs", inputs: ["context"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
196
+ }
197
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: AdjudicationShellComponent, decorators: [{
198
+ type: Component,
199
+ args: [{ selector: 'lib-adjudication-shell', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
200
+ 'class': 'lib-adjudication-shell',
201
+ '[class.fullscreen]': 'fullscreen()',
202
+ '(document:keydown.escape)': 'onEscape()',
203
+ }, imports: [MatButtonModule, MatIconModule, MatTooltipModule, AdjudicationChartComponent, AdjudicationDocsComponent], template: "<header class=\"shell-bar\">\n <div class=\"shell-id\">\n <span class=\"shell-label\">{{ label() }}</span>\n @if (system()) {\n <span class=\"shell-system\"\n matTooltip=\"Preference point system in effect (PPR 2022): points for price are computed automatically against the lowest compliant bid.\">\n {{ system() }}\n </span>\n }\n </div>\n <div class=\"shell-actions\">\n <button mat-icon-button type=\"button\" [class.active]=\"view() === 'main'\"\n matTooltip=\"Review table\" aria-label=\"Review table\"\n [attr.aria-pressed]=\"view() === 'main'\" (click)=\"view.set('main')\">\n <mat-icon>table_rows</mat-icon>\n </button>\n @if (chart()) {\n <button mat-icon-button type=\"button\" [class.active]=\"view() === 'chart'\"\n matTooltip=\"Chart\" aria-label=\"Records by price chart\"\n [attr.aria-pressed]=\"view() === 'chart'\" (click)=\"view.set('chart')\">\n <mat-icon>insights</mat-icon>\n </button>\n }\n <button mat-icon-button type=\"button\" [class.active]=\"view() === 'docs'\"\n matTooltip=\"Guide\" aria-label=\"How scoring works\"\n [attr.aria-pressed]=\"view() === 'docs'\" (click)=\"view.set('docs')\">\n <mat-icon>menu_book</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" class=\"fullscreen-toggle\"\n [matTooltip]=\"fullscreen() ? 'Exit full screen (Esc)' : 'Full screen'\"\n [attr.aria-label]=\"fullscreen() ? 'Exit full screen' : 'Full screen'\"\n [attr.aria-pressed]=\"fullscreen()\" (click)=\"fullscreen.set(!fullscreen())\">\n <mat-icon>{{ fullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>\n </button>\n </div>\n</header>\n\n<div class=\"shell-body\">\n @switch (view()) {\n @case ('docs') {\n <lib-adjudication-docs [context]=\"docsContext()\" />\n }\n @case ('chart') {\n @if (chart(); as chartVm) {\n <lib-adjudication-chart [vm]=\"chartVm\" />\n }\n }\n @default {\n <ng-content />\n }\n }\n</div>\n", styles: [":host{display:block}:host(.fullscreen){position:fixed;inset:0;z-index:1000;background:var(--lib-forms-surface);overflow:auto;padding:1rem 1.5rem 2rem}.shell-bar{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:.75rem}.shell-id{display:flex;align-items:baseline;gap:.625rem;min-width:0}.shell-label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant);white-space:nowrap}.shell-system{font-size:.6875rem;font-weight:600;line-height:1;padding:.3125rem .5625rem;border-radius:999px;background:var(--lib-forms-surface-container-low);color:var(--lib-forms-on-surface-variant);font-variant-numeric:tabular-nums;cursor:default}.shell-actions{display:flex;align-items:center;gap:.25rem}.shell-actions button{opacity:.5;transition:opacity .4s cubic-bezier(.16,1,.3,1)}.shell-actions button.active{opacity:1;color:var(--lib-forms-primary)}.shell-actions button.fullscreen-toggle{opacity:.7}.shell-body{min-width:0}\n"] }]
204
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], system: [{ type: i0.Input, args: [{ isSignal: true, alias: "system", required: false }] }], docsContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "docsContext", required: true }] }], chart: [{ type: i0.Input, args: [{ isSignal: true, alias: "chart", required: false }] }] } });
205
+
206
+ class PointsCreationComponent {
207
+ #config;
208
+ #destroyRef;
209
+ #points;
210
+ constructor() {
211
+ this.#config = inject(NGX_T_FORMS_CONFIG_TOKEN);
212
+ this.#destroyRef = inject(DestroyRef);
213
+ /** Static guide context: this step authors the sheet, nothing dynamic yet. */
214
+ this.docsContext = {
215
+ step: AdjudicationSteps.ScoreCreation,
216
+ };
217
+ /** Tower step column config that drives column layout, types, and disabled/readonly state. */
218
+ this.inputConfig = input(undefined, ...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
219
+ /** Existing points list pushed in from the parent (workflow-adjudication-reactive-input). */
220
+ // NOTE(phase-4): Trap 6 — parent (`workflow-adjudication-reactive-input`) binds a
221
+ // `WorkflowAdjudicationValue | null` union of three incompatible shapes. Until the parent
222
+ // template is split per adjudication step type, this input must remain `any`.
223
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO(phase-4): split parent template by adjudication step, then narrow this input.
224
+ this.value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
225
+ /** Emits the updated points list whenever the user saves, edits, or removes a row. */
226
+ this.pointsChange = output();
227
+ this.pointRow = this.#createDefaultPointRow();
228
+ this.selectAllWorkflowInputs = [];
229
+ this.#points = [];
230
+ /** Material table columns derived from the input config. */
231
+ this.cols = computed(() => {
232
+ const cfg = this.inputConfig();
233
+ let cols = (cfg?.adjudicationPointTypes?.length || 0) > 0
234
+ ? ['description', 'totalPoints', 'pointType', 'actions']
235
+ : ['description', 'totalPoints', 'actions'];
236
+ if (cfg?.disabled || !!cfg?.readonly) {
237
+ cols = cols.filter(col => col !== 'actions');
238
+ }
239
+ return cols;
240
+ }, ...(ngDevMode ? [{ debugName: "cols" }] : /* istanbul ignore next */ []));
241
+ /** Mirrors the legacy `set value` setter — pushes incoming `value` into the internal `#points` buffer. */
242
+ this.valueBridge = effect(() => {
243
+ const next = this.value();
244
+ this.#points = (next || []);
245
+ }, ...(ngDevMode ? [{ debugName: "valueBridge" }] : /* istanbul ignore next */ []));
246
+ this.#config.formBuilder.getCurrentFormAvailableInputOptions().pipe(tap((inputs) => {
247
+ this.selectAllWorkflowInputs = inputs;
248
+ }), takeUntilDestroyed(this.#destroyRef)).subscribe();
249
+ }
250
+ get points() {
251
+ const cfg = this.inputConfig();
252
+ if (cfg?.disabled || !!cfg?.readonly) {
253
+ return this.#points;
254
+ }
255
+ return [...this.#points, this.pointRow];
256
+ }
257
+ get filteredInputs() {
258
+ const description = this.pointRow.description?.toLowerCase() || '';
259
+ if (!description) {
260
+ return this.selectAllWorkflowInputs;
261
+ }
262
+ const regex = new RegExp(description.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'i');
263
+ return this.selectAllWorkflowInputs.filter((input) => (typeof input.label === 'string' && regex.test(input.label)) ||
264
+ (typeof input.hintLabel === 'string' && regex.test(input.hintLabel)));
265
+ }
266
+ get pointInEditIsValid() {
267
+ const cfg = this.inputConfig();
268
+ const typeRequired = (cfg?.adjudicationPointTypes?.length || 0) > 0;
269
+ return !!this.pointRow.description && this.pointRow.totalPoints > 0 && (!typeRequired || !!this.pointRow.pointType);
270
+ }
271
+ #createDefaultPointRow() {
272
+ return {
273
+ id: '',
274
+ formControlName: '',
275
+ totalPoints: 0,
276
+ description: '',
277
+ pointType: '',
278
+ inputId: undefined,
279
+ isEditRow: true,
280
+ };
281
+ }
282
+ #resetPointRow() {
283
+ this.pointRow = this.#createDefaultPointRow();
284
+ }
285
+ selectActiveInput(input) {
286
+ const cfg = this.inputConfig();
287
+ this.pointRow = {
288
+ ...this.pointRow,
289
+ totalPoints: 0,
290
+ description: input.label || '',
291
+ id: input.id,
292
+ formControlName: input.formControlName,
293
+ pointType: this.pointRow.pointType || cfg?.adjudicationPointTypes[0] || '',
294
+ inputId: input.id,
295
+ };
296
+ }
297
+ selectPointType(pointType) {
298
+ this.pointRow = {
299
+ ...this.pointRow,
300
+ pointType: pointType.value,
301
+ };
302
+ }
303
+ savePoints() {
304
+ const pointToSave = {
305
+ ...this.pointRow,
306
+ id: this.pointRow.id || v4(),
307
+ formControlName: this.pointRow.formControlName || this.pointRow.description,
308
+ isEditRow: undefined,
309
+ };
310
+ this.#points = [...this.#points, pointToSave];
311
+ this.pointsChange.emit(this.#points);
312
+ this.#resetPointRow();
313
+ }
314
+ edit(element) {
315
+ this.pointRow = {
316
+ ...element,
317
+ isEditRow: true,
318
+ };
319
+ this.#points = this.#points.filter(p => p.id !== element.id);
320
+ this.pointsChange.emit(this.#points);
321
+ }
322
+ remove(element) {
323
+ this.#points = this.#points.filter(p => p.id !== element.id);
324
+ this.pointsChange.emit(this.#points);
325
+ }
326
+ getInputIcon(input) {
327
+ return getInputIcon(input.element);
328
+ }
329
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: PointsCreationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
330
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: PointsCreationComponent, isStandalone: true, selector: "lib-points-creation", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointsChange: "pointsChange" }, ngImport: i0, template: "<lib-adjudication-shell label=\"Score sheet\" [docsContext]=\"docsContext\">\r\n<div style=\"resize: both; overflow: auto;\">\r\n @if (!points || points.length === 1) {\r\n <h5 style=\"margin-bottom: 5px; margin-top: 0px;\">\r\n &#8505;&#65039; To add a scoring item:\r\n </h5>\r\n <ol>\r\n <li>\r\n <strong>Enter Description:</strong>\r\n <ul style=\"margin-top: 5px; margin-bottom: 5px; padding-left: 20px; list-style-type: disc;\">\r\n <li>\r\n To <strong>link</strong> a field: You <strong>must select it</strong> from the list first (you can\r\n edit it after).\r\n </li>\r\n <li>\r\n For a <strong>custom</strong> point: <strong>Ignore the list</strong> and just type your own\r\n description.\r\n </li>\r\n </ul>\r\n </li>\r\n <li>\r\n <strong>Set Details:</strong>\r\n Assign the <strong>Points</strong> and select the <strong>Point Type</strong>.\r\n </li>\r\n <li>\r\n <strong>Save:</strong>\r\n Click the <strong>\"Save\"</strong> button to add the item.\r\n </li>\r\n </ol>\r\n }\r\n <table mat-table [dataSource]=\"points\" matSort>\r\n <ng-container matColumnDef=\"description\">\r\n <th mat-header-cell *matHeaderCellDef>Description</th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n @if (element.isEditRow) {\r\n <mat-form-field subscriptSizing=\"dynamic\" class=\"input-add\" appearance=\"outline\">\r\n <textarea [matAutocomplete]=\"auto\" [(ngModel)]=\"pointRow.description\" matInput cdkTextareaAutosize\r\n cdkAutosizeMinRows=\"1\" placeholder=\"Enter point description\"></textarea>\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n @for (input of filteredInputs; track input.id) {\r\n <mat-option [value]=\"input.label\" (click)=\"selectActiveInput(input)\">\r\n <div style=\"display: flex;align-items: center;gap:8px\">\r\n <mat-icon style=\"font-size:24px; width:24px; height:24px;\"\r\n [attr.aria-label]=\"input.label\">\r\n {{ getInputIcon(input) }}\r\n </mat-icon>\r\n <span>\r\n <div style=\"font-size: 0.75em;\">\r\n <strong>\r\n {{ input.label }}\r\n </strong>\r\n </div>\r\n <div\r\n style=\"font-size: 0.75em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;\">\r\n {{ input.hintLabel || input.formControlName }}\r\n </div>\r\n </span>\r\n </div>\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n } @else {\r\n {{ element.description }}\r\n }\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"totalPoints\">\r\n <th mat-header-cell *matHeaderCellDef>Points</th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n @if (element.isEditRow) {\r\n <mat-form-field subscriptSizing=\"dynamic\" class=\"input-add\" appearance=\"outline\">\r\n <input matInput [(ngModel)]=\"pointRow.totalPoints\"\r\n placeholder=\"Enter points , eg 50\" type=\"number\">\r\n </mat-form-field>\r\n } @else {\r\n {{ element.totalPoints }}\r\n }\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"pointType\">\r\n <th mat-header-cell *matHeaderCellDef>Point Type</th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n @if (element.isEditRow) {\r\n <mat-form-field subscriptSizing=\"dynamic\" class=\"input-add\" appearance=\"outline\">\r\n <mat-select (selectionChange)=\"selectPointType($event)\" ngDefaultControl\r\n [value]=\"pointRow.pointType\"\r\n placeholder=\"Select\">\r\n @for (type of inputConfig()?.adjudicationPointTypes || []; track $index) {\r\n <mat-option [value]=\"type\">{{ type }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n } @else {\r\n {{ element.pointType }}\r\n }\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"actions\" [stickyEnd]=\"true\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <span style=\"display: flex; justify-content: center;\">\r\n @if (element.isEditRow) {\r\n <button matTooltip=\"Save Point in Edit\" color=\"primary\" style=\"white-space: nowrap;\r\n height: 26px;\r\n margin-bottom: 0px;\" mat-flat-button (click)=\"savePoints()\" [disabled]=\"!pointInEditIsValid || inputConfig()?.disabled || inputConfig()?.readonly\">\r\n <span style=\"font-size: 0.875em;\">\r\n save\r\n </span>\r\n </button>\r\n } @else {\r\n <button mat-icon-button (click)=\"edit(element)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button mat-icon-button (click)=\"remove(element)\">\r\n <mat-icon>delete_forever</mat-icon>\r\n </button>\r\n }\r\n </span>\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"cols()\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: cols()\"></tr>\r\n </table>\r\n</div>\r\n</lib-adjudication-shell>\r\n", styles: [".input-add{width:100%}th,td{padding:4px}mat-hint{text-align:start}:host .glass{background:#ffffff40;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}.mat-column-totalPoints{width:100px!important;max-width:100px!important}.mat-column-pointType{width:180px!important;max-width:180px!important}.mat-column-actions{width:78px!important;max-width:78px!important}li{font-size:.75em}ol{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TextFieldModule }, { kind: "directive", type: i2$1.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i5$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i8.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i5$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i2$4.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5$2.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5$2.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5$2.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5$2.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5$2.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5$2.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5$2.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5$2.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5$2.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5$2.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: AdjudicationShellComponent, selector: "lib-adjudication-shell", inputs: ["label", "system", "docsContext", "chart"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
331
+ }
332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: PointsCreationComponent, decorators: [{
333
+ type: Component,
334
+ args: [{ selector: 'lib-points-creation', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [
335
+ ReactiveFormsModule,
336
+ FormsModule,
337
+ TextFieldModule,
338
+ MatAutocompleteModule,
339
+ MatButtonModule,
340
+ MatFormFieldModule,
341
+ MatIconModule,
342
+ MatInputModule,
343
+ MatSelectModule,
344
+ MatSortModule,
345
+ MatTableModule,
346
+ MatTooltipModule,
347
+ AdjudicationShellComponent,
348
+ ], template: "<lib-adjudication-shell label=\"Score sheet\" [docsContext]=\"docsContext\">\r\n<div style=\"resize: both; overflow: auto;\">\r\n @if (!points || points.length === 1) {\r\n <h5 style=\"margin-bottom: 5px; margin-top: 0px;\">\r\n &#8505;&#65039; To add a scoring item:\r\n </h5>\r\n <ol>\r\n <li>\r\n <strong>Enter Description:</strong>\r\n <ul style=\"margin-top: 5px; margin-bottom: 5px; padding-left: 20px; list-style-type: disc;\">\r\n <li>\r\n To <strong>link</strong> a field: You <strong>must select it</strong> from the list first (you can\r\n edit it after).\r\n </li>\r\n <li>\r\n For a <strong>custom</strong> point: <strong>Ignore the list</strong> and just type your own\r\n description.\r\n </li>\r\n </ul>\r\n </li>\r\n <li>\r\n <strong>Set Details:</strong>\r\n Assign the <strong>Points</strong> and select the <strong>Point Type</strong>.\r\n </li>\r\n <li>\r\n <strong>Save:</strong>\r\n Click the <strong>\"Save\"</strong> button to add the item.\r\n </li>\r\n </ol>\r\n }\r\n <table mat-table [dataSource]=\"points\" matSort>\r\n <ng-container matColumnDef=\"description\">\r\n <th mat-header-cell *matHeaderCellDef>Description</th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n @if (element.isEditRow) {\r\n <mat-form-field subscriptSizing=\"dynamic\" class=\"input-add\" appearance=\"outline\">\r\n <textarea [matAutocomplete]=\"auto\" [(ngModel)]=\"pointRow.description\" matInput cdkTextareaAutosize\r\n cdkAutosizeMinRows=\"1\" placeholder=\"Enter point description\"></textarea>\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n @for (input of filteredInputs; track input.id) {\r\n <mat-option [value]=\"input.label\" (click)=\"selectActiveInput(input)\">\r\n <div style=\"display: flex;align-items: center;gap:8px\">\r\n <mat-icon style=\"font-size:24px; width:24px; height:24px;\"\r\n [attr.aria-label]=\"input.label\">\r\n {{ getInputIcon(input) }}\r\n </mat-icon>\r\n <span>\r\n <div style=\"font-size: 0.75em;\">\r\n <strong>\r\n {{ input.label }}\r\n </strong>\r\n </div>\r\n <div\r\n style=\"font-size: 0.75em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;\">\r\n {{ input.hintLabel || input.formControlName }}\r\n </div>\r\n </span>\r\n </div>\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n } @else {\r\n {{ element.description }}\r\n }\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"totalPoints\">\r\n <th mat-header-cell *matHeaderCellDef>Points</th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n @if (element.isEditRow) {\r\n <mat-form-field subscriptSizing=\"dynamic\" class=\"input-add\" appearance=\"outline\">\r\n <input matInput [(ngModel)]=\"pointRow.totalPoints\"\r\n placeholder=\"Enter points , eg 50\" type=\"number\">\r\n </mat-form-field>\r\n } @else {\r\n {{ element.totalPoints }}\r\n }\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"pointType\">\r\n <th mat-header-cell *matHeaderCellDef>Point Type</th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n @if (element.isEditRow) {\r\n <mat-form-field subscriptSizing=\"dynamic\" class=\"input-add\" appearance=\"outline\">\r\n <mat-select (selectionChange)=\"selectPointType($event)\" ngDefaultControl\r\n [value]=\"pointRow.pointType\"\r\n placeholder=\"Select\">\r\n @for (type of inputConfig()?.adjudicationPointTypes || []; track $index) {\r\n <mat-option [value]=\"type\">{{ type }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n } @else {\r\n {{ element.pointType }}\r\n }\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"actions\" [stickyEnd]=\"true\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <span style=\"display: flex; justify-content: center;\">\r\n @if (element.isEditRow) {\r\n <button matTooltip=\"Save Point in Edit\" color=\"primary\" style=\"white-space: nowrap;\r\n height: 26px;\r\n margin-bottom: 0px;\" mat-flat-button (click)=\"savePoints()\" [disabled]=\"!pointInEditIsValid || inputConfig()?.disabled || inputConfig()?.readonly\">\r\n <span style=\"font-size: 0.875em;\">\r\n save\r\n </span>\r\n </button>\r\n } @else {\r\n <button mat-icon-button (click)=\"edit(element)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button mat-icon-button (click)=\"remove(element)\">\r\n <mat-icon>delete_forever</mat-icon>\r\n </button>\r\n }\r\n </span>\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"cols()\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: cols()\"></tr>\r\n </table>\r\n</div>\r\n</lib-adjudication-shell>\r\n", styles: [".input-add{width:100%}th,td{padding:4px}mat-hint{text-align:start}:host .glass{background:#ffffff40;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}.mat-column-totalPoints{width:100px!important;max-width:100px!important}.mat-column-pointType{width:180px!important;max-width:180px!important}.mat-column-actions{width:78px!important;max-width:78px!important}li{font-size:.75em}ol{margin-top:8px}\n"] }]
349
+ }], ctorParameters: () => [], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], pointsChange: [{ type: i0.Output, args: ["pointsChange"] }] } });
350
+
351
+ /** Human-readable reason for an unknown thrown value, for the error card. */
352
+ function describeError(error) {
353
+ if (error instanceof Error && error.message)
354
+ return error.message;
355
+ if (typeof error === 'string' && error.length > 0)
356
+ return error;
357
+ return 'Unknown error';
358
+ }
359
+ /**
360
+ * One fetch per trigger emission, surfaced as {@link MicroflowFetchState}.
361
+ *
362
+ * Errors are caught INSIDE the `switchMap`, so a failed request completes only
363
+ * its own inner observable: the trigger subscription survives and the next
364
+ * trigger genuinely refetches. (The historical defect placed `catchError` on
365
+ * the consuming `vm$` itself — the first error tore the whole chain down and
366
+ * "Try Again" pushed into a dead trigger.) `startWith` re-enters the loading
367
+ * state on every trigger, so a retry shows the spinner instead of a stale
368
+ * error card.
369
+ *
370
+ * @param trigger$ - Emits whenever a (re)fetch should run.
371
+ * @param fetch - The `getCurrentStepMicroflowSubmissions` call, deferred so
372
+ * each trigger issues a fresh request.
373
+ * @returns Replayed (`shareReplay(1)`) state stream for a step's `vm$`.
374
+ */
375
+ function microflowFetchStates(trigger$, fetch) {
376
+ return trigger$.pipe(switchMap(() => fetch().pipe(take(1), map((payload) => ({ status: 'loaded', payload })), catchError((error) => of({ status: 'failed', reason: describeError(error) })), startWith({ status: 'loading' }))), shareReplay(1));
377
+ }
378
+
379
+ /**
380
+ * R50 million: the Rand-value boundary between the 80/20 and 90/10 systems
381
+ * (PPR 2022 regs 4(1) and 5(1); ≤ threshold → 80/20, above → 90/10).
382
+ */
383
+ const RAND_VALUE_SCALE_THRESHOLD = 50_000_000;
384
+ /**
385
+ * Default form key holding each submission's tendered price. Matches the
386
+ * `totalBidPrice` token the published formula strings are written against;
387
+ * hosts override per tender via `AdjResponseReviewColumnMapping.responsePriceKey`.
388
+ */
389
+ const DEFAULT_RESPONSE_PRICE_KEY = 'totalBidPrice';
390
+ /**
391
+ * Default ALT sensitivity: a bid more than 15% below the median responsive
392
+ * price (or below the estimated Rand value) is flagged for investigation.
393
+ * A best-practice heuristic — SA guidance prescribes judgment, not a fixed
394
+ * percentage — chosen at the sensitive end of the common 15–20% band so
395
+ * borderline under-quotes surface rather than slip through.
396
+ */
397
+ const DEFAULT_ABNORMALLY_LOW_FRACTION = 0.15;
398
+ /** Row key the engine writes its ALT flag to (read by the review template). */
399
+ const ABNORMALLY_LOW_FLAG_KEY = 'adj_priceScore_abnormallyLow';
400
+ /**
401
+ * Reads the 80/90 base out of a stored formula string such as
402
+ * `80(1-((totalBidPrice-Pmin)/(Pmin)))` — the shape workflow steps persist in
403
+ * `adjudicationPricePreferenceCalculationFormula`. Returns undefined for
404
+ * anything else so auto-selection (rule 5) takes over.
405
+ */
406
+ function parsePreferenceScale(formula) {
407
+ const match = /^\s*(80|90)\s*\(/.exec(formula ?? '');
408
+ if (match?.[1] === '80')
409
+ return 80;
410
+ if (match?.[1] === '90')
411
+ return 90;
412
+ return undefined;
413
+ }
414
+ /**
415
+ * Rule 5 precedence: advertised system → estimated Rand value → lowest
416
+ * acceptable tender (reg 3(b)). Exported for the spec; `pMin` may be null
417
+ * only while nothing is computable, in which case the default is 80/20 (the
418
+ * band the overwhelming majority of tenders fall in).
419
+ */
420
+ function selectPreferenceScale(scaleOverride, estimatedProcurementValue, pMin) {
421
+ if (scaleOverride)
422
+ return scaleOverride;
423
+ if (Number.isFinite(estimatedProcurementValue) && estimatedProcurementValue > 0) {
424
+ return estimatedProcurementValue <= RAND_VALUE_SCALE_THRESHOLD ? 80 : 90;
425
+ }
426
+ if (pMin !== null) {
427
+ return pMin <= RAND_VALUE_SCALE_THRESHOLD ? 80 : 90;
428
+ }
429
+ return 80;
430
+ }
431
+ /** Rule 4: full precision internally; final figure only, two decimals, half-up. */
432
+ function roundToTwoDecimals(value) {
433
+ return Math.round((value + Number.EPSILON) * 100) / 100;
434
+ }
435
+ /** Median of a non-empty list (mean of the middle pair for even lengths). */
436
+ function median(sortedAscending) {
437
+ const mid = Math.floor(sortedAscending.length / 2);
438
+ return sortedAscending.length % 2 === 1
439
+ ? sortedAscending[mid]
440
+ : (sortedAscending[mid - 1] + sortedAscending[mid]) / 2;
441
+ }
442
+ /**
443
+ * One full calculation pass over the bid pool.
444
+ *
445
+ * Pure and synchronous: feed it the current rows and the current review
446
+ * verdicts and every score comes back consistent with that state — which is
447
+ * what makes rule 2's "recalculate instantly on disqualification" a matter of
448
+ * simply calling it again from reactive state.
449
+ *
450
+ * @param rows - The submission rows (each must carry `id`; prices are read
451
+ * from `options.priceKey`).
452
+ * @param options - See {@link PricePreferenceOptions}.
453
+ * @returns See {@link PricePreferenceResult}; check `computed` before use.
454
+ */
455
+ function computePricePreference(rows, options) {
456
+ const priceKey = options?.priceKey || DEFAULT_RESPONSE_PRICE_KEY;
457
+ const nonResponsiveIds = options?.nonResponsiveIds ?? new Set();
458
+ const altFraction = options?.abnormallyLowFraction ?? DEFAULT_ABNORMALLY_LOW_FRACTION;
459
+ const priceOf = (row) => {
460
+ const price = Number(row[priceKey]);
461
+ return Number.isFinite(price) && price > 0 ? price : undefined;
462
+ };
463
+ // The engine only stands down when price data simply is not reaching the
464
+ // library: no row at all carries a usable price under the price key. Then
465
+ // the caller keeps host-stamped scores (the pre-engine behaviour).
466
+ const anyUsablePrice = rows.some(row => priceOf(row) !== undefined);
467
+ if (!anyUsablePrice) {
468
+ return { computed: false, scale: null, pMin: null, median: null, scores: new Map() };
469
+ }
470
+ // Rule 2: the acceptable pool is responsive bids with a usable price. An
471
+ // EMPTY pool (every priced bid disqualified) is still a computed state —
472
+ // with no acceptable tender there is no Pmin and every price score is 0.
473
+ const responsivePrices = rows
474
+ .filter(row => !nonResponsiveIds.has(row.id))
475
+ .map(priceOf)
476
+ .filter((price) => price !== undefined)
477
+ .sort((a, b) => a - b);
478
+ const pMin = responsivePrices.length > 0 ? responsivePrices[0] : null;
479
+ const scale = selectPreferenceScale(options?.scaleOverride, options?.estimatedProcurementValue, pMin);
480
+ // Rule 3 anchors: the responsive median, plus the estimate when provided.
481
+ const responsiveMedian = responsivePrices.length > 0 ? median(responsivePrices) : undefined;
482
+ const altBelowMedian = responsiveMedian !== undefined ? responsiveMedian * (1 - altFraction) : undefined;
483
+ const estimate = options?.estimatedProcurementValue;
484
+ const altBelowEstimate = Number.isFinite(estimate) && estimate > 0
485
+ ? estimate * (1 - altFraction)
486
+ : undefined;
487
+ const scores = new Map();
488
+ for (const row of rows) {
489
+ const nonResponsive = nonResponsiveIds.has(row.id);
490
+ const price = priceOf(row);
491
+ const priceMissing = price === undefined;
492
+ let points = 0;
493
+ if (!nonResponsive && price !== undefined && pMin !== null) {
494
+ // Regs 4(1)/5(1): Ps = scale × (1 − (Pt − Pmin) / Pmin), floored at 0
495
+ // (rule 1) and rounded last (rule 4).
496
+ points = roundToTwoDecimals(Math.max(0, scale * (1 - (price - pMin) / pMin)));
497
+ }
498
+ // A disqualified bid is never flagged: it is already out of the pool and
499
+ // cannot hold Pmin, which is the risk the flag exists to surface.
500
+ const abnormallyLow = !nonResponsive &&
501
+ price !== undefined &&
502
+ ((altBelowMedian !== undefined && price < altBelowMedian) ||
503
+ (altBelowEstimate !== undefined && price < altBelowEstimate));
504
+ scores.set(row.id, { points, abnormallyLow, nonResponsive, priceMissing });
505
+ }
506
+ return { computed: true, scale, pMin, median: responsiveMedian ?? null, scores };
507
+ }
508
+
509
+ function getColorForNumber(targetNumber, numbers, asc = true) {
510
+ if (numbers.length === 0) {
511
+ throw new Error("The numbers array must not be empty.");
512
+ }
513
+ // Avoid sorting the original array
514
+ const sortedNumbers = [...numbers].sort((a, b) => asc ? a - b : b - a);
515
+ const min = sortedNumbers[0];
516
+ const max = sortedNumbers[sortedNumbers.length - 1];
517
+ if (!min || !max) {
518
+ return "rgb(173, 173, 173)";
519
+ }
520
+ if (min === max) {
521
+ return "rgb(173, 173, 173)"; // Return gray if there is no range
522
+ }
523
+ const interpolateColor = (value) => {
524
+ const fraction = (value - min) / (max - min);
525
+ const colors = [
526
+ { color: [247, 0, 0], pos: 0.0 }, // Red
527
+ { color: [247, 187, 0], pos: 0.25 }, // Orange
528
+ { color: [247, 247, 0], pos: 0.5 }, // Yellow
529
+ { color: [207, 247, 0], pos: 0.75 }, // Light green
530
+ { color: [96, 247, 0], pos: 1.0 } // Green
531
+ ];
532
+ for (let i = 0; i < colors.length - 1; i++) {
533
+ const nextColor = colors[i + 1];
534
+ const currentColor = colors[i];
535
+ if (currentColor && nextColor && fraction <= nextColor.pos) {
536
+ const range = nextColor.pos - currentColor.pos;
537
+ const localFraction = (fraction - currentColor.pos) / range;
538
+ const r = Math.round(currentColor.color[0] + localFraction * (nextColor.color[0] - currentColor.color[0]));
539
+ const g = Math.round(currentColor.color[1] + localFraction * (nextColor.color[1] - currentColor.color[1]));
540
+ const b = Math.round(currentColor.color[2] + localFraction * (nextColor.color[2] - currentColor.color[2]));
541
+ return `rgb(${r}, ${g}, ${b})`;
542
+ }
543
+ }
544
+ return `rgb(${colors[colors.length - 1]?.color[0]}, ${colors[colors.length - 1]?.color[1]}, ${colors[colors.length - 1]?.color[2]},0.6)`;
545
+ };
546
+ return interpolateColor(targetNumber);
547
+ }
548
+
549
+ /**
550
+ * Normalises whatever is stored under `adj_microFlow_review_notes` — or
551
+ * configured as a step's `adjudicationReviewFeedbackTemplate` — into the
552
+ * Quill Delta shape the notes editor consumes.
553
+ *
554
+ * The notes editor used to be EditorJS, so live documents hold EditorJS
555
+ * `OutputData` (`{ blocks: [...] }`) and workflow steps hold EditorJS-shaped
556
+ * feedback templates. Those must keep opening readably, so this converter is
557
+ * the single migration boundary:
558
+ *
559
+ * - a Quill payload (`{ ops: [...] }`) passes through untouched;
560
+ * - a legacy EditorJS document is flattened block-by-block (paragraphs,
561
+ * headers, lists, quotes, tables, code, delimiters) with inline HTML
562
+ * stripped — formatting fidelity is best-effort, the TEXT is what survives;
563
+ * - a bare string becomes a single paragraph;
564
+ * - anything else (including `{}` from an unconfigured template) → undefined.
565
+ *
566
+ * A document saved after this change is Quill-native and round-trips exactly.
567
+ */
568
+ function toQuillNotes(value) {
569
+ if (value === null || value === undefined)
570
+ return undefined;
571
+ if (typeof value === 'string') {
572
+ const text = value.trim();
573
+ return text ? { ops: [{ insert: text.endsWith('\n') ? text : `${text}\n` }] } : undefined;
574
+ }
575
+ if (typeof value !== 'object')
576
+ return undefined;
577
+ const record = value;
578
+ if (Array.isArray(record['ops'])) {
579
+ // Same reference back, not a re-wrap: identity survives, so equality
580
+ // guards downstream (`_isEqual` short-circuits) see an unchanged value.
581
+ return record['ops'].length > 0 ? value : undefined;
582
+ }
583
+ if (Array.isArray(record['blocks'])) {
584
+ const ops = record['blocks'].flatMap(blockToOps);
585
+ return ops.length > 0 ? { ops } : undefined;
586
+ }
587
+ return undefined;
588
+ }
589
+ /** One legacy EditorJS block → the Delta ops that carry its text. */
590
+ function blockToOps(block) {
591
+ if (typeof block !== 'object' || block === null)
592
+ return [];
593
+ const { type, data } = block;
594
+ switch (type) {
595
+ case 'header': {
596
+ const text = plainText(data?.['text']);
597
+ if (!text)
598
+ return [];
599
+ const level = Number(data?.['level']);
600
+ return [
601
+ { insert: text },
602
+ { insert: '\n', attributes: { header: level >= 1 && level <= 6 ? level : 2 } },
603
+ ];
604
+ }
605
+ case 'list': {
606
+ const style = data?.['style'] === 'ordered' ? 'ordered' : 'bullet';
607
+ const items = Array.isArray(data?.['items']) ? data['items'] : [];
608
+ return items.flatMap((item) => {
609
+ // Items are plain strings in old documents, `{ content }` in newer ones.
610
+ const text = plainText(typeof item === 'object' && item !== null
611
+ ? item['content']
612
+ : item);
613
+ return text ? [{ insert: text }, { insert: '\n', attributes: { list: style } }] : [];
614
+ });
615
+ }
616
+ case 'quote': {
617
+ const text = plainText(data?.['text']);
618
+ return text ? [{ insert: text }, { insert: '\n', attributes: { blockquote: true } }] : [];
619
+ }
620
+ case 'code': {
621
+ const code = typeof data?.['code'] === 'string' ? data['code'] : '';
622
+ return code ? [{ insert: code }, { insert: '\n', attributes: { 'code-block': true } }] : [];
623
+ }
624
+ case 'table': {
625
+ // Rows flatten to "cell | cell" lines — legible, if no longer a table.
626
+ const content = Array.isArray(data?.['content']) ? data['content'] : [];
627
+ return content.flatMap((row) => {
628
+ if (!Array.isArray(row))
629
+ return [];
630
+ const line = row.map((cell) => plainText(cell)).filter(Boolean).join(' | ');
631
+ return line ? [{ insert: `${line}\n` }] : [];
632
+ });
633
+ }
634
+ case 'delimiter':
635
+ return [{ insert: '---\n' }];
636
+ default: {
637
+ // Paragraphs, and any unknown block that carries a `text` field.
638
+ const text = plainText(data?.['text']);
639
+ return text ? [{ insert: `${text}\n` }] : [];
640
+ }
641
+ }
642
+ }
643
+ /** Strips EditorJS inline HTML down to text; `<br>` survives as a newline. */
644
+ function plainText(value) {
645
+ if (typeof value !== 'string')
646
+ return '';
647
+ return value
648
+ .replace(/<br\s*\/?>/gi, '\n')
649
+ .replace(/<[^>]+>/g, '')
650
+ .replace(/&nbsp;/g, ' ')
651
+ .replace(/&amp;/g, '&')
652
+ .replace(/&lt;/g, '<')
653
+ .replace(/&gt;/g, '>')
654
+ .replace(/&quot;/g, '"')
655
+ .trim();
656
+ }
657
+
658
+ class SubmissionReviewDialogComponent {
659
+ constructor() {
660
+ this.dialogRef = inject(MatDialogRef);
661
+ this.data = inject(MAT_DIALOG_DATA);
662
+ /**
663
+ * What the Quill editor opens with: the saved notes when any exist, else the
664
+ * step's feedback template — each migrated from its stored shape (legacy
665
+ * EditorJS documents included) by {@link toQuillNotes}.
666
+ */
667
+ this.initialNotes = toQuillNotes(this.data.row['adj_microFlow_review_notes']) ?? toQuillNotes(this.data.activeRowNotes);
668
+ }
669
+ get notesInputConfig() {
670
+ return {
671
+ id: 'adj_microFlow_review_notes',
672
+ label: 'Notes',
673
+ readonly: this.data.readonly,
674
+ required: false,
675
+ formControlName: 'adj_microFlow_review_notes',
676
+ };
677
+ }
678
+ get respondentName() {
679
+ const raw = this.data.row[this.data.respondentNameKey];
680
+ return typeof raw === 'string' ? raw : '';
681
+ }
682
+ notesChanged(notes) {
683
+ this.changedNotes = notes;
684
+ }
685
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SubmissionReviewDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
686
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: SubmissionReviewDialogComponent, isStandalone: true, selector: "lib-submission-review-dialog", ngImport: i0, template: "<span mat-dialog-title>\r\n Review Feedback For <span class=\"bidder-name\">{{ respondentName }}</span>\r\n</span>\r\n\r\n<div class=\"dialog-instructions\">\r\n <p>\r\n Your notes will be visible to the respondent. Provide <strong>clear, constructive feedback</strong> to\r\n guide their future submissions.\r\n </p>\r\n</div>\r\n<mat-dialog-content style=\"padding-bottom: 8px;padding-bottom: 8px\">\r\n <mat-form-field floatLabel=\"always\" subscriptSizing=\"dynamic\" style=\"width: 100%;\r\n display: absolute;\r\n left: 0;\r\n margin-bottom: 8px;\r\n margin-top: 8px;\r\n border-radius:16px;\" appearance=\"outline\">\r\n <lib-quill-input [value]=\"initialNotes\"\r\n (valueChanged)=\"notesChanged($event)\" ngDefaultControl [inputConfig]=\"notesInputConfig\"\r\n [required]=\"notesInputConfig.required\">\r\n </lib-quill-input>\r\n <mat-hint>\r\n <strong>Tip:</strong> Use bold, lists, and tables to structure your feedback.\r\n </mat-hint>\r\n </mat-form-field>\r\n</mat-dialog-content>\r\n\r\n\r\n<mat-dialog-actions align=\"end\">\r\n <button mat-dialog-close mat-button >\r\n Cancel\r\n </button>\r\n @if( !data.readonly){\r\n <button mat-flat-button\r\n [mat-dialog-close]=\"changedNotes\"\r\n >\r\n Save Feedback\r\n </button>}\r\n</mat-dialog-actions>", styles: [":host{display:block;min-width:500px;max-width:700px}.bidder-name{font-weight:500}.summary-bar{margin-bottom:24px}.summary-bar h3{margin-bottom:8px;font-weight:500}.score-item{display:flex;align-items:center;justify-content:space-between;padding:8px 4px;gap:16px}.score-description{flex:1;margin-right:16px;line-height:1.4}.score-input{flex-shrink:0;width:150px}.mat-expansion-panel-body .score-item:last-child+mat-divider{display:none}mat-dialog-actions{padding:16px 24px}.mat-mdc-form-field-error{font-size:.8125em}.dialog-instructions{margin-top:-8px;margin-bottom:24px;max-width:95%;padding-left:24px;padding-right:24px}li{font-size:.75em}ol,ul{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: QuillInputComponent, selector: "lib-quill-input", inputs: ["inputConfig", "bindings", "value"], outputs: ["valueChanged"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
687
+ }
688
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SubmissionReviewDialogComponent, decorators: [{
689
+ type: Component,
690
+ args: [{ selector: 'lib-submission-review-dialog', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [MatDialogModule, MatFormFieldModule, MatButtonModule, QuillInputComponent], template: "<span mat-dialog-title>\r\n Review Feedback For <span class=\"bidder-name\">{{ respondentName }}</span>\r\n</span>\r\n\r\n<div class=\"dialog-instructions\">\r\n <p>\r\n Your notes will be visible to the respondent. Provide <strong>clear, constructive feedback</strong> to\r\n guide their future submissions.\r\n </p>\r\n</div>\r\n<mat-dialog-content style=\"padding-bottom: 8px;padding-bottom: 8px\">\r\n <mat-form-field floatLabel=\"always\" subscriptSizing=\"dynamic\" style=\"width: 100%;\r\n display: absolute;\r\n left: 0;\r\n margin-bottom: 8px;\r\n margin-top: 8px;\r\n border-radius:16px;\" appearance=\"outline\">\r\n <lib-quill-input [value]=\"initialNotes\"\r\n (valueChanged)=\"notesChanged($event)\" ngDefaultControl [inputConfig]=\"notesInputConfig\"\r\n [required]=\"notesInputConfig.required\">\r\n </lib-quill-input>\r\n <mat-hint>\r\n <strong>Tip:</strong> Use bold, lists, and tables to structure your feedback.\r\n </mat-hint>\r\n </mat-form-field>\r\n</mat-dialog-content>\r\n\r\n\r\n<mat-dialog-actions align=\"end\">\r\n <button mat-dialog-close mat-button >\r\n Cancel\r\n </button>\r\n @if( !data.readonly){\r\n <button mat-flat-button\r\n [mat-dialog-close]=\"changedNotes\"\r\n >\r\n Save Feedback\r\n </button>}\r\n</mat-dialog-actions>", styles: [":host{display:block;min-width:500px;max-width:700px}.bidder-name{font-weight:500}.summary-bar{margin-bottom:24px}.summary-bar h3{margin-bottom:8px;font-weight:500}.score-item{display:flex;align-items:center;justify-content:space-between;padding:8px 4px;gap:16px}.score-description{flex:1;margin-right:16px;line-height:1.4}.score-input{flex-shrink:0;width:150px}.mat-expansion-panel-body .score-item:last-child+mat-divider{display:none}mat-dialog-actions{padding:16px 24px}.mat-mdc-form-field-error{font-size:.8125em}.dialog-instructions{margin-top:-8px;margin-bottom:24px;max-width:95%;padding-left:24px;padding-right:24px}li{font-size:.75em}ol,ul{margin-top:8px}\n"] }]
691
+ }] });
692
+
693
+ class SubmissionReviewComponent {
694
+ constructor() {
695
+ this.#config = inject(NGX_T_FORMS_CONFIG_TOKEN);
696
+ this.#destroyRef = inject(DestroyRef);
697
+ this.dialog = inject(MatDialog);
698
+ this.#refreshTrigger = new BehaviorSubject(undefined);
699
+ // A stream to push updates of the review values (`this.value`)
700
+ this.#valueChanges$ = new BehaviorSubject([]);
701
+ this.#valueSignal = signal([], ...(ngDevMode ? [{ debugName: "#valueSignal" }] : /* istanbul ignore next */ []));
702
+ this.#value = [];
703
+ this.inputConfig = input(undefined, ...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
704
+ /** The current review payload. Null while loading. */
705
+ // Parent (`workflow-adjudication-reactive-input`) passes a `WorkflowAdjudicationValue | null`
706
+ // union that includes three incompatible shapes (score-sheet array, micro-flow review array,
707
+ // response-elected-supplier object). This component only consumes the micro-flow branch; the
708
+ // input must remain `any` until parent template typing is split per micro-flow.
709
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO(phase-4): split parent template by adjudication step type, then narrow this input.
710
+ this.value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
711
+ this.valueBridge = effect(() => {
712
+ const raw = this.value();
713
+ // `?? []` is NOT enough here: an unsaved control reaches this input as the
714
+ // empty string (`formGenerator`'s `value || ''` seed), and any non-array
715
+ // slipping through crashes the enrich pass (`''.find is not a function`) —
716
+ // which the old vm$ catchError then misreported as a fetch failure.
717
+ // Same guard as the sibling steps (point-assignment / supplier-selection).
718
+ const next = Array.isArray(raw)
719
+ ? raw
720
+ : [];
721
+ if (_isEqual(next, this.#value))
722
+ return;
723
+ this.#value = next;
724
+ this.#valueSignal.set(next);
725
+ this.#valueChanges$.next(next);
726
+ }, ...(ngDevMode ? [{ debugName: "valueBridge" }] : /* istanbul ignore next */ []));
727
+ this.reviewChange = output();
728
+ this.selected = '';
729
+ this.columnMapping = undefined;
730
+ this.submissions = [];
731
+ this.#initialState = {
732
+ loading: true,
733
+ submissions: [],
734
+ columnMapping: { respondentNameKey: '', respondentCodeKey: '' },
735
+ displayCols: [],
736
+ displayColumns: [],
737
+ error: undefined,
738
+ docsContext: { step: AdjudicationSteps.SubMissionReview },
739
+ };
740
+ // One fetch per trigger; failures become 'failed' states instead of killing
741
+ // the stream, so "Try Again" genuinely refetches. See `microflowFetchStates`.
742
+ this.#fetchedData$ = microflowFetchStates(this.#refreshTrigger, () => this.#config.formBuilder.getCurrentStepMicroflowSubmissions());
743
+ /**
744
+ * Combines the fetched data with the ongoing stream of local review changes
745
+ * (`valueChanges$`), so a status/note edit re-projects without re-fetching.
746
+ *
747
+ * Failure is reported per branch: a fetch error and a projection error render
748
+ * different messages, so a bug in the enrich/sort pass can never masquerade
749
+ * as "the server call failed" (which is exactly how the `''.find` crash from
750
+ * a non-array `value` used to surface).
751
+ */
752
+ this.vm$ = combineLatest([
753
+ this.#fetchedData$,
754
+ this.#valueChanges$
755
+ ]).pipe(map(([fetched, reviewValues]) => {
756
+ if (fetched.status === 'loading') {
757
+ return this.#initialState;
758
+ }
759
+ if (fetched.status === 'failed') {
760
+ return {
761
+ ...this.#initialState,
762
+ loading: false,
763
+ error: `Could not load submissions: ${fetched.reason}`,
764
+ };
765
+ }
766
+ try {
767
+ return this.#buildViewModel(fetched.payload, reviewValues);
768
+ }
769
+ catch (error) {
770
+ // The data DID arrive — say so, and surface the real reason instead of
771
+ // swallowing it into a generic load-failure message.
772
+ return {
773
+ ...this.#initialState,
774
+ loading: false,
775
+ error: `Submissions were received but could not be displayed: ${describeError(error)}`,
776
+ };
777
+ }
778
+ }), shareReplay(1));
779
+ /**
780
+ * Latest per-id points for price computed by the engine, or null while the
781
+ * engine is not computing (no usable prices → host-stamped mode). Read by
782
+ * {@link #withCurrentScores} so every emission carries current figures.
783
+ */
784
+ this.#priceScores = null;
785
+ this.reviewStatuses = [
786
+ {
787
+ label: '✅ Compliant',
788
+ value: 'compliant',
789
+ color: 'var(--mat-sys-primary)',
790
+ },
791
+ {
792
+ label: '❌ Non-compliant',
793
+ value: 'non-compliant',
794
+ color: 'var(--mat-sys-error)',
795
+ },
796
+ ];
797
+ this.maxLimit = computed(() => {
798
+ const hasMax = this.inputConfig()?.maxLength;
799
+ if (!hasMax || isNaN(Number(hasMax))) {
800
+ return undefined;
801
+ }
802
+ return Number(hasMax);
803
+ }, ...(ngDevMode ? [{ debugName: "maxLimit" }] : /* istanbul ignore next */ []));
804
+ this.notesOpenForRowId = null;
805
+ this.bulkOperations = [
806
+ {
807
+ label: '✅ Set all to Compliant',
808
+ value: 'compliant',
809
+ color: 'var(--mat-sys-primary)',
810
+ },
811
+ {
812
+ label: '❌ Set all to Non-compliant',
813
+ value: 'non-compliant',
814
+ color: 'var(--mat-sys-error)',
815
+ },
816
+ {
817
+ label: '🔄 Reset all ',
818
+ value: 'reset',
819
+ color: 'var(--mat-sys-secondary)',
820
+ }
821
+ ];
822
+ this.bulkStatus = computed(() => {
823
+ // Re-read on submissions and value changes via the signal
824
+ void this.#valueSignal();
825
+ const allCompliant = this.submissions.every((s) => s['adj_microFlow_review'] === 'compliant');
826
+ if (allCompliant) {
827
+ return 'compliant';
828
+ }
829
+ const allNonCompliant = this.submissions.every((s) => s['adj_microFlow_review'] === 'non-compliant');
830
+ if (allNonCompliant) {
831
+ return 'non-compliant';
832
+ }
833
+ return 'mixed';
834
+ }, ...(ngDevMode ? [{ debugName: "bulkStatus" }] : /* istanbul ignore next */ []));
835
+ }
836
+ #config;
837
+ #destroyRef;
838
+ #refreshTrigger;
839
+ // A stream to push updates of the review values (`this.value`)
840
+ #valueChanges$;
841
+ #valueSignal;
842
+ #value;
843
+ #initialState;
844
+ // One fetch per trigger; failures become 'failed' states instead of killing
845
+ // the stream, so "Try Again" genuinely refetches. See `microflowFetchStates`.
846
+ #fetchedData$;
847
+ /**
848
+ * Projects a successful fetch plus the current local review values into the
849
+ * view model. A throw here is caught by `vm$` and reported as a display
850
+ * failure — never as a load failure.
851
+ */
852
+ #buildViewModel(payload, reviewValues) {
853
+ const { columnMapping } = payload;
854
+ this.columnMapping = columnMapping;
855
+ // PPPFA engine pass (see ../../price-preference.ts): points for price are
856
+ // recomputed here, from the tendered prices and the CURRENT verdicts, on
857
+ // every projection — so marking a bid non-compliant re-derives Pmin and
858
+ // every other score in the same pass (engine rule 2). Host-stamped scores
859
+ // remain the fallback when no price data reaches the library.
860
+ const { rows, scale, chart } = this.#applyPricePreference(payload, reviewValues);
861
+ this.submissions = rows;
862
+ const enrichedSubmissions = this.#enrichSubmissionsData(rows, columnMapping, reviewValues);
863
+ const calcKey = columnMapping.responsePreferenceCalculationKey || 'adjudicationPricePreferenceCalculation';
864
+ const sortedSubmissions = [...enrichedSubmissions].sort((a, b) => Number(b[calcKey]) - Number(a[calcKey]));
865
+ return {
866
+ loading: false,
867
+ submissions: sortedSubmissions,
868
+ columnMapping: columnMapping,
869
+ priceSystem: scale ? `${scale}/${100 - scale}` : undefined,
870
+ priceChart: chart,
871
+ docsContext: {
872
+ step: AdjudicationSteps.SubMissionReview,
873
+ system: scale ? `${scale}/${100 - scale}` : undefined,
874
+ priceKey: scale ? columnMapping.responsePriceKey || DEFAULT_RESPONSE_PRICE_KEY : undefined,
875
+ complianceLimit: this.maxLimit(),
876
+ },
877
+ displayCols: [columnMapping.respondentNameKey, 'adjudicationPricePreferenceCalculation', 'status', 'actions'],
878
+ displayColumns: [
879
+ { label: 'name', formControlName: columnMapping.respondentNameKey, type: InputDataTypes.String },
880
+ { label: 'Preference', formControlName: 'adjudicationPricePreferenceCalculation', type: InputDataTypes.Number, showColor: true },
881
+ { label: 'Actions', formControlName: 'actions', type: InputDataTypes.String },
882
+ { label: 'status and Notes', formControlName: 'status', type: 'actions' },
883
+ ],
884
+ error: undefined,
885
+ };
886
+ }
887
+ /**
888
+ * Latest per-id points for price computed by the engine, or null while the
889
+ * engine is not computing (no usable prices → host-stamped mode). Read by
890
+ * {@link #withCurrentScores} so every emission carries current figures.
891
+ */
892
+ #priceScores;
893
+ /**
894
+ * Runs the PPPFA price preference engine over the fetched rows and writes
895
+ * the outcome onto copies of them: the points under the preference
896
+ * calculation key (so sorting, colour banding and review records all read
897
+ * the engine's figure) and the abnormally-low flag under
898
+ * `ABNORMALLY_LOW_FLAG_KEY` (rendered as the amber warning in the points
899
+ * column — flagged for investigation, never auto-excluded).
900
+ *
901
+ * Scale precedence (engine rule 5): the step's configured formula string
902
+ * (the advertised system) → the estimated Rand value → the lowest
903
+ * acceptable tender (PPR 2022 reg 3(b)).
904
+ *
905
+ * When no responsive row carries a usable price under
906
+ * `columnMapping.responsePriceKey` (default `totalBidPrice`), the rows pass
907
+ * through untouched and host-stamped scores keep working — the pre-engine
908
+ * behaviour.
909
+ */
910
+ #applyPricePreference(payload, reviewValues) {
911
+ const { submissions, columnMapping } = payload;
912
+ const nonResponsiveIds = new Set((reviewValues ?? [])
913
+ .filter((v) => v.adj_microFlow_review === 'non-compliant')
914
+ .map((v) => v.id));
915
+ const result = computePricePreference(submissions, {
916
+ priceKey: columnMapping.responsePriceKey,
917
+ nonResponsiveIds,
918
+ estimatedProcurementValue: payload.estimatedProcurementValue,
919
+ scaleOverride: parsePreferenceScale(payload.adjudicationPricePreferenceCalculationFormula),
920
+ });
921
+ if (!result.computed) {
922
+ this.#priceScores = null;
923
+ return { rows: submissions, scale: null };
924
+ }
925
+ const calcKey = columnMapping.responsePreferenceCalculationKey || 'adjudicationPricePreferenceCalculation';
926
+ this.#priceScores = new Map(Array.from(result.scores, ([id, score]) => [id, score.points]));
927
+ return {
928
+ scale: result.scale,
929
+ chart: this.#buildPriceChart(submissions, columnMapping, result),
930
+ rows: submissions.map((row) => {
931
+ const score = result.scores.get(row.id);
932
+ if (!score)
933
+ return row;
934
+ return { ...row, [calcKey]: score.points, [ABNORMALLY_LOW_FLAG_KEY]: score.abnormallyLow };
935
+ }),
936
+ };
937
+ }
938
+ /**
939
+ * Projects an engine pass into the shared adjudication chart: one price bar
940
+ * and one points bar per bid on a shared axis, the responsive median and
941
+ * the abnormally-low cutoff (median − 15%) as reference lines, and a
942
+ * per-bid drift note so the chart SAYS why a bid is flagged, not just
943
+ * paints it amber. Rows without a usable price are left off and counted in
944
+ * the footnote.
945
+ */
946
+ #buildPriceChart(submissions, columnMapping, result) {
947
+ if (result.scale === null)
948
+ return undefined;
949
+ const scale = result.scale;
950
+ const priceKey = columnMapping.responsePriceKey || DEFAULT_RESPONSE_PRICE_KEY;
951
+ const priced = submissions
952
+ .map((row) => {
953
+ const price = Number(row[priceKey]);
954
+ const score = result.scores.get(row.id);
955
+ if (!Number.isFinite(price) || price <= 0 || !score)
956
+ return null;
957
+ return { row, price, score };
958
+ })
959
+ .filter((entry) => entry !== null)
960
+ .sort((a, b) => a.price - b.price);
961
+ if (priced.length === 0)
962
+ return undefined;
963
+ const median = result.median;
964
+ const cutoff = median !== null ? median * (1 - DEFAULT_ABNORMALLY_LOW_FRACTION) : null;
965
+ // 5% headroom so the longest bar never kisses the edge; the median line
966
+ // must always sit inside the axis even when every bid is below it.
967
+ const axisMax = Math.max(priced[priced.length - 1].price, median ?? 0) * 1.05;
968
+ const pct = (value) => Math.round((value / axisMax) * 1000) / 10;
969
+ const rand = (value) => `R ${value.toLocaleString('en-ZA', { maximumFractionDigits: 2 })}`;
970
+ const unpriced = submissions.length - priced.length;
971
+ return {
972
+ caption: `Thick bar = tendered price · thin bar = points for price (0–${scale}). ` +
973
+ (median !== null
974
+ ? 'Bids left of the −15% line sit in the shaded zone: abnormally low against the median.'
975
+ : ''),
976
+ zonePct: cutoff !== null ? pct(cutoff) : undefined,
977
+ refs: [
978
+ ...(median !== null ? [{ label: 'median', pct: pct(median), kind: 'neutral' }] : []),
979
+ ...(cutoff !== null ? [{ label: '−15%', pct: pct(cutoff), kind: 'warning' }] : []),
980
+ ],
981
+ legend: [
982
+ { label: 'Tendered price', kind: 'primary' },
983
+ { label: 'Abnormally low — investigate', kind: 'warning' },
984
+ { label: `Points for price (0–${scale})`, kind: 'secondary' },
985
+ ],
986
+ footnote: unpriced > 0
987
+ ? `${unpriced} submission(s) carry no usable price under “${priceKey}” and are not charted.`
988
+ : undefined,
989
+ rows: priced.map(({ row, price, score }) => {
990
+ const drift = median !== null ? ((price - median) / median) * 100 : null;
991
+ return {
992
+ id: row.id,
993
+ name: String(row[columnMapping.respondentNameKey] ?? row.id),
994
+ primaryPct: pct(price),
995
+ primaryLabel: rand(price),
996
+ secondaryPct: Math.round((score.points / scale) * 1000) / 10,
997
+ secondaryLabel: `${score.points.toFixed(2)} pts`,
998
+ state: score.nonResponsive ? 'muted' : score.abnormallyLow ? 'warning' : 'normal',
999
+ note: score.nonResponsive
1000
+ ? 'non-compliant — excluded from benchmark'
1001
+ : score.abnormallyLow && drift !== null
1002
+ ? `${Number((-drift).toFixed(1))}% below median — investigate`
1003
+ : undefined,
1004
+ };
1005
+ }),
1006
+ };
1007
+ }
1008
+ /**
1009
+ * Single funnel for every review emission. Re-stamps each record with the
1010
+ * engine's CURRENT points before it leaves the component, so a verdict that
1011
+ * shifted Pmin updates the committed score of EVERY record in the same
1012
+ * emission — the saved value can never carry a score computed against a
1013
+ * superseded Pmin (engine rule 2, extended to the audit trail). A no-op in
1014
+ * host-stamped mode.
1015
+ */
1016
+ #emitReview(values) {
1017
+ const scores = this.#priceScores;
1018
+ const stamped = !scores
1019
+ ? values
1020
+ : values.map((v) => {
1021
+ const points = scores.get(v.id);
1022
+ return points === undefined || v.adjudicationPricePreferenceCalculation === points
1023
+ ? v
1024
+ : { ...v, adjudicationPricePreferenceCalculation: points };
1025
+ });
1026
+ this.reviewChange.emit(stamped);
1027
+ return stamped;
1028
+ }
1029
+ loadMicroSubmissions() {
1030
+ this.#refreshTrigger.next();
1031
+ }
1032
+ /**
1033
+ * REFACTORED: Now accepts `reviewValues` as a parameter instead of relying on `this.value`.
1034
+ */
1035
+ #enrichSubmissionsData(submissions, cols, reviewValues) {
1036
+ const numberSets = new Map();
1037
+ numberSets.set(cols.responsePreferenceCalculationKey || 'adjudicationPricePreferenceCalculation', submissions.map((s) => Number(s[cols.responsePreferenceCalculationKey || 'adjudicationPricePreferenceCalculation'] || 0)));
1038
+ // NOTE(phase-4): the legacy fallback assigns review-value rows into a submission-shaped slot —
1039
+ // the two only share `id`, so most downstream property reads degrade to undefined. Preserved
1040
+ // for behavioural parity. `ISubmission` extends `Record<string, any>`, so review-value entries
1041
+ // satisfy the structural shape (with most fields as undefined). Flagged as a pre-existing
1042
+ // latent defect — out of scope for Phase 4 type tightening.
1043
+ const list = submissions.length > 0
1044
+ ? submissions
1045
+ : (this.#value ?? []);
1046
+ return list.map((submission) => {
1047
+ const priceCalcKey = cols.responsePreferenceCalculationKey || 'adjudicationPricePreferenceCalculation';
1048
+ const numbers = numberSets.get(priceCalcKey) || [];
1049
+ const color = numbers.length === 0 ? submission.adjudicationPricePreferenceCalculationColor : this.#getColorString(submission[priceCalcKey], numbers);
1050
+ const backgroundShades = numbers.length === 0 ? submission['backgroundShades'] : { [priceCalcKey]: this.#getScoreShade(color ?? '') };
1051
+ // Use the passed `reviewValues` argument. Notes stay `unknown` here —
1052
+ // they are forwarded as stored (legacy EditorJS payloads included); the
1053
+ // notes dialog migrates to Quill format on open via `toQuillNotes`.
1054
+ const submissionReview = reviewValues?.find((v) => v.id === submission.id) ?? {};
1055
+ return {
1056
+ ...submission,
1057
+ submissionIsReviewed: !!submissionReview,
1058
+ adj_microFlow_review_notes: submissionReview?.adj_microFlow_review_notes || '',
1059
+ submissionHasReviewNotes: !!submissionReview?.adj_microFlow_review_notes,
1060
+ adj_microFlow_review: submissionReview?.['adj_microFlow_review'],
1061
+ adjudicationPricePreferenceCalculationColor: color,
1062
+ adjudicationPricePreferenceCalculation: submission[cols.responsePreferenceCalculationKey || 'adjudicationPricePreferenceCalculation'],
1063
+ backgroundShades
1064
+ };
1065
+ });
1066
+ }
1067
+ #getColorString(target, numbers) {
1068
+ return getColorForNumber(target, numbers, true);
1069
+ }
1070
+ #getScoreShade(rgbColor) {
1071
+ if (!rgbColor)
1072
+ return '';
1073
+ return rgbColor.replace('rgb', 'rgba').replace(')', `, 0.1)`);
1074
+ }
1075
+ viewMicroSubmission(res) {
1076
+ const alreadyInValue = this.#value?.find((v) => v.id === res.id);
1077
+ if (!alreadyInValue) {
1078
+ const newReview = this.#buildReviewRecord(res, undefined);
1079
+ this.#emitReview([...(this.#value || []), newReview]);
1080
+ }
1081
+ this.#config.formBuilder['previewWorkflowDocument'](res.id);
1082
+ }
1083
+ /**
1084
+ * Builds a review record from a submission row. Status, createdAt and updatedAt are
1085
+ * all optional on the shared `WorkflowAdjudicationMicroFlowReviewValue` type, so
1086
+ * `undefined` flows through naturally without any casts.
1087
+ */
1088
+ #buildReviewRecord(res, status) {
1089
+ const cm = this.columnMapping;
1090
+ const createdAt = res[cm?.responseDateKey || 'createdAt'] || undefined;
1091
+ const updatedAt = res[cm?.responseDateKey || 'updatedAt'] || undefined;
1092
+ return {
1093
+ id: res.id,
1094
+ adj_microFlow_review: status,
1095
+ nameOfBidder: res[cm?.respondentNameKey || ''] || '',
1096
+ supplierNumber: res[cm?.respondentCodeKey || ''] || '',
1097
+ createdAt,
1098
+ updatedAt,
1099
+ adjudicationPricePreferenceCalculation: res[cm?.responsePreferenceCalculationKey || 'adjudicationPricePreferenceCalculation'] || 0,
1100
+ reference: res['reference'] || '',
1101
+ };
1102
+ }
1103
+ setResponseStatus(res, status) {
1104
+ const alreadyInValue = this.#value?.find((v) => v.id === res.id);
1105
+ const statusValue = status.value;
1106
+ if (!alreadyInValue) {
1107
+ const newReview = this.#buildReviewRecord(res, statusValue);
1108
+ this.reachedMax(this.#emitReview([...(this.#value || []), newReview]));
1109
+ return;
1110
+ }
1111
+ const newValue = (this.#value || []).map((v) => {
1112
+ if (v.id === res.id) {
1113
+ return { ...v, adj_microFlow_review: statusValue };
1114
+ }
1115
+ return v;
1116
+ });
1117
+ this.reachedMax(this.#emitReview(newValue));
1118
+ }
1119
+ reachedMax(newValue) {
1120
+ const hasMax = this.inputConfig()?.maxLength;
1121
+ if (!hasMax || isNaN(Number(hasMax))) {
1122
+ return; // No limit set, do nothin
1123
+ }
1124
+ const allCompetentSubmissions = newValue?.filter((v) => v.adj_microFlow_review === 'compliant').length || 0;
1125
+ if (!(allCompetentSubmissions >= (Number(hasMax) || 1))) {
1126
+ return;
1127
+ }
1128
+ const missingSubmission = this.submissions
1129
+ .filter((s) => !newValue?.find((v) => v.id === s.id))
1130
+ .map((s) => this.#buildReviewRecord(s, 'non-compliant'));
1131
+ const unique = new Set([...(newValue || []), ...missingSubmission]);
1132
+ this.#emitReview(Array.from(unique));
1133
+ }
1134
+ // FIX: A Map to hold notes being edited, keyed by row ID. This prevents shared state.
1135
+ /**
1136
+ * REFACTORED: Saves the notes from the `notesBeingEdited` map.
1137
+ */
1138
+ notesBlur(notesToSave) {
1139
+ if (!this.notesOpenForRowId || !notesToSave) {
1140
+ this.notesOpenForRowId = null;
1141
+ return;
1142
+ }
1143
+ const alreadyInValue = this.#value?.find((v) => v.id === this.notesOpenForRowId);
1144
+ if (!alreadyInValue) {
1145
+ const newReview = {
1146
+ id: this.notesOpenForRowId,
1147
+ adj_microFlow_review_notes: notesToSave,
1148
+ adj_microFlow_review: undefined,
1149
+ nameOfBidder: '',
1150
+ supplierNumber: '',
1151
+ createdAt: undefined,
1152
+ updatedAt: undefined,
1153
+ adjudicationPricePreferenceCalculation: 0,
1154
+ reference: '',
1155
+ };
1156
+ this.#emitReview([...(this.#value || []), newReview]);
1157
+ }
1158
+ else {
1159
+ const newValue = (this.#value ?? []).map((v) => {
1160
+ if (v.id === this.notesOpenForRowId) {
1161
+ return { ...v, adj_microFlow_review_notes: notesToSave };
1162
+ }
1163
+ return v;
1164
+ });
1165
+ this.#emitReview(newValue);
1166
+ }
1167
+ // Clean up and close the overlay
1168
+ }
1169
+ bulkStatusChanged(event) {
1170
+ const newStatus = event.value;
1171
+ if (newStatus === 'reset') {
1172
+ this.#emitReview([]);
1173
+ return;
1174
+ }
1175
+ // Create a Map of existing values for efficient O(1) lookup
1176
+ const existingValueMap = new Map((this.#value ?? []).map(v => [v.id, v]));
1177
+ // Destructure column keys with fallbacks for cleaner access
1178
+ const { respondentNameKey = '', respondentCodeKey = '', responseDateKey = 'createdAt', responsePreferenceCalculationKey = 'adjudicationPricePreferenceCalculation', } = this.columnMapping || {};
1179
+ let allItems = this.submissions.map(s => {
1180
+ // Efficiently look up the existing value using the Map
1181
+ const existingValue = existingValueMap.get(s.id);
1182
+ // If it exists, spread its properties to preserve them and update the status
1183
+ if (existingValue) {
1184
+ return { ...existingValue, adj_microFlow_review: newStatus };
1185
+ }
1186
+ // Otherwise, create a new object from the submission data
1187
+ return {
1188
+ id: s.id,
1189
+ adj_microFlow_review: newStatus,
1190
+ nameOfBidder: s[respondentNameKey] || '',
1191
+ supplierNumber: s[respondentCodeKey] || '',
1192
+ createdAt: s[responseDateKey] || undefined,
1193
+ updatedAt: s[this.columnMapping?.responseDateKey || 'updatedAt'] || undefined,
1194
+ adjudicationPricePreferenceCalculation: s[responsePreferenceCalculationKey] || 0,
1195
+ reference: s['reference'] || '',
1196
+ };
1197
+ });
1198
+ // Apply the compliance limit if necessary
1199
+ const limit = this.maxLimit();
1200
+ if (limit !== undefined && newStatus === 'compliant') {
1201
+ // Sort by preference calculation, highest first
1202
+ allItems.sort((a, b) => (b.adjudicationPricePreferenceCalculation ?? 0) - (a.adjudicationPricePreferenceCalculation ?? 0));
1203
+ // Mark items beyond the limit as 'non-compliant'
1204
+ allItems = allItems.map((item, index) => {
1205
+ if (index >= limit) {
1206
+ return { ...item, adj_microFlow_review: 'non-compliant' };
1207
+ }
1208
+ return item;
1209
+ });
1210
+ }
1211
+ this.#emitReview(allItems);
1212
+ }
1213
+ openNotes(row) {
1214
+ this.notesOpenForRowId = row.id;
1215
+ const stringfiedTemplate = JSON.stringify(this.inputConfig()?.adjudicationReviewFeedbackTemplate);
1216
+ const template = stringfiedTemplate?.replace(/\$bidderName/g, row[this.columnMapping?.respondentNameKey || ''])
1217
+ ?.replace(/\$bidderCode/g, row[this.columnMapping?.respondentCodeKey || ''])
1218
+ ?.replace(/\$responseDate/g, row[this.columnMapping?.responseDateKey || ''])
1219
+ ?.replace(/\$responsePreferenceCalculation/g, row[this.columnMapping?.responsePreferenceCalculationKey || ''] || '0');
1220
+ this.dialog.open(SubmissionReviewDialogComponent, {
1221
+ height: 'fit-content',
1222
+ data: {
1223
+ row,
1224
+ respondentNameKey: this.columnMapping?.respondentNameKey || '',
1225
+ respondentCodeKey: this.columnMapping?.respondentCodeKey || '',
1226
+ readonly: this.inputConfig()?.readonly || false,
1227
+ // EditorJS-shaped in legacy step configs — the dialog migrates it.
1228
+ activeRowNotes: JSON.parse(template || '{}')
1229
+ },
1230
+ autoFocus: false,
1231
+ disableClose: true
1232
+ }).afterClosed().pipe(take(1), tap((result) => {
1233
+ this.notesBlur(result);
1234
+ }), takeUntilDestroyed(this.#destroyRef)).subscribe();
1235
+ }
1236
+ canChangeStatus(row) {
1237
+ if (row['adj_microFlow_review'] === 'compliant')
1238
+ return true;
1239
+ const maxLength = this.inputConfig()?.maxLength;
1240
+ // check if max exists and is a number
1241
+ if (!maxLength || isNaN(Number(maxLength))) {
1242
+ return true; // No limit set, allow status change
1243
+ }
1244
+ const allCompetentSubmissions = this.#value?.filter((v) => v.adj_microFlow_review === 'compliant').length || 0;
1245
+ return allCompetentSubmissions < (Number(maxLength) || 1);
1246
+ }
1247
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SubmissionReviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1248
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: SubmissionReviewComponent, isStandalone: true, selector: "lib-submission-review", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reviewChange: "reviewChange" }, ngImport: i0, template: "@if (vm$ | async; as vm) {\r\n\r\n @if (vm.loading) {\r\n <div style=\"display: flex; justify-content: center; align-items: center; padding:24px;width: 100%;\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n } @else if (vm.error) {\r\n <div class=\"info-card error-card\">\r\n <!-- Heading stays cause-neutral: vm.error states WHICH half failed\r\n (the fetch vs. displaying data that did arrive). -->\r\n <h5 class=\"info-title\">\u274C Unable to show submissions</h5>\r\n <p>{{ vm.error }}</p>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\">\r\n Try Again\r\n </button>\r\n </div>\r\n } @else {\r\n <lib-adjudication-shell label=\"Submission review\" [system]=\"vm.priceSystem\"\r\n [docsContext]=\"vm.docsContext\" [chart]=\"vm.priceChart\">\r\n @if (!vm.displayCols.length) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u2699\uFE0F This step needs to be configured to show data.</h5>\r\n <ol>\r\n <li>\r\n <strong>Why you're seeing this:</strong>\r\n <ul>\r\n <li>This component is designed for a <strong>\"Submission Review\"</strong> workflow step.</li>\r\n <li>It's currently missing the required column setup.</li>\r\n </ul>\r\n </li>\r\n <li>\r\n <strong>What to do (for Administrators):</strong>\r\n To fix this, go to the <strong>Workflow Builder</strong> and for this specific step, <strong>map the display\r\n columns</strong> to the desired submission data (e.g., form fields or document keys).\r\n </li>\r\n </ol>\r\n </div>\r\n } @else if (!vm.submissions.length) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u2139\uFE0F There are no submissions to display.</h5>\r\n <ul>\r\n <li>This can happen if <strong>no one has responded</strong> yet, or if the <strong>submission closing date has\r\n passed</strong>.</li>\r\n <li>If you are expecting to see submissions, try clicking the <strong>Refresh</strong> button.</li>\r\n </ul>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\" class=\"load-button\">\r\n Refresh\r\n </button>\r\n </div>\r\n } @else {\r\n @if (!value() || (value()?.length ?? 0) === 0) {\r\n <!-- value() typed `any` per parent's mixed union; length check survives null -->\r\n\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\uD83D\uDCDD How to Review Submissions</h5>\r\n <ol>\r\n <li>\r\n <strong>View Response:</strong> Click the <strong>Preview</strong> (<mat-icon\r\n class=\"smallIcon\">preview</mat-icon>) icon to see the full submission.\r\n </li>\r\n <li>\r\n <strong>Set Status:</strong> Use the dropdown to select <strong>Compliant</strong> or\r\n <strong>Non-compliant</strong>.\r\n </li>\r\n <li>\r\n <strong>Add Note (If Non-compliant):</strong>\r\n <ul>\r\n <li>If you select <strong>Non-compliant</strong>, you <strong>must</strong> add a note.</li>\r\n <li>Click the <strong>Add Note</strong> (<mat-icon class=\"smallIcon\">add_comment</mat-icon>) icon, write your\r\n feedback, and hit <strong>Save Feedback</strong>. Your note will be visible to the applicant.</li>\r\n </ul>\r\n </li>\r\n </ol>\r\n </div>\r\n }\r\n <table mat-table [dataSource]=\"vm.submissions\">\r\n @for (col of vm.displayColumns; track col.formControlName) {\r\n <ng-container [matColumnDef]=\"col.formControlName\">\r\n <th mat-header-cell *matHeaderCellDef style=\"padding:4px\">\r\n\r\n @if (col.formControlName === 'status' && !inputConfig()?.readonly) {\r\n <mat-form-field floatLabel=\"always\" subscriptSizing=\"dynamic\" style=\"width: 100%;\r\n margin-bottom: 8px;\r\n margin-top: 8px;\r\n border-radius:16px;\" appearance=\"outline\">\r\n <mat-label>\r\n Bulk Status Selection\r\n </mat-label>\r\n <mat-select\r\n [style.color]=\"bulkStatus() === 'non-compliant' ? 'var(--mat-sys-error)' : bulkStatus()==='compliant'? 'var(--mat-sys-primary)' : ''\"\r\n (selectionChange)=\"bulkStatusChanged($event)\" ngDefaultControl [value]=\"bulkStatus()\"\r\n placeholder=\" Select Status\">\r\n @for (type of bulkOperations || []; track type) {\r\n <mat-option [value]=\"type.value\">{{type.label}}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n } @else {\r\n {{ col.label }}\r\n }\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\" mat-ripple class=\"table-cell\" [class.selected-row]=\"selected === row.id\"\r\n (click)=\"$event.stopPropagation()\" [class.price-preference-cell]=\"true\"\r\n [style.border-bottom-color]=\"row.adjudicationPricePreferenceCalculationColor\"\r\n [style.background]=\"row.backgroundShades?.[col.formControlName]\">\r\n\r\n @if (col.formControlName === 'actions') {\r\n <span style=\"display: flex; align-items: center;\">\r\n <button matTooltipPosition=\"before\"\r\n [matTooltip]=\"`View and review **` + row[vm.columnMapping.respondentNameKey]+ `** 's' Submission`\"\r\n (click)=\"viewMicroSubmission(row)\" mat-icon-button>\r\n <mat-icon>preview</mat-icon>\r\n </button>\r\n @if (!(inputConfig()?.readonly) || (inputConfig()?.readonly) && !!row['submissionHasReviewNotes']) {\r\n <button (click)=\"openNotes(row)\" cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\" matTooltipPosition=\"after\"\r\n [matTooltip]=\"\r\n `Add a review note for **` + row[vm.columnMapping.respondentNameKey] + `**`\" mat-icon-button>\r\n <mat-icon [style.color]=\"\r\n notesOpenForRowId === row.id ? 'var(--mat-sys-primary)' : (row['adj_microFlow_review']==='non-compliant' && !row['adj_microFlow_review_notes']?'var(--mat-sys-error)':'')\r\n \">\r\n {{ !row['submissionHasReviewNotes']? 'add_comment' : 'comment' }}\r\n </mat-icon>\r\n </button>\r\n }\r\n </span>\r\n } @else if (col.formControlName === 'status') {\r\n <mat-form-field floatLabel=\"always\" subscriptSizing=\"dynamic\" style=\"width: 100%;\r\n margin-bottom: 8px;\r\n margin-top: 8px;\r\n border-radius:16px;\" appearance=\"outline\">\r\n <mat-select [disabled]=\"!canChangeStatus(row) || inputConfig()?.readonly === true\"\r\n [style.color]=\"row['adj_microFlow_review'] === 'non-compliant' ? 'var(--mat-sys-error)' : row['adj_microFlow_review']==='compliant'? 'var(--mat-sys-primary)' : ''\"\r\n (selectionChange)=\"setResponseStatus(row,$event)\" ngDefaultControl [value]=\"row.adj_microFlow_review\"\r\n placeholder=\" Select Status\">\r\n @for (type of reviewStatuses || []; track type) {\r\n <mat-option [value]=\"type.value\">{{type.label}}</mat-option>\r\n }\r\n </mat-select>\r\n @if (row['adj_microFlow_review']==='non-compliant' && !row['adj_microFlow_review_notes']) {\r\n <mat-hint style=\"color:var(--mat-sys-error)\">\r\n Rejection reason is required. Add a review note.\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n @switch (col?.type) {\r\n @case ('daysAgo') {\r\n {{ row[col.formControlName] | daysAgo }}\r\n }\r\n @case ('number') {\r\n <div class=\"number-cell\">\r\n <span>\r\n {{ (row[col.formControlName] | number:'0.0-2' ) || 'N/A' }}\r\n </span>\r\n @if (row['adj_priceScore_abnormallyLow']) {\r\n <!-- Abnormally low tender: flagged for investigation,\r\n never auto-excluded (amber = act, no blame). -->\r\n <mat-icon class=\"alt-flag\"\r\n matTooltip=\"Abnormally low tender: this bid is priced well below the responsive pool. Investigate sustainability before scoring \u2014 if found non-responsive, mark it non-compliant and every score recalculates against the next lowest compliant bid.\">\r\n warning_amber\r\n </mat-icon>\r\n }\r\n @if (col.showColor) {\r\n <mat-icon [style.color]=\"row.adjudicationPricePreferenceCalculationColor\">\r\n fiber_manual_record\r\n </mat-icon>\r\n }\r\n </div>\r\n }\r\n @default {\r\n @if ($index === 0) {\r\n <span class=\"main-submission-text\">\r\n <mat-icon style=\"font-size: 1em;height:16px;width:16px\">domain</mat-icon>\r\n <strong>\r\n {{ row[col.formControlName] }}\r\n </strong>\r\n </span>\r\n <span class=\"secondary-text\">\r\n <mat-icon>fingerprint</mat-icon>\r\n {{row[vm.columnMapping.respondentCodeKey]}}\r\n <mat-icon>more_time</mat-icon>\r\n {{ row[vm.columnMapping.responseDateKey ||''] | daysAgo}}\r\n </span>\r\n } @else {\r\n {{ row[col.formControlName] }}\r\n }\r\n }\r\n }\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n <tr mat-header-row *matHeaderRowDef=\"vm.displayCols\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: vm.displayCols\"></tr>\r\n </table>\r\n }\r\n </lib-adjudication-shell>\r\n }\r\n\r\n}\r\n", styles: [".number{display:flex;justify-content:space-between;align-items:center}li{font-size:.75em}ol,ul{margin-top:8px}.number-cell{display:flex;justify-content:space-between;align-items:center;width:100%}.number-cell span{font-variant-numeric:tabular-nums}.alt-flag{color:var(--lib-forms-warning);font-size:1.125em;width:18px;height:18px}.secondary-text{display:flex;align-items:center;white-space:pre;font-size:.75em;gap:8px;opacity:.8}.secondary-text mat-icon{font-size:.875em;width:14px;height:14px}.mat-column-adjudicationPricePreferenceCalculation{max-width:70px}.mat-column-actions{padding:0;max-width:80px}.mat-column-status{padding-left:8px;padding-right:8px;max-width:fit-content!important}.main-submission-text{display:flex;align-items:center;gap:8px;font-size:.875em}:host .notes-card{width:100%;max-width:480px;resize:both;height:fit-content}.smallIcon{font-size:.875em;width:14px;height:14px}.table-cell{padding:.25rem .5rem;font-size:.8125rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i2$5.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatRippleModule }, { kind: "directive", type: i7.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i8.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5$2.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5$2.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5$2.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5$2.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5$2.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5$2.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5$2.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5$2.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5$2.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5$2.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: AdjudicationShellComponent, selector: "lib-adjudication-shell", inputs: ["label", "system", "docsContext", "chart"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: DecimalPipe, name: "number" }, { kind: "pipe", type: DaysAgoPipe, name: "daysAgo" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1249
+ }
1250
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SubmissionReviewComponent, decorators: [{
1251
+ type: Component,
1252
+ args: [{ selector: 'lib-submission-review', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [
1253
+ AsyncPipe,
1254
+ DecimalPipe,
1255
+ FormsModule,
1256
+ OverlayModule,
1257
+ MatButtonModule,
1258
+ MatFormFieldModule,
1259
+ MatIconModule,
1260
+ MatInputModule,
1261
+ MatProgressSpinnerModule,
1262
+ MatRippleModule,
1263
+ MatSelectModule,
1264
+ MatTableModule,
1265
+ MatTooltipModule,
1266
+ DaysAgoPipe,
1267
+ AdjudicationShellComponent,
1268
+ ], template: "@if (vm$ | async; as vm) {\r\n\r\n @if (vm.loading) {\r\n <div style=\"display: flex; justify-content: center; align-items: center; padding:24px;width: 100%;\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n } @else if (vm.error) {\r\n <div class=\"info-card error-card\">\r\n <!-- Heading stays cause-neutral: vm.error states WHICH half failed\r\n (the fetch vs. displaying data that did arrive). -->\r\n <h5 class=\"info-title\">\u274C Unable to show submissions</h5>\r\n <p>{{ vm.error }}</p>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\">\r\n Try Again\r\n </button>\r\n </div>\r\n } @else {\r\n <lib-adjudication-shell label=\"Submission review\" [system]=\"vm.priceSystem\"\r\n [docsContext]=\"vm.docsContext\" [chart]=\"vm.priceChart\">\r\n @if (!vm.displayCols.length) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u2699\uFE0F This step needs to be configured to show data.</h5>\r\n <ol>\r\n <li>\r\n <strong>Why you're seeing this:</strong>\r\n <ul>\r\n <li>This component is designed for a <strong>\"Submission Review\"</strong> workflow step.</li>\r\n <li>It's currently missing the required column setup.</li>\r\n </ul>\r\n </li>\r\n <li>\r\n <strong>What to do (for Administrators):</strong>\r\n To fix this, go to the <strong>Workflow Builder</strong> and for this specific step, <strong>map the display\r\n columns</strong> to the desired submission data (e.g., form fields or document keys).\r\n </li>\r\n </ol>\r\n </div>\r\n } @else if (!vm.submissions.length) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u2139\uFE0F There are no submissions to display.</h5>\r\n <ul>\r\n <li>This can happen if <strong>no one has responded</strong> yet, or if the <strong>submission closing date has\r\n passed</strong>.</li>\r\n <li>If you are expecting to see submissions, try clicking the <strong>Refresh</strong> button.</li>\r\n </ul>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\" class=\"load-button\">\r\n Refresh\r\n </button>\r\n </div>\r\n } @else {\r\n @if (!value() || (value()?.length ?? 0) === 0) {\r\n <!-- value() typed `any` per parent's mixed union; length check survives null -->\r\n\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\uD83D\uDCDD How to Review Submissions</h5>\r\n <ol>\r\n <li>\r\n <strong>View Response:</strong> Click the <strong>Preview</strong> (<mat-icon\r\n class=\"smallIcon\">preview</mat-icon>) icon to see the full submission.\r\n </li>\r\n <li>\r\n <strong>Set Status:</strong> Use the dropdown to select <strong>Compliant</strong> or\r\n <strong>Non-compliant</strong>.\r\n </li>\r\n <li>\r\n <strong>Add Note (If Non-compliant):</strong>\r\n <ul>\r\n <li>If you select <strong>Non-compliant</strong>, you <strong>must</strong> add a note.</li>\r\n <li>Click the <strong>Add Note</strong> (<mat-icon class=\"smallIcon\">add_comment</mat-icon>) icon, write your\r\n feedback, and hit <strong>Save Feedback</strong>. Your note will be visible to the applicant.</li>\r\n </ul>\r\n </li>\r\n </ol>\r\n </div>\r\n }\r\n <table mat-table [dataSource]=\"vm.submissions\">\r\n @for (col of vm.displayColumns; track col.formControlName) {\r\n <ng-container [matColumnDef]=\"col.formControlName\">\r\n <th mat-header-cell *matHeaderCellDef style=\"padding:4px\">\r\n\r\n @if (col.formControlName === 'status' && !inputConfig()?.readonly) {\r\n <mat-form-field floatLabel=\"always\" subscriptSizing=\"dynamic\" style=\"width: 100%;\r\n margin-bottom: 8px;\r\n margin-top: 8px;\r\n border-radius:16px;\" appearance=\"outline\">\r\n <mat-label>\r\n Bulk Status Selection\r\n </mat-label>\r\n <mat-select\r\n [style.color]=\"bulkStatus() === 'non-compliant' ? 'var(--mat-sys-error)' : bulkStatus()==='compliant'? 'var(--mat-sys-primary)' : ''\"\r\n (selectionChange)=\"bulkStatusChanged($event)\" ngDefaultControl [value]=\"bulkStatus()\"\r\n placeholder=\" Select Status\">\r\n @for (type of bulkOperations || []; track type) {\r\n <mat-option [value]=\"type.value\">{{type.label}}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n } @else {\r\n {{ col.label }}\r\n }\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\" mat-ripple class=\"table-cell\" [class.selected-row]=\"selected === row.id\"\r\n (click)=\"$event.stopPropagation()\" [class.price-preference-cell]=\"true\"\r\n [style.border-bottom-color]=\"row.adjudicationPricePreferenceCalculationColor\"\r\n [style.background]=\"row.backgroundShades?.[col.formControlName]\">\r\n\r\n @if (col.formControlName === 'actions') {\r\n <span style=\"display: flex; align-items: center;\">\r\n <button matTooltipPosition=\"before\"\r\n [matTooltip]=\"`View and review **` + row[vm.columnMapping.respondentNameKey]+ `** 's' Submission`\"\r\n (click)=\"viewMicroSubmission(row)\" mat-icon-button>\r\n <mat-icon>preview</mat-icon>\r\n </button>\r\n @if (!(inputConfig()?.readonly) || (inputConfig()?.readonly) && !!row['submissionHasReviewNotes']) {\r\n <button (click)=\"openNotes(row)\" cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\" matTooltipPosition=\"after\"\r\n [matTooltip]=\"\r\n `Add a review note for **` + row[vm.columnMapping.respondentNameKey] + `**`\" mat-icon-button>\r\n <mat-icon [style.color]=\"\r\n notesOpenForRowId === row.id ? 'var(--mat-sys-primary)' : (row['adj_microFlow_review']==='non-compliant' && !row['adj_microFlow_review_notes']?'var(--mat-sys-error)':'')\r\n \">\r\n {{ !row['submissionHasReviewNotes']? 'add_comment' : 'comment' }}\r\n </mat-icon>\r\n </button>\r\n }\r\n </span>\r\n } @else if (col.formControlName === 'status') {\r\n <mat-form-field floatLabel=\"always\" subscriptSizing=\"dynamic\" style=\"width: 100%;\r\n margin-bottom: 8px;\r\n margin-top: 8px;\r\n border-radius:16px;\" appearance=\"outline\">\r\n <mat-select [disabled]=\"!canChangeStatus(row) || inputConfig()?.readonly === true\"\r\n [style.color]=\"row['adj_microFlow_review'] === 'non-compliant' ? 'var(--mat-sys-error)' : row['adj_microFlow_review']==='compliant'? 'var(--mat-sys-primary)' : ''\"\r\n (selectionChange)=\"setResponseStatus(row,$event)\" ngDefaultControl [value]=\"row.adj_microFlow_review\"\r\n placeholder=\" Select Status\">\r\n @for (type of reviewStatuses || []; track type) {\r\n <mat-option [value]=\"type.value\">{{type.label}}</mat-option>\r\n }\r\n </mat-select>\r\n @if (row['adj_microFlow_review']==='non-compliant' && !row['adj_microFlow_review_notes']) {\r\n <mat-hint style=\"color:var(--mat-sys-error)\">\r\n Rejection reason is required. Add a review note.\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n @switch (col?.type) {\r\n @case ('daysAgo') {\r\n {{ row[col.formControlName] | daysAgo }}\r\n }\r\n @case ('number') {\r\n <div class=\"number-cell\">\r\n <span>\r\n {{ (row[col.formControlName] | number:'0.0-2' ) || 'N/A' }}\r\n </span>\r\n @if (row['adj_priceScore_abnormallyLow']) {\r\n <!-- Abnormally low tender: flagged for investigation,\r\n never auto-excluded (amber = act, no blame). -->\r\n <mat-icon class=\"alt-flag\"\r\n matTooltip=\"Abnormally low tender: this bid is priced well below the responsive pool. Investigate sustainability before scoring \u2014 if found non-responsive, mark it non-compliant and every score recalculates against the next lowest compliant bid.\">\r\n warning_amber\r\n </mat-icon>\r\n }\r\n @if (col.showColor) {\r\n <mat-icon [style.color]=\"row.adjudicationPricePreferenceCalculationColor\">\r\n fiber_manual_record\r\n </mat-icon>\r\n }\r\n </div>\r\n }\r\n @default {\r\n @if ($index === 0) {\r\n <span class=\"main-submission-text\">\r\n <mat-icon style=\"font-size: 1em;height:16px;width:16px\">domain</mat-icon>\r\n <strong>\r\n {{ row[col.formControlName] }}\r\n </strong>\r\n </span>\r\n <span class=\"secondary-text\">\r\n <mat-icon>fingerprint</mat-icon>\r\n {{row[vm.columnMapping.respondentCodeKey]}}\r\n <mat-icon>more_time</mat-icon>\r\n {{ row[vm.columnMapping.responseDateKey ||''] | daysAgo}}\r\n </span>\r\n } @else {\r\n {{ row[col.formControlName] }}\r\n }\r\n }\r\n }\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n <tr mat-header-row *matHeaderRowDef=\"vm.displayCols\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: vm.displayCols\"></tr>\r\n </table>\r\n }\r\n </lib-adjudication-shell>\r\n }\r\n\r\n}\r\n", styles: [".number{display:flex;justify-content:space-between;align-items:center}li{font-size:.75em}ol,ul{margin-top:8px}.number-cell{display:flex;justify-content:space-between;align-items:center;width:100%}.number-cell span{font-variant-numeric:tabular-nums}.alt-flag{color:var(--lib-forms-warning);font-size:1.125em;width:18px;height:18px}.secondary-text{display:flex;align-items:center;white-space:pre;font-size:.75em;gap:8px;opacity:.8}.secondary-text mat-icon{font-size:.875em;width:14px;height:14px}.mat-column-adjudicationPricePreferenceCalculation{max-width:70px}.mat-column-actions{padding:0;max-width:80px}.mat-column-status{padding-left:8px;padding-right:8px;max-width:fit-content!important}.main-submission-text{display:flex;align-items:center;gap:8px;font-size:.875em}:host .notes-card{width:100%;max-width:480px;resize:both;height:fit-content}.smallIcon{font-size:.875em;width:14px;height:14px}.table-cell{padding:.25rem .5rem;font-size:.8125rem}\n"] }]
1269
+ }], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], reviewChange: [{ type: i0.Output, args: ["reviewChange"] }] } });
1270
+
1271
+ /** Shows validation errors as soon as the control becomes dirty + invalid. */
1272
+ class ShowErrorOnDirtyMatcher {
1273
+ isErrorState(control, _form) {
1274
+ return !!(control && control.invalid && control.dirty);
1275
+ }
1276
+ }
1277
+ class PointAssignmentDialogComponent {
1278
+ constructor() {
1279
+ this.dialogRef = inject(MatDialogRef);
1280
+ this.data = inject(MAT_DIALOG_DATA);
1281
+ this.#fb = inject(FormBuilder);
1282
+ this.maxPossiblePoints = 0;
1283
+ this.matcher = new ShowErrorOnDirtyMatcher();
1284
+ }
1285
+ #fb;
1286
+ ngOnInit() {
1287
+ this.#calculateMaxPoints();
1288
+ this.pointsForm = this.#buildForm();
1289
+ this.totalPoints$ = this.#createTotalPointsObservable();
1290
+ }
1291
+ correctMaxValue(event, groupKey, controlId, maxPoints) {
1292
+ const inputElement = event.target;
1293
+ const currentValue = parseFloat(inputElement.value);
1294
+ if (currentValue > maxPoints) {
1295
+ this.pointsForm.get([groupKey, controlId])?.patchValue(maxPoints);
1296
+ }
1297
+ }
1298
+ #buildForm() {
1299
+ const groupOfGroups = this.data.scoreSheetGroups.reduce((acc, group) => {
1300
+ const scoresInGroup = this.data.groupedScoreSheet[group.key] || [];
1301
+ const groupControls = scoresInGroup.reduce((ctrls, score) => {
1302
+ const existingScore = this.data.row.adj_microFlow_assignedScore?.[score.id] ?? null;
1303
+ ctrls[score.id] = new FormControl(existingScore, [
1304
+ Validators.required,
1305
+ Validators.min(0),
1306
+ Validators.max(score.totalPoints),
1307
+ ]);
1308
+ return ctrls;
1309
+ }, {});
1310
+ acc[group.key] = this.#fb.group(groupControls);
1311
+ return acc;
1312
+ }, {});
1313
+ return this.#fb.group(groupOfGroups);
1314
+ }
1315
+ #calculateMaxPoints() {
1316
+ this.maxPossiblePoints = Object.values(this.data.groupedScoreSheet)
1317
+ .flat()
1318
+ .reduce((acc, score) => acc + score.totalPoints, 0);
1319
+ }
1320
+ #createTotalPointsObservable() {
1321
+ return this.pointsForm.valueChanges.pipe(startWith(this.pointsForm.value), map(formValue => {
1322
+ let total = 0;
1323
+ Object.values(formValue || {}).forEach((group) => {
1324
+ if (group && typeof group === 'object') {
1325
+ Object.values(group).forEach(score => {
1326
+ total += Number(score) || 0;
1327
+ });
1328
+ }
1329
+ });
1330
+ return total;
1331
+ }));
1332
+ }
1333
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: PointAssignmentDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1334
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: PointAssignmentDialogComponent, isStandalone: true, selector: "lib-point-assignment-dialog", ngImport: i0, template: "<span mat-dialog-title>\r\n Assign Points for <span class=\"bidder-name\">{{ data.row['nameOfBidder'] }}</span>\r\n</span>\r\n @if( !data.readonly){\r\n<div class=\"dialog-instructions\">\r\n @if(!pointsForm.dirty && !pointsForm.touched){\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\uD83D\uDCAF How to Assign Points\r\n\r\n </h5>\r\n <ol>\r\n <li>\r\n <strong>Enter a score</strong> for each item listed below.\r\n </li>\r\n <li>\r\n <strong>Follow the rules:</strong>\r\n <ul>\r\n <li>Your score cannot be higher than the maximum points shown (e.g., / 10).</li>\r\n <li>The <strong>\"Save Points\"</strong> button at the bottom will turn blue when everything is filled\r\n out correctly.</li>\r\n </ul>\r\n </li>\r\n <li>\r\n <strong>Click the blue \"Save Points\" button</strong> to finish.\r\n </li>\r\n </ol>\r\n </div>\r\n }\r\n @else {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u270D\uFE0F Editing Your Scores</h5>\r\n <ol>\r\n <li>\r\n <strong>You are viewing saved scores.</strong> To make a change, simply click on a score and type in a\r\n new number.\r\n </li>\r\n <li>\r\n The <strong>Total Points</strong> bar at the top will update as you make edits.\r\n </li>\r\n <li>\r\n Click <strong>\"Save Points\"</strong> to confirm your changes when you're done.\r\n </li>\r\n </ol>\r\n </div>\r\n }\r\n</div>\r\n\r\n }\r\n\r\n\r\n<mat-dialog-content style=\"padding-bottom: 8px;padding-bottom: 8px\" [formGroup]=\"pointsForm\">\r\n <div class=\"summary-bar\">\r\n <h3>Total Points: {{ totalPoints$ | async }} / {{ maxPossiblePoints }}</h3>\r\n <mat-progress-bar mode=\"determinate\"\r\n [value]=\"((totalPoints$ | async) || 0) / maxPossiblePoints * 100\"></mat-progress-bar>\r\n </div>\r\n\r\n <mat-accordion multi>\r\n @for (group of data.scoreSheetGroups; track group.key) {\r\n <mat-expansion-panel [expanded]=\"true\" [formGroupName]=\"group.key\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>{{ group.name }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n\r\n @for (score of data.groupedScoreSheet[group.key] || []; track score.id) {\r\n <div class=\"score-item\">\r\n <label [for]=\"score.id\" class=\"score-description\">{{ score.description }}</label>\r\n\r\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"score-input\">\r\n <mat-label>Score</mat-label>\r\n <input [disabled]=\"data.readonly\" matInput type=\"number\" placeholder=\"0\" [id]=\"score.id\"\r\n [formControlName]=\"score.id\" [max]=\"score.totalPoints\" min=\"0\" [errorStateMatcher]=\"matcher\"\r\n (input)=\"correctMaxValue($event, group.key, score.id, score.totalPoints)\" />\r\n <span matSuffix>\r\n <span style=\"min-width: 58px; display:flex\">\r\n / {{ score.totalPoints }}\r\n </span>\r\n </span>\r\n\r\n @if (pointsForm.get(group.key)?.get(score.id)?.hasError('required')) {\r\n <mat-error>A score is required.</mat-error>\r\n }\r\n @if (pointsForm.get(group.key)?.get(score.id)?.hasError('max')) {\r\n <mat-error>Score cannot exceed {{ score.totalPoints }}.</mat-error>\r\n }\r\n @if (pointsForm.get(group.key)?.get(score.id)?.hasError('min')) {\r\n <mat-error>Score cannot be negative.</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n <mat-divider></mat-divider>\r\n }\r\n </mat-expansion-panel>\r\n }\r\n </mat-accordion>\r\n\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions align=\"end\">\r\n <button mat-button mat-dialog-close>Cancel</button>\r\n @if( !data.readonly){\r\n <button mat-flat-button color=\"primary\" \r\n [mat-dialog-close]=\"pointsForm.getRawValue()\"\r\n [disabled]=\"pointsForm.invalid\">\r\n Save Points\r\n </button>\r\n }\r\n\r\n</mat-dialog-actions>", styles: [":host{display:block;min-width:500px;max-width:700px}.bidder-name{font-weight:500}.summary-bar{margin-bottom:24px}.summary-bar h3{margin-bottom:8px;font-weight:500}.score-item{display:flex;align-items:center;justify-content:space-between;padding:8px 4px;gap:16px}.score-description{flex:1;margin-right:16px;line-height:1.4}.score-input{flex-shrink:0;width:150px}.mat-expansion-panel-body .score-item:last-child+mat-divider{display:none}mat-dialog-actions{padding:16px 24px}.mat-mdc-form-field-error{font-size:.8125em}.dialog-instructions{margin-top:-8px;margin-bottom:24px;max-width:95%;padding-left:24px;padding-right:24px}li{font-size:.75em}ol,ul{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i1$2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "directive", type: i5$3.MatAccordion, selector: "mat-accordion", inputs: ["hideToggle", "displayMode", "togglePosition"], exportAs: ["matAccordion"] }, { kind: "component", type: i5$3.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i5$3.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i5$3.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i6.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1335
+ }
1336
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: PointAssignmentDialogComponent, decorators: [{
1337
+ type: Component,
1338
+ args: [{ selector: 'lib-point-assignment-dialog', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [
1339
+ AsyncPipe,
1340
+ ReactiveFormsModule,
1341
+ MatDialogModule,
1342
+ MatFormFieldModule,
1343
+ MatInputModule,
1344
+ MatButtonModule,
1345
+ MatProgressBarModule,
1346
+ MatExpansionModule,
1347
+ MatDividerModule,
1348
+ ], template: "<span mat-dialog-title>\r\n Assign Points for <span class=\"bidder-name\">{{ data.row['nameOfBidder'] }}</span>\r\n</span>\r\n @if( !data.readonly){\r\n<div class=\"dialog-instructions\">\r\n @if(!pointsForm.dirty && !pointsForm.touched){\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\uD83D\uDCAF How to Assign Points\r\n\r\n </h5>\r\n <ol>\r\n <li>\r\n <strong>Enter a score</strong> for each item listed below.\r\n </li>\r\n <li>\r\n <strong>Follow the rules:</strong>\r\n <ul>\r\n <li>Your score cannot be higher than the maximum points shown (e.g., / 10).</li>\r\n <li>The <strong>\"Save Points\"</strong> button at the bottom will turn blue when everything is filled\r\n out correctly.</li>\r\n </ul>\r\n </li>\r\n <li>\r\n <strong>Click the blue \"Save Points\" button</strong> to finish.\r\n </li>\r\n </ol>\r\n </div>\r\n }\r\n @else {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u270D\uFE0F Editing Your Scores</h5>\r\n <ol>\r\n <li>\r\n <strong>You are viewing saved scores.</strong> To make a change, simply click on a score and type in a\r\n new number.\r\n </li>\r\n <li>\r\n The <strong>Total Points</strong> bar at the top will update as you make edits.\r\n </li>\r\n <li>\r\n Click <strong>\"Save Points\"</strong> to confirm your changes when you're done.\r\n </li>\r\n </ol>\r\n </div>\r\n }\r\n</div>\r\n\r\n }\r\n\r\n\r\n<mat-dialog-content style=\"padding-bottom: 8px;padding-bottom: 8px\" [formGroup]=\"pointsForm\">\r\n <div class=\"summary-bar\">\r\n <h3>Total Points: {{ totalPoints$ | async }} / {{ maxPossiblePoints }}</h3>\r\n <mat-progress-bar mode=\"determinate\"\r\n [value]=\"((totalPoints$ | async) || 0) / maxPossiblePoints * 100\"></mat-progress-bar>\r\n </div>\r\n\r\n <mat-accordion multi>\r\n @for (group of data.scoreSheetGroups; track group.key) {\r\n <mat-expansion-panel [expanded]=\"true\" [formGroupName]=\"group.key\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>{{ group.name }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n\r\n @for (score of data.groupedScoreSheet[group.key] || []; track score.id) {\r\n <div class=\"score-item\">\r\n <label [for]=\"score.id\" class=\"score-description\">{{ score.description }}</label>\r\n\r\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"score-input\">\r\n <mat-label>Score</mat-label>\r\n <input [disabled]=\"data.readonly\" matInput type=\"number\" placeholder=\"0\" [id]=\"score.id\"\r\n [formControlName]=\"score.id\" [max]=\"score.totalPoints\" min=\"0\" [errorStateMatcher]=\"matcher\"\r\n (input)=\"correctMaxValue($event, group.key, score.id, score.totalPoints)\" />\r\n <span matSuffix>\r\n <span style=\"min-width: 58px; display:flex\">\r\n / {{ score.totalPoints }}\r\n </span>\r\n </span>\r\n\r\n @if (pointsForm.get(group.key)?.get(score.id)?.hasError('required')) {\r\n <mat-error>A score is required.</mat-error>\r\n }\r\n @if (pointsForm.get(group.key)?.get(score.id)?.hasError('max')) {\r\n <mat-error>Score cannot exceed {{ score.totalPoints }}.</mat-error>\r\n }\r\n @if (pointsForm.get(group.key)?.get(score.id)?.hasError('min')) {\r\n <mat-error>Score cannot be negative.</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n <mat-divider></mat-divider>\r\n }\r\n </mat-expansion-panel>\r\n }\r\n </mat-accordion>\r\n\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions align=\"end\">\r\n <button mat-button mat-dialog-close>Cancel</button>\r\n @if( !data.readonly){\r\n <button mat-flat-button color=\"primary\" \r\n [mat-dialog-close]=\"pointsForm.getRawValue()\"\r\n [disabled]=\"pointsForm.invalid\">\r\n Save Points\r\n </button>\r\n }\r\n\r\n</mat-dialog-actions>", styles: [":host{display:block;min-width:500px;max-width:700px}.bidder-name{font-weight:500}.summary-bar{margin-bottom:24px}.summary-bar h3{margin-bottom:8px;font-weight:500}.score-item{display:flex;align-items:center;justify-content:space-between;padding:8px 4px;gap:16px}.score-description{flex:1;margin-right:16px;line-height:1.4}.score-input{flex-shrink:0;width:150px}.mat-expansion-panel-body .score-item:last-child+mat-divider{display:none}mat-dialog-actions{padding:16px 24px}.mat-mdc-form-field-error{font-size:.8125em}.dialog-instructions{margin-top:-8px;margin-bottom:24px;max-width:95%;padding-left:24px;padding-right:24px}li{font-size:.75em}ol,ul{margin-top:8px}\n"] }]
1349
+ }] });
1350
+
1351
+ class PointAssignmentComponent {
1352
+ constructor() {
1353
+ this.#config = inject(NGX_T_FORMS_CONFIG_TOKEN);
1354
+ this.#dialog = inject(MatDialog);
1355
+ this.#destroyRef = inject(DestroyRef);
1356
+ this.#refreshTrigger = new BehaviorSubject(undefined);
1357
+ // A stream to push updates of the review values (`this.value`)
1358
+ this.#valueChanges$ = new BehaviorSubject([]);
1359
+ this.#initialState = {
1360
+ loading: true,
1361
+ submissions: [],
1362
+ columnMapping: {},
1363
+ displayCols: [],
1364
+ displayColumns: [],
1365
+ error: undefined,
1366
+ docsContext: { step: AdjudicationSteps.PointAssignment },
1367
+ };
1368
+ this.#valueSignal = signal([], ...(ngDevMode ? [{ debugName: "#valueSignal" }] : /* istanbul ignore next */ []));
1369
+ this.inputConfig = input(undefined, ...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
1370
+ // NOTE(phase-4): Trap 6 — parent (`workflow-adjudication-reactive-input`) binds a
1371
+ // `WorkflowAdjudicationValue | null` union of three incompatible shapes. Until the parent
1372
+ // template is split per adjudication step type, this input must remain `any`; narrow
1373
+ // inside `valueBridge`.
1374
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO(phase-4): split parent template by adjudication step, then narrow this input.
1375
+ this.value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
1376
+ this.valueBridge = effect(() => {
1377
+ const raw = this.value();
1378
+ const next = Array.isArray(raw) ? raw : [];
1379
+ if (_isEqual(next, this.#valueSignal()))
1380
+ return;
1381
+ this.#valueSignal.set(next);
1382
+ this.#valueChanges$.next(next);
1383
+ }, ...(ngDevMode ? [{ debugName: "valueBridge" }] : /* istanbul ignore next */ []));
1384
+ // NOTE(phase-4): Trap 6 — emitter forwards enriched `ISubmission[]` rows (with score-sheet
1385
+ // augmentation) back to the parent which then writes through the `WorkflowAdjudicationValue`
1386
+ // union. D-013: the parent (`workflow-adjudication-reactive-input`) `(pointsChange)="setValue($event)"`
1387
+ // binding only typechecks under strictTemplates if `$event` is assignable to that union; the
1388
+ // enriched `ISubmission[]` payload matches no single branch (missing formControlName/totalPoints/
1389
+ // description), so the emitted type must stay `any[]` to preserve parity. Narrows when the parent
1390
+ // template is split per adjudication step type.
1391
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO(phase-4): split parent template by adjudication step, then narrow this emitter.
1392
+ this.pointsChange = output();
1393
+ // One fetch per trigger; failures become 'failed' states instead of killing
1394
+ // the stream, so "Try Again" genuinely refetches. See `microflowFetchStates`.
1395
+ this.#fetchedData$ = microflowFetchStates(this.#refreshTrigger, () => this.#config.formBuilder.getCurrentStepMicroflowSubmissions());
1396
+ /**
1397
+ * Combines the fetched data with the ongoing stream of local score changes.
1398
+ * Failure is reported per branch — a fetch error and a projection error
1399
+ * render different messages, so a bug in the enrich pass can never
1400
+ * masquerade as "the server call failed".
1401
+ */
1402
+ this.vm$ = combineLatest([
1403
+ this.#fetchedData$,
1404
+ this.#valueChanges$,
1405
+ ]).pipe(map(([fetched, reviewValues]) => {
1406
+ if (fetched.status === 'loading') {
1407
+ return this.#initialState;
1408
+ }
1409
+ if (fetched.status === 'failed') {
1410
+ return {
1411
+ ...this.#initialState,
1412
+ loading: false,
1413
+ error: `Could not load submissions: ${fetched.reason}`,
1414
+ };
1415
+ }
1416
+ try {
1417
+ return this.#buildViewModel(fetched.payload, reviewValues);
1418
+ }
1419
+ catch (error) {
1420
+ // The data DID arrive — surface a display failure with the real
1421
+ // reason instead of swallowing it into a generic load message.
1422
+ return {
1423
+ ...this.#initialState,
1424
+ loading: false,
1425
+ error: `Submissions were received but could not be displayed: ${describeError(error)}`,
1426
+ };
1427
+ }
1428
+ }), shareReplay(1));
1429
+ this.readonly = computed(() => this.inputConfig()?.readonly ?? false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
1430
+ }
1431
+ #config;
1432
+ #dialog;
1433
+ #destroyRef;
1434
+ #refreshTrigger;
1435
+ // A stream to push updates of the review values (`this.value`)
1436
+ #valueChanges$;
1437
+ #initialState;
1438
+ #valueSignal;
1439
+ // One fetch per trigger; failures become 'failed' states instead of killing
1440
+ // the stream, so "Try Again" genuinely refetches. See `microflowFetchStates`.
1441
+ #fetchedData$;
1442
+ /**
1443
+ * Projects a successful fetch plus the current local score values into the
1444
+ * view model. A throw here is caught by `vm$` and reported as a display
1445
+ * failure — never as a load failure.
1446
+ */
1447
+ #buildViewModel(payload, reviewValues) {
1448
+ const { columnMapping, submissions, scoreSheet } = payload;
1449
+ // group scoresheet by pointType
1450
+ const groupedScoreSheet = (scoreSheet || []).reduce((acc, curr) => {
1451
+ const pointType = curr.pointType || 'default';
1452
+ if (!acc[pointType]) {
1453
+ acc[pointType] = [];
1454
+ }
1455
+ acc[pointType].push(curr);
1456
+ return acc;
1457
+ }, {});
1458
+ const enriched = this.#enrichSubmissionsData(submissions || [], reviewValues);
1459
+ return {
1460
+ docsContext: {
1461
+ step: AdjudicationSteps.PointAssignment,
1462
+ hasScoreSheet: (scoreSheet?.length ?? 0) > 0,
1463
+ },
1464
+ chart: this.#buildPointsChart(enriched, columnMapping, scoreSheet),
1465
+ submissions: enriched,
1466
+ loading: false,
1467
+ error: undefined,
1468
+ groupedScoreSheet,
1469
+ scoreSheetGroups: Object.keys(groupedScoreSheet).map((key) => ({
1470
+ name: key.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z])([A-Z][a-z])/g, '$1 $2'),
1471
+ key,
1472
+ })),
1473
+ columnMapping,
1474
+ displayCols: [
1475
+ 'nameOfBidder',
1476
+ 'adj_microFlow_review',
1477
+ 'adjudicationPricePreferenceCalculation',
1478
+ 'adj_microFlow_scoreSheetTotalPoints',
1479
+ 'actions',
1480
+ ],
1481
+ displayColumns: [
1482
+ { label: 'name', formControlName: 'nameOfBidder', type: 'string' },
1483
+ { label: 'Pref Calc', formControlName: 'adjudicationPricePreferenceCalculation', type: 'number', showColor: true },
1484
+ { label: 'status', formControlName: 'adj_microFlow_review', type: 'string' },
1485
+ { label: 'Score', formControlName: 'adj_microFlow_scoreSheetTotalPoints', type: 'number', showColor: true },
1486
+ { label: '', formControlName: 'actions', type: 'string' },
1487
+ ],
1488
+ };
1489
+ }
1490
+ /**
1491
+ * Points chart for the shell: score-sheet points as the primary bar (axis
1492
+ * 0–total possible) and points for price as the thin secondary bar (its own
1493
+ * 0–100 scale), sorted best score first. Undefined when no sheet total
1494
+ * exists — the chart button hides with it.
1495
+ */
1496
+ #buildPointsChart(rows, columnMapping, scoreSheet) {
1497
+ const totalPossible = (scoreSheet ?? []).reduce((acc, s) => acc + (Number(s.totalPoints) || 0), 0);
1498
+ if (rows.length === 0 || totalPossible <= 0)
1499
+ return undefined;
1500
+ const pct = (value, max) => Math.max(0, Math.min(100, Math.round((value / max) * 1000) / 10));
1501
+ const sorted = [...rows].sort((a, b) => Number(b['adj_microFlow_scoreSheetTotalPoints'] ?? 0) -
1502
+ Number(a['adj_microFlow_scoreSheetTotalPoints'] ?? 0));
1503
+ return {
1504
+ caption: `Bar = score-sheet points awarded (0–${totalPossible}) · thin bar = points for price (0–100 scale).`,
1505
+ refs: [],
1506
+ legend: [
1507
+ { label: `Score-sheet points (0–${totalPossible})`, kind: 'primary' },
1508
+ { label: 'Points for price (0–100)', kind: 'secondary' },
1509
+ ],
1510
+ rows: sorted.map((row) => {
1511
+ const points = Number(row['adj_microFlow_scoreSheetTotalPoints'] ?? 0);
1512
+ const price = Number(row['adjudicationPricePreferenceCalculation'] ?? 0);
1513
+ // Enrich maps the review verdict to ✅/❌ for the table.
1514
+ const nonCompliant = row['adj_microFlow_review'] === '❌';
1515
+ return {
1516
+ id: row.id,
1517
+ name: String(row[columnMapping?.respondentNameKey || 'nameOfBidder'] ?? row['nameOfBidder'] ?? row.id),
1518
+ primaryPct: pct(points, totalPossible),
1519
+ primaryLabel: `${Number(points.toFixed(2))}/${totalPossible} pts`,
1520
+ secondaryPct: pct(price, 100),
1521
+ secondaryLabel: `${Number(price.toFixed(2))} price pts`,
1522
+ state: nonCompliant ? 'muted' : 'normal',
1523
+ note: nonCompliant ? 'non-compliant' : undefined,
1524
+ };
1525
+ }),
1526
+ };
1527
+ }
1528
+ loadMicroSubmissions() {
1529
+ this.#refreshTrigger.next();
1530
+ }
1531
+ viewMicroSubmission(res) {
1532
+ this.#config.formBuilder['previewWorkflowDocument'](res.id);
1533
+ }
1534
+ #enrichSubmissionsData(submissions, reviewValues) {
1535
+ const numberSets = new Map();
1536
+ numberSets.set('adjudicationPricePreferenceCalculation', submissions.map((s) => Number(s['adjudicationPricePreferenceCalculation'] || 0)));
1537
+ const list = submissions.length > 0 ? submissions : (reviewValues || []);
1538
+ return list.map((submission) => {
1539
+ const numbers = numberSets.get('adjudicationPricePreferenceCalculation') || [];
1540
+ const color = numbers.length === 0
1541
+ ? submission['adjudicationPricePreferenceCalculationColor']
1542
+ : this.#getColorString(submission['adjudicationPricePreferenceCalculation'], numbers);
1543
+ const backgroundShades = { ['adjudicationPricePreferenceCalculation']: this.#getScoreShade(color ?? '') };
1544
+ const existing = this.#valueSignal()?.find((v) => v.id === submission.id);
1545
+ return {
1546
+ ...submission,
1547
+ adj_microFlow_review: submission['adj_microFlow_review'] === 'compliant' ? '✅' : '❌',
1548
+ adjudicationPricePreferenceCalculationColor: color,
1549
+ backgroundShades,
1550
+ ...existing,
1551
+ };
1552
+ });
1553
+ }
1554
+ #getScoreShade(rgbColor) {
1555
+ if (!rgbColor)
1556
+ return '';
1557
+ return rgbColor.replace('rgb', 'rgba').replace(')', `, 0.1)`);
1558
+ }
1559
+ #getColorString(target, numbers) {
1560
+ return getColorForNumber(target, numbers, true);
1561
+ }
1562
+ openPointAssignmentDialog(row, groupedScoreSheet, scoreSheetGroups) {
1563
+ this.#dialog
1564
+ .open(PointAssignmentDialogComponent, {
1565
+ height: 'fit-content',
1566
+ data: {
1567
+ row,
1568
+ groupedScoreSheet,
1569
+ scoreSheetGroups,
1570
+ readonly: this.inputConfig()?.readonly || false,
1571
+ },
1572
+ autoFocus: false,
1573
+ disableClose: true,
1574
+ })
1575
+ .afterClosed()
1576
+ .pipe(take(1), switchMap((result) => {
1577
+ if (!result)
1578
+ return of(null);
1579
+ // Update the value with the new point assignments
1580
+ const assignment = Object.values(result).reduce((acc, curr) => {
1581
+ acc = { ...acc, ...curr };
1582
+ return acc;
1583
+ }, {});
1584
+ row['adj_microFlow_assignedScore'] = assignment;
1585
+ const currentList = this.#valueSignal() ?? [];
1586
+ const alreadyInValue = currentList.find((v) => v.id === row.id);
1587
+ let newValue;
1588
+ if (!alreadyInValue) {
1589
+ newValue = [
1590
+ ...currentList,
1591
+ {
1592
+ ...row,
1593
+ adj_microFlow_assignedScore: assignment,
1594
+ adj_microFlow_scoreSheetTotalPoints: Object.values(assignment).reduce((acc, curr) => acc + curr, 0),
1595
+ },
1596
+ ];
1597
+ }
1598
+ else {
1599
+ newValue = currentList.map((v) => {
1600
+ if (v.id === row.id) {
1601
+ return {
1602
+ ...v,
1603
+ adj_microFlow_scoreSheetTotalPoints: Object.values(assignment).reduce((acc, curr) => acc + curr, 0),
1604
+ adj_microFlow_assignedScore: assignment,
1605
+ };
1606
+ }
1607
+ return v;
1608
+ });
1609
+ }
1610
+ return of(newValue);
1611
+ }), tap((newValue) => {
1612
+ if (!newValue || this.inputConfig()?.readonly)
1613
+ return;
1614
+ this.pointsChange.emit(newValue);
1615
+ }), takeUntilDestroyed(this.#destroyRef))
1616
+ .subscribe();
1617
+ }
1618
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: PointAssignmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1619
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: PointAssignmentComponent, isStandalone: true, selector: "lib-point-assignment", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointsChange: "pointsChange" }, ngImport: i0, template: "@if (vm$ | async; as vm) {\r\n @if (vm.loading) {\r\n <div style=\"display: flex; justify-content: center; align-items: center; padding:24px;width: 100%;\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n } @else if (vm.error) {\r\n <div class=\"info-card error-card\">\r\n <!-- Heading stays cause-neutral: vm.error states WHICH half failed\r\n (the fetch vs. displaying data that did arrive). -->\r\n <h5 class=\"info-title\">\u274C Unable to show submissions</h5>\r\n <p>{{ vm.error }}</p>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\">\r\n Try Again\r\n </button>\r\n </div>\r\n } @else {\r\n <lib-adjudication-shell label=\"Point assignment\" [docsContext]=\"vm.docsContext\" [chart]=\"vm.chart\">\r\n @if (vm.submissions.length === 0) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u2139\uFE0F There are no submissions to display.</h5>\r\n <ul>\r\n <li>This can happen if <strong>no one has responded</strong> yet, or if <strong>none of the submission were\r\n compliant </strong>.</li>\r\n <li>If you are expecting to see submissions, try clicking the <strong>Refresh</strong> button.</li>\r\n </ul>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\" class=\"load-button\">\r\n Refresh\r\n </button>\r\n </div>\r\n } @else {\r\n @if (!value || value.length === 0) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\uD83D\uDCDD How to Review Submissions</h5>\r\n <ol>\r\n <li>\r\n <strong>View Response:</strong> Click the <strong>Preview</strong> (<mat-icon\r\n class=\"smallIcon\">preview</mat-icon>) icon to see the full submission.\r\n </li>\r\n <li>\r\n <strong>Set Status:</strong> Use the dropdown to select <strong>Compliant</strong> or\r\n <strong>Non-compliant</strong>.\r\n </li>\r\n <li>\r\n <strong>Add Note (If Non-compliant):</strong>\r\n <ul>\r\n <li>If you select <strong>Non-compliant</strong>, you <strong>must</strong> add a note.</li>\r\n <li>Click the <strong>Add Note</strong> (<mat-icon class=\"smallIcon\">add_comment</mat-icon>) icon, write your\r\n feedback, and hit <strong>Save Feedback</strong>. Your note will be visible to the applicant.</li>\r\n </ul>\r\n </li>\r\n </ol>\r\n </div>\r\n }\r\n <table mat-table [dataSource]=\"vm.submissions\">\r\n @for (col of vm.displayColumns; track col.formControlName) {\r\n <ng-container [matColumnDef]=\"col.formControlName\">\r\n <th mat-header-cell *matHeaderCellDef style=\"padding:4px\">\r\n {{ col.label }}\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\" mat-ripple class=\"table-cell\" (click)=\"$event.stopPropagation()\"\r\n [class.price-preference-cell]=\"true\"\r\n [style.border-bottom-color]=\"row.adjudicationPricePreferenceCalculationColor\"\r\n [style.background]=\"row.backgroundShades?.[col.formControlName]\">\r\n @if (col.formControlName === 'actions') {\r\n <span style=\"display: flex; align-items: center;\">\r\n <button matTooltipPosition=\"before\"\r\n [matTooltip]=\"'View and review **' + row[vm.columnMapping.respondentNameKey] + '\\'s\\' Submission'\"\r\n (click)=\"viewMicroSubmission(row)\" mat-icon-button>\r\n <mat-icon>preview</mat-icon>\r\n </button>\r\n </span>\r\n } @else if (col.formControlName === 'adj_microFlow_scoreSheetTotalPoints') {\r\n <button\r\n (click)=\"openPointAssignmentDialog(row, vm?.groupedScoreSheet, vm.scoreSheetGroups)\"\r\n [id]=\"row.id\" mat-stroked-button>\r\n {{ (row[col.formControlName] | number:'0.0-0') || 'Assign Points' }}\r\n </button>\r\n } @else {\r\n @switch (col?.type) {\r\n @case ('daysAgo') {\r\n {{ row[col.formControlName] | daysAgo }}\r\n }\r\n @case ('number') {\r\n {{ (row[col.formControlName] | number:'0.0-0') || 'N/A' }}\r\n }\r\n @default {\r\n @if ($index === 0) {\r\n <span class=\"main-submission-text\">\r\n <mat-icon style=\"font-size: 1em;height:16px;width:16px\">domain</mat-icon>\r\n <strong>\r\n {{ row[col.formControlName] }}\r\n </strong>\r\n </span>\r\n <span class=\"secondary-text\">\r\n <mat-icon>fingerprint</mat-icon>\r\n {{ row[vm.columnMapping.respondentCodeKey] }}\r\n <mat-icon>more_time</mat-icon>\r\n {{ row[vm.columnMapping.responseDateKey || ''] | daysAgo }}\r\n </span>\r\n } @else {\r\n {{ row[col.formControlName] }}\r\n }\r\n }\r\n }\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n <tr mat-header-row *matHeaderRowDef=\"vm.displayCols\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: vm.displayCols\"></tr>\r\n </table>\r\n }\r\n </lib-adjudication-shell>\r\n }\r\n}\r\n", styles: [".number{display:flex;justify-content:space-between;align-items:center}li{font-size:.75em}ol,ul{margin-top:8px}.number-cell{display:flex;justify-content:space-between;align-items:center;width:100%}.secondary-text{display:flex;align-items:center;white-space:pre;font-size:.75em;gap:8px;opacity:.8}.secondary-text mat-icon{font-size:.875em;width:14px;height:14px}.mat-column-adj_microFlow_review{max-width:18px;text-align:center}.mat-column-nameOfBidder{max-width:90px}.mat-column-actions{padding:0;max-width:80px}.mat-column-status{padding-left:8px;padding-right:8px;max-width:fit-content!important}.main-submission-text{display:flex;align-items:center;gap:8px;font-size:.875em}:host .notes-card{width:100%;max-width:480px;resize:both;height:fit-content}.smallIcon{font-size:.875em;width:14px;height:14px}.table-cell{padding-left:4px;padding-right:4px}.mat-column-adjudicationPricePreferenceCalculation{max-width:18px;text-align:center}.mat-column-adj_microFlow_scoreSheetTotalPoints{width:148px;text-align:center}.mat-column-actions{max-width:14px;text-align:center}.ngx-t-forms-point-assignment-menu{width:fit-content!important;max-width:400px!important}.point-assignment-menu{padding-left:28px;padding-right:28px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatRippleModule }, { kind: "directive", type: i7.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5$2.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5$2.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5$2.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5$2.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5$2.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5$2.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5$2.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5$2.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5$2.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5$2.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: AdjudicationShellComponent, selector: "lib-adjudication-shell", inputs: ["label", "system", "docsContext", "chart"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: DecimalPipe, name: "number" }, { kind: "pipe", type: DaysAgoPipe, name: "daysAgo" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1620
+ }
1621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: PointAssignmentComponent, decorators: [{
1622
+ type: Component,
1623
+ args: [{ selector: 'lib-point-assignment', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [
1624
+ AsyncPipe,
1625
+ DecimalPipe,
1626
+ FormsModule,
1627
+ ReactiveFormsModule,
1628
+ MatButtonModule,
1629
+ MatIconModule,
1630
+ MatProgressSpinnerModule,
1631
+ MatRippleModule,
1632
+ MatTableModule,
1633
+ MatTooltipModule,
1634
+ DaysAgoPipe,
1635
+ AdjudicationShellComponent,
1636
+ ], template: "@if (vm$ | async; as vm) {\r\n @if (vm.loading) {\r\n <div style=\"display: flex; justify-content: center; align-items: center; padding:24px;width: 100%;\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n } @else if (vm.error) {\r\n <div class=\"info-card error-card\">\r\n <!-- Heading stays cause-neutral: vm.error states WHICH half failed\r\n (the fetch vs. displaying data that did arrive). -->\r\n <h5 class=\"info-title\">\u274C Unable to show submissions</h5>\r\n <p>{{ vm.error }}</p>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\">\r\n Try Again\r\n </button>\r\n </div>\r\n } @else {\r\n <lib-adjudication-shell label=\"Point assignment\" [docsContext]=\"vm.docsContext\" [chart]=\"vm.chart\">\r\n @if (vm.submissions.length === 0) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u2139\uFE0F There are no submissions to display.</h5>\r\n <ul>\r\n <li>This can happen if <strong>no one has responded</strong> yet, or if <strong>none of the submission were\r\n compliant </strong>.</li>\r\n <li>If you are expecting to see submissions, try clicking the <strong>Refresh</strong> button.</li>\r\n </ul>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\" class=\"load-button\">\r\n Refresh\r\n </button>\r\n </div>\r\n } @else {\r\n @if (!value || value.length === 0) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\uD83D\uDCDD How to Review Submissions</h5>\r\n <ol>\r\n <li>\r\n <strong>View Response:</strong> Click the <strong>Preview</strong> (<mat-icon\r\n class=\"smallIcon\">preview</mat-icon>) icon to see the full submission.\r\n </li>\r\n <li>\r\n <strong>Set Status:</strong> Use the dropdown to select <strong>Compliant</strong> or\r\n <strong>Non-compliant</strong>.\r\n </li>\r\n <li>\r\n <strong>Add Note (If Non-compliant):</strong>\r\n <ul>\r\n <li>If you select <strong>Non-compliant</strong>, you <strong>must</strong> add a note.</li>\r\n <li>Click the <strong>Add Note</strong> (<mat-icon class=\"smallIcon\">add_comment</mat-icon>) icon, write your\r\n feedback, and hit <strong>Save Feedback</strong>. Your note will be visible to the applicant.</li>\r\n </ul>\r\n </li>\r\n </ol>\r\n </div>\r\n }\r\n <table mat-table [dataSource]=\"vm.submissions\">\r\n @for (col of vm.displayColumns; track col.formControlName) {\r\n <ng-container [matColumnDef]=\"col.formControlName\">\r\n <th mat-header-cell *matHeaderCellDef style=\"padding:4px\">\r\n {{ col.label }}\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\" mat-ripple class=\"table-cell\" (click)=\"$event.stopPropagation()\"\r\n [class.price-preference-cell]=\"true\"\r\n [style.border-bottom-color]=\"row.adjudicationPricePreferenceCalculationColor\"\r\n [style.background]=\"row.backgroundShades?.[col.formControlName]\">\r\n @if (col.formControlName === 'actions') {\r\n <span style=\"display: flex; align-items: center;\">\r\n <button matTooltipPosition=\"before\"\r\n [matTooltip]=\"'View and review **' + row[vm.columnMapping.respondentNameKey] + '\\'s\\' Submission'\"\r\n (click)=\"viewMicroSubmission(row)\" mat-icon-button>\r\n <mat-icon>preview</mat-icon>\r\n </button>\r\n </span>\r\n } @else if (col.formControlName === 'adj_microFlow_scoreSheetTotalPoints') {\r\n <button\r\n (click)=\"openPointAssignmentDialog(row, vm?.groupedScoreSheet, vm.scoreSheetGroups)\"\r\n [id]=\"row.id\" mat-stroked-button>\r\n {{ (row[col.formControlName] | number:'0.0-0') || 'Assign Points' }}\r\n </button>\r\n } @else {\r\n @switch (col?.type) {\r\n @case ('daysAgo') {\r\n {{ row[col.formControlName] | daysAgo }}\r\n }\r\n @case ('number') {\r\n {{ (row[col.formControlName] | number:'0.0-0') || 'N/A' }}\r\n }\r\n @default {\r\n @if ($index === 0) {\r\n <span class=\"main-submission-text\">\r\n <mat-icon style=\"font-size: 1em;height:16px;width:16px\">domain</mat-icon>\r\n <strong>\r\n {{ row[col.formControlName] }}\r\n </strong>\r\n </span>\r\n <span class=\"secondary-text\">\r\n <mat-icon>fingerprint</mat-icon>\r\n {{ row[vm.columnMapping.respondentCodeKey] }}\r\n <mat-icon>more_time</mat-icon>\r\n {{ row[vm.columnMapping.responseDateKey || ''] | daysAgo }}\r\n </span>\r\n } @else {\r\n {{ row[col.formControlName] }}\r\n }\r\n }\r\n }\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n <tr mat-header-row *matHeaderRowDef=\"vm.displayCols\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: vm.displayCols\"></tr>\r\n </table>\r\n }\r\n </lib-adjudication-shell>\r\n }\r\n}\r\n", styles: [".number{display:flex;justify-content:space-between;align-items:center}li{font-size:.75em}ol,ul{margin-top:8px}.number-cell{display:flex;justify-content:space-between;align-items:center;width:100%}.secondary-text{display:flex;align-items:center;white-space:pre;font-size:.75em;gap:8px;opacity:.8}.secondary-text mat-icon{font-size:.875em;width:14px;height:14px}.mat-column-adj_microFlow_review{max-width:18px;text-align:center}.mat-column-nameOfBidder{max-width:90px}.mat-column-actions{padding:0;max-width:80px}.mat-column-status{padding-left:8px;padding-right:8px;max-width:fit-content!important}.main-submission-text{display:flex;align-items:center;gap:8px;font-size:.875em}:host .notes-card{width:100%;max-width:480px;resize:both;height:fit-content}.smallIcon{font-size:.875em;width:14px;height:14px}.table-cell{padding-left:4px;padding-right:4px}.mat-column-adjudicationPricePreferenceCalculation{max-width:18px;text-align:center}.mat-column-adj_microFlow_scoreSheetTotalPoints{width:148px;text-align:center}.mat-column-actions{max-width:14px;text-align:center}.ngx-t-forms-point-assignment-menu{width:fit-content!important;max-width:400px!important}.point-assignment-menu{padding-left:28px;padding-right:28px}\n"] }]
1637
+ }], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], pointsChange: [{ type: i0.Output, args: ["pointsChange"] }] } });
1638
+
1639
+ function toSupplierValue(input) {
1640
+ // Runtime guard — the parent supplies a union of array / object payloads.
1641
+ return Array.isArray(input) ? input : [];
1642
+ }
1643
+ class SupplierSelectionComponent {
1644
+ constructor() {
1645
+ this.inputConfig = input(undefined, ...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
1646
+ // Phase-4 TODO: parent (workflow-adjudication-reactive-input) accepts broader `WorkflowAdjudicationValue` union.
1647
+ // Emitting narrower `SupplierRow[]` is structurally compatible at runtime; output widened to `any` for template typecheck (Trap 6).
1648
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1649
+ this.supplierSelection = output();
1650
+ this.#config = inject(NGX_T_FORMS_CONFIG_TOKEN);
1651
+ this.#destroyRef = inject(DestroyRef);
1652
+ this.#dialog = inject(MatDialog);
1653
+ this.#refreshTrigger = new BehaviorSubject(undefined);
1654
+ // A stream to push updates of the review values (`this.value`)
1655
+ this.#valueChanges$ = new BehaviorSubject([]);
1656
+ this.#initialState = {
1657
+ loading: true,
1658
+ submissions: [],
1659
+ columnMapping: {},
1660
+ displayCols: [],
1661
+ displayColumns: [],
1662
+ error: undefined,
1663
+ docsContext: { step: AdjudicationSteps.SupplierSelection },
1664
+ };
1665
+ this.#value = [];
1666
+ // NOTE(phase-4): Trap 6 — parent (`workflow-adjudication-reactive-input`) binds a
1667
+ // `WorkflowAdjudicationValue | null` union of three incompatible shapes. The template
1668
+ // also reads `value.length` directly. Until parent template is split per adjudication step
1669
+ // the input must remain `any`; narrow inside the `valueBridge` via `toSupplierValue`.
1670
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO(phase-4): split parent template by adjudication step, then narrow this input.
1671
+ this.value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
1672
+ this.valueBridge = effect(() => {
1673
+ const next = toSupplierValue(this.value());
1674
+ if (_isEqual(next, this.#value))
1675
+ return;
1676
+ this.#value = next;
1677
+ this.#valueChanges$.next(this.#value);
1678
+ }, ...(ngDevMode ? [{ debugName: "valueBridge" }] : /* istanbul ignore next */ []));
1679
+ // One fetch per trigger; failures become 'failed' states instead of killing
1680
+ // the stream, so "Try Again" genuinely refetches. See `microflowFetchStates`.
1681
+ this.#fetchedData$ = microflowFetchStates(this.#refreshTrigger, () => this.#config.formBuilder.getCurrentStepMicroflowSubmissions());
1682
+ /**
1683
+ * Combines the fetched data with the ongoing stream of local appointment
1684
+ * changes. Failure is reported per branch — a fetch error and a projection
1685
+ * error render different messages, so a bug in the enrich/scoring pass can
1686
+ * never masquerade as "the server call failed".
1687
+ */
1688
+ this.vm$ = combineLatest([
1689
+ this.#fetchedData$,
1690
+ this.#valueChanges$,
1691
+ ]).pipe(map(([fetched, reviewValues]) => {
1692
+ if (fetched.status === 'loading') {
1693
+ return this.#initialState;
1694
+ }
1695
+ if (fetched.status === 'failed') {
1696
+ return {
1697
+ ...this.#initialState,
1698
+ loading: false,
1699
+ error: `Could not load submissions: ${fetched.reason}`,
1700
+ };
1701
+ }
1702
+ try {
1703
+ return this.#buildViewModel(fetched.payload, reviewValues);
1704
+ }
1705
+ catch (error) {
1706
+ // The data DID arrive — surface a display failure with the real
1707
+ // reason instead of swallowing it into a generic load message.
1708
+ return {
1709
+ ...this.#initialState,
1710
+ loading: false,
1711
+ error: `Submissions were received but could not be displayed: ${describeError(error)}`,
1712
+ };
1713
+ }
1714
+ }), shareReplay(1));
1715
+ }
1716
+ #config;
1717
+ #destroyRef;
1718
+ #dialog;
1719
+ #refreshTrigger;
1720
+ // A stream to push updates of the review values (`this.value`)
1721
+ #valueChanges$;
1722
+ #initialState;
1723
+ #value;
1724
+ // One fetch per trigger; failures become 'failed' states instead of killing
1725
+ // the stream, so "Try Again" genuinely refetches. See `microflowFetchStates`.
1726
+ #fetchedData$;
1727
+ loadMicroSubmissions() {
1728
+ this.#refreshTrigger.next();
1729
+ }
1730
+ /**
1731
+ * Projects a successful fetch plus the current local appointment values into
1732
+ * the view model. A throw here is caught by `vm$` and reported as a display
1733
+ * failure — never as a load failure.
1734
+ */
1735
+ #buildViewModel(payload, reviewValues) {
1736
+ const { columnMapping, submissions, scoreSheet, adjudicationPricePreferenceCalculationFormula, } = payload;
1737
+ //group scoreSheet by pointType
1738
+ const groupedScoreSheet = (scoreSheet || []).reduce((acc, curr) => {
1739
+ const pointType = curr.pointType || 'default';
1740
+ if (!acc[pointType]) {
1741
+ acc[pointType] = [];
1742
+ }
1743
+ acc[pointType].push(curr);
1744
+ return acc;
1745
+ }, {});
1746
+ const totalPossibleScore = (scoreSheet || []).reduce((acc, curr) => acc + curr.totalPoints, 0);
1747
+ const maxPointsAwarded = adjudicationPricePreferenceCalculationFormula ===
1748
+ '80(1-((totalBidPrice-Pmin)/(Pmin)))'
1749
+ ? 20
1750
+ : adjudicationPricePreferenceCalculationFormula ===
1751
+ '90(1-((totalBidPrice-Pmin)/(Pmin)))'
1752
+ ? 10
1753
+ : 100;
1754
+ const enriched = this.#enrichSubmissionsData(submissions || [], reviewValues, totalPossibleScore, maxPointsAwarded);
1755
+ return {
1756
+ docsContext: {
1757
+ step: AdjudicationSteps.SupplierSelection,
1758
+ system: `${100 - maxPointsAwarded}/${maxPointsAwarded}`,
1759
+ hasScoreSheet: (scoreSheet?.length ?? 0) > 0,
1760
+ },
1761
+ chart: this.#buildTotalsChart(enriched, columnMapping, maxPointsAwarded),
1762
+ submissions: enriched,
1763
+ loading: false,
1764
+ error: undefined,
1765
+ groupedScoreSheet,
1766
+ scoreSheetGroups: Object.keys(groupedScoreSheet).map((key) => ({
1767
+ name: key
1768
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
1769
+ .replace(/([A-Z])([A-Z][a-z])/g, '$1 $2'),
1770
+ key: key,
1771
+ })),
1772
+ maxPointsAwarded,
1773
+ totalPossibleScore,
1774
+ columnMapping: columnMapping,
1775
+ displayCols: [
1776
+ 'nameOfBidder',
1777
+ 'adjudicationPricePreferenceCalculation',
1778
+ 'adj_microFlow_pointsAwarded',
1779
+ 'adj_microFlow_pricePointCalculation',
1780
+ 'actions',
1781
+ 'adj_microFlow_supplierAppointed',
1782
+ ],
1783
+ displayColumns: [
1784
+ { label: 'name', formControlName: 'nameOfBidder', type: InputDataTypes.String },
1785
+ {
1786
+ label: `${100 - maxPointsAwarded}`,
1787
+ formControlName: 'adjudicationPricePreferenceCalculation',
1788
+ type: InputDataTypes.Number,
1789
+ },
1790
+ {
1791
+ label: `${maxPointsAwarded}`,
1792
+ formControlName: 'adj_microFlow_pointsAwarded',
1793
+ type: InputDataTypes.Number,
1794
+ },
1795
+ {
1796
+ label: 'Total',
1797
+ formControlName: 'adj_microFlow_pricePointCalculation',
1798
+ type: InputDataTypes.Number,
1799
+ },
1800
+ // `actions` is an internal cell type used by the template `@switch`; widened locally in `tableCols`.
1801
+ { label: '', formControlName: 'actions', type: 'actions' },
1802
+ {
1803
+ label: 'Appointed',
1804
+ formControlName: 'adj_microFlow_supplierAppointed',
1805
+ type: InputDataTypes.Boolean,
1806
+ showColor: true,
1807
+ },
1808
+ ],
1809
+ };
1810
+ }
1811
+ viewMicroSubmission(res) {
1812
+ this.#config.formBuilder['previewWorkflowDocument'](res.id);
1813
+ }
1814
+ /**
1815
+ * Final-score chart for the shell: the combined price + points total as the
1816
+ * primary bar (axis 0–100) and the scaled score-sheet award as the thin
1817
+ * secondary bar (0–maxPointsAwarded), sorted best total first. The
1818
+ * appointed supplier is annotated on its row.
1819
+ */
1820
+ #buildTotalsChart(rows, columnMapping, maxPointsAwarded) {
1821
+ if (rows.length === 0)
1822
+ return undefined;
1823
+ const pct = (value, max) => Math.max(0, Math.min(100, Math.round((value / max) * 1000) / 10));
1824
+ const sorted = [...rows].sort((a, b) => Number(b['adj_microFlow_pricePointCalculation'] ?? 0) -
1825
+ Number(a['adj_microFlow_pricePointCalculation'] ?? 0));
1826
+ return {
1827
+ caption: `Bar = final score out of 100 (price + scaled score-sheet points) · thin bar = score-sheet award (0–${maxPointsAwarded}).`,
1828
+ refs: [],
1829
+ legend: [
1830
+ { label: 'Final score (0–100)', kind: 'primary' },
1831
+ { label: `Score-sheet award (0–${maxPointsAwarded})`, kind: 'secondary' },
1832
+ ],
1833
+ rows: sorted.map((row) => {
1834
+ const total = Number(row['adj_microFlow_pricePointCalculation'] ?? 0);
1835
+ const awarded = Number(row['adj_microFlow_pointsAwarded'] ?? 0);
1836
+ return {
1837
+ id: row.id,
1838
+ name: String(row[columnMapping?.respondentNameKey || 'nameOfBidder'] ?? row['nameOfBidder'] ?? row.id),
1839
+ primaryPct: pct(total, 100),
1840
+ primaryLabel: `${Number(total.toFixed(2))}/100`,
1841
+ secondaryPct: pct(awarded, maxPointsAwarded),
1842
+ secondaryLabel: `${Number(awarded.toFixed(2))}/${maxPointsAwarded} awarded`,
1843
+ state: 'normal',
1844
+ note: row['adj_microFlow_supplierAppointed'] === true ? 'Appointed' : undefined,
1845
+ };
1846
+ }),
1847
+ };
1848
+ }
1849
+ #enrichSubmissionsData(submissions, value, totalPossibleScore, maxPointsAwarded) {
1850
+ // 1. Handle edge cases first for clarity.
1851
+ // 2. Improve performance by creating a lookup map to avoid O(n^2) complexity.
1852
+ // This is much faster than using .find() inside a loop.
1853
+ const valueMap = new Map(this.#value?.map((v) => [v.id, v]) || []);
1854
+ const list = submissions.length > 0 ? submissions : (value || []);
1855
+ // 3. First pass: Enrich submissions with calculated scores.
1856
+ const enrichedSubmissions = list.map((submission) => {
1857
+ const v = valueMap.get(submission.id);
1858
+ // Use nullish coalescing (??) for cleaner fallback logic.
1859
+ const totalPoints = v?.['adj_microFlow_scoreSheetTotalPoints'] ??
1860
+ submission?.['adj_microFlow_scoreSheetTotalPoints'] ??
1861
+ 0;
1862
+ // Simplify calculation: remove unnecessary try-catch. Division by zero in JS results
1863
+ // in Infinity, not an error. The check for totalPossibleScore > 0 handles this.
1864
+ const pointsAwarded = totalPossibleScore > 0
1865
+ ? (totalPoints / totalPossibleScore) * maxPointsAwarded
1866
+ : 0;
1867
+ const pricePointCalculation = (Number(submission['adjudicationPricePreferenceCalculation'] ?? 0)) + pointsAwarded;
1868
+ return {
1869
+ ...submission,
1870
+ ...v,
1871
+ adj_microFlow_pointsAwarded: pointsAwarded,
1872
+ adj_microFlow_pricePointCalculation: pricePointCalculation,
1873
+ };
1874
+ });
1875
+ // 4. Define keys to process to avoid repetition (DRY principle).
1876
+ const keysToColor = ['adj_microFlow_pricePointCalculation'];
1877
+ // 5. Correctly build the number sets from the *newly enriched* data.
1878
+ const numberSets = new Map();
1879
+ for (const key of keysToColor) {
1880
+ const values = enrichedSubmissions.map((s) => Number(s[key] ?? 0));
1881
+ numberSets.set(key, values);
1882
+ }
1883
+ // 6. Second pass: Add colors and shades based on the complete dataset.
1884
+ return enrichedSubmissions.map((submission) => {
1885
+ const colColors = {};
1886
+ const backgroundShades = {
1887
+ ...(submission.backgroundShades ?? {}),
1888
+ };
1889
+ for (const key of keysToColor) {
1890
+ const scoreValue = Number(submission[key] ?? 0);
1891
+ const allScores = numberSets.get(key) || [];
1892
+ const color = this.#getColorString(scoreValue, allScores);
1893
+ colColors[key] = color;
1894
+ backgroundShades[key] = this.#getScoreShade(color);
1895
+ }
1896
+ backgroundShades['adjudicationPricePreferenceCalculation'] = '';
1897
+ return {
1898
+ ...submission,
1899
+ colColors,
1900
+ backgroundShades,
1901
+ };
1902
+ });
1903
+ }
1904
+ #getScoreShade(rgbColor) {
1905
+ if (!rgbColor)
1906
+ return '';
1907
+ return rgbColor.replace('rgb', 'rgba').replace(')', `, 0.1)`);
1908
+ }
1909
+ #getColorString(target, numbers) {
1910
+ return getColorForNumber(target, numbers, true);
1911
+ }
1912
+ openPointAssignmentDialog(row, groupedScoreSheet, scoreSheetGroups) {
1913
+ this.#dialog
1914
+ .open(PointAssignmentDialogComponent, {
1915
+ height: 'fit-content',
1916
+ data: {
1917
+ row,
1918
+ groupedScoreSheet,
1919
+ scoreSheetGroups,
1920
+ },
1921
+ autoFocus: false,
1922
+ disableClose: true,
1923
+ })
1924
+ .afterClosed()
1925
+ .pipe(take(1), switchMap((result) => {
1926
+ if (!result)
1927
+ return of(null);
1928
+ // Update the value with the new point assignments
1929
+ const assignment = Object.values(result).reduce((acc, curr) => {
1930
+ acc = {
1931
+ ...acc,
1932
+ ...curr,
1933
+ };
1934
+ return acc;
1935
+ }, {});
1936
+ row['adj_microFlow_assignedScore'] = assignment;
1937
+ const alreadyInValue = this.#value?.find((v) => v.id === row.id);
1938
+ let newValue;
1939
+ if (!alreadyInValue) {
1940
+ newValue = [
1941
+ ...(this.#value || []),
1942
+ {
1943
+ ...row,
1944
+ adj_microFlow_assignedScore: assignment,
1945
+ adj_microFlow_scoreSheetTotalPoints: Object.values(assignment).reduce((acc, curr) => acc + curr, 0),
1946
+ },
1947
+ ];
1948
+ }
1949
+ else {
1950
+ newValue =
1951
+ this.#value?.map((v) => {
1952
+ if (v.id === row.id) {
1953
+ return {
1954
+ ...v,
1955
+ adj_microFlow_scoreSheetTotalPoints: Object.values(assignment).reduce((acc, curr) => acc + curr, 0),
1956
+ adj_microFlow_assignedScore: assignment,
1957
+ };
1958
+ }
1959
+ return v;
1960
+ }) || [];
1961
+ }
1962
+ return of(newValue);
1963
+ }), tap((newValue) => {
1964
+ if (!newValue)
1965
+ return;
1966
+ this.supplierSelection.emit(newValue);
1967
+ }), takeUntilDestroyed(this.#destroyRef))
1968
+ .subscribe();
1969
+ }
1970
+ appointASupplier(row) {
1971
+ if (this.inputConfig()?.readonly || this.inputConfig()?.disabled) {
1972
+ return;
1973
+ }
1974
+ if (row['adj_microFlow_supplierAppointed']) {
1975
+ row['adj_microFlow_supplierAppointed'] = false;
1976
+ }
1977
+ else {
1978
+ row['adj_microFlow_supplierAppointed'] = true;
1979
+ }
1980
+ const alreadyInValue = this.#value?.find((v) => v.id === row.id);
1981
+ let newValue;
1982
+ if (!alreadyInValue) {
1983
+ const otherRows = this.#value?.map((v) => ({
1984
+ ...v,
1985
+ adj_microFlow_supplierAppointed: false,
1986
+ }));
1987
+ newValue = [...(otherRows || []), row];
1988
+ }
1989
+ else {
1990
+ newValue =
1991
+ this.#value?.map((v) => {
1992
+ if (v.id === row.id) {
1993
+ return {
1994
+ ...v,
1995
+ adj_microFlow_supplierAppointed: row['adj_microFlow_supplierAppointed'],
1996
+ };
1997
+ }
1998
+ return {
1999
+ ...v,
2000
+ adj_microFlow_supplierAppointed: false,
2001
+ };
2002
+ }) || [];
2003
+ }
2004
+ if (newValue) {
2005
+ this.supplierSelection.emit(newValue);
2006
+ }
2007
+ }
2008
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SupplierSelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2009
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: SupplierSelectionComponent, isStandalone: true, selector: "lib-supplier-selection", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { supplierSelection: "supplierSelection" }, ngImport: i0, template: "@if (vm$ | async; as vm) {\r\n @if (vm.loading) {\r\n <div style=\"display: flex; justify-content: center; align-items: center; padding:24px;width: 100%;\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n } @else if (vm.error) {\r\n <div class=\"info-card error-card\">\r\n <!-- Heading stays cause-neutral: vm.error states WHICH half failed\r\n (the fetch vs. displaying data that did arrive). -->\r\n <h5 class=\"info-title\">\u274C Unable to show submissions</h5>\r\n <p>{{ vm.error }}</p>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\">\r\n Try Again\r\n </button>\r\n </div>\r\n } @else {\r\n <lib-adjudication-shell label=\"Supplier selection\" [system]=\"vm.docsContext.system\" [docsContext]=\"vm.docsContext\" [chart]=\"vm.chart\">\r\n\r\n @if (vm.submissions.length === 0) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u2139\uFE0F There are no submissions to display.</h5>\r\n <ul>\r\n <li>This can happen if <strong>no one has responded</strong> yet, or if <strong>none of the submission were\r\n compliant </strong>.</li>\r\n <li>If you are expecting to see submissions, try clicking the <strong>Refresh</strong> button.</li>\r\n </ul>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\" class=\"load-button\">\r\n Refresh\r\n </button>\r\n </div>\r\n } @else {\r\n\r\n @if (!value || value.length === 0) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\uD83D\uDCDD How to Appoint</h5>\r\n <ol>\r\n <li>\r\n <strong>View Response:</strong> Click the <strong>Preview</strong> (<mat-icon\r\n class=\"smallIcon\">preview</mat-icon>) icon to see the full submission.\r\n </li>\r\n <li>\r\n <strong>Appoint:</strong> Click the <strong>Appoint</strong> button to appoint the supplier.\r\n </li>\r\n\r\n </ol>\r\n </div>\r\n }\r\n <table mat-table [dataSource]=\"vm.submissions\">\r\n @for (col of vm.displayColumns; track col.formControlName) {\r\n <ng-container [matColumnDef]=\"col.formControlName\">\r\n <th mat-header-cell *matHeaderCellDef style=\"padding:4px\">\r\n {{ col.label }}\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\" mat-ripple class=\"table-cell\" (click)=\"$event.stopPropagation()\"\r\n [class.price-preference-cell]=\"true\" [style.border-bottom-color]=\"row.colColors[col.formControlName]\"\r\n [style.background]=\"row.backgroundShades?.[col.formControlName]\">\r\n @if (col.formControlName === 'actions') {\r\n <span style=\"display: flex; align-items: center;\">\r\n <button matTooltipPosition=\"before\"\r\n [matTooltip]=\"`View and review **` + row[vm.columnMapping.respondentNameKey]+ `** 's' Submission`\"\r\n (click)=\"viewMicroSubmission(row)\" mat-icon-button>\r\n <mat-icon>preview</mat-icon>\r\n </button>\r\n </span>\r\n } @else if (col.formControlName === 'adj_microFlow_supplierAppointed') {\r\n @if (row[col.formControlName] === true) {\r\n <button (click)=\"appointASupplier(row)\" mat-flat-button color=\"primary\">\r\n <mat-icon>\r\n check_circle\r\n </mat-icon>\r\n Appointed\r\n </button>\r\n } @else {\r\n <button (click)=\"appointASupplier(row)\" mat-stroked-button>\r\n Appoint\r\n </button>\r\n }\r\n } @else {\r\n @switch (col?.type) {\r\n @case ('daysAgo') {\r\n {{ row[col.formControlName] | daysAgo }}\r\n }\r\n @case ('number') {\r\n {{ (row[col.formControlName] | number:'0.0-0' ) || 'N/A' }}\r\n }\r\n @default {\r\n @if ($index === 0) {\r\n <span class=\"main-submission-text\">\r\n <mat-icon style=\"font-size: 1em;height:16px;width:16px\">domain</mat-icon>\r\n <strong>\r\n {{ row[col.formControlName] }}\r\n </strong>\r\n </span>\r\n <span class=\"secondary-text\">\r\n <mat-icon>fingerprint</mat-icon>\r\n {{ row[vm.columnMapping.respondentCodeKey] }}\r\n <mat-icon>more_time</mat-icon>\r\n {{ row[vm.columnMapping.responseDateKey ||''] | daysAgo }}\r\n </span>\r\n } @else {\r\n {{ row[col.formControlName] }}\r\n }\r\n }\r\n }\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n <tr mat-header-row *matHeaderRowDef=\"vm.displayCols\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: vm.displayCols\"></tr>\r\n </table>\r\n }\r\n </lib-adjudication-shell>\r\n }\r\n}\r\n", styles: [".number{display:flex;justify-content:space-between;align-items:center}li{font-size:.75em}ol,ul{margin-top:8px}.number-cell{display:flex;justify-content:space-between;align-items:center;width:100%}.secondary-text{display:flex;align-items:center;white-space:pre;font-size:.75em;gap:8px;opacity:.8}.secondary-text mat-icon{font-size:.875em;width:14px;height:14px}.mat-column-adj_microFlow_review{max-width:18px;text-align:center}.mat-column-nameOfBidder{max-width:90px}.mat-column-actions{padding:0;max-width:80px}.mat-column-status{padding-left:8px;padding-right:8px;max-width:fit-content!important}.main-submission-text{display:flex;align-items:center;gap:8px;font-size:.875em}:host .notes-card{width:100%;max-width:480px;resize:both;height:fit-content}.smallIcon{font-size:.875em;width:14px;height:14px}.table-cell{padding-left:4px;padding-right:4px}.mat-column-adjudicationPricePreferenceCalculation,.mat-column-adj_microFlow_scoreSheetTotalPoints,.mat-column-adj_microFlow_pointsAwarded,.mat-column-adj_microFlow_pricePointCalculation{max-width:18px;text-align:center}.mat-column-adj_microFlow_supplierAppointed{max-width:50px;text-align:center}.mat-column-actions{max-width:14px;text-align:center}.ngx-t-forms-point-assignment-menu{width:fit-content!important;max-width:400px!important}.point-assignment-menu{padding-left:28px;padding-right:28px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatRippleModule }, { kind: "directive", type: i7.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5$2.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5$2.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5$2.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5$2.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5$2.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5$2.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5$2.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5$2.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5$2.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5$2.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: AdjudicationShellComponent, selector: "lib-adjudication-shell", inputs: ["label", "system", "docsContext", "chart"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: DecimalPipe, name: "number" }, { kind: "pipe", type: DaysAgoPipe, name: "daysAgo" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2010
+ }
2011
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SupplierSelectionComponent, decorators: [{
2012
+ type: Component,
2013
+ args: [{ selector: 'lib-supplier-selection', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
2014
+ AsyncPipe,
2015
+ DecimalPipe,
2016
+ FormsModule,
2017
+ MatButtonModule,
2018
+ MatDialogModule,
2019
+ MatIconModule,
2020
+ MatProgressSpinnerModule,
2021
+ MatRippleModule,
2022
+ MatTableModule,
2023
+ MatTooltipModule,
2024
+ DaysAgoPipe,
2025
+ AdjudicationShellComponent,
2026
+ ], template: "@if (vm$ | async; as vm) {\r\n @if (vm.loading) {\r\n <div style=\"display: flex; justify-content: center; align-items: center; padding:24px;width: 100%;\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n } @else if (vm.error) {\r\n <div class=\"info-card error-card\">\r\n <!-- Heading stays cause-neutral: vm.error states WHICH half failed\r\n (the fetch vs. displaying data that did arrive). -->\r\n <h5 class=\"info-title\">\u274C Unable to show submissions</h5>\r\n <p>{{ vm.error }}</p>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\">\r\n Try Again\r\n </button>\r\n </div>\r\n } @else {\r\n <lib-adjudication-shell label=\"Supplier selection\" [system]=\"vm.docsContext.system\" [docsContext]=\"vm.docsContext\" [chart]=\"vm.chart\">\r\n\r\n @if (vm.submissions.length === 0) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\u2139\uFE0F There are no submissions to display.</h5>\r\n <ul>\r\n <li>This can happen if <strong>no one has responded</strong> yet, or if <strong>none of the submission were\r\n compliant </strong>.</li>\r\n <li>If you are expecting to see submissions, try clicking the <strong>Refresh</strong> button.</li>\r\n </ul>\r\n <button mat-raised-button color=\"primary\" (click)=\"loadMicroSubmissions()\" class=\"load-button\">\r\n Refresh\r\n </button>\r\n </div>\r\n } @else {\r\n\r\n @if (!value || value.length === 0) {\r\n <div class=\"info-card\">\r\n <h5 class=\"info-title\">\uD83D\uDCDD How to Appoint</h5>\r\n <ol>\r\n <li>\r\n <strong>View Response:</strong> Click the <strong>Preview</strong> (<mat-icon\r\n class=\"smallIcon\">preview</mat-icon>) icon to see the full submission.\r\n </li>\r\n <li>\r\n <strong>Appoint:</strong> Click the <strong>Appoint</strong> button to appoint the supplier.\r\n </li>\r\n\r\n </ol>\r\n </div>\r\n }\r\n <table mat-table [dataSource]=\"vm.submissions\">\r\n @for (col of vm.displayColumns; track col.formControlName) {\r\n <ng-container [matColumnDef]=\"col.formControlName\">\r\n <th mat-header-cell *matHeaderCellDef style=\"padding:4px\">\r\n {{ col.label }}\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\" mat-ripple class=\"table-cell\" (click)=\"$event.stopPropagation()\"\r\n [class.price-preference-cell]=\"true\" [style.border-bottom-color]=\"row.colColors[col.formControlName]\"\r\n [style.background]=\"row.backgroundShades?.[col.formControlName]\">\r\n @if (col.formControlName === 'actions') {\r\n <span style=\"display: flex; align-items: center;\">\r\n <button matTooltipPosition=\"before\"\r\n [matTooltip]=\"`View and review **` + row[vm.columnMapping.respondentNameKey]+ `** 's' Submission`\"\r\n (click)=\"viewMicroSubmission(row)\" mat-icon-button>\r\n <mat-icon>preview</mat-icon>\r\n </button>\r\n </span>\r\n } @else if (col.formControlName === 'adj_microFlow_supplierAppointed') {\r\n @if (row[col.formControlName] === true) {\r\n <button (click)=\"appointASupplier(row)\" mat-flat-button color=\"primary\">\r\n <mat-icon>\r\n check_circle\r\n </mat-icon>\r\n Appointed\r\n </button>\r\n } @else {\r\n <button (click)=\"appointASupplier(row)\" mat-stroked-button>\r\n Appoint\r\n </button>\r\n }\r\n } @else {\r\n @switch (col?.type) {\r\n @case ('daysAgo') {\r\n {{ row[col.formControlName] | daysAgo }}\r\n }\r\n @case ('number') {\r\n {{ (row[col.formControlName] | number:'0.0-0' ) || 'N/A' }}\r\n }\r\n @default {\r\n @if ($index === 0) {\r\n <span class=\"main-submission-text\">\r\n <mat-icon style=\"font-size: 1em;height:16px;width:16px\">domain</mat-icon>\r\n <strong>\r\n {{ row[col.formControlName] }}\r\n </strong>\r\n </span>\r\n <span class=\"secondary-text\">\r\n <mat-icon>fingerprint</mat-icon>\r\n {{ row[vm.columnMapping.respondentCodeKey] }}\r\n <mat-icon>more_time</mat-icon>\r\n {{ row[vm.columnMapping.responseDateKey ||''] | daysAgo }}\r\n </span>\r\n } @else {\r\n {{ row[col.formControlName] }}\r\n }\r\n }\r\n }\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n <tr mat-header-row *matHeaderRowDef=\"vm.displayCols\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: vm.displayCols\"></tr>\r\n </table>\r\n }\r\n </lib-adjudication-shell>\r\n }\r\n}\r\n", styles: [".number{display:flex;justify-content:space-between;align-items:center}li{font-size:.75em}ol,ul{margin-top:8px}.number-cell{display:flex;justify-content:space-between;align-items:center;width:100%}.secondary-text{display:flex;align-items:center;white-space:pre;font-size:.75em;gap:8px;opacity:.8}.secondary-text mat-icon{font-size:.875em;width:14px;height:14px}.mat-column-adj_microFlow_review{max-width:18px;text-align:center}.mat-column-nameOfBidder{max-width:90px}.mat-column-actions{padding:0;max-width:80px}.mat-column-status{padding-left:8px;padding-right:8px;max-width:fit-content!important}.main-submission-text{display:flex;align-items:center;gap:8px;font-size:.875em}:host .notes-card{width:100%;max-width:480px;resize:both;height:fit-content}.smallIcon{font-size:.875em;width:14px;height:14px}.table-cell{padding-left:4px;padding-right:4px}.mat-column-adjudicationPricePreferenceCalculation,.mat-column-adj_microFlow_scoreSheetTotalPoints,.mat-column-adj_microFlow_pointsAwarded,.mat-column-adj_microFlow_pricePointCalculation{max-width:18px;text-align:center}.mat-column-adj_microFlow_supplierAppointed{max-width:50px;text-align:center}.mat-column-actions{max-width:14px;text-align:center}.ngx-t-forms-point-assignment-menu{width:fit-content!important;max-width:400px!important}.point-assignment-menu{padding-left:28px;padding-right:28px}\n"] }]
2027
+ }], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: false }] }], supplierSelection: [{ type: i0.Output, args: ["supplierSelection"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
2028
+
2029
+ const customInputConfig = {
2030
+ controlType: 'lib-workflow-adjudication-reactive-input',
2031
+ nextId: 0,
2032
+ };
2033
+ class WorkflowAdjudicationReactiveInputComponent extends BaseCustomInput {
2034
+ get empty() {
2035
+ return this.value === null || this.value === undefined || Object.keys(this.value).length === 0;
2036
+ }
2037
+ get shouldLabelFloat() {
2038
+ return this.focused || !this.empty;
2039
+ }
2040
+ constructor() {
2041
+ super(inject(NgControl, { self: true, optional: true }), inject(ElementRef), customInputConfig);
2042
+ this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
2043
+ this.editorMode = input(false, ...(ngDevMode ? [{ debugName: "editorMode" }] : /* istanbul ignore next */ []));
2044
+ this.formBuilderFunctions = input(undefined, ...(ngDevMode ? [{ debugName: "formBuilderFunctions" }] : /* istanbul ignore next */ []));
2045
+ this.adjudicationSteps = AdjudicationSteps;
2046
+ }
2047
+ setValue(value) {
2048
+ this.value = value;
2049
+ this.onChange(value);
2050
+ this.onTouched();
2051
+ }
2052
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: WorkflowAdjudicationReactiveInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2053
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: WorkflowAdjudicationReactiveInputComponent, isStandalone: true, selector: "lib-workflow-adjudication-reactive-input", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: true, transformFunction: null }, editorMode: { classPropertyName: "editorMode", publicName: "editorMode", isSignal: true, isRequired: false, transformFunction: null }, formBuilderFunctions: { classPropertyName: "formBuilderFunctions", publicName: "formBuilderFunctions", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.floating": "shouldLabelFloat", "id": "id" } }, providers: [{ provide: MatFormFieldControl, useExisting: WorkflowAdjudicationReactiveInputComponent }], usesInheritance: true, ngImport: i0, template: "@switch (inputConfig().adjudicationStep) {\r\n@case (adjudicationSteps.ScoreCreation) {\r\n<lib-points-creation [inputConfig]=\"inputConfig()\" [value]=\"value\" (pointsChange)=\"setValue($event)\">\r\n</lib-points-creation>\r\n}\r\n@case (adjudicationSteps.SubMissionReview) {\r\n<lib-submission-review [inputConfig]=\"inputConfig()\" [value]=\"value\"\r\n (reviewChange)=\"setValue($event)\"></lib-submission-review>\r\n}\r\n@case (adjudicationSteps.SupplierSelection) {\r\n<lib-supplier-selection [inputConfig]=\"inputConfig()\" [value]=\"value\"\r\n (supplierSelection)=\"setValue($event)\"></lib-supplier-selection>\r\n}\r\n@case (adjudicationSteps.PointAssignment) {\r\n<lib-point-assignment [inputConfig]=\"inputConfig()\" [value]=\"value\"\r\n (pointsChange)=\"setValue($event)\"></lib-point-assignment>\r\n}\r\n@default {\r\n<h6>\r\n {{ inputConfig().adjudicationStep | titlecase }} is not implemented yet.\r\n</h6>\r\n}\r\n}\r\n", styles: [".input-add{width:100%}th,td{padding:4px}mat-hint{text-align:start}.glass{background:#ffffff40!important;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}.mat-column-totalPoints{width:100px!important;max-width:100px!important}.mat-column-pointType{width:180px!important;max-width:180px!important}.mat-column-actions{width:78px!important;max-width:78px!important}li{font-size:.75em}ol{margin-top:8px}\n"], dependencies: [{ kind: "component", type: PointsCreationComponent, selector: "lib-points-creation", inputs: ["inputConfig", "value"], outputs: ["pointsChange"] }, { kind: "component", type: SubmissionReviewComponent, selector: "lib-submission-review", inputs: ["inputConfig", "value"], outputs: ["reviewChange"] }, { kind: "component", type: SupplierSelectionComponent, selector: "lib-supplier-selection", inputs: ["inputConfig", "value"], outputs: ["supplierSelection"] }, { kind: "component", type: PointAssignmentComponent, selector: "lib-point-assignment", inputs: ["inputConfig", "value"], outputs: ["pointsChange"] }, { kind: "pipe", type: TitleCasePipe, name: "titlecase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2054
+ }
2055
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: WorkflowAdjudicationReactiveInputComponent, decorators: [{
2056
+ type: Component,
2057
+ args: [{ selector: 'lib-workflow-adjudication-reactive-input', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
2058
+ '[class.floating]': 'shouldLabelFloat',
2059
+ '[id]': 'id',
2060
+ }, imports: [
2061
+ TitleCasePipe,
2062
+ PointsCreationComponent,
2063
+ SubmissionReviewComponent,
2064
+ SupplierSelectionComponent,
2065
+ PointAssignmentComponent,
2066
+ ], providers: [{ provide: MatFormFieldControl, useExisting: WorkflowAdjudicationReactiveInputComponent }], template: "@switch (inputConfig().adjudicationStep) {\r\n@case (adjudicationSteps.ScoreCreation) {\r\n<lib-points-creation [inputConfig]=\"inputConfig()\" [value]=\"value\" (pointsChange)=\"setValue($event)\">\r\n</lib-points-creation>\r\n}\r\n@case (adjudicationSteps.SubMissionReview) {\r\n<lib-submission-review [inputConfig]=\"inputConfig()\" [value]=\"value\"\r\n (reviewChange)=\"setValue($event)\"></lib-submission-review>\r\n}\r\n@case (adjudicationSteps.SupplierSelection) {\r\n<lib-supplier-selection [inputConfig]=\"inputConfig()\" [value]=\"value\"\r\n (supplierSelection)=\"setValue($event)\"></lib-supplier-selection>\r\n}\r\n@case (adjudicationSteps.PointAssignment) {\r\n<lib-point-assignment [inputConfig]=\"inputConfig()\" [value]=\"value\"\r\n (pointsChange)=\"setValue($event)\"></lib-point-assignment>\r\n}\r\n@default {\r\n<h6>\r\n {{ inputConfig().adjudicationStep | titlecase }} is not implemented yet.\r\n</h6>\r\n}\r\n}\r\n", styles: [".input-add{width:100%}th,td{padding:4px}mat-hint{text-align:start}.glass{background:#ffffff40!important;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}.mat-column-totalPoints{width:100px!important;max-width:100px!important}.mat-column-pointType{width:180px!important;max-width:180px!important}.mat-column-actions{width:78px!important;max-width:78px!important}li{font-size:.75em}ol{margin-top:8px}\n"] }]
2067
+ }], ctorParameters: () => [], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: true }] }], editorMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "editorMode", required: false }] }], formBuilderFunctions: [{ type: i0.Input, args: [{ isSignal: true, alias: "formBuilderFunctions", required: false }] }] } });
2068
+
2069
+ /** Wraps a workflow-adjudication reactive control inside a `mat-form-field`. */
2070
+ class WorkflowAdjudicationComponent {
2071
+ constructor() {
2072
+ this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
2073
+ this.formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
2074
+ this.editorMode = input(false, ...(ngDevMode ? [{ debugName: "editorMode" }] : /* istanbul ignore next */ []));
2075
+ this.formBuilderFunctions = input(undefined, ...(ngDevMode ? [{ debugName: "formBuilderFunctions" }] : /* istanbul ignore next */ []));
2076
+ this.reload = output();
2077
+ this.errorMessage = computed(() => getInputErrorMessage(this.inputConfig(), this.formGroup()), ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
2078
+ }
2079
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: WorkflowAdjudicationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2080
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: WorkflowAdjudicationComponent, isStandalone: true, selector: "lib-workflow-adjudication", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: true, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, editorMode: { classPropertyName: "editorMode", publicName: "editorMode", isSignal: true, isRequired: false, transformFunction: null }, formBuilderFunctions: { classPropertyName: "formBuilderFunctions", publicName: "formBuilderFunctions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reload: "reload" }, ngImport: i0, template: "<form [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field\r\n [appearance]=\"inputConfig.appearance || 'fill'\"\r\n [floatLabel]=\"'always'\"\r\n subscriptSizing=\"dynamic\"\r\n >\r\n <mat-label>\r\n {{ inputConfig.label }}\r\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\r\n </mat-label>\r\n\r\n <lib-workflow-adjudication-reactive-input\r\n [inputConfig]=\"inputConfig\"\r\n [formControlName]=\"inputConfig.id\"\r\n [required]=\"inputConfig.required\"\r\n [formGroup]=\"formGroup()\"\r\n [editorMode]=\"editorMode()\"\r\n [formBuilderFunctions]=\"formBuilderFunctions()\"\r\n ></lib-workflow-adjudication-reactive-input>\r\n\r\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\r\n <mat-hint class=\"inputHint\">\r\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\r\n </mat-hint>\r\n }\r\n\r\n @if (!!errorMessage()) {\r\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\r\n }\r\n\r\n @if (inputConfig.canReload?.canReload) {\r\n <button\r\n mat-icon-button\r\n style=\"margin-right: 4px;\"\r\n matTooltip=\"Click to refresh this field.\"\r\n class=\"input-sync-button\"\r\n (click)=\"inputConfig.canReload.emit()\"\r\n matSuffix\r\n >\r\n <mat-icon style=\"color: var(--mat-sys-primary)\">sync</mat-icon>\r\n </button>\r\n }\r\n\r\n @if (inputConfig.prefixIcon) {\r\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\r\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.prefixText) {\r\n <span matPrefix style=\"top: 0\">{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span matSuffix style=\"padding-left: 5px\">{{ inputConfig.suffixText }}</span>\r\n }\r\n\r\n @if (inputConfig.maxLength && formGroup()) {\r\n <mat-hint align=\"end\">\r\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n</form>\r\n", styles: ["mat-form-field{width:100%}mat-form-field .input-sync-button{display:none}mat-form-field:hover .input-sync-button{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: TFormInputStatusComponent, selector: "lib-t-form-input-status", inputs: ["inputConfig"] }, { kind: "component", type: WorkflowAdjudicationReactiveInputComponent, selector: "lib-workflow-adjudication-reactive-input", inputs: ["inputConfig", "editorMode", "formBuilderFunctions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2081
+ }
2082
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: WorkflowAdjudicationComponent, decorators: [{
2083
+ type: Component,
2084
+ args: [{ selector: 'lib-workflow-adjudication', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
2085
+ ReactiveFormsModule,
2086
+ MatFormFieldModule,
2087
+ MatIconModule,
2088
+ MatButtonModule,
2089
+ MatTooltipModule,
2090
+ TFormInputStatusComponent,
2091
+ WorkflowAdjudicationReactiveInputComponent,
2092
+ ], template: "<form [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field\r\n [appearance]=\"inputConfig.appearance || 'fill'\"\r\n [floatLabel]=\"'always'\"\r\n subscriptSizing=\"dynamic\"\r\n >\r\n <mat-label>\r\n {{ inputConfig.label }}\r\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\r\n </mat-label>\r\n\r\n <lib-workflow-adjudication-reactive-input\r\n [inputConfig]=\"inputConfig\"\r\n [formControlName]=\"inputConfig.id\"\r\n [required]=\"inputConfig.required\"\r\n [formGroup]=\"formGroup()\"\r\n [editorMode]=\"editorMode()\"\r\n [formBuilderFunctions]=\"formBuilderFunctions()\"\r\n ></lib-workflow-adjudication-reactive-input>\r\n\r\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\r\n <mat-hint class=\"inputHint\">\r\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\r\n </mat-hint>\r\n }\r\n\r\n @if (!!errorMessage()) {\r\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\r\n }\r\n\r\n @if (inputConfig.canReload?.canReload) {\r\n <button\r\n mat-icon-button\r\n style=\"margin-right: 4px;\"\r\n matTooltip=\"Click to refresh this field.\"\r\n class=\"input-sync-button\"\r\n (click)=\"inputConfig.canReload.emit()\"\r\n matSuffix\r\n >\r\n <mat-icon style=\"color: var(--mat-sys-primary)\">sync</mat-icon>\r\n </button>\r\n }\r\n\r\n @if (inputConfig.prefixIcon) {\r\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\r\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.prefixText) {\r\n <span matPrefix style=\"top: 0\">{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span matSuffix style=\"padding-left: 5px\">{{ inputConfig.suffixText }}</span>\r\n }\r\n\r\n @if (inputConfig.maxLength && formGroup()) {\r\n <mat-hint align=\"end\">\r\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n</form>\r\n", styles: ["mat-form-field{width:100%}mat-form-field .input-sync-button{display:none}mat-form-field:hover .input-sync-button{display:inline-block}\n"] }]
2093
+ }], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: true }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], editorMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "editorMode", required: false }] }], formBuilderFunctions: [{ type: i0.Input, args: [{ isSignal: true, alias: "formBuilderFunctions", required: false }] }], reload: [{ type: i0.Output, args: ["reload"] }] } });
2094
+
2095
+ export { WorkflowAdjudicationComponent };
2096
+ //# sourceMappingURL=ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs.map