@feedmepos/mf-inventory-portal 0.0.23-dev.9 → 0.0.24-dev.1

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 (140) hide show
  1. package/dist/App-D3sNH2MR.js +276 -0
  2. package/dist/{ApprovalView-e85YmdZN.js → ApprovalView-DHnRx0hJ.js} +17 -20
  3. package/dist/{BindingsDialog-giBUD0IH.js → BindingsDialog-oTeg2Dai.js} +6 -6
  4. package/dist/{BindingsPicker-CC4MmPbF.js → BindingsPicker-CWdjmMJ3.js} +8 -9
  5. package/dist/{BindingsTable-WphZdzrA.js → BindingsTable-bKLR1OKX.js} +18 -22
  6. package/dist/ClosingDraftView-CIQVz7lY.js +1225 -0
  7. package/dist/{ClosingTemplateView-1lzoDyet.js → ClosingTemplateView-D5pLzQwU.js} +259 -274
  8. package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-ClLDcchC.js +142 -0
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cv-vvzr5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B_c6Vn6P.js} +23 -24
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DIFQcrc0.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DhpHOaRH.js} +50 -51
  11. package/dist/{IngredientGroupView-UegBM_JK.js → IngredientGroupView-4C437mso.js} +63 -70
  12. package/dist/IngredientsView-DoiGgjre.js +1706 -0
  13. package/dist/{IntegrationView-FYNNzKia.js → IntegrationView-8ZKE7MAM.js} +123 -126
  14. package/dist/{InventoryBindingForm-DsHv_IHG.js → InventoryBindingForm-CcnfliYQ.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BURSXafS.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B_J-6C9x.js} +116 -108
  16. package/dist/{InventoryBindingSummary-BLb4MRPZ.js → InventoryBindingSummary-CRdHCzNE.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BG78-DHs.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B2-TypU0.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CqID5_7v.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BuQde75S.js} +20 -21
  19. package/dist/PublishView-t5gjGmK_.js +192 -0
  20. package/dist/{PurchaseOrderPrintPreview-BBMU3teq.js → PurchaseOrderPrintPreview-6i53Y-v1.js} +13 -14
  21. package/dist/ReceiveRequestView-uOeSh0Mr.js +1866 -0
  22. package/dist/RecipeView-BTWywckD.js +609 -0
  23. package/dist/StockView-DN2xk8ei.js +1817 -0
  24. package/dist/{SupplierView-B2aObtwK.js → SupplierView-l0XUg3J4.js} +185 -196
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CWMn6fFf.js +1327 -0
  26. package/dist/TransferTemplateView-wDKXpCWZ.js +1263 -0
  27. package/dist/UnitView-CUI-k-tS.js +648 -0
  28. package/dist/{WarehouseView-G8pej6Y2.js → WarehouseView-WsI_eG5r.js} +190 -197
  29. package/dist/api/adjustment-template.d.ts +25 -0
  30. package/dist/api/bill.d.ts +240 -84
  31. package/dist/api/inventory.d.ts +19 -6
  32. package/dist/api/netsuite.d.ts +3 -3
  33. package/dist/app-DntcWR3_.js +85558 -0
  34. package/dist/app.d.ts +85 -0
  35. package/dist/app.js +2 -2
  36. package/dist/components/FmCustomAttribute.vue.d.ts +23 -0
  37. package/dist/components/FmLockableField.vue.d.ts +37 -0
  38. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +3 -1
  40. package/dist/components/shell/inventory/binding-ui.vue.d.ts +3 -1
  41. package/dist/composable/defineDeepModel.d.ts +1 -1
  42. package/dist/{decimal-DC07xoJW.js → decimal-DTCTnMwO.js} +1 -1
  43. package/dist/format-unit-display-Hy48Iw5j.js +1215 -0
  44. package/dist/index-Bv9RYyTZ.js +29202 -0
  45. package/dist/{StockView-C5btudss.js → index-D4yJP9I2.js} +2220 -3863
  46. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -0
  47. package/dist/router/name.d.ts +2 -0
  48. package/dist/stock-BsdmfT-b.js +125 -0
  49. package/dist/stores/feature.d.ts +41 -1
  50. package/dist/stores/integration/netsuite.d.ts +3 -2
  51. package/dist/stores/inventory.d.ts +20 -8
  52. package/dist/stores/location.d.ts +29 -1
  53. package/dist/stores/supplier.d.ts +1 -1
  54. package/dist/style.css +1 -1
  55. package/dist/supplier-CXhkgC4M.js +77 -0
  56. package/dist/tsconfig.app.tsbuildinfo +1 -1
  57. package/dist/{use-inventory-binding-dialog-B0G2XYSw.js → use-inventory-binding-dialog-DPMJmBCr.js} +10 -11
  58. package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +2 -0
  59. package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +18 -0
  60. package/dist/views/adjustment-template/import/export.d.ts +60 -0
  61. package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +2 -0
  62. package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +22 -0
  63. package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +6 -0
  64. package/dist/views/adjustment-template/wastage-template/WastageTemplateReason.vue.d.ts +18 -0
  65. package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +2 -0
  66. package/dist/views/adjustment-template/wastage-template/actions.d.ts +1377 -0
  67. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +16 -0
  68. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +35 -0
  69. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +20 -0
  70. package/dist/views/adjustment-template/wastage-template/props.d.ts +36 -0
  71. package/dist/views/adjustment-template/wastage-template/table.d.ts +1351 -0
  72. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +198 -12
  73. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +7 -4
  74. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1559 -467
  75. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +19 -0
  76. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +4 -0
  77. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +2 -1
  78. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +72 -12
  79. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +73 -13
  80. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +6 -3
  81. package/dist/views/ingredients/components/convert/ConvertFormProps.d.ts +1 -0
  82. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -2
  83. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +1 -0
  84. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +2 -1
  85. package/dist/views/publish/PublishView.vue.d.ts +2 -0
  86. package/dist/views/receive-request/components/netsuite/NetSuiteInfo.vue.d.ts +12 -0
  87. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +13 -0
  88. package/dist/views/receive-request/components/netsuite/NetSuiteSync.vue.d.ts +12 -0
  89. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +13 -0
  90. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  91. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +86 -17
  92. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -2
  93. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -1
  94. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +126 -24
  95. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +126 -24
  96. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -0
  97. package/dist/views/stock/components/StockRecordCard.vue.d.ts +120 -42
  98. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
  99. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  100. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -0
  101. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +2 -1
  102. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +72 -12
  103. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +72 -12
  104. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +2 -1
  105. package/dist/vue-i18n-ByVzHsI7.js +2365 -0
  106. package/package.json +5 -4
  107. package/dist/App-ByLgARNp.js +0 -259
  108. package/dist/ClosingDraftView-CQM1Sx45.js +0 -755
  109. package/dist/FmDroppableField-8RzKjEdL.js +0 -154
  110. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BvkN-71q.js +0 -436
  111. package/dist/FmMultiselectDialog-DScMA6iG.js +0 -415
  112. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-t4pim_k9.js +0 -51
  113. package/dist/IngredientsView-BfW-jZLM.js +0 -1666
  114. package/dist/ReceiveRequestView-vbANEzne.js +0 -4165
  115. package/dist/RecipeView-DW4DY0C0.js +0 -598
  116. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +0 -135
  117. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B2LOvVef.js +0 -1229
  118. package/dist/TransferTemplateView-BKumN_p6.js +0 -1262
  119. package/dist/UnitView-CHLucv9s.js +0 -648
  120. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  121. package/dist/app-BXjk74IB.js +0 -33538
  122. package/dist/date2-CWAt9bRf.js +0 -117
  123. package/dist/dayjs.min-D3jPOnu6.js +0 -282
  124. package/dist/defineDeepModel-CiD4GtOw.js +0 -13
  125. package/dist/feature-6tcLMotY.js +0 -92
  126. package/dist/form-mode.enum-BKiNVH6A.js +0 -4
  127. package/dist/format-time-from-id-CYU5Z9Mt.js +0 -15
  128. package/dist/format-unit-display-CY-0bznr.js +0 -1217
  129. package/dist/fuzzy-BMkhNYLR.js +0 -41
  130. package/dist/index-BXwQa14X.js +0 -45
  131. package/dist/index-CRLd5xyg.js +0 -22283
  132. package/dist/index-DqwAtOgI.js +0 -12087
  133. package/dist/netsuite-fYUUk_ss.js +0 -225
  134. package/dist/row-action.enum-7rGLGZ5v.js +0 -55
  135. package/dist/rules-BmRGm3yv.js +0 -203
  136. package/dist/stock-CEX0DP2B.js +0 -111
  137. package/dist/supplier-CdJmZr7w.js +0 -77
  138. package/dist/use-template-enabled-locations-2-xbPJWHCs.js +0 -86
  139. package/dist/xlsx-CTOKp7SQ.js +0 -24004
  140. package/dist/xlsx.util-D5NFSfDg.js +0 -78
@@ -1,1262 +0,0 @@
1
- import { defineComponent as Z, onMounted as pe, computed as R, ref as B, watch as ce, inject as We, resolveComponent as O, openBlock as A, createElementBlock as Q, createElementVNode as t, createVNode as c, withCtx as E, renderSlot as Ie, withDirectives as Ve, normalizeClass as ie, vModelText as Ae, reactive as Ze, h as W, toDisplayString as C, unref as e, createBlock as K, mergeProps as Ue, isRef as Ee, createCommentVNode as Y, Fragment as qe, renderList as Je, normalizeStyle as Xe, Teleport as Ye, normalizeProps as et, guardReactiveProps as tt } from "vue";
2
- import { u as ot, _ as st, a as lt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BvkN-71q.js";
3
- import { useI18n as J } from "@feedmepos/mf-common";
4
- import { P as N, a as nt, f as rt, t as at, b as Re, u as it } from "./format-unit-display-CY-0bznr.js";
5
- import { R as De } from "./row-action.enum-7rGLGZ5v.js";
6
- import { a as Ne, u as ze, A as ne } from "./app-BXjk74IB.js";
7
- import { components as re, useDialog as ut, useSnackbar as mt, useProxiedModel as je, useBreakpoints as dt } from "@feedmepos/ui-library";
8
- import { storeToRefs as Pe } from "pinia";
9
- import { F as ee } from "./form-mode.enum-BKiNVH6A.js";
10
- import { u as ue, t as Le, I as pt, n as ct, o as ft, a as G, p as yt, R as me, g as ae, c as vt, A as de, M as bt, b as xt, j as _t } from "./rules-BmRGm3yv.js";
11
- import { d as He } from "./defineDeepModel-CiD4GtOw.js";
12
- import { _ as ht, b as gt, F as Ft, a as Tt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DIFQcrc0.js";
13
- import { u as Qe } from "./feature-6tcLMotY.js";
14
- import { c as wt, u as kt, _ as Mt } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cv-vvzr5.js";
15
- import { F as Be } from "./index-CRLd5xyg.js";
16
- import { u as St } from "./supplier-CdJmZr7w.js";
17
- import { F as $t } from "./FmMultiselectDialog-DScMA6iG.js";
18
- import { F as j, _ as Ge } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
19
- import { u as Ct } from "./use-template-enabled-locations-2-xbPJWHCs.js";
20
- import { f as Ot } from "./format-time-from-id-CYU5Z9Mt.js";
21
- const It = { class: "flex flex-col" }, Vt = { class: "flex flex-col" }, At = { class: "flex-1" }, Rt = { class: "flex items-center" }, Dt = { class: "flex-1" }, Pt = { class: "flex-1" }, Lt = /* @__PURE__ */ Z({
22
- __name: "FmMinMaxInput",
23
- props: {
24
- rules: {},
25
- label: {},
26
- minPlaceholder: {},
27
- maxPlaceholder: {},
28
- modelValue: {},
29
- precision: {},
30
- minLength: {},
31
- maxLength: {},
32
- inputmode: {},
33
- type: {},
34
- readonly: { type: Boolean },
35
- labelMark: {},
36
- prependIcon: {},
37
- appendIcon: {},
38
- showValidBorder: { type: Boolean },
39
- labelInfo: {},
40
- showWordCount: { type: Boolean },
41
- invalid: { type: Boolean },
42
- autofocus: { type: Boolean },
43
- formatter: { type: Function },
44
- decimal: {},
45
- datalist: {},
46
- shiftDatalist: { type: Boolean },
47
- datalistMaxHeight: {},
48
- datalistMinHeight: {},
49
- offsetDatalist: {},
50
- datalistPlacement: {},
51
- datalistZIndex: {},
52
- datalistWidth: {},
53
- disabled: { type: Boolean },
54
- focused: { type: Boolean },
55
- helperText: {},
56
- helperState: {}
57
- },
58
- setup(v) {
59
- const _ = v, m = He("modelValue"), o = pt();
60
- pe(() => {
61
- const { min: b, max: a } = m ?? {};
62
- if (!(!b || !a) && b.precision !== a.precision) {
63
- const h = Math.max(b.precision, a.precision), r = ue(b, h), y = ue(a, h);
64
- m.min = r, m.max = y;
65
- }
66
- });
67
- const p = R(() => {
68
- const { min: b, max: a } = m ?? {};
69
- return Math.max((b == null ? void 0 : b.precision) ?? 0, (a == null ? void 0 : a.precision) ?? 0, _.precision ?? 0);
70
- }), d = (b) => {
71
- if (!b) return "";
72
- const a = ct(b), h = p.value, r = ue(a, h);
73
- return ft(
74
- +G(r),
75
- r.precision
76
- );
77
- }, s = B(d(m.min)), u = B(d(m.max));
78
- ce([s, u], ([b, a]) => {
79
- const h = m ?? {}, r = o(b), y = o(a), l = p.value;
80
- if (b !== "" && r === !0) {
81
- const n = Le(+b, l);
82
- h.min = n;
83
- } else
84
- h.min = null;
85
- if (a !== "" && y === !0) {
86
- const n = Le(+a, l);
87
- h.max = n;
88
- } else
89
- h.max = null;
90
- m.min = h.min, m.max = h.max;
91
- });
92
- const x = Symbol.for("fm:form-state"), T = We(x, null), S = R(() => _.disabled ?? (T == null ? void 0 : T.getDisabled()) ?? !1), I = B(), g = B(), f = B(!1), w = B(!1), L = R(() => f.value || w.value), q = R(() => [...[
93
- function() {
94
- return typeof o(s.value) == "string" || typeof o(u.value) == "string" ? "Must be a number" : !0;
95
- },
96
- function(h) {
97
- return !h || !h.min || !h.max ? !0 : +G(h.min) > +G(h.max) ? "Min must be less than or equal to max" : !0;
98
- }
99
- ], ..._.rules ?? []]);
100
- return (b, a) => {
101
- const h = O("FmLabel"), r = O("FmField"), y = O("FmFormGroup");
102
- return A(), Q("div", It, [
103
- t("div", Vt, [
104
- t("div", At, [
105
- c(h, {
106
- label: b.label,
107
- disabled: b.disabled,
108
- required: b.labelMark === "required",
109
- optional: b.labelMark === "optional"
110
- }, null, 8, ["label", "disabled", "required", "optional"])
111
- ]),
112
- c(r, { focused: L.value }, {
113
- default: E(() => [
114
- t("div", Rt, [
115
- Ie(b.$slots, "prepend"),
116
- a[6] || (a[6] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
117
- t("div", Dt, [
118
- Ve(t("input", {
119
- type: "text",
120
- ref_key: "minInputRef",
121
- ref: I,
122
- onFocus: a[0] || (a[0] = () => f.value = !0),
123
- onBlur: a[1] || (a[1] = () => f.value = !1),
124
- "onUpdate:modelValue": a[2] || (a[2] = (l) => s.value = l),
125
- class: ie({
126
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
127
- "text-fm-color-typo-primary": !S.value,
128
- "text-fm-color-typo-disabled": S.value
129
- })
130
- }, null, 34), [
131
- [Ae, s.value]
132
- ])
133
- ]),
134
- a[7] || (a[7] = t("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
135
- a[8] || (a[8] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
136
- t("div", Pt, [
137
- Ve(t("input", {
138
- type: "text",
139
- ref_key: "maxInputRef",
140
- ref: g,
141
- onFocus: a[3] || (a[3] = () => w.value = !0),
142
- onBlur: a[4] || (a[4] = () => w.value = !1),
143
- "onUpdate:modelValue": a[5] || (a[5] = (l) => u.value = l),
144
- class: ie({
145
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
146
- "text-fm-color-typo-primary": !S.value,
147
- "text-fm-color-typo-disabled": S.value
148
- })
149
- }, null, 34), [
150
- [Ae, u.value]
151
- ])
152
- ]),
153
- Ie(b.$slots, "append")
154
- ])
155
- ]),
156
- _: 3
157
- }, 8, ["focused"])
158
- ]),
159
- c(y, {
160
- class: "flex-1",
161
- "model-value": b.modelValue,
162
- info: b.labelInfo,
163
- rules: q.value,
164
- "helper-text": b.helperText,
165
- "helper-state": b.helperState
166
- }, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
167
- ]);
168
- };
169
- }
170
- });
171
- function Bt({ min: v, max: _ } = { min: !0, max: !0 }) {
172
- return function(o) {
173
- return !o || !o.min && v != !1 || !o.max && _ != !1 ? "Required" : !0;
174
- };
175
- }
176
- function Ut(v, _) {
177
- return function(o) {
178
- return !o || !o.min || !o.max ? !0 : +G(o.min) < v ? `Must be between ${v} and ${_}` : +G(o.max) > _ ? `Must be between ${v} and ${_}` : !0;
179
- };
180
- }
181
- function Et(v) {
182
- const _ = yt(v), m = G(v);
183
- return function(p) {
184
- const d = !(p != null && p.min) || _(p.min) === !0, s = !(p != null && p.max) || _(p.max) === !0;
185
- return !d && !s ? `Min & max must be a multiple of ${m}` : d ? s ? !0 : `Max must be a multiple of ${m}` : `Min must be a multiple of ${m}`;
186
- };
187
- }
188
- var P = /* @__PURE__ */ ((v) => (v.Code = "Code", v.Name = "Name", v.DefaultAmount = "DefaultAmount", v.Limit = "Limit", v.MinimumAmount = "MinimumAmount", v.Step = "Step", v.Cost = "Cost", v.Delete = "Delete", v))(P || {});
189
- function qt(v) {
190
- const { t: _ } = J(), m = Ze({});
191
- pe(() => {
192
- for (const d of v.items) {
193
- if (!d.totalCost)
194
- continue;
195
- const s = wt(d.sku, d.quantity, d.measurement, {
196
- supplier: v.supplier
197
- }), u = d.totalCost ?? Be.reset();
198
- s ? m[d.sku._id] = s.amount !== u.amount || s.precision !== u.precision : m[d.sku._id] = !0;
199
- }
200
- });
201
- const o = [
202
- {
203
- id: "Code",
204
- header: () => _("inventory.transfer.form.items.table.Code"),
205
- accessorKey: "code",
206
- size: 96,
207
- cell(d) {
208
- const s = d.row.original;
209
- return W(re.FmTextField, {
210
- modelValue: s.code,
211
- "onUpdate:modelValue": (u) => {
212
- v.updateItem({
213
- ...s,
214
- code: u
215
- });
216
- },
217
- key: s.sku._id,
218
- rules: [me()],
219
- labelMark: "required"
220
- });
221
- },
222
- enableSorting: !1
223
- },
224
- {
225
- id: "Name",
226
- header: () => _("inventory.transfer.form.items.table.Name"),
227
- minSize: 300,
228
- cell(d) {
229
- const s = d.row.original;
230
- return W(re.FmTextField, {
231
- modelValue: s.name,
232
- "onUpdate:modelValue": (u) => {
233
- v.updateItem({
234
- ...s,
235
- name: u
236
- });
237
- },
238
- key: s.sku._id,
239
- rules: [me()],
240
- labelMark: "required"
241
- });
242
- },
243
- enableSorting: !1
244
- },
245
- {
246
- id: "DefaultAmount",
247
- header: () => _("inventory.transfer.form.items.table.DefaultAmount"),
248
- minSize: 200,
249
- cell(d) {
250
- var g;
251
- const s = d.row.original, u = Ne(), x = u.skuById[s.sku._id], T = u.unitById[(g = x.unit) == null ? void 0 : g._id], S = T.measurements.find((f) => {
252
- var w;
253
- return ((w = s.measurement) == null ? void 0 : w.id) === f.id;
254
- }), I = s.sku.unit._id !== x.unit._id || !T || s.measurement && !S;
255
- return W(ht, {
256
- style: {
257
- flex: "1 1 0%"
258
- },
259
- modelValue: {
260
- amount: s.quantity ?? { amount: 1, precision: 0 },
261
- // NOTE: leave this reading from row.sku.unit and row.measurement instead,
262
- measurement: s.measurement ?? (s.sku.unit._id !== x.unit._id ? { ...s.sku.unit, id: "", conversion: { amount: 1, precision: 0 } } : null)
263
- },
264
- disabled: v.disabled,
265
- key: s.sku._id,
266
- unit: T,
267
- "onUpdate:modelValue": (f) => {
268
- v.updateItem({
269
- ...s,
270
- sku: x,
271
- quantity: f.amount,
272
- measurement: f.measurement
273
- });
274
- },
275
- rules: [
276
- gt(s.quantityStep),
277
- Ft(
278
- +G(
279
- s.minimumQuantity ?? {
280
- amount: 1,
281
- // NOTE: leave this reading from row.sku.unit and row.measurement instead,
282
- precision: ae(s.sku.unit, s.measurement)
283
- }
284
- )
285
- ),
286
- Tt(
287
- s.maximumQuantity ? +G(s.maximumQuantity) : 1 / 0
288
- ),
289
- function(w) {
290
- return I ? "This item is no longer valid due to change in unit. Please reapply unit." : !0;
291
- }
292
- ],
293
- applyDefaultRules: !0
294
- });
295
- },
296
- enableSorting: !1
297
- },
298
- {
299
- id: "Limit",
300
- header: () => "Limit",
301
- // TODO: i18n,
302
- minSize: 280,
303
- cell(d) {
304
- const s = d.row.original;
305
- return W(Lt, {
306
- style: {
307
- flex: "1 1 0%"
308
- },
309
- modelValue: {
310
- min: s.minimumQuantity,
311
- max: s.maximumQuantity
312
- },
313
- disabled: v.disabled,
314
- key: s.sku._id,
315
- unit: s.sku.unit,
316
- "onUpdate:modelValue": (u) => {
317
- const x = { ...s };
318
- u != null && u.min ? x.minimumQuantity = u.min : x.minimumQuantity = null, u != null && u.max ? x.maximumQuantity = u.max : x.maximumQuantity = null, v.updateItem(x);
319
- },
320
- rules: [
321
- Bt({ max: !1 }),
322
- Et(s.quantityStep),
323
- Ut(
324
- +G({
325
- amount: 1,
326
- precision: ae(s.sku.unit, s.measurement)
327
- }),
328
- 1 / 0
329
- )
330
- ],
331
- disableUnit: !0,
332
- applyDefaultRules: !0
333
- });
334
- }
335
- },
336
- {
337
- id: "Step",
338
- header: () => _("inventory.transfer.form.items.table.Step"),
339
- minSize: 100,
340
- cell(d) {
341
- const s = d.row.original;
342
- return W(re.FmTextField, {
343
- modelValue: G(s.quantityStep ?? Be.reset(), !1),
344
- key: s.sku._id,
345
- "onUpdate:modelValue": (u) => {
346
- v.updateItem({
347
- ...s,
348
- quantityStep: vt(+u)
349
- });
350
- },
351
- rules: [
352
- de({
353
- amount: 1,
354
- precision: ae(s.sku.unit, s.measurement)
355
- }),
356
- bt(s.sku.unit, s.measurement)
357
- ]
358
- });
359
- },
360
- enableSorting: !1
361
- },
362
- {
363
- id: "Delete",
364
- header: "",
365
- cell(d) {
366
- const s = d.row.original;
367
- return W(re.FmButton, {
368
- class: "delete-button",
369
- key: s.sku._id,
370
- type: "button",
371
- icon: "delete",
372
- variant: "tertiary",
373
- size: "md",
374
- disabled: v.disabled,
375
- onClick: () => {
376
- v.deleteItem(s);
377
- }
378
- });
379
- },
380
- enableSorting: !1,
381
- size: 40,
382
- meta: {
383
- cellClass: "",
384
- headerClass: ""
385
- }
386
- }
387
- ];
388
- return {
389
- columnDefs: R(() => Qe().enableTotalCost && v.transferType === N.PURCHASE ? o : o.filter((s) => s.id !== "Cost"))
390
- };
391
- }
392
- const Nt = { class: "flex flex-col gap-8 py-16" }, zt = { class: "flex items-center" }, jt = { class: "flex-1 flex gap-1 items-center" }, Ht = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Gt = { class: "flex gap-8 w-full" }, Kt = { class: "flex-1 flex flex-col gap-4" }, Wt = { class: "flex-1 flex flex-col gap-4" }, Zt = { class: "flex gap-8 w-full" }, Jt = { class: "flex-1 flex flex-col gap-4" }, Xt = { class: "flex-1 flex flex-col gap-4" }, Yt = { class: "flex gap-8 w-full" }, eo = { class: "flex-1 flex flex-col gap-4" }, to = /* @__PURE__ */ Z({
393
- __name: "TransferTemplateItem",
394
- props: {
395
- cellByColId: {},
396
- row: {}
397
- },
398
- setup(v) {
399
- const { t: _ } = J();
400
- return (m, o) => {
401
- var d, s, u, x, T, S, I, g, f, w, L, q, b, a, h, r, y, l, n, i, $, V, k, F, D, z, H, M, U, X;
402
- const p = O("FmLabel");
403
- return A(), Q("div", Nt, [
404
- t("div", zt, [
405
- t("div", jt, [
406
- t("span", Ht, " (" + C(m.row.original.sku.code) + ") ", 1),
407
- t("span", Qt, C(m.row.original.sku.name), 1)
408
- ]),
409
- t("div", null, [
410
- c(e(j), {
411
- render: (u = (s = (d = m.cellByColId.Delete) == null ? void 0 : d.column) == null ? void 0 : s.columnDef) == null ? void 0 : u.cell,
412
- props: (T = (x = m.cellByColId.Delete) == null ? void 0 : x.getContext) == null ? void 0 : T.call(x)
413
- }, null, 8, ["render", "props"])
414
- ])
415
- ]),
416
- t("div", Gt, [
417
- t("div", Kt, [
418
- c(p, {
419
- label: e(_)(`inventory.transfer.form.items.table.${e(P).Code}`)
420
- }, null, 8, ["label"]),
421
- c(e(j), {
422
- render: (g = (I = (S = m.cellByColId[e(P).Code]) == null ? void 0 : S.column) == null ? void 0 : I.columnDef) == null ? void 0 : g.cell,
423
- props: (w = (f = m.cellByColId[e(P).Code]) == null ? void 0 : f.getContext) == null ? void 0 : w.call(f)
424
- }, null, 8, ["render", "props"]),
425
- o[0] || (o[0] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
426
- ]),
427
- t("div", Wt, [
428
- c(p, {
429
- label: e(_)(`inventory.transfer.form.items.table.${e(P).Name}`)
430
- }, null, 8, ["label"]),
431
- c(e(j), {
432
- render: (b = (q = (L = m.cellByColId[e(P).Name]) == null ? void 0 : L.column) == null ? void 0 : q.columnDef) == null ? void 0 : b.cell,
433
- props: (h = (a = m.cellByColId[e(P).Name]) == null ? void 0 : a.getContext) == null ? void 0 : h.call(a)
434
- }, null, 8, ["render", "props"]),
435
- o[1] || (o[1] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
436
- ])
437
- ]),
438
- t("div", Zt, [
439
- t("div", Jt, [
440
- c(p, {
441
- label: e(_)(`inventory.transfer.form.items.table.${e(P).DefaultAmount}`)
442
- }, null, 8, ["label"]),
443
- c(e(j), {
444
- render: (l = (y = (r = m.cellByColId[e(P).DefaultAmount]) == null ? void 0 : r.column) == null ? void 0 : y.columnDef) == null ? void 0 : l.cell,
445
- props: (i = (n = m.cellByColId[e(P).DefaultAmount]) == null ? void 0 : n.getContext) == null ? void 0 : i.call(n)
446
- }, null, 8, ["render", "props"]),
447
- o[2] || (o[2] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
448
- ]),
449
- t("div", Xt, [
450
- c(p, {
451
- label: e(_)(`inventory.transfer.form.items.table.${e(P).Step}`)
452
- }, null, 8, ["label"]),
453
- c(e(j), {
454
- render: (k = (V = ($ = m.cellByColId[e(P).Step]) == null ? void 0 : $.column) == null ? void 0 : V.columnDef) == null ? void 0 : k.cell,
455
- props: (D = (F = m.cellByColId[e(P).Step]) == null ? void 0 : F.getContext) == null ? void 0 : D.call(F)
456
- }, null, 8, ["render", "props"]),
457
- o[3] || (o[3] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
458
- ])
459
- ]),
460
- t("div", Yt, [
461
- t("div", eo, [
462
- c(p, {
463
- label: e(_)(`inventory.transfer.form.items.table.${e(P).Limit}`)
464
- }, null, 8, ["label"]),
465
- c(e(j), {
466
- render: (M = (H = (z = m.cellByColId[e(P).Limit]) == null ? void 0 : z.column) == null ? void 0 : H.columnDef) == null ? void 0 : M.cell,
467
- props: (X = (U = m.cellByColId[e(P).Limit]) == null ? void 0 : U.getContext) == null ? void 0 : X.call(U)
468
- }, null, 8, ["render", "props"]),
469
- o[4] || (o[4] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
470
- ])
471
- ])
472
- ]);
473
- };
474
- }
475
- }), oo = { class: "flex flex-col gap-16" }, so = { class: "flex flex-col gap-24" }, lo = { class: "flex flex-col gap-16" }, no = { class: "flex items-center" }, ro = { class: "flex flex-col" }, ao = { class: "flex flex-col gap-16" }, io = { class: "flex" }, uo = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, mo = /* @__PURE__ */ Z({
476
- __name: "TransferTemplateForm",
477
- props: {
478
- modelValue: {},
479
- disabled: { type: Boolean }
480
- },
481
- setup(v, { expose: _ }) {
482
- const m = v, o = He(), { t: p } = J(), d = ze(), s = Ne(), u = St();
483
- ce(
484
- () => m.modelValue,
485
- (l) => {
486
- console.log("TransferTemplateForm.model", l);
487
- }
488
- ), d.watchLocation(async () => {
489
- location && (o.purchaseOrder.supplier || (o.purchaseOrder.supplier = u.suppliers.find((l) => l) ?? o.purchaseOrder.supplier));
490
- });
491
- const x = ut(), T = kt(
492
- () => o.purchaseOrder,
493
- (l) => {
494
- o.purchaseOrder = {
495
- ...o.purchaseOrder,
496
- supplier: l.supplier ?? (o == null ? void 0 : o.purchaseOrder.supplier)
497
- };
498
- }
499
- ), S = R({
500
- get() {
501
- var l, n;
502
- return typeof ((n = (l = o.purchaseOrder) == null ? void 0 : l.supplier) == null ? void 0 : n.internal) == "string" ? N.TRANSFER : N.PURCHASE;
503
- },
504
- set(l) {
505
- var i, $;
506
- const n = typeof (($ = (i = o.purchaseOrder) == null ? void 0 : i.supplier) == null ? void 0 : $.internal) == "string" ? N.TRANSFER : N.PURCHASE;
507
- l !== n && (o.purchaseOrder.supplier = l === N.PURCHASE ? T.locationOptionsTypePurchase.value[0] : T.locationOptionsTypeTransfer.value[0]);
508
- }
509
- }), I = R(() => T.transferLocationOptions.value), g = R({
510
- get() {
511
- var l;
512
- return (l = o.purchaseOrder.supplier) == null ? void 0 : l._id;
513
- },
514
- set(l) {
515
- T.transferLocationModel.value = l;
516
- }
517
- }), {
518
- promptSelectLocations: f,
519
- columnDefs: w,
520
- rowData: L
521
- } = Ct({
522
- getLocations() {
523
- return o.locations;
524
- },
525
- setLocations(l) {
526
- o.locations = l;
527
- }
528
- });
529
- function q() {
530
- var l, n;
531
- return (l = o.locations) != null && l.find((i) => {
532
- var $, V;
533
- return (($ = i.doc) == null ? void 0 : $._id) === ((V = o.purchaseOrder.supplier) == null ? void 0 : V._id);
534
- }) ? `Location ${(n = o.purchaseOrder.supplier) == null ? void 0 : n.name} must be removed because template cannot be used to transfer to itself.` : !0;
535
- }
536
- const b = R({
537
- get() {
538
- return o.purchaseOrder.remark ?? void 0;
539
- },
540
- set(l) {
541
- o.purchaseOrder.remark = l;
542
- }
543
- }), a = B();
544
- _({
545
- validateInputs: () => {
546
- var l, n;
547
- (n = (l = a.value) == null ? void 0 : l.validateInputs) == null || n.call(l);
548
- },
549
- resetInputsValidation: () => {
550
- var l, n;
551
- (n = (l = a.value) == null ? void 0 : l.resetInputsValidation) == null || n.call(l);
552
- },
553
- resetInputs: () => {
554
- var l, n;
555
- (n = (l = a.value) == null ? void 0 : l.resetInputs) == null || n.call(l);
556
- }
557
- });
558
- const h = qt({
559
- updateItem: (l) => {
560
- o.purchaseOrder.items = o.purchaseOrder.items.map((n) => n.sku._id !== l.sku._id ? n : l);
561
- },
562
- deleteItem: (l) => {
563
- o.purchaseOrder.items = o.purchaseOrder.items.filter(
564
- (n) => n.sku._id !== l.sku._id
565
- );
566
- },
567
- get supplier() {
568
- return o.purchaseOrder.supplier;
569
- },
570
- get items() {
571
- return o.purchaseOrder.items;
572
- },
573
- get transferType() {
574
- return N.PURCHASE;
575
- },
576
- get disabled() {
577
- return m.disabled;
578
- }
579
- }), r = R(() => h.columnDefs.value);
580
- function y() {
581
- const l = s.skus.map((i) => ({
582
- label: i.name,
583
- sublabel: i.code,
584
- value: i
585
- })), n = l.filter((i) => {
586
- var $;
587
- return ($ = o.purchaseOrder.items) == null ? void 0 : $.find((V) => V.sku._id === i.value._id);
588
- }).map((i) => i.value);
589
- x.open({
590
- title: p("inventory.transfer.form.items.selectItem"),
591
- closeButton: !0,
592
- contentComponent: $t,
593
- contentComponentProps: {
594
- modelValue: n,
595
- items: l,
596
- virtualScroll: !0
597
- },
598
- primaryActions: {
599
- text: p("common.confirm"),
600
- close: !0
601
- },
602
- secondaryActions: {
603
- text: p("common.close"),
604
- close: !0,
605
- variant: "tertiary"
606
- }
607
- }).onPrimary((i) => {
608
- const $ = o.purchaseOrder.items ?? [], V = i.map((k) => {
609
- const F = $.find((H) => H.sku._id === k._id);
610
- if (F)
611
- return F;
612
- const D = { amount: 1, precision: ae(k.unit) };
613
- return {
614
- sku: k,
615
- code: k.code,
616
- name: k.name,
617
- quantity: D,
618
- minimumQuantity: D,
619
- maximumQuantity: xt(D, {
620
- amount: 100,
621
- precision: 0
622
- }),
623
- quantityStep: D
624
- };
625
- });
626
- V.sort((k, F) => k.sku.code.localeCompare(F.sku.code)), o.purchaseOrder.items = V;
627
- });
628
- }
629
- return (l, n) => {
630
- const i = O("FmTextField"), $ = O("FmSelect"), V = O("FmTextarea"), k = O("FmButton"), F = O("FmTable"), D = O("FmFormGroup"), z = O("FmForm");
631
- return A(), K(z, {
632
- ref_key: "formRef",
633
- ref: a,
634
- class: "flex flex-col gap-32",
635
- disabled: l.disabled
636
- }, {
637
- default: E(() => {
638
- var H;
639
- return [
640
- t("div", oo, [
641
- t("div", so, [
642
- c(i, {
643
- label: e(p)("inventory.transfer.form.name"),
644
- "label-mark": "required",
645
- modelValue: e(o).name,
646
- "onUpdate:modelValue": n[0] || (n[0] = (M) => e(o).name = M),
647
- rules: [e(me)()]
648
- }, null, 8, ["label", "modelValue", "rules"]),
649
- c($, {
650
- label: e(p)("inventory.transfer.form.type.title"),
651
- "model-value": S.value,
652
- "onUpdate:modelValue": n[1] || (n[1] = (M) => S.value = M),
653
- items: [
654
- {
655
- label: e(p)("inventory.transfer.form.type.purchase"),
656
- value: e(N).PURCHASE,
657
- disabled: !e(T).locationOptionsTypePurchase.value.length,
658
- sublabel: e(T).locationOptionsTypePurchase.value.length ? void 0 : e(p)("inventory.transfer.form.noSupplierAvailable")
659
- },
660
- {
661
- label: e(p)("inventory.transfer.form.type.transfer"),
662
- value: e(N).TRANSFER,
663
- disabled: !e(T).locationOptionsTypeTransfer.value.length,
664
- sublabel: e(T).locationOptionsTypeTransfer.value.length ? void 0 : e(p)("inventory.transfer.form.noLocationAvailable")
665
- }
666
- ],
667
- rules: [e(de)(1)(I.value)]
668
- }, null, 8, ["label", "model-value", "items", "rules"]),
669
- c($, {
670
- label: S.value === e(N).PURCHASE ? e(p)("inventory.transfer.form.purchaseFrom") : e(p)("inventory.transfer.form.transferFrom"),
671
- modelValue: g.value,
672
- "onUpdate:modelValue": n[2] || (n[2] = (M) => g.value = M),
673
- items: I.value
674
- }, {
675
- "menu-wrapper": E((M) => {
676
- var U;
677
- return [
678
- c(Mt, Ue(M, {
679
- items: I.value,
680
- "model-value": (U = l.modelValue.purchaseOrder.supplier) == null ? void 0 : U._id
681
- }), null, 16, ["items", "model-value"])
682
- ];
683
- }),
684
- _: 1
685
- }, 8, ["label", "modelValue", "items"]),
686
- c(i, {
687
- label: e(p)("inventory.transfer.form.reference"),
688
- "label-mark": "optional",
689
- modelValue: e(o).purchaseOrder.ref,
690
- "onUpdate:modelValue": n[3] || (n[3] = (M) => e(o).purchaseOrder.ref = M)
691
- }, null, 8, ["label", "modelValue"]),
692
- c(V, {
693
- label: e(p)("inventory.transfer.form.remark"),
694
- "label-mark": "optional",
695
- "max-length": 240,
696
- modelValue: b.value,
697
- "onUpdate:modelValue": n[4] || (n[4] = (M) => b.value = M),
698
- class: ie({ "text-fm-color-typo-disabled": l.disabled })
699
- }, null, 8, ["label", "modelValue", "class"])
700
- ])
701
- ]),
702
- t("div", lo, [
703
- t("div", no, [
704
- n[6] || (n[6] = t("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
705
- c(k, {
706
- disabled: l.disabled,
707
- label: "Select location",
708
- "prepend-icon": "add",
709
- variant: "plain",
710
- class: "border-2 rounded-lg border-fm-color-primary",
711
- onClick: e(f)
712
- }, null, 8, ["disabled", "onClick"])
713
- ]),
714
- c(F, {
715
- "column-defs": e(w),
716
- "row-data": e(L),
717
- "shrink-at": 9999,
718
- onRowClick: e(f),
719
- "hide-footer": ""
720
- }, null, 8, ["column-defs", "row-data", "onRowClick"]),
721
- t("div", ro, [
722
- c(D, {
723
- "model-value": [
724
- (H = m.modelValue.purchaseOrder.supplier) == null ? void 0 : H._id,
725
- ...m.modelValue.locations ?? []
726
- ].join(","),
727
- rules: [q]
728
- }, null, 8, ["model-value", "rules"])
729
- ])
730
- ]),
731
- t("div", ao, [
732
- t("div", io, [
733
- t("div", uo, C(e(p)("inventory.transfer.form.items.title")), 1),
734
- c(k, {
735
- disabled: l.disabled,
736
- label: e(p)("inventory.transfer.form.items.addItem"),
737
- "prepend-icon": "add",
738
- variant: "plain",
739
- class: "border-2 rounded-lg border-fm-color-primary",
740
- onClick: n[5] || (n[5] = (M) => y()),
741
- size: "md"
742
- }, null, 8, ["disabled", "label"])
743
- ]),
744
- (A(), K(F, {
745
- "column-defs": r.value,
746
- "row-data": e(o).purchaseOrder.items,
747
- key: e(o).purchaseOrder.items.map((M) => M.sku._id).join("."),
748
- "hide-footer": "",
749
- "page-size": e(o).purchaseOrder.items.length
750
- }, {
751
- "list-row": E((M) => [
752
- (A(), K(Ge, {
753
- row: M,
754
- key: e(o).purchaseOrder.items.map((U) => U.sku._id).join(".")
755
- }, {
756
- default: E((U) => [
757
- c(to, {
758
- row: M,
759
- "cell-by-col-id": U
760
- }, null, 8, ["row", "cell-by-col-id"])
761
- ]),
762
- _: 2
763
- }, 1032, ["row"]))
764
- ]),
765
- _: 1
766
- }, 8, ["column-defs", "row-data", "page-size"])),
767
- c(D, {
768
- "model-value": e(o).purchaseOrder.items.length,
769
- rules: [e(de)(1)]
770
- }, null, 8, ["model-value", "rules"])
771
- ])
772
- ];
773
- }),
774
- _: 1
775
- }, 8, ["disabled"]);
776
- };
777
- }
778
- }), po = { class: "flex items-center" }, co = { class: "fm-typo-en-title-md-800" }, fo = { class: "flex gap-4" }, yo = /* @__PURE__ */ Z({
779
- __name: "TransferTemplateDialog",
780
- props: {
781
- mode: {},
782
- modelValue: {},
783
- show: { type: Boolean }
784
- },
785
- emits: ["update:show", "submitted"],
786
- setup(v, { expose: _, emit: m }) {
787
- var h;
788
- const o = v, p = m, d = nt(), s = mt(), { t: u } = J(), x = je(o, "show");
789
- function T() {
790
- return {
791
- _id: "",
792
- name: "",
793
- purchaseOrder: {
794
- remark: void 0,
795
- ref: void 0,
796
- items: [],
797
- supplier: {
798
- _rev: void 0,
799
- email: void 0,
800
- internal: void 0,
801
- contactName: void 0,
802
- phoneNumber: void 0,
803
- registrationNumber: void 0,
804
- supplyItems: void 0,
805
- _id: "",
806
- name: "",
807
- address: {
808
- line2: void 0,
809
- line1: "",
810
- state: "",
811
- city: "",
812
- postcode: "",
813
- country: ""
814
- }
815
- }
816
- }
817
- };
818
- }
819
- const S = B(o.modelValue ?? T()), I = B(((h = o.modelValue) == null ? void 0 : h._id) ?? `${Math.random()}`);
820
- ce(
821
- () => o.show,
822
- (r) => {
823
- var y;
824
- r && (S.value = o.modelValue ?? T(), I.value = ((y = o.modelValue) == null ? void 0 : y._id) ?? `${Math.random()}`);
825
- }
826
- );
827
- const g = B(!1), f = R(() => {
828
- switch (o.mode) {
829
- case ee.READ:
830
- return "";
831
- case ee.CREATE:
832
- return u("inventory.transfer.template.create.title");
833
- case ee.UPDATE:
834
- return u("inventory.transfer.template.update.title");
835
- }
836
- return "";
837
- }), w = B();
838
- _({
839
- validateInputs: () => {
840
- var r, y;
841
- (y = (r = w.value) == null ? void 0 : r.validateInputs) == null || y.call(r);
842
- },
843
- resetInputsValidation: () => {
844
- var r, y;
845
- (y = (r = w.value) == null ? void 0 : r.resetInputsValidation) == null || y.call(r);
846
- },
847
- resetInputs: () => {
848
- var r, y;
849
- (y = (r = w.value) == null ? void 0 : r.resetInputs) == null || y.call(r);
850
- }
851
- });
852
- async function L() {
853
- var y, l;
854
- const r = S.value;
855
- if (r) {
856
- g.value = !0, (((y = r.purchaseOrder.supplier) == null ? void 0 : y.internal) === ne.enum.warehouse || ((l = r.purchaseOrder.supplier) == null ? void 0 : l.internal) === ne.enum.restaurant) && (r.purchaseOrder.items = r.purchaseOrder.items.map(
857
- ({ totalCost: n, ...i }) => i
858
- ));
859
- try {
860
- await d.createTemplate(r), await new Promise((n) => setTimeout(n, 1e3)), s.open({
861
- title: u("inventory.transfer.template.create.success"),
862
- message: u("inventory.transfer.template.create.successMessage"),
863
- type: "success"
864
- }), p("update:show", !1), p("submitted");
865
- } catch (n) {
866
- s.open({
867
- title: u("inventory.transfer.template.create.error"),
868
- message: u("inventory.transfer.template.create.errorMessage"),
869
- type: "error"
870
- }), console.error("Error in creating transfer template", n);
871
- } finally {
872
- g.value = !1;
873
- }
874
- }
875
- }
876
- async function q() {
877
- var y, l;
878
- const r = S.value;
879
- if (r) {
880
- g.value = !0, (((y = r.purchaseOrder.supplier) == null ? void 0 : y.internal) === ne.enum.warehouse || ((l = r.purchaseOrder.supplier) == null ? void 0 : l.internal) === ne.enum.restaurant) && (r.purchaseOrder.items = r.purchaseOrder.items.map(
881
- ({ totalCost: n, ...i }) => i
882
- ));
883
- try {
884
- await d.updateTemplate(r), await new Promise((n) => setTimeout(n, 1e3)), s.open({
885
- title: u("inventory.transfer.template.update.success"),
886
- message: u("inventory.transfer.template.update.successMessage"),
887
- type: "success"
888
- }), p("update:show", !1), p("submitted");
889
- } catch (n) {
890
- s.open({
891
- title: u("inventory.transfer.template.update.error"),
892
- message: u("inventory.transfer.template.update.errorMessage"),
893
- type: "error"
894
- }), console.error("Error in updating transfer template", n);
895
- } finally {
896
- g.value = !1;
897
- }
898
- }
899
- }
900
- function b() {
901
- switch (o.mode) {
902
- case ee.CREATE:
903
- return L();
904
- case ee.UPDATE:
905
- return q();
906
- }
907
- }
908
- function a() {
909
- var r, y;
910
- (y = (r = w.value) == null ? void 0 : r.validateInputs) == null || y.call(r);
911
- }
912
- return (r, y) => {
913
- const l = O("FmButton"), n = O("FmSideSheet");
914
- return A(), K(n, {
915
- modelValue: e(x),
916
- "onUpdate:modelValue": y[2] || (y[2] = (i) => Ee(x) ? x.value = i : null),
917
- "dismiss-away": "",
918
- "close-button": "",
919
- "max-width": 1200
920
- }, {
921
- "side-sheet-header": E(() => [
922
- t("div", po, [
923
- t("div", co, C(f.value), 1)
924
- ])
925
- ]),
926
- default: E(() => [
927
- (A(), K(mo, {
928
- class: "w-full",
929
- ref_key: "formRef",
930
- ref: w,
931
- onValidationSuccess: b,
932
- "model-value": S.value,
933
- "onUpdate:modelValue": y[0] || (y[0] = (i) => S.value = i),
934
- disabled: g.value,
935
- key: I.value
936
- }, null, 8, ["model-value", "disabled"]))
937
- ]),
938
- "side-sheet-footer": E(() => [
939
- t("div", fo, [
940
- c(l, {
941
- loading: g.value,
942
- label: e(u)("common.save"),
943
- onClick: a
944
- }, null, 8, ["loading", "label"]),
945
- c(l, {
946
- disabled: g.value,
947
- variant: "tertiary",
948
- label: e(u)("common.close"),
949
- onClick: y[1] || (y[1] = (i) => p("update:show", !1))
950
- }, null, 8, ["disabled", "label"])
951
- ])
952
- ]),
953
- _: 1
954
- }, 8, ["modelValue"]);
955
- };
956
- }
957
- }), vo = { class: "flex flex-col gap-16 w-full h-full overflow-y-auto" }, bo = { class: "flex justify-between" }, xo = { class: "fm-typo-en-body-lg-600" }, _o = { class: "fm-status-badge fm-status-badge-info-secondary" }, ho = { class: "flex flex-col gap-8" }, go = { class: "flex flex-col gap-4" }, Fo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, To = { class: "flex gap-1" }, wo = { class: "fm-typo-en-body-lg-600" }, ko = {
958
- key: 0,
959
- class: "flex flex-col gap-4"
960
- }, Mo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, So = { class: "fm-typo-en-body-lg-600" }, $o = {
961
- key: 1,
962
- class: "flex flex-col gap-4"
963
- }, Co = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oo = { class: "fm-typo-en-body-lg-600" }, Io = {
964
- key: 2,
965
- class: "flex flex-col gap-4"
966
- }, Vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ao = { class: "fm-typo-en-body-lg-600" }, Ro = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Do = { class: "flex flex-col gap-8" }, Po = { class: "fm-typo-en-body-lg-600" }, Lo = { class: "flex w-full gap-4" }, Bo = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Uo = { class: "fm-typo-en-body-lg-600 shrink-0" }, Eo = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, qo = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, No = {
967
- key: 0,
968
- class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
969
- }, zo = {
970
- key: 0,
971
- class: "flex gap-4 items-center"
972
- }, jo = { class: "flex flex-col gap-12" }, Ho = { class: "flex flex-col gap-8" }, Qo = { class: "flex gap-8 xs:flex-col" }, Go = /* @__PURE__ */ Z({
973
- __name: "TransferTemplateDetails",
974
- props: {
975
- template: {},
976
- show: { type: Boolean }
977
- },
978
- emits: ["update:show", "action:edit"],
979
- setup(v, { emit: _ }) {
980
- const m = v, o = _, p = Qe(), { t: d } = J(), s = R(() => {
981
- var g;
982
- return (g = m.template) == null ? void 0 : g.purchaseOrder;
983
- }), u = [
984
- { accessorKey: "name", header: () => "Name" },
985
- { accessorKey: "type", header: () => "Type" }
986
- ], x = B(""), T = R(
987
- () => {
988
- var g, f, w, L;
989
- return ((f = (g = s.value) == null ? void 0 : g.supplier) == null ? void 0 : f.internal) === "restaurant" || ((L = (w = s.value) == null ? void 0 : w.supplier) == null ? void 0 : L.internal) === "warehouse" ? N.TRANSFER : N.PURCHASE;
990
- }
991
- ), S = B(!0), I = je(m, "show");
992
- return (g, f) => {
993
- var y;
994
- const w = O("FmMenuDivider"), L = O("FmCard"), q = O("FmIcon"), b = O("FmTextField"), a = O("FmTable"), h = O("FmButton"), r = O("FmSideSheet");
995
- return A(), K(r, {
996
- header: e(d)("inventory.transfer.template.details.view", { template: (y = g.template) == null ? void 0 : y.name }),
997
- modelValue: e(I),
998
- "onUpdate:modelValue": f[2] || (f[2] = (l) => Ee(I) ? I.value = l : null),
999
- "dismiss-away": S.value,
1000
- "close-button": "",
1001
- "max-width": 500
1002
- }, {
1003
- default: E(() => {
1004
- var l, n;
1005
- return [
1006
- t("div", vo, [
1007
- t("div", null, [
1008
- c(L, {
1009
- variant: "outlined",
1010
- class: "flex flex-col gap-8 px-12 py-16"
1011
- }, {
1012
- default: E(() => {
1013
- var i, $, V, k, F, D, z;
1014
- return [
1015
- t("div", bo, [
1016
- t("div", xo, C(e(d)("inventory.transfer.template.details.templateSummary")), 1),
1017
- t("div", _o, C(e(d)(
1018
- `inventory.transfer.receiveRequest.details.type.${T.value.toLocaleLowerCase("en-US")}`
1019
- )), 1)
1020
- ]),
1021
- c(w),
1022
- t("div", ho, [
1023
- t("div", go, [
1024
- t("div", Fo, [
1025
- t("div", To, C(e(d)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1026
- ]),
1027
- t("div", wo, C(e(Ot)(((i = g.template) == null ? void 0 : i._id) ?? "")), 1)
1028
- ]),
1029
- (V = ($ = s.value) == null ? void 0 : $.supplier) != null && V.name ? (A(), Q("div", ko, [
1030
- t("div", Mo, C(e(d)("inventory.transfer.receiveRequest.details.from")), 1),
1031
- t("div", So, C((F = (k = s.value) == null ? void 0 : k.supplier) == null ? void 0 : F.name), 1)
1032
- ])) : Y("", !0),
1033
- (D = s.value) != null && D.ref ? (A(), Q("div", $o, [
1034
- t("div", Co, C(e(d)("inventory.transfer.receiveRequest.details.reference")), 1),
1035
- t("div", Oo, C(s.value.ref), 1)
1036
- ])) : Y("", !0),
1037
- (z = s.value) != null && z.remark ? (A(), Q("div", Io, [
1038
- t("div", Vo, C(e(d)("inventory.transfer.receiveRequest.details.remark")), 1),
1039
- t("div", Ao, C(s.value.remark), 1)
1040
- ])) : Y("", !0)
1041
- ])
1042
- ];
1043
- }),
1044
- _: 1
1045
- })
1046
- ]),
1047
- t("div", Ro, [
1048
- t("div", Do, [
1049
- t("div", Po, C(e(d)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1050
- (A(!0), Q(qe, null, Je(((l = s.value) == null ? void 0 : l.items) ?? [], (i) => (A(), Q("div", {
1051
- key: i.code,
1052
- class: "flex flex-col"
1053
- }, [
1054
- t("div", Lo, [
1055
- t("div", Bo, C(i.name), 1),
1056
- f[3] || (f[3] = t("div", { class: "flex-1 min-w-32" }, null, -1)),
1057
- t("div", Uo, C(e(rt)(i.quantity, i.sku.unit, i.measurement)), 1)
1058
- ]),
1059
- t("div", Eo, [
1060
- t("div", qo, C(i.code), 1),
1061
- i.totalCost && e(p).enableTotalCost ? (A(), Q("div", No, " (" + C(e(_t)(i.totalCost)) + ") ", 1)) : Y("", !0)
1062
- ]),
1063
- e(at)(i) ? (A(), Q("div", zo, [
1064
- c(q, {
1065
- name: "error",
1066
- color: "system-error-300",
1067
- size: "sm"
1068
- }),
1069
- f[4] || (f[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))
1070
- ])) : Y("", !0)
1071
- ]))), 128))
1072
- ])
1073
- ]),
1074
- f[6] || (f[6] = t("div", null, null, -1)),
1075
- f[7] || (f[7] = t("div", null, null, -1)),
1076
- t("div", jo, [
1077
- f[5] || (f[5] = t("div", { class: "flex flex-col" }, [
1078
- t("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
1079
- t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is only usable for the following locations. ")
1080
- ], -1)),
1081
- t("div", Ho, [
1082
- c(b, {
1083
- modelValue: x.value,
1084
- "onUpdate:modelValue": f[0] || (f[0] = (i) => x.value = i),
1085
- placeholder: "Filter locations",
1086
- "prepend-icon": "search"
1087
- }, null, 8, ["modelValue"]),
1088
- c(a, {
1089
- "hide-footer": "",
1090
- style: { height: "500px" },
1091
- "column-defs": u,
1092
- "search-value": x.value,
1093
- "row-data": ((n = m.template) == null ? void 0 : n.locations) ?? [{ name: "All locations" }]
1094
- }, null, 8, ["search-value", "row-data"])
1095
- ])
1096
- ])
1097
- ])
1098
- ];
1099
- }),
1100
- "side-sheet-footer": E(() => [
1101
- t("div", Qo, [
1102
- c(h, {
1103
- label: e(d)("common.edit"),
1104
- onClick: f[1] || (f[1] = (l) => o("action:edit")),
1105
- variant: "tertiary"
1106
- }, null, 8, ["label"])
1107
- ])
1108
- ]),
1109
- _: 1
1110
- }, 8, ["header", "modelValue", "dismiss-away"]);
1111
- };
1112
- }
1113
- }), Ko = { class: "flex-1 flex flex-col gap-8" }, Wo = { class: "flex flex-col" }, Zo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Jo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Xo = { class: "fm-typo-en-body-lg-400" }, Yo = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, es = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, gs = /* @__PURE__ */ Z({
1114
- __name: "TransferTemplateView",
1115
- setup(v) {
1116
- const { t: _ } = J(), { createTemplate: m, viewTemplate: o, importTemplates: p, exportTemplates: d } = Re(), { templateDialogProps: s, templateDetailsProps: u } = Pe(Re()), x = it(), { loading: T, templates: S } = Pe(x), I = B(!1), g = ot(), f = ze(), { breakpoints: w } = dt();
1117
- pe(x.fetchTemplates);
1118
- const L = R(
1119
- () => I.value || T.value || !f._currentLocation
1120
- ), q = R(() => S.value), b = B(""), a = R(() => w.value.xs || w.value.sm), h = R(() => a.value ? 10 : 20);
1121
- function r(n) {
1122
- switch (n) {
1123
- case De.Add:
1124
- return m();
1125
- case "refresh":
1126
- return x.fetchTemplates();
1127
- case "import":
1128
- return p();
1129
- case "export":
1130
- return d();
1131
- }
1132
- }
1133
- function y(n) {
1134
- return n;
1135
- }
1136
- const l = R(() => [
1137
- {
1138
- label: _("inventory.closing.template.create.title"),
1139
- value: De.Add,
1140
- isPrimary: !0,
1141
- prependIcon: "add"
1142
- },
1143
- {
1144
- label: "Refresh",
1145
- value: "refresh",
1146
- isPrimary: !1
1147
- },
1148
- {
1149
- label: "Import",
1150
- value: "import",
1151
- isPrimary: !1
1152
- },
1153
- {
1154
- label: "Export",
1155
- value: "export",
1156
- isPrimary: !1
1157
- }
1158
- ]);
1159
- return (n, i) => {
1160
- const $ = O("FmTable");
1161
- return A(), Q(qe, null, [
1162
- c(st, {
1163
- title: e(_)("inventory.transfer.template.title2"),
1164
- actions: l.value,
1165
- "onClick:action": r
1166
- }, {
1167
- default: E(() => {
1168
- var V;
1169
- return [
1170
- t("div", {
1171
- class: ie([
1172
- "flex flex-col gap-8 max-h-full",
1173
- {
1174
- "p-0": a.value,
1175
- "px-24 ": !a.value
1176
- }
1177
- ])
1178
- }, [
1179
- c(lt, {
1180
- searchable: "",
1181
- search: b.value,
1182
- "onUpdate:search": i[0] || (i[0] = (k) => b.value = k)
1183
- }, null, 8, ["search"]),
1184
- (A(), K($, {
1185
- style: Xe(e(g).tableHeight),
1186
- "column-defs": e(x).columnDefs,
1187
- "row-data": q.value,
1188
- "search-value": b.value,
1189
- loading: L.value,
1190
- key: (V = e(f)._currentLocation) == null ? void 0 : V.dbName,
1191
- onRowClick: i[1] || (i[1] = (k) => e(o)(k.original)),
1192
- "page-size": h.value
1193
- }, {
1194
- "list-row": E((k) => [
1195
- c(Ge, {
1196
- row: k,
1197
- onRowClick: (F) => e(o)(F)
1198
- }, {
1199
- default: E((F) => {
1200
- var D, z, H, M, U, X, fe, ye, te, ve, be, xe, _e, oe, he, ge, Fe, Te, we, ke, se, Me, Se, $e, Ce, le, Oe;
1201
- return [
1202
- t("div", Ko, [
1203
- t("div", Wo, [
1204
- t("div", Zo, [
1205
- c(e(j), {
1206
- render: (H = (z = (D = F._id) == null ? void 0 : D.column) == null ? void 0 : z.columnDef) == null ? void 0 : H.cell,
1207
- props: (U = (M = F._id) == null ? void 0 : M.getContext) == null ? void 0 : U.call(M)
1208
- }, null, 8, ["render", "props"])
1209
- ]),
1210
- t("div", Jo, [
1211
- c(e(j), {
1212
- render: (ye = (fe = (X = F.name) == null ? void 0 : X.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ye.cell,
1213
- props: (ve = (te = F.name) == null ? void 0 : te.getContext) == null ? void 0 : ve.call(te)
1214
- }, null, 8, ["render", "props"])
1215
- ]),
1216
- t("div", Xo, [
1217
- c(e(j), {
1218
- render: (_e = (xe = (be = F.supplier) == null ? void 0 : be.column) == null ? void 0 : xe.columnDef) == null ? void 0 : _e.cell,
1219
- props: (he = (oe = F.supplier) == null ? void 0 : oe.getContext) == null ? void 0 : he.call(oe)
1220
- }, null, 8, ["render", "props"])
1221
- ]),
1222
- t("div", null, C((ge = k.original.locations) != null && ge.length ? `Enabled for ${(Fe = k.original.locations) == null ? void 0 : Fe.length} outlets` : "Enabled for all outlets"), 1),
1223
- t("div", Yo, C(k.original.purchaseOrder.items.length ? k.original.purchaseOrder.items.map((Ke) => Ke.name).join(", ") : "No items"), 1),
1224
- t("div", es, [
1225
- c(e(j), {
1226
- render: (ke = (we = (Te = F.ref) == null ? void 0 : Te.column) == null ? void 0 : we.columnDef) == null ? void 0 : ke.cell,
1227
- props: (Me = (se = F.ref) == null ? void 0 : se.getContext) == null ? void 0 : Me.call(se)
1228
- }, null, 8, ["render", "props"])
1229
- ])
1230
- ]),
1231
- t("div", null, [
1232
- c(e(j), {
1233
- render: (Ce = ($e = (Se = F.type) == null ? void 0 : Se.column) == null ? void 0 : $e.columnDef) == null ? void 0 : Ce.cell,
1234
- props: (Oe = (le = F.type) == null ? void 0 : le.getContext) == null ? void 0 : Oe.call(le)
1235
- }, null, 8, ["render", "props"])
1236
- ])
1237
- ])
1238
- ];
1239
- }),
1240
- _: 2
1241
- }, 1032, ["row", "onRowClick"])
1242
- ]),
1243
- _: 1
1244
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1245
- ], 2)
1246
- ];
1247
- }),
1248
- _: 1
1249
- }, 8, ["title", "actions"]),
1250
- (A(), K(Ye, { to: "body" }, [
1251
- c(Go, et(tt(e(u))), null, 16),
1252
- c(yo, Ue(e(s), {
1253
- onSubmitted: i[2] || (i[2] = (V) => e(x).fetchTemplates())
1254
- }), null, 16)
1255
- ]))
1256
- ], 64);
1257
- };
1258
- }
1259
- });
1260
- export {
1261
- gs as default
1262
- };