@feedmepos/mf-inventory-portal 0.0.19-dev.3 → 0.0.19-dev.5
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-CS7NtcBA.js → ApprovalView-DY_a4R25.js} +16 -15
- package/dist/{BindingsDialog-BA2w-qkY.js → BindingsDialog-GITQp9DQ.js} +1 -1
- package/dist/{BindingsPicker-wf7b30Bk.js → BindingsPicker-CmS01WWD.js} +5 -5
- package/dist/{BindingsTable-mqqSPDbO.js → BindingsTable-CsMAutCO.js} +1 -1
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CViUEhuw.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BstbCK2r.js} +1 -1
- package/dist/{IngredientsView-BVX31o67.js → IngredientsView-BM218iE0.js} +26 -25
- package/dist/{IntegrationView-DFdl_238.js → IntegrationView-DrPzZ7YF.js} +2 -2
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BENFVQkL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BtY633D-.js} +1 -1
- package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-DBPQovO2.js +88 -0
- package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js +29 -0
- package/dist/{PurchaseOrderPrintPreview-06PokYt4.js → PurchaseOrderPrintPreview-s_pZiI6a.js} +11 -11
- package/dist/ReceiveRequestView-De2UMTFi.js +208 -0
- package/dist/{RecipeView-CiOb2lvU.js → RecipeView-CXH_9Jbb.js} +117 -116
- package/dist/{StockView-5LkTxYI2.js → StockView-Cld0Ss_r.js} +17 -16
- package/dist/{SupplierView-BAfC5Wcw.js → SupplierView-DtaCFERj.js} +6 -6
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kgcXwT9t.js +745 -0
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-C1YU60Mq.js +1269 -0
- package/dist/TransferTemplateView-BSmhw7Vl.js +1130 -0
- package/dist/{UnitView-wsbXOcbf.js → UnitView-BS9sJznU.js} +33 -33
- package/dist/{WarehouseView-DHhDNAk8.js → WarehouseView-D0xCjihu.js} +4 -4
- package/dist/api/purchase-order-template.d.ts +7 -0
- package/dist/{app-DNCC20Aq.js → app-Bq5a4Oca.js} +6097 -5889
- package/dist/app.d.ts +39 -0
- package/dist/app.js +7 -5
- package/dist/components/FmUnitInputProps.d.ts +2 -0
- package/dist/components/FmUnitInputRules.d.ts +1 -0
- package/dist/components/row-action.enum.d.ts +2 -0
- package/dist/composable/defineDeepModel.d.ts +2 -0
- package/dist/{decimal-DaXHxukU.js → decimal-Bk4WDsfO.js} +1 -1
- package/dist/helper/country.d.ts +2 -0
- package/dist/id-to-date-DOITPfk-.js +30 -0
- package/dist/layout-Dkdyeqv8.js +147 -0
- package/dist/purchase-order-transaction-type-std52lFO.js +295 -0
- package/dist/router/name.d.ts +1 -0
- package/dist/row-action.enum-7jVyol1k.js +36 -0
- package/dist/stores/supplier.d.ts +90 -7
- package/dist/style.css +1 -1
- package/dist/supplier-B1qyquXV.js +54 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +2 -0
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingSummary.vue.d.ts +26 -0
- package/dist/views/ingredients/helper/calculate-default-cost.d.ts +9 -0
- package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +2 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +3 -1
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +6 -0
- package/dist/views/transfer-template/TransferTemplateView.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +22 -0
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialogProps.d.ts +10 -0
- package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +16 -0
- package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateFormProps.d.ts +7 -0
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +18 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +116 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +112 -0
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +470 -0
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +289 -0
- package/dist/{xlsx-DaxqUL1h.js → xlsx-Bx1vSwYW.js} +1 -1
- package/dist/{xlsx.util-Dwiw0sTo.js → xlsx.util-DsOslDqG.js} +2 -2
- package/package.json +3 -3
- package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js +0 -35
- package/dist/ReceiveRequestView-ck-05Ly7.js +0 -1394
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-qZDMkkIZ.js +0 -1031
- package/dist/id-to-date-XiomI6dP.js +0 -121
- package/dist/layout-DvgFrTEG.js +0 -151
- package/dist/row-action.enum-BwQbURNh.js +0 -28
- package/dist/supplier-BepZrUgL.js +0 -65
|
@@ -0,0 +1,1130 @@
|
|
|
1
|
+
import { ref as $, computed as A, reactive as ke, onMounted as Pe, h as O, getCurrentInstance as ve, watch as se, defineComponent as Z, resolveComponent as R, openBlock as E, createElementBlock as Ae, createElementVNode as h, toDisplayString as ee, createVNode as b, unref as o, withCtx as U, createBlock as z, isRef as $e, Fragment as Ee, normalizeStyle as Ue, Teleport as Me, mergeProps as he } from "vue";
|
|
2
|
+
import { _ as Be, a as Le } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BstbCK2r.js";
|
|
3
|
+
import { useI18n as H } from "@feedmepos/mf-common";
|
|
4
|
+
import { useDialog as Oe, useSnackbar as Fe, FmButtonVariant as te, components as M, useProxiedModel as Ne, useBreakpoints as ze } from "@feedmepos/ui-library";
|
|
5
|
+
import { defineStore as qe, storeToRefs as He } from "pinia";
|
|
6
|
+
import { F as L, D as be, R as N } from "./row-action.enum-7jVyol1k.js";
|
|
7
|
+
import { u as ne, c as X, _ as Ke } from "./TransferDialog.vue_vue_type_script_setup_true_lang-C1YU60Mq.js";
|
|
8
|
+
import { u as je, f as Qe, P as k } from "./purchase-order-transaction-type-std52lFO.js";
|
|
9
|
+
import { j as G, c as Ie, P as _e, $ as Ye, D as ge, R as oe, a0 as Te, a1 as We, a as Y, r as Ce, a2 as Je, l as we, A as re, M as Se, a3 as Xe, b as Ze, a4 as De, a5 as Ge, u as et, y as tt, a6 as ot } from "./app-Bq5a4Oca.js";
|
|
10
|
+
import { c as rt, F as B, _ as at, u as st } from "./layout-Dkdyeqv8.js";
|
|
11
|
+
import { u as Re } from "./supplier-B1qyquXV.js";
|
|
12
|
+
import { _ as Ve } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-DBPQovO2.js";
|
|
13
|
+
import { useRouter as nt } from "vue-router";
|
|
14
|
+
const ae = qe("transferTemplateActions", () => {
|
|
15
|
+
const r = je("receive/request"), v = Oe(), c = Fe(), a = ne(), d = $({});
|
|
16
|
+
function T() {
|
|
17
|
+
d.value = {
|
|
18
|
+
mode: L.CREATE,
|
|
19
|
+
show: !0,
|
|
20
|
+
"onUpdate:show"(i) {
|
|
21
|
+
d.value.show = i;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function s(i) {
|
|
26
|
+
d.value = {
|
|
27
|
+
mode: L.UPDATE,
|
|
28
|
+
modelValue: i,
|
|
29
|
+
show: !0,
|
|
30
|
+
"onUpdate:show"(u) {
|
|
31
|
+
d.value.show = u;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function t(i, u, f) {
|
|
36
|
+
v.open({
|
|
37
|
+
title: `Confirm deleting template ${i.name}?`,
|
|
38
|
+
message: "Deleted template can no longer be retrieved",
|
|
39
|
+
primaryActions: {
|
|
40
|
+
text: "Delete",
|
|
41
|
+
variant: te.Destructive,
|
|
42
|
+
close: !0
|
|
43
|
+
},
|
|
44
|
+
secondaryActions: {
|
|
45
|
+
text: "Cancel",
|
|
46
|
+
variant: te.Plain,
|
|
47
|
+
close: !0
|
|
48
|
+
}
|
|
49
|
+
}).onPrimary(async () => {
|
|
50
|
+
c.open({
|
|
51
|
+
title: `Deleting ${i.name}`,
|
|
52
|
+
type: "info"
|
|
53
|
+
});
|
|
54
|
+
try {
|
|
55
|
+
u.value = !0;
|
|
56
|
+
const [p] = await Promise.allSettled([
|
|
57
|
+
a.deleteTemplate(i),
|
|
58
|
+
new Promise((_) => setTimeout(_, 1e3))
|
|
59
|
+
]);
|
|
60
|
+
if (p.status === "rejected") throw p.reason;
|
|
61
|
+
c.open({
|
|
62
|
+
title: `Deleted ${i.name}`,
|
|
63
|
+
type: "success"
|
|
64
|
+
});
|
|
65
|
+
} catch (p) {
|
|
66
|
+
c.open({
|
|
67
|
+
title: `Unable to delete ${i.name}`,
|
|
68
|
+
message: `See error from server: ${p}`,
|
|
69
|
+
type: "error"
|
|
70
|
+
}), console.error("error on deleting purchase order template", p);
|
|
71
|
+
} finally {
|
|
72
|
+
u.value = !1, f();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function m(i) {
|
|
77
|
+
}
|
|
78
|
+
function y(i) {
|
|
79
|
+
r.promptCreateTransferDialog({
|
|
80
|
+
...i.purchaseOrder,
|
|
81
|
+
template: i._id
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
createTemplate: T,
|
|
86
|
+
viewTemplate: m,
|
|
87
|
+
updateTemplate: s,
|
|
88
|
+
deleteTemplate: t,
|
|
89
|
+
useTemplate: y,
|
|
90
|
+
templateDialogProps: d,
|
|
91
|
+
transferFormDialogProps: r.transferDialogProps
|
|
92
|
+
};
|
|
93
|
+
}), xe = "use";
|
|
94
|
+
function lt() {
|
|
95
|
+
const { t: r } = H(), { viewTemplate: v, updateTemplate: c, deleteTemplate: a, useTemplate: d } = ae(), T = $(new Array()), s = $(!1), t = G(), m = ne();
|
|
96
|
+
async function y() {
|
|
97
|
+
if (T.value = [], !!t._currentLocation) {
|
|
98
|
+
s.value = !0;
|
|
99
|
+
try {
|
|
100
|
+
const [f] = await Promise.all([
|
|
101
|
+
m.readTemplates(),
|
|
102
|
+
new Promise((p) => setTimeout(p, 1e3))
|
|
103
|
+
]);
|
|
104
|
+
T.value = f;
|
|
105
|
+
} catch (f) {
|
|
106
|
+
console.log("Something went wrong when fetching templates:", f);
|
|
107
|
+
} finally {
|
|
108
|
+
s.value = !1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function i(f, p) {
|
|
113
|
+
switch (p = Ie(p), f) {
|
|
114
|
+
case xe:
|
|
115
|
+
return d(p);
|
|
116
|
+
case N.Details:
|
|
117
|
+
return v(p);
|
|
118
|
+
case N.Edit:
|
|
119
|
+
return c(p);
|
|
120
|
+
case N.Delete:
|
|
121
|
+
return a(p, s, y);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { columnDefs: [
|
|
125
|
+
{
|
|
126
|
+
accessorKey: "_id",
|
|
127
|
+
header: () => r("inventory.transfer.table.createdAt"),
|
|
128
|
+
cell(f) {
|
|
129
|
+
return Qe(`${f.getValue()}`);
|
|
130
|
+
},
|
|
131
|
+
enableSorting: !0
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
accessorKey: "name",
|
|
135
|
+
header: () => r("inventory.transfer.table.name"),
|
|
136
|
+
enableSorting: !0,
|
|
137
|
+
size: 200
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
accessorKey: "purchaseOrder.supplier.name",
|
|
141
|
+
header: () => r("inventory.transfer.table.transferFrom"),
|
|
142
|
+
enableSorting: !0,
|
|
143
|
+
size: 200
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
accessorKey: "purchaseOrder.items.length",
|
|
147
|
+
header: () => r("inventory.transfer.table.noOfItems"),
|
|
148
|
+
enableSorting: !1,
|
|
149
|
+
meta: {
|
|
150
|
+
width: "10rem"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
accessorKey: "purchaseOrder.ref",
|
|
155
|
+
header: () => r("inventory.transfer.table.reference"),
|
|
156
|
+
enableSorting: !1,
|
|
157
|
+
size: "auto"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "action",
|
|
161
|
+
cell(f) {
|
|
162
|
+
const p = f.row.original, _ = [
|
|
163
|
+
{
|
|
164
|
+
label: r("inventory.transfer.template.use"),
|
|
165
|
+
value: xe,
|
|
166
|
+
color: "text-fm-color-typo-primary"
|
|
167
|
+
},
|
|
168
|
+
be[N.Edit],
|
|
169
|
+
be[N.Delete]
|
|
170
|
+
];
|
|
171
|
+
return rt(_, (x) => i(x, p));
|
|
172
|
+
},
|
|
173
|
+
enableSorting: !1,
|
|
174
|
+
size: 40,
|
|
175
|
+
meta: {
|
|
176
|
+
cellClass: "",
|
|
177
|
+
headerClass: ""
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
], templates: T, loading: s, fetchTemplates: y };
|
|
181
|
+
}
|
|
182
|
+
function W(r) {
|
|
183
|
+
return Ye.parse(r);
|
|
184
|
+
}
|
|
185
|
+
function J(r) {
|
|
186
|
+
return {
|
|
187
|
+
_id: r.doc._id,
|
|
188
|
+
internal: r.type,
|
|
189
|
+
contactName: r.doc.profile.name,
|
|
190
|
+
name: r.doc.profile.name,
|
|
191
|
+
email: r.doc.profile.email,
|
|
192
|
+
phoneNumber: r.doc.profile.phoneNo,
|
|
193
|
+
registrationNumber: r.doc.profile.regNo,
|
|
194
|
+
address: r.doc.profile.address
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function it(r, v) {
|
|
198
|
+
const c = Re(), a = G();
|
|
199
|
+
a.watchLocation(async () => {
|
|
200
|
+
await c.readSuppliers();
|
|
201
|
+
const i = r();
|
|
202
|
+
if (i.supplier._id) return;
|
|
203
|
+
const u = c.suppliers[0], f = a.locations[0];
|
|
204
|
+
v({
|
|
205
|
+
...i,
|
|
206
|
+
supplier: u ? W(u) : f ? J(f) : i.supplier
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
const d = A(
|
|
210
|
+
() => {
|
|
211
|
+
var i, u;
|
|
212
|
+
return typeof ((u = (i = r()) == null ? void 0 : i.supplier) == null ? void 0 : u.internal) == "string" ? k.TRANSFER : k.PURCHASE;
|
|
213
|
+
}
|
|
214
|
+
), T = A({
|
|
215
|
+
get() {
|
|
216
|
+
var i, u;
|
|
217
|
+
return (u = (i = r()) == null ? void 0 : i.supplier) == null ? void 0 : u._id;
|
|
218
|
+
},
|
|
219
|
+
set(i) {
|
|
220
|
+
const u = r() ?? {};
|
|
221
|
+
if (d.value === k.PURCHASE) {
|
|
222
|
+
const _ = c.suppliers.find((x) => x._id === i);
|
|
223
|
+
v({
|
|
224
|
+
...u,
|
|
225
|
+
supplier: _ ? W(_) : u.supplier
|
|
226
|
+
});
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const p = a.locations.find((_) => _.doc._id === i);
|
|
230
|
+
v({
|
|
231
|
+
...u,
|
|
232
|
+
supplier: p ? J(p) : u.supplier
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}), s = A(() => c.suppliers.map(W)), t = A(() => {
|
|
236
|
+
var u;
|
|
237
|
+
const i = ((u = a._currentLocation) == null ? void 0 : u.type) === _e.warehouse;
|
|
238
|
+
return a.locations.filter((f) => {
|
|
239
|
+
var _;
|
|
240
|
+
return !(f.dbName === ((_ = a._currentLocation) == null ? void 0 : _.dbName)) && (!i || f.type === _e.warehouse) && f.acceptRequest;
|
|
241
|
+
}).map(J);
|
|
242
|
+
}), m = A(() => d.value === k.PURCHASE ? s.value.map((u) => ({
|
|
243
|
+
label: u.name,
|
|
244
|
+
value: u._id
|
|
245
|
+
})) : t.value.map((u) => ({
|
|
246
|
+
label: u.name,
|
|
247
|
+
sublabel: u.internal ? `${u.internal}` : void 0,
|
|
248
|
+
value: u._id
|
|
249
|
+
}))), y = A(() => {
|
|
250
|
+
var p, _;
|
|
251
|
+
const i = (_ = (p = r()) == null ? void 0 : p.supplier) == null ? void 0 : _._id;
|
|
252
|
+
if (d.value === k.PURCHASE) {
|
|
253
|
+
const x = c.suppliers.find((I) => I._id === i);
|
|
254
|
+
return x ? W(x) : null;
|
|
255
|
+
}
|
|
256
|
+
const f = a.locations.find((x) => x.doc._id);
|
|
257
|
+
return f ? J(f) : null;
|
|
258
|
+
});
|
|
259
|
+
return {
|
|
260
|
+
transferLocationModel: T,
|
|
261
|
+
transferLocationOptions: m,
|
|
262
|
+
locationOptionsTypePurchase: s,
|
|
263
|
+
locationOptionsTypeTransfer: t,
|
|
264
|
+
selectedLocation: y
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
var w = /* @__PURE__ */ ((r) => (r.Code = "Code", r.Name = "Name", r.Amount = "Amount", r.MinimumAmount = "MinimumAmount", r.Step = "Step", r.Cost = "Cost", r.Delete = "Delete", r))(w || {});
|
|
268
|
+
const ut = () => {
|
|
269
|
+
const { t: r } = H();
|
|
270
|
+
return O(
|
|
271
|
+
Ve,
|
|
272
|
+
{
|
|
273
|
+
zIndex: 50,
|
|
274
|
+
class: "whitespace-nowrap"
|
|
275
|
+
},
|
|
276
|
+
r("inventory.transfer.form.items.table.Cost", [De()])
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
function ct(r) {
|
|
280
|
+
const { t: v } = H(), c = ke({});
|
|
281
|
+
Pe(() => {
|
|
282
|
+
for (const s of r.items) {
|
|
283
|
+
if (!s.totalCost)
|
|
284
|
+
continue;
|
|
285
|
+
const t = X(s.sku, s.quantity, s.measurement, {
|
|
286
|
+
supplier: r.supplier
|
|
287
|
+
}), m = s.totalCost ?? ge.reset();
|
|
288
|
+
t ? c[s.sku._id] = t.amount !== m.amount || t.precision !== m.precision : c[s.sku._id] = !0;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
function a(s) {
|
|
292
|
+
var m, y;
|
|
293
|
+
return !!(s.defaultCost ?? ((y = (m = r.supplier) == null ? void 0 : m.supplyItems) == null ? void 0 : y.find((i) => i.skuId === s._id)));
|
|
294
|
+
}
|
|
295
|
+
const d = [
|
|
296
|
+
{
|
|
297
|
+
id: "Code",
|
|
298
|
+
header: () => v("inventory.transfer.form.items.table.Code"),
|
|
299
|
+
accessorKey: "code",
|
|
300
|
+
size: 96,
|
|
301
|
+
cell(s) {
|
|
302
|
+
const t = s.row.original;
|
|
303
|
+
return O(M.FmTextField, {
|
|
304
|
+
modelValue: t.code,
|
|
305
|
+
"onUpdate:modelValue": (m) => {
|
|
306
|
+
r.updateItem({
|
|
307
|
+
...t,
|
|
308
|
+
code: m
|
|
309
|
+
});
|
|
310
|
+
},
|
|
311
|
+
key: t.sku._id,
|
|
312
|
+
rules: [oe()],
|
|
313
|
+
labelMark: "required"
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
enableSorting: !1
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
id: "Name",
|
|
320
|
+
header: () => v("inventory.transfer.form.items.table.Name"),
|
|
321
|
+
minSize: 300,
|
|
322
|
+
cell(s) {
|
|
323
|
+
const t = s.row.original;
|
|
324
|
+
return O(M.FmTextField, {
|
|
325
|
+
modelValue: t.name,
|
|
326
|
+
"onUpdate:modelValue": (m) => {
|
|
327
|
+
r.updateItem({
|
|
328
|
+
...t,
|
|
329
|
+
name: m
|
|
330
|
+
});
|
|
331
|
+
},
|
|
332
|
+
key: t.sku._id,
|
|
333
|
+
rules: [oe()],
|
|
334
|
+
labelMark: "required"
|
|
335
|
+
});
|
|
336
|
+
},
|
|
337
|
+
enableSorting: !1
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: "Amount",
|
|
341
|
+
header: () => v("inventory.transfer.form.items.table.Amount2"),
|
|
342
|
+
minSize: 150,
|
|
343
|
+
cell(s) {
|
|
344
|
+
const t = s.row.original;
|
|
345
|
+
return O(Te, {
|
|
346
|
+
style: {
|
|
347
|
+
flex: "1 1 0%"
|
|
348
|
+
},
|
|
349
|
+
modelValue: {
|
|
350
|
+
amount: t.quantity ?? { amount: 1, precision: 0 },
|
|
351
|
+
measurement: t.measurement ?? null
|
|
352
|
+
},
|
|
353
|
+
key: t.sku._id,
|
|
354
|
+
unit: t.sku.unit,
|
|
355
|
+
"onUpdate:modelValue": (m) => {
|
|
356
|
+
r.updateItem({
|
|
357
|
+
...t,
|
|
358
|
+
quantity: m.amount,
|
|
359
|
+
measurement: m.measurement
|
|
360
|
+
});
|
|
361
|
+
},
|
|
362
|
+
rules: [
|
|
363
|
+
We(
|
|
364
|
+
+Y(
|
|
365
|
+
t.minimumQuantity ?? {
|
|
366
|
+
amount: 1,
|
|
367
|
+
precision: Ce(t.sku.unit, t.measurement)
|
|
368
|
+
}
|
|
369
|
+
)
|
|
370
|
+
)
|
|
371
|
+
],
|
|
372
|
+
applyDefaultRules: !0
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
enableSorting: !1
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: "MinimumAmount",
|
|
379
|
+
header: () => v("inventory.transfer.form.items.table.MinimumAmount2"),
|
|
380
|
+
minSize: 124,
|
|
381
|
+
cell(s) {
|
|
382
|
+
const t = s.row.original;
|
|
383
|
+
return O(Te, {
|
|
384
|
+
style: {
|
|
385
|
+
flex: "1 1 0%"
|
|
386
|
+
},
|
|
387
|
+
modelValue: {
|
|
388
|
+
amount: t.minimumQuantity ?? {
|
|
389
|
+
amount: 1,
|
|
390
|
+
precision: Ce(t.sku.unit, t.measurement)
|
|
391
|
+
},
|
|
392
|
+
measurement: t.measurement ?? null
|
|
393
|
+
},
|
|
394
|
+
key: t.sku._id,
|
|
395
|
+
unit: t.sku.unit,
|
|
396
|
+
"onUpdate:modelValue": (m) => {
|
|
397
|
+
r.updateItem({
|
|
398
|
+
...t,
|
|
399
|
+
minimumQuantity: m.amount
|
|
400
|
+
});
|
|
401
|
+
},
|
|
402
|
+
rules: [Je(0)],
|
|
403
|
+
disableUnit: !0,
|
|
404
|
+
applyDefaultRules: !0
|
|
405
|
+
});
|
|
406
|
+
},
|
|
407
|
+
enableSorting: !1
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
id: "Step",
|
|
411
|
+
header: () => v("inventory.transfer.form.items.table.Step"),
|
|
412
|
+
minSize: 100,
|
|
413
|
+
cell(s) {
|
|
414
|
+
const t = s.row.original;
|
|
415
|
+
return O(M.FmTextField, {
|
|
416
|
+
modelValue: Y(t.quantityStep ?? ge.reset(), !1),
|
|
417
|
+
key: t.sku._id,
|
|
418
|
+
"onUpdate:modelValue": (m) => {
|
|
419
|
+
r.updateItem({
|
|
420
|
+
...t,
|
|
421
|
+
quantityStep: we(+m)
|
|
422
|
+
});
|
|
423
|
+
},
|
|
424
|
+
rules: [re(0), Se(t.sku.unit, t.measurement)]
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
enableSorting: !1
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
id: "Cost",
|
|
431
|
+
header: ut,
|
|
432
|
+
size: 180,
|
|
433
|
+
cell(s) {
|
|
434
|
+
const t = s.row.original, m = a(t.sku);
|
|
435
|
+
return !c[t.sku._id] && m ? O(
|
|
436
|
+
"div",
|
|
437
|
+
{
|
|
438
|
+
class: "flex gap-4 fm-typo-en-body-md-400 items-center"
|
|
439
|
+
},
|
|
440
|
+
[
|
|
441
|
+
O(M.FmButton, {
|
|
442
|
+
prependIcon: "edit",
|
|
443
|
+
variant: te.Tertiary,
|
|
444
|
+
onClick() {
|
|
445
|
+
r.updateItem({
|
|
446
|
+
...t,
|
|
447
|
+
totalCost: X(t.sku, t.quantity, t.measurement, {
|
|
448
|
+
supplier: r.supplier
|
|
449
|
+
})
|
|
450
|
+
}), c[t.sku._id] = !0;
|
|
451
|
+
}
|
|
452
|
+
}),
|
|
453
|
+
O(
|
|
454
|
+
"div",
|
|
455
|
+
{
|
|
456
|
+
class: "flex flex-col"
|
|
457
|
+
},
|
|
458
|
+
[
|
|
459
|
+
O(
|
|
460
|
+
"span",
|
|
461
|
+
Y(
|
|
462
|
+
X(t.sku, t.quantity, t.measurement, {
|
|
463
|
+
supplier: r.supplier
|
|
464
|
+
})
|
|
465
|
+
)
|
|
466
|
+
),
|
|
467
|
+
O(
|
|
468
|
+
"span",
|
|
469
|
+
{
|
|
470
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400"
|
|
471
|
+
},
|
|
472
|
+
"Auto-calculated"
|
|
473
|
+
)
|
|
474
|
+
]
|
|
475
|
+
)
|
|
476
|
+
]
|
|
477
|
+
) : O(
|
|
478
|
+
M.FmTextField,
|
|
479
|
+
{
|
|
480
|
+
modelValue: Y(t.totalCost ?? { amount: 0, precision: 0 }),
|
|
481
|
+
key: t.sku._id,
|
|
482
|
+
"onUpdate:modelValue": (y) => {
|
|
483
|
+
r.updateItem({
|
|
484
|
+
...t,
|
|
485
|
+
totalCost: {
|
|
486
|
+
...we(+y),
|
|
487
|
+
currency: Xe()
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
},
|
|
491
|
+
rules: [re(0), Se(2)]
|
|
492
|
+
},
|
|
493
|
+
m ? {
|
|
494
|
+
append() {
|
|
495
|
+
return O(M.FmButton, {
|
|
496
|
+
prependIcon: "close",
|
|
497
|
+
variant: "tertiary",
|
|
498
|
+
onClick() {
|
|
499
|
+
r.updateItem({
|
|
500
|
+
...t,
|
|
501
|
+
totalCost: null
|
|
502
|
+
}), c[t.sku._id] = !1;
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
} : {}
|
|
507
|
+
);
|
|
508
|
+
},
|
|
509
|
+
enableSorting: !1
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
id: "Delete",
|
|
513
|
+
header: "",
|
|
514
|
+
cell(s) {
|
|
515
|
+
return O(M.FmButton, {
|
|
516
|
+
class: "delete-button",
|
|
517
|
+
type: "button",
|
|
518
|
+
icon: "delete",
|
|
519
|
+
variant: "tertiary",
|
|
520
|
+
size: "md",
|
|
521
|
+
onClick: () => {
|
|
522
|
+
r.deleteItem(s.row.original);
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
},
|
|
526
|
+
enableSorting: !1,
|
|
527
|
+
size: 40,
|
|
528
|
+
meta: {
|
|
529
|
+
cellClass: "",
|
|
530
|
+
headerClass: ""
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
];
|
|
534
|
+
return {
|
|
535
|
+
columnDefs: A(() => Ze().enableTotalCost && r.transferType === k.PURCHASE ? d : d.filter((t) => t.id !== "Cost"))
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function mt(r = "modelValue") {
|
|
539
|
+
var T, s;
|
|
540
|
+
const v = ((T = ve()) == null ? void 0 : T.props) ?? {}, c = ((s = ve()) == null ? void 0 : s.emit) ?? (() => {
|
|
541
|
+
}), a = ke(Ie(v[r])), d = `update:${Ge(r)}`;
|
|
542
|
+
return se(a, (t) => {
|
|
543
|
+
c(d, t);
|
|
544
|
+
}), a;
|
|
545
|
+
}
|
|
546
|
+
const pt = { class: "flex flex-col gap-8 py-16" }, dt = { class: "flex items-center" }, ft = { class: "flex-1 flex gap-1 items-center" }, yt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ht = { class: "flex gap-8 w-full" }, bt = { class: "flex-1 flex flex-col gap-4" }, _t = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), gt = { class: "flex-1 flex flex-col gap-4" }, Tt = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Ct = { class: "flex gap-8 w-full" }, wt = { class: "flex-1 flex flex-col gap-4" }, St = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), xt = { class: "flex-1 flex flex-col gap-4" }, kt = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), At = { class: "flex gap-8 w-full" }, Ot = { class: "flex-1 flex flex-col gap-4" }, Ft = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), It = { class: "flex-1 flex flex-col gap-4" }, Dt = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Rt = /* @__PURE__ */ Z({
|
|
547
|
+
__name: "TransferTemplateItem",
|
|
548
|
+
props: {
|
|
549
|
+
cellByColId: {},
|
|
550
|
+
row: {}
|
|
551
|
+
},
|
|
552
|
+
setup(r) {
|
|
553
|
+
const { t: v } = H();
|
|
554
|
+
return (c, a) => {
|
|
555
|
+
var T, s, t, m, y, i, u, f, p, _, x, I, V, n, e, l, g, F, S, P, D, C, q, K, le, ie, ue, ce, j, me, pe, de, fe, Q, ye;
|
|
556
|
+
const d = R("FmLabel");
|
|
557
|
+
return E(), Ae("div", pt, [
|
|
558
|
+
h("div", dt, [
|
|
559
|
+
h("div", ft, [
|
|
560
|
+
h("span", yt, " (" + ee(c.row.original.sku.code) + ") ", 1),
|
|
561
|
+
h("span", vt, ee(c.row.original.sku.name), 1)
|
|
562
|
+
]),
|
|
563
|
+
h("div", null, [
|
|
564
|
+
b(o(B), {
|
|
565
|
+
render: (t = (s = (T = c.cellByColId.Delete) == null ? void 0 : T.column) == null ? void 0 : s.columnDef) == null ? void 0 : t.cell,
|
|
566
|
+
props: (y = (m = c.cellByColId.Delete) == null ? void 0 : m.getContext) == null ? void 0 : y.call(m)
|
|
567
|
+
}, null, 8, ["render", "props"])
|
|
568
|
+
])
|
|
569
|
+
]),
|
|
570
|
+
h("div", ht, [
|
|
571
|
+
h("div", bt, [
|
|
572
|
+
b(d, {
|
|
573
|
+
label: o(v)(`inventory.transfer.form.items.table.${o(w).Code}`)
|
|
574
|
+
}, null, 8, ["label"]),
|
|
575
|
+
b(o(B), {
|
|
576
|
+
render: (f = (u = (i = c.cellByColId[o(w).Code]) == null ? void 0 : i.column) == null ? void 0 : u.columnDef) == null ? void 0 : f.cell,
|
|
577
|
+
props: (_ = (p = c.cellByColId[o(w).Code]) == null ? void 0 : p.getContext) == null ? void 0 : _.call(p)
|
|
578
|
+
}, null, 8, ["render", "props"]),
|
|
579
|
+
_t
|
|
580
|
+
]),
|
|
581
|
+
h("div", gt, [
|
|
582
|
+
b(d, {
|
|
583
|
+
label: o(v)(`inventory.transfer.form.items.table.${o(w).Name}`)
|
|
584
|
+
}, null, 8, ["label"]),
|
|
585
|
+
b(o(B), {
|
|
586
|
+
render: (V = (I = (x = c.cellByColId[o(w).Name]) == null ? void 0 : x.column) == null ? void 0 : I.columnDef) == null ? void 0 : V.cell,
|
|
587
|
+
props: (e = (n = c.cellByColId[o(w).Name]) == null ? void 0 : n.getContext) == null ? void 0 : e.call(n)
|
|
588
|
+
}, null, 8, ["render", "props"]),
|
|
589
|
+
Tt
|
|
590
|
+
])
|
|
591
|
+
]),
|
|
592
|
+
h("div", Ct, [
|
|
593
|
+
h("div", wt, [
|
|
594
|
+
b(d, {
|
|
595
|
+
label: o(v)(`inventory.transfer.form.items.table.${o(w).MinimumAmount}`)
|
|
596
|
+
}, null, 8, ["label"]),
|
|
597
|
+
b(o(B), {
|
|
598
|
+
render: (F = (g = (l = c.cellByColId[o(w).MinimumAmount]) == null ? void 0 : l.column) == null ? void 0 : g.columnDef) == null ? void 0 : F.cell,
|
|
599
|
+
props: (P = (S = c.cellByColId[o(w).MinimumAmount]) == null ? void 0 : S.getContext) == null ? void 0 : P.call(S)
|
|
600
|
+
}, null, 8, ["render", "props"]),
|
|
601
|
+
St
|
|
602
|
+
]),
|
|
603
|
+
h("div", xt, [
|
|
604
|
+
b(d, {
|
|
605
|
+
label: o(v)(`inventory.transfer.form.items.table.${o(w).Step}`)
|
|
606
|
+
}, null, 8, ["label"]),
|
|
607
|
+
b(o(B), {
|
|
608
|
+
render: (q = (C = (D = c.cellByColId[o(w).Step]) == null ? void 0 : D.column) == null ? void 0 : C.columnDef) == null ? void 0 : q.cell,
|
|
609
|
+
props: (le = (K = c.cellByColId[o(w).Step]) == null ? void 0 : K.getContext) == null ? void 0 : le.call(K)
|
|
610
|
+
}, null, 8, ["render", "props"]),
|
|
611
|
+
kt
|
|
612
|
+
])
|
|
613
|
+
]),
|
|
614
|
+
h("div", At, [
|
|
615
|
+
h("div", Ot, [
|
|
616
|
+
b(d, {
|
|
617
|
+
label: o(v)(`inventory.transfer.form.items.table.${o(w).Amount}`)
|
|
618
|
+
}, null, 8, ["label"]),
|
|
619
|
+
b(o(B), {
|
|
620
|
+
render: (ce = (ue = (ie = c.cellByColId[o(w).Amount]) == null ? void 0 : ie.column) == null ? void 0 : ue.columnDef) == null ? void 0 : ce.cell,
|
|
621
|
+
props: (me = (j = c.cellByColId[o(w).Amount]) == null ? void 0 : j.getContext) == null ? void 0 : me.call(j)
|
|
622
|
+
}, null, 8, ["render", "props"]),
|
|
623
|
+
Ft
|
|
624
|
+
]),
|
|
625
|
+
h("div", It, [
|
|
626
|
+
b(Ve, { "z-index": 50 }, {
|
|
627
|
+
default: U(() => [
|
|
628
|
+
b(d, {
|
|
629
|
+
label: o(v)(`inventory.transfer.form.items.table.${o(w).Cost}`, [o(De)()])
|
|
630
|
+
}, null, 8, ["label"])
|
|
631
|
+
]),
|
|
632
|
+
_: 1
|
|
633
|
+
}),
|
|
634
|
+
b(o(B), {
|
|
635
|
+
render: (fe = (de = (pe = c.cellByColId[o(w).Cost]) == null ? void 0 : pe.column) == null ? void 0 : de.columnDef) == null ? void 0 : fe.cell,
|
|
636
|
+
props: (ye = (Q = c.cellByColId[o(w).Cost]) == null ? void 0 : Q.getContext) == null ? void 0 : ye.call(Q)
|
|
637
|
+
}, null, 8, ["render", "props"]),
|
|
638
|
+
Dt
|
|
639
|
+
])
|
|
640
|
+
])
|
|
641
|
+
]);
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
}), Vt = { class: "flex flex-col gap-16" }, Pt = { class: "flex flex-col gap-24" }, $t = { class: "flex flex-col gap-16" }, Et = { class: "flex" }, Ut = /* @__PURE__ */ h("div", { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, "Transfer items", -1), Mt = /* @__PURE__ */ Z({
|
|
645
|
+
__name: "TransferTemplateForm",
|
|
646
|
+
props: {
|
|
647
|
+
modelValue: {},
|
|
648
|
+
disabled: { type: Boolean }
|
|
649
|
+
},
|
|
650
|
+
setup(r, { expose: v }) {
|
|
651
|
+
const c = r, a = mt(), { t: d } = H(), T = G(), s = et(), t = Re();
|
|
652
|
+
se(
|
|
653
|
+
() => c.modelValue,
|
|
654
|
+
(n) => {
|
|
655
|
+
console.log("TransferTemplateForm.model", n);
|
|
656
|
+
}
|
|
657
|
+
), T.watchLocation(async () => {
|
|
658
|
+
location && (a.purchaseOrder.supplier || (a.purchaseOrder.supplier = t.suppliers.find((n) => n) ?? a.purchaseOrder.supplier));
|
|
659
|
+
});
|
|
660
|
+
const m = Oe(), y = it(
|
|
661
|
+
() => a.purchaseOrder,
|
|
662
|
+
(n) => {
|
|
663
|
+
a.purchaseOrder = {
|
|
664
|
+
...a.purchaseOrder,
|
|
665
|
+
...n
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
), i = A({
|
|
669
|
+
get() {
|
|
670
|
+
var n, e;
|
|
671
|
+
return typeof ((e = (n = a.purchaseOrder) == null ? void 0 : n.supplier) == null ? void 0 : e.internal) == "string" ? k.TRANSFER : k.PURCHASE;
|
|
672
|
+
},
|
|
673
|
+
set(n) {
|
|
674
|
+
var l, g;
|
|
675
|
+
const e = typeof ((g = (l = a.purchaseOrder) == null ? void 0 : l.supplier) == null ? void 0 : g.internal) == "string" ? k.TRANSFER : k.PURCHASE;
|
|
676
|
+
n !== e && (a.purchaseOrder.supplier = n === k.PURCHASE ? y.locationOptionsTypePurchase.value[0] : y.locationOptionsTypeTransfer.value[0]);
|
|
677
|
+
}
|
|
678
|
+
}), u = A(() => y.transferLocationOptions.value), f = A({
|
|
679
|
+
get() {
|
|
680
|
+
return a.purchaseOrder.supplier._id;
|
|
681
|
+
},
|
|
682
|
+
set(n) {
|
|
683
|
+
y.transferLocationModel.value = n;
|
|
684
|
+
}
|
|
685
|
+
}), p = A({
|
|
686
|
+
get() {
|
|
687
|
+
return a.purchaseOrder.remark ?? void 0;
|
|
688
|
+
},
|
|
689
|
+
set(n) {
|
|
690
|
+
a.purchaseOrder.remark = n;
|
|
691
|
+
}
|
|
692
|
+
}), _ = $();
|
|
693
|
+
v({
|
|
694
|
+
validateInputs: () => {
|
|
695
|
+
var n, e;
|
|
696
|
+
(e = (n = _.value) == null ? void 0 : n.validateInputs) == null || e.call(n);
|
|
697
|
+
},
|
|
698
|
+
resetInputsValidation: () => {
|
|
699
|
+
var n, e;
|
|
700
|
+
(e = (n = _.value) == null ? void 0 : n.resetInputsValidation) == null || e.call(n);
|
|
701
|
+
},
|
|
702
|
+
resetInputs: () => {
|
|
703
|
+
var n, e;
|
|
704
|
+
(e = (n = _.value) == null ? void 0 : n.resetInputs) == null || e.call(n);
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
const x = ct({
|
|
708
|
+
updateItem: (n) => {
|
|
709
|
+
a.purchaseOrder.items = a.purchaseOrder.items.map((e) => e.sku._id !== n.sku._id ? e : n);
|
|
710
|
+
},
|
|
711
|
+
deleteItem: (n) => {
|
|
712
|
+
a.purchaseOrder.items = a.purchaseOrder.items.filter(
|
|
713
|
+
(e) => e.sku._id !== n.sku._id
|
|
714
|
+
);
|
|
715
|
+
},
|
|
716
|
+
get supplier() {
|
|
717
|
+
return a.purchaseOrder.supplier;
|
|
718
|
+
},
|
|
719
|
+
get items() {
|
|
720
|
+
return a.purchaseOrder.items;
|
|
721
|
+
},
|
|
722
|
+
get transferType() {
|
|
723
|
+
return i.value;
|
|
724
|
+
}
|
|
725
|
+
}), I = A(() => x.columnDefs.value);
|
|
726
|
+
function V() {
|
|
727
|
+
const n = s.skus.map((l) => ({
|
|
728
|
+
label: l.name,
|
|
729
|
+
sublabel: l.code,
|
|
730
|
+
value: l
|
|
731
|
+
})), e = n.filter((l) => {
|
|
732
|
+
var g;
|
|
733
|
+
return (g = a.purchaseOrder.items) == null ? void 0 : g.find((F) => F.sku._id === l.value._id);
|
|
734
|
+
}).map((l) => l.value);
|
|
735
|
+
m.open({
|
|
736
|
+
title: "Select item",
|
|
737
|
+
closeButton: !0,
|
|
738
|
+
contentComponent: tt,
|
|
739
|
+
contentComponentProps: {
|
|
740
|
+
modelValue: e,
|
|
741
|
+
items: n
|
|
742
|
+
},
|
|
743
|
+
primaryActions: {
|
|
744
|
+
text: "Confirm",
|
|
745
|
+
close: !0
|
|
746
|
+
},
|
|
747
|
+
secondaryActions: {
|
|
748
|
+
text: "Close",
|
|
749
|
+
close: !0,
|
|
750
|
+
variant: "tertiary"
|
|
751
|
+
}
|
|
752
|
+
}).onPrimary((l) => {
|
|
753
|
+
const g = a.purchaseOrder.items ?? [], F = l.map((S) => {
|
|
754
|
+
const P = g.find((C) => C.sku._id === S._id);
|
|
755
|
+
if (P)
|
|
756
|
+
return P;
|
|
757
|
+
const D = {
|
|
758
|
+
sku: S,
|
|
759
|
+
code: S.code,
|
|
760
|
+
name: S.name,
|
|
761
|
+
quantity: {
|
|
762
|
+
amount: 1,
|
|
763
|
+
precision: 0
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
return i.value == k.PURCHASE && (D.totalCost = X(
|
|
767
|
+
D.sku,
|
|
768
|
+
D.quantity,
|
|
769
|
+
D.measurement,
|
|
770
|
+
{
|
|
771
|
+
supplier: a.purchaseOrder.supplier
|
|
772
|
+
}
|
|
773
|
+
)), D;
|
|
774
|
+
});
|
|
775
|
+
F.sort((S, P) => S.sku.code.localeCompare(P.sku.code)), a.purchaseOrder.items = F;
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
return (n, e) => {
|
|
779
|
+
const l = R("FmTextField"), g = R("FmSelect"), F = R("FmTextarea"), S = R("FmButton"), P = R("FmTable"), D = R("FmForm");
|
|
780
|
+
return E(), z(D, {
|
|
781
|
+
ref_key: "formRef",
|
|
782
|
+
ref: _,
|
|
783
|
+
class: "flex flex-col gap-32"
|
|
784
|
+
}, {
|
|
785
|
+
default: U(() => [
|
|
786
|
+
h("div", Vt, [
|
|
787
|
+
h("div", Pt, [
|
|
788
|
+
b(l, {
|
|
789
|
+
label: o(d)("inventory.transfer.form.name"),
|
|
790
|
+
"label-mark": "required",
|
|
791
|
+
modelValue: o(a).name,
|
|
792
|
+
"onUpdate:modelValue": e[0] || (e[0] = (C) => o(a).name = C),
|
|
793
|
+
rules: [o(oe)()]
|
|
794
|
+
}, null, 8, ["label", "modelValue", "rules"]),
|
|
795
|
+
b(g, {
|
|
796
|
+
label: o(d)("inventory.transfer.form.type.title"),
|
|
797
|
+
"model-value": i.value,
|
|
798
|
+
"onUpdate:modelValue": e[1] || (e[1] = (C) => i.value = C),
|
|
799
|
+
items: [
|
|
800
|
+
{
|
|
801
|
+
label: o(d)(
|
|
802
|
+
`inventory.transfer.form.type.${o(k).PURCHASE.toLocaleLowerCase()}`
|
|
803
|
+
),
|
|
804
|
+
value: o(k).PURCHASE,
|
|
805
|
+
disabled: !o(y).locationOptionsTypePurchase.value.length,
|
|
806
|
+
sublabel: o(y).locationOptionsTypePurchase.value.length ? void 0 : "No supplier available"
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
label: o(d)(
|
|
810
|
+
`inventory.transfer.form.type.${o(k).TRANSFER.toLocaleLowerCase()}`
|
|
811
|
+
),
|
|
812
|
+
value: o(k).TRANSFER,
|
|
813
|
+
disabled: !o(y).locationOptionsTypeTransfer.value.length,
|
|
814
|
+
sublabel: o(y).locationOptionsTypeTransfer.value.length ? void 0 : "No location available"
|
|
815
|
+
}
|
|
816
|
+
],
|
|
817
|
+
rules: [o(re)(1)(u.value)]
|
|
818
|
+
}, null, 8, ["label", "model-value", "items", "rules"]),
|
|
819
|
+
b(g, {
|
|
820
|
+
label: i.value === o(k).PURCHASE ? "Purchase from" : "Transfer from",
|
|
821
|
+
modelValue: f.value,
|
|
822
|
+
"onUpdate:modelValue": e[2] || (e[2] = (C) => f.value = C),
|
|
823
|
+
items: u.value
|
|
824
|
+
}, null, 8, ["label", "modelValue", "items"]),
|
|
825
|
+
b(l, {
|
|
826
|
+
label: "Reference",
|
|
827
|
+
"label-mark": "optional",
|
|
828
|
+
modelValue: o(a).purchaseOrder.ref,
|
|
829
|
+
"onUpdate:modelValue": e[3] || (e[3] = (C) => o(a).purchaseOrder.ref = C)
|
|
830
|
+
}, null, 8, ["modelValue"]),
|
|
831
|
+
b(F, {
|
|
832
|
+
label: "Remark",
|
|
833
|
+
"label-mark": "optional",
|
|
834
|
+
"max-length": 240,
|
|
835
|
+
modelValue: p.value,
|
|
836
|
+
"onUpdate:modelValue": e[4] || (e[4] = (C) => p.value = C)
|
|
837
|
+
}, null, 8, ["modelValue"])
|
|
838
|
+
])
|
|
839
|
+
]),
|
|
840
|
+
h("div", $t, [
|
|
841
|
+
h("div", Et, [
|
|
842
|
+
Ut,
|
|
843
|
+
b(S, {
|
|
844
|
+
disabled: n.disabled,
|
|
845
|
+
label: "Add Item",
|
|
846
|
+
"prepend-icon": "add",
|
|
847
|
+
variant: "plain",
|
|
848
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
849
|
+
onClick: e[5] || (e[5] = (C) => V()),
|
|
850
|
+
size: "md"
|
|
851
|
+
}, null, 8, ["disabled"])
|
|
852
|
+
]),
|
|
853
|
+
(E(), z(P, {
|
|
854
|
+
"column-defs": I.value,
|
|
855
|
+
"row-data": o(a).purchaseOrder.items,
|
|
856
|
+
key: o(a).purchaseOrder.items.map((C) => C.sku._id).join(".")
|
|
857
|
+
}, {
|
|
858
|
+
"list-row": U((C) => [
|
|
859
|
+
(E(), z(at, {
|
|
860
|
+
row: C,
|
|
861
|
+
key: o(a).purchaseOrder.items.map((q) => q.sku._id).join(".")
|
|
862
|
+
}, {
|
|
863
|
+
default: U((q) => [
|
|
864
|
+
b(Rt, {
|
|
865
|
+
row: C,
|
|
866
|
+
"cell-by-col-id": q
|
|
867
|
+
}, null, 8, ["row", "cell-by-col-id"])
|
|
868
|
+
]),
|
|
869
|
+
_: 2
|
|
870
|
+
}, 1032, ["row"]))
|
|
871
|
+
]),
|
|
872
|
+
_: 1
|
|
873
|
+
}, 8, ["column-defs", "row-data"]))
|
|
874
|
+
])
|
|
875
|
+
]),
|
|
876
|
+
_: 1
|
|
877
|
+
}, 512);
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
}), Bt = { class: "flex items-center" }, Lt = { class: "fm-typo-en-title-md-800" }, Nt = { class: "flex gap-4" }, zt = /* @__PURE__ */ Z({
|
|
881
|
+
__name: "TransferTemplateDialog",
|
|
882
|
+
props: {
|
|
883
|
+
mode: {},
|
|
884
|
+
modelValue: {},
|
|
885
|
+
show: { type: Boolean }
|
|
886
|
+
},
|
|
887
|
+
emits: ["update:show", "submitted"],
|
|
888
|
+
setup(r, { expose: v, emit: c }) {
|
|
889
|
+
var n;
|
|
890
|
+
const a = r, d = c, T = ne(), s = Fe(), t = Ne(a, "show");
|
|
891
|
+
function m() {
|
|
892
|
+
return {
|
|
893
|
+
_id: "",
|
|
894
|
+
name: "",
|
|
895
|
+
purchaseOrder: {
|
|
896
|
+
remark: void 0,
|
|
897
|
+
ref: void 0,
|
|
898
|
+
stockSnapshotId: void 0,
|
|
899
|
+
effectiveAt: void 0,
|
|
900
|
+
items: [],
|
|
901
|
+
supplier: {
|
|
902
|
+
_rev: void 0,
|
|
903
|
+
email: void 0,
|
|
904
|
+
internal: void 0,
|
|
905
|
+
contactName: void 0,
|
|
906
|
+
phoneNumber: void 0,
|
|
907
|
+
registrationNumber: void 0,
|
|
908
|
+
supplyItems: void 0,
|
|
909
|
+
_id: "",
|
|
910
|
+
name: "",
|
|
911
|
+
address: {
|
|
912
|
+
line2: void 0,
|
|
913
|
+
line1: "",
|
|
914
|
+
state: "",
|
|
915
|
+
city: "",
|
|
916
|
+
postcode: "",
|
|
917
|
+
country: ""
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
const y = $(a.modelValue ?? m()), i = $(((n = a.modelValue) == null ? void 0 : n._id) ?? `${Math.random()}`);
|
|
924
|
+
se(
|
|
925
|
+
() => a.show,
|
|
926
|
+
(e) => {
|
|
927
|
+
var l;
|
|
928
|
+
e && (y.value = a.modelValue ?? m(), i.value = ((l = a.modelValue) == null ? void 0 : l._id) ?? `${Math.random()}`);
|
|
929
|
+
}
|
|
930
|
+
);
|
|
931
|
+
const u = $(!1), f = A(() => {
|
|
932
|
+
switch (a.mode) {
|
|
933
|
+
case L.READ:
|
|
934
|
+
return "View template";
|
|
935
|
+
case L.CREATE:
|
|
936
|
+
return "Add template";
|
|
937
|
+
case L.UPDATE:
|
|
938
|
+
return "Edit template";
|
|
939
|
+
}
|
|
940
|
+
return "";
|
|
941
|
+
}), p = $();
|
|
942
|
+
v({
|
|
943
|
+
validateInputs: () => {
|
|
944
|
+
var e, l;
|
|
945
|
+
(l = (e = p.value) == null ? void 0 : e.validateInputs) == null || l.call(e);
|
|
946
|
+
},
|
|
947
|
+
resetInputsValidation: () => {
|
|
948
|
+
var e, l;
|
|
949
|
+
(l = (e = p.value) == null ? void 0 : e.resetInputsValidation) == null || l.call(e);
|
|
950
|
+
},
|
|
951
|
+
resetInputs: () => {
|
|
952
|
+
var e, l;
|
|
953
|
+
(l = (e = p.value) == null ? void 0 : e.resetInputs) == null || l.call(e);
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
async function _() {
|
|
957
|
+
const e = y.value;
|
|
958
|
+
if (e) {
|
|
959
|
+
u.value = !0, (e.purchaseOrder.supplier.internal === "warehouse" || e.purchaseOrder.supplier.internal === "restaurant") && (e.purchaseOrder.items = e.purchaseOrder.items.map(
|
|
960
|
+
({ totalCost: l, ...g }) => g
|
|
961
|
+
));
|
|
962
|
+
try {
|
|
963
|
+
await T.createTemplate(e), await new Promise((l) => setTimeout(l, 1e3)), s.open({
|
|
964
|
+
title: "Created",
|
|
965
|
+
message: "Your transfer template has been created!",
|
|
966
|
+
type: "success"
|
|
967
|
+
}), d("update:show", !1), d("submitted");
|
|
968
|
+
} catch (l) {
|
|
969
|
+
s.open({
|
|
970
|
+
title: "Cannot create transfer template",
|
|
971
|
+
message: "Report to system administrator for troubleshooting.",
|
|
972
|
+
type: "error"
|
|
973
|
+
}), console.error("Error in creating transfer template", l);
|
|
974
|
+
} finally {
|
|
975
|
+
u.value = !1;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
async function x() {
|
|
980
|
+
const e = y.value;
|
|
981
|
+
if (e) {
|
|
982
|
+
u.value = !0, (e.purchaseOrder.supplier.internal === "warehouse" || e.purchaseOrder.supplier.internal === "restaurant") && (e.purchaseOrder.items = e.purchaseOrder.items.map(
|
|
983
|
+
({ totalCost: l, ...g }) => g
|
|
984
|
+
));
|
|
985
|
+
try {
|
|
986
|
+
await T.updateTemplate(e), await new Promise((l) => setTimeout(l, 1e3)), s.open({
|
|
987
|
+
title: "Updated",
|
|
988
|
+
message: "Your transfer template has been updated!",
|
|
989
|
+
type: "success"
|
|
990
|
+
}), d("update:show", !1), d("submitted");
|
|
991
|
+
} catch (l) {
|
|
992
|
+
s.open({
|
|
993
|
+
title: "Cannot update transfer template",
|
|
994
|
+
message: "Report to system administrator for troubleshooting.",
|
|
995
|
+
type: "error"
|
|
996
|
+
}), console.error("Error in updating transfer template", l);
|
|
997
|
+
} finally {
|
|
998
|
+
u.value = !1;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
function I() {
|
|
1003
|
+
switch (a.mode) {
|
|
1004
|
+
case L.CREATE:
|
|
1005
|
+
return _();
|
|
1006
|
+
case L.UPDATE:
|
|
1007
|
+
return x();
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
function V() {
|
|
1011
|
+
var e, l;
|
|
1012
|
+
(l = (e = p.value) == null ? void 0 : e.validateInputs) == null || l.call(e);
|
|
1013
|
+
}
|
|
1014
|
+
return (e, l) => {
|
|
1015
|
+
const g = R("FmButton"), F = R("FmSideSheet");
|
|
1016
|
+
return E(), z(F, {
|
|
1017
|
+
modelValue: o(t),
|
|
1018
|
+
"onUpdate:modelValue": l[2] || (l[2] = (S) => $e(t) ? t.value = S : null),
|
|
1019
|
+
"dismiss-away": "",
|
|
1020
|
+
"close-button": "",
|
|
1021
|
+
"max-width": 900
|
|
1022
|
+
}, {
|
|
1023
|
+
"side-sheet-header": U(() => [
|
|
1024
|
+
h("div", Bt, [
|
|
1025
|
+
h("div", Lt, ee(f.value), 1)
|
|
1026
|
+
])
|
|
1027
|
+
]),
|
|
1028
|
+
default: U(() => [
|
|
1029
|
+
(E(), z(Mt, {
|
|
1030
|
+
class: "w-full",
|
|
1031
|
+
ref_key: "formRef",
|
|
1032
|
+
ref: p,
|
|
1033
|
+
onValidationSuccess: I,
|
|
1034
|
+
"model-value": y.value,
|
|
1035
|
+
"onUpdate:modelValue": l[0] || (l[0] = (S) => y.value = S),
|
|
1036
|
+
disabled: u.value,
|
|
1037
|
+
key: i.value
|
|
1038
|
+
}, null, 8, ["model-value", "disabled"]))
|
|
1039
|
+
]),
|
|
1040
|
+
"side-sheet-footer": U(() => [
|
|
1041
|
+
h("div", Nt, [
|
|
1042
|
+
b(g, {
|
|
1043
|
+
loading: u.value,
|
|
1044
|
+
label: "Save",
|
|
1045
|
+
onClick: V
|
|
1046
|
+
}, null, 8, ["loading"]),
|
|
1047
|
+
b(g, {
|
|
1048
|
+
disabled: u.value,
|
|
1049
|
+
variant: "tertiary",
|
|
1050
|
+
label: "Close",
|
|
1051
|
+
onClick: l[1] || (l[1] = (S) => d("update:show", !1))
|
|
1052
|
+
}, null, 8, ["disabled"])
|
|
1053
|
+
])
|
|
1054
|
+
]),
|
|
1055
|
+
_: 1
|
|
1056
|
+
}, 8, ["modelValue"]);
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
}), qt = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, ro = /* @__PURE__ */ Z({
|
|
1060
|
+
__name: "TransferTemplateView",
|
|
1061
|
+
setup(r) {
|
|
1062
|
+
const { t: v } = H(), { createTemplate: c, viewTemplate: a } = ae(), { templateDialogProps: d, transferFormDialogProps: T } = He(ae()), s = lt(), t = st(), m = G(), { breakpoints: y } = ze();
|
|
1063
|
+
m.watchLocation(s.fetchTemplates);
|
|
1064
|
+
const i = A(
|
|
1065
|
+
() => s.loading.value || !m._currentLocation
|
|
1066
|
+
), u = A(() => s.templates.value), f = $(""), p = A(() => y.value.xs || y.value.sm ? 10 : 20);
|
|
1067
|
+
function _(V) {
|
|
1068
|
+
switch (V) {
|
|
1069
|
+
case N.Add:
|
|
1070
|
+
return c();
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
const x = nt();
|
|
1074
|
+
function I() {
|
|
1075
|
+
x.push({ name: ot.RECEIVE_REQUEST });
|
|
1076
|
+
}
|
|
1077
|
+
return (V, n) => {
|
|
1078
|
+
const e = R("FmTable");
|
|
1079
|
+
return E(), Ae(Ee, null, [
|
|
1080
|
+
b(Be, {
|
|
1081
|
+
title: o(v)("inventory.transfer.template.title2"),
|
|
1082
|
+
actions: [
|
|
1083
|
+
{
|
|
1084
|
+
label: o(v)("inventory.transfer.template.create.title"),
|
|
1085
|
+
value: o(N).Add,
|
|
1086
|
+
isPrimary: !0,
|
|
1087
|
+
prependIcon: "add"
|
|
1088
|
+
}
|
|
1089
|
+
],
|
|
1090
|
+
"onClick:action": _
|
|
1091
|
+
}, {
|
|
1092
|
+
default: U(() => {
|
|
1093
|
+
var l;
|
|
1094
|
+
return [
|
|
1095
|
+
h("div", qt, [
|
|
1096
|
+
b(Le, {
|
|
1097
|
+
searchable: "",
|
|
1098
|
+
"change-location": "",
|
|
1099
|
+
search: f.value,
|
|
1100
|
+
"onUpdate:search": n[0] || (n[0] = (g) => f.value = g),
|
|
1101
|
+
actions: [{ icon: "refresh", onClick: o(s).fetchTemplates }]
|
|
1102
|
+
}, null, 8, ["search", "actions"]),
|
|
1103
|
+
(E(), z(e, {
|
|
1104
|
+
style: Ue(o(t).tableHeight),
|
|
1105
|
+
"column-defs": o(s).columnDefs,
|
|
1106
|
+
"row-data": u.value,
|
|
1107
|
+
"search-value": f.value,
|
|
1108
|
+
loading: i.value,
|
|
1109
|
+
key: (l = o(m)._currentLocation) == null ? void 0 : l.dbName,
|
|
1110
|
+
onRowClick: n[1] || (n[1] = (g) => o(a)(g.original)),
|
|
1111
|
+
"page-size": p.value
|
|
1112
|
+
}, null, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1113
|
+
])
|
|
1114
|
+
];
|
|
1115
|
+
}),
|
|
1116
|
+
_: 1
|
|
1117
|
+
}, 8, ["title", "actions"]),
|
|
1118
|
+
(E(), z(Me, { to: "body" }, [
|
|
1119
|
+
b(Ke, he(o(T), { onSubmitted: I }), null, 16),
|
|
1120
|
+
b(zt, he(o(d), {
|
|
1121
|
+
onSubmitted: n[2] || (n[2] = (l) => o(s).fetchTemplates())
|
|
1122
|
+
}), null, 16)
|
|
1123
|
+
]))
|
|
1124
|
+
], 64);
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
export {
|
|
1129
|
+
ro as default
|
|
1130
|
+
};
|