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