@feedmepos/mf-inventory-portal 1.5.12-dev.0 → 1.5.13

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 (111) hide show
  1. package/dist/{App-ym7zoIt4.js → App-DqGcS6Gm.js} +4 -4
  2. package/dist/{ApprovalView-DS1cgEM3.js → ApprovalView-BpLssvwC.js} +7 -7
  3. package/dist/{BindingsDialog-pA-lQ0Qx.js → BindingsDialog-Bjca56rZ.js} +2 -2
  4. package/dist/{BindingsPicker-D-lS8rtE.js → BindingsPicker-D3bSjNn3.js} +2 -2
  5. package/dist/{BindingsTable-CCG83TCM.js → BindingsTable-b8uwBXvE.js} +3 -3
  6. package/dist/{ClosingDraftView-BI6RvZMJ.js → ClosingDraftView-DufSupv2.js} +15 -15
  7. package/dist/{ClosingHistoryView-CzSQ7tNH.js → ClosingHistoryView-C3V5brh9.js} +86 -85
  8. package/dist/{ClosingTemplateView-By2oAuyO.js → ClosingTemplateView-B6hpp5B8.js} +14 -14
  9. package/dist/{DefaultView-eHfv7jOS.js → DefaultView-DeN96J1z.js} +2 -2
  10. package/dist/{DeliveryOrderPrintPreview-59gPCEN9.js → DeliveryOrderPrintPreview-EnFKjxtA.js} +2 -2
  11. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DJnbYUPk.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-6M_CG9Xi.js} +2 -2
  12. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BmoeRycM.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-RH37--FG.js} +2 -2
  13. package/dist/{FmMultiselectDialog-y6iFhI-b.js → FmMultiselectDialog-6mShWQom.js} +1 -1
  14. package/dist/{FmMultiselectDialog-BQct_7_1.js → FmMultiselectDialog-CfjwOjv0.js} +2 -2
  15. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-5FB2Q2M7.js → FmUnitInput.vue_vue_type_script_setup_true_lang-ILexyjQI.js} +5 -5
  16. package/dist/{ImportView-CFhTlC6A.js → ImportView-Aksgpj3u.js} +6 -6
  17. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang--lvhU0IL.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BVa8U4y-.js} +1 -1
  18. package/dist/{IngredientGroupView-98vFl0cv.js → IngredientGroupView-BbJFosjR.js} +5 -5
  19. package/dist/{IngredientsView-DOyC-80n.js → IngredientsView-CN933oCR.js} +15 -15
  20. package/dist/{IntegrationExplorerView-yqqhYVKa.js → IntegrationExplorerView-CAjxn-PC.js} +352 -352
  21. package/dist/IntegrationView-w4fp4oT4.js +4586 -0
  22. package/dist/{InventoryBindingForm-TOMIZzTV.js → InventoryBindingForm-EBJ3QGaU.js} +1 -1
  23. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CCwsG2nZ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CoUtIP_H.js} +5 -5
  24. package/dist/{InventoryBindingSummary-Kq71Npw5.js → InventoryBindingSummary-DqplMp3W.js} +1 -1
  25. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BpqRkOKa.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DtBoicPG.js} +1 -1
  26. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BXQXxebS.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DsYsq73l.js} +1 -1
  27. package/dist/{PublishView-B3iAIUeC.js → PublishView-BJIsXl8d.js} +3 -3
  28. package/dist/{PurchaseOrderPrintPreview-C7BYCDq4.js → PurchaseOrderPrintPreview-C7HgcwTx.js} +2 -2
  29. package/dist/{ReceiveRequestView-C0RZHVVz.js → ReceiveRequestView-BKfE6CFa.js} +26 -26
  30. package/dist/{RecipeView-CGMCm-6C.js → RecipeView-CIcat7Oq.js} +1117 -1104
  31. package/dist/{SettingsView-Dy36ihuC.js → SettingsView-DAg0_Cxw.js} +4 -4
  32. package/dist/{StockView-DG8gGcR6.js → StockView-DkkBhXdb.js} +19 -19
  33. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-7jJ-_TKD.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B_7-SpUx.js} +1 -1
  34. package/dist/{SupplierView-DkXdKVSS.js → SupplierView-DdBM6_mn.js} +12 -12
  35. package/dist/{SurchargeView-CnQFI8Np.js → SurchargeView-DO7ccJw4.js} +6 -6
  36. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CjxxSwOw.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CnmxlHSe.js} +2 -2
  37. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CgxcV8uB.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CsxPLRxW.js} +1 -1
  38. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-P4wynSco.js → TransferDetails.vue_vue_type_script_setup_true_lang-UAe7BwyU.js} +20 -20
  39. package/dist/TransferTemplateView-DwNMWpQG.js +1564 -0
  40. package/dist/{UnitCostHistoryView-lq-q2AHS.js → UnitCostHistoryView-BR_DzquD.js} +4 -4
  41. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DSlyQqSb.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-1frVLUSk.js} +5 -5
  42. package/dist/{UnitView-d_Imf603.js → UnitView-DHhs6eAM.js} +7 -7
  43. package/dist/{WarehouseView-61nx-AdI.js → WarehouseView-BncF3L-E.js} +5 -5
  44. package/dist/{WastageTemplateView-CjFGIKQo.js → WastageTemplateView-e3ixwHt1.js} +14 -14
  45. package/dist/api/inventory.d.ts +0 -1
  46. package/dist/api/netsuite.d.ts +4 -5
  47. package/dist/api/surcharge.d.ts +0 -1
  48. package/dist/{app-vpgIgmf7.js → app-BM6mngFA.js} +4141 -4438
  49. package/dist/app.d.ts +0 -268
  50. package/dist/app.js +1 -1
  51. package/dist/{closing-template-Dq6tC4Zx.js → closing-template-BD6V7qLl.js} +1 -1
  52. package/dist/{date2-Bdr9V2CH.js → date2-DDlrt2dw.js} +1 -1
  53. package/dist/{dayjs.min-DyMZZmIx.js → dayjs.min-CRtl6lAo.js} +1 -1
  54. package/dist/{decimal-naJvMnG2.js → decimal-C05Zbycy.js} +2 -2
  55. package/dist/{defineDeepModel-33cmeIFu.js → defineDeepModel-B0S3YXv1.js} +1 -1
  56. package/dist/{duplicate-template-DSu6924D.js → duplicate-template-DLoKowb8.js} +1 -1
  57. package/dist/{feature-yi8Tnb7H.js → feature-Hkq4qHGO.js} +2 -2
  58. package/dist/{format-time-from-id-Dq0qIwbK.js → format-time-from-id-BsGskcws.js} +1 -1
  59. package/dist/format-unit-display-Dbb2764O.js +1268 -0
  60. package/dist/{import-export.helper-DDiyb9cx.js → import-export.helper-CwHS2Pr0.js} +6 -6
  61. package/dist/{index-B4vbL-WN.js → index-BosCKut7.js} +1 -1
  62. package/dist/index-C-Z_O_57.js +164 -0
  63. package/dist/{index-Dmrgz0N_.js → index-DOZ0kYer.js} +1 -1
  64. package/dist/{inventory-core-dart.default-DzEwllSu.js → inventory-core-dart.default-DsrlA0VP.js} +1 -1
  65. package/dist/{lz-string-DECQ92Sb.js → lz-string-jug66pQ2.js} +1 -1
  66. package/dist/modules/print-template/api/print-template.d.ts +0 -1
  67. package/dist/{netsuite-CKOqNFIz.js → netsuite-CM1xsb3Q.js} +2 -2
  68. package/dist/{number-CwVsldWr.js → number-B1kR4U7C.js} +3 -3
  69. package/dist/{predefined-templates-7P8LQiMs.js → predefined-templates-B3VXqLxq.js} +1 -1
  70. package/dist/{purchase-order-template-CFGG5iZS.js → purchase-order-template-BZ7ubNPM.js} +1 -1
  71. package/dist/{recalculationUtils-CxUnAgYt.js → recalculationUtils-DT_K_oBV.js} +1 -1
  72. package/dist/{rules-C-5mKwH6.js → rules-DXN5yNM9.js} +2 -2
  73. package/dist/{stock-B_XDv328.js → stock-Cwp99-w7.js} +1 -1
  74. package/dist/stores/api.d.ts +0 -1
  75. package/dist/stores/helper/generate-backend-urls.d.ts +0 -1
  76. package/dist/stores/integration/index.d.ts +1 -4
  77. package/dist/{supplier-BDDyN8pD.js → supplier-CNblYzcC.js} +2 -2
  78. package/dist/{surcharge-9qVO99TB.js → surcharge-DiXkOxK8.js} +1 -1
  79. package/dist/tsconfig.app.tsbuildinfo +1 -1
  80. package/dist/{uom-rules-2xdoSjfc.js → uom-rules-B0cj4nFH.js} +1 -1
  81. package/dist/{use-ingredient-select-dialog-BHgTuz0K.js → use-ingredient-select-dialog-CHqjDEzy.js} +2 -2
  82. package/dist/{use-inventory-binding-dialog-CVpVEZ-n.js → use-inventory-binding-dialog-CqKj6_hT.js} +2 -2
  83. package/dist/use-template-enabled-locations-CZf0oezR.js +146 -0
  84. package/dist/{use-transfer-locations-CMPfQCpO.js → use-transfer-locations-BTRfRrp8.js} +2 -2
  85. package/dist/{useHrmPermission-BfjsEgXe.js → useHrmPermission-CYeY_uQ0.js} +1 -1
  86. package/dist/{useNavigationMenu-DQV4rPXu.js → useNavigationMenu-D2DBZszb.js} +2 -2
  87. package/dist/{useSseClient-DyY87MX7.js → useSseClient-DNe-54JD.js} +3 -3
  88. package/dist/views/recipe/composables/use-recipe-bulk-editor.d.ts +3 -3
  89. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1 -4
  90. package/dist/{vue-i18n-WjLZbUYJ.js → vue-i18n-CRix8f2i.js} +419 -419
  91. package/dist/{xlsx-BoG4Nhqx.js → xlsx-4npyDw84.js} +398 -398
  92. package/dist/{xlsx.util-BSJ5fdz4.js → xlsx.util-C-DEH9b0.js} +3 -3
  93. package/package.json +4 -4
  94. package/dist/IntegrationView-BR7yLMpk.js +0 -5100
  95. package/dist/TransferTemplateView-D6dO4-GT.js +0 -2327
  96. package/dist/api/codemax.d.ts +0 -11
  97. package/dist/format-unit-display-dtvjecol.js +0 -1432
  98. package/dist/index-B4O6YlPQ.js +0 -257
  99. package/dist/stores/integration/codemax.d.ts +0 -432
  100. package/dist/use-template-enabled-locations-esKf16CY.js +0 -132
  101. package/dist/views/integration/Codemax.vue.d.ts +0 -2
  102. package/dist/views/integration/components/ApplyProductCodemax.vue.d.ts +0 -341
  103. package/dist/views/integration/components/ApplyProductDialogCodemax.vue.d.ts +0 -298
  104. package/dist/views/integration/components/ApplyProductDialogPropsCodemax.d.ts +0 -17
  105. package/dist/views/integration/components/CodemaxDialog.vue.d.ts +0 -519
  106. package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorDialog.vue.d.ts +0 -2
  107. package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep1.vue.d.ts +0 -2
  108. package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep2.vue.d.ts +0 -8
  109. package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep3.vue.d.ts +0 -2
  110. package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +0 -3225
  111. package/dist/views/transfer-template/helpers/template-item-bulk-editor-export.d.ts +0 -9
@@ -0,0 +1,1564 @@
1
+ import { defineComponent as ae, onMounted as Te, computed as B, ref as H, watch as Fe, inject as ot, resolveComponent as R, openBlock as O, createElementBlock as L, createElementVNode as t, createVNode as b, withCtx as N, renderSlot as Ue, withDirectives as Pe, normalizeClass as le, vModelText as Be, reactive as st, h as Q, toDisplayString as M, unref as e, createCommentVNode as oe, Fragment as pe, normalizeStyle as _e, renderList as Qe, createBlock as ne, mergeProps as Ye, createTextVNode as re, mergeModels as Le, useModel as nt, isRef as He, Teleport as lt, normalizeProps as rt, guardReactiveProps as at } from "vue";
2
+ import { u as it, _ as ut } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
3
+ import { useI18n as me } from "@feedmepos/mf-common";
4
+ import { f as dt, t as mt, u as Ne, a as pt } from "./format-unit-display-Dbb2764O.js";
5
+ import { R as Ee } from "./row-action.enum-DQ9bJ_uv.js";
6
+ import { a as We, q as ct, r as X, u as Ge, s as ft, j as ye } from "./app-BM6mngFA.js";
7
+ import { _ as yt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-RH37--FG.js";
8
+ import { components as ue, useSnackbar as vt, useProxiedModel as Ke, useBreakpoints as bt } from "@feedmepos/ui-library";
9
+ import { defineStore as ht, storeToRefs as ze } from "pinia";
10
+ import { F as de } from "./form-mode.enum-BKiNVH6A.js";
11
+ import { I as gt, a as xt, R as ke, A as we, M as _t } from "./rules-DXN5yNM9.js";
12
+ import { u as ge, t as je, b as kt, n as wt, a as se, g as be, c as ve, d as Tt } from "./number-B1kR4U7C.js";
13
+ import { d as Ze } from "./defineDeepModel-B0S3YXv1.js";
14
+ import { _ as Ft, F as Ct, a as It, b as Mt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-ILexyjQI.js";
15
+ import { u as he } from "./feature-Hkq4qHGO.js";
16
+ import { u as Je } from "./netsuite-CM1xsb3Q.js";
17
+ import { F as xe } from "./inventory-core-dart.default-DsrlA0VP.js";
18
+ import { u as St } from "./supplier-CNblYzcC.js";
19
+ import { u as Ot } from "./use-ingredient-select-dialog-CHqjDEzy.js";
20
+ import { F as ee, _ as Xe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
21
+ import { u as $t } from "./use-template-enabled-locations-CZf0oezR.js";
22
+ import { u as Dt } from "./use-transfer-locations-BTRfRrp8.js";
23
+ import { _ as Vt } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-6M_CG9Xi.js";
24
+ import { u as At } from "./purchase-order-template-BZ7ubNPM.js";
25
+ import { _ as Rt } from "./FmConfirmationButton.vue_vue_type_script_setup_true_lang-DLrMEGFR.js";
26
+ import { f as qt } from "./format-time-from-id-BsGskcws.js";
27
+ import { f as Ut } from "./date2-DDlrt2dw.js";
28
+ const Pt = { class: "flex flex-col" }, Bt = { class: "flex flex-col" }, Lt = { class: "flex-1" }, Nt = { class: "flex items-center" }, Et = { class: "flex-1" }, zt = { class: "flex-1" }, jt = /* @__PURE__ */ ae({
29
+ __name: "FmMinMaxInput",
30
+ props: {
31
+ rules: {},
32
+ label: {},
33
+ minPlaceholder: {},
34
+ maxPlaceholder: {},
35
+ modelValue: {},
36
+ precision: {},
37
+ minLength: {},
38
+ maxLength: {},
39
+ inputmode: {},
40
+ type: {},
41
+ readonly: { type: Boolean },
42
+ labelMark: {},
43
+ prependIcon: {},
44
+ appendIcon: {},
45
+ showValidBorder: { type: Boolean },
46
+ labelInfo: {},
47
+ showWordCount: { type: Boolean },
48
+ invalid: { type: Boolean },
49
+ autofocus: { type: Boolean },
50
+ formatter: { type: Function },
51
+ decimal: {},
52
+ datalist: {},
53
+ shiftDatalist: { type: Boolean },
54
+ datalistMaxHeight: {},
55
+ datalistMinHeight: {},
56
+ offsetDatalist: {},
57
+ datalistPlacement: {},
58
+ datalistZIndex: {},
59
+ datalistWidth: {},
60
+ disabled: { type: Boolean },
61
+ focused: { type: Boolean },
62
+ helperText: {},
63
+ helperState: {}
64
+ },
65
+ setup(f) {
66
+ const x = f, h = Ze("modelValue"), r = gt();
67
+ Te(() => {
68
+ const { min: p, max: c } = h ?? {};
69
+ if (!(!p || !c) && p.precision !== c.precision) {
70
+ const w = Math.max(p.precision, c.precision), a = ge(p, w), v = ge(c, w);
71
+ h.min = a, h.max = v;
72
+ }
73
+ });
74
+ const i = B(() => {
75
+ const { min: p, max: c } = h ?? {};
76
+ return Math.max((p == null ? void 0 : p.precision) ?? 0, (c == null ? void 0 : c.precision) ?? 0, x.precision ?? 0);
77
+ }), s = (p) => {
78
+ if (!p) return "";
79
+ const c = kt(p), w = i.value, a = ge(c, w);
80
+ return wt(
81
+ +se(a),
82
+ a.precision
83
+ );
84
+ }, u = H(s(h.min)), _ = H(s(h.max));
85
+ Fe([u, _], ([p, c]) => {
86
+ const w = h ?? {}, a = r(p), v = r(c), S = i.value;
87
+ if (p !== "" && a === !0) {
88
+ const I = je(+p, S);
89
+ w.min = I;
90
+ } else
91
+ w.min = null;
92
+ if (c !== "" && v === !0) {
93
+ const I = je(+c, S);
94
+ w.max = I;
95
+ } else
96
+ w.max = null;
97
+ h.min = w.min, h.max = w.max;
98
+ });
99
+ const $ = Symbol.for("fm:form-state"), y = ot($, null), o = B(() => x.disabled ?? (y == null ? void 0 : y.getDisabled()) ?? !1), d = H(), m = H(), k = H(!1), T = H(!1), A = B(() => k.value || T.value), q = B(() => [...[
100
+ function() {
101
+ return typeof r(u.value) == "string" || typeof r(_.value) == "string" ? "Must be a number" : !0;
102
+ },
103
+ function(w) {
104
+ return !w || !w.min || !w.max ? !0 : +se(w.min) > +se(w.max) ? "Min must be less than or equal to max" : !0;
105
+ }
106
+ ], ...x.rules ?? []]);
107
+ return (p, c) => {
108
+ const w = R("FmLabel"), a = R("FmField"), v = R("FmFormGroup");
109
+ return O(), L("div", Pt, [
110
+ t("div", Bt, [
111
+ t("div", Lt, [
112
+ b(w, {
113
+ label: p.label,
114
+ disabled: p.disabled,
115
+ required: p.labelMark === "required",
116
+ optional: p.labelMark === "optional"
117
+ }, null, 8, ["label", "disabled", "required", "optional"])
118
+ ]),
119
+ b(a, { focused: A.value }, {
120
+ default: N(() => [
121
+ t("div", Nt, [
122
+ Ue(p.$slots, "prepend"),
123
+ c[6] || (c[6] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
124
+ t("div", Et, [
125
+ Pe(t("input", {
126
+ type: "text",
127
+ ref_key: "minInputRef",
128
+ ref: d,
129
+ onFocus: c[0] || (c[0] = () => k.value = !0),
130
+ onBlur: c[1] || (c[1] = () => k.value = !1),
131
+ "onUpdate:modelValue": c[2] || (c[2] = (S) => u.value = S),
132
+ class: le({
133
+ "fm-text-field--input fm-typo-en-body-lg-400": !0,
134
+ "text-fm-color-typo-primary": !o.value,
135
+ "text-fm-color-typo-disabled": o.value
136
+ })
137
+ }, null, 34), [
138
+ [Be, u.value]
139
+ ])
140
+ ]),
141
+ c[7] || (c[7] = t("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
142
+ c[8] || (c[8] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
143
+ t("div", zt, [
144
+ Pe(t("input", {
145
+ type: "text",
146
+ ref_key: "maxInputRef",
147
+ ref: m,
148
+ onFocus: c[3] || (c[3] = () => T.value = !0),
149
+ onBlur: c[4] || (c[4] = () => T.value = !1),
150
+ "onUpdate:modelValue": c[5] || (c[5] = (S) => _.value = S),
151
+ class: le({
152
+ "fm-text-field--input fm-typo-en-body-lg-400": !0,
153
+ "text-fm-color-typo-primary": !o.value,
154
+ "text-fm-color-typo-disabled": o.value
155
+ })
156
+ }, null, 34), [
157
+ [Be, _.value]
158
+ ])
159
+ ]),
160
+ Ue(p.$slots, "append")
161
+ ])
162
+ ]),
163
+ _: 3
164
+ }, 8, ["focused"])
165
+ ]),
166
+ b(v, {
167
+ class: "flex-1",
168
+ "model-value": p.modelValue,
169
+ info: p.labelInfo,
170
+ rules: q.value,
171
+ "helper-text": p.helperText,
172
+ "helper-state": p.helperState
173
+ }, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
174
+ ]);
175
+ };
176
+ }
177
+ });
178
+ function Qt({ min: f, max: x } = { min: !0, max: !0 }) {
179
+ return function(r) {
180
+ return !r || !r.min && f != !1 || !r.max && x != !1 ? "Required" : !0;
181
+ };
182
+ }
183
+ function Yt(f, x) {
184
+ return function(r) {
185
+ return !r || !r.min || !r.max ? !0 : +se(r.min) < f ? `Must be between ${f} and ${x}` : +se(r.max) > x ? `Must be between ${f} and ${x}` : !0;
186
+ };
187
+ }
188
+ function Ht(f) {
189
+ const x = xt(f), h = se(f);
190
+ return function(i) {
191
+ const s = !(i != null && i.min) || x(i.min) === !0, u = !(i != null && i.max) || x(i.max) === !0;
192
+ return !s && !u ? `Min & max must be a multiple of ${h}` : s ? u ? !0 : `Max must be a multiple of ${h}` : `Min must be a multiple of ${h}`;
193
+ };
194
+ }
195
+ const et = ht("netsuite-custom-field-helper", () => {
196
+ const f = Je();
197
+ function x(h, r, i, s, u) {
198
+ var y, o, d;
199
+ if (!i) {
200
+ u == null || u("Unit is not valid");
201
+ return;
202
+ }
203
+ let _ = h.code;
204
+ if (((y = h.measurement) == null ? void 0 : y.id) !== ((o = i.measurement) == null ? void 0 : o.id) && f.isEnabled) {
205
+ const m = f.getItemCustomCode(r, (d = i.measurement) == null ? void 0 : d.id);
206
+ m && (_ = m);
207
+ }
208
+ s({
209
+ ...h,
210
+ quantity: i.amount,
211
+ measurement: i.measurement ?? null,
212
+ code: _
213
+ });
214
+ }
215
+ return {
216
+ validateUnitInput: x
217
+ };
218
+ });
219
+ var Y = /* @__PURE__ */ ((f) => (f.Code = "Code", f.Name = "Name", f.DefaultAmount = "DefaultAmount", f.Limit = "Limit", f.Step = "Step", f.Cost = "Cost", f.Delete = "Delete", f))(Y || {});
220
+ function Wt(f, x = {}) {
221
+ const { t: h } = me(), r = We(), i = he(), s = st({}), u = et();
222
+ Te(() => {
223
+ for (const y of f.items) {
224
+ if (!y.totalCost)
225
+ continue;
226
+ const { cost: o } = xe.calculateDefaultCost({
227
+ item: y.sku,
228
+ amount: y.quantity,
229
+ measurement: y.measurement,
230
+ overrides: {
231
+ supplier: f.supplier
232
+ },
233
+ defaultCurrency: ct()
234
+ }), d = y.totalCost ?? xe.reset();
235
+ o ? s[y.sku._id] = o.amount !== d.amount || o.precision !== d.precision : s[y.sku._id] = !0;
236
+ }
237
+ });
238
+ const _ = [
239
+ {
240
+ id: "Code",
241
+ header: () => Q("div", { class: "flex-col" }, [
242
+ Q("div", h("inventory.transfer.form.items.table.Code")),
243
+ Q(
244
+ "div",
245
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
246
+ "(original code)"
247
+ )
248
+ ]),
249
+ accessorKey: "code",
250
+ size: 180,
251
+ cell(y) {
252
+ const o = y.row.original;
253
+ return Q("div", [
254
+ Q(ue.FmTextField, {
255
+ modelValue: o.code,
256
+ "onUpdate:modelValue": (d) => {
257
+ f.updateItem({
258
+ ...o,
259
+ code: d
260
+ });
261
+ },
262
+ helperText: o.sku.code,
263
+ key: o.sku._id,
264
+ rules: [ke()],
265
+ labelMark: "required"
266
+ })
267
+ ]);
268
+ },
269
+ enableSorting: !1
270
+ },
271
+ {
272
+ id: "Name",
273
+ header: () => Q("div", { class: "flex-col" }, [
274
+ Q("div", h("inventory.transfer.form.items.table.Name")),
275
+ Q(
276
+ "div",
277
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
278
+ "(original name)"
279
+ )
280
+ ]),
281
+ minSize: 300,
282
+ cell(y) {
283
+ const o = y.row.original;
284
+ return Q("div", [
285
+ Q(ue.FmTextField, {
286
+ modelValue: o.name,
287
+ "onUpdate:modelValue": (d) => {
288
+ f.updateItem({
289
+ ...o,
290
+ name: d
291
+ });
292
+ },
293
+ helperText: o.sku.name,
294
+ key: o.sku._id,
295
+ rules: [ke()],
296
+ labelMark: "required"
297
+ })
298
+ ]);
299
+ },
300
+ enableSorting: !1
301
+ },
302
+ {
303
+ id: "DefaultAmount",
304
+ header: () => h("inventory.transfer.form.items.table.DefaultAmount"),
305
+ minSize: 200,
306
+ cell(y) {
307
+ var A;
308
+ const o = y.row.original, d = r.skuById[o.sku._id], m = r.unitById[(A = d.unit) == null ? void 0 : A._id], k = m.measurements.find((q) => {
309
+ var p;
310
+ return ((p = o.measurement) == null ? void 0 : p.id) === q.id;
311
+ }), T = o.sku.unit._id !== d.unit._id || !m || o.measurement && !k;
312
+ return Q(Ft, {
313
+ style: {
314
+ flex: "1 1 0%"
315
+ },
316
+ modelValue: {
317
+ amount: o.quantity ?? { amount: 1, precision: 0 },
318
+ // NOTE: leave this reading from row.sku.unit and row.measurement instead,
319
+ measurement: o.measurement ?? (o.sku.unit._id !== d.unit._id ? { ...o.sku.unit, id: "", conversion: { amount: 1, precision: 0 } } : null)
320
+ },
321
+ disabled: f.disabled,
322
+ key: o.sku._id,
323
+ unit: m,
324
+ "onUpdate:modelValue": (q) => {
325
+ u.validateUnitInput(
326
+ o,
327
+ d,
328
+ q,
329
+ (p) => {
330
+ f.updateItem({
331
+ ...o,
332
+ code: p.code,
333
+ quantity: p.quantity,
334
+ measurement: p.measurement
335
+ });
336
+ }
337
+ );
338
+ },
339
+ rules: [
340
+ Ct(o.quantityStep),
341
+ ...+se(o.quantity) ? [
342
+ It(
343
+ +se(
344
+ o.minimumQuantity ?? {
345
+ amount: 1,
346
+ // NOTE: leave this reading from row.sku.unit and row.measurement instead,
347
+ precision: be(o.sku.unit, o.measurement)
348
+ }
349
+ )
350
+ )
351
+ ] : [],
352
+ Mt(
353
+ o.maximumQuantity ? +se(o.maximumQuantity) : 1 / 0
354
+ ),
355
+ function(p) {
356
+ return T ? "This item is no longer valid due to change in unit. Please reapply unit." : !0;
357
+ }
358
+ ],
359
+ applyDefaultRules: !0
360
+ });
361
+ },
362
+ enableSorting: !1
363
+ },
364
+ {
365
+ id: "Limit",
366
+ header: () => "Limit",
367
+ // TODO: i18n,
368
+ minSize: 280,
369
+ cell(y) {
370
+ const o = y.row.original;
371
+ return Q(jt, {
372
+ style: {
373
+ flex: "1 1 0%"
374
+ },
375
+ modelValue: {
376
+ min: o.minimumQuantity,
377
+ max: o.maximumQuantity
378
+ },
379
+ disabled: f.disabled,
380
+ key: o.sku._id,
381
+ unit: o.sku.unit,
382
+ "onUpdate:modelValue": (d) => {
383
+ const m = { ...o };
384
+ d != null && d.min ? m.minimumQuantity = d.min : m.minimumQuantity = null, d != null && d.max ? m.maximumQuantity = d.max : m.maximumQuantity = null, f.updateItem(m);
385
+ },
386
+ rules: [
387
+ Qt({ max: !1 }),
388
+ Ht(o.quantityStep),
389
+ Yt(
390
+ +se({
391
+ amount: 0,
392
+ precision: be(o.sku.unit, o.measurement)
393
+ }),
394
+ 1 / 0
395
+ )
396
+ ],
397
+ disableUnit: !0,
398
+ applyDefaultRules: !0
399
+ });
400
+ }
401
+ },
402
+ {
403
+ id: "Step",
404
+ header: () => h("inventory.transfer.form.items.table.Step"),
405
+ minSize: 100,
406
+ cell(y) {
407
+ const o = y.row.original;
408
+ return Q(ue.FmTextField, {
409
+ modelValue: se(o.quantityStep ?? xe.reset(), !1),
410
+ key: o.sku._id,
411
+ "onUpdate:modelValue": (d) => {
412
+ f.updateItem({
413
+ ...o,
414
+ quantityStep: ve(+d)
415
+ });
416
+ },
417
+ rules: [
418
+ we({
419
+ amount: 1,
420
+ precision: be(o.sku.unit, o.measurement)
421
+ }),
422
+ _t(o.sku.unit, o.measurement)
423
+ ]
424
+ });
425
+ },
426
+ enableSorting: !1
427
+ },
428
+ {
429
+ id: "Delete",
430
+ header: "",
431
+ cell(y) {
432
+ const o = y.row.original;
433
+ return Q("div", { class: "flex items-center" }, [
434
+ i.usePurchaseOrderV2 ? Q(
435
+ ue.FmTooltip,
436
+ {
437
+ zIndex: 50,
438
+ placement: "left"
439
+ },
440
+ {
441
+ default() {
442
+ return Q(ue.FmButton, {
443
+ key: o.sku._id,
444
+ type: "button",
445
+ icon: "add_circle",
446
+ variant: "tertiary",
447
+ size: "md",
448
+ disabled: f.disabled,
449
+ onClick: async () => {
450
+ const d = {
451
+ id: crypto.randomUUID(),
452
+ sku: o.sku,
453
+ code: o.sku.code,
454
+ name: o.sku.name,
455
+ quantity: ve(1),
456
+ quantityStep: ve(1),
457
+ minimumQuantity: ve(1)
458
+ };
459
+ u.validateUnitInput(
460
+ d,
461
+ o.sku,
462
+ {
463
+ amount: d.quantity,
464
+ measurement: null
465
+ },
466
+ (m) => {
467
+ d.code = m.code;
468
+ }
469
+ ), f.duplicateItem(d);
470
+ }
471
+ });
472
+ },
473
+ content() {
474
+ return "Duplicate entry";
475
+ }
476
+ }
477
+ ) : null,
478
+ Q(ue.FmButton, {
479
+ class: "delete-button",
480
+ key: o.sku._id,
481
+ type: "button",
482
+ icon: "delete",
483
+ variant: "tertiary",
484
+ size: "md",
485
+ disabled: f.disabled,
486
+ onClick: () => {
487
+ f.deleteItem(o);
488
+ }
489
+ })
490
+ ]);
491
+ },
492
+ enableSorting: !1,
493
+ size: 40,
494
+ meta: {
495
+ cellClass: "",
496
+ headerClass: ""
497
+ }
498
+ }
499
+ ];
500
+ return {
501
+ columnDefs: B(() => {
502
+ const y = he(), o = [..._];
503
+ if (Object.keys(x).length > 0)
504
+ for (const [d, m] of Object.entries(x))
505
+ o.splice(Number(d), 0, {
506
+ ...m,
507
+ id: d
508
+ });
509
+ return y.enableTotalCost && f.transferType === X.enum.purchase ? o : o.filter((d) => d.id !== "Cost");
510
+ })
511
+ };
512
+ }
513
+ const Gt = { class: "flex flex-col gap-8 py-16" }, Kt = { class: "flex items-center" }, Zt = { class: "flex-1 flex gap-1 items-center" }, Jt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, eo = { class: "flex gap-8 w-full" }, to = { class: "flex-1 flex flex-col gap-4" }, oo = { class: "flex-1 flex flex-col gap-4" }, so = {
514
+ key: 0,
515
+ class: "flex gap-8 w-full"
516
+ }, no = { class: "flex-1 flex flex-col gap-4" }, lo = { class: "flex-1 flex flex-col gap-4" }, ro = { class: "flex gap-8 w-full" }, ao = { class: "flex-1 flex flex-col gap-4" }, io = /* @__PURE__ */ ae({
517
+ __name: "TransferTemplateItem",
518
+ props: {
519
+ cellByColId: {},
520
+ row: {}
521
+ },
522
+ setup(f) {
523
+ const { t: x } = me();
524
+ function h(r) {
525
+ return r;
526
+ }
527
+ return (r, i) => {
528
+ var u, _, $, y, o, d, m, k, T, A, q, p, c, w, a, v, S, I, g, W, te, E, U, Z, n, l, F, P, z, G;
529
+ const s = R("FmLabel");
530
+ return O(), L("div", Gt, [
531
+ t("div", Kt, [
532
+ t("div", Zt, [
533
+ t("span", Jt, " (" + M(r.row.original.sku.code) + ") ", 1),
534
+ t("span", Xt, M(r.row.original.sku.name), 1)
535
+ ]),
536
+ t("div", null, [
537
+ b(e(ee), {
538
+ render: ($ = (_ = (u = r.cellByColId.Delete) == null ? void 0 : u.column) == null ? void 0 : _.columnDef) == null ? void 0 : $.cell,
539
+ props: (o = (y = r.cellByColId.Delete) == null ? void 0 : y.getContext) == null ? void 0 : o.call(y)
540
+ }, null, 8, ["render", "props"])
541
+ ])
542
+ ]),
543
+ t("div", eo, [
544
+ t("div", to, [
545
+ b(s, {
546
+ label: e(x)(`inventory.transfer.form.items.table.${e(Y).Code}`)
547
+ }, null, 8, ["label"]),
548
+ b(e(ee), {
549
+ render: (k = (m = (d = r.cellByColId[e(Y).Code]) == null ? void 0 : d.column) == null ? void 0 : m.columnDef) == null ? void 0 : k.cell,
550
+ props: (A = (T = r.cellByColId[e(Y).Code]) == null ? void 0 : T.getContext) == null ? void 0 : A.call(T)
551
+ }, null, 8, ["render", "props"]),
552
+ i[0] || (i[0] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
553
+ ]),
554
+ t("div", oo, [
555
+ b(s, {
556
+ label: e(x)(`inventory.transfer.form.items.table.${e(Y).Name}`)
557
+ }, null, 8, ["label"]),
558
+ b(e(ee), {
559
+ render: (c = (p = (q = r.cellByColId[e(Y).Name]) == null ? void 0 : q.column) == null ? void 0 : p.columnDef) == null ? void 0 : c.cell,
560
+ props: (a = (w = r.cellByColId[e(Y).Name]) == null ? void 0 : w.getContext) == null ? void 0 : a.call(w)
561
+ }, null, 8, ["render", "props"]),
562
+ i[1] || (i[1] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
563
+ ])
564
+ ]),
565
+ r.row.original ? (O(), L("div", so, [
566
+ t("div", no, [
567
+ b(s, {
568
+ label: e(x)(`inventory.transfer.form.items.table.${e(Y).DefaultAmount}`)
569
+ }, null, 8, ["label"]),
570
+ b(e(ee), {
571
+ render: (I = (S = (v = r.cellByColId[e(Y).DefaultAmount]) == null ? void 0 : v.column) == null ? void 0 : S.columnDef) == null ? void 0 : I.cell,
572
+ props: (W = (g = r.cellByColId[e(Y).DefaultAmount]) == null ? void 0 : g.getContext) == null ? void 0 : W.call(g)
573
+ }, null, 8, ["render", "props"]),
574
+ i[2] || (i[2] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
575
+ ]),
576
+ t("div", lo, [
577
+ b(s, {
578
+ label: e(x)(`inventory.transfer.form.items.table.${e(Y).Step}`)
579
+ }, null, 8, ["label"]),
580
+ b(e(ee), {
581
+ render: (U = (E = (te = r.cellByColId[e(Y).Step]) == null ? void 0 : te.column) == null ? void 0 : E.columnDef) == null ? void 0 : U.cell,
582
+ props: (n = (Z = r.cellByColId[e(Y).Step]) == null ? void 0 : Z.getContext) == null ? void 0 : n.call(Z)
583
+ }, null, 8, ["render", "props"]),
584
+ i[3] || (i[3] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
585
+ ])
586
+ ])) : oe("", !0),
587
+ t("div", ro, [
588
+ t("div", ao, [
589
+ b(s, {
590
+ label: e(x)(`inventory.transfer.form.items.table.${e(Y).Limit}`)
591
+ }, null, 8, ["label"]),
592
+ b(e(ee), {
593
+ render: (P = (F = (l = r.cellByColId[e(Y).Limit]) == null ? void 0 : l.column) == null ? void 0 : F.columnDef) == null ? void 0 : P.cell,
594
+ props: (G = (z = r.cellByColId[e(Y).Limit]) == null ? void 0 : z.getContext) == null ? void 0 : G.call(z)
595
+ }, null, 8, ["render", "props"]),
596
+ i[4] || (i[4] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
597
+ ])
598
+ ])
599
+ ]);
600
+ };
601
+ }
602
+ }), uo = { class: "fm-typo-en-body-md-400 line-clamp-2 w-full" }, mo = { key: 0 }, po = ["colspan"], co = /* @__PURE__ */ ae({
603
+ __name: "TransferTemplateItemTable",
604
+ props: {
605
+ row: {},
606
+ disabled: { type: Boolean },
607
+ errorMessage: {}
608
+ },
609
+ emits: ["update:item"],
610
+ setup(f) {
611
+ function x(h) {
612
+ return h.column.columnDef.meta;
613
+ }
614
+ return (h, r) => (O(), L(pe, null, [
615
+ t("tr", {
616
+ class: "hover:bg-fm-color-opacity-sm border-b border-fm-color-neutral-gray-100",
617
+ style: _e({ backgroundColor: h.errorMessage ? "#ffd6d6" : void 0 })
618
+ }, [
619
+ (O(!0), L(pe, null, Qe(h.row.getVisibleCells(), (i) => {
620
+ var s, u, _, $, y;
621
+ return O(), L("td", {
622
+ key: i.id,
623
+ class: le(["text-fm-color-typo-primary", ((s = x(i)) == null ? void 0 : s.cellClass) ?? "px-16", "py-2"]),
624
+ style: _e({
625
+ width: (u = x(i)) != null && u.width ? (_ = x(i)) == null ? void 0 : _.width : i.column.getSize() !== 0 ? `${i.column.getSize()}px` : void 0,
626
+ maxWidth: ($ = x(i)) == null ? void 0 : $.maxWidth,
627
+ textAlign: ((y = x(i)) == null ? void 0 : y.textAlign) ?? "left"
628
+ })
629
+ }, [
630
+ t("span", uo, [
631
+ b(e(ee), {
632
+ props: i.getContext(),
633
+ render: i.column.columnDef.cell
634
+ }, null, 8, ["props", "render"])
635
+ ])
636
+ ], 6);
637
+ }), 128))
638
+ ], 4),
639
+ h.errorMessage ? (O(), L("tr", mo, [
640
+ t("td", {
641
+ colspan: h.row.getVisibleCells().length,
642
+ class: "text-red-600 px-16 py-2"
643
+ }, M(h.errorMessage), 9, po)
644
+ ])) : oe("", !0)
645
+ ], 64));
646
+ }
647
+ }), fo = { class: "flex flex-col gap-16" }, yo = { class: "flex flex-col gap-24" }, vo = { class: "flex flex-col gap-16" }, bo = { class: "flex items-center" }, ho = { class: "flex flex-col" }, go = { class: "flex flex-col gap-16" }, xo = { class: "flex gap-3" }, _o = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, ko = {
648
+ key: 0,
649
+ class: "border rounded-sm px-8 py-2 bg-fm-color-system-warning-100 fm-typo-en-body-lg-400"
650
+ }, wo = { class: "border rounded-sm px-8 py-2 bg-fm-color-system-info-100 fm-typo-en-body-lg-400" }, To = { class: "mb-2" }, Fo = /* @__PURE__ */ ae({
651
+ __name: "TransferTemplateForm",
652
+ props: {
653
+ modelValue: {},
654
+ disabled: { type: Boolean }
655
+ },
656
+ emits: ["update:disabled"],
657
+ setup(f, { expose: x, emit: h }) {
658
+ const r = f, i = h, s = Ze(), { t: u } = me(), _ = H({}), $ = Ge(), y = We(), o = St(), d = he(), m = Je(), k = et();
659
+ Fe(
660
+ () => s.purchaseOrder.items.length,
661
+ () => {
662
+ _.value = {};
663
+ }
664
+ ), $.watchLocation(async () => {
665
+ location && (s.purchaseOrder.supplier || (s.purchaseOrder.supplier = o.suppliers.find((n) => n) ?? s.purchaseOrder.supplier));
666
+ });
667
+ const T = Dt(
668
+ () => s.purchaseOrder,
669
+ (n) => {
670
+ s.purchaseOrder = {
671
+ ...s.purchaseOrder,
672
+ supplier: n.supplier ?? (s == null ? void 0 : s.purchaseOrder.supplier)
673
+ };
674
+ }
675
+ ), A = B({
676
+ get() {
677
+ var n, l;
678
+ return typeof ((l = (n = s.purchaseOrder) == null ? void 0 : n.supplier) == null ? void 0 : l.internal) == "string" ? X.enum.transfer : X.enum.purchase;
679
+ },
680
+ set(n) {
681
+ var F, P;
682
+ const l = typeof ((P = (F = s.purchaseOrder) == null ? void 0 : F.supplier) == null ? void 0 : P.internal) == "string" ? X.enum.transfer : X.enum.purchase;
683
+ n !== l && (s.purchaseOrder.supplier = n === X.enum.purchase ? T.locationOptionsTypePurchase.value[0] : T.locationOptionsTypeTransfer.value[0]);
684
+ }
685
+ }), q = B(() => T.transferLocationOptions.value), p = B({
686
+ get() {
687
+ var n;
688
+ return (n = s.purchaseOrder.supplier) == null ? void 0 : n._id;
689
+ },
690
+ set(n) {
691
+ T.transferLocationModel.value = n;
692
+ }
693
+ });
694
+ async function c() {
695
+ const n = await m.checkCustomFieldCodes({
696
+ beforeStart: async () => {
697
+ i("update:disabled", !0);
698
+ },
699
+ templateItems: s.purchaseOrder.items
700
+ });
701
+ _.value = n, i("update:disabled", !1);
702
+ }
703
+ const {
704
+ promptSelectLocations: w,
705
+ columnDefs: a,
706
+ rowData: v
707
+ } = $t({
708
+ getLocations() {
709
+ return s.locations;
710
+ },
711
+ setLocations(n) {
712
+ s.locations = n;
713
+ }
714
+ });
715
+ function S() {
716
+ var n, l;
717
+ return (n = s.locations) != null && n.find((F) => {
718
+ var P, z;
719
+ return ((P = F.doc) == null ? void 0 : P._id) === ((z = s.purchaseOrder.supplier) == null ? void 0 : z._id);
720
+ }) ? `Location ${(l = s.purchaseOrder.supplier) == null ? void 0 : l.name} must be removed because template cannot be used to transfer to itself.` : !0;
721
+ }
722
+ const I = B({
723
+ get() {
724
+ return s.purchaseOrder.remark ?? void 0;
725
+ },
726
+ set(n) {
727
+ s.purchaseOrder.remark = n;
728
+ }
729
+ }), g = H();
730
+ x({
731
+ validateInputs: () => {
732
+ var n, l;
733
+ (l = (n = g.value) == null ? void 0 : n.validateInputs) == null || l.call(n);
734
+ },
735
+ resetInputsValidation: () => {
736
+ var n, l;
737
+ (l = (n = g.value) == null ? void 0 : n.resetInputsValidation) == null || l.call(n);
738
+ },
739
+ resetInputs: () => {
740
+ var n, l;
741
+ (l = (n = g.value) == null ? void 0 : n.resetInputs) == null || l.call(n);
742
+ }
743
+ });
744
+ const W = B(() => ({
745
+ duplicateItem: (n) => {
746
+ s.purchaseOrder.items = [
747
+ ...s.purchaseOrder.items,
748
+ {
749
+ ...n
750
+ }
751
+ ];
752
+ },
753
+ updateItem: (n) => {
754
+ let l = [];
755
+ n.id ? l = s.purchaseOrder.items.map((F) => F.id !== n.id ? F : n) : l = s.purchaseOrder.items.map((F) => F.sku._id !== n.sku._id ? F : n), s.purchaseOrder.items = l;
756
+ },
757
+ deleteItem: (n) => {
758
+ console.log(n.id);
759
+ let l = [];
760
+ n.id ? l = s.purchaseOrder.items.filter((F) => F.id !== n.id) : l = s.purchaseOrder.items.filter((F) => F.sku._id !== n.sku._id), s.purchaseOrder.items = l;
761
+ }
762
+ })), te = Wt(
763
+ {
764
+ duplicateItem: W.value.duplicateItem,
765
+ updateItem: W.value.updateItem,
766
+ deleteItem: W.value.deleteItem,
767
+ get supplier() {
768
+ return s.purchaseOrder.supplier;
769
+ },
770
+ get items() {
771
+ return s.purchaseOrder.items;
772
+ },
773
+ get transferType() {
774
+ return X.enum.purchase;
775
+ },
776
+ get disabled() {
777
+ return r.disabled;
778
+ }
779
+ },
780
+ m.transferTemplateColumnDefs({
781
+ onUpdate: (n, l, F, P) => {
782
+ if (n < 0 || n >= s.purchaseOrder.items.length) return;
783
+ const z = s.purchaseOrder.items[n];
784
+ z && W.value.updateItem({
785
+ ...z,
786
+ sku: l,
787
+ // Sku might be outdated, so we need to update it
788
+ code: F,
789
+ measurement: P
790
+ });
791
+ }
792
+ })
793
+ ), E = B(() => te.columnDefs.value), { promptSelectIngredients: U } = Ot();
794
+ async function Z() {
795
+ const l = y.skus.map((D) => ({
796
+ label: D.name,
797
+ sublabel: D.code,
798
+ value: D
799
+ })).filter((D) => {
800
+ var V;
801
+ return (V = s.purchaseOrder.items) == null ? void 0 : V.find((K) => K.sku._id === D.value._id);
802
+ }).map((D) => D.value), F = s.purchaseOrder.items ?? [], P = await U(
803
+ l.map((D) => D._id),
804
+ (D) => {
805
+ const V = y.skuById[D], K = F.find((j) => j.sku._id === V._id);
806
+ if (K)
807
+ return K;
808
+ const J = { amount: 1, precision: be(V.unit) };
809
+ let C = {
810
+ id: d.usePurchaseOrderV2 ? crypto.randomUUID() : void 0,
811
+ sku: V,
812
+ code: V.code,
813
+ name: V.name,
814
+ quantity: J,
815
+ minimumQuantity: J,
816
+ // maximumQuantity: adjustmentAmountMultiplyDecimal(minimumQuantity, {
817
+ // amount: 100,
818
+ // precision: 0
819
+ // }),
820
+ quantityStep: J
821
+ };
822
+ return k.validateUnitInput(
823
+ C,
824
+ V,
825
+ {
826
+ amount: J,
827
+ measurement: null
828
+ },
829
+ (j) => {
830
+ C.code = j.code;
831
+ }
832
+ ), C;
833
+ }
834
+ );
835
+ if (!P) return;
836
+ const z = P.map((D) => D.sku._id), G = [];
837
+ for (const D of z) {
838
+ const V = F.filter((K) => K.sku._id === D);
839
+ if (V.length > 0)
840
+ G.push(...V);
841
+ else {
842
+ const K = P.find((J) => J.sku._id === D);
843
+ K && G.push(K);
844
+ }
845
+ }
846
+ G.sort((D, V) => D.sku.code.localeCompare(V.sku.code)), s.purchaseOrder.items = G;
847
+ }
848
+ return (n, l) => {
849
+ const F = R("FmTextField"), P = R("FmSelect"), z = R("FmTextarea"), G = R("FmButton"), D = R("FmTable"), V = R("FmFormGroup"), K = R("FmForm");
850
+ return O(), ne(K, {
851
+ ref_key: "formRef",
852
+ ref: g,
853
+ class: "flex flex-col gap-32",
854
+ disabled: n.disabled
855
+ }, {
856
+ default: N(() => {
857
+ var J;
858
+ return [
859
+ t("div", fo, [
860
+ t("div", yo, [
861
+ b(F, {
862
+ label: e(u)("inventory.transfer.form.name"),
863
+ "label-mark": "required",
864
+ modelValue: e(s).name,
865
+ "onUpdate:modelValue": l[0] || (l[0] = (C) => e(s).name = C),
866
+ rules: [e(ke)()]
867
+ }, null, 8, ["label", "modelValue", "rules"]),
868
+ b(P, {
869
+ label: e(u)("inventory.transfer.form.type.title"),
870
+ "model-value": A.value,
871
+ "onUpdate:modelValue": l[1] || (l[1] = (C) => A.value = C),
872
+ items: [
873
+ {
874
+ label: e(u)("inventory.transfer.form.type.purchase"),
875
+ value: e(X).enum.purchase,
876
+ disabled: !e(T).locationOptionsTypePurchase.value.length,
877
+ sublabel: e(T).locationOptionsTypePurchase.value.length ? void 0 : e(u)("inventory.transfer.form.noSupplierAvailable")
878
+ },
879
+ {
880
+ label: e(u)("inventory.transfer.form.type.transfer"),
881
+ value: e(X).enum.transfer,
882
+ disabled: !e(T).locationOptionsTypeTransfer.value.length,
883
+ sublabel: e(T).locationOptionsTypeTransfer.value.length ? void 0 : e(u)("inventory.transfer.form.noLocationAvailable")
884
+ }
885
+ ],
886
+ rules: [e(we)(1)(q.value)]
887
+ }, {
888
+ default: N(() => [
889
+ t("span", {
890
+ class: le([
891
+ "line-clamp-1 fm-typo-en-body-lg-400",
892
+ n.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
893
+ ])
894
+ }, M(e(ft)(A.value)), 3)
895
+ ]),
896
+ _: 1
897
+ }, 8, ["label", "model-value", "items", "rules"]),
898
+ b(P, {
899
+ label: A.value === e(X).enum.purchase ? e(u)("inventory.transfer.form.purchaseFrom") : e(u)("inventory.transfer.form.transferFrom"),
900
+ modelValue: p.value,
901
+ "onUpdate:modelValue": l[2] || (l[2] = (C) => p.value = C),
902
+ items: q.value
903
+ }, {
904
+ "menu-wrapper": N((C) => {
905
+ var j;
906
+ return [
907
+ b(Vt, Ye(C, {
908
+ items: q.value,
909
+ "model-value": (j = n.modelValue.purchaseOrder.supplier) == null ? void 0 : j._id
910
+ }), null, 16, ["items", "model-value"])
911
+ ];
912
+ }),
913
+ default: N(() => {
914
+ var C;
915
+ return [
916
+ t("span", {
917
+ class: le([
918
+ "line-clamp-1 fm-typo-en-body-lg-400",
919
+ n.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
920
+ ])
921
+ }, M((C = q.value.find((j) => j.value === p.value)) == null ? void 0 : C.label), 3)
922
+ ];
923
+ }),
924
+ _: 1
925
+ }, 8, ["label", "modelValue", "items"]),
926
+ b(F, {
927
+ label: e(u)("inventory.transfer.form.reference"),
928
+ "label-mark": "optional",
929
+ modelValue: e(s).purchaseOrder.ref,
930
+ "onUpdate:modelValue": l[3] || (l[3] = (C) => e(s).purchaseOrder.ref = C)
931
+ }, null, 8, ["label", "modelValue"]),
932
+ b(z, {
933
+ label: e(u)("inventory.transfer.form.remark"),
934
+ "label-mark": "optional",
935
+ "max-length": 240,
936
+ modelValue: I.value,
937
+ "onUpdate:modelValue": l[4] || (l[4] = (C) => I.value = C),
938
+ class: le({ "text-fm-color-typo-disabled": n.disabled })
939
+ }, null, 8, ["label", "modelValue", "class"])
940
+ ])
941
+ ]),
942
+ t("div", vo, [
943
+ t("div", bo, [
944
+ l[8] || (l[8] = t("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
945
+ b(G, {
946
+ disabled: n.disabled,
947
+ label: "Select location",
948
+ "prepend-icon": "add",
949
+ variant: "plain",
950
+ class: "border-2 rounded-lg border-fm-color-primary",
951
+ onClick: e(w)
952
+ }, null, 8, ["disabled", "onClick"])
953
+ ]),
954
+ b(D, {
955
+ "column-defs": e(a),
956
+ "row-data": e(v),
957
+ "shrink-at": 9999,
958
+ onRowClick: e(w),
959
+ "hide-footer": ""
960
+ }, null, 8, ["column-defs", "row-data", "onRowClick"]),
961
+ t("div", ho, [
962
+ b(V, {
963
+ "model-value": [
964
+ (J = r.modelValue.purchaseOrder.supplier) == null ? void 0 : J._id,
965
+ ...r.modelValue.locations ?? []
966
+ ].join(","),
967
+ rules: [S]
968
+ }, null, 8, ["model-value", "rules"])
969
+ ])
970
+ ]),
971
+ t("div", go, [
972
+ t("div", xo, [
973
+ t("div", _o, M(e(u)("inventory.transfer.form.items.title")), 1),
974
+ e(m).isEnabled ? (O(), ne(G, {
975
+ key: 0,
976
+ label: "Check NetSuite",
977
+ "prepend-icon": "troubleshoot",
978
+ variant: "secondary",
979
+ onClick: c,
980
+ size: "md"
981
+ })) : oe("", !0),
982
+ b(G, {
983
+ disabled: n.disabled,
984
+ label: e(u)("inventory.transfer.form.items.addItem"),
985
+ "prepend-icon": "add",
986
+ variant: "plain",
987
+ class: "border-2 rounded-lg border-fm-color-primary",
988
+ onClick: l[5] || (l[5] = (C) => Z()),
989
+ size: "md"
990
+ }, null, 8, ["disabled", "label"])
991
+ ]),
992
+ e(m).isEnabled ? (O(), L("div", ko, l[9] || (l[9] = [
993
+ re(" NetSuite is enabled. "),
994
+ t("ul", { style: { "list-style": "initial", "margin-left": "20px" } }, [
995
+ t("li", null, ' When adding new item or changing UOM, the first match available custom code (if any) will be applied to "Code" for each item by default. '),
996
+ t("li", null, ' You can also choose to change the code by selecting from the "NetSuite" button in each row. ')
997
+ ], -1),
998
+ t("p", { class: "fm-typo-en-body-lg-600 mt-2" }, " If you use custom code for certain items, please make sure that the custom code is correct before saving the template. ", -1)
999
+ ]))) : oe("", !0),
1000
+ t("div", wo, [
1001
+ t("p", To, [
1002
+ re(' Set "' + M(e(u)("inventory.transfer.form.items.table.DefaultAmount")) + '" to "0" to mark the item as ', 1),
1003
+ l[10] || (l[10] = t("b", null, "optional", -1)),
1004
+ l[11] || (l[11] = re(" when creating an order request. "))
1005
+ ]),
1006
+ l[12] || (l[12] = t("p", null, ' You can leave "Max" empty to remove the limit on the maximum quantity of the item when creating an order request. ', -1))
1007
+ ]),
1008
+ (O(), ne(D, {
1009
+ "column-defs": E.value,
1010
+ "row-data": e(s).purchaseOrder.items,
1011
+ key: e(s).purchaseOrder.items.map((C) => C.sku._id).join("."),
1012
+ "hide-footer": "",
1013
+ "page-size": e(s).purchaseOrder.items.length
1014
+ }, {
1015
+ "table-row": N((C) => [
1016
+ b(co, {
1017
+ row: C,
1018
+ errorMessage: _.value[C.index],
1019
+ "onUpdate:item": l[6] || (l[6] = (j) => W.value.updateItem(j)),
1020
+ disabled: n.disabled
1021
+ }, null, 8, ["row", "errorMessage", "disabled"])
1022
+ ]),
1023
+ "list-row": N((C) => [
1024
+ (O(), ne(Xe, {
1025
+ row: C,
1026
+ key: e(s).purchaseOrder.items.map((j) => j.sku._id).join(".")
1027
+ }, {
1028
+ default: N((j) => [
1029
+ b(io, {
1030
+ row: C,
1031
+ "cell-by-col-id": j,
1032
+ "onUpdate:item": l[7] || (l[7] = (ie) => W.value.updateItem(ie)),
1033
+ disabled: n.disabled
1034
+ }, null, 8, ["row", "cell-by-col-id", "disabled"])
1035
+ ]),
1036
+ _: 2
1037
+ }, 1032, ["row"]))
1038
+ ]),
1039
+ _: 1
1040
+ }, 8, ["column-defs", "row-data", "page-size"])),
1041
+ b(V, {
1042
+ "model-value": e(s).purchaseOrder.items.length,
1043
+ rules: [e(we)(1)]
1044
+ }, null, 8, ["model-value", "rules"])
1045
+ ])
1046
+ ];
1047
+ }),
1048
+ _: 1
1049
+ }, 8, ["disabled"]);
1050
+ };
1051
+ }
1052
+ }), Co = { class: "flex items-center" }, Io = { class: "fm-typo-en-title-md-800" }, Mo = { class: "flex gap-4" }, So = /* @__PURE__ */ ae({
1053
+ __name: "TransferTemplateDialog",
1054
+ props: /* @__PURE__ */ Le({
1055
+ mode: {},
1056
+ modelValue: {},
1057
+ show: { type: Boolean }
1058
+ }, {
1059
+ disabled: { type: Boolean },
1060
+ disabledModifiers: {}
1061
+ }),
1062
+ emits: /* @__PURE__ */ Le(["update:show", "submitted"], ["update:disabled"]),
1063
+ setup(f, { expose: x, emit: h }) {
1064
+ var w;
1065
+ const r = f, i = h, s = At(), u = vt(), { t: _ } = me(), $ = Ke(r, "show");
1066
+ function y() {
1067
+ return {
1068
+ _id: "",
1069
+ name: "",
1070
+ purchaseOrder: {
1071
+ remark: void 0,
1072
+ ref: void 0,
1073
+ items: [],
1074
+ supplier: {
1075
+ _rev: void 0,
1076
+ email: void 0,
1077
+ internal: void 0,
1078
+ contactName: void 0,
1079
+ phoneNumber: void 0,
1080
+ registrationNumber: void 0,
1081
+ supplyItems: void 0,
1082
+ _id: "",
1083
+ name: "",
1084
+ address: {
1085
+ line2: void 0,
1086
+ line1: "",
1087
+ state: "",
1088
+ city: "",
1089
+ postcode: "",
1090
+ country: ""
1091
+ }
1092
+ }
1093
+ }
1094
+ };
1095
+ }
1096
+ const o = H(r.modelValue ?? y()), d = H(((w = r.modelValue) == null ? void 0 : w._id) ?? `${Math.random()}`);
1097
+ Fe(
1098
+ () => r.show,
1099
+ (a) => {
1100
+ var v;
1101
+ a && (o.value = r.modelValue ?? y(), d.value = ((v = r.modelValue) == null ? void 0 : v._id) ?? `${Math.random()}`);
1102
+ }
1103
+ );
1104
+ const m = nt(f, "disabled"), k = B(() => {
1105
+ switch (r.mode) {
1106
+ case de.READ:
1107
+ return "";
1108
+ case de.CREATE:
1109
+ return _("inventory.transfer.template.create.title");
1110
+ case de.UPDATE:
1111
+ return _("inventory.transfer.template.update.title");
1112
+ }
1113
+ return "";
1114
+ }), T = H();
1115
+ x({
1116
+ validateInputs: () => {
1117
+ var a, v;
1118
+ (v = (a = T.value) == null ? void 0 : a.validateInputs) == null || v.call(a);
1119
+ },
1120
+ resetInputsValidation: () => {
1121
+ var a, v;
1122
+ (v = (a = T.value) == null ? void 0 : a.resetInputsValidation) == null || v.call(a);
1123
+ },
1124
+ resetInputs: () => {
1125
+ var a, v;
1126
+ (v = (a = T.value) == null ? void 0 : a.resetInputs) == null || v.call(a);
1127
+ }
1128
+ });
1129
+ async function A() {
1130
+ var v, S;
1131
+ const a = o.value;
1132
+ if (a) {
1133
+ m.value = !0, (((v = a.purchaseOrder.supplier) == null ? void 0 : v.internal) === ye.enum.warehouse || ((S = a.purchaseOrder.supplier) == null ? void 0 : S.internal) === ye.enum.restaurant) && (a.purchaseOrder.items = a.purchaseOrder.items.map(
1134
+ ({ totalCost: I, ...g }) => g
1135
+ ));
1136
+ try {
1137
+ await s.createTemplate(a), await new Promise((I) => setTimeout(I, 1e3)), u.open({
1138
+ title: _("inventory.transfer.template.create.success"),
1139
+ message: _("inventory.transfer.template.create.successMessage"),
1140
+ type: "success"
1141
+ }), i("update:show", !1), i("submitted");
1142
+ } catch (I) {
1143
+ u.open({
1144
+ title: _("inventory.transfer.template.create.error"),
1145
+ message: _("inventory.transfer.template.create.errorMessage"),
1146
+ type: "error"
1147
+ }), console.error("Error in creating transfer template", I);
1148
+ } finally {
1149
+ m.value = !1;
1150
+ }
1151
+ }
1152
+ }
1153
+ async function q() {
1154
+ var v, S;
1155
+ const a = o.value;
1156
+ if (a) {
1157
+ m.value = !0, (((v = a.purchaseOrder.supplier) == null ? void 0 : v.internal) === ye.enum.warehouse || ((S = a.purchaseOrder.supplier) == null ? void 0 : S.internal) === ye.enum.restaurant) && (a.purchaseOrder.items = a.purchaseOrder.items.map(
1158
+ ({ totalCost: I, ...g }) => g
1159
+ ));
1160
+ try {
1161
+ await s.updateTemplate(a), await new Promise((I) => setTimeout(I, 1e3)), u.open({
1162
+ title: _("inventory.transfer.template.update.success"),
1163
+ message: _("inventory.transfer.template.update.successMessage"),
1164
+ type: "success"
1165
+ }), i("update:show", !1), i("submitted");
1166
+ } catch (I) {
1167
+ u.open({
1168
+ title: _("inventory.transfer.template.update.error"),
1169
+ message: _("inventory.transfer.template.update.errorMessage"),
1170
+ type: "error"
1171
+ }), console.error("Error in updating transfer template", I);
1172
+ } finally {
1173
+ m.value = !1;
1174
+ }
1175
+ }
1176
+ }
1177
+ function p() {
1178
+ switch (r.mode) {
1179
+ case de.CREATE:
1180
+ return A();
1181
+ case de.UPDATE:
1182
+ return q();
1183
+ }
1184
+ }
1185
+ function c() {
1186
+ var a, v;
1187
+ (v = (a = T.value) == null ? void 0 : a.validateInputs) == null || v.call(a);
1188
+ }
1189
+ return (a, v) => {
1190
+ const S = R("FmButton"), I = R("FmSideSheet");
1191
+ return O(), ne(I, {
1192
+ modelValue: e($),
1193
+ "onUpdate:modelValue": v[3] || (v[3] = (g) => He($) ? $.value = g : null),
1194
+ "dismiss-away": "",
1195
+ "close-button": "",
1196
+ "max-width": 1600
1197
+ }, {
1198
+ "side-sheet-header": N(() => [
1199
+ t("div", Co, [
1200
+ t("div", Io, M(k.value), 1)
1201
+ ])
1202
+ ]),
1203
+ default: N(() => [
1204
+ (O(), ne(Fo, {
1205
+ class: "w-full",
1206
+ ref_key: "formRef",
1207
+ ref: T,
1208
+ onValidationSuccess: p,
1209
+ "model-value": o.value,
1210
+ "onUpdate:modelValue": v[0] || (v[0] = (g) => o.value = g),
1211
+ disabled: m.value,
1212
+ "onUpdate:disabled": v[1] || (v[1] = (g) => m.value = g),
1213
+ key: d.value
1214
+ }, null, 8, ["model-value", "disabled"]))
1215
+ ]),
1216
+ "side-sheet-footer": N(() => [
1217
+ t("div", Mo, [
1218
+ b(Rt, {
1219
+ loading: m.value,
1220
+ label: e(_)("common.save"),
1221
+ "confirm-title": `Save ${r.mode === e(de).CREATE ? "Template" : "Changes"}`,
1222
+ onConfirm: c
1223
+ }, {
1224
+ "dialog-content": N(() => v[4] || (v[4] = [
1225
+ t("div", { class: "fm-typo-en-body-md-400 bg-fm-color-primary-oats p-8 rounded" }, [
1226
+ re(" Warning: This action "),
1227
+ t("span", { class: "text-fm-color-system-error-300" }, "will not"),
1228
+ re(" create or update any order request, but only a template. ")
1229
+ ], -1)
1230
+ ])),
1231
+ _: 1
1232
+ }, 8, ["loading", "label", "confirm-title"]),
1233
+ b(S, {
1234
+ disabled: m.value,
1235
+ variant: "tertiary",
1236
+ label: e(_)("common.close"),
1237
+ onClick: v[2] || (v[2] = (g) => i("update:show", !1))
1238
+ }, null, 8, ["disabled", "label"])
1239
+ ])
1240
+ ]),
1241
+ _: 1
1242
+ }, 8, ["modelValue"]);
1243
+ };
1244
+ }
1245
+ }), Oo = { class: "flex flex-col gap-16 w-full h-full overflow-y-auto" }, $o = { class: "flex justify-between" }, Do = { class: "fm-typo-en-body-lg-600" }, Vo = { class: "fm-status-badge fm-status-badge-info-secondary" }, Ao = { class: "flex flex-col gap-8" }, Ro = { class: "flex flex-col gap-4" }, qo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Uo = { class: "flex gap-1" }, Po = { class: "fm-typo-en-body-lg-600" }, Bo = {
1246
+ key: 0,
1247
+ class: "flex flex-col gap-4"
1248
+ }, Lo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, No = { class: "flex gap-1" }, Eo = { class: "fm-typo-en-body-lg-600" }, zo = {
1249
+ key: 1,
1250
+ class: "flex flex-col gap-4"
1251
+ }, jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qo = { class: "fm-typo-en-body-lg-600" }, Yo = {
1252
+ key: 2,
1253
+ class: "flex flex-col gap-4"
1254
+ }, Ho = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Wo = { class: "fm-typo-en-body-lg-600" }, Go = {
1255
+ key: 3,
1256
+ class: "flex flex-col gap-4"
1257
+ }, Ko = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Zo = { class: "fm-typo-en-body-lg-600" }, Jo = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Xo = { class: "flex flex-col gap-8" }, es = { class: "fm-typo-en-body-lg-600" }, ts = { class: "flex w-full gap-4" }, os = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, ss = { class: "fm-typo-en-body-lg-600 shrink-0" }, ns = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, ls = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, rs = {
1258
+ key: 0,
1259
+ class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1260
+ }, as = {
1261
+ key: 0,
1262
+ class: "flex gap-4 items-center"
1263
+ }, is = { class: "flex flex-col gap-12" }, us = { class: "flex flex-col gap-8" }, ds = { class: "flex gap-8 xs:flex-col" }, ms = /* @__PURE__ */ ae({
1264
+ __name: "TransferTemplateDetails",
1265
+ props: {
1266
+ template: {},
1267
+ show: { type: Boolean }
1268
+ },
1269
+ emits: ["update:show", "action:edit"],
1270
+ setup(f, { emit: x }) {
1271
+ const h = f, r = x, i = he(), { t: s } = me(), u = B(() => {
1272
+ var m;
1273
+ return (m = h.template) == null ? void 0 : m.purchaseOrder;
1274
+ }), _ = [
1275
+ { accessorKey: "name", header: () => "Name" },
1276
+ { accessorKey: "type", header: () => "Type" }
1277
+ ], $ = H(""), y = B(
1278
+ () => {
1279
+ var m, k, T, A;
1280
+ return ((k = (m = u.value) == null ? void 0 : m.supplier) == null ? void 0 : k.internal) === "restaurant" || ((A = (T = u.value) == null ? void 0 : T.supplier) == null ? void 0 : A.internal) === "warehouse" ? X.enum.transfer : X.enum.purchase;
1281
+ }
1282
+ ), o = H(!0), d = Ke(h, "show");
1283
+ return (m, k) => {
1284
+ var v;
1285
+ const T = R("FmMenuDivider"), A = R("FmCard"), q = R("FmIcon"), p = R("FmTextField"), c = R("FmTable"), w = R("FmButton"), a = R("FmSideSheet");
1286
+ return O(), ne(a, {
1287
+ header: e(s)("inventory.transfer.template.details.view", { template: (v = m.template) == null ? void 0 : v.name }),
1288
+ modelValue: e(d),
1289
+ "onUpdate:modelValue": k[2] || (k[2] = (S) => He(d) ? d.value = S : null),
1290
+ "dismiss-away": o.value,
1291
+ "close-button": "",
1292
+ "max-width": 1200
1293
+ }, {
1294
+ default: N(() => {
1295
+ var S, I;
1296
+ return [
1297
+ t("div", Oo, [
1298
+ t("div", null, [
1299
+ b(A, {
1300
+ variant: "outlined",
1301
+ class: "flex flex-col gap-8 px-12 py-16"
1302
+ }, {
1303
+ default: N(() => {
1304
+ var g, W, te, E, U, Z, n, l, F;
1305
+ return [
1306
+ t("div", $o, [
1307
+ t("div", Do, M(e(s)("inventory.transfer.template.details.templateSummary")), 1),
1308
+ t("div", Vo, M(e(s)(
1309
+ `inventory.transfer.receiveRequest.details.type.${y.value.toLocaleLowerCase("en-US")}`
1310
+ )), 1)
1311
+ ]),
1312
+ b(T),
1313
+ t("div", Ao, [
1314
+ t("div", Ro, [
1315
+ t("div", qo, [
1316
+ t("div", Uo, M(e(s)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1317
+ ]),
1318
+ t("div", Po, M(e(qt)(((g = m.template) == null ? void 0 : g._id) ?? "")), 1)
1319
+ ]),
1320
+ (W = m.template) != null && W.updatedAt ? (O(), L("div", Bo, [
1321
+ t("div", Lo, [
1322
+ t("div", No, M(e(s)("inventory.transfer.receiveRequest.details.updatedAt")), 1)
1323
+ ]),
1324
+ t("div", Eo, [
1325
+ re(M(e(Ut)(new Date(m.template.updatedAt))) + " ", 1),
1326
+ (te = m.template.updatedBy) != null && te.name ? (O(), L(pe, { key: 0 }, [
1327
+ re(" (" + M(m.template.updatedBy.name) + ") ", 1)
1328
+ ], 64)) : oe("", !0)
1329
+ ])
1330
+ ])) : oe("", !0),
1331
+ (U = (E = u.value) == null ? void 0 : E.supplier) != null && U.name ? (O(), L("div", zo, [
1332
+ t("div", jo, M(e(s)("inventory.transfer.receiveRequest.details.from")), 1),
1333
+ t("div", Qo, M((n = (Z = u.value) == null ? void 0 : Z.supplier) == null ? void 0 : n.name), 1)
1334
+ ])) : oe("", !0),
1335
+ (l = u.value) != null && l.ref ? (O(), L("div", Yo, [
1336
+ t("div", Ho, M(e(s)("inventory.transfer.receiveRequest.details.reference")), 1),
1337
+ t("div", Wo, M(u.value.ref), 1)
1338
+ ])) : oe("", !0),
1339
+ (F = u.value) != null && F.remark ? (O(), L("div", Go, [
1340
+ t("div", Ko, M(e(s)("inventory.transfer.receiveRequest.details.remark")), 1),
1341
+ t("div", Zo, M(u.value.remark), 1)
1342
+ ])) : oe("", !0)
1343
+ ])
1344
+ ];
1345
+ }),
1346
+ _: 1
1347
+ })
1348
+ ]),
1349
+ t("div", Jo, [
1350
+ t("div", Xo, [
1351
+ t("div", es, M(e(s)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1352
+ (O(!0), L(pe, null, Qe(((S = u.value) == null ? void 0 : S.items) ?? [], (g) => (O(), L("div", {
1353
+ key: g.code,
1354
+ class: "flex flex-col"
1355
+ }, [
1356
+ t("div", ts, [
1357
+ t("div", os, M(g.name), 1),
1358
+ k[3] || (k[3] = t("div", { class: "flex-1 min-w-32" }, null, -1)),
1359
+ t("div", ss, M(e(dt)(g.quantity, g.sku.unit, g.measurement)), 1)
1360
+ ]),
1361
+ t("div", ns, [
1362
+ t("div", ls, M(g.code), 1),
1363
+ g.totalCost && e(i).enableTotalCost ? (O(), L("div", rs, " (" + M(e(Tt)(g.totalCost)) + ") ", 1)) : oe("", !0)
1364
+ ]),
1365
+ e(mt)(g) ? (O(), L("div", as, [
1366
+ b(q, {
1367
+ name: "error",
1368
+ color: "system-error-300",
1369
+ size: "sm"
1370
+ }),
1371
+ k[4] || (k[4] = t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-system-error-400" }, " This item has invalid unit configuration. Apply update on this item. ", -1))
1372
+ ])) : oe("", !0)
1373
+ ]))), 128))
1374
+ ])
1375
+ ]),
1376
+ k[6] || (k[6] = t("div", null, null, -1)),
1377
+ k[7] || (k[7] = t("div", null, null, -1)),
1378
+ t("div", is, [
1379
+ k[5] || (k[5] = t("div", { class: "flex flex-col" }, [
1380
+ t("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
1381
+ t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is only usable for the following locations. ")
1382
+ ], -1)),
1383
+ t("div", us, [
1384
+ b(p, {
1385
+ modelValue: $.value,
1386
+ "onUpdate:modelValue": k[0] || (k[0] = (g) => $.value = g),
1387
+ placeholder: "Filter locations",
1388
+ "prepend-icon": "search"
1389
+ }, null, 8, ["modelValue"]),
1390
+ b(c, {
1391
+ "hide-footer": "",
1392
+ style: { height: "500px" },
1393
+ "column-defs": _,
1394
+ "search-value": $.value,
1395
+ "row-data": ((I = h.template) == null ? void 0 : I.locations) ?? [{ name: "All locations" }]
1396
+ }, null, 8, ["search-value", "row-data"])
1397
+ ])
1398
+ ])
1399
+ ])
1400
+ ];
1401
+ }),
1402
+ "side-sheet-footer": N(() => [
1403
+ t("div", ds, [
1404
+ b(w, {
1405
+ label: e(s)("common.edit"),
1406
+ onClick: k[1] || (k[1] = (S) => r("action:edit")),
1407
+ variant: "tertiary"
1408
+ }, null, 8, ["label"])
1409
+ ])
1410
+ ]),
1411
+ _: 1
1412
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1413
+ };
1414
+ }
1415
+ }), ps = { class: "flex-1 flex flex-col gap-8" }, cs = { class: "flex flex-col" }, fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ys = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, vs = { class: "fm-typo-en-body-lg-400" }, bs = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, hs = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Ys = /* @__PURE__ */ ae({
1416
+ __name: "TransferTemplateView",
1417
+ setup(f) {
1418
+ const { t: x } = me(), { createTemplate: h, viewTemplate: r, importTemplates: i, exportTemplates: s } = Ne(), { templateDialogProps: u, templateDetailsProps: _ } = ze(Ne()), $ = pt(), { loading: y, templates: o } = ze($), d = H(!1), m = it(), k = Ge(), { breakpoints: T } = bt();
1419
+ Te($.fetchTemplates);
1420
+ const A = B(
1421
+ () => d.value || y.value || !k._currentLocation
1422
+ ), q = B(() => o.value), p = H(""), c = B(() => T.value.xs || T.value.sm), w = B(() => c.value ? 10 : 20);
1423
+ function a(I) {
1424
+ switch (I) {
1425
+ case Ee.Add:
1426
+ return h();
1427
+ case "refresh":
1428
+ return $.fetchTemplates();
1429
+ case "import":
1430
+ return i();
1431
+ case "export":
1432
+ return s();
1433
+ }
1434
+ }
1435
+ function v(I) {
1436
+ return I;
1437
+ }
1438
+ const S = B(() => [
1439
+ {
1440
+ label: x("inventory.closing.template.create.title"),
1441
+ value: Ee.Add,
1442
+ isPrimary: !0,
1443
+ prependIcon: "add"
1444
+ },
1445
+ {
1446
+ label: x("inventory.common.refresh"),
1447
+ value: "refresh",
1448
+ isPrimary: !1
1449
+ },
1450
+ {
1451
+ label: x("inventory.common.import"),
1452
+ value: "import",
1453
+ isPrimary: !1
1454
+ },
1455
+ {
1456
+ label: x("inventory.common.export"),
1457
+ value: "export",
1458
+ isPrimary: !1
1459
+ }
1460
+ ]);
1461
+ return (I, g) => {
1462
+ const W = R("FmTable");
1463
+ return O(), L(pe, null, [
1464
+ b(ut, {
1465
+ title: e(x)("inventory.transfer.template.title2"),
1466
+ actions: S.value,
1467
+ "onClick:action": a
1468
+ }, {
1469
+ default: N(() => {
1470
+ var te;
1471
+ return [
1472
+ t("div", {
1473
+ class: le([
1474
+ "flex flex-col gap-8 max-h-full",
1475
+ {
1476
+ "p-0": c.value,
1477
+ "px-24 ": !c.value
1478
+ }
1479
+ ])
1480
+ }, [
1481
+ b(yt, {
1482
+ searchable: "",
1483
+ search: p.value,
1484
+ "onUpdate:search": g[0] || (g[0] = (E) => p.value = E)
1485
+ }, null, 8, ["search"]),
1486
+ (O(), ne(W, {
1487
+ style: _e(e(m).tableHeight),
1488
+ "column-defs": e($).columnDefs,
1489
+ "row-data": q.value,
1490
+ "search-value": p.value,
1491
+ loading: A.value,
1492
+ key: (te = e(k)._currentLocation) == null ? void 0 : te.dbName,
1493
+ onRowClick: g[1] || (g[1] = (E) => e(r)(E.original)),
1494
+ "page-size": w.value
1495
+ }, {
1496
+ "list-row": N((E) => [
1497
+ b(Xe, {
1498
+ row: E,
1499
+ onRowClick: (U) => e(r)(U)
1500
+ }, {
1501
+ default: N((U) => {
1502
+ var Z, n, l, F, P, z, G, D, V, K, J, C, j, ie, Ce, Ie, Me, Se, Oe, $e, ce, De, Ve, Ae, Re, fe, qe;
1503
+ return [
1504
+ t("div", ps, [
1505
+ t("div", cs, [
1506
+ t("div", fs, [
1507
+ b(e(ee), {
1508
+ render: (l = (n = (Z = U._id) == null ? void 0 : Z.column) == null ? void 0 : n.columnDef) == null ? void 0 : l.cell,
1509
+ props: (P = (F = U._id) == null ? void 0 : F.getContext) == null ? void 0 : P.call(F)
1510
+ }, null, 8, ["render", "props"])
1511
+ ]),
1512
+ t("div", ys, [
1513
+ b(e(ee), {
1514
+ render: (D = (G = (z = U.name) == null ? void 0 : z.column) == null ? void 0 : G.columnDef) == null ? void 0 : D.cell,
1515
+ props: (K = (V = U.name) == null ? void 0 : V.getContext) == null ? void 0 : K.call(V)
1516
+ }, null, 8, ["render", "props"])
1517
+ ]),
1518
+ t("div", vs, [
1519
+ b(e(ee), {
1520
+ render: (j = (C = (J = U.supplier) == null ? void 0 : J.column) == null ? void 0 : C.columnDef) == null ? void 0 : j.cell,
1521
+ props: (Ce = (ie = U.supplier) == null ? void 0 : ie.getContext) == null ? void 0 : Ce.call(ie)
1522
+ }, null, 8, ["render", "props"])
1523
+ ]),
1524
+ t("div", null, M((Ie = E.original.locations) != null && Ie.length ? `Enabled for ${(Me = E.original.locations) == null ? void 0 : Me.length} outlets` : "Enabled for all outlets"), 1),
1525
+ t("div", bs, M(E.original.purchaseOrder.items.length ? E.original.purchaseOrder.items.map((tt) => tt.name).join(", ") : "No items"), 1),
1526
+ t("div", hs, [
1527
+ b(e(ee), {
1528
+ render: ($e = (Oe = (Se = U.ref) == null ? void 0 : Se.column) == null ? void 0 : Oe.columnDef) == null ? void 0 : $e.cell,
1529
+ props: (De = (ce = U.ref) == null ? void 0 : ce.getContext) == null ? void 0 : De.call(ce)
1530
+ }, null, 8, ["render", "props"])
1531
+ ])
1532
+ ]),
1533
+ t("div", null, [
1534
+ b(e(ee), {
1535
+ render: (Re = (Ae = (Ve = U.type) == null ? void 0 : Ve.column) == null ? void 0 : Ae.columnDef) == null ? void 0 : Re.cell,
1536
+ props: (qe = (fe = U.type) == null ? void 0 : fe.getContext) == null ? void 0 : qe.call(fe)
1537
+ }, null, 8, ["render", "props"])
1538
+ ])
1539
+ ])
1540
+ ];
1541
+ }),
1542
+ _: 2
1543
+ }, 1032, ["row", "onRowClick"])
1544
+ ]),
1545
+ _: 1
1546
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1547
+ ], 2)
1548
+ ];
1549
+ }),
1550
+ _: 1
1551
+ }, 8, ["title", "actions"]),
1552
+ (O(), ne(lt, { to: "body" }, [
1553
+ b(ms, rt(at(e(_))), null, 16),
1554
+ b(So, Ye(e(u), {
1555
+ onSubmitted: g[2] || (g[2] = (te) => e($).fetchTemplates())
1556
+ }), null, 16)
1557
+ ]))
1558
+ ], 64);
1559
+ };
1560
+ }
1561
+ });
1562
+ export {
1563
+ Ys as default
1564
+ };