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