@feedmepos/mf-inventory-portal 0.0.25-dev.9 → 0.0.26-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.
- package/dist/{App-9zSE_swt.js → App-CipfIdtR.js} +71 -72
- package/dist/ApprovalView-IC33yBg7.js +143 -0
- package/dist/{BindingsDialog-eGbOIQkw.js → BindingsDialog-EN6Kbnu7.js} +2 -2
- package/dist/{BindingsPicker-CVXrd29s.js → BindingsPicker-DQ_LEoqq.js} +3 -3
- package/dist/BindingsTable-DGXpAyM4.js +120 -0
- package/dist/ClosingDraftView-DR9xsW9I.js +1348 -0
- package/dist/ClosingTemplateView-CC1T7ovX.js +1804 -0
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C9un0wCK.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CovzlB-s.js} +43 -43
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BRSABJnM.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BxEtsFXp.js} +29 -29
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DeRvrF7O.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-B8H6vFJ5.js} +1 -1
- package/dist/{IngredientGroupView-ZWCOAljO.js → IngredientGroupView-DRPbXH8d.js} +24 -24
- package/dist/IngredientsView-DSHcH30X.js +1731 -0
- package/dist/{IntegrationView-DO3Ambro.js → IntegrationView-BgACk-jP.js} +605 -669
- package/dist/{InventoryBindingForm-BjtFP29c.js → InventoryBindingForm-Fs-CHoT-.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CFMZ4VsK.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DVHQjAEC.js} +63 -63
- package/dist/{InventoryBindingSummary-C6DkVX-B.js → InventoryBindingSummary-CHWMtGtk.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-nb1t6u2V.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cu9V-8Cf.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BcMAXo4F.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CyVRCAqv.js} +12 -12
- package/dist/PublishView-CI7o5a0F.js +222 -0
- package/dist/{PurchaseOrderPrintPreview-_MCAsdw9.js → PurchaseOrderPrintPreview-CO4a811o.js} +1 -1
- package/dist/ReceiveRequestView-KH5wY5BA.js +2562 -0
- package/dist/{RecipeView-dmmjklwh.js → RecipeView-DxVbUxOG.js} +47 -47
- package/dist/StockView-CiHPAaYh.js +1840 -0
- package/dist/{SupplierView-CO5460uC.js → SupplierView-DPj87kld.js} +448 -461
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CfPPCFh8.js +1566 -0
- package/dist/TransferTemplateView-3W29v8hd.js +1420 -0
- package/dist/{UnitView-DbYzxCXF.js → UnitView-WCtNQFf8.js} +23 -23
- package/dist/{WarehouseView-BII4SEVC.js → WarehouseView-tgFFbQY7.js} +40 -40
- package/dist/api/bill.d.ts +12 -2
- package/dist/api/closing-draft.d.ts +1 -0
- package/dist/api/inventory.d.ts +8 -7
- package/dist/api/netsuite.d.ts +22 -5
- package/dist/api/purchase-order.d.ts +6 -1
- package/dist/api/stock.d.ts +1 -0
- package/dist/{app-IM1yJnE8.js → app-Ba80HxT3.js} +38448 -34777
- package/dist/app.d.ts +965 -120
- package/dist/app.js +1 -1
- package/dist/components/FmDroppableField.vue.d.ts +1 -1
- package/dist/components/FmMultiselectDialog.d.ts +23 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -1
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -1
- package/dist/{decimal-DQUpCN-B.js → decimal-DFqusYHB.js} +1 -1
- package/dist/{format-unit-display-COuIZISg.js → format-unit-display-Bsod5Ra6.js} +232 -238
- package/dist/helper/country.d.ts +1 -0
- package/dist/helper/fuzzy.d.ts +1 -1
- package/dist/helper/number.d.ts +1 -1
- package/dist/index-0ekVGPtB.js +12197 -0
- package/dist/index-ZAEVHtfa.js +84 -0
- package/dist/{stock-BJUTiXXk.js → stock-Cn6EQvTz.js} +29 -25
- package/dist/stores/feature.d.ts +11 -6
- package/dist/stores/helper/generate-backend-urls.d.ts +0 -1
- package/dist/stores/integration/index.d.ts +2 -0
- package/dist/stores/integration/netsuite.d.ts +22 -5
- package/dist/stores/inventory.d.ts +141 -8
- package/dist/stores/location.d.ts +0 -9
- package/dist/stores/stock.d.ts +5 -0
- package/dist/stores/warehouse.d.ts +4 -7
- package/dist/style.css +1 -1
- package/dist/{supplier-CM-qQVyI.js → supplier-P1gi71dg.js} +4 -4
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-Cn79xFNg.js → use-ingredient-select-dialog-BW5imbB5.js} +1 -1
- package/dist/{use-inventory-binding-dialog-zwOG19YV.js → use-inventory-binding-dialog-BYxb8nXg.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +0 -24
- package/dist/views/adjustment-template/wastage-template/table.d.ts +0 -24
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +92 -8
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +552 -48
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +1 -1
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -36
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -36
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +3 -3
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
- package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +4 -1
- package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +529 -489
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +8 -4
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +382 -2
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +5 -2
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1238 -972
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1080 -1003
- package/dist/views/receive-request/import/XilnexImportDialog.vue.d.ts +22 -0
- package/dist/views/receive-request/import/XilnexImportForm.vue.d.ts +17 -0
- package/dist/views/receive-request/import/XilnexResult.vue.d.ts +17 -0
- package/dist/views/receive-request/import/export.d.ts +14 -0
- package/dist/views/receive-request/import/props.d.ts +7 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +6 -1
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +220 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +0 -8
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +0 -1
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +7 -2
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +530 -530
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +530 -530
- package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +305 -0
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
- package/dist/vue-i18n-CjtRsQMl.js +2365 -0
- package/package.json +7 -7
- package/dist/ApprovalView-C2tg-wsm.js +0 -138
- package/dist/BindingsTable-CCsQEFnu.js +0 -145
- package/dist/ClosingDraftView-BI8b3CJ9.js +0 -1225
- package/dist/ClosingTemplateView-miJnC-ML.js +0 -1859
- package/dist/IngredientsView-5-pSX6y_.js +0 -1718
- package/dist/PublishView-DOMQdIJ7.js +0 -192
- package/dist/ReceiveRequestView-902hWGtz.js +0 -1877
- package/dist/StockView-C4lEYLXU.js +0 -7847
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-D6sZDCEY.js +0 -1328
- package/dist/TransferTemplateView-C9UwNTnY.js +0 -1371
- package/dist/components/FmAutocompleteTextField.vue.d.ts +0 -31
- package/dist/feature-DMBVVBsQ.js +0 -1005
- package/dist/index-CIrsMt6f.js +0 -35546
- package/dist/views/dev/components/AutocompleteTextField.vue.d.ts +0 -2
- package/dist/vue-i18n-CzPFJ9JY.js +0 -2365
|
@@ -0,0 +1,1420 @@
|
|
|
1
|
+
import { defineComponent as ee, onMounted as ve, computed as U, ref as Q, watch as be, inject as et, resolveComponent as A, openBlock as R, createElementBlock as j, createElementVNode as s, createVNode as p, withCtx as N, renderSlot as Re, withDirectives as Ae, normalizeClass as Y, vModelText as Pe, reactive as tt, h as J, toDisplayString as V, unref as t, createCommentVNode as oe, Fragment as _e, renderList as ze, normalizeStyle as He, createBlock as X, mergeProps as Qe, isRef as je, Teleport as st, normalizeProps as ot, guardReactiveProps as nt } from "vue";
|
|
2
|
+
import { H as We, az as ce, t as Ue, I as lt, aA as at, aB as rt, j as Z, aC as it, b as ut, a as Ge, a0 as Le, m as fe, Q as me, L as ue, A as ye, M as dt, c as pe, G as K, u as Ke, ad as mt, W as pt, E as Ze, e as le, aD as de, aa as ct, a2 as ft, B as yt, i as Be, _ as vt, C as bt } from "./app-Ba80HxT3.js";
|
|
3
|
+
import { useI18n as ne } from "@feedmepos/mf-common";
|
|
4
|
+
import { P as G, a as _t, f as xt, t as ht, b as qe, u as gt } from "./format-unit-display-Bsod5Ra6.js";
|
|
5
|
+
import { components as se, useDialog as kt, useSnackbar as Tt, useProxiedModel as Je, useBreakpoints as wt } from "@feedmepos/ui-library";
|
|
6
|
+
import { defineStore as Ft, storeToRefs as Ee } from "pinia";
|
|
7
|
+
import { _ as It, b as St, F as Ct, a as $t } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BxEtsFXp.js";
|
|
8
|
+
import { c as Ot, u as Mt, _ as Dt } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CovzlB-s.js";
|
|
9
|
+
import { u as Vt } from "./supplier-P1gi71dg.js";
|
|
10
|
+
import { u as Rt } from "./use-ingredient-select-dialog-BW5imbB5.js";
|
|
11
|
+
const At = { class: "flex flex-col" }, Pt = { class: "flex flex-col" }, Ut = { class: "flex-1" }, Lt = { class: "flex items-center" }, Bt = { class: "flex-1" }, qt = { class: "flex-1" }, Et = /* @__PURE__ */ ee({
|
|
12
|
+
__name: "FmMinMaxInput",
|
|
13
|
+
props: {
|
|
14
|
+
rules: {},
|
|
15
|
+
label: {},
|
|
16
|
+
minPlaceholder: {},
|
|
17
|
+
maxPlaceholder: {},
|
|
18
|
+
modelValue: {},
|
|
19
|
+
precision: {},
|
|
20
|
+
minLength: {},
|
|
21
|
+
maxLength: {},
|
|
22
|
+
inputmode: {},
|
|
23
|
+
type: {},
|
|
24
|
+
readonly: { type: Boolean },
|
|
25
|
+
labelMark: {},
|
|
26
|
+
prependIcon: {},
|
|
27
|
+
appendIcon: {},
|
|
28
|
+
showValidBorder: { type: Boolean },
|
|
29
|
+
labelInfo: {},
|
|
30
|
+
showWordCount: { type: Boolean },
|
|
31
|
+
invalid: { type: Boolean },
|
|
32
|
+
autofocus: { type: Boolean },
|
|
33
|
+
formatter: { type: Function },
|
|
34
|
+
decimal: {},
|
|
35
|
+
datalist: {},
|
|
36
|
+
shiftDatalist: { type: Boolean },
|
|
37
|
+
datalistMaxHeight: {},
|
|
38
|
+
datalistMinHeight: {},
|
|
39
|
+
offsetDatalist: {},
|
|
40
|
+
datalistPlacement: {},
|
|
41
|
+
datalistZIndex: {},
|
|
42
|
+
datalistWidth: {},
|
|
43
|
+
disabled: { type: Boolean },
|
|
44
|
+
focused: { type: Boolean },
|
|
45
|
+
helperText: {},
|
|
46
|
+
helperState: {}
|
|
47
|
+
},
|
|
48
|
+
setup(m) {
|
|
49
|
+
const c = m, v = We("modelValue"), e = lt();
|
|
50
|
+
ve(() => {
|
|
51
|
+
const { min: y, max: d } = v ?? {};
|
|
52
|
+
if (!(!y || !d) && y.precision !== d.precision) {
|
|
53
|
+
const k = Math.max(y.precision, d.precision), a = ce(y, k), f = ce(d, k);
|
|
54
|
+
v.min = a, v.max = f;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const l = U(() => {
|
|
58
|
+
const { min: y, max: d } = v ?? {};
|
|
59
|
+
return Math.max((y == null ? void 0 : y.precision) ?? 0, (d == null ? void 0 : d.precision) ?? 0, c.precision ?? 0);
|
|
60
|
+
}), g = (y) => {
|
|
61
|
+
if (!y) return "";
|
|
62
|
+
const d = at(y), k = l.value, a = ce(d, k);
|
|
63
|
+
return rt(
|
|
64
|
+
+Z(a),
|
|
65
|
+
a.precision
|
|
66
|
+
);
|
|
67
|
+
}, b = Q(g(v.min)), i = Q(g(v.max));
|
|
68
|
+
be([b, i], ([y, d]) => {
|
|
69
|
+
const k = v ?? {}, a = e(y), f = e(d), C = l.value;
|
|
70
|
+
if (y !== "" && a === !0) {
|
|
71
|
+
const $ = Ue(+y, C);
|
|
72
|
+
k.min = $;
|
|
73
|
+
} else
|
|
74
|
+
k.min = null;
|
|
75
|
+
if (d !== "" && f === !0) {
|
|
76
|
+
const $ = Ue(+d, C);
|
|
77
|
+
k.max = $;
|
|
78
|
+
} else
|
|
79
|
+
k.max = null;
|
|
80
|
+
v.min = k.min, v.max = k.max;
|
|
81
|
+
});
|
|
82
|
+
const o = Symbol.for("fm:form-state"), u = et(o, null), _ = U(() => c.disabled ?? (u == null ? void 0 : u.getDisabled()) ?? !1), P = Q(), I = Q(), x = Q(!1), S = Q(!1), D = U(() => x.value || S.value), W = U(() => [...[
|
|
83
|
+
function() {
|
|
84
|
+
return typeof e(b.value) == "string" || typeof e(i.value) == "string" ? "Must be a number" : !0;
|
|
85
|
+
},
|
|
86
|
+
function(k) {
|
|
87
|
+
return !k || !k.min || !k.max ? !0 : +Z(k.min) > +Z(k.max) ? "Min must be less than or equal to max" : !0;
|
|
88
|
+
}
|
|
89
|
+
], ...c.rules ?? []]);
|
|
90
|
+
return (y, d) => {
|
|
91
|
+
const k = A("FmLabel"), a = A("FmField"), f = A("FmFormGroup");
|
|
92
|
+
return R(), j("div", At, [
|
|
93
|
+
s("div", Pt, [
|
|
94
|
+
s("div", Ut, [
|
|
95
|
+
p(k, {
|
|
96
|
+
label: y.label,
|
|
97
|
+
disabled: y.disabled,
|
|
98
|
+
required: y.labelMark === "required",
|
|
99
|
+
optional: y.labelMark === "optional"
|
|
100
|
+
}, null, 8, ["label", "disabled", "required", "optional"])
|
|
101
|
+
]),
|
|
102
|
+
p(a, { focused: D.value }, {
|
|
103
|
+
default: N(() => [
|
|
104
|
+
s("div", Lt, [
|
|
105
|
+
Re(y.$slots, "prepend"),
|
|
106
|
+
d[6] || (d[6] = s("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
|
|
107
|
+
s("div", Bt, [
|
|
108
|
+
Ae(s("input", {
|
|
109
|
+
type: "text",
|
|
110
|
+
ref_key: "minInputRef",
|
|
111
|
+
ref: P,
|
|
112
|
+
onFocus: d[0] || (d[0] = () => x.value = !0),
|
|
113
|
+
onBlur: d[1] || (d[1] = () => x.value = !1),
|
|
114
|
+
"onUpdate:modelValue": d[2] || (d[2] = (C) => b.value = C),
|
|
115
|
+
class: Y({
|
|
116
|
+
"fm-text-field--input fm-typo-en-body-lg-400": !0,
|
|
117
|
+
"text-fm-color-typo-primary": !_.value,
|
|
118
|
+
"text-fm-color-typo-disabled": _.value
|
|
119
|
+
})
|
|
120
|
+
}, null, 34), [
|
|
121
|
+
[Pe, b.value]
|
|
122
|
+
])
|
|
123
|
+
]),
|
|
124
|
+
d[7] || (d[7] = s("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
|
|
125
|
+
d[8] || (d[8] = s("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
|
|
126
|
+
s("div", qt, [
|
|
127
|
+
Ae(s("input", {
|
|
128
|
+
type: "text",
|
|
129
|
+
ref_key: "maxInputRef",
|
|
130
|
+
ref: I,
|
|
131
|
+
onFocus: d[3] || (d[3] = () => S.value = !0),
|
|
132
|
+
onBlur: d[4] || (d[4] = () => S.value = !1),
|
|
133
|
+
"onUpdate:modelValue": d[5] || (d[5] = (C) => i.value = C),
|
|
134
|
+
class: Y({
|
|
135
|
+
"fm-text-field--input fm-typo-en-body-lg-400": !0,
|
|
136
|
+
"text-fm-color-typo-primary": !_.value,
|
|
137
|
+
"text-fm-color-typo-disabled": _.value
|
|
138
|
+
})
|
|
139
|
+
}, null, 34), [
|
|
140
|
+
[Pe, i.value]
|
|
141
|
+
])
|
|
142
|
+
]),
|
|
143
|
+
Re(y.$slots, "append")
|
|
144
|
+
])
|
|
145
|
+
]),
|
|
146
|
+
_: 3
|
|
147
|
+
}, 8, ["focused"])
|
|
148
|
+
]),
|
|
149
|
+
p(f, {
|
|
150
|
+
class: "flex-1",
|
|
151
|
+
"model-value": y.modelValue,
|
|
152
|
+
info: y.labelInfo,
|
|
153
|
+
rules: W.value,
|
|
154
|
+
"helper-text": y.helperText,
|
|
155
|
+
"helper-state": y.helperState
|
|
156
|
+
}, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
|
|
157
|
+
]);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
function Nt({ min: m, max: c } = { min: !0, max: !0 }) {
|
|
162
|
+
return function(e) {
|
|
163
|
+
return !e || !e.min && m != !1 || !e.max && c != !1 ? "Required" : !0;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function zt(m, c) {
|
|
167
|
+
return function(e) {
|
|
168
|
+
return !e || !e.min || !e.max ? !0 : +Z(e.min) < m ? `Must be between ${m} and ${c}` : +Z(e.max) > c ? `Must be between ${m} and ${c}` : !0;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function Ht(m) {
|
|
172
|
+
const c = it(m), v = Z(m);
|
|
173
|
+
return function(l) {
|
|
174
|
+
const g = !(l != null && l.min) || c(l.min) === !0, b = !(l != null && l.max) || c(l.max) === !0;
|
|
175
|
+
return !g && !b ? `Min & max must be a multiple of ${v}` : g ? b ? !0 : `Max must be a multiple of ${v}` : `Min must be a multiple of ${v}`;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const Xe = Ft("transfer-template-helper", () => {
|
|
179
|
+
const m = ut();
|
|
180
|
+
function c(v, e, l, g, b) {
|
|
181
|
+
var o;
|
|
182
|
+
if (!l) {
|
|
183
|
+
b == null || b("Unit is not valid");
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
let i = v.code;
|
|
187
|
+
if (m.isEnabled) {
|
|
188
|
+
const u = m.getItemPKTCode(e, (o = l.measurement) == null ? void 0 : o.id);
|
|
189
|
+
u && (i = u);
|
|
190
|
+
}
|
|
191
|
+
g({
|
|
192
|
+
...v,
|
|
193
|
+
quantity: l.amount,
|
|
194
|
+
measurement: l.measurement ?? null,
|
|
195
|
+
code: i
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
validateUnitInput: c
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
var H = /* @__PURE__ */ ((m) => (m.Code = "Code", m.Name = "Name", m.DefaultAmount = "DefaultAmount", m.Limit = "Limit", m.Step = "Step", m.Cost = "Cost", m.Delete = "Delete", m))(H || {});
|
|
203
|
+
const Ne = Xe();
|
|
204
|
+
function Qt(m) {
|
|
205
|
+
const { t: c } = ne(), v = Ge(), e = pe(), l = tt({});
|
|
206
|
+
ve(() => {
|
|
207
|
+
for (const i of m.items) {
|
|
208
|
+
if (!i.totalCost)
|
|
209
|
+
continue;
|
|
210
|
+
const o = Ot(i.sku, i.quantity, i.measurement, {
|
|
211
|
+
supplier: m.supplier
|
|
212
|
+
}), u = i.totalCost ?? Le.reset();
|
|
213
|
+
o ? l[i.sku._id] = o.amount !== u.amount || o.precision !== u.precision : l[i.sku._id] = !0;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const g = [
|
|
217
|
+
{
|
|
218
|
+
id: "Code",
|
|
219
|
+
header: () => c("inventory.transfer.form.items.table.Code"),
|
|
220
|
+
accessorKey: "code",
|
|
221
|
+
size: 180,
|
|
222
|
+
cell(i) {
|
|
223
|
+
const o = i.row.original;
|
|
224
|
+
return J(se.FmTextField, {
|
|
225
|
+
modelValue: o.code,
|
|
226
|
+
"onUpdate:modelValue": (u) => {
|
|
227
|
+
m.updateItem({
|
|
228
|
+
...o,
|
|
229
|
+
code: u
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
key: o.sku._id,
|
|
233
|
+
rules: [fe()],
|
|
234
|
+
labelMark: "required"
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
enableSorting: !1
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "Name",
|
|
241
|
+
header: () => c("inventory.transfer.form.items.table.Name"),
|
|
242
|
+
minSize: 300,
|
|
243
|
+
cell(i) {
|
|
244
|
+
const o = i.row.original;
|
|
245
|
+
return J(se.FmTextField, {
|
|
246
|
+
modelValue: o.name,
|
|
247
|
+
"onUpdate:modelValue": (u) => {
|
|
248
|
+
m.updateItem({
|
|
249
|
+
...o,
|
|
250
|
+
name: u
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
key: o.sku._id,
|
|
254
|
+
rules: [fe()],
|
|
255
|
+
labelMark: "required"
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
enableSorting: !1
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
id: "DefaultAmount",
|
|
262
|
+
header: () => c("inventory.transfer.form.items.table.DefaultAmount"),
|
|
263
|
+
minSize: 200,
|
|
264
|
+
cell(i) {
|
|
265
|
+
var x;
|
|
266
|
+
const o = i.row.original, u = v.skuById[o.sku._id], _ = v.unitById[(x = u.unit) == null ? void 0 : x._id], P = _.measurements.find((S) => {
|
|
267
|
+
var D;
|
|
268
|
+
return ((D = o.measurement) == null ? void 0 : D.id) === S.id;
|
|
269
|
+
}), I = o.sku.unit._id !== u.unit._id || !_ || o.measurement && !P;
|
|
270
|
+
return J(It, {
|
|
271
|
+
style: {
|
|
272
|
+
flex: "1 1 0%"
|
|
273
|
+
},
|
|
274
|
+
modelValue: {
|
|
275
|
+
amount: o.quantity ?? { amount: 1, precision: 0 },
|
|
276
|
+
// NOTE: leave this reading from row.sku.unit and row.measurement instead,
|
|
277
|
+
measurement: o.measurement ?? (o.sku.unit._id !== u.unit._id ? { ...o.sku.unit, id: "", conversion: { amount: 1, precision: 0 } } : null)
|
|
278
|
+
},
|
|
279
|
+
disabled: m.disabled,
|
|
280
|
+
key: o.sku._id,
|
|
281
|
+
unit: _,
|
|
282
|
+
"onUpdate:modelValue": (S) => {
|
|
283
|
+
Ne.validateUnitInput(
|
|
284
|
+
o,
|
|
285
|
+
u,
|
|
286
|
+
S,
|
|
287
|
+
(D) => {
|
|
288
|
+
m.updateItem({
|
|
289
|
+
...o,
|
|
290
|
+
code: D.code,
|
|
291
|
+
sku: u,
|
|
292
|
+
quantity: D.quantity,
|
|
293
|
+
measurement: D.measurement
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
},
|
|
298
|
+
rules: [
|
|
299
|
+
St(o.quantityStep),
|
|
300
|
+
...+Z(o.quantity) ? [
|
|
301
|
+
Ct(
|
|
302
|
+
+Z(
|
|
303
|
+
o.minimumQuantity ?? {
|
|
304
|
+
amount: 1,
|
|
305
|
+
// NOTE: leave this reading from row.sku.unit and row.measurement instead,
|
|
306
|
+
precision: me(o.sku.unit, o.measurement)
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
)
|
|
310
|
+
] : [],
|
|
311
|
+
$t(
|
|
312
|
+
o.maximumQuantity ? +Z(o.maximumQuantity) : 1 / 0
|
|
313
|
+
),
|
|
314
|
+
function(D) {
|
|
315
|
+
return I ? "This item is no longer valid due to change in unit. Please reapply unit." : !0;
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
applyDefaultRules: !0
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
enableSorting: !1
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "Limit",
|
|
325
|
+
header: () => "Limit",
|
|
326
|
+
// TODO: i18n,
|
|
327
|
+
minSize: 280,
|
|
328
|
+
cell(i) {
|
|
329
|
+
const o = i.row.original;
|
|
330
|
+
return J(Et, {
|
|
331
|
+
style: {
|
|
332
|
+
flex: "1 1 0%"
|
|
333
|
+
},
|
|
334
|
+
modelValue: {
|
|
335
|
+
min: o.minimumQuantity,
|
|
336
|
+
max: o.maximumQuantity
|
|
337
|
+
},
|
|
338
|
+
disabled: m.disabled,
|
|
339
|
+
key: o.sku._id,
|
|
340
|
+
unit: o.sku.unit,
|
|
341
|
+
"onUpdate:modelValue": (u) => {
|
|
342
|
+
const _ = { ...o };
|
|
343
|
+
u != null && u.min ? _.minimumQuantity = u.min : _.minimumQuantity = null, u != null && u.max ? _.maximumQuantity = u.max : _.maximumQuantity = null, m.updateItem(_);
|
|
344
|
+
},
|
|
345
|
+
rules: [
|
|
346
|
+
Nt({ max: !1 }),
|
|
347
|
+
Ht(o.quantityStep),
|
|
348
|
+
zt(
|
|
349
|
+
+Z({
|
|
350
|
+
amount: 0,
|
|
351
|
+
precision: me(o.sku.unit, o.measurement)
|
|
352
|
+
}),
|
|
353
|
+
1 / 0
|
|
354
|
+
)
|
|
355
|
+
],
|
|
356
|
+
disableUnit: !0,
|
|
357
|
+
applyDefaultRules: !0
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
id: "Step",
|
|
363
|
+
header: () => c("inventory.transfer.form.items.table.Step"),
|
|
364
|
+
minSize: 100,
|
|
365
|
+
cell(i) {
|
|
366
|
+
const o = i.row.original;
|
|
367
|
+
return J(se.FmTextField, {
|
|
368
|
+
modelValue: Z(o.quantityStep ?? Le.reset(), !1),
|
|
369
|
+
key: o.sku._id,
|
|
370
|
+
"onUpdate:modelValue": (u) => {
|
|
371
|
+
m.updateItem({
|
|
372
|
+
...o,
|
|
373
|
+
quantityStep: ue(+u)
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
rules: [
|
|
377
|
+
ye({
|
|
378
|
+
amount: 1,
|
|
379
|
+
precision: me(o.sku.unit, o.measurement)
|
|
380
|
+
}),
|
|
381
|
+
dt(o.sku.unit, o.measurement)
|
|
382
|
+
]
|
|
383
|
+
});
|
|
384
|
+
},
|
|
385
|
+
enableSorting: !1
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
id: "Delete",
|
|
389
|
+
header: "",
|
|
390
|
+
cell(i) {
|
|
391
|
+
const o = i.row.original;
|
|
392
|
+
return J("div", { class: "flex items-center" }, [
|
|
393
|
+
e.usePurchaseOrderV2 ? J(
|
|
394
|
+
se.FmTooltip,
|
|
395
|
+
{
|
|
396
|
+
zIndex: 50,
|
|
397
|
+
placement: "left"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
default() {
|
|
401
|
+
return J(se.FmButton, {
|
|
402
|
+
key: o.sku._id,
|
|
403
|
+
type: "button",
|
|
404
|
+
icon: "add_circle",
|
|
405
|
+
variant: "tertiary",
|
|
406
|
+
size: "md",
|
|
407
|
+
disabled: m.disabled,
|
|
408
|
+
onClick: async () => {
|
|
409
|
+
const u = {
|
|
410
|
+
id: crypto.randomUUID(),
|
|
411
|
+
sku: o.sku,
|
|
412
|
+
code: o.sku.code,
|
|
413
|
+
name: o.sku.name,
|
|
414
|
+
quantity: ue(1),
|
|
415
|
+
quantityStep: ue(1),
|
|
416
|
+
minimumQuantity: ue(1)
|
|
417
|
+
};
|
|
418
|
+
Ne.validateUnitInput(
|
|
419
|
+
u,
|
|
420
|
+
o.sku,
|
|
421
|
+
{
|
|
422
|
+
amount: u.quantity,
|
|
423
|
+
measurement: null
|
|
424
|
+
},
|
|
425
|
+
(_) => {
|
|
426
|
+
u.code = _.code;
|
|
427
|
+
}
|
|
428
|
+
), m.duplicateItem(u);
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
},
|
|
432
|
+
content() {
|
|
433
|
+
return "Duplicate entry";
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
) : null,
|
|
437
|
+
J(se.FmButton, {
|
|
438
|
+
class: "delete-button",
|
|
439
|
+
key: o.sku._id,
|
|
440
|
+
type: "button",
|
|
441
|
+
icon: "delete",
|
|
442
|
+
variant: "tertiary",
|
|
443
|
+
size: "md",
|
|
444
|
+
disabled: m.disabled,
|
|
445
|
+
onClick: () => {
|
|
446
|
+
m.deleteItem(o);
|
|
447
|
+
}
|
|
448
|
+
})
|
|
449
|
+
]);
|
|
450
|
+
},
|
|
451
|
+
enableSorting: !1,
|
|
452
|
+
size: 40,
|
|
453
|
+
meta: {
|
|
454
|
+
cellClass: "",
|
|
455
|
+
headerClass: ""
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
];
|
|
459
|
+
return {
|
|
460
|
+
columnDefs: U(() => pe().enableTotalCost && m.transferType === G.PURCHASE ? g : g.filter((o) => o.id !== "Cost"))
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
const jt = { class: "flex flex-col gap-8 py-16" }, Wt = { class: "flex items-center" }, Gt = { class: "flex-1 flex gap-1 items-center" }, Kt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Zt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Jt = { class: "flex gap-8 w-full" }, Xt = { class: "flex-1 flex flex-col gap-4" }, Yt = { class: "flex-1 flex flex-col gap-4" }, es = {
|
|
464
|
+
key: 0,
|
|
465
|
+
class: "flex gap-8 w-full"
|
|
466
|
+
}, ts = { class: "flex-1 flex flex-col gap-4" }, ss = { class: "flex-1 flex flex-col gap-4" }, os = { class: "flex gap-8 w-full" }, ns = { class: "flex-1 flex flex-col gap-4" }, ls = /* @__PURE__ */ ee({
|
|
467
|
+
__name: "TransferTemplateItem",
|
|
468
|
+
props: {
|
|
469
|
+
cellByColId: {},
|
|
470
|
+
row: {}
|
|
471
|
+
},
|
|
472
|
+
setup(m) {
|
|
473
|
+
const { t: c } = ne();
|
|
474
|
+
function v(e) {
|
|
475
|
+
return e;
|
|
476
|
+
}
|
|
477
|
+
return (e, l) => {
|
|
478
|
+
var b, i, o, u, _, P, I, x, S, D, W, y, d, k, a, f, C, $, h, n, r, T, F, L, z, O, M, B, q, w;
|
|
479
|
+
const g = A("FmLabel");
|
|
480
|
+
return R(), j("div", jt, [
|
|
481
|
+
s("div", Wt, [
|
|
482
|
+
s("div", Gt, [
|
|
483
|
+
s("span", Kt, " (" + V(e.row.original.sku.code) + ") ", 1),
|
|
484
|
+
s("span", Zt, V(e.row.original.sku.name), 1)
|
|
485
|
+
]),
|
|
486
|
+
s("div", null, [
|
|
487
|
+
p(t(K), {
|
|
488
|
+
render: (o = (i = (b = e.cellByColId.Delete) == null ? void 0 : b.column) == null ? void 0 : i.columnDef) == null ? void 0 : o.cell,
|
|
489
|
+
props: (_ = (u = e.cellByColId.Delete) == null ? void 0 : u.getContext) == null ? void 0 : _.call(u)
|
|
490
|
+
}, null, 8, ["render", "props"])
|
|
491
|
+
])
|
|
492
|
+
]),
|
|
493
|
+
s("div", Jt, [
|
|
494
|
+
s("div", Xt, [
|
|
495
|
+
p(g, {
|
|
496
|
+
label: t(c)(`inventory.transfer.form.items.table.${t(H).Code}`)
|
|
497
|
+
}, null, 8, ["label"]),
|
|
498
|
+
p(t(K), {
|
|
499
|
+
render: (x = (I = (P = e.cellByColId[t(H).Code]) == null ? void 0 : P.column) == null ? void 0 : I.columnDef) == null ? void 0 : x.cell,
|
|
500
|
+
props: (D = (S = e.cellByColId[t(H).Code]) == null ? void 0 : S.getContext) == null ? void 0 : D.call(S)
|
|
501
|
+
}, null, 8, ["render", "props"]),
|
|
502
|
+
l[0] || (l[0] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
503
|
+
]),
|
|
504
|
+
s("div", Yt, [
|
|
505
|
+
p(g, {
|
|
506
|
+
label: t(c)(`inventory.transfer.form.items.table.${t(H).Name}`)
|
|
507
|
+
}, null, 8, ["label"]),
|
|
508
|
+
p(t(K), {
|
|
509
|
+
render: (d = (y = (W = e.cellByColId[t(H).Name]) == null ? void 0 : W.column) == null ? void 0 : y.columnDef) == null ? void 0 : d.cell,
|
|
510
|
+
props: (a = (k = e.cellByColId[t(H).Name]) == null ? void 0 : k.getContext) == null ? void 0 : a.call(k)
|
|
511
|
+
}, null, 8, ["render", "props"]),
|
|
512
|
+
l[1] || (l[1] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
513
|
+
])
|
|
514
|
+
]),
|
|
515
|
+
e.row.original ? (R(), j("div", es, [
|
|
516
|
+
s("div", ts, [
|
|
517
|
+
p(g, {
|
|
518
|
+
label: t(c)(`inventory.transfer.form.items.table.${t(H).DefaultAmount}`)
|
|
519
|
+
}, null, 8, ["label"]),
|
|
520
|
+
p(t(K), {
|
|
521
|
+
render: ($ = (C = (f = e.cellByColId[t(H).DefaultAmount]) == null ? void 0 : f.column) == null ? void 0 : C.columnDef) == null ? void 0 : $.cell,
|
|
522
|
+
props: (n = (h = e.cellByColId[t(H).DefaultAmount]) == null ? void 0 : h.getContext) == null ? void 0 : n.call(h)
|
|
523
|
+
}, null, 8, ["render", "props"]),
|
|
524
|
+
l[2] || (l[2] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
525
|
+
]),
|
|
526
|
+
s("div", ss, [
|
|
527
|
+
p(g, {
|
|
528
|
+
label: t(c)(`inventory.transfer.form.items.table.${t(H).Step}`)
|
|
529
|
+
}, null, 8, ["label"]),
|
|
530
|
+
p(t(K), {
|
|
531
|
+
render: (F = (T = (r = e.cellByColId[t(H).Step]) == null ? void 0 : r.column) == null ? void 0 : T.columnDef) == null ? void 0 : F.cell,
|
|
532
|
+
props: (z = (L = e.cellByColId[t(H).Step]) == null ? void 0 : L.getContext) == null ? void 0 : z.call(L)
|
|
533
|
+
}, null, 8, ["render", "props"]),
|
|
534
|
+
l[3] || (l[3] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
535
|
+
])
|
|
536
|
+
])) : oe("", !0),
|
|
537
|
+
s("div", os, [
|
|
538
|
+
s("div", ns, [
|
|
539
|
+
p(g, {
|
|
540
|
+
label: t(c)(`inventory.transfer.form.items.table.${t(H).Limit}`)
|
|
541
|
+
}, null, 8, ["label"]),
|
|
542
|
+
p(t(K), {
|
|
543
|
+
render: (B = (M = (O = e.cellByColId[t(H).Limit]) == null ? void 0 : O.column) == null ? void 0 : M.columnDef) == null ? void 0 : B.cell,
|
|
544
|
+
props: (w = (q = e.cellByColId[t(H).Limit]) == null ? void 0 : q.getContext) == null ? void 0 : w.call(q)
|
|
545
|
+
}, null, 8, ["render", "props"]),
|
|
546
|
+
l[4] || (l[4] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
547
|
+
])
|
|
548
|
+
])
|
|
549
|
+
]);
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
}), as = { class: "hover:bg-fm-color-opacity-sm" }, rs = { class: "fm-typo-en-body-md-400 line-clamp-2 w-full" }, is = /* @__PURE__ */ ee({
|
|
553
|
+
__name: "TransferTemplateItemTable",
|
|
554
|
+
props: {
|
|
555
|
+
row: {},
|
|
556
|
+
disabled: { type: Boolean }
|
|
557
|
+
},
|
|
558
|
+
emits: ["update:item"],
|
|
559
|
+
setup(m) {
|
|
560
|
+
function c(v) {
|
|
561
|
+
return v.column.columnDef.meta;
|
|
562
|
+
}
|
|
563
|
+
return (v, e) => (R(), j("tr", as, [
|
|
564
|
+
(R(!0), j(_e, null, ze(v.row.getVisibleCells(), (l) => {
|
|
565
|
+
var g, b, i, o, u;
|
|
566
|
+
return R(), j("td", {
|
|
567
|
+
key: l.id,
|
|
568
|
+
class: Y(["text-fm-color-typo-primary", ((g = c(l)) == null ? void 0 : g.cellClass) ?? "px-16"]),
|
|
569
|
+
style: He({
|
|
570
|
+
width: (b = c(l)) != null && b.width ? (i = c(l)) == null ? void 0 : i.width : l.column.getSize() !== 0 ? `${l.column.getSize()}px` : void 0,
|
|
571
|
+
maxWidth: (o = c(l)) == null ? void 0 : o.maxWidth,
|
|
572
|
+
textAlign: ((u = c(l)) == null ? void 0 : u.textAlign) ?? "left"
|
|
573
|
+
})
|
|
574
|
+
}, [
|
|
575
|
+
s("span", rs, [
|
|
576
|
+
p(t(K), {
|
|
577
|
+
props: l.getContext(),
|
|
578
|
+
render: l.column.columnDef.cell
|
|
579
|
+
}, null, 8, ["props", "render"])
|
|
580
|
+
])
|
|
581
|
+
], 6);
|
|
582
|
+
}), 128))
|
|
583
|
+
]));
|
|
584
|
+
}
|
|
585
|
+
}), us = { class: "flex flex-col gap-16" }, ds = { class: "flex flex-col gap-24" }, ms = { class: "flex flex-col gap-16" }, ps = { class: "flex items-center" }, cs = { class: "flex flex-col" }, fs = { class: "flex flex-col gap-16" }, ys = { class: "flex" }, vs = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, bs = /* @__PURE__ */ ee({
|
|
586
|
+
__name: "TransferTemplateForm",
|
|
587
|
+
props: {
|
|
588
|
+
modelValue: {},
|
|
589
|
+
disabled: { type: Boolean }
|
|
590
|
+
},
|
|
591
|
+
setup(m, { expose: c }) {
|
|
592
|
+
const v = m, e = We(), { t: l } = ne(), g = Ke(), b = Ge(), i = Vt(), o = pe(), u = Xe();
|
|
593
|
+
be(
|
|
594
|
+
() => v.modelValue,
|
|
595
|
+
(n) => {
|
|
596
|
+
console.log("TransferTemplateForm.model", n);
|
|
597
|
+
}
|
|
598
|
+
), g.watchLocation(async () => {
|
|
599
|
+
location && (e.purchaseOrder.supplier || (e.purchaseOrder.supplier = i.suppliers.find((n) => n) ?? e.purchaseOrder.supplier));
|
|
600
|
+
}), kt();
|
|
601
|
+
const _ = Mt(
|
|
602
|
+
() => e.purchaseOrder,
|
|
603
|
+
(n) => {
|
|
604
|
+
e.purchaseOrder = {
|
|
605
|
+
...e.purchaseOrder,
|
|
606
|
+
supplier: n.supplier ?? (e == null ? void 0 : e.purchaseOrder.supplier)
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
), P = U({
|
|
610
|
+
get() {
|
|
611
|
+
var n, r;
|
|
612
|
+
return typeof ((r = (n = e.purchaseOrder) == null ? void 0 : n.supplier) == null ? void 0 : r.internal) == "string" ? G.TRANSFER : G.PURCHASE;
|
|
613
|
+
},
|
|
614
|
+
set(n) {
|
|
615
|
+
var T, F;
|
|
616
|
+
const r = typeof ((F = (T = e.purchaseOrder) == null ? void 0 : T.supplier) == null ? void 0 : F.internal) == "string" ? G.TRANSFER : G.PURCHASE;
|
|
617
|
+
n !== r && (e.purchaseOrder.supplier = n === G.PURCHASE ? _.locationOptionsTypePurchase.value[0] : _.locationOptionsTypeTransfer.value[0]);
|
|
618
|
+
}
|
|
619
|
+
}), I = U(() => _.transferLocationOptions.value), x = U({
|
|
620
|
+
get() {
|
|
621
|
+
var n;
|
|
622
|
+
return (n = e.purchaseOrder.supplier) == null ? void 0 : n._id;
|
|
623
|
+
},
|
|
624
|
+
set(n) {
|
|
625
|
+
_.transferLocationModel.value = n;
|
|
626
|
+
}
|
|
627
|
+
}), {
|
|
628
|
+
promptSelectLocations: S,
|
|
629
|
+
columnDefs: D,
|
|
630
|
+
rowData: W
|
|
631
|
+
} = mt({
|
|
632
|
+
getLocations() {
|
|
633
|
+
return e.locations;
|
|
634
|
+
},
|
|
635
|
+
setLocations(n) {
|
|
636
|
+
e.locations = n;
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
function y() {
|
|
640
|
+
var n, r;
|
|
641
|
+
return (n = e.locations) != null && n.find((T) => {
|
|
642
|
+
var F, L;
|
|
643
|
+
return ((F = T.doc) == null ? void 0 : F._id) === ((L = e.purchaseOrder.supplier) == null ? void 0 : L._id);
|
|
644
|
+
}) ? `Location ${(r = e.purchaseOrder.supplier) == null ? void 0 : r.name} must be removed because template cannot be used to transfer to itself.` : !0;
|
|
645
|
+
}
|
|
646
|
+
const d = U({
|
|
647
|
+
get() {
|
|
648
|
+
return e.purchaseOrder.remark ?? void 0;
|
|
649
|
+
},
|
|
650
|
+
set(n) {
|
|
651
|
+
e.purchaseOrder.remark = n;
|
|
652
|
+
}
|
|
653
|
+
}), k = Q();
|
|
654
|
+
c({
|
|
655
|
+
validateInputs: () => {
|
|
656
|
+
var n, r;
|
|
657
|
+
(r = (n = k.value) == null ? void 0 : n.validateInputs) == null || r.call(n);
|
|
658
|
+
},
|
|
659
|
+
resetInputsValidation: () => {
|
|
660
|
+
var n, r;
|
|
661
|
+
(r = (n = k.value) == null ? void 0 : n.resetInputsValidation) == null || r.call(n);
|
|
662
|
+
},
|
|
663
|
+
resetInputs: () => {
|
|
664
|
+
var n, r;
|
|
665
|
+
(r = (n = k.value) == null ? void 0 : n.resetInputs) == null || r.call(n);
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
const a = U(() => ({
|
|
669
|
+
duplicateItem: (n) => {
|
|
670
|
+
e.purchaseOrder.items = [
|
|
671
|
+
...e.purchaseOrder.items,
|
|
672
|
+
{
|
|
673
|
+
...n
|
|
674
|
+
}
|
|
675
|
+
];
|
|
676
|
+
},
|
|
677
|
+
updateItem: (n) => {
|
|
678
|
+
let r = [];
|
|
679
|
+
n.id ? r = e.purchaseOrder.items.map((T) => T.id !== n.id ? T : n) : r = e.purchaseOrder.items.map((T) => T.sku._id !== n.sku._id ? T : n), e.purchaseOrder.items = r;
|
|
680
|
+
},
|
|
681
|
+
deleteItem: (n) => {
|
|
682
|
+
console.log(n.id);
|
|
683
|
+
let r = [];
|
|
684
|
+
n.id ? r = e.purchaseOrder.items.filter((T) => T.id !== n.id) : r = e.purchaseOrder.items.filter((T) => T.sku._id !== n.sku._id), e.purchaseOrder.items = r;
|
|
685
|
+
}
|
|
686
|
+
})), f = Qt({
|
|
687
|
+
duplicateItem: a.value.duplicateItem,
|
|
688
|
+
updateItem: a.value.updateItem,
|
|
689
|
+
deleteItem: a.value.deleteItem,
|
|
690
|
+
get supplier() {
|
|
691
|
+
return e.purchaseOrder.supplier;
|
|
692
|
+
},
|
|
693
|
+
get items() {
|
|
694
|
+
return e.purchaseOrder.items;
|
|
695
|
+
},
|
|
696
|
+
get transferType() {
|
|
697
|
+
return G.PURCHASE;
|
|
698
|
+
},
|
|
699
|
+
get disabled() {
|
|
700
|
+
return v.disabled;
|
|
701
|
+
}
|
|
702
|
+
}), C = U(() => f.columnDefs.value), { promptSelectIngredients: $ } = Rt();
|
|
703
|
+
async function h() {
|
|
704
|
+
const r = b.skus.map((O) => ({
|
|
705
|
+
label: O.name,
|
|
706
|
+
sublabel: O.code,
|
|
707
|
+
value: O
|
|
708
|
+
})).filter((O) => {
|
|
709
|
+
var M;
|
|
710
|
+
return (M = e.purchaseOrder.items) == null ? void 0 : M.find((B) => B.sku._id === O.value._id);
|
|
711
|
+
}).map((O) => O.value), T = e.purchaseOrder.items ?? [], F = await $(
|
|
712
|
+
r.map((O) => O._id),
|
|
713
|
+
(O) => {
|
|
714
|
+
const M = b.skuById[O], B = T.find((E) => E.sku._id === M._id);
|
|
715
|
+
if (B)
|
|
716
|
+
return B;
|
|
717
|
+
const q = { amount: 1, precision: me(M.unit) };
|
|
718
|
+
let w = {
|
|
719
|
+
id: o.usePurchaseOrderV2 ? crypto.randomUUID() : void 0,
|
|
720
|
+
sku: M,
|
|
721
|
+
code: M.code,
|
|
722
|
+
name: M.name,
|
|
723
|
+
quantity: q,
|
|
724
|
+
minimumQuantity: q,
|
|
725
|
+
// maximumQuantity: adjustmentAmountMultiplyDecimal(minimumQuantity, {
|
|
726
|
+
// amount: 100,
|
|
727
|
+
// precision: 0
|
|
728
|
+
// }),
|
|
729
|
+
quantityStep: q
|
|
730
|
+
};
|
|
731
|
+
return u.validateUnitInput(
|
|
732
|
+
w,
|
|
733
|
+
M,
|
|
734
|
+
{
|
|
735
|
+
amount: q,
|
|
736
|
+
measurement: null
|
|
737
|
+
},
|
|
738
|
+
(E) => {
|
|
739
|
+
w.code = E.code;
|
|
740
|
+
}
|
|
741
|
+
), w;
|
|
742
|
+
}
|
|
743
|
+
);
|
|
744
|
+
if (!F) return;
|
|
745
|
+
const L = F.map((O) => O.sku._id), z = [];
|
|
746
|
+
for (const O of L) {
|
|
747
|
+
const M = T.filter((B) => B.sku._id === O);
|
|
748
|
+
if (M.length > 0)
|
|
749
|
+
z.push(...M);
|
|
750
|
+
else {
|
|
751
|
+
const B = F.find((q) => q.sku._id === O);
|
|
752
|
+
B && z.push(B);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
z.sort((O, M) => O.sku.code.localeCompare(M.sku.code)), e.purchaseOrder.items = z;
|
|
756
|
+
}
|
|
757
|
+
return (n, r) => {
|
|
758
|
+
const T = A("FmTextField"), F = A("FmSelect"), L = A("FmTextarea"), z = A("FmButton"), O = A("FmTable"), M = A("FmFormGroup"), B = A("FmForm");
|
|
759
|
+
return R(), X(B, {
|
|
760
|
+
ref_key: "formRef",
|
|
761
|
+
ref: k,
|
|
762
|
+
class: "flex flex-col gap-32",
|
|
763
|
+
disabled: n.disabled
|
|
764
|
+
}, {
|
|
765
|
+
default: N(() => {
|
|
766
|
+
var q;
|
|
767
|
+
return [
|
|
768
|
+
s("div", us, [
|
|
769
|
+
s("div", ds, [
|
|
770
|
+
p(T, {
|
|
771
|
+
label: t(l)("inventory.transfer.form.name"),
|
|
772
|
+
"label-mark": "required",
|
|
773
|
+
modelValue: t(e).name,
|
|
774
|
+
"onUpdate:modelValue": r[0] || (r[0] = (w) => t(e).name = w),
|
|
775
|
+
rules: [t(fe)()]
|
|
776
|
+
}, null, 8, ["label", "modelValue", "rules"]),
|
|
777
|
+
p(F, {
|
|
778
|
+
label: t(l)("inventory.transfer.form.type.title"),
|
|
779
|
+
"model-value": P.value,
|
|
780
|
+
"onUpdate:modelValue": r[1] || (r[1] = (w) => P.value = w),
|
|
781
|
+
items: [
|
|
782
|
+
{
|
|
783
|
+
label: t(l)("inventory.transfer.form.type.purchase"),
|
|
784
|
+
value: t(G).PURCHASE,
|
|
785
|
+
disabled: !t(_).locationOptionsTypePurchase.value.length,
|
|
786
|
+
sublabel: t(_).locationOptionsTypePurchase.value.length ? void 0 : t(l)("inventory.transfer.form.noSupplierAvailable")
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
label: t(l)("inventory.transfer.form.type.transfer"),
|
|
790
|
+
value: t(G).TRANSFER,
|
|
791
|
+
disabled: !t(_).locationOptionsTypeTransfer.value.length,
|
|
792
|
+
sublabel: t(_).locationOptionsTypeTransfer.value.length ? void 0 : t(l)("inventory.transfer.form.noLocationAvailable")
|
|
793
|
+
}
|
|
794
|
+
],
|
|
795
|
+
rules: [t(ye)(1)(I.value)]
|
|
796
|
+
}, {
|
|
797
|
+
default: N(() => [
|
|
798
|
+
s("span", {
|
|
799
|
+
class: Y([
|
|
800
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
801
|
+
n.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
802
|
+
])
|
|
803
|
+
}, V(t(pt)(P.value)), 3)
|
|
804
|
+
]),
|
|
805
|
+
_: 1
|
|
806
|
+
}, 8, ["label", "model-value", "items", "rules"]),
|
|
807
|
+
p(F, {
|
|
808
|
+
label: P.value === t(G).PURCHASE ? t(l)("inventory.transfer.form.purchaseFrom") : t(l)("inventory.transfer.form.transferFrom"),
|
|
809
|
+
modelValue: x.value,
|
|
810
|
+
"onUpdate:modelValue": r[2] || (r[2] = (w) => x.value = w),
|
|
811
|
+
items: I.value
|
|
812
|
+
}, {
|
|
813
|
+
"menu-wrapper": N((w) => {
|
|
814
|
+
var E;
|
|
815
|
+
return [
|
|
816
|
+
p(Dt, Qe(w, {
|
|
817
|
+
items: I.value,
|
|
818
|
+
"model-value": (E = n.modelValue.purchaseOrder.supplier) == null ? void 0 : E._id
|
|
819
|
+
}), null, 16, ["items", "model-value"])
|
|
820
|
+
];
|
|
821
|
+
}),
|
|
822
|
+
default: N(() => {
|
|
823
|
+
var w;
|
|
824
|
+
return [
|
|
825
|
+
s("span", {
|
|
826
|
+
class: Y([
|
|
827
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
828
|
+
n.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
829
|
+
])
|
|
830
|
+
}, V((w = I.value.find((E) => E.value === x.value)) == null ? void 0 : w.label), 3)
|
|
831
|
+
];
|
|
832
|
+
}),
|
|
833
|
+
_: 1
|
|
834
|
+
}, 8, ["label", "modelValue", "items"]),
|
|
835
|
+
p(T, {
|
|
836
|
+
label: t(l)("inventory.transfer.form.reference"),
|
|
837
|
+
"label-mark": "optional",
|
|
838
|
+
modelValue: t(e).purchaseOrder.ref,
|
|
839
|
+
"onUpdate:modelValue": r[3] || (r[3] = (w) => t(e).purchaseOrder.ref = w)
|
|
840
|
+
}, null, 8, ["label", "modelValue"]),
|
|
841
|
+
p(L, {
|
|
842
|
+
label: t(l)("inventory.transfer.form.remark"),
|
|
843
|
+
"label-mark": "optional",
|
|
844
|
+
"max-length": 240,
|
|
845
|
+
modelValue: d.value,
|
|
846
|
+
"onUpdate:modelValue": r[4] || (r[4] = (w) => d.value = w),
|
|
847
|
+
class: Y({ "text-fm-color-typo-disabled": n.disabled })
|
|
848
|
+
}, null, 8, ["label", "modelValue", "class"])
|
|
849
|
+
])
|
|
850
|
+
]),
|
|
851
|
+
s("div", ms, [
|
|
852
|
+
s("div", ps, [
|
|
853
|
+
r[8] || (r[8] = s("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
|
|
854
|
+
p(z, {
|
|
855
|
+
disabled: n.disabled,
|
|
856
|
+
label: "Select location",
|
|
857
|
+
"prepend-icon": "add",
|
|
858
|
+
variant: "plain",
|
|
859
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
860
|
+
onClick: t(S)
|
|
861
|
+
}, null, 8, ["disabled", "onClick"])
|
|
862
|
+
]),
|
|
863
|
+
p(O, {
|
|
864
|
+
"column-defs": t(D),
|
|
865
|
+
"row-data": t(W),
|
|
866
|
+
"shrink-at": 9999,
|
|
867
|
+
onRowClick: t(S),
|
|
868
|
+
"hide-footer": ""
|
|
869
|
+
}, null, 8, ["column-defs", "row-data", "onRowClick"]),
|
|
870
|
+
s("div", cs, [
|
|
871
|
+
p(M, {
|
|
872
|
+
"model-value": [
|
|
873
|
+
(q = v.modelValue.purchaseOrder.supplier) == null ? void 0 : q._id,
|
|
874
|
+
...v.modelValue.locations ?? []
|
|
875
|
+
].join(","),
|
|
876
|
+
rules: [y]
|
|
877
|
+
}, null, 8, ["model-value", "rules"])
|
|
878
|
+
])
|
|
879
|
+
]),
|
|
880
|
+
s("div", fs, [
|
|
881
|
+
s("div", ys, [
|
|
882
|
+
s("div", vs, V(t(l)("inventory.transfer.form.items.title")), 1),
|
|
883
|
+
p(z, {
|
|
884
|
+
disabled: n.disabled,
|
|
885
|
+
label: t(l)("inventory.transfer.form.items.addItem"),
|
|
886
|
+
"prepend-icon": "add",
|
|
887
|
+
variant: "plain",
|
|
888
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
889
|
+
onClick: r[5] || (r[5] = (w) => h()),
|
|
890
|
+
size: "md"
|
|
891
|
+
}, null, 8, ["disabled", "label"])
|
|
892
|
+
]),
|
|
893
|
+
(R(), X(O, {
|
|
894
|
+
"column-defs": C.value,
|
|
895
|
+
"row-data": t(e).purchaseOrder.items,
|
|
896
|
+
key: t(e).purchaseOrder.items.map((w) => w.sku._id).join("."),
|
|
897
|
+
"hide-footer": "",
|
|
898
|
+
"page-size": t(e).purchaseOrder.items.length
|
|
899
|
+
}, {
|
|
900
|
+
"table-row": N((w) => [
|
|
901
|
+
p(is, {
|
|
902
|
+
row: w,
|
|
903
|
+
"onUpdate:item": r[6] || (r[6] = (E) => a.value.updateItem(E)),
|
|
904
|
+
disabled: n.disabled
|
|
905
|
+
}, null, 8, ["row", "disabled"])
|
|
906
|
+
]),
|
|
907
|
+
"list-row": N((w) => [
|
|
908
|
+
(R(), X(Ze, {
|
|
909
|
+
row: w,
|
|
910
|
+
key: t(e).purchaseOrder.items.map((E) => E.sku._id).join(".")
|
|
911
|
+
}, {
|
|
912
|
+
default: N((E) => [
|
|
913
|
+
p(ls, {
|
|
914
|
+
row: w,
|
|
915
|
+
"cell-by-col-id": E,
|
|
916
|
+
"onUpdate:item": r[7] || (r[7] = (te) => a.value.updateItem(te)),
|
|
917
|
+
disabled: n.disabled
|
|
918
|
+
}, null, 8, ["row", "cell-by-col-id", "disabled"])
|
|
919
|
+
]),
|
|
920
|
+
_: 2
|
|
921
|
+
}, 1032, ["row"]))
|
|
922
|
+
]),
|
|
923
|
+
_: 1
|
|
924
|
+
}, 8, ["column-defs", "row-data", "page-size"])),
|
|
925
|
+
p(M, {
|
|
926
|
+
"model-value": t(e).purchaseOrder.items.length,
|
|
927
|
+
rules: [t(ye)(1)]
|
|
928
|
+
}, null, 8, ["model-value", "rules"])
|
|
929
|
+
])
|
|
930
|
+
];
|
|
931
|
+
}),
|
|
932
|
+
_: 1
|
|
933
|
+
}, 8, ["disabled"]);
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
}), _s = { class: "flex items-center" }, xs = { class: "fm-typo-en-title-md-800" }, hs = { class: "flex gap-4" }, gs = /* @__PURE__ */ ee({
|
|
937
|
+
__name: "TransferTemplateDialog",
|
|
938
|
+
props: {
|
|
939
|
+
mode: {},
|
|
940
|
+
modelValue: {},
|
|
941
|
+
show: { type: Boolean }
|
|
942
|
+
},
|
|
943
|
+
emits: ["update:show", "submitted"],
|
|
944
|
+
setup(m, { expose: c, emit: v }) {
|
|
945
|
+
var k;
|
|
946
|
+
const e = m, l = v, g = _t(), b = Tt(), { t: i } = ne(), o = Je(e, "show");
|
|
947
|
+
function u() {
|
|
948
|
+
return {
|
|
949
|
+
_id: "",
|
|
950
|
+
name: "",
|
|
951
|
+
purchaseOrder: {
|
|
952
|
+
remark: void 0,
|
|
953
|
+
ref: void 0,
|
|
954
|
+
items: [],
|
|
955
|
+
supplier: {
|
|
956
|
+
_rev: void 0,
|
|
957
|
+
email: void 0,
|
|
958
|
+
internal: void 0,
|
|
959
|
+
contactName: void 0,
|
|
960
|
+
phoneNumber: void 0,
|
|
961
|
+
registrationNumber: void 0,
|
|
962
|
+
supplyItems: void 0,
|
|
963
|
+
_id: "",
|
|
964
|
+
name: "",
|
|
965
|
+
address: {
|
|
966
|
+
line2: void 0,
|
|
967
|
+
line1: "",
|
|
968
|
+
state: "",
|
|
969
|
+
city: "",
|
|
970
|
+
postcode: "",
|
|
971
|
+
country: ""
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
const _ = Q(e.modelValue ?? u()), P = Q(((k = e.modelValue) == null ? void 0 : k._id) ?? `${Math.random()}`);
|
|
978
|
+
be(
|
|
979
|
+
() => e.show,
|
|
980
|
+
(a) => {
|
|
981
|
+
var f;
|
|
982
|
+
a && (_.value = e.modelValue ?? u(), P.value = ((f = e.modelValue) == null ? void 0 : f._id) ?? `${Math.random()}`);
|
|
983
|
+
}
|
|
984
|
+
);
|
|
985
|
+
const I = Q(!1), x = U(() => {
|
|
986
|
+
switch (e.mode) {
|
|
987
|
+
case le.READ:
|
|
988
|
+
return "";
|
|
989
|
+
case le.CREATE:
|
|
990
|
+
return i("inventory.transfer.template.create.title");
|
|
991
|
+
case le.UPDATE:
|
|
992
|
+
return i("inventory.transfer.template.update.title");
|
|
993
|
+
}
|
|
994
|
+
return "";
|
|
995
|
+
}), S = Q();
|
|
996
|
+
c({
|
|
997
|
+
validateInputs: () => {
|
|
998
|
+
var a, f;
|
|
999
|
+
(f = (a = S.value) == null ? void 0 : a.validateInputs) == null || f.call(a);
|
|
1000
|
+
},
|
|
1001
|
+
resetInputsValidation: () => {
|
|
1002
|
+
var a, f;
|
|
1003
|
+
(f = (a = S.value) == null ? void 0 : a.resetInputsValidation) == null || f.call(a);
|
|
1004
|
+
},
|
|
1005
|
+
resetInputs: () => {
|
|
1006
|
+
var a, f;
|
|
1007
|
+
(f = (a = S.value) == null ? void 0 : a.resetInputs) == null || f.call(a);
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
async function D() {
|
|
1011
|
+
var f, C;
|
|
1012
|
+
const a = _.value;
|
|
1013
|
+
if (a) {
|
|
1014
|
+
I.value = !0, (((f = a.purchaseOrder.supplier) == null ? void 0 : f.internal) === de.enum.warehouse || ((C = a.purchaseOrder.supplier) == null ? void 0 : C.internal) === de.enum.restaurant) && (a.purchaseOrder.items = a.purchaseOrder.items.map(
|
|
1015
|
+
({ totalCost: $, ...h }) => h
|
|
1016
|
+
));
|
|
1017
|
+
try {
|
|
1018
|
+
await g.createTemplate(a), await new Promise(($) => setTimeout($, 1e3)), b.open({
|
|
1019
|
+
title: i("inventory.transfer.template.create.success"),
|
|
1020
|
+
message: i("inventory.transfer.template.create.successMessage"),
|
|
1021
|
+
type: "success"
|
|
1022
|
+
}), l("update:show", !1), l("submitted");
|
|
1023
|
+
} catch ($) {
|
|
1024
|
+
b.open({
|
|
1025
|
+
title: i("inventory.transfer.template.create.error"),
|
|
1026
|
+
message: i("inventory.transfer.template.create.errorMessage"),
|
|
1027
|
+
type: "error"
|
|
1028
|
+
}), console.error("Error in creating transfer template", $);
|
|
1029
|
+
} finally {
|
|
1030
|
+
I.value = !1;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
async function W() {
|
|
1035
|
+
var f, C;
|
|
1036
|
+
const a = _.value;
|
|
1037
|
+
if (a) {
|
|
1038
|
+
I.value = !0, (((f = a.purchaseOrder.supplier) == null ? void 0 : f.internal) === de.enum.warehouse || ((C = a.purchaseOrder.supplier) == null ? void 0 : C.internal) === de.enum.restaurant) && (a.purchaseOrder.items = a.purchaseOrder.items.map(
|
|
1039
|
+
({ totalCost: $, ...h }) => h
|
|
1040
|
+
));
|
|
1041
|
+
try {
|
|
1042
|
+
await g.updateTemplate(a), await new Promise(($) => setTimeout($, 1e3)), b.open({
|
|
1043
|
+
title: i("inventory.transfer.template.update.success"),
|
|
1044
|
+
message: i("inventory.transfer.template.update.successMessage"),
|
|
1045
|
+
type: "success"
|
|
1046
|
+
}), l("update:show", !1), l("submitted");
|
|
1047
|
+
} catch ($) {
|
|
1048
|
+
b.open({
|
|
1049
|
+
title: i("inventory.transfer.template.update.error"),
|
|
1050
|
+
message: i("inventory.transfer.template.update.errorMessage"),
|
|
1051
|
+
type: "error"
|
|
1052
|
+
}), console.error("Error in updating transfer template", $);
|
|
1053
|
+
} finally {
|
|
1054
|
+
I.value = !1;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function y() {
|
|
1059
|
+
switch (e.mode) {
|
|
1060
|
+
case le.CREATE:
|
|
1061
|
+
return D();
|
|
1062
|
+
case le.UPDATE:
|
|
1063
|
+
return W();
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
function d() {
|
|
1067
|
+
var a, f;
|
|
1068
|
+
(f = (a = S.value) == null ? void 0 : a.validateInputs) == null || f.call(a);
|
|
1069
|
+
}
|
|
1070
|
+
return (a, f) => {
|
|
1071
|
+
const C = A("FmButton"), $ = A("FmSideSheet");
|
|
1072
|
+
return R(), X($, {
|
|
1073
|
+
modelValue: t(o),
|
|
1074
|
+
"onUpdate:modelValue": f[2] || (f[2] = (h) => je(o) ? o.value = h : null),
|
|
1075
|
+
"dismiss-away": "",
|
|
1076
|
+
"close-button": "",
|
|
1077
|
+
"max-width": 1200
|
|
1078
|
+
}, {
|
|
1079
|
+
"side-sheet-header": N(() => [
|
|
1080
|
+
s("div", _s, [
|
|
1081
|
+
s("div", xs, V(x.value), 1)
|
|
1082
|
+
])
|
|
1083
|
+
]),
|
|
1084
|
+
default: N(() => [
|
|
1085
|
+
(R(), X(bs, {
|
|
1086
|
+
class: "w-full",
|
|
1087
|
+
ref_key: "formRef",
|
|
1088
|
+
ref: S,
|
|
1089
|
+
onValidationSuccess: y,
|
|
1090
|
+
"model-value": _.value,
|
|
1091
|
+
"onUpdate:modelValue": f[0] || (f[0] = (h) => _.value = h),
|
|
1092
|
+
disabled: I.value,
|
|
1093
|
+
key: P.value
|
|
1094
|
+
}, null, 8, ["model-value", "disabled"]))
|
|
1095
|
+
]),
|
|
1096
|
+
"side-sheet-footer": N(() => [
|
|
1097
|
+
s("div", hs, [
|
|
1098
|
+
p(C, {
|
|
1099
|
+
loading: I.value,
|
|
1100
|
+
label: t(i)("common.save"),
|
|
1101
|
+
onClick: d
|
|
1102
|
+
}, null, 8, ["loading", "label"]),
|
|
1103
|
+
p(C, {
|
|
1104
|
+
disabled: I.value,
|
|
1105
|
+
variant: "tertiary",
|
|
1106
|
+
label: t(i)("common.close"),
|
|
1107
|
+
onClick: f[1] || (f[1] = (h) => l("update:show", !1))
|
|
1108
|
+
}, null, 8, ["disabled", "label"])
|
|
1109
|
+
])
|
|
1110
|
+
]),
|
|
1111
|
+
_: 1
|
|
1112
|
+
}, 8, ["modelValue"]);
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
}), ks = { class: "flex flex-col gap-16 w-full h-full overflow-y-auto" }, Ts = { class: "flex justify-between" }, ws = { class: "fm-typo-en-body-lg-600" }, Fs = { class: "fm-status-badge fm-status-badge-info-secondary" }, Is = { class: "flex flex-col gap-8" }, Ss = { class: "flex flex-col gap-4" }, Cs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, $s = { class: "flex gap-1" }, Os = { class: "fm-typo-en-body-lg-600" }, Ms = {
|
|
1116
|
+
key: 0,
|
|
1117
|
+
class: "flex flex-col gap-4"
|
|
1118
|
+
}, Ds = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vs = { class: "fm-typo-en-body-lg-600" }, Rs = {
|
|
1119
|
+
key: 1,
|
|
1120
|
+
class: "flex flex-col gap-4"
|
|
1121
|
+
}, As = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ps = { class: "fm-typo-en-body-lg-600" }, Us = {
|
|
1122
|
+
key: 2,
|
|
1123
|
+
class: "flex flex-col gap-4"
|
|
1124
|
+
}, Ls = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bs = { class: "fm-typo-en-body-lg-600" }, qs = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Es = { class: "flex flex-col gap-8" }, Ns = { class: "fm-typo-en-body-lg-600" }, zs = { class: "flex w-full gap-4" }, Hs = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Qs = { class: "fm-typo-en-body-lg-600 shrink-0" }, js = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Ws = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Gs = {
|
|
1125
|
+
key: 0,
|
|
1126
|
+
class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1127
|
+
}, Ks = {
|
|
1128
|
+
key: 0,
|
|
1129
|
+
class: "flex gap-4 items-center"
|
|
1130
|
+
}, Zs = { class: "flex flex-col gap-12" }, Js = { class: "flex flex-col gap-8" }, Xs = { class: "flex gap-8 xs:flex-col" }, Ys = /* @__PURE__ */ ee({
|
|
1131
|
+
__name: "TransferTemplateDetails",
|
|
1132
|
+
props: {
|
|
1133
|
+
template: {},
|
|
1134
|
+
show: { type: Boolean }
|
|
1135
|
+
},
|
|
1136
|
+
emits: ["update:show", "action:edit"],
|
|
1137
|
+
setup(m, { emit: c }) {
|
|
1138
|
+
const v = m, e = c, l = pe(), { t: g } = ne(), b = U(() => {
|
|
1139
|
+
var I;
|
|
1140
|
+
return (I = v.template) == null ? void 0 : I.purchaseOrder;
|
|
1141
|
+
}), i = [
|
|
1142
|
+
{ accessorKey: "name", header: () => "Name" },
|
|
1143
|
+
{ accessorKey: "type", header: () => "Type" }
|
|
1144
|
+
], o = Q(""), u = U(
|
|
1145
|
+
() => {
|
|
1146
|
+
var I, x, S, D;
|
|
1147
|
+
return ((x = (I = b.value) == null ? void 0 : I.supplier) == null ? void 0 : x.internal) === "restaurant" || ((D = (S = b.value) == null ? void 0 : S.supplier) == null ? void 0 : D.internal) === "warehouse" ? G.TRANSFER : G.PURCHASE;
|
|
1148
|
+
}
|
|
1149
|
+
), _ = Q(!0), P = Je(v, "show");
|
|
1150
|
+
return (I, x) => {
|
|
1151
|
+
var f;
|
|
1152
|
+
const S = A("FmMenuDivider"), D = A("FmCard"), W = A("FmIcon"), y = A("FmTextField"), d = A("FmTable"), k = A("FmButton"), a = A("FmSideSheet");
|
|
1153
|
+
return R(), X(a, {
|
|
1154
|
+
header: t(g)("inventory.transfer.template.details.view", { template: (f = I.template) == null ? void 0 : f.name }),
|
|
1155
|
+
modelValue: t(P),
|
|
1156
|
+
"onUpdate:modelValue": x[2] || (x[2] = (C) => je(P) ? P.value = C : null),
|
|
1157
|
+
"dismiss-away": _.value,
|
|
1158
|
+
"close-button": "",
|
|
1159
|
+
"max-width": 500
|
|
1160
|
+
}, {
|
|
1161
|
+
default: N(() => {
|
|
1162
|
+
var C, $;
|
|
1163
|
+
return [
|
|
1164
|
+
s("div", ks, [
|
|
1165
|
+
s("div", null, [
|
|
1166
|
+
p(D, {
|
|
1167
|
+
variant: "outlined",
|
|
1168
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
1169
|
+
}, {
|
|
1170
|
+
default: N(() => {
|
|
1171
|
+
var h, n, r, T, F, L, z;
|
|
1172
|
+
return [
|
|
1173
|
+
s("div", Ts, [
|
|
1174
|
+
s("div", ws, V(t(g)("inventory.transfer.template.details.templateSummary")), 1),
|
|
1175
|
+
s("div", Fs, V(t(g)(
|
|
1176
|
+
`inventory.transfer.receiveRequest.details.type.${u.value.toLocaleLowerCase("en-US")}`
|
|
1177
|
+
)), 1)
|
|
1178
|
+
]),
|
|
1179
|
+
p(S),
|
|
1180
|
+
s("div", Is, [
|
|
1181
|
+
s("div", Ss, [
|
|
1182
|
+
s("div", Cs, [
|
|
1183
|
+
s("div", $s, V(t(g)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
1184
|
+
]),
|
|
1185
|
+
s("div", Os, V(t(ct)(((h = I.template) == null ? void 0 : h._id) ?? "")), 1)
|
|
1186
|
+
]),
|
|
1187
|
+
(r = (n = b.value) == null ? void 0 : n.supplier) != null && r.name ? (R(), j("div", Ms, [
|
|
1188
|
+
s("div", Ds, V(t(g)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
1189
|
+
s("div", Vs, V((F = (T = b.value) == null ? void 0 : T.supplier) == null ? void 0 : F.name), 1)
|
|
1190
|
+
])) : oe("", !0),
|
|
1191
|
+
(L = b.value) != null && L.ref ? (R(), j("div", Rs, [
|
|
1192
|
+
s("div", As, V(t(g)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
1193
|
+
s("div", Ps, V(b.value.ref), 1)
|
|
1194
|
+
])) : oe("", !0),
|
|
1195
|
+
(z = b.value) != null && z.remark ? (R(), j("div", Us, [
|
|
1196
|
+
s("div", Ls, V(t(g)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
1197
|
+
s("div", Bs, V(b.value.remark), 1)
|
|
1198
|
+
])) : oe("", !0)
|
|
1199
|
+
])
|
|
1200
|
+
];
|
|
1201
|
+
}),
|
|
1202
|
+
_: 1
|
|
1203
|
+
})
|
|
1204
|
+
]),
|
|
1205
|
+
s("div", qs, [
|
|
1206
|
+
s("div", Es, [
|
|
1207
|
+
s("div", Ns, V(t(g)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
|
|
1208
|
+
(R(!0), j(_e, null, ze(((C = b.value) == null ? void 0 : C.items) ?? [], (h) => (R(), j("div", {
|
|
1209
|
+
key: h.code,
|
|
1210
|
+
class: "flex flex-col"
|
|
1211
|
+
}, [
|
|
1212
|
+
s("div", zs, [
|
|
1213
|
+
s("div", Hs, V(h.name), 1),
|
|
1214
|
+
x[3] || (x[3] = s("div", { class: "flex-1 min-w-32" }, null, -1)),
|
|
1215
|
+
s("div", Qs, V(t(xt)(h.quantity, h.sku.unit, h.measurement)), 1)
|
|
1216
|
+
]),
|
|
1217
|
+
s("div", js, [
|
|
1218
|
+
s("div", Ws, V(h.code), 1),
|
|
1219
|
+
h.totalCost && t(l).enableTotalCost ? (R(), j("div", Gs, " (" + V(t(ft)(h.totalCost)) + ") ", 1)) : oe("", !0)
|
|
1220
|
+
]),
|
|
1221
|
+
t(ht)(h) ? (R(), j("div", Ks, [
|
|
1222
|
+
p(W, {
|
|
1223
|
+
name: "error",
|
|
1224
|
+
color: "system-error-300",
|
|
1225
|
+
size: "sm"
|
|
1226
|
+
}),
|
|
1227
|
+
x[4] || (x[4] = s("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))
|
|
1228
|
+
])) : oe("", !0)
|
|
1229
|
+
]))), 128))
|
|
1230
|
+
])
|
|
1231
|
+
]),
|
|
1232
|
+
x[6] || (x[6] = s("div", null, null, -1)),
|
|
1233
|
+
x[7] || (x[7] = s("div", null, null, -1)),
|
|
1234
|
+
s("div", Zs, [
|
|
1235
|
+
x[5] || (x[5] = s("div", { class: "flex flex-col" }, [
|
|
1236
|
+
s("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
|
|
1237
|
+
s("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is only usable for the following locations. ")
|
|
1238
|
+
], -1)),
|
|
1239
|
+
s("div", Js, [
|
|
1240
|
+
p(y, {
|
|
1241
|
+
modelValue: o.value,
|
|
1242
|
+
"onUpdate:modelValue": x[0] || (x[0] = (h) => o.value = h),
|
|
1243
|
+
placeholder: "Filter locations",
|
|
1244
|
+
"prepend-icon": "search"
|
|
1245
|
+
}, null, 8, ["modelValue"]),
|
|
1246
|
+
p(d, {
|
|
1247
|
+
"hide-footer": "",
|
|
1248
|
+
style: { height: "500px" },
|
|
1249
|
+
"column-defs": i,
|
|
1250
|
+
"search-value": o.value,
|
|
1251
|
+
"row-data": (($ = v.template) == null ? void 0 : $.locations) ?? [{ name: "All locations" }]
|
|
1252
|
+
}, null, 8, ["search-value", "row-data"])
|
|
1253
|
+
])
|
|
1254
|
+
])
|
|
1255
|
+
])
|
|
1256
|
+
];
|
|
1257
|
+
}),
|
|
1258
|
+
"side-sheet-footer": N(() => [
|
|
1259
|
+
s("div", Xs, [
|
|
1260
|
+
p(k, {
|
|
1261
|
+
label: t(g)("common.edit"),
|
|
1262
|
+
onClick: x[1] || (x[1] = (C) => e("action:edit")),
|
|
1263
|
+
variant: "tertiary"
|
|
1264
|
+
}, null, 8, ["label"])
|
|
1265
|
+
])
|
|
1266
|
+
]),
|
|
1267
|
+
_: 1
|
|
1268
|
+
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
}), eo = { class: "flex-1 flex flex-col gap-8" }, to = { class: "flex flex-col" }, so = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, oo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, no = { class: "fm-typo-en-body-lg-400" }, lo = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, ao = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, _o = /* @__PURE__ */ ee({
|
|
1272
|
+
__name: "TransferTemplateView",
|
|
1273
|
+
setup(m) {
|
|
1274
|
+
const { t: c } = ne(), { createTemplate: v, viewTemplate: e, importTemplates: l, exportTemplates: g } = qe(), { templateDialogProps: b, templateDetailsProps: i } = Ee(qe()), o = gt(), { loading: u, templates: _ } = Ee(o), P = Q(!1), I = yt(), x = Ke(), { breakpoints: S } = wt();
|
|
1275
|
+
ve(o.fetchTemplates);
|
|
1276
|
+
const D = U(
|
|
1277
|
+
() => P.value || u.value || !x._currentLocation
|
|
1278
|
+
), W = U(() => _.value), y = Q(""), d = U(() => S.value.xs || S.value.sm), k = U(() => d.value ? 10 : 20);
|
|
1279
|
+
function a($) {
|
|
1280
|
+
switch ($) {
|
|
1281
|
+
case Be.Add:
|
|
1282
|
+
return v();
|
|
1283
|
+
case "refresh":
|
|
1284
|
+
return o.fetchTemplates();
|
|
1285
|
+
case "import":
|
|
1286
|
+
return l();
|
|
1287
|
+
case "export":
|
|
1288
|
+
return g();
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
function f($) {
|
|
1292
|
+
return $;
|
|
1293
|
+
}
|
|
1294
|
+
const C = U(() => [
|
|
1295
|
+
{
|
|
1296
|
+
label: c("inventory.closing.template.create.title"),
|
|
1297
|
+
value: Be.Add,
|
|
1298
|
+
isPrimary: !0,
|
|
1299
|
+
prependIcon: "add"
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
label: c("inventory.common.refresh"),
|
|
1303
|
+
value: "refresh",
|
|
1304
|
+
isPrimary: !1
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
label: c("inventory.common.import"),
|
|
1308
|
+
value: "import",
|
|
1309
|
+
isPrimary: !1
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
label: c("inventory.common.export"),
|
|
1313
|
+
value: "export",
|
|
1314
|
+
isPrimary: !1
|
|
1315
|
+
}
|
|
1316
|
+
]);
|
|
1317
|
+
return ($, h) => {
|
|
1318
|
+
const n = A("FmTable");
|
|
1319
|
+
return R(), j(_e, null, [
|
|
1320
|
+
p(vt, {
|
|
1321
|
+
title: t(c)("inventory.transfer.template.title2"),
|
|
1322
|
+
actions: C.value,
|
|
1323
|
+
"onClick:action": a
|
|
1324
|
+
}, {
|
|
1325
|
+
default: N(() => {
|
|
1326
|
+
var r;
|
|
1327
|
+
return [
|
|
1328
|
+
s("div", {
|
|
1329
|
+
class: Y([
|
|
1330
|
+
"flex flex-col gap-8 max-h-full",
|
|
1331
|
+
{
|
|
1332
|
+
"p-0": d.value,
|
|
1333
|
+
"px-24 ": !d.value
|
|
1334
|
+
}
|
|
1335
|
+
])
|
|
1336
|
+
}, [
|
|
1337
|
+
p(bt, {
|
|
1338
|
+
searchable: "",
|
|
1339
|
+
search: y.value,
|
|
1340
|
+
"onUpdate:search": h[0] || (h[0] = (T) => y.value = T)
|
|
1341
|
+
}, null, 8, ["search"]),
|
|
1342
|
+
(R(), X(n, {
|
|
1343
|
+
style: He(t(I).tableHeight),
|
|
1344
|
+
"column-defs": t(o).columnDefs,
|
|
1345
|
+
"row-data": W.value,
|
|
1346
|
+
"search-value": y.value,
|
|
1347
|
+
loading: D.value,
|
|
1348
|
+
key: (r = t(x)._currentLocation) == null ? void 0 : r.dbName,
|
|
1349
|
+
onRowClick: h[1] || (h[1] = (T) => t(e)(T.original)),
|
|
1350
|
+
"page-size": k.value
|
|
1351
|
+
}, {
|
|
1352
|
+
"list-row": N((T) => [
|
|
1353
|
+
p(Ze, {
|
|
1354
|
+
row: T,
|
|
1355
|
+
onRowClick: (F) => t(e)(F)
|
|
1356
|
+
}, {
|
|
1357
|
+
default: N((F) => {
|
|
1358
|
+
var L, z, O, M, B, q, w, E, te, xe, he, ge, ke, ae, Te, we, Fe, Ie, Se, Ce, re, $e, Oe, Me, De, ie, Ve;
|
|
1359
|
+
return [
|
|
1360
|
+
s("div", eo, [
|
|
1361
|
+
s("div", to, [
|
|
1362
|
+
s("div", so, [
|
|
1363
|
+
p(t(K), {
|
|
1364
|
+
render: (O = (z = (L = F._id) == null ? void 0 : L.column) == null ? void 0 : z.columnDef) == null ? void 0 : O.cell,
|
|
1365
|
+
props: (B = (M = F._id) == null ? void 0 : M.getContext) == null ? void 0 : B.call(M)
|
|
1366
|
+
}, null, 8, ["render", "props"])
|
|
1367
|
+
]),
|
|
1368
|
+
s("div", oo, [
|
|
1369
|
+
p(t(K), {
|
|
1370
|
+
render: (E = (w = (q = F.name) == null ? void 0 : q.column) == null ? void 0 : w.columnDef) == null ? void 0 : E.cell,
|
|
1371
|
+
props: (xe = (te = F.name) == null ? void 0 : te.getContext) == null ? void 0 : xe.call(te)
|
|
1372
|
+
}, null, 8, ["render", "props"])
|
|
1373
|
+
]),
|
|
1374
|
+
s("div", no, [
|
|
1375
|
+
p(t(K), {
|
|
1376
|
+
render: (ke = (ge = (he = F.supplier) == null ? void 0 : he.column) == null ? void 0 : ge.columnDef) == null ? void 0 : ke.cell,
|
|
1377
|
+
props: (Te = (ae = F.supplier) == null ? void 0 : ae.getContext) == null ? void 0 : Te.call(ae)
|
|
1378
|
+
}, null, 8, ["render", "props"])
|
|
1379
|
+
]),
|
|
1380
|
+
s("div", null, V((we = T.original.locations) != null && we.length ? `Enabled for ${(Fe = T.original.locations) == null ? void 0 : Fe.length} outlets` : "Enabled for all outlets"), 1),
|
|
1381
|
+
s("div", lo, V(T.original.purchaseOrder.items.length ? T.original.purchaseOrder.items.map((Ye) => Ye.name).join(", ") : "No items"), 1),
|
|
1382
|
+
s("div", ao, [
|
|
1383
|
+
p(t(K), {
|
|
1384
|
+
render: (Ce = (Se = (Ie = F.ref) == null ? void 0 : Ie.column) == null ? void 0 : Se.columnDef) == null ? void 0 : Ce.cell,
|
|
1385
|
+
props: ($e = (re = F.ref) == null ? void 0 : re.getContext) == null ? void 0 : $e.call(re)
|
|
1386
|
+
}, null, 8, ["render", "props"])
|
|
1387
|
+
])
|
|
1388
|
+
]),
|
|
1389
|
+
s("div", null, [
|
|
1390
|
+
p(t(K), {
|
|
1391
|
+
render: (De = (Me = (Oe = F.type) == null ? void 0 : Oe.column) == null ? void 0 : Me.columnDef) == null ? void 0 : De.cell,
|
|
1392
|
+
props: (Ve = (ie = F.type) == null ? void 0 : ie.getContext) == null ? void 0 : Ve.call(ie)
|
|
1393
|
+
}, null, 8, ["render", "props"])
|
|
1394
|
+
])
|
|
1395
|
+
])
|
|
1396
|
+
];
|
|
1397
|
+
}),
|
|
1398
|
+
_: 2
|
|
1399
|
+
}, 1032, ["row", "onRowClick"])
|
|
1400
|
+
]),
|
|
1401
|
+
_: 1
|
|
1402
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1403
|
+
], 2)
|
|
1404
|
+
];
|
|
1405
|
+
}),
|
|
1406
|
+
_: 1
|
|
1407
|
+
}, 8, ["title", "actions"]),
|
|
1408
|
+
(R(), X(st, { to: "body" }, [
|
|
1409
|
+
p(Ys, ot(nt(t(i))), null, 16),
|
|
1410
|
+
p(gs, Qe(t(b), {
|
|
1411
|
+
onSubmitted: h[2] || (h[2] = (r) => t(o).fetchTemplates())
|
|
1412
|
+
}), null, 16)
|
|
1413
|
+
]))
|
|
1414
|
+
], 64);
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
export {
|
|
1419
|
+
_o as default
|
|
1420
|
+
};
|