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