@feedmepos/mf-inventory-portal 1.2.60-dev.2 → 1.2.60

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 (129) hide show
  1. package/dist/{App-B_yr-6yL.js → App-B6JtYLP4.js} +78 -82
  2. package/dist/{ApprovalView-DoYBBuSD.js → ApprovalView-fiHlFJKJ.js} +5 -5
  3. package/dist/{BindingsDialog-DG7HOy6J.js → BindingsDialog-BlF79qCu.js} +5 -5
  4. package/dist/{BindingsPicker-DVCYpyrR.js → BindingsPicker-BS2OcyII.js} +3 -3
  5. package/dist/{BindingsTable-CCel2b_W.js → BindingsTable-RyfzT4g6.js} +5 -5
  6. package/dist/{ClosingDraftView-CfM7gNBX.js → ClosingDraftView-B2d-XA_E.js} +216 -217
  7. package/dist/{ClosingHistoryView-DWH4bFgg.js → ClosingHistoryView-DZPNorN6.js} +36 -36
  8. package/dist/{ClosingTemplateView-JYnnvm7L.js → ClosingTemplateView-L596UQJH.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-BihBTJGj.js → DeliveryOrderPrintPreview-C82JPcVR.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CWjtQajS.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CNf3PA0N.js} +17 -17
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-WWzwaGw-.js} +2 -2
  12. package/dist/{FmMultiselectDialog-CxDviJZM.js → FmMultiselectDialog-CcMB_4yD.js} +16 -16
  13. package/dist/{FmMultiselectDialog-D51nW6yj.js → FmMultiselectDialog-DTLcPYaF.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DLqUnROc.js → FmUnitInput.vue_vue_type_script_setup_true_lang-ChqG8Av1.js} +22 -23
  15. package/dist/{ImportView-C52rZFib.js → ImportView-diTEPSKt.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CjZmd-Sa.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cu-dNL-B.js} +1 -1
  17. package/dist/{IngredientGroupView-DTHpZP2L.js → IngredientGroupView-CYqZOXH1.js} +5 -5
  18. package/dist/{IngredientsView-CrCW6heJ.js → IngredientsView-DoCTezXa.js} +24 -25
  19. package/dist/{IntegrationView--DZANrHj.js → IntegrationView-JboVfhvd.js} +17 -18
  20. package/dist/{InventoryBindingForm-DLTpv-zQ.js → InventoryBindingForm-B1MrDzRK.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-hkIg4Rbp.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Br1hzlQ5.js} +16 -17
  22. package/dist/{InventoryBindingSummary-D9ptV8Cw.js → InventoryBindingSummary-B09SU9pE.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdPxhkg0.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BX26mYQG.js} +5 -5
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Ci3esisT.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DIk5aP_6.js} +2 -2
  25. package/dist/{PublishView-DxzL_D61.js → PublishView-BLu0VGTW.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-D0tg-2TC.js → PurchaseOrderPrintPreview-CFZX2Yen.js} +11 -11
  27. package/dist/{ReceiveRequestView-2U534J1_.js → ReceiveRequestView-DD0kz7x8.js} +37 -38
  28. package/dist/RecipeView-Cg7v20hW.js +646 -0
  29. package/dist/{StockView-CvWbnYGz.js → StockView-CJk1YeM_.js} +105 -106
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CxjceLuZ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BFCjZO6S.js} +1 -1
  31. package/dist/{SupplierView-DMIunLvv.js → SupplierView-CTEInwI-.js} +19 -20
  32. package/dist/{SurchargeView-jteWYvQz.js → SurchargeView-CKJ2LS9l.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CyoUVoDH.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DVhI5Qy6.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DAkKiy0Z.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DjjLI4tM.js} +1 -1
  35. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dte8E0MX.js +3354 -0
  36. package/dist/{TransferTemplateView-DMQ1WIij.js → TransferTemplateView-rmrQtfX8.js} +21 -22
  37. package/dist/{UnitView-p6eZ8G2C.js → UnitView-Drvo3Tew.js} +10 -11
  38. package/dist/{WarehouseView-BIShkEPs.js → WarehouseView-DIBgCCzG.js} +5 -5
  39. package/dist/{WastageTemplateView-DCbczB_0.js → WastageTemplateView-Cdvx4Ist.js} +14 -14
  40. package/dist/api/inventory.d.ts +36 -126
  41. package/dist/api/netsuite.d.ts +1 -8
  42. package/dist/{app-BAVBNKKH.js → app-BQahEYX9.js} +6700 -7673
  43. package/dist/app.d.ts +24 -228
  44. package/dist/app.js +1 -1
  45. package/dist/{closing-template-DqxA750a.js → closing-template-ByR8ktYf.js} +1 -1
  46. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -37
  47. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +0 -14
  48. package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -16
  49. package/dist/{date2-CgwRU403.js → date2-BTP8kRm1.js} +1 -1
  50. package/dist/{dayjs.min-CjWVK_Fe.js → dayjs.min-1rxaqCQM.js} +16 -16
  51. package/dist/{defineDeepModel-B1j_kSRA.js → defineDeepModel-BaJIlpWC.js} +1 -1
  52. package/dist/{duplicate-template-iHtqE_uw.js → duplicate-template-XaB2svr5.js} +1 -1
  53. package/dist/{feature-DEryk-Cv.js → feature-Ce7hky70.js} +1044 -908
  54. package/dist/{format-time-from-id-C-mbWMLS.js → format-time-from-id-DwTuSEMw.js} +1 -1
  55. package/dist/{format-unit-display-C8Hzskg0.js → format-unit-display-DviFIF9R.js} +15 -16
  56. package/dist/{import-export.helper-DGg16RXI.js → import-export.helper-CyeFjIHv.js} +15 -16
  57. package/dist/{index-BLowSL6G.js → index-CC_ls9B4.js} +1412 -1471
  58. package/dist/{index-CLr4DPan.js → index-CeTIFqwk.js} +3 -3
  59. package/dist/{index-BAkoTUB0.js → index-f1rjUE_a.js} +1 -1
  60. package/dist/{lodash-D1_0uR01.js → lodash-Be4onxQF.js} +1 -1
  61. package/dist/{netsuite-Bbxz8tiD.js → netsuite-CB9u725A.js} +374 -372
  62. package/dist/{purchase-order-template-B-sXEbRE.js → purchase-order-template-DoBDYEtP.js} +1 -1
  63. package/dist/router/name.d.ts +0 -1
  64. package/dist/rules-DZnC9R5E.js +327 -0
  65. package/dist/stock-DcXdnfU0.js +75 -0
  66. package/dist/{stock-BYPFH5a_.js → stock-DjHGX36M.js} +1 -1
  67. package/dist/stores/feature.d.ts +0 -2
  68. package/dist/stores/integration/netsuite.d.ts +1 -8
  69. package/dist/stores/inventory.d.ts +30 -119
  70. package/dist/style.css +1 -1
  71. package/dist/{supplier-wQYh275s.js → supplier-BtZvsnMx.js} +2 -2
  72. package/dist/{surcharge-Bi21qFa0.js → surcharge-CDGjoxGm.js} +1 -1
  73. package/dist/tsconfig.app.tsbuildinfo +1 -1
  74. package/dist/{use-ingredient-select-dialog-DH-mXl8H.js → use-ingredient-select-dialog-l54ucmfp.js} +2 -2
  75. package/dist/{use-inventory-binding-dialog-i8E2CNuV.js → use-inventory-binding-dialog-adxsJaIL.js} +2 -2
  76. package/dist/{use-template-enabled-locations-2-DRk9TskI.js → use-template-enabled-locations-2-CgWtnf8k.js} +2 -2
  77. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -64
  78. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +24 -192
  79. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -8
  80. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -96
  81. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -96
  82. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
  83. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +0 -14
  84. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -32
  85. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -28
  86. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -8
  87. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +2 -16
  88. package/dist/views/receive-request/components/transfer-details/RejectDraftForm.vue.d.ts +19 -0
  89. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +5 -1
  90. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +6 -33
  91. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -16
  92. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +4 -32
  93. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
  94. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +7 -41
  95. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +42 -246
  96. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +49 -287
  97. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -16
  98. package/dist/views/stock/components/StockRecordCard.vue.d.ts +0 -1
  99. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -16
  100. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -16
  101. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -16
  102. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -16
  103. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -8
  104. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +3 -24
  105. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -96
  106. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -96
  107. package/dist/vue-i18n-CgWPe8oO.js +2365 -0
  108. package/dist/{xlsx-lp5RXzSw.js → xlsx-FLEhrhiP.js} +398 -398
  109. package/dist/{xlsx.util-BxpZNkEZ.js → xlsx.util-DoAD8sxa.js} +1 -1
  110. package/package.json +2 -2
  111. package/dist/RecipeView-VZRyX3Mm.js +0 -1558
  112. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CEXA3vvS.js +0 -3241
  113. package/dist/UnitCostHistoryView-DQ3sXVAQ.js +0 -651
  114. package/dist/api/unit-cost-history.d.ts +0 -28
  115. package/dist/number-Cof88Fjz.js +0 -232
  116. package/dist/rules-CzPUVxD_.js +0 -98
  117. package/dist/stock-D9E1uFb1.js +0 -75
  118. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -169
  119. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +0 -43
  120. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +0 -25
  121. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -125
  122. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +0 -129
  123. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +0 -30
  124. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -4
  125. package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +0 -2
  126. package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +0 -19
  127. package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +0 -11
  128. package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +0 -65
  129. package/dist/vue-i18n-Cf9iDkfk.js +0 -2365
@@ -1,3241 +0,0 @@
1
- import { p as Ct, f as We } from "./format-time-from-id-C-mbWMLS.js";
2
- import { ref as J, computed as Y, h as L, defineComponent as $e, reactive as Rt, onMounted as yt, resolveComponent as H, openBlock as l, createBlock as re, withCtx as ee, createElementVNode as e, createVNode as D, unref as v, createElementBlock as b, toDisplayString as y, createCommentVNode as B, Fragment as de, renderList as xe, createTextVNode as ke, normalizeClass as Me, watch as kt, isRef as Dt, resolveDynamicComponent as At } from "vue";
3
- import { c as mt } from "./component-DpCUABT3.js";
4
- import { R as ye, D as Se } from "./row-action.enum-BcW_L_nE.js";
5
- import { o as Nt, u as De, X as U, Y as Ze, O as se, H as Ft, c as vt, v as it, Z as ht, t as He, s as Ce, D as Ye, y as qe, E as Pe } from "./app-BAVBNKKH.js";
6
- import { k as bt, F as Tt, c as gt, a as be, t as Qe, d as Ke } from "./number-Cof88Fjz.js";
7
- import { t as It, c as Pt, h as _t, a as Ge } from "./date2-CgwRU403.js";
8
- import { u as Ue, F as qt, a as st } from "./feature-DEryk-Cv.js";
9
- import { useCoreStore as ct, useI18n as ut } from "@feedmepos/mf-common";
10
- import { u as et, a as dt, S as we } from "./netsuite-Bbxz8tiD.js";
11
- import { useDialog as tt, useSnackbar as Be, components as Je, FmButtonVariant as ge, useProxiedModel as Vt } from "@feedmepos/ui-library";
12
- import { F as Ve } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
13
- import { E as Et } from "./empty-placeholder-wf6-BWE8.js";
14
- import { u as Lt, a as Mt, f as Ut } from "./format-unit-display-C8Hzskg0.js";
15
- import { u as je, _ as Bt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-CyoUVoDH.js";
16
- import { _ as jt, a as zt, b as Kt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DLqUnROc.js";
17
- import { u as Ht, R as pt } from "./usePromise-CbVUCxhj.js";
18
- import { c as Gt } from "./index-CLr4DPan.js";
19
- import { i as Wt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js";
20
- import { F as ft } from "./form-mode.enum-BKiNVH6A.js";
21
- import { d as St } from "./defineDeepModel-B1j_kSRA.js";
22
- import { u as Yt } from "./vue-i18n-Cf9iDkfk.js";
23
- const Qt = Nt(($, a) => {
24
- const o = De();
25
- return {
26
- async getShipments({
27
- start: f,
28
- end: h
29
- }) {
30
- const n = o.currentLocationDBName, A = `${$.inventoryBackendUrl}/${n}/shipments`;
31
- return await a.get(`${A}?start=${f}&end=${h}`);
32
- },
33
- async getShipmentsByIds(f) {
34
- if (f.length === 0)
35
- return [];
36
- const h = o.currentLocationDBName, n = `${$.inventoryBackendUrl}/${h}/shipments/get`;
37
- return await a.post(n, { shipmentIds: f });
38
- }
39
- };
40
- }), xt = {
41
- [U.enum.confirmDraft]: {
42
- primaryActions: {
43
- text: "Confirm draft",
44
- close: !0
45
- },
46
- title: "Confirm draft?",
47
- message: "Purchase order cannot be changed after confirm draft.",
48
- successMessage: "Purchase order draft has been confirmed"
49
- },
50
- [U.enum.cancelDraft]: {
51
- primaryActions: {
52
- text: "Cancel draft",
53
- close: !0,
54
- variant: "destructive"
55
- },
56
- title: "Cancel draft?",
57
- message: "Purchase order cannot be changed after cancelled draft.",
58
- successMessage: "Purchase order draft has been cancelled"
59
- },
60
- [U.enum.submitRequest]: {
61
- primaryActions: {
62
- text: "Submit request",
63
- close: !0
64
- },
65
- title: "Confirm draft?",
66
- message: "Purchase order cannot be changed after confirm draft.",
67
- successMessage: "Purchase order draft has been submitted"
68
- },
69
- [U.enum.completeReceive]: {
70
- primaryActions: {
71
- text: "Mark received",
72
- close: !0
73
- },
74
- title: "Mark as received",
75
- message: "Purchase order cannot be changed after it has complete receiving.",
76
- successMessage: "Purchase order has been marked as received"
77
- },
78
- [U.enum.approveRequest]: {
79
- primaryActions: {
80
- text: "Accept request",
81
- close: !0
82
- },
83
- title: "Accept request?",
84
- message: "Transfer out request will be accepted.",
85
- successMessage: "Transfer out request has been approved"
86
- },
87
- [U.enum.rejectRequest]: {
88
- primaryActions: {
89
- text: "Reject request",
90
- close: !0,
91
- variant: "destructive"
92
- },
93
- title: "Reject request?",
94
- message: "Purchase order will be rejected.",
95
- successMessage: "Purchase order has been rejected"
96
- },
97
- [U.enum.processRequest]: {
98
- primaryActions: {
99
- text: "Process request",
100
- close: !0,
101
- variant: "destructive"
102
- },
103
- title: "Process request?",
104
- message: "Purchase order will be processed.",
105
- successMessage: "Purchase order has been processed"
106
- }
107
- };
108
- function Xe($) {
109
- return Ze.generatedPOReceivedMap({
110
- purchaseOrder: $
111
- });
112
- }
113
- function Jt($) {
114
- return Ze.validatePOItemReceivedStatus({
115
- dto: $
116
- });
117
- }
118
- function nt($) {
119
- return Ze.validatePOReceivedStatus({
120
- receivedMap: $
121
- });
122
- }
123
- function at($, a, o) {
124
- if (!se.safeParse($).success)
125
- throw new Error(`Invalid purchase order status: ${$}`);
126
- const f = se.parse($);
127
- return Ze.orderStatusCombination({
128
- status: f,
129
- isPOPartialReceive: a,
130
- isPOOverReceive: o
131
- });
132
- }
133
- function Ot() {
134
- const $ = De(), a = je(), o = Ue();
135
- async function f(n, A) {
136
- const t = $.currentLocationDBName;
137
- return n.doc.supplier.internal && n.operation === U.enum.confirmDraft && (n.operation = U.enum.submitRequest), await a.processPurchaseOrder(n, A || t);
138
- }
139
- async function h(n, A) {
140
- const t = $.currentLocationDBName;
141
- return await a.processPurchaseOrderV2(n, A || t);
142
- }
143
- return (n) => o.useOperatePurchaseOrderV2 ? h(n.operateV2, n.transferTo) : f(n.operate, n.transferTo);
144
- }
145
- var lt = /* @__PURE__ */ (($) => ($.RECEIVE_REQUEST = "receive/request", $.APPROVAL = "approval", $))(lt || {});
146
- const ze = J(), rt = J();
147
- function Wn($, a) {
148
- const o = tt(), f = De(), h = Ue();
149
- et();
150
- const n = Lt(), A = Mt(), t = J(!1), c = Be(), S = je(), x = Qt(), u = J(new Array()), T = J(new Array()), N = J(
151
- a != null && a.startDate && (a != null && a.endDate) ? a : Wt()
152
- ), w = Y(() => {
153
- const j = new Date(N.value.startDate), V = new Date(N.value.endDate);
154
- return {
155
- start: It(j).toISOString(),
156
- end: Pt(V).toISOString()
157
- };
158
- }), O = J(new Array()), r = Ft(), d = J(null);
159
- async function i(j) {
160
- function V(k) {
161
- const _ = {
162
- mode: ft.CREATE,
163
- modelValue: j || void 0,
164
- show: !0,
165
- "onUpdate:show"(F) {
166
- ze.value.show = F;
167
- },
168
- templateId: k,
169
- lastClosingDate: d.value
170
- };
171
- ze.value = _;
172
- }
173
- let oe;
174
- h.mustUsePoTemplate && !(j != null && j.template) ? o.open({
175
- title: "Create transfer",
176
- message: "",
177
- primaryActions: {
178
- text: "Select a template",
179
- close: !0
180
- },
181
- secondaryActions: {
182
- text: "Outlet to Outlet",
183
- variant: "secondary",
184
- close: !0
185
- }
186
- }).onPrimary(async () => {
187
- oe = await n.getTemplateId(), oe && V(oe);
188
- }).onSecondary(() => {
189
- V(void 0);
190
- }) : V(oe);
191
- }
192
- function g(j) {
193
- const V = {
194
- mode: ft.UPDATE,
195
- modelValue: vt(j),
196
- show: !0,
197
- "onUpdate:show"(oe) {
198
- ze.value.show = oe;
199
- },
200
- lastClosingDate: d.value
201
- };
202
- ze.value = V;
203
- }
204
- async function C() {
205
- u.value = [], T.value = [], t.value = !0;
206
- try {
207
- const j = await S.getPurchaseOrders(w.value);
208
- u.value = j.sort((G, ce) => ce._id.localeCompare(G._id));
209
- const V = j.flatMap((G) => G.shipmentIds || []).filter(Boolean), oe = V.length > 0 ? await x.getShipmentsByIds(V) : [];
210
- T.value = oe;
211
- const k = await r.readCurrentLocationLastClosing(!0), _ = k == null ? void 0 : k._id;
212
- _ && (d.value = Ct(_)), await h.awaitFeatureLoaded(() => h.mustUsePoTemplate) && await A.fetchTemplates();
213
- const F = u.value.map((G) => {
214
- var ce;
215
- return ((ce = G.request) == null ? void 0 : ce.id) ?? "";
216
- }).filter((G) => G);
217
- O.value = await S.readRequestByIds(F);
218
- } catch {
219
- c.open({
220
- title: "Something went wrong",
221
- message: "Error at fetching purchase orders",
222
- type: "error"
223
- });
224
- } finally {
225
- t.value = !1;
226
- }
227
- }
228
- async function K() {
229
- O.value = [], t.value = !0;
230
- try {
231
- O.value = await S.readRequests(
232
- void 0,
233
- w.value.start,
234
- w.value.end
235
- ).then((j) => j.reverse());
236
- } catch {
237
- c.open({
238
- title: "Something went wrong",
239
- message: "Error at fetching purchase requests",
240
- type: "error"
241
- });
242
- } finally {
243
- t.value = !1;
244
- }
245
- }
246
- function R() {
247
- switch ($) {
248
- case "receive/request":
249
- return C();
250
- case "approval":
251
- return K();
252
- }
253
- }
254
- function X(j, V) {
255
- N.value = {
256
- startDate: j,
257
- endDate: V
258
- }, R();
259
- }
260
- f.watchLocation(async (j) => {
261
- if (!j) {
262
- u.value = [];
263
- return;
264
- }
265
- await R();
266
- });
267
- const z = J(), Q = J(Math.random().toString());
268
- async function ve(j, V) {
269
- const oe = Math.random().toString();
270
- Q.value = oe, V ?? (V = O.value.computeFirst(
271
- (G) => G.purchaseOrderId === j._id ? G : null
272
- ) ?? void 0);
273
- const k = $ === "receive/request" ? f.currentLocation : V == null ? void 0 : V.to, _ = $ === "approval", F = {
274
- poRequest: V,
275
- purchaseOrder: {
276
- ...j,
277
- status: _ && (V != null && V.rejectedAt) ? se.Enum.REJECT : j.status
278
- },
279
- transferTo: k == null ? void 0 : k.name,
280
- transferToDbName: k == null ? void 0 : k.dbName,
281
- show: !0,
282
- canResubmit: !1,
283
- canApprove: _,
284
- "onUpdate:show"(G) {
285
- z.value.show = G;
286
- },
287
- scope: $,
288
- receivedMap: Xe(j) ?? {},
289
- shipments: T.value
290
- };
291
- z.value = F;
292
- }
293
- async function ie(j, V, oe, k) {
294
- const _ = Ot();
295
- t.value = !0;
296
- try {
297
- await _({
298
- operate: {
299
- operation: V,
300
- doc: j,
301
- options: (
302
- // auto receive for supplier to warehouse
303
- (V === U.enum.confirmDraft || // auto receive for warehouse to warehouse
304
- V === U.enum.completeReceive) && h.autoReceiveWarehouse ? {
305
- autoReceive: !0
306
- } : void 0
307
- )
308
- },
309
- operateV2: {
310
- _id: j._id,
311
- _rev: j._rev ?? "",
312
- action: V,
313
- payloads: []
314
- },
315
- transferTo: k
316
- }), await new Promise((ce) => setTimeout(ce, 1e3));
317
- const G = De().currentLocationDBName.startsWith("restaurant_");
318
- V === U.enum.confirmDraft && j.effectiveAt && G ? c.open({
319
- title: "Success",
320
- message: `${oe}. The backdate will be reflected once your POS has received this change.`,
321
- type: "success"
322
- }) : c.open({
323
- title: "Success",
324
- message: oe,
325
- type: "success"
326
- });
327
- } catch (F) {
328
- c.open({
329
- title: "Something went wrong",
330
- message: "Please try again.",
331
- type: "error"
332
- }), console.error("Error when submitting PO operation", V, j, F);
333
- } finally {
334
- t.value = !1, R();
335
- }
336
- }
337
- async function Ae(j, V, oe) {
338
- const k = xt[V];
339
- if (!k) {
340
- c.open({
341
- title: "Something went wrong",
342
- message: `Cannot process order: ${it(V)}`,
343
- type: "error"
344
- });
345
- return;
346
- }
347
- const { successMessage: _, ...F } = k;
348
- o.open({
349
- title: F.title,
350
- message: F.message,
351
- primaryActions: F.primaryActions
352
- }).onPrimary(() => {
353
- ie(j, V, _, oe);
354
- });
355
- }
356
- async function Ne() {
357
- o.open({
358
- title: "Upload Transfer",
359
- primaryActions: {
360
- text: "Xilnex transfer note",
361
- close: !0
362
- },
363
- secondaryActions: {
364
- text: "Cancel",
365
- close: !0
366
- }
367
- }).onPrimary(() => {
368
- const j = {
369
- show: !0,
370
- "onUpdate:show"(V) {
371
- rt.value.show = V;
372
- }
373
- };
374
- rt.value = j;
375
- });
376
- }
377
- return {
378
- purchaseOrders: u,
379
- shipments: T,
380
- purchaseRequests: O,
381
- updateDateRange: X,
382
- fetchData: R,
383
- loading: t,
384
- transferDialogProps: ze,
385
- promptCreateTransferDialog: i,
386
- promptUpdateTransferDialog: g,
387
- transferDetailsProps: z,
388
- promptShowTransferDetails: ve,
389
- submitAction: Ae,
390
- xilnexImportDialogProps: rt,
391
- promptUploadTransferDialog: Ne
392
- };
393
- }
394
- function Xt($, a) {
395
- return a.reduce(
396
- (f, h) => {
397
- const n = h.received.find((A) => A.sku._id === $._id);
398
- return n && (f = bt(f, n.amount)), f;
399
- },
400
- Tt.toPrecision(gt(0), $.unit.precision)
401
- );
402
- }
403
- function Zt($) {
404
- const { po: a, currentLocation: o, business: f, fulfilling: h, por: n } = $, { name: A, address: t, regNo: c, legalName: S } = o.doc.profile, x = {
405
- name: A,
406
- legalName: S,
407
- registrationNumber: c,
408
- line1: t == null ? void 0 : t.line1,
409
- line2: t == null ? void 0 : t.line2,
410
- postcode: t == null ? void 0 : t.postcode,
411
- city: t == null ? void 0 : t.city,
412
- state: t == null ? void 0 : t.state,
413
- country: t == null ? void 0 : t.country
414
- }, u = {
415
- name: a.supplier.name,
416
- phoneNumber: a.supplier.phoneNumber,
417
- registrationNumber: a.supplier.registrationNumber,
418
- line1: a.supplier.address.line1,
419
- line2: a.supplier.address.line2,
420
- postcode: a.supplier.address.postcode,
421
- city: a.supplier.address.city,
422
- state: a.supplier.address.state,
423
- country: a.supplier.address.country
424
- }, T = a.items.map((C) => {
425
- const { sku: K, measurement: R } = C, X = be(
426
- Xt(C.sku, a.deliveryOrder || []),
427
- !1
428
- );
429
- return {
430
- code: K.code,
431
- description: K.name,
432
- quantity: be(C.quantity, !1),
433
- unit: (R == null ? void 0 : R.abbrev) || K.unit.abbrev,
434
- received: X,
435
- cost: C.totalCost ? `${C.totalCost.currency} ${qt.toFormatString({
436
- value: C.totalCost
437
- })}` : void 0
438
- };
439
- }), N = a.deliveryOrder.map((C) => ({
440
- createdAt: _t(new Date(C.createdAt)),
441
- ref: C.deliveryOrderNumber,
442
- remark: C.remark || "",
443
- items: C.received.map((K) => {
444
- var R;
445
- return {
446
- code: K.sku.code,
447
- description: K.sku.name,
448
- quantity: be(K.amount),
449
- unit: ((R = K.measurement) == null ? void 0 : R.abbrev) || K.sku.unit.abbrev
450
- };
451
- })
452
- })), w = [
453
- // Production
454
- "67ca5d2c80bd0e001c5bf5bc",
455
- // Dev
456
- "6880b36a3054c5001db19218"
457
- ];
458
- let O = "Inventory Receive Note";
459
- if (a.supplier.internal ? (O = "Inventory Transfer Note", w.includes((f == null ? void 0 : f._id) || "") && (O = "Stock Request")) : O = "Purchase Order", n) {
460
- const C = n.from.dbName;
461
- o.dbName === C || (O = "Inventory Receive Note");
462
- }
463
- const d = {
464
- title: O,
465
- businessName: f == null ? void 0 : f.name,
466
- logo: f == null ? void 0 : f.thumbnail,
467
- orderNumber: a.seqNumber.toString(),
468
- createdAt: We(a._id),
469
- ref: a.ref || "",
470
- remark: a.remark || "",
471
- buyer: x,
472
- supplier: u,
473
- items: T,
474
- status: a.status,
475
- deliveryOrders: N
476
- }, i = new URL(window.location.href), g = h && (a.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
477
- i.pathname = i.hostname.includes("portal.feedme") ? `/inventory/${g}` : `/${g}`, i.searchParams.append("data", JSON.stringify(d)), window.open(i.href, "_blank", "noreferrer");
478
- }
479
- const Le = {
480
- submitRequest: {
481
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
482
- color: "text-fm-color-typo-primary",
483
- value: U.enum.submitRequest
484
- },
485
- confirmDraft: {
486
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
487
- color: "text-fm-color-typo-primary",
488
- value: U.enum.confirmDraft
489
- },
490
- cancelDraft: {
491
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
492
- color: "text-fm-color-typo-error",
493
- value: U.enum.cancelDraft
494
- },
495
- approveRequest: {
496
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
497
- color: "text-fm-color-typo-primary",
498
- value: U.enum.approveRequest
499
- },
500
- rejectRequest: {
501
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
502
- color: "text-fm-color-typo-error",
503
- value: U.enum.rejectRequest
504
- },
505
- processRequest: {
506
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
507
- color: "text-fm-color-typo-primary",
508
- value: U.enum.processRequest
509
- },
510
- receiveStock: {
511
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
512
- color: "text-fm-color-typo-primary",
513
- value: U.enum.receiveStock
514
- },
515
- completeReceive: {
516
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
517
- color: "text-fm-color-typo-primary",
518
- value: U.enum.completeReceive
519
- },
520
- closeRequest: {
521
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
522
- color: "system-error-300",
523
- value: U.enum.closeRequest
524
- },
525
- approveDraft: {
526
- translationKey: "",
527
- color: "",
528
- value: void 0
529
- },
530
- rejectDraft: {
531
- translationKey: "",
532
- color: "",
533
- value: void 0
534
- },
535
- returnStock: {
536
- translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
537
- color: "text-fm-color-typo-primary",
538
- value: U.enum.returnStock
539
- }
540
- };
541
- function wt() {
542
- const $ = Ue();
543
- return {
544
- ableToMarkReceived(a) {
545
- if (!a || a.status !== se.enum.RECEIVING || $.useOperatePurchaseOrderV2) return !1;
546
- const f = De().currentLocationDBName;
547
- return `${a.supplier.internal}_${a.supplier._id}` !== f;
548
- },
549
- ableToMarkApproved(a) {
550
- return !(!a || (a == null ? void 0 : a.status) !== se.enum.REQUESTING);
551
- },
552
- ableToCreateFulfillment(a, o) {
553
- var n, A;
554
- if (!$.acceptRequireFulfillment || !a || !o || a.status !== se.enum.PROCESSING || !o.processedAt)
555
- return !1;
556
- const f = (n = o == null ? void 0 : o.from) == null ? void 0 : n.dbName, h = (A = o == null ? void 0 : o.to) == null ? void 0 : A.dbName;
557
- return !(f.startsWith("restaurant_") && h.startsWith("restaurant_"));
558
- }
559
- };
560
- }
561
- function Yn($, a, o) {
562
- const f = De(), h = et(), n = ct(), A = wt(), { t } = ut();
563
- function c(w) {
564
- switch (w.status) {
565
- case "DRAFT":
566
- return [
567
- Se[ye.Update],
568
- Se[ye.Details],
569
- w.supplier.internal === "restaurant" || w.supplier.internal === "warehouse" ? Le[U.enum.submitRequest] : Le[U.enum.confirmDraft],
570
- Le[U.enum.cancelDraft]
571
- ];
572
- case "RECEIVING":
573
- return [
574
- ...A.ableToMarkReceived(w) ? [Le[U.enum.completeReceive]] : [],
575
- Se[ye.Details],
576
- Se[ye.Print]
577
- ];
578
- case "REQUESTING":
579
- return $ === "receive/request" ? [Se[ye.Details], Se[ye.Print]] : [
580
- Le[U.enum.approveRequest],
581
- Le[U.enum.rejectRequest],
582
- Se[ye.Details]
583
- // DefaultRowActions[RowActionEnum.Print]
584
- ];
585
- case "PROCESSING":
586
- return [Se[ye.Details], Se[ye.Print]];
587
- case "COMPLETE":
588
- case "CANCEL":
589
- default:
590
- return [Se[ye.Details], Se[ye.Print]];
591
- }
592
- }
593
- function S(w) {
594
- return Object.values(U.enum).includes(w);
595
- }
596
- async function x(w, O, r) {
597
- var i, g, C, K, R, X;
598
- const d = vt(O);
599
- if (w === ye.Print) {
600
- const z = (r == null ? void 0 : r.toInventoryLocation) ?? f.currentLocation;
601
- if (z.type === "restaurant") {
602
- const Q = f.locationRestaurantFromCore(z.doc._id);
603
- Q !== null && (z.doc = Q);
604
- }
605
- ((i = r == null ? void 0 : r.netSuite) != null && i.refNo || (g = d.netSuite) != null && g.refNo) && (d.ref = [((C = r == null ? void 0 : r.netSuite) == null ? void 0 : C.refNo) || ((K = d.netSuite) == null ? void 0 : K.refNo)].filter((Q) => Q).join(" ")), Zt({
606
- po: d,
607
- currentLocation: z,
608
- business: n.currentBusiness.value,
609
- fulfilling: $ === "approval",
610
- por: r
611
- });
612
- return;
613
- }
614
- if (w === ye.Details) {
615
- a.promptShowTransferDetails(d, r);
616
- return;
617
- }
618
- if (w === ye.Update) {
619
- (R = a.promptUpdateTransferDialog) == null || R.call(a, d);
620
- return;
621
- }
622
- if (S(w)) {
623
- a.submitAction(O, w, (X = r == null ? void 0 : r.to) == null ? void 0 : X.dbName);
624
- return;
625
- }
626
- }
627
- function u() {
628
- var O;
629
- const w = [
630
- {
631
- accessorKey: "seqNumber",
632
- header: () => t("inventory.transfer.table.seqNo"),
633
- enableSorting: !0,
634
- size: 80,
635
- sortUndefined: "last"
636
- },
637
- {
638
- accessorKey: "_id",
639
- header: () => t("inventory.transfer.table.createdAt"),
640
- cell(r) {
641
- return We(`${r.getValue()}`);
642
- },
643
- enableSorting: !0
644
- },
645
- {
646
- accessorKey: "supplier.name",
647
- header: () => t("inventory.transfer.table.transferFrom"),
648
- enableSorting: !0,
649
- size: 200
650
- },
651
- {
652
- accessorKey: "items.length",
653
- header: () => t("inventory.transfer.table.noOfItems"),
654
- cell: (r) => {
655
- const d = r.row.original.version || "1", i = r.getValue();
656
- return L("div", { class: "flex items-center gap-2" }, [
657
- i,
658
- d !== "1" ? L(
659
- "div",
660
- { class: "py-3" },
661
- L(
662
- Ve,
663
- L(
664
- "div",
665
- {
666
- class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
667
- },
668
- `v${d}`
669
- )
670
- )
671
- ) : null
672
- ]);
673
- },
674
- enableSorting: !1,
675
- meta: {
676
- width: "10rem"
677
- }
678
- },
679
- {
680
- accessorKey: "ref",
681
- header: () => t("inventory.transfer.table.reference"),
682
- enableSorting: !1,
683
- size: "auto"
684
- },
685
- ...(O = n.sessionUser.value) != null && O.role.isAdmin ? [
686
- {
687
- id: "statusForAdmin",
688
- header: () => L(Ve, {}, () => `${t("inventory.transfer.table.status")}`),
689
- cell(r) {
690
- return r.row.original.status;
691
- },
692
- enableSorting: !0,
693
- size: 200
694
- }
695
- ] : [],
696
- {
697
- accessorKey: "status",
698
- header: () => t("inventory.transfer.table.status"),
699
- cell(r) {
700
- const d = r.getValue(), i = Xe(r.row.original), { partial: g, over: C } = nt(i), K = at(d ?? "", g, C);
701
- let R = t(`inventory.transfer.status.${K}`), X = `${d ?? ""}`.toLocaleLowerCase("en-us");
702
- K === se.enum.CLOSE && (R = `${t(`inventory.transfer.status.${se.enum.COMPLETE}`)}`), K === "PARTIAL_RECEIVED" && X === se.enum.PROCESSING.toLocaleLowerCase("en-us") && (X = se.enum.RECEIVING.toLocaleLowerCase("en-us"));
703
- let z = null;
704
- const Q = o.value.find((ve) => ve.ref === r.row.original._id);
705
- if (Q != null && Q.milestones && Q.milestones.length > 0) {
706
- const ve = Q.milestones[Q.milestones.length - 1];
707
- if (ve.estimatedTime) {
708
- const ie = new Date(ve.estimatedTime), Ae = ie.getDate().toString().padStart(2, "0");
709
- z = `${ie.toLocaleString("en-US", { month: "short" })} ${Ae}`;
710
- }
711
- }
712
- return L(
713
- "div",
714
- {
715
- class: "flex"
716
- },
717
- [
718
- L(
719
- "div",
720
- { class: "flex items-center" },
721
- L(
722
- "div",
723
- {
724
- class: [
725
- "fm-status-badge",
726
- `fm-status-badge-${X}`,
727
- C && "fm-status-badge-error"
728
- ].filter(Boolean).join(" ")
729
- },
730
- `${R}`
731
- )
732
- ),
733
- ...z ? [
734
- L(
735
- "div",
736
- {
737
- class: "flex items-center gap-1 ml-2"
738
- },
739
- [
740
- L(Je.FmIcon, {
741
- name: "local_shipping",
742
- size: "md",
743
- color: "neutral-gray-400"
744
- }),
745
- L(
746
- "span",
747
- { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
748
- z
749
- )
750
- ]
751
- )
752
- ] : []
753
- ]
754
- );
755
- },
756
- enableSorting: !0,
757
- size: 150
758
- },
759
- {
760
- id: "action",
761
- cell(r) {
762
- const d = r.row.original, i = c(d);
763
- return mt(i, (g) => x(g, d));
764
- },
765
- enableSorting: !1,
766
- size: 40,
767
- meta: {
768
- cellClass: "",
769
- headerClass: ""
770
- }
771
- }
772
- ];
773
- if (h.isEnabled) {
774
- const r = [
775
- {
776
- id: "netsuiteTransferOrder",
777
- accessorFn: (d) => {
778
- var i;
779
- return (i = d.netSuite) != null && i.id ? `${d.netSuite.refNo} (${d.netSuite.id})` : "N/A";
780
- },
781
- header: () => "NetSuite Order (ID)",
782
- cell(d) {
783
- var g;
784
- const i = d.row.original;
785
- return (g = i.netSuite) != null && g.id ? `${i.netSuite.refNo} (${i.netSuite.id})` : "N/A";
786
- },
787
- enableSorting: !1,
788
- size: 200,
789
- meta: {
790
- cellClass: "",
791
- headerClass: ""
792
- }
793
- },
794
- {
795
- id: "netsuiteTransactionNumber",
796
- accessorFn: (d) => {
797
- var i, g;
798
- return ((g = (i = d.netSuite) == null ? void 0 : i.additionalInfo) == null ? void 0 : g.transactionnumber) ?? "N/A";
799
- },
800
- header: () => "NetSuite Transaction No.",
801
- cell(d) {
802
- var g, C;
803
- return ((C = (g = d.row.original.netSuite) == null ? void 0 : g.additionalInfo) == null ? void 0 : C.transactionnumber) ?? "N/A";
804
- },
805
- enableSorting: !1,
806
- size: 200,
807
- meta: {
808
- cellClass: "",
809
- headerClass: ""
810
- }
811
- }
812
- ];
813
- w.splice(w.length - 1, 0, ...r);
814
- }
815
- return w;
816
- }
817
- function T() {
818
- var O;
819
- const w = [
820
- {
821
- accessorKey: "purchaseOrder.seqNumber",
822
- header: () => t("inventory.transfer.table.seqNo"),
823
- enableSorting: !0,
824
- size: 80,
825
- sortUndefined: "last"
826
- },
827
- {
828
- accessorKey: "purchaseOrder._id",
829
- header: () => t("inventory.transfer.table.createdAt"),
830
- cell(r) {
831
- return We(`${r.getValue()}`);
832
- },
833
- enableSorting: !0
834
- },
835
- {
836
- accessorKey: "to.name",
837
- header: () => t("inventory.transfer.table.transferTo"),
838
- enableSorting: !1,
839
- size: 200
840
- },
841
- {
842
- accessorKey: "purchaseOrder.items.length",
843
- header: () => t("inventory.transfer.table.noOfItems"),
844
- enableSorting: !1
845
- },
846
- {
847
- accessorKey: "purchaseOrder.ref",
848
- header: () => t("inventory.transfer.table.reference"),
849
- enableSorting: !1,
850
- size: "auto"
851
- },
852
- ...(O = n.sessionUser.value) != null && O.role.isAdmin ? [
853
- {
854
- id: "statusForAdmin",
855
- header: () => L(Ve, {}, () => `${t("inventory.transfer.table.status")}`),
856
- cell(r) {
857
- return r.row.original.status;
858
- },
859
- enableSorting: !0,
860
- size: 200
861
- }
862
- ] : [],
863
- {
864
- accessorKey: "purchaseOrder.status",
865
- header: () => t("inventory.transfer.table.status"),
866
- cell(r) {
867
- const d = r.row.original, i = r.getValue();
868
- if (!d.purchaseOrder)
869
- return L(Je.FmChip, {
870
- label: "N/A",
871
- compact: !0
872
- });
873
- const g = Xe(d.purchaseOrder), { partial: C, over: K } = nt(g), R = at(i ?? "", C, K);
874
- let X = t(`inventory.transfer.status.${R}`), z = `${i ?? ""}`.toLocaleLowerCase("en-us");
875
- return R === se.enum.CLOSE && (X = `${t(`inventory.transfer.status.${se.enum.COMPLETE}`)}`), R === "PARTIAL_RECEIVED" && z === se.enum.PROCESSING.toLocaleLowerCase("en-us") && (z = se.enum.RECEIVING.toLocaleLowerCase("en-us")), d.rejectedAt && (X = t("inventory.transfer.status.REJECT"), z = se.enum.REJECT.toLocaleLowerCase("en-us")), L(
876
- "div",
877
- {
878
- class: "flex"
879
- },
880
- L(
881
- "div",
882
- {
883
- class: [
884
- "fm-status-badge",
885
- `fm-status-badge-${z}`,
886
- K && "fm-status-badge-error"
887
- ].filter(Boolean).join(" ")
888
- },
889
- `${X}`
890
- )
891
- );
892
- },
893
- enableSorting: !0
894
- },
895
- {
896
- id: "action",
897
- cell(r) {
898
- const d = r.row.original, g = (d.purchaseOrder ? c(d.purchaseOrder) : []).map((C) => C.value === ye.Print ? {
899
- ...C,
900
- translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
901
- } : C);
902
- return mt(
903
- g,
904
- (C) => d.purchaseOrder ? x(C, d.purchaseOrder, d) : void 0
905
- );
906
- },
907
- enableSorting: !1,
908
- size: 40,
909
- meta: {
910
- cellClass: "",
911
- headerClass: ""
912
- }
913
- }
914
- ];
915
- if (h.isEnabled) {
916
- const r = [
917
- {
918
- id: "netsuiteTransferOrder",
919
- accessorFn: (d) => {
920
- var i;
921
- return (i = d.netSuite) != null && i.id ? `${d.netSuite.refNo} (${d.netSuite.id})` : "N/A";
922
- },
923
- header: () => "NetSuite Order (ID)",
924
- cell(d) {
925
- var g;
926
- const i = d.row.original;
927
- return (g = i.netSuite) != null && g.id ? `${i.netSuite.refNo} (${i.netSuite.id})` : "N/A";
928
- },
929
- enableSorting: !1,
930
- size: 200,
931
- meta: {
932
- cellClass: "",
933
- headerClass: ""
934
- }
935
- },
936
- {
937
- id: "netsuiteTransactionNumber",
938
- accessorFn: (d) => {
939
- var i, g;
940
- return ((g = (i = d.netSuite) == null ? void 0 : i.additionalInfo) == null ? void 0 : g.transactionnumber) ?? "N/A";
941
- },
942
- header: () => "NetSuite Transaction No.",
943
- cell(d) {
944
- var g, C;
945
- return ((C = (g = d.row.original.netSuite) == null ? void 0 : g.additionalInfo) == null ? void 0 : C.transactionnumber) ?? "N/A";
946
- },
947
- enableSorting: !1,
948
- size: 200,
949
- meta: {
950
- cellClass: "",
951
- headerClass: ""
952
- }
953
- }
954
- ];
955
- w.splice(w.length - 2, 0, ...r);
956
- }
957
- return w;
958
- }
959
- return {
960
- columnDefs: Y(() => $ === "receive/request" ? u() : T())
961
- };
962
- }
963
- const es = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, ts = { class: "flex flex-col gap-8" }, ss = { class: "flex w-full justify-end gap-16" }, rs = /* @__PURE__ */ $e({
964
- __name: "FulfillmentForm",
965
- props: {
966
- purchaseOrder: {},
967
- confirm: { type: Function }
968
- },
969
- emits: ["update:show"],
970
- setup($, { emit: a }) {
971
- const o = $, f = Rt({
972
- id: "",
973
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
974
- items: []
975
- }), h = J(), n = a;
976
- yt(() => {
977
- o.purchaseOrder && (f.items = o.purchaseOrder.items.map((t) => ({
978
- id: t.id,
979
- sku: t.sku,
980
- measurement: t.measurement,
981
- amount: t.quantity ?? { amount: 1, precision: 0 }
982
- })));
983
- });
984
- const A = Y(() => f.items.length <= 10);
985
- return (t, c) => {
986
- const S = H("FmTable"), x = H("FmButton"), u = H("FmForm");
987
- return l(), re(u, {
988
- ref_key: "formRef",
989
- ref: h,
990
- class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
991
- onValidationFailed: console.log,
992
- onValidationSuccess: c[1] || (c[1] = () => o.confirm(f))
993
- }, {
994
- default: ee(() => [
995
- c[2] || (c[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
996
- e("div", es, [
997
- e("div", ts, [
998
- D(S, {
999
- "column-defs": [
1000
- {
1001
- header: "Code",
1002
- cell: (T) => {
1003
- const N = o.purchaseOrder.items.find((w) => w.id === T.row.original.id || w.sku._id === T.row.original.sku._id);
1004
- return L(
1005
- v(Je).FmTooltip,
1006
- {
1007
- content: N.code,
1008
- placement: "top",
1009
- variant: "plain",
1010
- zIndex: 50
1011
- },
1012
- L(
1013
- "span",
1014
- {
1015
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
1016
- },
1017
- N.code
1018
- )
1019
- );
1020
- }
1021
- },
1022
- {
1023
- header: "Name",
1024
- cell: (T) => {
1025
- const N = o.purchaseOrder.items.find((w) => w.id === T.row.original.id || w.sku._id === T.row.original.sku._id);
1026
- return L(
1027
- v(Je).FmTooltip,
1028
- {
1029
- content: N.name,
1030
- placement: "top",
1031
- variant: "plain",
1032
- zIndex: 50
1033
- },
1034
- L(
1035
- "span",
1036
- {
1037
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
1038
- },
1039
- N.name
1040
- )
1041
- );
1042
- }
1043
- },
1044
- {
1045
- header: "Amount",
1046
- cell: (T) => {
1047
- const N = T.row.original, w = o.purchaseOrder.items.find((r) => r.id === N.id || r.sku._id === N.sku._id), O = N.amount ?? {
1048
- amount: 1,
1049
- precision: 0
1050
- };
1051
- return L(jt, {
1052
- style: {
1053
- flex: "1 1 0%"
1054
- },
1055
- modelValue: {
1056
- amount: O,
1057
- measurement: N.measurement ?? null
1058
- },
1059
- key: N.id ?? N.sku._id,
1060
- unit: N.sku.unit,
1061
- "onUpdate:modelValue": (r) => {
1062
- if (!r) return;
1063
- const d = f.items.find((i) => i.id === N.id || i.sku._id === N.sku._id);
1064
- d && (d.amount = r.amount);
1065
- },
1066
- disableUnit: !0,
1067
- rules: [
1068
- v(zt)(
1069
- +v(be)({ amount: 0, precision: 0 })
1070
- ),
1071
- v(Kt)(+v(be)(w.quantity))
1072
- ],
1073
- applyDefaultRules: !0
1074
- });
1075
- }
1076
- }
1077
- ],
1078
- "row-data": f.items,
1079
- "hide-footer": A.value
1080
- }, null, 8, ["column-defs", "row-data", "hide-footer"])
1081
- ])
1082
- ]),
1083
- e("div", ss, [
1084
- D(x, {
1085
- class: "px-16",
1086
- label: "Confirm",
1087
- size: "md",
1088
- variant: "primary",
1089
- type: "submit"
1090
- }),
1091
- D(x, {
1092
- class: "px-16",
1093
- label: "Cancel",
1094
- size: "md",
1095
- variant: "secondary",
1096
- onClick: c[0] || (c[0] = () => n("update:show", !1))
1097
- })
1098
- ])
1099
- ]),
1100
- _: 1
1101
- }, 8, ["onValidationFailed"]);
1102
- };
1103
- }
1104
- }), ot = {
1105
- submitRequest: {
1106
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
1107
- color: "primary",
1108
- buttonVariant: ge.Primary
1109
- },
1110
- confirmDraft: {
1111
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
1112
- color: "primary",
1113
- buttonVariant: ge.Primary
1114
- },
1115
- cancelDraft: {
1116
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
1117
- color: "system-error-300",
1118
- buttonVariant: ge.Destructive
1119
- },
1120
- approveDraft: {
1121
- translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
1122
- color: "primary",
1123
- buttonVariant: ge.Primary
1124
- },
1125
- rejectDraft: {
1126
- translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
1127
- color: "system-error-300",
1128
- buttonVariant: ge.Destructive
1129
- },
1130
- approveRequest: {
1131
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
1132
- color: "primary",
1133
- buttonVariant: ge.Primary
1134
- },
1135
- processRequest: {
1136
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
1137
- color: "primary",
1138
- buttonVariant: ge.Primary
1139
- },
1140
- receiveStock: {
1141
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
1142
- color: "primary",
1143
- buttonVariant: ge.Primary,
1144
- available: !1
1145
- },
1146
- completeReceive: {
1147
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
1148
- color: "primary",
1149
- buttonVariant: ge.Plain
1150
- },
1151
- rejectRequest: {
1152
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
1153
- color: "system-error-300",
1154
- buttonVariant: ge.Destructive
1155
- },
1156
- closeRequest: {
1157
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
1158
- color: "system-error-300",
1159
- buttonVariant: ge.Destructive,
1160
- available: !1
1161
- },
1162
- returnStock: {
1163
- translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1164
- color: "primary",
1165
- buttonVariant: ge.Primary,
1166
- available: !1
1167
- }
1168
- }, os = { class: "flex flex-row-reverse" }, ns = /* @__PURE__ */ $e({
1169
- __name: "NetSuiteSync",
1170
- props: {
1171
- poRequest: {},
1172
- purchaseOrder: {},
1173
- isTransferBetweenOutlets: { type: Boolean },
1174
- scope: {}
1175
- },
1176
- setup($) {
1177
- const a = $, o = et(), f = Be(), h = tt(), n = J(!1);
1178
- Y(() => {
1179
- var x, u, T, N;
1180
- let t = !0;
1181
- o.isEnabled || (t = !1);
1182
- const c = a.purchaseOrder, S = a.poRequest;
1183
- return c && ((x = c == null ? void 0 : c.supplier) != null && x.internal ? (!S && c.status == se.enum.DRAFT && (t = !1), S && !((u = S == null ? void 0 : S.netSuite) != null && u.id) && (t = !1), a.isTransferBetweenOutlets && (t = !1)) : ((c == null ? void 0 : c.status) !== se.enum.REQUESTING && c.supplier.internal && (t = !1), !S && !((T = c == null ? void 0 : c.netSuite) != null && T.id) && (t = !1), !S && ((N = c == null ? void 0 : c.netSuite) != null && N.id) && (c == null ? void 0 : c.status) == se.enum.REQUESTING && (t = !1))), t;
1184
- });
1185
- async function A() {
1186
- n.value || h.open({
1187
- title: "Sync with NetSuite",
1188
- contentComponent: L("div", [
1189
- L("p", "Are you sure you want to sync now?"),
1190
- L("br"),
1191
- L(
1192
- "p",
1193
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1194
- "Please wait a moment before syncing manually to avoid unnecessary actions."
1195
- )
1196
- ]),
1197
- primaryActions: {
1198
- text: "Sync",
1199
- close: !0,
1200
- variant: "destructive"
1201
- },
1202
- secondaryActions: { text: "Not now", close: !0 }
1203
- }).onPrimary(async () => {
1204
- var t, c, S;
1205
- try {
1206
- n.value = !0;
1207
- const x = ((t = a.purchaseOrder) == null ? void 0 : t._id) || ((c = a.poRequest) == null ? void 0 : c.purchaseOrderId) || "", u = (S = a.poRequest) == null ? void 0 : S.to.dbName;
1208
- await o.syncPurchaseOrder(
1209
- x,
1210
- a.scope === "approval" ? u : void 0
1211
- ), f.open({
1212
- title: "Sync with NetSuite",
1213
- message: "Requested to sync with NetSuite. Please wait a moment.",
1214
- type: "success"
1215
- }), await new Promise((T) => setTimeout(T, 5e3)), n.value = !1;
1216
- } catch {
1217
- f.open({
1218
- title: "Error",
1219
- message: "Failed to sync with NetSuite",
1220
- type: "error"
1221
- }), n.value = !1;
1222
- }
1223
- });
1224
- }
1225
- return (t, c) => {
1226
- const S = H("FmButton");
1227
- return l(), b("div", os, [
1228
- D(S, {
1229
- "prepend-icon": "sync",
1230
- variant: "secondary",
1231
- label: "Sync",
1232
- loading: n.value,
1233
- onClick: A,
1234
- "text-color": "primary",
1235
- "bg-color": "transparent",
1236
- "border-color": "primary"
1237
- }, null, 8, ["loading"])
1238
- ]);
1239
- };
1240
- }
1241
- }), as = {
1242
- key: 0,
1243
- class: "flex flex-col gap-8"
1244
- }, ls = { class: "flex flex-col gap-4" }, is = { class: "fm-typo-en-body-lg-600" }, cs = {
1245
- key: 0,
1246
- class: "flex flex-col gap-4"
1247
- }, us = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ds = { class: "fm-typo-en-body-lg-600" }, ms = { key: 0 }, ps = { key: 1 }, fs = {
1248
- key: 1,
1249
- class: "flex flex-col gap-4"
1250
- }, ys = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, vs = { class: "fm-typo-en-body-lg-600" }, hs = { key: 0 }, bs = { key: 1 }, gs = {
1251
- key: 2,
1252
- class: "flex flex-col gap-4"
1253
- }, _s = { class: "fm-typo-en-body-lg-600" }, Ss = {
1254
- key: 3,
1255
- class: "flex flex-col gap-4"
1256
- }, xs = { class: "fm-typo-en-body-lg-600" }, Os = /* @__PURE__ */ $e({
1257
- __name: "NetSuiteInfo",
1258
- props: {
1259
- transferType: {},
1260
- transferToDbName: {},
1261
- poRequest: {},
1262
- purchaseOrder: {},
1263
- isTransferBetweenOutlets: { type: Boolean },
1264
- scope: {}
1265
- },
1266
- setup($) {
1267
- const a = $, o = et(), f = je(), h = J(a.poRequest);
1268
- yt(async () => {
1269
- var c;
1270
- if (!a.poRequest && ((c = a.purchaseOrder) != null && c._id)) {
1271
- const S = await f.getLatestPurchaseOrderRequest(a.purchaseOrder._id);
1272
- h.value = S;
1273
- }
1274
- });
1275
- const n = Y(
1276
- () => {
1277
- var c, S, x, u, T, N;
1278
- return o.getSubsidiaryFullName(
1279
- ((x = (S = (c = a.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : S.subsidiary) == null ? void 0 : x.id) || ((N = (T = (u = a.poRequest) == null ? void 0 : u.netSuite) == null ? void 0 : T.subsidiary) == null ? void 0 : N.id)
1280
- ).fullName;
1281
- }
1282
- ), A = Y(() => {
1283
- var c, S, x, u, T, N, w, O, r, d, i, g;
1284
- return (x = (S = (c = a.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : S.additionalInfo) != null && x.transactionnumber ? (N = (T = (u = a.purchaseOrder) == null ? void 0 : u.netSuite) == null ? void 0 : T.additionalInfo) == null ? void 0 : N.transactionnumber : (r = (O = (w = h.value) == null ? void 0 : w.netSuite) == null ? void 0 : O.additionalInfo) != null && r.transactionnumber ? (g = (i = (d = h.value) == null ? void 0 : d.netSuite) == null ? void 0 : i.additionalInfo) == null ? void 0 : g.transactionnumber : null;
1285
- }), t = Y(() => {
1286
- var c, S, x, u, T, N;
1287
- return (S = (c = a.purchaseOrder) == null ? void 0 : c.deliveryFullfillment) != null && S.length && ((u = (x = a.purchaseOrder) == null ? void 0 : x.deliveryFullfillment) == null ? void 0 : u.length) > 0 ? (N = (T = a.purchaseOrder) == null ? void 0 : T.deliveryFullfillment) == null ? void 0 : N.map((w) => {
1288
- var O;
1289
- return (O = w.netSuite) == null ? void 0 : O.refNo;
1290
- }).join(", ") : "N/A";
1291
- });
1292
- return (c, S) => {
1293
- var x, u, T, N, w, O, r, d, i, g, C, K, R, X, z, Q;
1294
- return v(o).isEnabled ? (l(), b("div", as, [
1295
- e("div", ls, [
1296
- S[0] || (S[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1297
- e("div", is, y(n.value || "N/A"), 1)
1298
- ]),
1299
- !c.isTransferBetweenOutlets && c.scope === v(lt).RECEIVE_REQUEST ? (l(), b("div", cs, [
1300
- e("div", us, " NetSuite " + y((u = (x = c.purchaseOrder) == null ? void 0 : x.netSuite) != null && u.recordType ? v(ht)((N = (T = c.purchaseOrder) == null ? void 0 : T.netSuite) == null ? void 0 : N.recordType) : c.transferType === v(He).enum.purchase ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1301
- e("div", ds, [
1302
- (O = (w = c.purchaseOrder) == null ? void 0 : w.netSuite) != null && O.id ? (l(), b("span", ms, y((d = (r = c.purchaseOrder) == null ? void 0 : r.netSuite) == null ? void 0 : d.refNo) + " (" + y((g = (i = c.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : g.id) + ") ", 1)) : (l(), b("span", ps, "N/A"))
1303
- ])
1304
- ])) : B("", !0),
1305
- !c.isTransferBetweenOutlets && h.value || c.scope === v(lt).APPROVAL ? (l(), b("div", fs, [
1306
- e("div", ys, " (Request) NetSuite " + y(c.transferType === v(He).enum.purchase ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1307
- e("div", vs, [
1308
- (K = (C = h.value) == null ? void 0 : C.netSuite) != null && K.id ? (l(), b("span", hs, y((X = (R = h.value) == null ? void 0 : R.netSuite) == null ? void 0 : X.refNo) + " (" + y((Q = (z = h.value) == null ? void 0 : z.netSuite) == null ? void 0 : Q.id) + ") ", 1)) : (l(), b("span", bs, "N/A"))
1309
- ])
1310
- ])) : B("", !0),
1311
- A.value ? (l(), b("div", gs, [
1312
- S[1] || (S[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1313
- e("div", _s, y(A.value), 1)
1314
- ])) : B("", !0),
1315
- v(o).isEnabled && c.transferType === v(He).enum.transfer && !c.isTransferBetweenOutlets ? (l(), b("div", Ss, [
1316
- S[2] || (S[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1317
- e("div", xs, y(t.value), 1)
1318
- ])) : B("", !0)
1319
- ])) : B("", !0);
1320
- };
1321
- }
1322
- }), ws = { class: "flex flex-row-reverse" }, $s = /* @__PURE__ */ $e({
1323
- __name: "NetSuiteLog",
1324
- props: {
1325
- netsuiteId: {},
1326
- purchaseOrderId: {}
1327
- },
1328
- setup($) {
1329
- const a = Be(), o = dt();
1330
- async function f(h, n) {
1331
- const A = [];
1332
- if (h && A.push(`body.message:*${h}*`), n) {
1333
- const x = n.replace(/:/g, "\\:");
1334
- A.push(`${x}`);
1335
- }
1336
- if (A.length === 0) {
1337
- a.open({
1338
- message: "Cannot open logs without valid filters.",
1339
- type: "error"
1340
- });
1341
- return;
1342
- }
1343
- const c = `attributes.pod:netsuite* AND (${A.join(" OR ")})`, { url: S } = await o.getSyncLogs(c);
1344
- a.open(
1345
- {
1346
- message: "Opening NetSuite logs...",
1347
- type: "info"
1348
- },
1349
- 800
1350
- ), await new Promise((x) => setTimeout(x, 800)), window.open(S, "_blank");
1351
- }
1352
- return (h, n) => {
1353
- const A = H("FmButton");
1354
- return l(), b("div", ws, [
1355
- D(A, {
1356
- "prepend-icon": "history",
1357
- variant: "secondary",
1358
- label: "Logs",
1359
- onClick: n[0] || (n[0] = (t) => f(h.netsuiteId, h.purchaseOrderId)),
1360
- "text-color": "primary",
1361
- "bg-color": "transparent",
1362
- "border-color": "primary"
1363
- })
1364
- ]);
1365
- };
1366
- }
1367
- }), Cs = { class: "flex flex-row-reverse" }, Rs = { key: 0 }, ks = { key: 1 }, Ds = { class: "mb-6" }, As = { class: "fm-typo-en-body-md-400" }, Ns = { key: 0 }, Fs = { key: 1 }, Ts = {
1368
- key: 0,
1369
- class: "flex"
1370
- }, Is = {
1371
- key: 1,
1372
- class: "border-t pt-6"
1373
- }, Ps = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, qs = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, Vs = { class: "w-full" }, Es = {
1374
- class: "p-3 fm-typo-en-body-sm-600",
1375
- style: { "min-width": "130px" }
1376
- }, Ls = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ms = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Us = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Bs = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, js = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, zs = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ks = { class: "p-3 fm-typo-en-body-sm-600" }, Hs = { key: 2 }, Gs = { key: 1 }, Ws = /* @__PURE__ */ $e({
1377
- __name: "NetSuiteLatestInfo",
1378
- props: {
1379
- netsuiteId: {},
1380
- purchaseOrderId: {}
1381
- },
1382
- setup($) {
1383
- const a = $, o = dt(), f = J(!1), h = De(), n = J(!0), A = J(!1), t = J(!1), c = J(!1), S = J(null), x = J([]);
1384
- async function u() {
1385
- if (!S.value) {
1386
- f.value = !0;
1387
- try {
1388
- n.value = !0;
1389
- const O = await o.getMoreInfo(
1390
- h.currentLocation.dbName,
1391
- a.purchaseOrderId
1392
- );
1393
- S.value = O, A.value = !1;
1394
- } catch {
1395
- A.value = !0;
1396
- } finally {
1397
- n.value = !1;
1398
- }
1399
- await T();
1400
- }
1401
- }
1402
- async function T() {
1403
- if (!(x.value.length > 0))
1404
- try {
1405
- t.value = !0;
1406
- const O = await o.getChangeLogs(a.netsuiteId);
1407
- x.value = O, c.value = !1;
1408
- } catch {
1409
- c.value = !0;
1410
- } finally {
1411
- t.value = !1;
1412
- }
1413
- }
1414
- function N(O) {
1415
- switch (O) {
1416
- case we.Create:
1417
- return "text-green-600 bg-green-100";
1418
- case we.Set:
1419
- return "text-blue-600 bg-blue-100";
1420
- case we.Change:
1421
- return "text-yellow-600 bg-yellow-100";
1422
- case we.Unset:
1423
- return "text-red-600 bg-red-100";
1424
- default:
1425
- return "text-gray-600 bg-gray-100";
1426
- }
1427
- }
1428
- function w(O) {
1429
- return new Date(O).toLocaleDateString("en-US", {
1430
- year: "numeric",
1431
- month: "short",
1432
- day: "numeric",
1433
- hour: "2-digit",
1434
- minute: "2-digit"
1435
- });
1436
- }
1437
- return (O, r) => {
1438
- const d = H("FmButton"), i = H("FmLabel"), g = H("FmCircularProgress"), C = H("FmIcon"), K = H("FmDialog");
1439
- return l(), b("div", Cs, [
1440
- D(K, {
1441
- modelValue: f.value,
1442
- "onUpdate:modelValue": r[2] || (r[2] = (R) => f.value = R),
1443
- overlay: !0,
1444
- "max-width": 800
1445
- }, {
1446
- "dialog-button": ee(() => [
1447
- D(d, {
1448
- "prepend-icon": "info",
1449
- variant: "secondary",
1450
- label: "Latest Info",
1451
- onClick: r[0] || (r[0] = (R) => u()),
1452
- "text-color": "primary",
1453
- "bg-color": "transparent",
1454
- "border-color": "primary"
1455
- })
1456
- ]),
1457
- "dialog-header": ee(() => r[3] || (r[3] = [
1458
- e("div", null, "NetSuite latest info", -1)
1459
- ])),
1460
- default: ee(() => [
1461
- n.value ? (l(), b("div", Rs, "Loading...")) : (l(), b("div", ks, [
1462
- A.value ? (l(), b("p", Gs, "Something went wrong.")) : (l(), b(de, { key: 0 }, [
1463
- e("div", Ds, [
1464
- r[4] || (r[4] = e("h3", { class: "fm-typo-en-body-lg-600 mb-4" }, "NetSuite Order Details", -1)),
1465
- (l(!0), b(de, null, xe(S.value, (R, X) => (l(), b("div", {
1466
- key: X,
1467
- class: "mb-2"
1468
- }, [
1469
- e("div", null, [
1470
- D(i, {
1471
- label: v(it)(X)
1472
- }, null, 8, ["label"]),
1473
- e("div", As, [
1474
- Array.isArray(R) ? (l(), b("span", Ns, y(R.length > 0 ? R.join(", ") : "N/A"), 1)) : (l(), b("span", Fs, y(R), 1))
1475
- ])
1476
- ])
1477
- ]))), 128))
1478
- ]),
1479
- t.value ? (l(), b("div", Ts, [
1480
- r[5] || (r[5] = e("span", null, "Change Log Loading...", -1)),
1481
- D(g, { size: "md" })
1482
- ])) : B("", !0),
1483
- !t.value && x.value.length > 0 ? (l(), b("div", Is, [
1484
- e("h3", Ps, [
1485
- D(C, {
1486
- name: "error",
1487
- color: "#ff9500",
1488
- size: "sm"
1489
- }),
1490
- r[6] || (r[6] = ke(" Change Logs "))
1491
- ]),
1492
- e("div", qs, [
1493
- e("table", Vs, [
1494
- r[7] || (r[7] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
1495
- e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
1496
- e("th", {
1497
- class: "text-left p-3 fm-typo-en-body-md-600",
1498
- style: { "min-width": "130px" }
1499
- }, " Date "),
1500
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
1501
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
1502
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
1503
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
1504
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
1505
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
1506
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
1507
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
1508
- ])
1509
- ], -1)),
1510
- e("tbody", null, [
1511
- (l(!0), b(de, null, xe(x.value, (R, X) => (l(), b("tr", {
1512
- key: X,
1513
- class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
1514
- }, [
1515
- e("td", Es, y(w(R._dateiso8601)), 1),
1516
- e("td", Ls, y(R._rolename), 1),
1517
- e("td", Ms, y(R._employeename), 1),
1518
- e("td", Us, y(R._contextname), 1),
1519
- e("td", {
1520
- class: Me(`p-3 fm-typo-en-body-sm-600 ${N(Number(R.type) - 1)}`)
1521
- }, y(v(we)[Number(R.type) - 1]), 3),
1522
- e("td", Bs, y(R.lineid || ""), 1),
1523
- e("td", js, y(R._fieldname), 1),
1524
- e("td", zs, y(R.oldvalue || ""), 1),
1525
- e("td", Ks, y(R.newvalue || ""), 1)
1526
- ]))), 128))
1527
- ])
1528
- ])
1529
- ])
1530
- ])) : (l(), b("div", Hs, r[8] || (r[8] = [
1531
- e("p", null, "No change logs available.", -1)
1532
- ])))
1533
- ], 64))
1534
- ]))
1535
- ]),
1536
- "dialog-footer": ee(() => [
1537
- D(d, {
1538
- class: "ml-auto sm:w-full xs:w-full",
1539
- label: "Close",
1540
- size: "md",
1541
- variant: "primary",
1542
- onClick: r[1] || (r[1] = (R) => f.value = !1)
1543
- })
1544
- ]),
1545
- _: 1
1546
- }, 8, ["modelValue"])
1547
- ]);
1548
- };
1549
- }
1550
- }), Ys = {
1551
- key: 0,
1552
- class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1553
- }, Qs = { class: "flex gap-8 items-center" }, Js = { class: "ml-auto" }, Xs = { class: "flex gap-3" }, Zs = /* @__PURE__ */ $e({
1554
- __name: "NetSuitePanel",
1555
- props: {
1556
- poRequest: {},
1557
- purchaseOrder: {},
1558
- transferType: {},
1559
- transferToDbName: {},
1560
- scope: {}
1561
- },
1562
- setup($) {
1563
- const a = $, o = Gt(), f = Y(() => o.isNetSuiteEnabled);
1564
- return (h, n) => {
1565
- var t, c;
1566
- const A = H("FmMenuDivider");
1567
- return f.value ? (l(), b("div", Ys, [
1568
- e("div", Qs, [
1569
- n[0] || (n[0] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1570
- e("div", Js, [
1571
- e("div", Xs, [
1572
- (c = (t = a.purchaseOrder) == null ? void 0 : t.netSuite) != null && c.id ? (l(), re(Ve, { key: 0 }, {
1573
- default: ee(() => {
1574
- var S, x, u;
1575
- return [
1576
- D(Ws, {
1577
- "netsuite-id": (x = (S = h.purchaseOrder) == null ? void 0 : S.netSuite) == null ? void 0 : x.id,
1578
- "purchase-order-id": (u = h.purchaseOrder) == null ? void 0 : u._id
1579
- }, null, 8, ["netsuite-id", "purchase-order-id"])
1580
- ];
1581
- }),
1582
- _: 1
1583
- })) : B("", !0),
1584
- D(Ve, null, {
1585
- default: ee(() => {
1586
- var S, x, u;
1587
- return [
1588
- D($s, {
1589
- "netsuite-id": (x = (S = h.purchaseOrder) == null ? void 0 : S.netSuite) == null ? void 0 : x.id,
1590
- "purchase-order-id": (u = h.purchaseOrder) == null ? void 0 : u._id
1591
- }, null, 8, ["netsuite-id", "purchase-order-id"])
1592
- ];
1593
- }),
1594
- _: 1
1595
- }),
1596
- D(ns, {
1597
- "po-request": h.poRequest,
1598
- "purchase-order": h.purchaseOrder,
1599
- "is-transfer-between-outlets": !f.value,
1600
- scope: h.scope
1601
- }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1602
- ])
1603
- ])
1604
- ]),
1605
- D(A),
1606
- D(Os, {
1607
- "po-request": h.poRequest,
1608
- "purchase-order": h.purchaseOrder,
1609
- "transfer-type": h.transferType,
1610
- "transfer-to-db-name": h.transferToDbName,
1611
- "is-transfer-between-outlets": !f.value,
1612
- scope: h.scope
1613
- }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1614
- ])) : B("", !0);
1615
- };
1616
- }
1617
- }), er = { class: "flex flex-col gap-3" }, tr = { class: "flex flex-col gap-4" }, sr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, rr = { class: "flex flex-col gap-4" }, or = { class: "flex justify-between items-center py-1 gap-4" }, nr = { class: "flex flex-col" }, ar = { class: "fm-typo-en-body-lg-600" }, lr = { class: "fm-typo-en-body-md-400" }, ir = { class: "flex flex-col gap-2 items-end" }, cr = { class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ur = {
1618
- key: 0,
1619
- class: "flex items-center gap-2"
1620
- }, dr = {
1621
- key: 0,
1622
- class: "border-b border-fm-color-stroke-secondary"
1623
- }, mr = { class: "flex flex-col gap-4" }, pr = { class: "flex flex-col gap-4" }, fr = { class: "flex flex-col gap-4" }, yr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, vr = {
1624
- key: 0,
1625
- class: "flex flex-col gap-4"
1626
- }, hr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, br = /* @__PURE__ */ $e({
1627
- __name: "EditForm",
1628
- props: {
1629
- purchaseOrder: {},
1630
- deliveryOrder: {}
1631
- },
1632
- emits: ["submitted"],
1633
- setup($, { emit: a }) {
1634
- Yt();
1635
- const o = Ue(), f = Be(), h = J(!1), n = $, A = a, t = St("deliveryOrder"), c = je(), S = Y(
1636
- () => {
1637
- var d;
1638
- return ((d = n.purchaseOrder.deliveryFullfillment) == null ? void 0 : d.findIndex(
1639
- (i) => n.deliveryOrder.fullfillmentId && i.id === n.deliveryOrder.fullfillmentId
1640
- )) ?? -1;
1641
- }
1642
- ), x = o.enablePurchaseOrderReceiveWithCustomCost, u = o.enablePortalDeliveryOrderWrite, T = J({}), N = Y(() => n.purchaseOrder.items.map((d, i) => Y({
1643
- get: () => {
1644
- var C;
1645
- const g = (C = t.received[i]) == null ? void 0 : C.cost;
1646
- return g ? +be(g) : 0;
1647
- },
1648
- set: (g) => {
1649
- t.received[i].cost = {
1650
- currency: Ce(),
1651
- ...Qe(g, 4)
1652
- };
1653
- }
1654
- }))), w = Y(() => n.deliveryOrder.received.map((d, i) => Y({
1655
- get: () => {
1656
- var C;
1657
- const g = (C = t.received[i]) == null ? void 0 : C.amount;
1658
- return g ? +be(g) : 0;
1659
- },
1660
- set: (g) => {
1661
- t.received[i].amount = Qe(g, 2);
1662
- }
1663
- })));
1664
- function O(d) {
1665
- const i = !T.value[d];
1666
- if (T.value[d] = i, i) {
1667
- const g = n.deliveryOrder.received[d];
1668
- g.cost ? t.received[d].cost = {
1669
- currency: g.cost.currency,
1670
- amount: g.cost.amount,
1671
- precision: g.cost.precision
1672
- } : t.received[d].cost = {
1673
- currency: Ce(),
1674
- amount: 0,
1675
- precision: 4
1676
- };
1677
- } else
1678
- delete t.received[d].cost;
1679
- }
1680
- function r() {
1681
- c.updateDeliveryOrder({
1682
- deliveryOrder: {
1683
- ...n.deliveryOrder,
1684
- ...t
1685
- },
1686
- purchaseOrderId: n.purchaseOrder._id,
1687
- purchaseOrderRev: n.purchaseOrder._rev
1688
- }).then(() => {
1689
- f.open(
1690
- {
1691
- title: "Success",
1692
- message: `PO# ${n.purchaseOrder.seqNumber} Changes have been saved`,
1693
- type: "success"
1694
- },
1695
- 1e4
1696
- ), h.value = !1, A("submitted");
1697
- });
1698
- }
1699
- return (d, i) => {
1700
- const g = H("FmButton"), C = H("FmStepperField"), K = H("FmSwitch"), R = H("FmTextField"), X = H("FmDialog");
1701
- return l(), re(X, {
1702
- modelValue: h.value,
1703
- "onUpdate:modelValue": i[1] || (i[1] = (z) => h.value = z),
1704
- overlay: !0
1705
- }, {
1706
- "dialog-button": ee(() => [
1707
- v(u) ? (l(), re(g, {
1708
- key: 0,
1709
- variant: "plain",
1710
- label: "Edit",
1711
- size: "md",
1712
- "prepend-icon": "edit"
1713
- })) : B("", !0)
1714
- ]),
1715
- "dialog-header": ee(() => [
1716
- e("div", null, "Received on " + y(v(Ge)(n.deliveryOrder.createdAt)), 1)
1717
- ]),
1718
- "dialog-footer": ee(() => [
1719
- D(g, {
1720
- class: "ml-auto",
1721
- label: "Apply changes",
1722
- size: "md",
1723
- variant: "destructive",
1724
- onClick: r
1725
- })
1726
- ]),
1727
- default: ee(() => [
1728
- e("div", null, [
1729
- e("div", er, [
1730
- e("div", tr, [
1731
- i[2] || (i[2] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Adjustment date", -1)),
1732
- e("div", sr, y(n.deliveryOrder.adjustment ? v(Ge)(new Date(v(Ye)(n.deliveryOrder.adjustment))) : "-"), 1)
1733
- ]),
1734
- e("div", rr, [
1735
- i[4] || (i[4] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received items", -1)),
1736
- (l(!0), b(de, null, xe(n.deliveryOrder.received, (z, Q) => {
1737
- var ve;
1738
- return l(), b("div", { key: Q }, [
1739
- e("div", or, [
1740
- e("div", nr, [
1741
- e("span", ar, y(z.sku.name), 1),
1742
- e("span", lr, y(z.sku.code), 1)
1743
- ]),
1744
- e("div", ir, [
1745
- D(C, {
1746
- label: "Receive Quantity",
1747
- modelValue: w.value[Q].value,
1748
- "onUpdate:modelValue": (ie) => w.value[Q].value = ie,
1749
- min: 0,
1750
- "append-text": ((ve = z.measurement) == null ? void 0 : ve.abbrev) ?? z.sku.unit.abbrev
1751
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"]),
1752
- e("div", cr, y(`${z.cost ? `${v(Ke)(z.cost)}` : ""}`), 1),
1753
- v(x) ? (l(), b("div", ur, [
1754
- D(K, {
1755
- "model-value": T.value[Q],
1756
- "onUpdate:modelValue": (ie) => O(Q),
1757
- size: "sm"
1758
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
1759
- i[3] || (i[3] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
1760
- ])) : B("", !0),
1761
- v(x) && T.value[Q] ? (l(), re(C, {
1762
- key: 1,
1763
- modelValue: N.value[Q].value,
1764
- "onUpdate:modelValue": (ie) => N.value[Q].value = ie,
1765
- label: "Total Cost",
1766
- step: 1e-4,
1767
- min: 0,
1768
- placeholder: "0.0000",
1769
- size: "sm",
1770
- "append-text": v(Ce)()
1771
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : B("", !0)
1772
- ])
1773
- ]),
1774
- Q < n.purchaseOrder.items.length - 1 ? (l(), b("div", dr)) : B("", !0)
1775
- ]);
1776
- }), 128))
1777
- ]),
1778
- e("div", mr, [
1779
- i[5] || (i[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
1780
- e("div", pr, [
1781
- D(R, {
1782
- modelValue: v(t).deliveryOrderNumber,
1783
- "onUpdate:modelValue": i[0] || (i[0] = (z) => v(t).deliveryOrderNumber = z),
1784
- size: "md",
1785
- placeholder: n.deliveryOrder.deliveryOrderNumber
1786
- }, null, 8, ["modelValue", "placeholder"])
1787
- ])
1788
- ]),
1789
- e("div", fr, [
1790
- i[6] || (i[6] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
1791
- e("div", yr, y(n.deliveryOrder.remark || "N/A"), 1)
1792
- ]),
1793
- S.value >= 0 ? (l(), b("div", vr, [
1794
- i[7] || (i[7] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fulfilment's sequence ", -1)),
1795
- e("div", hr, y(S.value + 1), 1)
1796
- ])) : B("", !0)
1797
- ])
1798
- ])
1799
- ]),
1800
- _: 1
1801
- }, 8, ["modelValue"]);
1802
- };
1803
- }
1804
- }), gr = { class: "flex flex-col gap-3" }, _r = { class: "flex flex-col gap-4" }, Sr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, xr = {
1805
- key: 0,
1806
- class: "flex flex-col gap-4"
1807
- }, Or = { class: "flex items-center justify-between" }, wr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, $r = {
1808
- key: 0,
1809
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1810
- }, Cr = { class: "flex gap-4" }, Rr = { class: "flex-1" }, kr = { class: "flex-1" }, Dr = {
1811
- key: 0,
1812
- class: "flex items-center text-fm-color-system-error-300"
1813
- }, Ar = { class: "fm-typo-en-body-md-400" }, Nr = { class: "flex flex-col gap-4" }, Fr = { class: "flex justify-between items-center py-1 gap-4" }, Tr = { class: "flex flex-col" }, Ir = { class: "fm-typo-en-body-lg-600" }, Pr = { class: "fm-typo-en-body-md-400" }, qr = { class: "flex flex-col gap-2 items-end" }, Vr = {
1814
- key: 0,
1815
- class: "flex items-center gap-2"
1816
- }, Er = {
1817
- key: 0,
1818
- class: "border-b border-fm-color-stroke-secondary"
1819
- }, Lr = { class: "flex flex-col gap-4" }, Mr = { class: "flex flex-col gap-4" }, Ur = { class: "flex flex-col gap-4" }, Br = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, jr = /* @__PURE__ */ $e({
1820
- __name: "CreateForm",
1821
- props: {
1822
- purchaseOrder: {},
1823
- receivedInfoMap: {}
1824
- },
1825
- emits: ["submitted"],
1826
- setup($, { emit: a }) {
1827
- var j, V, oe;
1828
- const { t: o } = ut(), f = J(!1), h = ct(), n = $, A = a, t = St("", {
1829
- default: {
1830
- deliveryOrderNumber: "",
1831
- remark: "",
1832
- received: n.purchaseOrder.items.map((k) => ({
1833
- sku: k.sku,
1834
- amount: qe.fromNumber(0),
1835
- measurement: k.measurement
1836
- })),
1837
- createdBy: {
1838
- id: ((j = h.sessionUser.value) == null ? void 0 : j.id) || "",
1839
- name: ((V = h.sessionUser.value) == null ? void 0 : V.displayName) || ""
1840
- },
1841
- createdAt: ""
1842
- }
1843
- }), c = je(), S = tt(), x = Ue(), u = ((oe = n.purchaseOrder) == null ? void 0 : oe.supplier.internal) != null, T = u && x.enablePOSTransferRequireFulfillment, N = x.enablePortalDeliveryOrderWrite && (n.purchaseOrder.status === se.Enum.RECEIVING || n.purchaseOrder.status === se.Enum.COMPLETE) && (u ? !T : !0), w = x.enablePurchaseOrderReceiveWithCustomCost, O = x.enableBackdateReceive, r = J({}), d = Be(), i = Y({
1844
- get() {
1845
- if (!t.createdAt) return "";
1846
- const k = new Date(t.createdAt), _ = k.getFullYear(), F = String(k.getMonth() + 1).padStart(2, "0"), G = String(k.getDate()).padStart(2, "0");
1847
- return `${_}-${F}-${G}`;
1848
- },
1849
- set(k) {
1850
- if (k) {
1851
- const _ = t.createdAt ? new Date(t.createdAt) : /* @__PURE__ */ new Date(), [F, G, ce] = k.split("-");
1852
- _.setFullYear(parseInt(F)), _.setMonth(parseInt(G) - 1), _.setDate(parseInt(ce)), t.createdAt = _.toISOString();
1853
- }
1854
- }
1855
- }), g = Y({
1856
- get() {
1857
- if (!t.createdAt) return "";
1858
- const k = new Date(t.createdAt), _ = String(k.getHours()).padStart(2, "0"), F = String(k.getMinutes()).padStart(2, "0");
1859
- return `${_}:${F}`;
1860
- },
1861
- set(k) {
1862
- if (k) {
1863
- const _ = t.createdAt ? new Date(t.createdAt) : /* @__PURE__ */ new Date(), [F, G] = k.split(":");
1864
- _.setHours(parseInt(F)), _.setMinutes(parseInt(G)), t.createdAt = _.toISOString();
1865
- }
1866
- }
1867
- }), C = Y(() => {
1868
- const k = Ye(n.purchaseOrder._id);
1869
- if (!k) return "";
1870
- const _ = new Date(k), F = _.getFullYear(), G = String(_.getMonth() + 1).padStart(2, "0"), ce = String(_.getDate()).padStart(2, "0");
1871
- return `${F}-${G}-${ce}`;
1872
- }), K = Y(() => {
1873
- const k = Ye(n.purchaseOrder._id);
1874
- return k ? new Date(k) : null;
1875
- }), R = Y(() => {
1876
- if (!i.value || !g.value || !K.value) return null;
1877
- if (/* @__PURE__ */ new Date(`${i.value}T${g.value}:00`) < K.value) {
1878
- const _ = C.value, F = K.value.getHours(), G = K.value.getMinutes(), ce = F >= 12 ? "PM" : "AM", s = F % 12 || 12, m = `${String(s).padStart(2, "0")}:${String(G).padStart(2, "0")} ${ce}`;
1879
- return `Delivery date & time cannot be earlier than order creation (${_} ${m})`;
1880
- }
1881
- return null;
1882
- }), X = Y(() => R.value ? !1 : t.received.some((_) => {
1883
- const F = _.amount;
1884
- return F ? +be(F) > 0 : !1;
1885
- }));
1886
- function z() {
1887
- t.createdAt = "";
1888
- }
1889
- const Q = Y(() => n.purchaseOrder.items.map((k, _) => Y({
1890
- get: () => {
1891
- var G;
1892
- const F = (G = t.received[_]) == null ? void 0 : G.amount;
1893
- return F ? +be(F) : 0;
1894
- },
1895
- set: (F) => {
1896
- t.received[_].amount = Qe(F, 2);
1897
- }
1898
- })));
1899
- function ve(k) {
1900
- const _ = !r.value[k];
1901
- if (r.value[k] = _, _) {
1902
- const F = n.purchaseOrder.items[k];
1903
- F.totalCost ? t.received[k].cost = {
1904
- currency: F.totalCost.currency,
1905
- amount: F.totalCost.amount,
1906
- precision: 4
1907
- // Standardize to 4 decimals
1908
- } : t.received[k].cost = {
1909
- currency: Ce(),
1910
- amount: 0,
1911
- precision: 4
1912
- };
1913
- } else
1914
- delete t.received[k].cost;
1915
- }
1916
- const ie = Y(() => n.purchaseOrder.items.map((k, _) => Y({
1917
- get: () => {
1918
- var G;
1919
- const F = (G = t.received[_]) == null ? void 0 : G.cost;
1920
- return F ? +be(F) : 0;
1921
- },
1922
- set: (F) => {
1923
- t.received[_].cost = {
1924
- currency: Ce(),
1925
- ...Qe(F, 4)
1926
- };
1927
- }
1928
- })));
1929
- function Ae() {
1930
- S.open({
1931
- title: "Confirm Create Delivery Order",
1932
- message: `Are you sure you want to create delivery order for PO# ${n.purchaseOrder.seqNumber}?`,
1933
- primaryActions: {
1934
- text: "Create",
1935
- close: !0,
1936
- variant: "primary"
1937
- },
1938
- secondaryActions: {
1939
- text: "Cancel",
1940
- close: !0
1941
- }
1942
- }).onPrimary(() => Ne());
1943
- }
1944
- function Ne() {
1945
- c.createDeliveryOrder({
1946
- deliveryOrder: t,
1947
- purchaseOrderId: n.purchaseOrder._id,
1948
- purchaseOrderRev: n.purchaseOrder._rev,
1949
- currency: Ce()
1950
- }).then(() => {
1951
- d.open(
1952
- {
1953
- title: "Success",
1954
- message: `New delivery order created for PO# ${n.purchaseOrder.seqNumber}`,
1955
- type: "success"
1956
- },
1957
- 1e4
1958
- ), f.value = !1, A("submitted");
1959
- });
1960
- }
1961
- return (k, _) => {
1962
- const F = H("FmButton"), G = H("FmDatePicker"), ce = H("FmTimePicker"), s = H("FmIcon"), m = H("FmStepperField"), P = H("FmSwitch"), M = H("FmTextField"), W = H("FmDialog");
1963
- return l(), re(W, {
1964
- modelValue: f.value,
1965
- "onUpdate:modelValue": _[4] || (_[4] = (E) => f.value = E),
1966
- overlay: !0,
1967
- "min-width": 800
1968
- }, {
1969
- "dialog-button": ee(() => [
1970
- v(N) ? (l(), re(F, {
1971
- key: 0,
1972
- variant: "primary",
1973
- label: "Create",
1974
- size: "md",
1975
- "prepend-icon": "add",
1976
- class: "w-full"
1977
- })) : B("", !0)
1978
- ]),
1979
- "dialog-header": ee(() => [
1980
- e("div", null, "Order #" + y(n.purchaseOrder.seqNumber) + " (New Delivery Order)", 1)
1981
- ]),
1982
- "dialog-footer": ee(() => [
1983
- D(F, {
1984
- class: "ml-auto",
1985
- label: "Create",
1986
- size: "md",
1987
- variant: "destructive",
1988
- disabled: !X.value,
1989
- onClick: Ae
1990
- }, null, 8, ["disabled"])
1991
- ]),
1992
- default: ee(() => {
1993
- var E;
1994
- return [
1995
- e("div", gr, [
1996
- e("div", _r, [
1997
- _[5] || (_[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
1998
- e("div", Sr, y((E = v(h).sessionUser.value) == null ? void 0 : E.displayName), 1)
1999
- ]),
2000
- v(O) ? (l(), b("div", xr, [
2001
- e("div", Or, [
2002
- e("div", wr, [
2003
- _[6] || (_[6] = ke(" Delivery Date & Time ")),
2004
- !i.value && !g.value ? (l(), b("div", $r, " Leave blank to use current date & time ")) : B("", !0)
2005
- ]),
2006
- i.value || g.value ? (l(), re(F, {
2007
- key: 0,
2008
- variant: "tertiary",
2009
- label: "Clear",
2010
- "prepend-icon": "close",
2011
- onClick: z
2012
- })) : B("", !0)
2013
- ]),
2014
- e("div", Cr, [
2015
- e("div", Rr, [
2016
- D(G, {
2017
- modelValue: i.value,
2018
- "onUpdate:modelValue": _[0] || (_[0] = (I) => i.value = I)
2019
- }, null, 8, ["modelValue"])
2020
- ]),
2021
- e("div", kr, [
2022
- D(ce, {
2023
- modelValue: g.value,
2024
- "onUpdate:modelValue": _[1] || (_[1] = (I) => g.value = I)
2025
- }, null, 8, ["modelValue"])
2026
- ])
2027
- ]),
2028
- R.value ? (l(), b("div", Dr, [
2029
- D(s, {
2030
- name: "error",
2031
- class: "inline-block mr-1",
2032
- size: "sm"
2033
- }),
2034
- e("div", Ar, y(R.value), 1)
2035
- ])) : B("", !0)
2036
- ])) : B("", !0),
2037
- e("div", Nr, [
2038
- _[8] || (_[8] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Items going to receive ", -1)),
2039
- (l(!0), b(de, null, xe(n.purchaseOrder.items, (I, p) => {
2040
- var Z, ae, ne;
2041
- return l(), b("div", { key: p }, [
2042
- e("div", Fr, [
2043
- e("div", Tr, [
2044
- e("span", Ir, y(I.sku.name), 1),
2045
- e("span", Pr, y(I.sku.code), 1)
2046
- ]),
2047
- e("div", qr, [
2048
- D(m, {
2049
- label: "Receive Quantity",
2050
- modelValue: Q.value[p].value,
2051
- "onUpdate:modelValue": (q) => Q.value[p].value = q,
2052
- "helper-text": `${v(o)("inventory.transfer.receiveRequest.details.received")} ${v(qe).toFormatString(
2053
- {
2054
- value: (Z = k.receivedInfoMap[I.sku._id]) == null ? void 0 : Z.received
2055
- }
2056
- )} ${((ae = I.measurement) == null ? void 0 : ae.abbrev) ?? I.sku.unit.abbrev}`,
2057
- min: 0,
2058
- "append-text": ((ne = I.measurement) == null ? void 0 : ne.abbrev) ?? I.sku.unit.abbrev
2059
- }, null, 8, ["modelValue", "onUpdate:modelValue", "helper-text", "append-text"]),
2060
- v(w) ? (l(), b("div", Vr, [
2061
- D(P, {
2062
- "model-value": r.value[p],
2063
- "onUpdate:modelValue": (q) => ve(p),
2064
- size: "sm"
2065
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
2066
- _[7] || (_[7] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
2067
- ])) : B("", !0),
2068
- v(w) && r.value[p] ? (l(), re(m, {
2069
- key: 1,
2070
- modelValue: ie.value[p].value,
2071
- "onUpdate:modelValue": (q) => ie.value[p].value = q,
2072
- label: "Total Cost",
2073
- step: 1e-4,
2074
- min: 0,
2075
- placeholder: "0.0000",
2076
- size: "sm",
2077
- "append-text": v(Ce)()
2078
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : B("", !0)
2079
- ])
2080
- ]),
2081
- p < n.purchaseOrder.items.length - 1 ? (l(), b("div", Er)) : B("", !0)
2082
- ]);
2083
- }), 128))
2084
- ]),
2085
- e("div", Lr, [
2086
- _[9] || (_[9] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
2087
- e("div", Mr, [
2088
- D(M, {
2089
- modelValue: v(t).deliveryOrderNumber,
2090
- "onUpdate:modelValue": _[2] || (_[2] = (I) => v(t).deliveryOrderNumber = I),
2091
- size: "md"
2092
- }, null, 8, ["modelValue"])
2093
- ])
2094
- ]),
2095
- e("div", Ur, [
2096
- _[10] || (_[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
2097
- e("div", Br, [
2098
- D(M, {
2099
- modelValue: v(t).remark,
2100
- "onUpdate:modelValue": _[3] || (_[3] = (I) => v(t).remark = I),
2101
- size: "md"
2102
- }, null, 8, ["modelValue"])
2103
- ])
2104
- ])
2105
- ])
2106
- ];
2107
- }),
2108
- _: 1
2109
- }, 8, ["modelValue"]);
2110
- };
2111
- }
2112
- }), zr = { class: "flex flex-row-reverse" }, Kr = {
2113
- key: 0,
2114
- class: "flex"
2115
- }, Hr = {
2116
- key: 1,
2117
- class: "border-t pt-6"
2118
- }, Gr = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, Wr = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, Yr = { class: "w-full" }, Qr = {
2119
- class: "p-3 fm-typo-en-body-sm-600",
2120
- style: { "min-width": "130px" }
2121
- }, Jr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Xr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Zr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, eo = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, to = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, so = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ro = { class: "p-3 fm-typo-en-body-sm-600" }, oo = { key: 2 }, no = /* @__PURE__ */ $e({
2122
- __name: "NetSuiteTransactionChangeLog",
2123
- props: {
2124
- netsuiteId: {}
2125
- },
2126
- setup($) {
2127
- const a = $, o = dt(), f = J(!1), h = J(!1), n = J(!1), A = J([]);
2128
- async function t() {
2129
- if (!(A.value.length > 0))
2130
- try {
2131
- h.value = !0;
2132
- const x = await o.getChangeLogs(a.netsuiteId);
2133
- A.value = x, n.value = !1;
2134
- } catch {
2135
- n.value = !0;
2136
- } finally {
2137
- h.value = !1;
2138
- }
2139
- }
2140
- function c(x) {
2141
- switch (x) {
2142
- case we.Create:
2143
- return "text-green-600 bg-green-100";
2144
- case we.Set:
2145
- return "text-blue-600 bg-blue-100";
2146
- case we.Change:
2147
- return "text-yellow-600 bg-yellow-100";
2148
- case we.Unset:
2149
- return "text-red-600 bg-red-100";
2150
- default:
2151
- return "text-gray-600 bg-gray-100";
2152
- }
2153
- }
2154
- function S(x) {
2155
- return new Date(x).toLocaleDateString("en-US", {
2156
- year: "numeric",
2157
- month: "short",
2158
- day: "numeric",
2159
- hour: "2-digit",
2160
- minute: "2-digit"
2161
- });
2162
- }
2163
- return (x, u) => {
2164
- const T = H("FmButton"), N = H("FmCircularProgress"), w = H("FmIcon"), O = H("FmDialog");
2165
- return l(), b("div", zr, [
2166
- D(O, {
2167
- modelValue: f.value,
2168
- "onUpdate:modelValue": u[2] || (u[2] = (r) => f.value = r),
2169
- overlay: !0,
2170
- "max-width": 800
2171
- }, {
2172
- "dialog-button": ee(() => [
2173
- D(T, {
2174
- "prepend-icon": "info",
2175
- variant: "secondary",
2176
- label: "NetSuite",
2177
- onClick: u[0] || (u[0] = (r) => t()),
2178
- "text-color": "primary",
2179
- "bg-color": "transparent",
2180
- "border-color": "primary"
2181
- })
2182
- ]),
2183
- "dialog-header": ee(() => u[3] || (u[3] = [
2184
- e("div", null, "NetSuite info", -1)
2185
- ])),
2186
- default: ee(() => [
2187
- h.value ? (l(), b("div", Kr, [
2188
- u[4] || (u[4] = e("span", null, "Change Log Loading...", -1)),
2189
- D(N, { size: "md" })
2190
- ])) : B("", !0),
2191
- !h.value && A.value.length > 0 ? (l(), b("div", Hr, [
2192
- e("h3", Gr, [
2193
- D(w, {
2194
- name: "error",
2195
- color: "#ff9500",
2196
- size: "sm"
2197
- }),
2198
- u[5] || (u[5] = ke(" Change Logs "))
2199
- ]),
2200
- e("div", Wr, [
2201
- e("table", Yr, [
2202
- u[6] || (u[6] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
2203
- e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
2204
- e("th", {
2205
- class: "text-left p-3 fm-typo-en-body-md-600",
2206
- style: { "min-width": "130px" }
2207
- }, " Date "),
2208
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
2209
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
2210
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
2211
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
2212
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
2213
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
2214
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
2215
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
2216
- ])
2217
- ], -1)),
2218
- e("tbody", null, [
2219
- (l(!0), b(de, null, xe(A.value, (r, d) => (l(), b("tr", {
2220
- key: d,
2221
- class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
2222
- }, [
2223
- e("td", Qr, y(S(r._dateiso8601)), 1),
2224
- e("td", Jr, y(r._rolename), 1),
2225
- e("td", Xr, y(r._employeename), 1),
2226
- e("td", Zr, y(r._contextname), 1),
2227
- e("td", {
2228
- class: Me(`p-3 fm-typo-en-body-sm-600 ${c(Number(r.type) - 1)}`)
2229
- }, y(v(we)[Number(r.type) - 1]), 3),
2230
- e("td", eo, y(r.lineid || ""), 1),
2231
- e("td", to, y(r._fieldname), 1),
2232
- e("td", so, y(r.oldvalue || ""), 1),
2233
- e("td", ro, y(r.newvalue || ""), 1)
2234
- ]))), 128))
2235
- ])
2236
- ])
2237
- ])
2238
- ])) : (l(), b("div", oo, u[7] || (u[7] = [
2239
- e("p", null, "No change logs available.", -1)
2240
- ])))
2241
- ]),
2242
- "dialog-footer": ee(() => [
2243
- D(T, {
2244
- class: "ml-auto sm:w-full xs:w-full",
2245
- label: "Close",
2246
- size: "md",
2247
- variant: "primary",
2248
- onClick: u[1] || (u[1] = (r) => f.value = !1)
2249
- })
2250
- ]),
2251
- _: 1
2252
- }, 8, ["modelValue"])
2253
- ]);
2254
- };
2255
- }
2256
- }), ao = { class: "flex flex-col w-full gap-3" }, lo = { class: "flex" }, io = { class: "fm-typo-en-title-md-600 text-fm-color-typo-primary" }, co = { class: "flex flex-col gap-16 w-full h-full" }, uo = { class: "flex justify-between" }, mo = { class: "fm-typo-en-body-lg-600" }, po = { class: "flex gap-2" }, fo = {
2257
- key: 0,
2258
- class: "flex items-center gap-1"
2259
- }, yo = { class: "fm-typo-en-body-md-400" }, vo = { class: "flex flex-col gap-8" }, ho = { class: "flex flex-col gap-4" }, bo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, go = { class: "flex gap-1" }, _o = { class: "fm-typo-en-body-lg-600" }, So = {
2260
- key: 0,
2261
- class: "flex flex-col gap-4"
2262
- }, xo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oo = { class: "fm-typo-en-body-lg-600" }, wo = { class: "flex flex-col gap-4" }, $o = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Co = { class: "fm-typo-en-body-lg-600" }, Ro = {
2263
- key: 1,
2264
- class: "flex flex-col gap-4"
2265
- }, ko = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Do = { class: "fm-typo-en-body-lg-600" }, Ao = {
2266
- key: 2,
2267
- class: "flex flex-col gap-4"
2268
- }, No = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fo = { class: "fm-typo-en-body-lg-600" }, To = {
2269
- key: 3,
2270
- class: "flex flex-col gap-4"
2271
- }, Io = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Po = { class: "fm-typo-en-body-lg-600" }, qo = {
2272
- key: 4,
2273
- class: "flex flex-col gap-4"
2274
- }, Vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Eo = { class: "fm-typo-en-body-lg-600" }, Lo = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Mo = { class: "flex flex-col gap-8" }, Uo = { class: "flex gap-8 items-center" }, Bo = { class: "flex-1 fm-typo-en-body-lg-600" }, jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, zo = { class: "flex w-full gap-4" }, Ko = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, Ho = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-2" }, Go = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Wo = ["innerHTML"], Yo = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Qo = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Jo = {
2275
- key: 0,
2276
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2277
- }, Xo = { class: "py-8" }, Zo = { class: "flex justify-end gap-4 items-center" }, en = { class: "fm-typo-en-body-lg-600" }, tn = {
2278
- key: 1,
2279
- class: "flex-1 xs:w-screen xs:max-w-full"
2280
- }, sn = {
2281
- key: 0,
2282
- class: "flex flex-col items-center gap-8 h-full"
2283
- }, rn = ["src"], on = { class: "fm-typo-en-body-lg-600" }, nn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, an = {
2284
- key: 1,
2285
- class: "px-4 flex flex-col"
2286
- }, ln = { class: "flex gap-12 content-stretch" }, cn = {
2287
- class: "flex flex-col w-40",
2288
- name: "circles"
2289
- }, un = { class: "flex-1 flex flex-col items-center" }, dn = { class: "h-40 w-40 bg-fm-color-primary rounded-full flex items-center justify-center" }, mn = { class: "flex-1 flex flex-col items-center" }, pn = { class: "flex w-full items-center gap-4" }, fn = {
2290
- class: "py-12 flex flex-col gap-4",
2291
- name: "received-at header"
2292
- }, yn = { class: "fm-typo-en-body-lg-400" }, vn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, hn = { class: "ml-auto flex gap-1" }, bn = { class: "flex gap-12 content-stretch" }, gn = {
2293
- class: "flex flex-col w-40",
2294
- name: "circles"
2295
- }, _n = { class: "flex-1 flex flex-col items-center" }, Sn = {
2296
- class: "py-12 flex flex-col gap-4 flex-1",
2297
- name: "delivery details"
2298
- }, xn = { class: "flex flex-col gap-8" }, On = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, wn = { class: "flex flex-col gap-4" }, $n = { class: "flex gap-8 xs:flex-col" }, Qn = /* @__PURE__ */ $e({
2299
- __name: "TransferDetails",
2300
- props: {
2301
- poRequest: {},
2302
- purchaseOrder: {},
2303
- transferTo: {},
2304
- transferToDbName: {},
2305
- show: { type: Boolean },
2306
- canResubmit: { type: Boolean },
2307
- canApprove: { type: Boolean },
2308
- scope: {},
2309
- receivedMap: {},
2310
- shipments: {}
2311
- },
2312
- emits: ["update:show", "submitted"],
2313
- setup($, { emit: a }) {
2314
- const o = $, f = a, h = tt(), n = Be(), A = Ue(), t = De(), c = ct(), S = Y(
2315
- () => {
2316
- var s, m;
2317
- return {
2318
- id: ((s = c.sessionUser.value) == null ? void 0 : s.id) ?? "",
2319
- name: ((m = c.sessionUser.value) == null ? void 0 : m.displayName) ?? ""
2320
- };
2321
- }
2322
- ), x = wt(), { t: u } = ut(), T = Y(
2323
- () => {
2324
- var s, m, P, M;
2325
- return ((m = (s = o.purchaseOrder) == null ? void 0 : s.supplier) == null ? void 0 : m.internal) === "restaurant" || ((M = (P = o.purchaseOrder) == null ? void 0 : P.supplier) == null ? void 0 : M.internal) === "warehouse" ? He.enum.transfer : He.enum.purchase;
2326
- }
2327
- ), N = Y(() => {
2328
- var P;
2329
- const s = (P = o.shipments) == null ? void 0 : P.find((M) => {
2330
- var W;
2331
- return M.ref === ((W = o.purchaseOrder) == null ? void 0 : W._id);
2332
- });
2333
- let m = null;
2334
- if (s != null && s.milestones && s.milestones.length > 0) {
2335
- const M = s.milestones[s.milestones.length - 1];
2336
- if (M.estimatedTime) {
2337
- const W = new Date(M.estimatedTime), E = W.getDate().toString().padStart(2, "0");
2338
- m = `${W.toLocaleString("en-US", { month: "short" })} ${E}`;
2339
- }
2340
- }
2341
- return m;
2342
- }), w = J(!1), O = J(""), r = J(!0), d = je(), i = Ht(d.getWorkflowConfig), g = Ot(), C = [
2343
- U.enum.receiveStock,
2344
- U.enum.processRequest,
2345
- U.enum.closeRequest
2346
- ], K = Y(() => {
2347
- if (!o.purchaseOrder)
2348
- return [];
2349
- const s = i.result.value;
2350
- if (s.state === pt.loading)
2351
- return [];
2352
- const m = {
2353
- user: S.value,
2354
- executedAt: t.locations.computeFirst(
2355
- (I) => {
2356
- var p;
2357
- return I.dbName === ((p = t._currentLocation) == null ? void 0 : p.dbName) ? I : null;
2358
- }
2359
- ),
2360
- purchaseOrderRequest: o.poRequest,
2361
- purchaseOrder: o.purchaseOrder
2362
- }, P = A.useOperatePurchaseOrderV2, M = A.poWorkflowAllowToMarkCompleted, W = [...C];
2363
- P && !M && W.push(U.enum.completeReceive);
2364
- let E = [];
2365
- try {
2366
- s.state === pt.error ? (console.error("Error fetching workflow config:", s.error), E = st.getAvailableActions({
2367
- ...m,
2368
- orderConfig: st.getDefaultConfig()
2369
- }).actions.filter((I) => !W.includes(I))) : E = st.getAvailableActions({
2370
- ...m,
2371
- orderConfig: s.data
2372
- }).actions.filter((I) => !W.includes(I));
2373
- } catch (I) {
2374
- console.error("Error getting available actions:", I);
2375
- }
2376
- return o.scope === "approval" && (E = E.filter((I) => I !== U.enum.completeReceive)), E;
2377
- }), R = Vt(o, "show"), X = Y(() => [
2378
- {
2379
- label: u("inventory.transfer.receiveRequest.details.overview"),
2380
- value: "overview"
2381
- },
2382
- {
2383
- label: u("inventory.transfer.receiveRequest.details.deliveryHistory"),
2384
- value: "deliveryHistory"
2385
- }
2386
- ]), z = J(X.value[0]);
2387
- kt(
2388
- () => o.show,
2389
- (s) => {
2390
- s && (z.value = X.value[0]);
2391
- }
2392
- );
2393
- function Q(s) {
2394
- return s.map((m) => ({
2395
- ...m,
2396
- amount: {
2397
- ...m.amount,
2398
- amount: -Math.abs(m.amount.amount)
2399
- }
2400
- }));
2401
- }
2402
- async function ve(s, m, P, M, W) {
2403
- return new Promise((E, I) => {
2404
- h.open({
2405
- closeButton: !1,
2406
- title: M.title,
2407
- message: M.message,
2408
- primaryActions: M.primaryActions,
2409
- secondaryActions: { text: "No", close: !1 }
2410
- }).onPrimary(async () => {
2411
- var Z, ae, ne, q;
2412
- const p = [];
2413
- P === U.enum.approveRequest ? (p.push({
2414
- action: "approveRequest",
2415
- payload: null
2416
- }), m.fulfillment && p.push({
2417
- action: "processRequest",
2418
- payload: {
2419
- fulfillmentId: "",
2420
- deliveryOrderNumber: "",
2421
- deliveryRemark: null,
2422
- items: Q(m.fulfillment.items),
2423
- createdBy: S.value
2424
- }
2425
- })) : P === U.enum.processRequest ? m.fulfillment && p.push({
2426
- action: "processRequest",
2427
- payload: {
2428
- fulfillmentId: "",
2429
- deliveryOrderNumber: "",
2430
- deliveryRemark: null,
2431
- items: Q(m.fulfillment.items),
2432
- createdBy: S.value
2433
- }
2434
- }) : P === U.enum.rejectRequest ? p.push({
2435
- action: "rejectRequest",
2436
- payload: null
2437
- }) : P === U.enum.closeRequest && p.push({
2438
- action: "closeRequest",
2439
- payload: null
2440
- });
2441
- try {
2442
- await g({
2443
- operate: {
2444
- operation: P,
2445
- doc: s,
2446
- options: m
2447
- },
2448
- operateV2: {
2449
- _id: ((Z = o.purchaseOrder) == null ? void 0 : Z._id) ?? "",
2450
- _rev: ((ae = o.purchaseOrder) == null ? void 0 : ae._rev) ?? "",
2451
- action: P,
2452
- payloads: p
2453
- // add payload if action is receiveStock or processRequest
2454
- },
2455
- transferTo: (q = (ne = o.poRequest) == null ? void 0 : ne.to) == null ? void 0 : q.dbName
2456
- }).delayed(1e3), E("submitted");
2457
- } catch (me) {
2458
- I(me);
2459
- }
2460
- }).onSecondary(() => {
2461
- E("cancelled");
2462
- for (let p = 0; p < W + 2; p++)
2463
- h.close();
2464
- }).onClose(() => {
2465
- });
2466
- });
2467
- }
2468
- async function ie(s) {
2469
- var W, E, I, p;
2470
- if (s === U.enum.receiveStock)
2471
- return;
2472
- const m = xt[s];
2473
- if (!m) {
2474
- n.open({
2475
- title: "Something went wrong",
2476
- message: `Cannot process order: ${it(s)}`,
2477
- type: "error"
2478
- });
2479
- return;
2480
- }
2481
- const { successMessage: P, ...M } = m;
2482
- if (o.purchaseOrder) {
2483
- O.value = `${s}`, w.value = !0, r.value = !1;
2484
- const Z = {};
2485
- let ae = 0;
2486
- if ((s === U.enum.confirmDraft || // auto receive for warehouse to warehouse
2487
- s === U.enum.completeReceive) && A.autoReceiveWarehouse)
2488
- Z.autoReceive = !0;
2489
- else if ((s === U.enum.approveRequest || s === U.enum.processRequest) && A.acceptRequireFulfillment) {
2490
- const ne = (E = (W = o.poRequest) == null ? void 0 : W.from) == null ? void 0 : E.dbName, q = (p = (I = o.poRequest) == null ? void 0 : I.to) == null ? void 0 : p.dbName;
2491
- if (ne && q && (ne.startsWith("warehouse_") || q.startsWith("warehouse_"))) {
2492
- const me = await new Promise((Oe, Fe) => {
2493
- h.open({
2494
- closeButton: !1,
2495
- title: "Confirm transfer amount",
2496
- dialogComponent: rs,
2497
- dialogComponentProps: {
2498
- purchaseOrder: o.purchaseOrder,
2499
- confirm: Oe,
2500
- "onUpdate:show": (Te) => {
2501
- Te || (O.value = "", w.value = !1, r.value = !0, ae++, h.close()), Fe("cancelled");
2502
- }
2503
- }
2504
- });
2505
- });
2506
- Z.fulfillment = me;
2507
- }
2508
- }
2509
- try {
2510
- await ve(
2511
- o.purchaseOrder,
2512
- Z,
2513
- s,
2514
- m,
2515
- ae
2516
- ) === "submitted" && (n.open({
2517
- title: "Success",
2518
- message: P,
2519
- type: "success"
2520
- }), f("update:show", !1), f("submitted"));
2521
- } catch (ne) {
2522
- n.open({
2523
- title: "Something went wrong",
2524
- message: "Please try again.",
2525
- type: "error"
2526
- }), console.error("Error when submitting PO operation", s, o.purchaseOrder, ne);
2527
- } finally {
2528
- O.value = "", w.value = !1, r.value = !0;
2529
- }
2530
- }
2531
- }
2532
- const Ae = Y(() => {
2533
- var s, m;
2534
- return ((s = o.purchaseOrder) == null ? void 0 : s.status) === se.enum.RECEIVING || ((m = o.purchaseOrder) == null ? void 0 : m.status) === se.enum.COMPLETE;
2535
- }), Ne = Y(() => o.purchaseOrder ? Xe(o.purchaseOrder) : {}), j = Y(() => {
2536
- const s = o.purchaseOrder;
2537
- if (!s) return { status: "", statusClass: "" };
2538
- const { partial: m, over: P } = nt(Ne.value), M = at(s.status, m, P);
2539
- let W = u(`inventory.transfer.status.${M}`), E = `${s.status}`.toLocaleLowerCase("en-us");
2540
- return M === se.enum.CLOSE && (W = `${u(`inventory.transfer.status.${se.enum.COMPLETE}`)}`), M === "PARTIAL_RECEIVED" && E === se.enum.PROCESSING.toLocaleLowerCase("en-us") && (E = se.enum.RECEIVING.toLocaleLowerCase("en-us")), {
2541
- status: W,
2542
- statusClass: `fm-status-badge fm-status-badge-${E}`
2543
- };
2544
- }), V = Y(() => {
2545
- var E, I;
2546
- const s = ((E = o.purchaseOrder) == null ? void 0 : E.deliveryOrder) ?? [], m = ((I = o.purchaseOrder) == null ? void 0 : I.deliveryFullfillment) ?? [], P = [
2547
- ...s.map((p) => ({
2548
- createdAt: p.createdAt,
2549
- type: "grn",
2550
- doc: p
2551
- })),
2552
- ...m.map((p) => ({
2553
- createdAt: p.createdAt,
2554
- type: "fulfillment",
2555
- doc: p
2556
- }))
2557
- ];
2558
- P.reverse().sort((p, Z) => p.createdAt.localeCompare(Z.createdAt));
2559
- function M(p) {
2560
- var ne, q, me, Oe, Fe, Te, te, le, pe, he, _e, Re;
2561
- const Z = m.findIndex((ue) => ue.id === p.fullfillmentId), ae = [
2562
- (q = (ne = m[Z]) == null ? void 0 : ne.netSuite) != null && q.id ? {
2563
- label: "Fulfillment's ref no. (Netsuite)",
2564
- values: [
2565
- `${((Oe = (me = m[Z]) == null ? void 0 : me.netSuite) == null ? void 0 : Oe.refNo) ?? "N/A"} (${((Te = (Fe = m[Z]) == null ? void 0 : Fe.netSuite) == null ? void 0 : Te.id) ?? "-"})`
2566
- ]
2567
- } : null,
2568
- (te = p == null ? void 0 : p.netSuite) != null && te.id ? {
2569
- label: "Netsuite ref no.",
2570
- values: [`${((le = p == null ? void 0 : p.netSuite) == null ? void 0 : le.refNo) ?? "N/A"} (${((pe = p == null ? void 0 : p.netSuite) == null ? void 0 : pe.id) ?? "-"})`]
2571
- } : null,
2572
- (he = p == null ? void 0 : p.netSuite) != null && he.recordType ? {
2573
- label: "Netsuite Type",
2574
- values: [ht((_e = p == null ? void 0 : p.netSuite) == null ? void 0 : _e.recordType)]
2575
- } : null
2576
- ];
2577
- return {
2578
- header: "Received",
2579
- deliveryOrder: p,
2580
- date: Ge(new Date(p.createdAt)),
2581
- info: [
2582
- {
2583
- label: "Adjustment date",
2584
- values: [
2585
- p.adjustment ? Ge(new Date(Ye(p.adjustment))) : "-"
2586
- ]
2587
- },
2588
- {
2589
- label: "Received by",
2590
- values: [(Re = p.createdBy) == null ? void 0 : Re.name]
2591
- },
2592
- {
2593
- label: "Received items",
2594
- values: p.received.map((ue) => {
2595
- var fe;
2596
- return L("div", [
2597
- L(
2598
- "div",
2599
- {
2600
- class: "flex gap-4"
2601
- },
2602
- [
2603
- L(
2604
- "div",
2605
- {
2606
- class: "flex flex-col"
2607
- },
2608
- [
2609
- L(
2610
- "span",
2611
- {
2612
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2613
- },
2614
- `${ue.sku.name}`
2615
- ),
2616
- L(
2617
- "span",
2618
- {
2619
- class: "fm-typo-en-body-md-400"
2620
- },
2621
- `${ue.sku.code} `
2622
- )
2623
- ]
2624
- ),
2625
- L(
2626
- "div",
2627
- {
2628
- class: "ml-auto flex flex-col"
2629
- },
2630
- [
2631
- L(
2632
- "div",
2633
- {
2634
- class: "ml-auto flex gap-1"
2635
- },
2636
- [
2637
- L(
2638
- "span",
2639
- {
2640
- class: "fm-typo-en-body-lg-600 self-end"
2641
- },
2642
- be(ue.amount, !1)
2643
- ),
2644
- L(
2645
- "span",
2646
- {
2647
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2648
- },
2649
- ((fe = ue.measurement) == null ? void 0 : fe.abbrev) ?? ue.sku.unit.abbrev
2650
- )
2651
- ]
2652
- ),
2653
- L(
2654
- "div",
2655
- {
2656
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2657
- },
2658
- `${ue.cost ? `(${Ke(ue.cost)})` : ""}`
2659
- )
2660
- ]
2661
- )
2662
- ]
2663
- )
2664
- ]);
2665
- })
2666
- },
2667
- {
2668
- label: "Delivery order no.",
2669
- values: [p.deliveryOrderNumber || "N/A"]
2670
- },
2671
- {
2672
- label: "Remark",
2673
- values: [p.remark || "N/A"]
2674
- },
2675
- Z > -1 ? {
2676
- label: "Fulfilment's sequence",
2677
- values: [`${Z + 1}`]
2678
- } : null,
2679
- ...ae
2680
- ].filter((ue) => !!ue)
2681
- };
2682
- }
2683
- function W(p) {
2684
- var ae, ne;
2685
- const Z = m.findIndex((q) => q.id === p.id);
2686
- return {
2687
- header: "Fulfillment",
2688
- date: Ge(new Date(p.createdAt)),
2689
- info: [
2690
- {
2691
- label: "Sequence",
2692
- values: [String(Z + 1)]
2693
- },
2694
- {
2695
- label: "Receiveable items",
2696
- values: p.items.map((q) => {
2697
- var me;
2698
- return L("div", [
2699
- L(
2700
- "div",
2701
- {
2702
- class: "flex gap-4"
2703
- },
2704
- [
2705
- L(
2706
- "div",
2707
- {
2708
- class: "flex flex-col"
2709
- },
2710
- [
2711
- L(
2712
- "span",
2713
- {
2714
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2715
- },
2716
- `${q.sku.name}`
2717
- ),
2718
- L(
2719
- "span",
2720
- {
2721
- class: "fm-typo-en-body-md-400"
2722
- },
2723
- `${q.sku.code} `
2724
- )
2725
- ]
2726
- ),
2727
- L(
2728
- "div",
2729
- {
2730
- class: "ml-auto flex flex-col"
2731
- },
2732
- [
2733
- L(
2734
- "div",
2735
- {
2736
- class: "ml-auto flex gap-1"
2737
- },
2738
- [
2739
- L(
2740
- "span",
2741
- {
2742
- class: "fm-typo-en-body-lg-600 self-end"
2743
- },
2744
- be(q.amount, !1)
2745
- ),
2746
- L(
2747
- "span",
2748
- {
2749
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2750
- },
2751
- ((me = q.measurement) == null ? void 0 : me.abbrev) ?? q.sku.unit.abbrev
2752
- )
2753
- ]
2754
- ),
2755
- L(
2756
- "div",
2757
- {
2758
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2759
- },
2760
- `${q.cost ? `(${Ke(q.cost)})` : ""}`
2761
- )
2762
- ]
2763
- )
2764
- ]
2765
- )
2766
- ]);
2767
- })
2768
- },
2769
- (ae = p.netSuite) != null && ae.refNo ? {
2770
- label: "Ref no. (Netsuite)",
2771
- values: [(ne = p.netSuite) == null ? void 0 : ne.refNo]
2772
- } : null
2773
- ].filter((q) => !!q)
2774
- };
2775
- }
2776
- return P.map((p) => {
2777
- switch (p.type) {
2778
- case "grn":
2779
- return M(p.doc);
2780
- case "fulfillment":
2781
- return W(p.doc);
2782
- }
2783
- });
2784
- }), oe = Y(() => {
2785
- var m;
2786
- const s = {
2787
- ...gt(0),
2788
- currency: Ce()
2789
- };
2790
- return ((m = o.purchaseOrder) == null ? void 0 : m.items.reduce((P, M) => ({
2791
- ...bt(P, M.totalCost ?? s),
2792
- currency: Ce()
2793
- }), s)) ?? s;
2794
- });
2795
- function k(s) {
2796
- var E;
2797
- const P = (((E = o.purchaseOrder) == null ? void 0 : E.version) ?? Pe.enum[1]) === Pe.enum[2] ? s.id : s.sku._id, M = o.receivedMap[P];
2798
- return `<span class="${_(s)} fm-typo-en-body-lg-600">${qe.toFormatString({ value: M.received })}</span>/${Ut(s.quantity, s.sku.unit, s.measurement)}`;
2799
- }
2800
- function _(s) {
2801
- var Z;
2802
- const P = (((Z = o.purchaseOrder) == null ? void 0 : Z.version) ?? Pe.enum[1]) === Pe.enum[2] ? s.id : s.sku._id, M = o.receivedMap[P], { isPartialReceive: W, isNoReceive: E, isOverReceive: I, isFullReceive: p } = Jt(M);
2803
- return E ? "text-fm-color-typo-tertiary" : W ? "text-fm-color-system-warning-300" : I ? "text-fm-color-system-error-300" : p ? "text-fm-color-system-success-300" : "";
2804
- }
2805
- const F = Y(() => {
2806
- var s, m, P;
2807
- return (s = o.purchaseOrder) != null && s.itemsAtSubmission ? ((m = o.purchaseOrder) == null ? void 0 : m.version) === Pe.enum[2] ? o.purchaseOrder.items.reduce((M, W) => {
2808
- var I, p;
2809
- const E = (p = (I = o.purchaseOrder) == null ? void 0 : I.itemsAtSubmission) == null ? void 0 : p.find(
2810
- (Z) => Z.id === W.id
2811
- );
2812
- return E && E.quantity !== W.quantity && M.set(W.sku.code, {
2813
- originalAmount: Number(qe.toFormatString({ value: E.quantity })),
2814
- newAmount: Number(qe.toFormatString({ value: W.quantity }))
2815
- }), M;
2816
- }, /* @__PURE__ */ new Map()) : (P = o.purchaseOrder) == null ? void 0 : P.items.reduce((M, W) => {
2817
- var Z, ae;
2818
- const E = (ae = (Z = o.purchaseOrder) == null ? void 0 : Z.itemsAtSubmission) == null ? void 0 : ae.find(
2819
- (ne) => ne.sku._id === W.sku._id
2820
- ), I = E ? Number(qe.toFormatString({ value: E.quantity })) : 0, p = Number(qe.toFormatString({ value: W.quantity }));
2821
- return E && I !== p && M.set(W.sku.code, {
2822
- originalAmount: I,
2823
- newAmount: p
2824
- }), M;
2825
- }, /* @__PURE__ */ new Map()) : /* @__PURE__ */ new Map();
2826
- }), G = (s) => {
2827
- var P, M;
2828
- const m = F.value;
2829
- return ((P = o.purchaseOrder) == null ? void 0 : P.version) === Pe.enum[2] ? m.has(s.id) : m.has((M = s.sku) == null ? void 0 : M.code);
2830
- }, ce = (s) => {
2831
- var P, M;
2832
- const m = F.value;
2833
- return ((P = o.purchaseOrder) == null ? void 0 : P.version) === Pe.enum[2] ? m.get(s.id) : m.get((M = s.sku) == null ? void 0 : M.code);
2834
- };
2835
- return (s, m) => {
2836
- const P = H("FmButton"), M = H("FmButtonGroup"), W = H("FmChip"), E = H("FmIcon"), I = H("FmMenuDivider"), p = H("FmCard"), Z = H("FmTooltip"), ae = H("FmSpacer"), ne = H("FmSideSheet");
2837
- return l(), re(ne, {
2838
- modelValue: v(R),
2839
- "onUpdate:modelValue": m[8] || (m[8] = (q) => Dt(R) ? R.value = q : null),
2840
- "dismiss-away": r.value,
2841
- "max-width": 600,
2842
- "close-button": !1
2843
- }, {
2844
- "side-sheet-header": ee(() => {
2845
- var q, me;
2846
- return [
2847
- e("div", ao, [
2848
- e("div", lo, [
2849
- e("div", io, y(v(u)("inventory.transfer.receiveRequest.details.title") + ((q = s.purchaseOrder) != null && q.seqNumber ? ` #${(me = s.purchaseOrder) == null ? void 0 : me.seqNumber}` : "")), 1),
2850
- D(P, {
2851
- class: "ml-auto -m-2",
2852
- variant: "tertiary",
2853
- "prepend-icon": "close",
2854
- onClick: m[0] || (m[0] = (Oe) => f("update:show", !1))
2855
- })
2856
- ]),
2857
- D(M, {
2858
- items: X.value,
2859
- modelValue: z.value,
2860
- "onUpdate:modelValue": m[1] || (m[1] = (Oe) => z.value = Oe)
2861
- }, null, 8, ["items", "modelValue"]),
2862
- s.purchaseOrder && z.value.value === "deliveryHistory" ? (l(), re(jr, {
2863
- key: 0,
2864
- "purchase-order": s.purchaseOrder,
2865
- "received-info-map": Ne.value,
2866
- onSubmitted: m[2] || (m[2] = () => {
2867
- f("update:show", !1), f("submitted");
2868
- })
2869
- }, null, 8, ["purchase-order", "received-info-map"])) : B("", !0)
2870
- ])
2871
- ];
2872
- }),
2873
- default: ee(() => {
2874
- var q, me, Oe, Fe, Te;
2875
- return [
2876
- e("div", co, [
2877
- z.value.value === "overview" ? (l(), b(de, { key: 0 }, [
2878
- e("div", null, [
2879
- D(p, {
2880
- variant: "outlined",
2881
- class: "flex flex-col gap-8 px-12 py-16"
2882
- }, {
2883
- default: ee(() => {
2884
- var te, le, pe, he, _e, Re, ue, fe, Ie;
2885
- return [
2886
- e("div", uo, [
2887
- e("div", mo, y(v(u)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
2888
- e("div", po, [
2889
- D(Ve, null, {
2890
- default: ee(() => {
2891
- var Ee;
2892
- return [
2893
- ke(y((Ee = o.purchaseOrder) == null ? void 0 : Ee.status), 1)
2894
- ];
2895
- }),
2896
- _: 1
2897
- }),
2898
- D(W, {
2899
- label: j.value.status,
2900
- class: Me(j.value.statusClass),
2901
- compact: ""
2902
- }, null, 8, ["label", "class"]),
2903
- N.value ? (l(), b("div", fo, [
2904
- D(E, {
2905
- name: "local_shipping",
2906
- color: "#666666"
2907
- }),
2908
- e("span", yo, y(N.value), 1)
2909
- ])) : B("", !0)
2910
- ])
2911
- ]),
2912
- D(I),
2913
- e("div", vo, [
2914
- e("div", ho, [
2915
- e("div", bo, [
2916
- e("div", go, y(v(u)("inventory.transfer.receiveRequest.details.createdAt")), 1)
2917
- ]),
2918
- e("div", _o, y(v(We)(((te = s.purchaseOrder) == null ? void 0 : te._id) ?? "")), 1)
2919
- ]),
2920
- (le = s.purchaseOrder) != null && le.effectiveAt ? (l(), b("div", So, [
2921
- e("div", xo, y(v(u)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
2922
- e("div", Oo, y(v(_t)(new Date((pe = s.purchaseOrder) == null ? void 0 : pe.effectiveAt))), 1)
2923
- ])) : B("", !0),
2924
- e("div", wo, [
2925
- e("div", $o, y(v(u)("inventory.transfer.receiveRequest.details.type.title")), 1),
2926
- e("div", Co, y(v(u)(
2927
- `inventory.transfer.receiveRequest.details.type.${T.value.toLocaleLowerCase("en-US")}`
2928
- )), 1)
2929
- ]),
2930
- (_e = (he = s.purchaseOrder) == null ? void 0 : he.supplier) != null && _e.name ? (l(), b("div", Ro, [
2931
- e("div", ko, y(v(u)("inventory.transfer.receiveRequest.details.from")), 1),
2932
- e("div", Do, y((ue = (Re = s.purchaseOrder) == null ? void 0 : Re.supplier) == null ? void 0 : ue.name), 1)
2933
- ])) : B("", !0),
2934
- s.transferTo ? (l(), b("div", Ao, [
2935
- e("div", No, y(v(u)("inventory.transfer.receiveRequest.details.to")), 1),
2936
- e("div", Fo, y(s.transferTo), 1)
2937
- ])) : B("", !0),
2938
- (fe = s.purchaseOrder) != null && fe.ref ? (l(), b("div", To, [
2939
- e("div", Io, y(v(u)("inventory.transfer.receiveRequest.details.reference")), 1),
2940
- e("div", Po, y(s.purchaseOrder.ref), 1)
2941
- ])) : B("", !0),
2942
- (Ie = s.purchaseOrder) != null && Ie.remark ? (l(), b("div", qo, [
2943
- e("div", Vo, y(v(u)("inventory.transfer.receiveRequest.details.remark")), 1),
2944
- e("div", Eo, y(s.purchaseOrder.remark), 1)
2945
- ])) : B("", !0)
2946
- ])
2947
- ];
2948
- }),
2949
- _: 1
2950
- })
2951
- ]),
2952
- D(Zs, {
2953
- "po-request": s.poRequest,
2954
- purchaseOrder: s.purchaseOrder,
2955
- transferType: T.value,
2956
- transferToDbName: s.transferToDbName,
2957
- scope: s.scope
2958
- }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
2959
- e("div", Lo, [
2960
- e("div", Mo, [
2961
- e("div", Uo, [
2962
- e("span", Bo, [
2963
- ke(y(Ae.value ? v(u)("inventory.transfer.receiveRequest.details.receivedItems") : v(u)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
2964
- (me = (q = s.purchaseOrder) == null ? void 0 : q.netSuite) != null && me.missingItems && ((Fe = (Oe = s.purchaseOrder) == null ? void 0 : Oe.netSuite) == null ? void 0 : Fe.missingItems.length) > 0 ? (l(), re(Z, {
2965
- key: 0,
2966
- variant: "rich",
2967
- placement: "top",
2968
- "z-index": 51
2969
- }, {
2970
- content: ee(() => {
2971
- var te, le;
2972
- return [
2973
- e("div", jo, [
2974
- (l(!0), b(de, null, xe((le = (te = s.purchaseOrder) == null ? void 0 : te.netSuite) == null ? void 0 : le.missingItems, (pe, he) => (l(), b("div", {
2975
- class: "flex justify-center align-middle",
2976
- key: he
2977
- }, [
2978
- D(E, {
2979
- name: "arrow_right",
2980
- size: "sm"
2981
- }),
2982
- ke(" " + y(`(${pe.netSuiteId}) ${pe.name}: ${pe.reason}`), 1)
2983
- ]))), 128))
2984
- ])
2985
- ];
2986
- }),
2987
- default: ee(() => [
2988
- D(E, {
2989
- name: "error",
2990
- color: "#ff2c2c",
2991
- size: "sm"
2992
- })
2993
- ]),
2994
- _: 1
2995
- })) : B("", !0)
2996
- ])
2997
- ]),
2998
- D(I),
2999
- (l(!0), b(de, null, xe(((Te = s.purchaseOrder) == null ? void 0 : Te.items) ?? [], (te, le) => {
3000
- var pe;
3001
- return l(), b("div", {
3002
- key: le,
3003
- class: "flex flex-col"
3004
- }, [
3005
- e("div", zo, [
3006
- e("div", Ko, [
3007
- ke(y(te.name) + " ", 1),
3008
- G(te) ? (l(), re(Z, {
3009
- key: 0,
3010
- variant: "rich",
3011
- placement: "top",
3012
- "z-index": 51
3013
- }, {
3014
- content: ee(() => {
3015
- var he, _e;
3016
- return [
3017
- e("div", Ho, [
3018
- m[9] || (m[9] = e("div", { class: "font-semibold" }, "Submission changes", -1)),
3019
- e("div", null, "Original Amount: " + y((he = ce(te)) == null ? void 0 : he.originalAmount), 1),
3020
- e("div", null, " New Amount: " + y((_e = ce(te)) == null ? void 0 : _e.newAmount), 1)
3021
- ])
3022
- ];
3023
- }),
3024
- default: ee(() => [
3025
- D(E, {
3026
- name: "error",
3027
- color: "#ff9500",
3028
- size: "sm"
3029
- })
3030
- ]),
3031
- _: 2
3032
- }, 1024)) : B("", !0)
3033
- ]),
3034
- e("div", Go, [
3035
- e("span", {
3036
- innerHTML: k(te)
3037
- }, null, 8, Wo)
3038
- ])
3039
- ]),
3040
- e("div", Yo, [
3041
- e("div", Qo, y(te.code), 1),
3042
- (pe = te.totalCost) != null && pe.amount && v(A).enableTotalCost ? (l(), b("div", Jo, " (" + y(v(Ke)(te.totalCost)) + ") ", 1)) : B("", !0)
3043
- ])
3044
- ]);
3045
- }), 128)),
3046
- +v(be)(oe.value) ? (l(), b(de, { key: 0 }, [
3047
- e("div", Xo, [
3048
- D(I)
3049
- ]),
3050
- e("div", Zo, [
3051
- m[10] || (m[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
3052
- e("div", en, y(v(Ke)(oe.value)), 1)
3053
- ])
3054
- ], 64)) : B("", !0)
3055
- ])
3056
- ])
3057
- ], 64)) : z.value.value === "deliveryHistory" ? (l(), b("div", tn, [
3058
- V.value.length ? (l(), b("div", an, [
3059
- (l(!0), b(de, null, xe(V.value, (te, le) => {
3060
- var pe, he, _e, Re, ue;
3061
- return l(), b(de, { key: le }, [
3062
- e("div", ln, [
3063
- e("div", cn, [
3064
- e("div", un, [
3065
- e("div", {
3066
- class: Me([
3067
- {
3068
- "bg-fm-color-primary": le !== 0,
3069
- "bg-white": le === 0
3070
- },
3071
- "w-[2px] h-full"
3072
- ])
3073
- }, null, 2)
3074
- ]),
3075
- e("div", dn, [
3076
- te.header === "Received" ? (l(), re(E, {
3077
- key: 0,
3078
- name: "local_shipping",
3079
- outline: "",
3080
- color: "#ffffff"
3081
- })) : B("", !0)
3082
- ]),
3083
- e("div", mn, [
3084
- e("div", {
3085
- class: Me([
3086
- {
3087
- "bg-fm-color-primary": le < V.value.length - 1,
3088
- "bg-white": le >= V.value.length - 1
3089
- },
3090
- "w-[2px] h-full"
3091
- ])
3092
- }, null, 2)
3093
- ])
3094
- ]),
3095
- e("div", pn, [
3096
- e("div", fn, [
3097
- e("div", yn, y(te.header), 1),
3098
- e("div", vn, y(te.date), 1)
3099
- ]),
3100
- e("div", hn, [
3101
- te.header === "Received" && te.deliveryOrder && s.purchaseOrder ? (l(), re(br, {
3102
- key: 0,
3103
- deliveryOrder: te.deliveryOrder,
3104
- purchaseOrder: s.purchaseOrder,
3105
- onSubmitted: m[3] || (m[3] = () => {
3106
- f("update:show", !1), f("submitted");
3107
- })
3108
- }, null, 8, ["deliveryOrder", "purchaseOrder"])) : B("", !0),
3109
- (he = (pe = te.deliveryOrder) == null ? void 0 : pe.netSuite) != null && he.id ? (l(), re(Ve, { key: 1 }, {
3110
- default: ee(() => {
3111
- var fe, Ie;
3112
- return [
3113
- D(no, {
3114
- "netsuite-id": (Ie = (fe = te.deliveryOrder) == null ? void 0 : fe.netSuite) == null ? void 0 : Ie.id
3115
- }, null, 8, ["netsuite-id"])
3116
- ];
3117
- }),
3118
- _: 2
3119
- }, 1024)) : B("", !0),
3120
- s.purchaseOrder && ((_e = te.deliveryOrder) != null && _e.id) ? (l(), re(Bt, {
3121
- key: 2,
3122
- "purchase-order-id": (Re = s.purchaseOrder) == null ? void 0 : Re._id,
3123
- "delivery-order-id": (ue = te.deliveryOrder) == null ? void 0 : ue.id
3124
- }, null, 8, ["purchase-order-id", "delivery-order-id"])) : B("", !0)
3125
- ])
3126
- ])
3127
- ]),
3128
- e("div", bn, [
3129
- e("div", gn, [
3130
- e("div", _n, [
3131
- e("div", {
3132
- class: Me([
3133
- {
3134
- "bg-fm-color-primary": le < V.value.length - 1,
3135
- "bg-white": le >= V.value.length - 1
3136
- },
3137
- "w-[2px] h-full"
3138
- ])
3139
- }, null, 2)
3140
- ])
3141
- ]),
3142
- e("div", Sn, [
3143
- D(p, {
3144
- variant: "outlined",
3145
- class: "py-12 px-16"
3146
- }, {
3147
- default: ee(() => [
3148
- e("div", xn, [
3149
- (l(!0), b(de, null, xe(te.info, (fe, Ie) => (l(), b("div", {
3150
- key: Ie,
3151
- class: "flex flex-col gap-4"
3152
- }, [
3153
- e("div", On, y(fe == null ? void 0 : fe.label), 1),
3154
- e("div", wn, [
3155
- (l(!0), b(de, null, xe(fe == null ? void 0 : fe.values, (Ee, $t) => (l(), b("div", {
3156
- key: $t,
3157
- class: "fm-typo-en-body-lg-600"
3158
- }, [
3159
- typeof Ee == "string" ? (l(), b(de, { key: 0 }, [
3160
- ke(y(Ee), 1)
3161
- ], 64)) : (l(), re(At(Ee), { key: 1 }))
3162
- ]))), 128))
3163
- ])
3164
- ]))), 128))
3165
- ])
3166
- ]),
3167
- _: 2
3168
- }, 1024)
3169
- ])
3170
- ])
3171
- ], 64);
3172
- }), 128))
3173
- ])) : (l(), b("div", sn, [
3174
- D(ae),
3175
- e("div", null, [
3176
- e("img", {
3177
- src: v(Et),
3178
- alt: "List is empty"
3179
- }, null, 8, rn)
3180
- ]),
3181
- e("div", on, y(v(u)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
3182
- e("div", nn, y(v(u)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
3183
- D(ae),
3184
- D(ae)
3185
- ]))
3186
- ])) : B("", !0)
3187
- ])
3188
- ];
3189
- }),
3190
- "side-sheet-footer": ee(() => [
3191
- e("div", $n, [
3192
- (l(!0), b(de, null, xe(K.value, (q) => (l(), b(de, null, [
3193
- v(ot)[q].available != !1 ? (l(), re(P, {
3194
- key: q,
3195
- label: v(u)(v(ot)[q].translationKey),
3196
- onClick: (me) => ie(q),
3197
- loading: O.value === q,
3198
- disabled: O.value !== q && w.value,
3199
- variant: v(ot)[q].buttonVariant
3200
- }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : B("", !0)
3201
- ], 64))), 256)),
3202
- v(x).ableToMarkReceived(s.purchaseOrder) && !K.value.includes("completeReceive") ? (l(), re(P, {
3203
- key: 0,
3204
- label: v(u)("inventory.transfer.receiveRequest.actions.completeReceive"),
3205
- onClick: m[4] || (m[4] = (q) => ie("completeReceive")),
3206
- loading: O.value === "completeReceive",
3207
- disabled: O.value !== "completeReceive" && w.value
3208
- }, null, 8, ["label", "loading", "disabled"])) : B("", !0),
3209
- v(x).ableToMarkApproved(s.purchaseOrder) && s.canApprove && !K.value.includes("approveRequest") ? (l(), re(P, {
3210
- key: 1,
3211
- label: v(u)("inventory.transfer.approval.actions.approveRequest"),
3212
- onClick: m[5] || (m[5] = (q) => ie("approveRequest")),
3213
- loading: O.value === "approveRequest",
3214
- disabled: O.value !== "approveRequest" && w.value
3215
- }, null, 8, ["label", "loading", "disabled"])) : B("", !0),
3216
- v(x).ableToCreateFulfillment(s.purchaseOrder, s.poRequest) && o.scope === "approval" ? (l(), re(P, {
3217
- key: 2,
3218
- label: v(u)("inventory.transfer.receiveRequest.actions.processRequest"),
3219
- onClick: m[6] || (m[6] = (q) => ie("processRequest")),
3220
- loading: O.value === "processRequest",
3221
- disabled: O.value !== "processRequest" && w.value
3222
- }, null, 8, ["label", "loading", "disabled"])) : B("", !0),
3223
- D(P, {
3224
- label: v(u)("common.close"),
3225
- variant: "tertiary",
3226
- onClick: m[7] || (m[7] = (q) => f("update:show", !1))
3227
- }, null, 8, ["label"])
3228
- ])
3229
- ]),
3230
- _: 1
3231
- }, 8, ["modelValue", "dismiss-away"]);
3232
- };
3233
- }
3234
- });
3235
- export {
3236
- lt as P,
3237
- Qn as _,
3238
- Yn as a,
3239
- Xt as g,
3240
- Wn as u
3241
- };