@feedmepos/mf-inventory-portal 1.2.61-dev.1 → 1.2.61

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