@acorex-platform/module-maintenance-management-client 0.0.32 → 0.0.37

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 (168) hide show
  1. package/fesm2022/{acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-BiQlJxPX.mjs → acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-BI7RNP_h.mjs} +13 -13
  2. package/fesm2022/{acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-BiQlJxPX.mjs.map → acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-BI7RNP_h.mjs.map} +1 -1
  3. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type-asset-type.mjs +361 -0
  4. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type-asset-type.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type-resource.mjs +432 -0
  6. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type-resource.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type.mjs +471 -0
  8. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-cause.mjs +491 -0
  10. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-cause.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-detection.mjs +491 -0
  12. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-detection.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-effect.mjs +371 -0
  14. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-effect.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mechanism.mjs +491 -0
  16. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mechanism.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-asset-type.mjs +453 -0
  18. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-asset-type.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-mechanism.mjs +328 -0
  20. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-mechanism.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-solution.mjs +496 -0
  22. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-solution.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode.mjs +723 -0
  24. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-cause.mjs +328 -0
  26. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-cause.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-effect.mjs +328 -0
  28. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-effect.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-mechanism.mjs +328 -0
  30. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-mechanism.mjs.map +1 -0
  31. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register.mjs +809 -0
  32. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register.mjs.map +1 -0
  33. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-severity.mjs +339 -0
  34. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-severity.mjs.map +1 -0
  35. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-type.mjs +496 -0
  36. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-failure-type.mjs.map +1 -0
  37. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-plan.mjs +613 -0
  38. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-plan.mjs.map +1 -0
  39. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-activity-type.mjs +401 -0
  40. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-activity-type.mjs.map +1 -0
  41. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-failure-mode.mjs +356 -0
  42. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-failure-mode.mjs.map +1 -0
  43. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-resource.mjs +458 -0
  44. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-resource.mjs.map +1 -0
  45. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template.mjs +622 -0
  46. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template.mjs.map +1 -0
  47. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-type.mjs +412 -0
  48. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-type.mjs.map +1 -0
  49. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-work-order.mjs +893 -0
  50. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-work-order.mjs.map +1 -0
  51. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-work-package.mjs +452 -0
  52. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-work-package.mjs.map +1 -0
  53. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-work-report.mjs +570 -0
  54. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-work-report.mjs.map +1 -0
  55. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-acorex-platform-module-maintenance-management-client-contracts-entity-catalog-DJkKh0Qa.mjs +248 -0
  56. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-acorex-platform-module-maintenance-management-client-contracts-entity-catalog-DJkKh0Qa.mjs.map +1 -0
  57. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-asset-type.entity--Kz4Kqqe.mjs +157 -0
  58. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-asset-type.entity--Kz4Kqqe.mjs.map +1 -0
  59. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-resource.entity-C2OP2EN0.mjs +228 -0
  60. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-resource.entity-C2OP2EN0.mjs.map +1 -0
  61. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type.entity-D9UUDRIS.mjs +267 -0
  62. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type.entity-D9UUDRIS.mjs.map +1 -0
  63. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-cause.entity-glUcXwS9.mjs +287 -0
  64. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-cause.entity-glUcXwS9.mjs.map +1 -0
  65. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-detection.entity-CTp1voFW.mjs +287 -0
  66. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-detection.entity-CTp1voFW.mjs.map +1 -0
  67. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-effect.entity-ClD09en8.mjs +167 -0
  68. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-effect.entity-ClD09en8.mjs.map +1 -0
  69. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mechanism.entity-BcU0-nFS.mjs +287 -0
  70. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mechanism.entity-BcU0-nFS.mjs.map +1 -0
  71. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-asset-type.entity-N37srLVb.mjs +249 -0
  72. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-asset-type.entity-N37srLVb.mjs.map +1 -0
  73. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-mechanism.entity-BkkvXk03.mjs +124 -0
  74. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-mechanism.entity-BkkvXk03.mjs.map +1 -0
  75. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-solution.entity-HlVVBMTA.mjs +292 -0
  76. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-solution.entity-HlVVBMTA.mjs.map +1 -0
  77. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode.entity-BGJP73yC.mjs +519 -0
  78. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode.entity-BGJP73yC.mjs.map +1 -0
  79. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-cause.entity-CLM9YuYF.mjs +124 -0
  80. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-cause.entity-CLM9YuYF.mjs.map +1 -0
  81. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-effect.entity-DpLYMLsi.mjs +124 -0
  82. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-effect.entity-DpLYMLsi.mjs.map +1 -0
  83. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-mechanism.entity-DqU2wP0I.mjs +124 -0
  84. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-mechanism.entity-DqU2wP0I.mjs.map +1 -0
  85. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register.entity-BPZwEGE9.mjs +605 -0
  86. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register.entity-BPZwEGE9.mjs.map +1 -0
  87. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-severity.entity-DaMUJOID.mjs +135 -0
  88. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-severity.entity-DaMUJOID.mjs.map +1 -0
  89. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-type.entity-DkhVvBOh.mjs +292 -0
  90. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-type.entity-DkhVvBOh.mjs.map +1 -0
  91. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-plan.entity-WCiP2h8H.mjs +409 -0
  92. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-plan.entity-WCiP2h8H.mjs.map +1 -0
  93. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-activity-type.entity-FWn7bmMX.mjs +197 -0
  94. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-activity-type.entity-FWn7bmMX.mjs.map +1 -0
  95. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-failure-mode.entity-DC5GTHYM.mjs +152 -0
  96. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-failure-mode.entity-DC5GTHYM.mjs.map +1 -0
  97. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-resource.entity-O6y3Q3U6.mjs +254 -0
  98. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-resource.entity-O6y3Q3U6.mjs.map +1 -0
  99. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template.entity-DFDajM9U.mjs +418 -0
  100. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template.entity-DFDajM9U.mjs.map +1 -0
  101. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-type.entity-CGSHreth.mjs +208 -0
  102. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-type.entity-CGSHreth.mjs.map +1 -0
  103. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-order.entity-GaQSPAmn.mjs +689 -0
  104. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-order.entity-GaQSPAmn.mjs.map +1 -0
  105. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-package.entity-CJE8Txjo.mjs +248 -0
  106. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-package.entity-CJE8Txjo.mjs.map +1 -0
  107. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-report.entity-BrActlGh.mjs +366 -0
  108. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-report.entity-BrActlGh.mjs.map +1 -0
  109. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog.mjs +2 -0
  110. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog.mjs.map +1 -0
  111. package/fesm2022/acorex-platform-module-maintenance-management-client-contracts.mjs.map +1 -1
  112. package/fesm2022/{acorex-platform-module-maintenance-management-client-create-or-get-work-report-draft.activity-xxvOfIxf.mjs → acorex-platform-module-maintenance-management-client-create-or-get-work-report-draft.activity-By_yjJjy.mjs} +2 -2
  113. package/fesm2022/{acorex-platform-module-maintenance-management-client-create-or-get-work-report-draft.activity-xxvOfIxf.mjs.map → acorex-platform-module-maintenance-management-client-create-or-get-work-report-draft.activity-By_yjJjy.mjs.map} +1 -1
  114. package/fesm2022/acorex-platform-module-maintenance-management-client-failure-register-status.provider-CLBaQy_e.mjs.map +1 -1
  115. package/fesm2022/acorex-platform-module-maintenance-management-client-fill-work-report-completion.command-Capowl1e.mjs.map +1 -1
  116. package/fesm2022/acorex-platform-module-maintenance-management-client-local-entities.mjs +54 -0
  117. package/fesm2022/acorex-platform-module-maintenance-management-client-local-entities.mjs.map +1 -0
  118. package/fesm2022/acorex-platform-module-maintenance-management-client-open-work-report-from-work-order.command-B0O4fWPt.mjs.map +1 -1
  119. package/fesm2022/{acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-CxRfaf0G.mjs → acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-CcH5qKzv.mjs} +2 -2
  120. package/fesm2022/{acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-CxRfaf0G.mjs.map → acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-CcH5qKzv.mjs.map} +1 -1
  121. package/fesm2022/acorex-platform-module-maintenance-management-client-resolve-person-user-id.activity-nwXAJHkd.mjs.map +1 -1
  122. package/fesm2022/acorex-platform-module-maintenance-management-client-resolve-work-order.activity-q5WM7Sv5.mjs.map +1 -1
  123. package/fesm2022/{acorex-platform-module-maintenance-management-client-start-work-order-flow.command-B06a962Y.mjs → acorex-platform-module-maintenance-management-client-start-work-order-flow.command-CVlDdtxW.mjs} +2 -2
  124. package/fesm2022/{acorex-platform-module-maintenance-management-client-start-work-order-flow.command-B06a962Y.mjs.map → acorex-platform-module-maintenance-management-client-start-work-order-flow.command-CVlDdtxW.mjs.map} +1 -1
  125. package/fesm2022/acorex-platform-module-maintenance-management-client-update-work-order-completed.activity-Di4R6LQl.mjs.map +1 -1
  126. package/fesm2022/{acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-CzkCCl1L.mjs → acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-CZwXs7XY.mjs} +2 -2
  127. package/fesm2022/{acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-CzkCCl1L.mjs.map → acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-CZwXs7XY.mjs.map} +1 -1
  128. package/fesm2022/acorex-platform-module-maintenance-management-client-update-work-report-on-completion.activity-_B0SUFtQ.mjs.map +1 -1
  129. package/fesm2022/acorex-platform-module-maintenance-management-client-validate-work-order-completion.activity-RA2zaQHH.mjs.map +1 -1
  130. package/fesm2022/acorex-platform-module-maintenance-management-client-work-order-list-command-Bh_6PS5w.mjs.map +1 -1
  131. package/fesm2022/acorex-platform-module-maintenance-management-client-work-order-status.provider-DvBk5kAW.mjs.map +1 -1
  132. package/fesm2022/{acorex-platform-module-maintenance-management-client-work-order-work-report-column.component-Bf1WZWIS.mjs → acorex-platform-module-maintenance-management-client-work-order-work-report-column.component-BikBvmHi.mjs} +2 -2
  133. package/fesm2022/{acorex-platform-module-maintenance-management-client-work-order-work-report-column.component-Bf1WZWIS.mjs.map → acorex-platform-module-maintenance-management-client-work-order-work-report-column.component-BikBvmHi.mjs.map} +1 -1
  134. package/fesm2022/{acorex-platform-module-maintenance-management-client-work-order-workflow-column.component-Dth3Z9fW.mjs → acorex-platform-module-maintenance-management-client-work-order-workflow-column.component-yzj-D7MB.mjs} +3 -3
  135. package/fesm2022/{acorex-platform-module-maintenance-management-client-work-order-workflow-column.component-Dth3Z9fW.mjs.map → acorex-platform-module-maintenance-management-client-work-order-workflow-column.component-yzj-D7MB.mjs.map} +1 -1
  136. package/fesm2022/acorex-platform-module-maintenance-management-client-work-report-assessment.util-Da1HVAit.mjs.map +1 -1
  137. package/fesm2022/{acorex-platform-module-maintenance-management-client-work-report-checklist-results-view.component-BSFW0Yt-.mjs → acorex-platform-module-maintenance-management-client-work-report-checklist-results-view.component-BgIQr5Hr.mjs} +2 -2
  138. package/fesm2022/{acorex-platform-module-maintenance-management-client-work-report-checklist-results-view.component-BSFW0Yt-.mjs.map → acorex-platform-module-maintenance-management-client-work-report-checklist-results-view.component-BgIQr5Hr.mjs.map} +1 -1
  139. package/fesm2022/acorex-platform-module-maintenance-management-client.mjs +1 -1
  140. package/package.json +113 -1
  141. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type-asset-type.d.ts +5 -0
  142. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type-resource.d.ts +5 -0
  143. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-activity-type.d.ts +5 -0
  144. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-cause.d.ts +5 -0
  145. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-detection.d.ts +5 -0
  146. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-effect.d.ts +5 -0
  147. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mechanism.d.ts +5 -0
  148. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-asset-type.d.ts +5 -0
  149. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-mechanism.d.ts +5 -0
  150. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode-solution.d.ts +5 -0
  151. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-mode.d.ts +5 -0
  152. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-cause.d.ts +5 -0
  153. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-effect.d.ts +5 -0
  154. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register-mechanism.d.ts +5 -0
  155. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-register.d.ts +5 -0
  156. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-severity.d.ts +5 -0
  157. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-failure-type.d.ts +5 -0
  158. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-plan.d.ts +5 -0
  159. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-activity-type.d.ts +5 -0
  160. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-failure-mode.d.ts +5 -0
  161. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template-resource.d.ts +5 -0
  162. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template.d.ts +5 -0
  163. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-type.d.ts +9 -0
  164. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-work-order.d.ts +7 -0
  165. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-work-package.d.ts +5 -0
  166. package/types/acorex-platform-module-maintenance-management-client-contracts-entities-work-report.d.ts +5 -0
  167. package/types/acorex-platform-module-maintenance-management-client-contracts-entity-catalog.d.ts +10 -0
  168. package/types/acorex-platform-module-maintenance-management-client-local-entities.d.ts +12 -0
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-CxRfaf0G.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/record-work-report-assessment.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport { AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE } from '../work-order-workflow.debug';\nimport type { AXMMaintenanceManagementWorkReportEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport {\n isWorkReportFinalized,\n sortWorkReportAssessments,\n upsertWorkReportAssessment,\n} from '../../../work-report/work-report-assessment.util';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface RecordWorkReportAssessmentInput {\n workOrderId: string;\n workReportId?: string | null;\n performedById?: string | null;\n assessmentCaseId: string;\n completedById?: string | null;\n}\n\nexport interface RecordWorkReportAssessmentOutput {\n workReportId: string;\n workOrderId: string;\n}\n\n//#endregion\n\n/**\n * Persists a lightweight checklist assessment reference on WorkReport after a checklist is submitted.\n * Questionnaire answers remain in AssessmentCase / AssessmentSession storage.\n */\n@Injectable({ providedIn: 'root' })\nexport class RecordWorkReportAssessmentActivity\n implements AXPCommand<RecordWorkReportAssessmentInput, RecordWorkReportAssessmentOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: RecordWorkReportAssessmentInput,\n ): AXPCommandExecuteResultPromise<RecordWorkReportAssessmentOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n const assessmentCaseId = this.resolveText(input?.assessmentCaseId);\n\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n if (!assessmentCaseId) {\n return { success: true, kind: 'object',\n data: { workReportId: this.resolveText(input.workReportId), workOrderId },\n metadata: { outcome: 'Done' },\n };\n }\n\n const workReport = await this.resolveWorkReport(workOrderId, input);\n if (!workReport?.id) {\n return {\n success: false,\n message: { text: 'Work report could not be resolved for the work order' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n if (isWorkReportFinalized(workReport)) {\n return {\n success: false,\n message: { text: 'Work report is finalized and cannot be updated' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const assessmentCase = await this.loadAssessmentCase(assessmentCaseId);\n const completedById = this.resolveText(input.completedById);\n const assessments = sortWorkReportAssessments(\n upsertWorkReportAssessment(workReport.assessments, {\n assessmentCaseId,\n assessmentCaseTitle: assessmentCase?.title as never,\n completedAt: new Date().toISOString(),\n completedById: completedById || null,\n }),\n );\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .update(workReport.id, { assessments } as never);\n\n this.debug.trace(\n AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE,\n 'work-report-assessment',\n 'Recorded checklist reference on work report',\n { workOrderId, workReportId: workReport.id, assessmentCaseId, assessmentCount: assessments.length },\n );\n\n return { success: true, kind: 'object',\n data: { workReportId: workReport.id, workOrderId },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private async resolveWorkReport(\n workOrderId: string,\n input: RecordWorkReportAssessmentInput,\n ): Promise<AXMMaintenanceManagementWorkReportEntityModel | null> {\n const workReportId = this.resolveText(input.workReportId);\n if (workReportId) {\n const byId = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .byKey(workReportId)) as AXMMaintenanceManagementWorkReportEntityModel | null;\n\n if (byId?.id && this.resolveText(byId.workOrderId) === workOrderId) {\n return byId;\n }\n }\n\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .query({\n skip: 0,\n take: 1,\n filter: {\n logic: 'and',\n filters: [{ field: 'workOrderId', operator: { type: 'equal' }, value: workOrderId }],\n },\n } as never);\n\n const existing = defaultTo(get(page, 'items[0]'), null) as AXMMaintenanceManagementWorkReportEntityModel | null;\n if (existing?.id) {\n return existing;\n }\n\n const performedById = this.resolveText(input.performedById);\n if (!performedById) {\n return null;\n }\n\n const now = new Date().toISOString();\n const createdId = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .create({\n workOrderId,\n reportedAt: now,\n performedById,\n startedAt: now,\n finalizedAt: null,\n assessments: [],\n } as never);\n\n const id = this.resolveText(createdId);\n if (!id) {\n return null;\n }\n\n return (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .byKey(id)) as AXMMaintenanceManagementWorkReportEntityModel | null;\n }\n\n private async loadAssessmentCase(assessmentCaseId: string): Promise<{ title?: unknown } | null> {\n try {\n return (await this.entityService\n .withEntity('AssessmentManagement', 'AssessmentCase')\n .data()\n .byKey(assessmentCaseId)) as { title?: unknown } | null;\n } catch {\n return null;\n }\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AAmCA;AAEA;;;AAGG;MAEU,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;AA8JjD,IAAA;;;IAxJC,MAAM,OAAO,CACX,KAAsC,EAAA;QAEtC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC;QAElE,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;AAC5C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;QAEA,IAAI,CAAC,gBAAgB,EAAE;AACrB,YAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ;AACpC,gBAAA,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE;AACzE,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;aAC9B;QACH;QAEA,MAAM,UAAU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,IAAI;AACJ,iBAAA,KAAK,CAAC,gBAAgB,CAAC;QAC5B;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,IAAI;QACb;IACF;AAEQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GAjKW,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cADrB,MAAM,EAAA,CAAA,CAAA;;2FACnB,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAD9C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-CcH5qKzv.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/record-work-report-assessment.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport { AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE } from '../work-order-workflow.debug';\nimport type { AXMMaintenanceManagementWorkReportEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport {\n isWorkReportFinalized,\n sortWorkReportAssessments,\n upsertWorkReportAssessment,\n} from '../../../work-report/work-report-assessment.util';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface RecordWorkReportAssessmentInput {\n workOrderId: string;\n workReportId?: string | null;\n performedById?: string | null;\n assessmentCaseId: string;\n completedById?: string | null;\n}\n\nexport interface RecordWorkReportAssessmentOutput {\n workReportId: string;\n workOrderId: string;\n}\n\n//#endregion\n\n/**\n * Persists a lightweight checklist assessment reference on WorkReport after a checklist is submitted.\n * Questionnaire answers remain in AssessmentCase / AssessmentSession storage.\n */\n@Injectable({ providedIn: 'root' })\nexport class RecordWorkReportAssessmentActivity\n implements AXPCommand<RecordWorkReportAssessmentInput, RecordWorkReportAssessmentOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: RecordWorkReportAssessmentInput,\n ): AXPCommandExecuteResultPromise<RecordWorkReportAssessmentOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n const assessmentCaseId = this.resolveText(input?.assessmentCaseId);\n\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n if (!assessmentCaseId) {\n return { success: true, kind: 'object',\n data: { workReportId: this.resolveText(input.workReportId), workOrderId },\n metadata: { outcome: 'Done' },\n };\n }\n\n const workReport = await this.resolveWorkReport(workOrderId, input);\n if (!workReport?.id) {\n return {\n success: false,\n message: { text: 'Work report could not be resolved for the work order' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n if (isWorkReportFinalized(workReport)) {\n return {\n success: false,\n message: { text: 'Work report is finalized and cannot be updated' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const assessmentCase = await this.loadAssessmentCase(assessmentCaseId);\n const completedById = this.resolveText(input.completedById);\n const assessments = sortWorkReportAssessments(\n upsertWorkReportAssessment(workReport.assessments, {\n assessmentCaseId,\n assessmentCaseTitle: assessmentCase?.title as never,\n completedAt: new Date().toISOString(),\n completedById: completedById || null,\n }),\n );\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .update(workReport.id, { assessments } as never);\n\n this.debug.trace(\n AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE,\n 'work-report-assessment',\n 'Recorded checklist reference on work report',\n { workOrderId, workReportId: workReport.id, assessmentCaseId, assessmentCount: assessments.length },\n );\n\n return { success: true, kind: 'object',\n data: { workReportId: workReport.id, workOrderId },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private async resolveWorkReport(\n workOrderId: string,\n input: RecordWorkReportAssessmentInput,\n ): Promise<AXMMaintenanceManagementWorkReportEntityModel | null> {\n const workReportId = this.resolveText(input.workReportId);\n if (workReportId) {\n const byId = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .byKey(workReportId)) as AXMMaintenanceManagementWorkReportEntityModel | null;\n\n if (byId?.id && this.resolveText(byId.workOrderId) === workOrderId) {\n return byId;\n }\n }\n\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .query({\n skip: 0,\n take: 1,\n filter: {\n logic: 'and',\n filters: [{ field: 'workOrderId', operator: { type: 'equal' }, value: workOrderId }],\n },\n } as never);\n\n const existing = defaultTo(get(page, 'items[0]'), null) as AXMMaintenanceManagementWorkReportEntityModel | null;\n if (existing?.id) {\n return existing;\n }\n\n const performedById = this.resolveText(input.performedById);\n if (!performedById) {\n return null;\n }\n\n const now = new Date().toISOString();\n const createdId = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .create({\n workOrderId,\n reportedAt: now,\n performedById,\n startedAt: now,\n finalizedAt: null,\n assessments: [],\n } as never);\n\n const id = this.resolveText(createdId);\n if (!id) {\n return null;\n }\n\n return (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .byKey(id)) as AXMMaintenanceManagementWorkReportEntityModel | null;\n }\n\n private async loadAssessmentCase(assessmentCaseId: string): Promise<{ title?: unknown } | null> {\n try {\n return (await this.entityService\n .withEntity('AssessmentManagement', 'AssessmentCase')\n .data()\n .byKey(assessmentCaseId)) as { title?: unknown } | null;\n } catch {\n return null;\n }\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AAmCA;AAEA;;;AAGG;MAEU,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;AA8JjD,IAAA;;;IAxJC,MAAM,OAAO,CACX,KAAsC,EAAA;QAEtC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC;QAElE,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;AAC5C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;QAEA,IAAI,CAAC,gBAAgB,EAAE;AACrB,YAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ;AACpC,gBAAA,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE;AACzE,gBAAA,QAAQ,EAAE,EAA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,iBAAA,UAAU,CAAC,sBAAsB,EAAE,gBAAgB;AACnD,iBAAA,IAAI;AACJ,iBAAA,KAAK,CAAC,gBAAgB,CAAC;QAC5B;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,IAAI;QACb;IACF;AAEQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GAjKW,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cADrB,MAAM,EAAA,CAAA,CAAA;;2FACnB,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAD9C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-resolve-person-user-id.activity-nwXAJHkd.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/resolve-person-user-id.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { isString } from 'lodash';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface ResolvePersonUserIdInput {\n personId?: string;\n}\n\nexport interface ResolvePersonUserIdOutput {\n userId: string | null;\n personId: string | null;\n}\n\n//#endregion\n\n/**\n * Resolves a PersonCore.Person id to the platform user id used by task-board assignment.\n */\n@Injectable({ providedIn: 'root' })\nexport class ResolvePersonUserIdActivity implements AXPCommand<ResolvePersonUserIdInput, ResolvePersonUserIdOutput> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ResolvePersonUserIdInput): AXPCommandExecuteResultPromise<ResolvePersonUserIdOutput> {\n const personId = this.resolveText(input?.personId);\n if (!personId) {\n return {\n success: false,\n message: { details: { userId: null, personId: null }, text: 'personId is required' },\n \n metadata: { outcome: 'Failed' },\n };\n }\n\n const person = (await this.entityService.withEntity('PersonCore', 'Person').data().byKey(personId)) as\n | { id?: string; userId?: string | null }\n | null;\n\n const userId = this.resolveText(person?.userId);\n if (!userId) {\n return {\n success: false,\n message: { details: { userId: null, personId }, text: 'Assigned person has no linked platform user.' },\n \n metadata: { outcome: 'Failed' },\n };\n }\n\n return { success: true, kind: 'object',\n data: { userId, personId },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;AAqBA;AAEA;;AAEG;MAEU,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAiD1D,IAAA;;;IA3CC,MAAM,OAAO,CAAC,KAA+B,EAAA;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;QAClD,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,EA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;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-resolve-person-user-id.activity-nwXAJHkd.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/resolve-person-user-id.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { isString } from 'lodash';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface ResolvePersonUserIdInput {\n personId?: string;\n}\n\nexport interface ResolvePersonUserIdOutput {\n userId: string | null;\n personId: string | null;\n}\n\n//#endregion\n\n/**\n * Resolves a PersonCore.Person id to the platform user id used by task-board assignment.\n */\n@Injectable({ providedIn: 'root' })\nexport class ResolvePersonUserIdActivity implements AXPCommand<ResolvePersonUserIdInput, ResolvePersonUserIdOutput> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ResolvePersonUserIdInput): AXPCommandExecuteResultPromise<ResolvePersonUserIdOutput> {\n const personId = this.resolveText(input?.personId);\n if (!personId) {\n return {\n success: false,\n message: { details: { userId: null, personId: null }, text: 'personId is required' },\n \n metadata: { outcome: 'Failed' },\n };\n }\n\n const person = (await this.entityService.withEntity('PersonCore', 'Person').data().byKey(personId)) as\n | { id?: string; userId?: string | null }\n | null;\n\n const userId = this.resolveText(person?.userId);\n if (!userId) {\n return {\n success: false,\n message: { details: { userId: null, personId }, text: 'Assigned person has no linked platform user.' },\n \n metadata: { outcome: 'Failed' },\n };\n }\n\n return { success: true, kind: 'object',\n data: { userId, personId },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;AAqBA;AAEA;;AAEG;MAEU,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAiD1D,IAAA;;;IA3CC,MAAM,OAAO,CAAC,KAA+B,EAAA;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;QAClD,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;AAEpF,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;QAEA,MAAM,MAAM,IAAI,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAE1F;QAER,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;QAC/C,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,8CAA8C,EAAE;AAEtG,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;AAEA,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ;AACpC,YAAA,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;AAC1B,YAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;SAC9B;IACH;;;AAMQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GAjDW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-resolve-work-order.activity-q5WM7Sv5.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/resolve-work-order.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface ResolveWorkOrderInput {\n workOrderId?: string;\n assignedToId?: string;\n}\n\nexport interface ResolveWorkOrderOutput {\n workOrderId: string;\n workOrderNo: string;\n assetId: string;\n assetDisplayName: string;\n assignedToId: string;\n assignedToDisplayName: string;\n maintenanceTypeId: string;\n maintenanceTypeName: string;\n maintenancePlanId: string | null;\n failureRegisterId: string | null;\n sourceType: string | null;\n dueDate: string | null;\n statusId: string | null;\n}\n\n//#endregion\n\n/**\n * Loads the existing work order and validates that an assignee is present before execution starts.\n */\n@Injectable({ providedIn: 'root' })\nexport class ResolveWorkOrderActivity implements AXPCommand<ResolveWorkOrderInput, ResolveWorkOrderOutput> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ResolveWorkOrderInput): AXPCommandExecuteResultPromise<ResolveWorkOrderOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as AXMMaintenanceManagementWorkOrderEntityModel | null;\n\n if (!workOrder?.id) {\n return {\n success: false,\n message: { text: 'Work order not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n const assignedToId = this.resolveText(input?.assignedToId) || this.resolveText(workOrder.assignedToId);\n if (!assignedToId) {\n return {\n success: false,\n message: { text: 'Assigned user is required before starting work order execution.' },\n metadata: { outcome: 'Blocked' },\n };\n }\n\n return { success: true, kind: 'object',\n data: {\n workOrderId: workOrder.id,\n workOrderNo: workOrder.workOrderNo,\n assetId: this.resolveText(workOrder.assetId),\n assetDisplayName: this.resolveDisplayName(workOrder.asset?.title, workOrder.assetId),\n assignedToId,\n assignedToDisplayName: this.resolveDisplayName(workOrder.assignedTo?.fullName, assignedToId),\n maintenanceTypeId: this.resolveText(workOrder.maintenanceTypeId),\n maintenanceTypeName: this.resolveDisplayName(workOrder.maintenanceType?.title, workOrder.maintenanceTypeId),\n maintenancePlanId: workOrder.maintenancePlanId?.trim() || null,\n failureRegisterId: workOrder.failureRegisterId?.trim() || null,\n sourceType: workOrder.sourceType?.trim() || null,\n dueDate: workOrder.scheduledEnd ?? workOrder.scheduledStart ?? null,\n statusId: workOrder.statusId ?? null,\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n private resolveDisplayName(value: unknown, fallback: string): string {\n if (isString(value) && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object') {\n const record = value as Record<string, string>;\n return record['en-US'] ?? record['fa-IR'] ?? Object.values(record)[0] ?? fallback;\n }\n return fallback;\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAoCA;AAEA;;AAEG;MAEU,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAiF1D,IAAA;;;IA3EC,MAAM,OAAO,CAAC,KAA4B,EAAA;QACxC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;AAC5C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;AAEA,QAAA,MAAM,SAAS,IAAI,MAAM,IAAI,CAAC;AAC3B,aAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AACrE,aAAA,IAAI;AACJ,aAAA,KAAK,CAAC,WAAW,CAAC,CAAwD;AAE7E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AA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-resolve-work-order.activity-q5WM7Sv5.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/resolve-work-order.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface ResolveWorkOrderInput {\n workOrderId?: string;\n assignedToId?: string;\n}\n\nexport interface ResolveWorkOrderOutput {\n workOrderId: string;\n workOrderNo: string;\n assetId: string;\n assetDisplayName: string;\n assignedToId: string;\n assignedToDisplayName: string;\n maintenanceTypeId: string;\n maintenanceTypeName: string;\n maintenancePlanId: string | null;\n failureRegisterId: string | null;\n sourceType: string | null;\n dueDate: string | null;\n statusId: string | null;\n}\n\n//#endregion\n\n/**\n * Loads the existing work order and validates that an assignee is present before execution starts.\n */\n@Injectable({ providedIn: 'root' })\nexport class ResolveWorkOrderActivity implements AXPCommand<ResolveWorkOrderInput, ResolveWorkOrderOutput> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ResolveWorkOrderInput): AXPCommandExecuteResultPromise<ResolveWorkOrderOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as AXMMaintenanceManagementWorkOrderEntityModel | null;\n\n if (!workOrder?.id) {\n return {\n success: false,\n message: { text: 'Work order not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n const assignedToId = this.resolveText(input?.assignedToId) || this.resolveText(workOrder.assignedToId);\n if (!assignedToId) {\n return {\n success: false,\n message: { text: 'Assigned user is required before starting work order execution.' },\n metadata: { outcome: 'Blocked' },\n };\n }\n\n return { success: true, kind: 'object',\n data: {\n workOrderId: workOrder.id,\n workOrderNo: workOrder.workOrderNo,\n assetId: this.resolveText(workOrder.assetId),\n assetDisplayName: this.resolveDisplayName(workOrder.asset?.title, workOrder.assetId),\n assignedToId,\n assignedToDisplayName: this.resolveDisplayName(workOrder.assignedTo?.fullName, assignedToId),\n maintenanceTypeId: this.resolveText(workOrder.maintenanceTypeId),\n maintenanceTypeName: this.resolveDisplayName(workOrder.maintenanceType?.title, workOrder.maintenanceTypeId),\n maintenancePlanId: workOrder.maintenancePlanId?.trim() || null,\n failureRegisterId: workOrder.failureRegisterId?.trim() || null,\n sourceType: workOrder.sourceType?.trim() || null,\n dueDate: workOrder.scheduledEnd ?? workOrder.scheduledStart ?? null,\n statusId: workOrder.statusId ?? null,\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n private resolveDisplayName(value: unknown, fallback: string): string {\n if (isString(value) && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object') {\n const record = value as Record<string, string>;\n return record['en-US'] ?? record['fa-IR'] ?? Object.values(record)[0] ?? fallback;\n }\n return fallback;\n }\n\n //#endregion\n}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CAAC,IAAI,EAAE;IACrB;IAEQ,kBAAkB,CAAC,KAAc,EAAE,QAAgB,EAAA;QACzD,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;AACnC,YAAA,OAAO,KAAK,CAAC,IAAI,EAAE;QACrB;AACA,QAAA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACtC,MAAM,MAAM,GAAG,KAA+B;YAC9C,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ;QACnF;AACA,QAAA,OAAO,QAAQ;IACjB;8GAjFW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -8,7 +8,7 @@ import * as i0 from '@angular/core';
8
8
  import { inject, Injectable } from '@angular/core';
9
9
  import { defaultTo, get, isString } from 'lodash';
10
10
  import { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';
11
- import { q as queryWorkflowTemplatesForAsset, r as resolveDisplayLabel } from './acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-BiQlJxPX.mjs';
11
+ import { q as queryWorkflowTemplatesForAsset, r as resolveDisplayLabel } from './acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-BI7RNP_h.mjs';
12
12
 
13
13
  //#region ---- Imports ----
14
14
  const STARTABLE_STATUSES = new Set([
@@ -399,4 +399,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
399
399
  }] });
400
400
 
401
401
  export { StartWorkOrderFlowCommand };
402
- //# sourceMappingURL=acorex-platform-module-maintenance-management-client-start-work-order-flow.command-B06a962Y.mjs.map
402
+ //# sourceMappingURL=acorex-platform-module-maintenance-management-client-start-work-order-flow.command-CVlDdtxW.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-start-work-order-flow.command-B06a962Y.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/commands/start-work-order-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport {\n AXPEntityService,\n buildAXPRecordWorkflowInfo,\n getRecordWorkflowInstanceId,\n} from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';\nimport { AXP_WORKFLOW_ENGINE, type AXPWorkflowEngine } from '@acorex-platform/framework-client/workflow';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport {\n type EntityStorageBackend,\n queryWorkflowTemplatesForAsset,\n resolveDisplayLabel,\n type MaintenanceTemplateLike,\n} from '../../../middlewares/maintenance-generation.utils';\n\n//#endregion\n\n//#region ---- Types ----\n\ninterface StartWorkOrderFlowContext {\n /** When set, applies the maintenance template on the work order before starting the workflow. */\n maintenanceTemplateId?: string;\n data?: Record<string, unknown>;\n options?: { maintenanceTemplateId?: string };\n}\n\nconst STARTABLE_STATUSES = new Set<string>([\n AXMWorkOrderStatus.Planned,\n AXMWorkOrderStatus.Scheduled,\n AXMWorkOrderStatus.Assigned,\n]);\n\n//#endregion\n\n/**\n * Starts the maintenance template workflow for a work order (execution + approval).\n */\n@Injectable({ providedIn: 'root' })\nexport class StartWorkOrderFlowCommand implements AXPCommand<StartWorkOrderFlowContext, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE) as AXPWorkflowEngine;\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly dialogService = inject(AXDialogService);\n private readonly eventService = inject(AXPBroadcastEventService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartWorkOrderFlowContext): AXPCommandExecuteResultPromise<void> {\n const row = defaultTo(get(input, 'data'), {}) as Record<string, unknown>;\n const workOrderId = this.resolveText(get(row, 'id'));\n if (!workOrderId) {\n return { success: false, message: { text: 'Work order id is required.' } };\n }\n\n if (getRecordWorkflowInstanceId(row)) {\n return { success: false };\n }\n\n let workOrder = await this.loadWorkOrder(workOrderId, row);\n if (!workOrder) {\n return { success: false, message: { text: 'Work order not found.' } };\n }\n\n const explicitTemplateId = this.resolveText(get(input, 'maintenanceTemplateId'));\n const selectedTemplateId = await this.resolveMaintenanceTemplateId(workOrder, explicitTemplateId || undefined);\n if (!selectedTemplateId) {\n return { success: false };\n }\n\n const flowPrerequisites = await this.validateFlowPrerequisites(workOrder, selectedTemplateId);\n if (!flowPrerequisites) {\n return { success: false };\n }\n\n const { workflowConfig, workflowName, assignedEmployeeId } = flowPrerequisites;\n\n if (selectedTemplateId !== workOrder.maintenanceTemplateId) {\n await this.applyMaintenanceTemplate(workOrderId, selectedTemplateId);\n workOrder = (await this.loadWorkOrder(workOrderId)) ?? workOrder;\n }\n\n const assetIdentifiers = await this.resolveAssetIdentifiers(this.resolveText(workOrder.assetId));\n const workflowInputs = this.buildWorkflowInputs(\n workOrder,\n workflowConfig,\n assignedEmployeeId,\n assetIdentifiers,\n );\n const correlationId = `${RootConfig.entities.workOrder.source}:${workOrderId}:${workflowName}`;\n\n try {\n // Start via engine only — do not use AXPWorkflowManager.start() here; it auto-runs inline\n // frontend steps (e.g. checklist fill). Human tasks must stay on the task board.\n const startResponse = await this.workflowEngine.start({\n workflowId: workflowName,\n input: {\n ...workflowInputs,\n refId: workOrderId,\n refType: RootConfig.entities.workOrder.source,\n correlationId,\n },\n });\n\n const instanceId = startResponse.instanceId;\n if (!instanceId) {\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: 'Unknown error',\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: 'Unknown error' } };\n }\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .update(workOrderId, {\n workflowInfo: buildAXPRecordWorkflowInfo({\n instanceId,\n definitionId: workflowName,\n correlationId,\n }),\n } as never);\n\n this.eventService.publish('task-board.refresh', { provider: workflowName });\n\n const taskBoardHint = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.workflow-started-use-task-board',\n );\n this.toastService.show({\n color: 'success',\n title: await this.translationService.translateAsync('@general:messages.generic.success.title'),\n content: taskBoardHint,\n closeButton: true,\n timeOut: 6000,\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('[StartWorkOrderFlowCommand]', error);\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private async loadWorkOrder(\n workOrderId: string,\n row?: Record<string, unknown>,\n ): Promise<AXMMaintenanceManagementWorkOrderEntityModel | null> {\n if (get(row, 'id') === workOrderId) {\n return row as unknown as AXMMaintenanceManagementWorkOrderEntityModel;\n }\n\n const loaded = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId);\n return (loaded as AXMMaintenanceManagementWorkOrderEntityModel | null) ?? null;\n }\n\n private async applyMaintenanceTemplate(workOrderId: string, templateId: string): Promise<void> {\n const template = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.maintenanceTemplate.name)\n .data()\n .byKey(templateId)) as {\n id?: string;\n title?: unknown;\n maintenanceTypeId?: string;\n metadataIds?: string[];\n workflowConfig?: AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig | null;\n needShutdown?: boolean;\n needPermission?: boolean;\n estimatedMinutes?: number;\n } | null;\n\n if (!template?.id) {\n throw new Error('Maintenance template not found.');\n }\n\n const estimatedHours =\n typeof template.estimatedMinutes === 'number' && template.estimatedMinutes > 0\n ? Math.round((template.estimatedMinutes / 60) * 100) / 100\n : undefined;\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .update(workOrderId, {\n maintenanceTemplateId: template.id,\n maintenanceTypeId: template.maintenanceTypeId,\n maintenanceTemplate: {\n id: template.id,\n title: template.title,\n metadataIds: template.metadataIds,\n workflowConfig: template.workflowConfig,\n },\n needShutdown: template.needShutdown ?? false,\n needPermission: template.needPermission ?? false,\n ...(estimatedHours !== undefined ? { estimatedHours } : {}),\n } as never);\n }\n\n private async resolveWorkflowConfig(\n workOrder: AXMMaintenanceManagementWorkOrderEntityModel,\n ): Promise<AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig | null> {\n let workflowConfig = workOrder.maintenanceTemplate?.workflowConfig ?? null;\n if (!workflowConfig?.workflowDefinitionId && workOrder.maintenanceTemplateId) {\n const template = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.maintenanceTemplate.name)\n .data()\n .byKey(workOrder.maintenanceTemplateId);\n workflowConfig = get(template, 'workflowConfig') ?? null;\n }\n return workflowConfig;\n }\n\n private isWorkflowEnabled(\n workflowConfig: AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig | null,\n ): boolean {\n if (!workflowConfig?.workflowDefinitionId?.trim() || !workflowConfig.workflowName?.trim()) {\n return false;\n }\n return workflowConfig.enabled !== false;\n }\n\n /**\n * Validates work-order state before starting a workflow or persisting workflowInfo.\n */\n private async validateFlowPrerequisites(\n workOrder: AXMMaintenanceManagementWorkOrderEntityModel,\n selectedTemplateId: string,\n ): Promise<{\n workflowConfig: AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig;\n workflowName: string;\n assignedEmployeeId: string;\n } | null> {\n const statusId = workOrder.statusId ?? '';\n if (!STARTABLE_STATUSES.has(statusId)) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.flow-requires-startable-status',\n );\n await this.showWarning(content);\n return null;\n }\n\n const workflowConfig = await this.resolveWorkflowConfigForTemplate(selectedTemplateId);\n if (!this.isWorkflowEnabled(workflowConfig)) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.no-workflow-configured',\n );\n await this.showWarning(content);\n return null;\n }\n\n const workflowName = workflowConfig!.workflowName.trim();\n const assignedToId = this.resolveText(workOrder.assignedToId);\n if (!assignedToId) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.assigned-user-required',\n );\n await this.showWarning(content);\n return null;\n }\n\n const assignedEmployeeId = await this.resolveEmployeeIdByPersonId(assignedToId);\n if (workflowName === 'work-order-approval' && !assignedEmployeeId) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.assigned-employee-required',\n );\n await this.showWarning(content);\n return null;\n }\n\n return { workflowConfig: workflowConfig!, workflowName, assignedEmployeeId };\n }\n\n private async resolveWorkflowConfigForTemplate(\n templateId: string,\n ): Promise<AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig | null> {\n const template = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.maintenanceTemplate.name)\n .data()\n .byKey(templateId);\n return get(template, 'workflowConfig') ?? null;\n }\n\n private async resolveAssetIdentifiers(\n assetId: string,\n ): Promise<{ assetCode: string | null; assetSerialNumber: string | null }> {\n if (!assetId) {\n return { assetCode: null, assetSerialNumber: null };\n }\n\n const asset = (await this.entityService\n .withEntity('AssetManagement', 'Asset')\n .data()\n .byKey(assetId)) as { code?: string; serialNumber?: string } | null;\n\n const assetCode = this.resolveText(asset?.code);\n const assetSerialNumber = this.resolveText(asset?.serialNumber);\n\n return {\n assetCode: assetCode || null,\n assetSerialNumber: assetSerialNumber || null,\n };\n }\n\n private buildWorkflowInputs(\n workOrder: AXMMaintenanceManagementWorkOrderEntityModel,\n workflowConfig: AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig,\n assignedEmployeeId: string,\n assetIdentifiers: { assetCode: string | null; assetSerialNumber: string | null },\n ): Record<string, unknown> {\n const assetTitle = workOrder.asset?.title;\n const assetDisplayName =\n typeof assetTitle === 'string'\n ? assetTitle\n : resolveMultiLanguageString(assetTitle as never, this.translationService.getActiveLang());\n\n const templateDefaults = defaultTo(workflowConfig.defaultInput, {}) as Record<string, unknown>;\n const maintenanceTypeTitle = workOrder.maintenanceType?.title;\n const maintenanceTypeName =\n typeof maintenanceTypeTitle === 'string'\n ? maintenanceTypeTitle\n : resolveMultiLanguageString(maintenanceTypeTitle as never, this.translationService.getActiveLang());\n\n const assignedToTitle = workOrder.assignedTo?.fullName;\n\n return {\n ...templateDefaults,\n workOrderId: workOrder.id,\n workOrderNo: workOrder.workOrderNo,\n workOrderCode: workOrder.workOrderNo,\n assetId: workOrder.assetId,\n assetCode: assetIdentifiers.assetCode,\n assetSerialNumber: assetIdentifiers.assetSerialNumber,\n assetDisplayName,\n maintenanceTypeId: workOrder.maintenanceTypeId,\n maintenanceTypeName,\n maintenancePlanId: workOrder.maintenancePlanId ?? null,\n failureRegisterId: workOrder.failureRegisterId ?? null,\n assignedToId: workOrder.assignedToId ?? null,\n assignedToDisplayName:\n typeof assignedToTitle === 'string' && assignedToTitle.trim()\n ? assignedToTitle.trim()\n : workOrder.assignedToId ?? null,\n assignedEmployeeId: assignedEmployeeId || null,\n sourceType: workOrder.sourceType ?? null,\n dueDate: workOrder.scheduledEnd ?? workOrder.scheduledStart ?? null,\n };\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n private async showWarning(content: string): Promise<void> {\n this.toastService.show({\n color: 'warning',\n title: await this.translationService.translateAsync('@general:messages.generic.warning.title'),\n content,\n closeButton: true,\n timeOut: 10000,\n timeOutProgress: true,\n });\n }\n\n /**\n * Work-order approval flow expects `HumanCapitalManagement.Employee` id (`performedById` on WorkReport).\n * `WorkOrder.assignedToId` stores `PersonCore.Person` id.\n */\n private async resolveEmployeeIdByPersonId(personId: string): Promise<string> {\n if (!personId) {\n return '';\n }\n\n const page = await this.entityService\n .withEntity('HumanCapitalManagement', 'Employee')\n .data()\n .query({\n skip: 0,\n take: 1,\n filter: {\n logic: 'and',\n filters: [{ field: 'personId', operator: { type: 'equal' }, value: personId }],\n },\n } as never);\n\n const employee = defaultTo(get(page, 'items[0]'), null) as { id?: string } | null;\n return this.resolveText(employee?.id);\n }\n\n private async resolveMaintenanceTemplateId(\n workOrder: AXMMaintenanceManagementWorkOrderEntityModel,\n explicitTemplateId?: string,\n ): Promise<string> {\n if (explicitTemplateId) {\n return explicitTemplateId;\n }\n\n const currentTemplateId = this.resolveText(workOrder.maintenanceTemplateId);\n if (currentTemplateId) {\n const currentConfig = await this.resolveWorkflowConfig(workOrder);\n if (this.isWorkflowEnabled(currentConfig)) {\n return currentTemplateId;\n }\n }\n\n const assetId = this.resolveText(workOrder.assetId);\n if (!assetId) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.no-workflow-templates-for-asset',\n );\n await this.showWarning(content);\n return '';\n }\n\n const backend = this.createStorageBackend();\n const templateEntityName = `${RootConfig.module.name}.${RootConfig.entities.maintenanceTemplate.name}`;\n const templates = await queryWorkflowTemplatesForAsset(backend, templateEntityName, assetId);\n if (templates.length === 0) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.no-workflow-templates-for-asset',\n );\n await this.showWarning(content);\n return '';\n }\n\n if (templates.length === 1) {\n return templates[0].id;\n }\n\n return (await this.pickMaintenanceTemplate(templates)) ?? '';\n }\n\n private async pickMaintenanceTemplate(templates: MaintenanceTemplateLike[]): Promise<string | null> {\n const locale = this.translationService.getActiveLang() as 'en-US' | 'fa-IR';\n const sorted = [...templates].sort((a, b) => {\n const ta = resolveDisplayLabel(a.title, a.code ?? a.id, locale);\n const tb = resolveDisplayLabel(b.title, b.code ?? b.id, locale);\n return ta.localeCompare(tb, locale, { sensitivity: 'base' });\n });\n\n const title = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.actions.start-flow.select-template.title',\n );\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.actions.start-flow.select-template.content',\n );\n const cancelLabel = await this.translationService.translateAsync('@general:actions.cancel.title');\n\n return new Promise((resolve) => {\n let settled = false;\n const finish = (value: string | null) => {\n if (settled) {\n return;\n }\n settled = true;\n resolve(value);\n };\n\n const dialog = this.dialogService.open({\n title,\n content,\n type: 'primary',\n orientation: 'vertical',\n closeButton: true,\n buttons: [\n {\n text: cancelLabel,\n color: 'default',\n autofocus: true,\n onClick: () => {\n dialog.close();\n finish(null);\n },\n },\n ...sorted.map((template) => ({\n text: resolveDisplayLabel(template.title, template.code ?? template.id, locale),\n color: 'primary' as const,\n onClick: () => {\n dialog.close();\n finish(template.id);\n },\n })),\n ],\n });\n });\n }\n\n private createStorageBackend(): EntityStorageBackend {\n return {\n getOne: async (entityName, id) => {\n const [module, entity] = entityName.split('.');\n return this.entityService.withEntity(module, entity).data().byKey(id);\n },\n insertOne: async () => null,\n query: async (entityName, request) => {\n const [module, entity] = entityName.split('.');\n return this.entityService.withEntity(module, entity).data().query(request as never);\n },\n };\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAsCA,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAS;AACzC,IAAA,kBAAkB,CAAC,OAAO;AAC1B,IAAA,kBAAkB,CAAC,SAAS;AAC5B,IAAA,kBAAkB,CAAC,QAAQ;AAC5B,CAAA,CAAC;AAEF;AAEA;;AAEG;MAEU,yBAAyB,CAAA;AADtC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,mBAAmB,CAAsB;AACjE,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAgejE,IAAA;;;IA1dC,MAAM,OAAO,CAAC,KAAgC,EAAA;AAC5C,QAAA,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CAA4B;AACxE,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,EAAE;AAChB,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,EAAE;QAC5E;AAEA,QAAA,IAAI,2BAA2B,CAAC,GAAG,CAAC,EAAE;AACpC,YAAA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,CAAC,KAAK,CAAC,OAAgB,CAAC;YACrF,CAAC;SACF;IACH;8GAreW,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAzB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,cADZ,MAAM,EAAA,CAAA,CAAA;;2FACnB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-start-work-order-flow.command-CVlDdtxW.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/commands/start-work-order-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport {\n AXPEntityService,\n buildAXPRecordWorkflowInfo,\n getRecordWorkflowInstanceId,\n} from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';\nimport { AXP_WORKFLOW_ENGINE, type AXPWorkflowEngine } from '@acorex-platform/framework-client/workflow';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport {\n type EntityStorageBackend,\n queryWorkflowTemplatesForAsset,\n resolveDisplayLabel,\n type MaintenanceTemplateLike,\n} from '../../../middlewares/maintenance-generation.utils';\n\n//#endregion\n\n//#region ---- Types ----\n\ninterface StartWorkOrderFlowContext {\n /** When set, applies the maintenance template on the work order before starting the workflow. */\n maintenanceTemplateId?: string;\n data?: Record<string, unknown>;\n options?: { maintenanceTemplateId?: string };\n}\n\nconst STARTABLE_STATUSES = new Set<string>([\n AXMWorkOrderStatus.Planned,\n AXMWorkOrderStatus.Scheduled,\n AXMWorkOrderStatus.Assigned,\n]);\n\n//#endregion\n\n/**\n * Starts the maintenance template workflow for a work order (execution + approval).\n */\n@Injectable({ providedIn: 'root' })\nexport class StartWorkOrderFlowCommand implements AXPCommand<StartWorkOrderFlowContext, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE) as AXPWorkflowEngine;\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly dialogService = inject(AXDialogService);\n private readonly eventService = inject(AXPBroadcastEventService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartWorkOrderFlowContext): AXPCommandExecuteResultPromise<void> {\n const row = defaultTo(get(input, 'data'), {}) as Record<string, unknown>;\n const workOrderId = this.resolveText(get(row, 'id'));\n if (!workOrderId) {\n return { success: false, message: { text: 'Work order id is required.' } };\n }\n\n if (getRecordWorkflowInstanceId(row)) {\n return { success: false };\n }\n\n let workOrder = await this.loadWorkOrder(workOrderId, row);\n if (!workOrder) {\n return { success: false, message: { text: 'Work order not found.' } };\n }\n\n const explicitTemplateId = this.resolveText(get(input, 'maintenanceTemplateId'));\n const selectedTemplateId = await this.resolveMaintenanceTemplateId(workOrder, explicitTemplateId || undefined);\n if (!selectedTemplateId) {\n return { success: false };\n }\n\n const flowPrerequisites = await this.validateFlowPrerequisites(workOrder, selectedTemplateId);\n if (!flowPrerequisites) {\n return { success: false };\n }\n\n const { workflowConfig, workflowName, assignedEmployeeId } = flowPrerequisites;\n\n if (selectedTemplateId !== workOrder.maintenanceTemplateId) {\n await this.applyMaintenanceTemplate(workOrderId, selectedTemplateId);\n workOrder = (await this.loadWorkOrder(workOrderId)) ?? workOrder;\n }\n\n const assetIdentifiers = await this.resolveAssetIdentifiers(this.resolveText(workOrder.assetId));\n const workflowInputs = this.buildWorkflowInputs(\n workOrder,\n workflowConfig,\n assignedEmployeeId,\n assetIdentifiers,\n );\n const correlationId = `${RootConfig.entities.workOrder.source}:${workOrderId}:${workflowName}`;\n\n try {\n // Start via engine only — do not use AXPWorkflowManager.start() here; it auto-runs inline\n // frontend steps (e.g. checklist fill). Human tasks must stay on the task board.\n const startResponse = await this.workflowEngine.start({\n workflowId: workflowName,\n input: {\n ...workflowInputs,\n refId: workOrderId,\n refType: RootConfig.entities.workOrder.source,\n correlationId,\n },\n });\n\n const instanceId = startResponse.instanceId;\n if (!instanceId) {\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: 'Unknown error',\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: 'Unknown error' } };\n }\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .update(workOrderId, {\n workflowInfo: buildAXPRecordWorkflowInfo({\n instanceId,\n definitionId: workflowName,\n correlationId,\n }),\n } as never);\n\n this.eventService.publish('task-board.refresh', { provider: workflowName });\n\n const taskBoardHint = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.workflow-started-use-task-board',\n );\n this.toastService.show({\n color: 'success',\n title: await this.translationService.translateAsync('@general:messages.generic.success.title'),\n content: taskBoardHint,\n closeButton: true,\n timeOut: 6000,\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('[StartWorkOrderFlowCommand]', error);\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private async loadWorkOrder(\n workOrderId: string,\n row?: Record<string, unknown>,\n ): Promise<AXMMaintenanceManagementWorkOrderEntityModel | null> {\n if (get(row, 'id') === workOrderId) {\n return row as unknown as AXMMaintenanceManagementWorkOrderEntityModel;\n }\n\n const loaded = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId);\n return (loaded as AXMMaintenanceManagementWorkOrderEntityModel | null) ?? null;\n }\n\n private async applyMaintenanceTemplate(workOrderId: string, templateId: string): Promise<void> {\n const template = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.maintenanceTemplate.name)\n .data()\n .byKey(templateId)) as {\n id?: string;\n title?: unknown;\n maintenanceTypeId?: string;\n metadataIds?: string[];\n workflowConfig?: AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig | null;\n needShutdown?: boolean;\n needPermission?: boolean;\n estimatedMinutes?: number;\n } | null;\n\n if (!template?.id) {\n throw new Error('Maintenance template not found.');\n }\n\n const estimatedHours =\n typeof template.estimatedMinutes === 'number' && template.estimatedMinutes > 0\n ? Math.round((template.estimatedMinutes / 60) * 100) / 100\n : undefined;\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .update(workOrderId, {\n maintenanceTemplateId: template.id,\n maintenanceTypeId: template.maintenanceTypeId,\n maintenanceTemplate: {\n id: template.id,\n title: template.title,\n metadataIds: template.metadataIds,\n workflowConfig: template.workflowConfig,\n },\n needShutdown: template.needShutdown ?? false,\n needPermission: template.needPermission ?? false,\n ...(estimatedHours !== undefined ? { estimatedHours } : {}),\n } as never);\n }\n\n private async resolveWorkflowConfig(\n workOrder: AXMMaintenanceManagementWorkOrderEntityModel,\n ): Promise<AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig | null> {\n let workflowConfig = workOrder.maintenanceTemplate?.workflowConfig ?? null;\n if (!workflowConfig?.workflowDefinitionId && workOrder.maintenanceTemplateId) {\n const template = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.maintenanceTemplate.name)\n .data()\n .byKey(workOrder.maintenanceTemplateId);\n workflowConfig = get(template, 'workflowConfig') ?? null;\n }\n return workflowConfig;\n }\n\n private isWorkflowEnabled(\n workflowConfig: AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig | null,\n ): boolean {\n if (!workflowConfig?.workflowDefinitionId?.trim() || !workflowConfig.workflowName?.trim()) {\n return false;\n }\n return workflowConfig.enabled !== false;\n }\n\n /**\n * Validates work-order state before starting a workflow or persisting workflowInfo.\n */\n private async validateFlowPrerequisites(\n workOrder: AXMMaintenanceManagementWorkOrderEntityModel,\n selectedTemplateId: string,\n ): Promise<{\n workflowConfig: AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig;\n workflowName: string;\n assignedEmployeeId: string;\n } | null> {\n const statusId = workOrder.statusId ?? '';\n if (!STARTABLE_STATUSES.has(statusId)) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.flow-requires-startable-status',\n );\n await this.showWarning(content);\n return null;\n }\n\n const workflowConfig = await this.resolveWorkflowConfigForTemplate(selectedTemplateId);\n if (!this.isWorkflowEnabled(workflowConfig)) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.no-workflow-configured',\n );\n await this.showWarning(content);\n return null;\n }\n\n const workflowName = workflowConfig!.workflowName.trim();\n const assignedToId = this.resolveText(workOrder.assignedToId);\n if (!assignedToId) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.assigned-user-required',\n );\n await this.showWarning(content);\n return null;\n }\n\n const assignedEmployeeId = await this.resolveEmployeeIdByPersonId(assignedToId);\n if (workflowName === 'work-order-approval' && !assignedEmployeeId) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.assigned-employee-required',\n );\n await this.showWarning(content);\n return null;\n }\n\n return { workflowConfig: workflowConfig!, workflowName, assignedEmployeeId };\n }\n\n private async resolveWorkflowConfigForTemplate(\n templateId: string,\n ): Promise<AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig | null> {\n const template = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.maintenanceTemplate.name)\n .data()\n .byKey(templateId);\n return get(template, 'workflowConfig') ?? null;\n }\n\n private async resolveAssetIdentifiers(\n assetId: string,\n ): Promise<{ assetCode: string | null; assetSerialNumber: string | null }> {\n if (!assetId) {\n return { assetCode: null, assetSerialNumber: null };\n }\n\n const asset = (await this.entityService\n .withEntity('AssetManagement', 'Asset')\n .data()\n .byKey(assetId)) as { code?: string; serialNumber?: string } | null;\n\n const assetCode = this.resolveText(asset?.code);\n const assetSerialNumber = this.resolveText(asset?.serialNumber);\n\n return {\n assetCode: assetCode || null,\n assetSerialNumber: assetSerialNumber || null,\n };\n }\n\n private buildWorkflowInputs(\n workOrder: AXMMaintenanceManagementWorkOrderEntityModel,\n workflowConfig: AXMMaintenanceManagementMaintenanceTemplateWorkflowConfig,\n assignedEmployeeId: string,\n assetIdentifiers: { assetCode: string | null; assetSerialNumber: string | null },\n ): Record<string, unknown> {\n const assetTitle = workOrder.asset?.title;\n const assetDisplayName =\n typeof assetTitle === 'string'\n ? assetTitle\n : resolveMultiLanguageString(assetTitle as never, this.translationService.getActiveLang());\n\n const templateDefaults = defaultTo(workflowConfig.defaultInput, {}) as Record<string, unknown>;\n const maintenanceTypeTitle = workOrder.maintenanceType?.title;\n const maintenanceTypeName =\n typeof maintenanceTypeTitle === 'string'\n ? maintenanceTypeTitle\n : resolveMultiLanguageString(maintenanceTypeTitle as never, this.translationService.getActiveLang());\n\n const assignedToTitle = workOrder.assignedTo?.fullName;\n\n return {\n ...templateDefaults,\n workOrderId: workOrder.id,\n workOrderNo: workOrder.workOrderNo,\n workOrderCode: workOrder.workOrderNo,\n assetId: workOrder.assetId,\n assetCode: assetIdentifiers.assetCode,\n assetSerialNumber: assetIdentifiers.assetSerialNumber,\n assetDisplayName,\n maintenanceTypeId: workOrder.maintenanceTypeId,\n maintenanceTypeName,\n maintenancePlanId: workOrder.maintenancePlanId ?? null,\n failureRegisterId: workOrder.failureRegisterId ?? null,\n assignedToId: workOrder.assignedToId ?? null,\n assignedToDisplayName:\n typeof assignedToTitle === 'string' && assignedToTitle.trim()\n ? assignedToTitle.trim()\n : workOrder.assignedToId ?? null,\n assignedEmployeeId: assignedEmployeeId || null,\n sourceType: workOrder.sourceType ?? null,\n dueDate: workOrder.scheduledEnd ?? workOrder.scheduledStart ?? null,\n };\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n private async showWarning(content: string): Promise<void> {\n this.toastService.show({\n color: 'warning',\n title: await this.translationService.translateAsync('@general:messages.generic.warning.title'),\n content,\n closeButton: true,\n timeOut: 10000,\n timeOutProgress: true,\n });\n }\n\n /**\n * Work-order approval flow expects `HumanCapitalManagement.Employee` id (`performedById` on WorkReport).\n * `WorkOrder.assignedToId` stores `PersonCore.Person` id.\n */\n private async resolveEmployeeIdByPersonId(personId: string): Promise<string> {\n if (!personId) {\n return '';\n }\n\n const page = await this.entityService\n .withEntity('HumanCapitalManagement', 'Employee')\n .data()\n .query({\n skip: 0,\n take: 1,\n filter: {\n logic: 'and',\n filters: [{ field: 'personId', operator: { type: 'equal' }, value: personId }],\n },\n } as never);\n\n const employee = defaultTo(get(page, 'items[0]'), null) as { id?: string } | null;\n return this.resolveText(employee?.id);\n }\n\n private async resolveMaintenanceTemplateId(\n workOrder: AXMMaintenanceManagementWorkOrderEntityModel,\n explicitTemplateId?: string,\n ): Promise<string> {\n if (explicitTemplateId) {\n return explicitTemplateId;\n }\n\n const currentTemplateId = this.resolveText(workOrder.maintenanceTemplateId);\n if (currentTemplateId) {\n const currentConfig = await this.resolveWorkflowConfig(workOrder);\n if (this.isWorkflowEnabled(currentConfig)) {\n return currentTemplateId;\n }\n }\n\n const assetId = this.resolveText(workOrder.assetId);\n if (!assetId) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.no-workflow-templates-for-asset',\n );\n await this.showWarning(content);\n return '';\n }\n\n const backend = this.createStorageBackend();\n const templateEntityName = `${RootConfig.module.name}.${RootConfig.entities.maintenanceTemplate.name}`;\n const templates = await queryWorkflowTemplatesForAsset(backend, templateEntityName, assetId);\n if (templates.length === 0) {\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.messages.no-workflow-templates-for-asset',\n );\n await this.showWarning(content);\n return '';\n }\n\n if (templates.length === 1) {\n return templates[0].id;\n }\n\n return (await this.pickMaintenanceTemplate(templates)) ?? '';\n }\n\n private async pickMaintenanceTemplate(templates: MaintenanceTemplateLike[]): Promise<string | null> {\n const locale = this.translationService.getActiveLang() as 'en-US' | 'fa-IR';\n const sorted = [...templates].sort((a, b) => {\n const ta = resolveDisplayLabel(a.title, a.code ?? a.id, locale);\n const tb = resolveDisplayLabel(b.title, b.code ?? b.id, locale);\n return ta.localeCompare(tb, locale, { sensitivity: 'base' });\n });\n\n const title = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.actions.start-flow.select-template.title',\n );\n const content = await this.translationService.translateAsync(\n '@maintenance-management:work-orders.actions.start-flow.select-template.content',\n );\n const cancelLabel = await this.translationService.translateAsync('@general:actions.cancel.title');\n\n return new Promise((resolve) => {\n let settled = false;\n const finish = (value: string | null) => {\n if (settled) {\n return;\n }\n settled = true;\n resolve(value);\n };\n\n const dialog = this.dialogService.open({\n title,\n content,\n type: 'primary',\n orientation: 'vertical',\n closeButton: true,\n buttons: [\n {\n text: cancelLabel,\n color: 'default',\n autofocus: true,\n onClick: () => {\n dialog.close();\n finish(null);\n },\n },\n ...sorted.map((template) => ({\n text: resolveDisplayLabel(template.title, template.code ?? template.id, locale),\n color: 'primary' as const,\n onClick: () => {\n dialog.close();\n finish(template.id);\n },\n })),\n ],\n });\n });\n }\n\n private createStorageBackend(): EntityStorageBackend {\n return {\n getOne: async (entityName, id) => {\n const [module, entity] = entityName.split('.');\n return this.entityService.withEntity(module, entity).data().byKey(id);\n },\n insertOne: async () => null,\n query: async (entityName, request) => {\n const [module, entity] = entityName.split('.');\n return this.entityService.withEntity(module, entity).data().query(request as never);\n },\n };\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAsCA,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAS;AACzC,IAAA,kBAAkB,CAAC,OAAO;AAC1B,IAAA,kBAAkB,CAAC,SAAS;AAC5B,IAAA,kBAAkB,CAAC,QAAQ;AAC5B,CAAA,CAAC;AAEF;AAEA;;AAEG;MAEU,yBAAyB,CAAA;AADtC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,mBAAmB,CAAsB;AACjE,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAgejE,IAAA;;;IA1dC,MAAM,OAAO,CAAC,KAAgC,EAAA;AAC5C,QAAA,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CAA4B;AACxE,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,EAAE;AAChB,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,E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C,KAAK,CAAC,GAAG,CAAC;AAC9C,gBAAA,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,OAAgB,CAAC;YACrF,CAAC;SACF;IACH;8GAreW,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAzB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,cADZ,MAAM,EAAA,CAAA,CAAA;;2FACnB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-update-work-order-completed.activity-Di4R6LQl.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/update-work-order-completed.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { isString } from 'lodash';\n\nimport { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface UpdateWorkOrderCompletedInput {\n workOrderId: string;\n}\n\nexport interface UpdateWorkOrderCompletedOutput {\n workOrderId: string;\n statusId: string;\n completedAt: string;\n}\n\n//#endregion\n\n/**\n * Marks the work order as completed. Approval/sign-off is handled by a separate workflow.\n */\n@Injectable({ providedIn: 'root' })\nexport class UpdateWorkOrderCompletedActivity\n implements AXPCommand<UpdateWorkOrderCompletedInput, UpdateWorkOrderCompletedOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: UpdateWorkOrderCompletedInput,\n ): AXPCommandExecuteResultPromise<UpdateWorkOrderCompletedOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as AXMMaintenanceManagementWorkOrderEntityModel | null;\n\n if (!workOrder?.id) {\n return {\n success: false,\n message: { text: 'Work order not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n if (workOrder.statusId === AXMWorkOrderStatus.Completed) {\n return { success: true, kind: 'object',\n data: {\n workOrderId,\n statusId: AXMWorkOrderStatus.Completed,\n completedAt: workOrder.completedAt ?? new Date().toISOString(),\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n if (workOrder.statusId !== AXMWorkOrderStatus.InProgress) {\n return {\n success: false,\n message: { text: 'Work order must be in progress before it can be marked completed.' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const completedAt = new Date().toISOString();\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .update(workOrderId, {\n statusId: AXMWorkOrderStatus.Completed,\n completedAt,\n } as never);\n\n return { success: true, kind: 'object',\n data: {\n workOrderId,\n statusId: AXMWorkOrderStatus.Completed,\n completedAt,\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n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,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,cADnB,MAAM,EAAA,CAAA,CAAA;;2FACnB,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAD5C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-update-work-order-completed.activity-Di4R6LQl.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/update-work-order-completed.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { isString } from 'lodash';\n\nimport { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface UpdateWorkOrderCompletedInput {\n workOrderId: string;\n}\n\nexport interface UpdateWorkOrderCompletedOutput {\n workOrderId: string;\n statusId: string;\n completedAt: string;\n}\n\n//#endregion\n\n/**\n * Marks the work order as completed. Approval/sign-off is handled by a separate workflow.\n */\n@Injectable({ providedIn: 'root' })\nexport class UpdateWorkOrderCompletedActivity\n implements AXPCommand<UpdateWorkOrderCompletedInput, UpdateWorkOrderCompletedOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: UpdateWorkOrderCompletedInput,\n ): AXPCommandExecuteResultPromise<UpdateWorkOrderCompletedOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as AXMMaintenanceManagementWorkOrderEntityModel | null;\n\n if (!workOrder?.id) {\n return {\n success: false,\n message: { text: 'Work order not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n if (workOrder.statusId === AXMWorkOrderStatus.Completed) {\n return { success: true, kind: 'object',\n data: {\n workOrderId,\n statusId: AXMWorkOrderStatus.Completed,\n completedAt: workOrder.completedAt ?? new Date().toISOString(),\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n if (workOrder.statusId !== AXMWorkOrderStatus.InProgress) {\n return {\n success: false,\n message: { text: 'Work order must be in progress before it can be marked completed.' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const completedAt = new Date().toISOString();\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .update(workOrderId, {\n statusId: AXMWorkOrderStatus.Completed,\n completedAt,\n } as never);\n\n return { success: true, kind: 'object',\n data: {\n workOrderId,\n statusId: AXMWorkOrderStatus.Completed,\n completedAt,\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAyBA;AAEA;;AAEG;MAEU,gCAAgC,CAAA;AAD7C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAiF1D,IAAA;;;IA3EC,MAAM,OAAO,CACX,KAAoC,EAAA;QAEpC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAy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AM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AACrE,aAAA,IAAI;aACJ,MAAM,CAAC,WAAW,EAAE;YACnB,QAAQ,EAAE,kBAAkB,CAAC,SAAS;YACtC,WAAW;AACH,SAAA,CAAC;AAEb,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ;AACpC,YAAA,IAAI,EAAE;gBACJ,WAAW;gBACX,QAAQ,EAAE,kBAAkB,CAAC,SAAS;gBACtC,WAAW;AACZ,aAAA;AACD,YAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;SAC9B;IACH;;;AAMQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GAnFW,gCAAgC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,cADnB,MAAM,EAAA,CAAA,CAAA;;2FACnB,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAD5C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -4,7 +4,7 @@ import * as i0 from '@angular/core';
4
4
  import { inject, Injectable } from '@angular/core';
5
5
  import { isString } from 'lodash';
6
6
  import { RootConfig, AXMWorkOrderStatus } from '@acorex-platform/module-maintenance-management-client/contracts';
7
- import { A as AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE } from './acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-BiQlJxPX.mjs';
7
+ import { A as AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE } from './acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-BI7RNP_h.mjs';
8
8
 
9
9
  //#region ---- Imports ----
10
10
  //#endregion
@@ -93,4 +93,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
93
93
  }] });
94
94
 
95
95
  export { UpdateWorkOrderInProgressActivity };
96
- //# sourceMappingURL=acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-CzkCCl1L.mjs.map
96
+ //# sourceMappingURL=acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-CZwXs7XY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-CzkCCl1L.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/update-work-order-in-progress.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { isString } from 'lodash';\n\nimport { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport { AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE } from '../work-order-workflow.debug';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface UpdateWorkOrderInProgressInput {\n workOrderId: string;\n}\n\nexport interface UpdateWorkOrderInProgressOutput {\n workOrderId: string;\n statusId: string;\n startedAt: string | null;\n skipped: boolean;\n}\n\n//#endregion\n\n/**\n * Sets the work order to in-progress when it is not already in that state.\n */\n@Injectable({ providedIn: 'root' })\nexport class UpdateWorkOrderInProgressActivity\n implements AXPCommand<UpdateWorkOrderInProgressInput, UpdateWorkOrderInProgressOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: UpdateWorkOrderInProgressInput,\n ): AXPCommandExecuteResultPromise<UpdateWorkOrderInProgressOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as AXMMaintenanceManagementWorkOrderEntityModel | null;\n\n if (!workOrder?.id) {\n return {\n success: false,\n message: { text: 'Work order not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n if (workOrder.statusId === AXMWorkOrderStatus.InProgress) {\n return { success: true, kind: 'object',\n data: {\n workOrderId,\n statusId: AXMWorkOrderStatus.InProgress,\n startedAt: workOrder.startedAt ?? null,\n skipped: true,\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n if (workOrder.statusId === AXMWorkOrderStatus.Completed || workOrder.statusId === AXMWorkOrderStatus.SignedOff) {\n return {\n success: false,\n message: { text: 'Work order is already completed.' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const startedAt = this.resolveText(workOrder.startedAt) || new Date().toISOString();\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .update(workOrderId, {\n statusId: AXMWorkOrderStatus.InProgress,\n startedAt,\n } as never);\n\n this.debug.trace(\n AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE,\n 'work-order-status',\n 'Work order set to in-progress',\n { workOrderId, startedAt, previousStatusId: workOrder.statusId },\n );\n\n return { success: true, kind: 'object',\n data: {\n workOrderId,\n statusId: AXMWorkOrderStatus.InProgress,\n startedAt,\n skipped: false,\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;AA4BA;AAEA;;AAEG;MAEU,iCAAiC,CAAA;AAD9C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;AA0FjD,IAAA;;;IApFC,MAAM,OAAO,CACX,KAAqC,EAAA;QAErC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;AAC5C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;AAEA,QAAA,MAAM,SAAS,IAAI,MAAM,IAAI,CAAC;AAC3B,aAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AACrE,aAAA,IAAI;AACJ,aAAA,KAAK,CAAC,WAAW,CAAC,CAAwD;AAE7E,QAAA,IAAI,CAAC,SAAS,EAAE,EAAE,EAAE;YAClB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;AACzC,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;aAClC;QACH;QAEA,IAAI,SAAS,CAAC,QAAQ,KAAK,kBAAkB,CAAC,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J,WAAW;gBACX,QAAQ,EAAE,kBAAkB,CAAC,UAAU;gBACvC,SAAS;AACT,gBAAA,OAAO,EAAE,KAAK;AACf,aAAA;AACD,YAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;SAC9B;IACH;;;AAMQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GA7FW,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,cADpB,MAAM,EAAA,CAAA,CAAA;;2FACnB,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAD7C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-CZwXs7XY.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/update-work-order-in-progress.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { isString } from 'lodash';\n\nimport { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport { AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE } from '../work-order-workflow.debug';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface UpdateWorkOrderInProgressInput {\n workOrderId: string;\n}\n\nexport interface UpdateWorkOrderInProgressOutput {\n workOrderId: string;\n statusId: string;\n startedAt: string | null;\n skipped: boolean;\n}\n\n//#endregion\n\n/**\n * Sets the work order to in-progress when it is not already in that state.\n */\n@Injectable({ providedIn: 'root' })\nexport class UpdateWorkOrderInProgressActivity\n implements AXPCommand<UpdateWorkOrderInProgressInput, UpdateWorkOrderInProgressOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: UpdateWorkOrderInProgressInput,\n ): AXPCommandExecuteResultPromise<UpdateWorkOrderInProgressOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as AXMMaintenanceManagementWorkOrderEntityModel | null;\n\n if (!workOrder?.id) {\n return {\n success: false,\n message: { text: 'Work order not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n if (workOrder.statusId === AXMWorkOrderStatus.InProgress) {\n return { success: true, kind: 'object',\n data: {\n workOrderId,\n statusId: AXMWorkOrderStatus.InProgress,\n startedAt: workOrder.startedAt ?? null,\n skipped: true,\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n if (workOrder.statusId === AXMWorkOrderStatus.Completed || workOrder.statusId === AXMWorkOrderStatus.SignedOff) {\n return {\n success: false,\n message: { text: 'Work order is already completed.' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const startedAt = this.resolveText(workOrder.startedAt) || new Date().toISOString();\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .update(workOrderId, {\n statusId: AXMWorkOrderStatus.InProgress,\n startedAt,\n } as never);\n\n this.debug.trace(\n AXM_WORK_ORDER_WORKFLOW_DEBUG_NAMESPACE,\n 'work-order-status',\n 'Work order set to in-progress',\n { workOrderId, startedAt, previousStatusId: workOrder.statusId },\n );\n\n return { success: true, kind: 'object',\n data: {\n workOrderId,\n statusId: AXMWorkOrderStatus.InProgress,\n startedAt,\n skipped: false,\n },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;AA4BA;AAEA;;AAEG;MAEU,iCAAiC,CAAA;AAD9C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;AA0FjD,IAAA;;;IApFC,MAAM,OAAO,CACX,KAAqC,EAAA;QAErC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;AAC5C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;AAEA,QAAA,MAAM,SAAS,IAAI,MAAM,IAAI,CAAC;AAC3B,aAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AACrE,aAAA,IAAI;AACJ,aAAA,KAAK,CAAC,WAAW,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C,SAAS;AACD,SAAA,CAAC;QAEb,IAAI,CAAC,KAAK,CAAC,KAAK,CACd,uCAAuC,EACvC,mBAAmB,EACnB,+BAA+B,EAC/B,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,CAAC,QAAQ,EAAE,CACjE;AAED,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ;AACpC,YAAA,IAAI,EAAE;gBACJ,WAAW;gBACX,QAAQ,EAAE,kBAAkB,CAAC,UAAU;gBACvC,SAAS;AACT,gBAAA,OAAO,EAAE,KAAK;AACf,aAAA;AACD,YAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;SAC9B;IACH;;;AAMQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GA7FW,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,cADpB,MAAM,EAAA,CAAA,CAAA;;2FACnB,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAD7C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-update-work-report-on-completion.activity-_B0SUFtQ.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/update-work-report-on-completion.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { get, isNumber, isString } from 'lodash';\n\nimport { RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkReportEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport { isWorkReportEditable, isWorkReportFinalized } from '../../../work-report/work-report-assessment.util';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface UpdateWorkReportOnCompletionInput {\n workOrderId: string;\n workReportId: string;\n /** Flat field or nested form payload from fill-work-report-completion (workflow `outputs.result`). */\n result?: string | Record<string, unknown>;\n summary?: string;\n actionTaken?: string;\n recommendation?: string;\n laborHours?: number;\n downtimeMinutes?: number;\n endedAt?: string;\n needFollowUp?: boolean;\n}\n\nexport interface UpdateWorkReportOnCompletionOutput {\n workReportId: string;\n workOrderId: string;\n}\n\n//#endregion\n\n/**\n * Updates completion fields on an existing work report after the technician submits the completion form.\n * Checklist references are persisted by {@link RecordWorkReportAssessmentActivity} on checklist submit.\n */\n@Injectable({ providedIn: 'root' })\nexport class UpdateWorkReportOnCompletionActivity\n implements AXPCommand<UpdateWorkReportOnCompletionInput, UpdateWorkReportOnCompletionOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: UpdateWorkReportOnCompletionInput,\n ): AXPCommandExecuteResultPromise<UpdateWorkReportOnCompletionOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n const workReportId = this.resolveText(input?.workReportId);\n\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n if (!workReportId) {\n return {\n success: false,\n message: { text: 'workReportId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workReport = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .byKey(workReportId)) as AXMMaintenanceManagementWorkReportEntityModel | null;\n\n if (!workReport?.id) {\n return {\n success: false,\n message: { text: 'Work report not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n if (this.resolveText(workReport.workOrderId) !== workOrderId) {\n return {\n success: false,\n message: { text: 'Work report does not belong to the work order' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as AXMMaintenanceManagementWorkOrderEntityModel | null;\n\n if (isWorkReportFinalized(workReport) || !isWorkReportEditable(workReport, workOrder)) {\n return {\n success: false,\n message: { text: 'Work report is not editable' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const formSource = this.resolveFormSource(input);\n const update: Partial<AXMMaintenanceManagementWorkReportEntityModel> = {\n result: this.resolveOptionalText(get(formSource, 'result')),\n summary: this.resolveOptionalText(get(formSource, 'summary')),\n actionTaken: this.resolveOptionalText(get(formSource, 'actionTaken')),\n recommendation: this.resolveOptionalText(get(formSource, 'recommendation')),\n laborHours: this.resolveLaborHours(get(formSource, 'laborHours'), workOrder?.actualHours),\n downtimeMinutes: this.resolveDowntimeMinutes(get(formSource, 'downtimeMinutes'), workOrder?.downtimeMinutes),\n endedAt: this.resolveEndedAt(get(formSource, 'endedAt')),\n needFollowUp: get(formSource, 'needFollowUp') === true,\n };\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .update(workReportId, update as never);\n\n return { success: true, kind: 'object',\n data: { workReportId, workOrderId },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveFormSource(input: UpdateWorkReportOnCompletionInput): Record<string, unknown> {\n const nested = input.result;\n if (nested && typeof nested === 'object' && !Array.isArray(nested)) {\n return nested;\n }\n return input as unknown as Record<string, unknown>;\n }\n\n private resolveLaborHours(explicit: unknown, fromWorkOrder: unknown): number | undefined {\n if (isNumber(explicit) && explicit >= 0) {\n return explicit;\n }\n if (isNumber(fromWorkOrder) && fromWorkOrder >= 0) {\n return fromWorkOrder;\n }\n return undefined;\n }\n\n private resolveDowntimeMinutes(explicit: unknown, fromWorkOrder: unknown): number | undefined {\n if (isNumber(explicit) && explicit >= 0) {\n return explicit;\n }\n if (isNumber(fromWorkOrder) && fromWorkOrder >= 0) {\n return fromWorkOrder;\n }\n return undefined;\n }\n\n private resolveEndedAt(value: unknown): Date {\n const text = this.resolveOptionalText(value);\n if (text) {\n const parsed = new Date(text);\n if (!Number.isNaN(parsed.getTime())) {\n return parsed;\n }\n }\n return new Date();\n }\n\n private resolveOptionalText(value: unknown): string | undefined {\n const text = this.resolveText(value);\n return text || undefined;\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAoCA;AAEA;;;AAGG;MAEU,oCAAoC,CAAA;AADjD,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA6I1D,IAAA;;;IAvIC,MAAM,OAAO,CACX,KAAwC,EAAA;QAExC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC;QAE1D,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;AAC5C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;QAEA,IA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,IAAI,EAAE;IACnB;AAEQ,IAAA,mBAAmB,CAAC,KAAc,EAAA;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;QACpC,OAAO,IAAI,IAAI,SAAS;IAC1B;AAEQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GA/IW,oCAAoC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oCAAoC,cADvB,MAAM,EAAA,CAAA,CAAA;;2FACnB,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBADhD,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-update-work-report-on-completion.activity-_B0SUFtQ.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/update-work-report-on-completion.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { get, isNumber, isString } from 'lodash';\n\nimport { RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkOrderEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport type { AXMMaintenanceManagementWorkReportEntityModel } from '@acorex-platform/module-maintenance-management-client/contracts';\nimport { isWorkReportEditable, isWorkReportFinalized } from '../../../work-report/work-report-assessment.util';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface UpdateWorkReportOnCompletionInput {\n workOrderId: string;\n workReportId: string;\n /** Flat field or nested form payload from fill-work-report-completion (workflow `outputs.result`). */\n result?: string | Record<string, unknown>;\n summary?: string;\n actionTaken?: string;\n recommendation?: string;\n laborHours?: number;\n downtimeMinutes?: number;\n endedAt?: string;\n needFollowUp?: boolean;\n}\n\nexport interface UpdateWorkReportOnCompletionOutput {\n workReportId: string;\n workOrderId: string;\n}\n\n//#endregion\n\n/**\n * Updates completion fields on an existing work report after the technician submits the completion form.\n * Checklist references are persisted by {@link RecordWorkReportAssessmentActivity} on checklist submit.\n */\n@Injectable({ providedIn: 'root' })\nexport class UpdateWorkReportOnCompletionActivity\n implements AXPCommand<UpdateWorkReportOnCompletionInput, UpdateWorkReportOnCompletionOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: UpdateWorkReportOnCompletionInput,\n ): AXPCommandExecuteResultPromise<UpdateWorkReportOnCompletionOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n const workReportId = this.resolveText(input?.workReportId);\n\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n if (!workReportId) {\n return {\n success: false,\n message: { text: 'workReportId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workReport = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .byKey(workReportId)) as AXMMaintenanceManagementWorkReportEntityModel | null;\n\n if (!workReport?.id) {\n return {\n success: false,\n message: { text: 'Work report not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n if (this.resolveText(workReport.workOrderId) !== workOrderId) {\n return {\n success: false,\n message: { text: 'Work report does not belong to the work order' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as AXMMaintenanceManagementWorkOrderEntityModel | null;\n\n if (isWorkReportFinalized(workReport) || !isWorkReportEditable(workReport, workOrder)) {\n return {\n success: false,\n message: { text: 'Work report is not editable' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const formSource = this.resolveFormSource(input);\n const update: Partial<AXMMaintenanceManagementWorkReportEntityModel> = {\n result: this.resolveOptionalText(get(formSource, 'result')),\n summary: this.resolveOptionalText(get(formSource, 'summary')),\n actionTaken: this.resolveOptionalText(get(formSource, 'actionTaken')),\n recommendation: this.resolveOptionalText(get(formSource, 'recommendation')),\n laborHours: this.resolveLaborHours(get(formSource, 'laborHours'), workOrder?.actualHours),\n downtimeMinutes: this.resolveDowntimeMinutes(get(formSource, 'downtimeMinutes'), workOrder?.downtimeMinutes),\n endedAt: this.resolveEndedAt(get(formSource, 'endedAt')),\n needFollowUp: get(formSource, 'needFollowUp') === true,\n };\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .update(workReportId, update as never);\n\n return { success: true, kind: 'object',\n data: { workReportId, workOrderId },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveFormSource(input: UpdateWorkReportOnCompletionInput): Record<string, unknown> {\n const nested = input.result;\n if (nested && typeof nested === 'object' && !Array.isArray(nested)) {\n return nested;\n }\n return input as unknown as Record<string, unknown>;\n }\n\n private resolveLaborHours(explicit: unknown, fromWorkOrder: unknown): number | undefined {\n if (isNumber(explicit) && explicit >= 0) {\n return explicit;\n }\n if (isNumber(fromWorkOrder) && fromWorkOrder >= 0) {\n return fromWorkOrder;\n }\n return undefined;\n }\n\n private resolveDowntimeMinutes(explicit: unknown, fromWorkOrder: unknown): number | undefined {\n if (isNumber(explicit) && explicit >= 0) {\n return explicit;\n }\n if (isNumber(fromWorkOrder) && fromWorkOrder >= 0) {\n return fromWorkOrder;\n }\n return undefined;\n }\n\n private resolveEndedAt(value: unknown): Date {\n const text = this.resolveOptionalText(value);\n if (text) {\n const parsed = new Date(text);\n if (!Number.isNaN(parsed.getTime())) {\n return parsed;\n }\n }\n return new Date();\n }\n\n private resolveOptionalText(value: unknown): string | undefined {\n const text = this.resolveText(value);\n return text || undefined;\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAoCA;AAEA;;;AAGG;MAEU,oCAAoC,CAAA;AADjD,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA6I1D,IAAA;;;IAvIC,MAAM,OAAO,CACX,KAAwC,EAAA;QAExC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC;QAE1D,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;AAC5C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;QAEA,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE;AAC7C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;AAEA,QAAA,MAAM,UAAU,IAAI,MAAM,IAAI,CAAC;AAC5B,aAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAA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AI,EAAE;IACrB;8GA/IW,oCAAoC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oCAAoC,cADvB,MAAM,EAAA,CAAA,CAAA;;2FACnB,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBADhD,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-validate-work-order-completion.activity-RA2zaQHH.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/validate-work-order-completion.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface ValidateWorkOrderCompletionInput {\n workOrderId: string;\n}\n\nexport interface ValidateWorkOrderCompletionOutput {\n valid: boolean;\n workReportId?: string | null;\n}\n\n//#endregion\n\n/**\n * Validates that a work order can be completed.\n * TODO: enforce required questionnaire/checklist responses when multi-stage questionnaires are wired for execution.\n */\n@Injectable({ providedIn: 'root' })\nexport class ValidateWorkOrderCompletionActivity\n implements AXPCommand<ValidateWorkOrderCompletionInput, ValidateWorkOrderCompletionOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: ValidateWorkOrderCompletionInput,\n ): AXPCommandExecuteResultPromise<ValidateWorkOrderCompletionOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as { statusId?: string } | null;\n\n if (!workOrder) {\n return {\n success: false,\n message: { text: 'Work order not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n if (workOrder.statusId !== AXMWorkOrderStatus.InProgress) {\n return {\n success: false,\n message: { text: 'Work order must be in progress before it can be completed.' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workReportPage = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .query({\n skip: 0,\n take: 1,\n filter: {\n logic: 'and',\n filters: [{ field: 'workOrderId', operator: { type: 'equal' }, value: workOrderId }],\n },\n } as never);\n\n const workReport = defaultTo(get(workReportPage, 'items[0]'), null) as { id?: string } | null;\n const workReportId = workReport?.id?.trim() || null;\n\n // TODO: when WorkReport becomes mandatory for completion, fail when workReportId is missing.\n // TODO: validate assessments on WorkReport when completion checklists are enabled.\n\n return { success: true, kind: 'object',\n data: { valid: true, workReportId },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAuBA;AAEA;;;AAGG;MAEU,mCAAmC,CAAA;AADhD,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA2E1D,IAAA;;;IArEC,MAAM,OAAO,CACX,KAAuC,EAAA;QAEvC,MAAM,WAA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C,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AACrF,aAAA;AACO,SAAA,CAAC;AAEb,QAAA,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,UAAU,CAAC,EAAE,IAAI,CAA2B;QAC7F,MAAM,YAAY,GAAG,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,IAAI;;;AAKnD,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ;AACpC,YAAA,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE;AACnC,YAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;SAC9B;IACH;;;AAMQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GA7EW,mCAAmC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mCAAmC,cADtB,MAAM,EAAA,CAAA,CAAA;;2FACnB,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAD/C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-validate-work-order-completion.activity-RA2zaQHH.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/work-order/workflows/activities/validate-work-order-completion.activity.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { AXMWorkOrderStatus, RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface ValidateWorkOrderCompletionInput {\n workOrderId: string;\n}\n\nexport interface ValidateWorkOrderCompletionOutput {\n valid: boolean;\n workReportId?: string | null;\n}\n\n//#endregion\n\n/**\n * Validates that a work order can be completed.\n * TODO: enforce required questionnaire/checklist responses when multi-stage questionnaires are wired for execution.\n */\n@Injectable({ providedIn: 'root' })\nexport class ValidateWorkOrderCompletionActivity\n implements AXPCommand<ValidateWorkOrderCompletionInput, ValidateWorkOrderCompletionOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: ValidateWorkOrderCompletionInput,\n ): AXPCommandExecuteResultPromise<ValidateWorkOrderCompletionOutput> {\n const workOrderId = this.resolveText(input?.workOrderId);\n if (!workOrderId) {\n return {\n success: false,\n message: { text: 'workOrderId is required' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workOrder = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workOrder.name)\n .data()\n .byKey(workOrderId)) as { statusId?: string } | null;\n\n if (!workOrder) {\n return {\n success: false,\n message: { text: 'Work order not found' },\n metadata: { outcome: 'NotFound' },\n };\n }\n\n if (workOrder.statusId !== AXMWorkOrderStatus.InProgress) {\n return {\n success: false,\n message: { text: 'Work order must be in progress before it can be completed.' },\n metadata: { outcome: 'Failed' },\n };\n }\n\n const workReportPage = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.workReport.name)\n .data()\n .query({\n skip: 0,\n take: 1,\n filter: {\n logic: 'and',\n filters: [{ field: 'workOrderId', operator: { type: 'equal' }, value: workOrderId }],\n },\n } as never);\n\n const workReport = defaultTo(get(workReportPage, 'items[0]'), null) as { id?: string } | null;\n const workReportId = workReport?.id?.trim() || null;\n\n // TODO: when WorkReport becomes mandatory for completion, fail when workReportId is missing.\n // TODO: validate assessments on WorkReport when completion checklists are enabled.\n\n return { success: true, kind: 'object',\n data: { valid: true, workReportId },\n metadata: { outcome: 'Done' },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAuBA;AAEA;;;AAGG;MAEU,mCAAmC,CAAA;AADhD,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA2E1D,IAAA;;;IArEC,MAAM,OAAO,CACX,KAAuC,EAAA;QAEvC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;QACxD,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;AAC5C,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;aAChC;QACH;AAEA,QAAA,MAAM,SAAS,IAAI,MAAM,IAAI,CAAC;AAC3B,aAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AACrE,aAAA,IAAI;AACJ,aAAA,KAAK,CAAC,WAAW,CAAC,CAAiC;QAEtD,IAAI,CAAC,SAAS,EAAE;YACd,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE,EAA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AAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GA7EW,mCAAmC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mCAAmC,cADtB,MAAM,EAAA,CAAA,CAAA;;2FACnB,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAD/C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-maintenance-management-client-work-order-list-command-Bh_6PS5w.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/commands/work-order-list-command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { Injectable, inject } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n/** Asset detail route segments (must match AssetManagement entity registration). */\nconst ASSET_DETAIL_MODULE = 'AssetManagement';\nconst ASSET_DETAIL_ENTITY = 'Asset';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface WorkOrderListCommandInput {\n entity: string;\n conditions?: Array<{ name?: string; operator?: unknown; value?: unknown }>;\n}\n\ntype WorkOrderListCommandInvocation = Partial<WorkOrderListCommandInput> & {\n data?: Record<string, unknown>;\n options?: Partial<WorkOrderListCommandInput> & { entity?: string; conditions?: WorkOrderListCommandInput['conditions'] };\n};\n\ninterface ListFilterQuery {\n field: string;\n operator: { type: string };\n value: unknown;\n}\n\n//#endregion\n\n//#region ---- Command ----\n\n@Injectable()\nexport class WorkOrderListCommand implements AXPCommand<WorkOrderListCommandInput, void> {\n private readonly router = inject(Router);\n private readonly sessionService = inject(AXPSessionService);\n\n private resolvePayload(input: WorkOrderListCommandInvocation): WorkOrderListCommandInput | null {\n const entity =\n (typeof input.entity === 'string' && input.entity.trim() ? input.entity : undefined) ??\n (typeof input.options?.entity === 'string' && input.options?.entity?.trim()\n ? input.options.entity\n : undefined);\n\n if (!entity) {\n return null;\n }\n\n const conditions = input.conditions ?? input.options?.conditions;\n return { entity, ...(Array.isArray(conditions) ? { conditions } : {}) };\n }\n\n private buildFilterQueries(conditions: WorkOrderListCommandInput['conditions']): ListFilterQuery[] {\n if (!Array.isArray(conditions)) {\n return [];\n }\n\n const filters: ListFilterQuery[] = [];\n\n for (const condition of conditions) {\n const field =\n (typeof condition.name === 'string' && condition.name) ||\n (typeof (condition as { field?: string }).field === 'string'\n ? (condition as { field: string }).field\n : undefined);\n\n if (!field || condition.value === undefined || condition.value === null || condition.value === '') {\n continue;\n }\n\n const operator =\n condition.operator && typeof condition.operator === 'object' && 'type' in condition.operator\n ? (condition.operator as { type: string })\n : { type: 'equal' };\n\n filters.push({ field, operator, value: condition.value });\n }\n\n return filters;\n }\n\n private resolveAssetIdFromContext(input: WorkOrderListCommandInvocation): string | null {\n const data = input.data;\n if (!data || typeof data !== 'object') {\n return null;\n }\n\n const record = data as Record<string, unknown>;\n const assetId = record['assetId'];\n if (typeof assetId === 'string' && assetId.trim()) {\n return assetId;\n }\n\n const asset = record['asset'];\n if (asset && typeof asset === 'object' && typeof (asset as { id?: unknown }).id === 'string') {\n return (asset as { id: string }).id;\n }\n\n return null;\n }\n\n private findAssetDetailsRoute(): ActivatedRoute | null {\n const stack: ActivatedRoute[] = [this.router.routerState.root];\n\n while (stack.length > 0) {\n const current = stack.pop();\n if (!current) {\n continue;\n }\n\n const module = current.snapshot.paramMap.get('module');\n const entity = current.snapshot.paramMap.get('entity');\n const id = current.snapshot.paramMap.get('id');\n const onViewRoute = current.snapshot.url.some((segment) => segment.path === 'view');\n\n if (onViewRoute && module === ASSET_DETAIL_MODULE && entity === ASSET_DETAIL_ENTITY && id) {\n return current;\n }\n\n stack.push(...current.children);\n }\n\n return null;\n }\n\n private buildWorkOrderPageQueryParams(\n conditions: WorkOrderListCommandInput['conditions'],\n ): Record<string, string> {\n const queryParams: Record<string, string> = {\n page: RootConfig.entities.workOrder.name,\n };\n\n const filterQueries = this.buildFilterQueries(conditions);\n if (filterQueries.length > 0) {\n queryParams['filters'] = JSON.stringify(filterQueries);\n }\n\n return queryParams;\n }\n\n private async navigateWithinCurrentAssetDetails(\n assetDetailsRoute: ActivatedRoute,\n conditions: WorkOrderListCommandInput['conditions'],\n ): Promise<void> {\n await this.router.navigate([], {\n relativeTo: assetDetailsRoute,\n queryParams: this.buildWorkOrderPageQueryParams(conditions),\n queryParamsHandling: 'merge',\n });\n }\n\n private async navigateToAssetWorkOrdersPage(\n assetId: string,\n conditions: WorkOrderListCommandInput['conditions'],\n ): Promise<void> {\n const appName = this.sessionService.application?.name;\n if (!appName) {\n throw new Error('Application name is required to open work orders in asset layout.');\n }\n\n const queryParams = this.buildWorkOrderPageQueryParams(conditions);\n const queryString = new URLSearchParams(queryParams).toString();\n const path = `/${appName}/m/${ASSET_DETAIL_MODULE}/e/${ASSET_DETAIL_ENTITY}/${assetId}/view`;\n const url = queryString ? `${path}?${queryString}` : path;\n\n await this.router.navigateByUrl(url);\n }\n\n async execute(input: WorkOrderListCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const payload = this.resolvePayload(input);\n if (!payload) {\n return {\n success: false,\n message: { text: 'Entity is required for Entity:List command.' },\n };\n }\n\n const assetDetailsRoute = this.findAssetDetailsRoute();\n if (assetDetailsRoute) {\n await this.navigateWithinCurrentAssetDetails(assetDetailsRoute, payload.conditions);\n return { success: true, kind: 'object', data: undefined };\n }\n\n const assetId = this.resolveAssetIdFromContext(input);\n if (!assetId) {\n return {\n success: false,\n message: {\n text: 'Cannot open work orders in asset layout: asset id is missing on the maintenance plan.',\n },\n };\n }\n\n await this.navigateToAssetWorkOrdersPage(assetId, payload.conditions);\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n return {\n success: false,\n message: {\n text: `Failed to open work orders in asset layout: ${error instanceof Error ? error.message : String(error)}`,\n },\n };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;AAUA;AACA,MAAM,mBAAmB,GAAG,iBAAiB;AAC7C,MAAM,mBAAmB,GAAG,OAAO;AAsBnC;AAEA;MAGa,oBAAoB,CAAA;AADjC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AA0K5D,IAAA;AAxKS,IAAA,cAAc,CAAC,KAAqC,EAAA;QAC1D,MAAM,MAAM,GACV,CAAC,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,GAAG,SAAS;AACnF,aAAC,OAAO,KAAK,CAAC,OAAO,EAAE,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI;AACvE,kBAAE,KAAK,CAAC,OAAO,CAAC;kBACd,SAAS,CAAC;QAEhB,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,IAAI;QACb;QAEA,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,OAAO,EAAE,UAAU;QAChE,OAAO,EAAE,MAAM,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC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AA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAApB,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC;;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-maintenance-management-client-work-order-list-command-Bh_6PS5w.mjs","sources":["../../../../libs/modules/maintenance-management/client/src/lib/features/commands/work-order-list-command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { Injectable, inject } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { RootConfig } from '@acorex-platform/module-maintenance-management-client/contracts';\n\n/** Asset detail route segments (must match AssetManagement entity registration). */\nconst ASSET_DETAIL_MODULE = 'AssetManagement';\nconst ASSET_DETAIL_ENTITY = 'Asset';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface WorkOrderListCommandInput {\n entity: string;\n conditions?: Array<{ name?: string; operator?: unknown; value?: unknown }>;\n}\n\ntype WorkOrderListCommandInvocation = Partial<WorkOrderListCommandInput> & {\n data?: Record<string, unknown>;\n options?: Partial<WorkOrderListCommandInput> & { entity?: string; conditions?: WorkOrderListCommandInput['conditions'] };\n};\n\ninterface ListFilterQuery {\n field: string;\n operator: { type: string };\n value: unknown;\n}\n\n//#endregion\n\n//#region ---- Command ----\n\n@Injectable()\nexport class WorkOrderListCommand implements AXPCommand<WorkOrderListCommandInput, void> {\n private readonly router = inject(Router);\n private readonly sessionService = inject(AXPSessionService);\n\n private resolvePayload(input: WorkOrderListCommandInvocation): WorkOrderListCommandInput | null {\n const entity =\n (typeof input.entity === 'string' && input.entity.trim() ? input.entity : undefined) ??\n (typeof input.options?.entity === 'string' && input.options?.entity?.trim()\n ? input.options.entity\n : undefined);\n\n if (!entity) {\n return null;\n }\n\n const conditions = input.conditions ?? input.options?.conditions;\n return { entity, ...(Array.isArray(conditions) ? { conditions } : {}) };\n }\n\n private buildFilterQueries(conditions: WorkOrderListCommandInput['conditions']): ListFilterQuery[] {\n if (!Array.isArray(conditions)) {\n return [];\n }\n\n const filters: ListFilterQuery[] = [];\n\n for (const condition of conditions) {\n const field =\n (typeof condition.name === 'string' && condition.name) ||\n (typeof (condition as { field?: string }).field === 'string'\n ? (condition as { field: string }).field\n : undefined);\n\n if (!field || condition.value === undefined || condition.value === null || condition.value === '') {\n continue;\n }\n\n const operator =\n condition.operator && typeof condition.operator === 'object' && 'type' in condition.operator\n ? (condition.operator as { type: string })\n : { type: 'equal' };\n\n filters.push({ field, operator, value: condition.value });\n }\n\n return filters;\n }\n\n private resolveAssetIdFromContext(input: WorkOrderListCommandInvocation): string | null {\n const data = input.data;\n if (!data || typeof data !== 'object') {\n return null;\n }\n\n const record = data as Record<string, unknown>;\n const assetId = record['assetId'];\n if (typeof assetId === 'string' && assetId.trim()) {\n return assetId;\n }\n\n const asset = record['asset'];\n if (asset && typeof asset === 'object' && typeof (asset as { id?: unknown }).id === 'string') {\n return (asset as { id: string }).id;\n }\n\n return null;\n }\n\n private findAssetDetailsRoute(): ActivatedRoute | null {\n const stack: ActivatedRoute[] = [this.router.routerState.root];\n\n while (stack.length > 0) {\n const current = stack.pop();\n if (!current) {\n continue;\n }\n\n const module = current.snapshot.paramMap.get('module');\n const entity = current.snapshot.paramMap.get('entity');\n const id = current.snapshot.paramMap.get('id');\n const onViewRoute = current.snapshot.url.some((segment) => segment.path === 'view');\n\n if (onViewRoute && module === ASSET_DETAIL_MODULE && entity === ASSET_DETAIL_ENTITY && id) {\n return current;\n }\n\n stack.push(...current.children);\n }\n\n return null;\n }\n\n private buildWorkOrderPageQueryParams(\n conditions: WorkOrderListCommandInput['conditions'],\n ): Record<string, string> {\n const queryParams: Record<string, string> = {\n page: RootConfig.entities.workOrder.name,\n };\n\n const filterQueries = this.buildFilterQueries(conditions);\n if (filterQueries.length > 0) {\n queryParams['filters'] = JSON.stringify(filterQueries);\n }\n\n return queryParams;\n }\n\n private async navigateWithinCurrentAssetDetails(\n assetDetailsRoute: ActivatedRoute,\n conditions: WorkOrderListCommandInput['conditions'],\n ): Promise<void> {\n await this.router.navigate([], {\n relativeTo: assetDetailsRoute,\n queryParams: this.buildWorkOrderPageQueryParams(conditions),\n queryParamsHandling: 'merge',\n });\n }\n\n private async navigateToAssetWorkOrdersPage(\n assetId: string,\n conditions: WorkOrderListCommandInput['conditions'],\n ): Promise<void> {\n const appName = this.sessionService.application?.name;\n if (!appName) {\n throw new Error('Application name is required to open work orders in asset layout.');\n }\n\n const queryParams = this.buildWorkOrderPageQueryParams(conditions);\n const queryString = new URLSearchParams(queryParams).toString();\n const path = `/${appName}/m/${ASSET_DETAIL_MODULE}/e/${ASSET_DETAIL_ENTITY}/${assetId}/view`;\n const url = queryString ? `${path}?${queryString}` : path;\n\n await this.router.navigateByUrl(url);\n }\n\n async execute(input: WorkOrderListCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const payload = this.resolvePayload(input);\n if (!payload) {\n return {\n success: false,\n message: { text: 'Entity is required for Entity:List command.' },\n };\n }\n\n const assetDetailsRoute = this.findAssetDetailsRoute();\n if (assetDetailsRoute) {\n await this.navigateWithinCurrentAssetDetails(assetDetailsRoute, payload.conditions);\n return { success: true, kind: 'object', data: undefined };\n }\n\n const assetId = this.resolveAssetIdFromContext(input);\n if (!assetId) {\n return {\n success: false,\n message: {\n text: 'Cannot open work orders in asset layout: asset id is missing on the maintenance plan.',\n },\n };\n }\n\n await this.navigateToAssetWorkOrdersPage(assetId, payload.conditions);\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n return {\n success: false,\n message: {\n text: `Failed to open work orders in asset layout: ${error instanceof Error ? error.message : String(error)}`,\n },\n };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;AAUA;AACA,MAAM,m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