@feedmepos/mf-inventory-portal 0.0.23-dev.4 → 0.0.23-dev.41

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