@feedmepos/mf-inventory-portal 0.0.22-dev.29 → 0.0.22-dev.30
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-Ba-tUg0r.js → ApprovalView-BowcCo8d.js} +4 -4
- package/dist/{BindingsDialog-BzE7RozX.js → BindingsDialog-CmmLVQTN.js} +1 -1
- package/dist/{BindingsPicker-21frBXLS.js → BindingsPicker-BErHbcxb.js} +1 -1
- package/dist/{BindingsTable-b5C-I-cP.js → BindingsTable-hrfbN6tX.js} +1 -1
- package/dist/{ClosingTemplateView-DMBAODHP.js → ClosingTemplateView-BVefCGpC.js} +374 -370
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DeX65Yyd.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CXHh_Bti.js} +1 -1
- package/dist/IngredientsView-BqnUckSv.js +1817 -0
- package/dist/{IntegrationView-BMrUQaFT.js → IntegrationView-BEdAKS1I.js} +120 -120
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-D0Yw7F_u.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-pr7Sb7Om.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-IS1pDkV9.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DsYwNO5N.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-CdOwEm2W.js → PurchaseOrderPrintPreview-DzaS_c8R.js} +1 -1
- package/dist/{ReceiveRequestView-B86diRXc.js → ReceiveRequestView-CU-bhIjl.js} +6 -6
- package/dist/{RecipeView-7zB4lKdK.js → RecipeView-CmETsz5e.js} +3 -3
- package/dist/{StockView-zoWR3C4k.js → StockView-BgmjwPbh.js} +6 -6
- package/dist/{SupplierView-C-1jW5ON.js → SupplierView-CDm5q1th.js} +3 -3
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BWItuAd0.js → TransferDetails.vue_vue_type_script_setup_true_lang-BZJyhJu4.js} +4 -4
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-lybenWiw.js +1678 -0
- package/dist/TransferTemplateView-CSQ2XxFU.js +1232 -0
- package/dist/{UnitView-yFNEgTl_.js → UnitView-D7bcDkOX.js} +4 -4
- package/dist/{WarehouseView-CregM24b.js → WarehouseView-BJAKVdRs.js} +2 -2
- package/dist/api/inventory.d.ts +71 -82
- package/dist/{app-BsDFpmXX.js → app-A8ykBdGf.js} +12514 -12256
- package/dist/app.js +1 -1
- package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
- package/dist/{decimal-B4_Y3KEm.js → decimal-BC4EGBAX.js} +1 -1
- package/dist/{defineDeepModel-BYWYdjn7.js → defineDeepModel-Ckfkwau_.js} +3 -3
- package/dist/{format-time-from-id-xHkyagtQ.js → format-time-from-id-o1plVFRH.js} +3 -3
- package/dist/{id-to-date-BZG9rZhi.js → id-to-date-DyPIToei.js} +1 -1
- package/dist/{purchase-order-transaction-type-B2Vf-MS0.js → purchase-order-transaction-type-skN4AmEj.js} +3 -3
- package/dist/stores/inventory.d.ts +15 -0
- package/dist/stores/location.d.ts +420 -486
- package/dist/stores/netsuite.d.ts +1 -1
- package/dist/{supplier-B9WHfMl-.js → supplier-DV3Tg4TT.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-template-enabled-locations-2-DMyd7rbX.js → use-template-enabled-locations-2-u_kejm-N.js} +1 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +852 -984
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +852 -984
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +996 -58
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1511 -104
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1417 -10
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -82
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1272 -2652
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +399 -859
- package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +108 -223
- package/dist/{xlsx-BFdyFL_3.js → xlsx-CrHTSBmd.js} +1 -1
- package/dist/{xlsx.util-UUCw3Kgc.js → xlsx.util-hjzkZFnf.js} +2 -2
- package/package.json +1 -1
- package/dist/IngredientsView-C6Lxkg-R.js +0 -1758
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-5u4NM7G5.js +0 -1522
- package/dist/TransferTemplateView-DnKSCXki.js +0 -1210
|
@@ -1,1522 +0,0 @@
|
|
|
1
|
-
import { reactive as Ge, onMounted as qe, computed as T, h as L, defineComponent as ue, openBlock as F, createElementBlock as $, Fragment as ie, renderList as $e, createElementVNode as a, toDisplayString as R, unref as e, resolveComponent as I, createVNode as v, withCtx as O, createCommentVNode as z, ref as H, createBlock as Y, watch as De, normalizeClass as N, normalizeStyle as et, isRef as fe } from "vue";
|
|
2
|
-
import { useBreakpoints as Ne, components as me, FmButtonVariant as tt, useSnackbar as Ve, useDialog as st, useProxiedModel as ot } from "@feedmepos/ui-library";
|
|
3
|
-
import { F as ke } from "./row-action.enum-PMKMRrZR.js";
|
|
4
|
-
import { P as V, d as He, c as nt } from "./purchase-order-transaction-type-B2Vf-MS0.js";
|
|
5
|
-
import { a as Z, t as lt, ab as Ae, E as at, b as ze, R as Me, a5 as rt, a7 as it, s as ut, a8 as Ee, a6 as dt, H as je, m as ct, A as Pe, M as pt, ac as Qe, P as Re, Q as We, ad as mt, j as Oe, ae as ft, u as Ue, af as yt, ag as vt, ah as bt, G as _t, ai as gt, aj as kt, z as Ct } from "./app-BsDFpmXX.js";
|
|
6
|
-
import { _ as Ye, u as ht } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-IS1pDkV9.js";
|
|
7
|
-
import { useI18n as ve } from "@feedmepos/mf-common";
|
|
8
|
-
import "vue-router";
|
|
9
|
-
import { u as Te } from "./supplier-B9WHfMl-.js";
|
|
10
|
-
import { d as xt } from "./defineDeepModel-BYWYdjn7.js";
|
|
11
|
-
import { F as ye, _ as wt } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
12
|
-
import { _ as St } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
13
|
-
function re(n, b, i, d) {
|
|
14
|
-
var k, S, p;
|
|
15
|
-
if (d != null && d.manualTotalCost)
|
|
16
|
-
return d == null ? void 0 : d.manualTotalCost;
|
|
17
|
-
const m = (p = (S = (k = d == null ? void 0 : d.supplier) == null ? void 0 : k.supplyItems) == null ? void 0 : S.find(
|
|
18
|
-
(u) => u.skuId === n._id
|
|
19
|
-
)) == null ? void 0 : p.defaultCost, t = n.defaultCost, o = m ?? t, w = o == null ? void 0 : o.costPerUnit, c = w ? o != null && o.measurement ? +Z(w) / +Z(o == null ? void 0 : o.measurement.conversion) : +Z(w) : void 0, s = c ? i ? c * +Z(i.conversion) : c : void 0, r = s ? +Z(b) * s : void 0;
|
|
20
|
-
return r ? {
|
|
21
|
-
...lt(r ?? 0, 2),
|
|
22
|
-
currency: Ae()
|
|
23
|
-
} : {
|
|
24
|
-
amount: 0,
|
|
25
|
-
precision: 0,
|
|
26
|
-
currency: Ae()
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
var E = /* @__PURE__ */ ((n) => (n.Code = "Code", n.Name = "Name", n.Amount = "Amount", n.Cost = "Cost", n.Delete = "Delete", n))(E || {});
|
|
30
|
-
const Ft = () => {
|
|
31
|
-
const { t: n } = ve();
|
|
32
|
-
return L(
|
|
33
|
-
Ye,
|
|
34
|
-
{
|
|
35
|
-
zIndex: 50,
|
|
36
|
-
class: "whitespace-nowrap"
|
|
37
|
-
},
|
|
38
|
-
n("inventory.transfer.form.items.table.Cost", [Qe()])
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
function Pt(n) {
|
|
42
|
-
const { t: b } = ve(), i = Ge({}), { breakpoints: d } = Ne(), m = ze();
|
|
43
|
-
qe(() => {
|
|
44
|
-
for (const c of n.items) {
|
|
45
|
-
if (!c.totalCost)
|
|
46
|
-
continue;
|
|
47
|
-
const s = re(c.sku, c.quantity, c.measurement, {
|
|
48
|
-
supplier: n.supplier
|
|
49
|
-
}), r = c.totalCost ?? at.reset();
|
|
50
|
-
s ? i[c.sku._id] = s.amount !== r.amount || s.precision !== r.precision : i[c.sku._id] = !0;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
function t(c) {
|
|
54
|
-
var r, y, k, S, p, u, h;
|
|
55
|
-
return !!(((y = (r = c.defaultCost) == null ? void 0 : r.costPerUnit) == null ? void 0 : y.amount) ?? ((h = (u = (p = (S = (k = n.supplier) == null ? void 0 : k.supplyItems) == null ? void 0 : S.find((C) => C.skuId === c._id)) == null ? void 0 : p.defaultCost) == null ? void 0 : u.costPerUnit) == null ? void 0 : h.amount));
|
|
56
|
-
}
|
|
57
|
-
const o = [
|
|
58
|
-
{
|
|
59
|
-
id: "Code",
|
|
60
|
-
header: () => b("inventory.transfer.form.items.table.Code"),
|
|
61
|
-
accessorKey: "code",
|
|
62
|
-
size: 96,
|
|
63
|
-
cell(c) {
|
|
64
|
-
const s = c.row.original;
|
|
65
|
-
return L(me.FmTextField, {
|
|
66
|
-
modelValue: s.code,
|
|
67
|
-
"onUpdate:modelValue": (r) => {
|
|
68
|
-
n.updateItem({
|
|
69
|
-
...s,
|
|
70
|
-
code: r
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
key: s.sku._id,
|
|
74
|
-
rules: [Me()],
|
|
75
|
-
labelMark: "required"
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
enableSorting: !1
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: "Name",
|
|
82
|
-
header: () => b("inventory.transfer.form.items.table.Name"),
|
|
83
|
-
minSize: 300,
|
|
84
|
-
cell(c) {
|
|
85
|
-
const s = c.row.original;
|
|
86
|
-
return L(me.FmTextField, {
|
|
87
|
-
modelValue: s.name,
|
|
88
|
-
"onUpdate:modelValue": (r) => {
|
|
89
|
-
n.updateItem({
|
|
90
|
-
...s,
|
|
91
|
-
name: r
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
key: s.sku._id,
|
|
95
|
-
rules: [Me()],
|
|
96
|
-
labelMark: "required"
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
enableSorting: !1
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "Amount",
|
|
103
|
-
header: () => b("inventory.transfer.form.items.table.Amount"),
|
|
104
|
-
minSize: 200,
|
|
105
|
-
cell(c) {
|
|
106
|
-
var y, k, S;
|
|
107
|
-
const s = c.row.original, r = (S = (k = (y = n.template) == null ? void 0 : y.purchaseOrder) == null ? void 0 : k.items) == null ? void 0 : S.find(
|
|
108
|
-
(p) => p.sku._id === s.sku._id
|
|
109
|
-
);
|
|
110
|
-
return L(rt, {
|
|
111
|
-
style: {
|
|
112
|
-
flex: "1 1 0%"
|
|
113
|
-
},
|
|
114
|
-
modelValue: {
|
|
115
|
-
amount: s.quantity ?? { amount: 1, precision: 0 },
|
|
116
|
-
measurement: s.measurement ?? null
|
|
117
|
-
},
|
|
118
|
-
key: s.sku._id,
|
|
119
|
-
unit: s.sku.unit,
|
|
120
|
-
"onUpdate:modelValue": (p) => {
|
|
121
|
-
const u = {
|
|
122
|
-
...s,
|
|
123
|
-
quantity: p.amount,
|
|
124
|
-
measurement: p.measurement
|
|
125
|
-
};
|
|
126
|
-
m.enableTotalCost && (u.totalCost = re(s.sku, s.quantity, s.measurement, {
|
|
127
|
-
supplier: n.supplier,
|
|
128
|
-
// NOTE: set undefined here if `manualTotalCost[row.sku._id] = false`, so that the function
|
|
129
|
-
// will return the auto calculated default cost instead of the manual total cost
|
|
130
|
-
manualTotalCost: i[s.sku._id] ? u.totalCost : void 0
|
|
131
|
-
})), n.updateItem(u);
|
|
132
|
-
},
|
|
133
|
-
stepper: r == null ? void 0 : r.quantityStep,
|
|
134
|
-
disableUnit: !!r,
|
|
135
|
-
disabled: n.disabled,
|
|
136
|
-
rules: [
|
|
137
|
-
it(
|
|
138
|
-
+Z(
|
|
139
|
-
(r == null ? void 0 : r.minimumQuantity) ?? {
|
|
140
|
-
amount: 1,
|
|
141
|
-
precision: ut(s.sku.unit, s.measurement)
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
),
|
|
145
|
-
r != null && r.maximumQuantity ? Ee(
|
|
146
|
-
+Z(r == null ? void 0 : r.maximumQuantity)
|
|
147
|
-
) : Ee(1 / 0),
|
|
148
|
-
...r != null && r.quantityStep ? [dt(r.quantityStep)] : []
|
|
149
|
-
],
|
|
150
|
-
applyDefaultRules: !0
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
enableSorting: !1
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
id: "Cost",
|
|
157
|
-
header: Ft,
|
|
158
|
-
size: 180,
|
|
159
|
-
cell(c) {
|
|
160
|
-
const s = c.row.original, r = t(s.sku), y = d.value.xs || d.value.sm;
|
|
161
|
-
return !i[s.sku._id] && r ? L(
|
|
162
|
-
"div",
|
|
163
|
-
{
|
|
164
|
-
class: [
|
|
165
|
-
"flex gap-4 fm-typo-en-body-md-400 items-center",
|
|
166
|
-
n.disabled ? "text-fm-color-typo-disabled" : ""
|
|
167
|
-
],
|
|
168
|
-
key: s.sku._id
|
|
169
|
-
},
|
|
170
|
-
[
|
|
171
|
-
L(me.FmButton, {
|
|
172
|
-
prependIcon: "edit",
|
|
173
|
-
variant: tt.Tertiary,
|
|
174
|
-
disabled: n.disabled,
|
|
175
|
-
onClick() {
|
|
176
|
-
n.updateItem({
|
|
177
|
-
...s,
|
|
178
|
-
totalCost: re(s.sku, s.quantity, s.measurement, {
|
|
179
|
-
supplier: n.supplier
|
|
180
|
-
})
|
|
181
|
-
}), i[s.sku._id] = !0;
|
|
182
|
-
}
|
|
183
|
-
}),
|
|
184
|
-
L(
|
|
185
|
-
"div",
|
|
186
|
-
{
|
|
187
|
-
class: "flex flex-col"
|
|
188
|
-
},
|
|
189
|
-
[
|
|
190
|
-
L(
|
|
191
|
-
"span",
|
|
192
|
-
y ? je(
|
|
193
|
-
re(s.sku, s.quantity, s.measurement, {
|
|
194
|
-
supplier: n.supplier
|
|
195
|
-
})
|
|
196
|
-
) : Z(
|
|
197
|
-
re(s.sku, s.quantity, s.measurement, {
|
|
198
|
-
supplier: n.supplier
|
|
199
|
-
})
|
|
200
|
-
)
|
|
201
|
-
),
|
|
202
|
-
L(
|
|
203
|
-
"span",
|
|
204
|
-
{
|
|
205
|
-
class: [
|
|
206
|
-
"fm-typo-en-body-sm-400",
|
|
207
|
-
n.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
|
|
208
|
-
]
|
|
209
|
-
},
|
|
210
|
-
b("inventory.transfer.form.items.autoCalculated")
|
|
211
|
-
)
|
|
212
|
-
]
|
|
213
|
-
)
|
|
214
|
-
]
|
|
215
|
-
) : L(
|
|
216
|
-
me.FmTextField,
|
|
217
|
-
{
|
|
218
|
-
modelValue: Z(s.totalCost ?? { amount: 0, precision: 0 }),
|
|
219
|
-
key: s.sku._id,
|
|
220
|
-
"onUpdate:modelValue": (k) => {
|
|
221
|
-
n.updateItem({
|
|
222
|
-
...s,
|
|
223
|
-
totalCost: {
|
|
224
|
-
...ct(+k),
|
|
225
|
-
currency: Ae()
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
},
|
|
229
|
-
rules: [Pe(0), pt(2)]
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
prepend() {
|
|
233
|
-
return y ? L(
|
|
234
|
-
"div",
|
|
235
|
-
{
|
|
236
|
-
class: [
|
|
237
|
-
"text-fm-typo-en-body-lg-400",
|
|
238
|
-
n.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
239
|
-
]
|
|
240
|
-
},
|
|
241
|
-
Qe()
|
|
242
|
-
) : null;
|
|
243
|
-
},
|
|
244
|
-
append() {
|
|
245
|
-
return r ? L(me.FmButton, {
|
|
246
|
-
prependIcon: "close",
|
|
247
|
-
variant: "tertiary",
|
|
248
|
-
disabled: n.disabled,
|
|
249
|
-
onClick() {
|
|
250
|
-
n.updateItem({
|
|
251
|
-
...s,
|
|
252
|
-
// NOTE: different from PO template, if a default cost is reenabled,
|
|
253
|
-
// the total cost will automatically assigned
|
|
254
|
-
totalCost: re(s.sku, s.quantity, s.measurement, {
|
|
255
|
-
supplier: n.supplier
|
|
256
|
-
})
|
|
257
|
-
}), i[s.sku._id] = !1;
|
|
258
|
-
}
|
|
259
|
-
}) : null;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
);
|
|
263
|
-
},
|
|
264
|
-
enableSorting: !1
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
id: "Delete",
|
|
268
|
-
header: "",
|
|
269
|
-
cell(c) {
|
|
270
|
-
const s = c.row.original;
|
|
271
|
-
return L(me.FmButton, {
|
|
272
|
-
key: s.sku._id,
|
|
273
|
-
class: "delete-button",
|
|
274
|
-
type: "button",
|
|
275
|
-
icon: "delete",
|
|
276
|
-
variant: "tertiary",
|
|
277
|
-
size: "md",
|
|
278
|
-
disabled: n.disabled,
|
|
279
|
-
onClick: () => {
|
|
280
|
-
n.deleteItem(s);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
},
|
|
284
|
-
enableSorting: !1,
|
|
285
|
-
size: 40,
|
|
286
|
-
meta: {
|
|
287
|
-
cellClass: "",
|
|
288
|
-
headerClass: ""
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
];
|
|
292
|
-
return {
|
|
293
|
-
columnDefs: T(() => m.enableTotalCost && n.transferType === V.PURCHASE ? o : o.filter(
|
|
294
|
-
(c) => c.id !== "Cost"
|
|
295
|
-
/* Cost */
|
|
296
|
-
))
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
const Tt = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, It = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, $t = { class: "w-[450px] xs:w-full flex" }, At = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Dt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ze = /* @__PURE__ */ ue({
|
|
300
|
-
__name: "SupplierPriceHistory",
|
|
301
|
-
props: {
|
|
302
|
-
prices: {}
|
|
303
|
-
},
|
|
304
|
-
setup(n) {
|
|
305
|
-
const b = Te();
|
|
306
|
-
function i(d) {
|
|
307
|
-
return b.suppliers.find((m) => m._id === d);
|
|
308
|
-
}
|
|
309
|
-
return (d, m) => (F(), $("div", Tt, [
|
|
310
|
-
(F(!0), $(ie, null, $e(Object.keys(d.prices), (t) => {
|
|
311
|
-
var o;
|
|
312
|
-
return F(), $("div", {
|
|
313
|
-
key: t,
|
|
314
|
-
class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
|
|
315
|
-
}, [
|
|
316
|
-
a("div", It, R((o = i(t)) == null ? void 0 : o.name), 1),
|
|
317
|
-
a("div", $t, [
|
|
318
|
-
(F(!0), $(ie, null, $e(d.prices[t].slice(0, 3), (w) => {
|
|
319
|
-
var c;
|
|
320
|
-
return F(), $("div", {
|
|
321
|
-
key: w.date,
|
|
322
|
-
class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
|
|
323
|
-
}, [
|
|
324
|
-
a("div", At, [
|
|
325
|
-
a("span", null, R(w.totalCost ? e(je)(w.totalCost) : "No data"), 1),
|
|
326
|
-
m[0] || (m[0] = a("span", { class: "text-fm-color-typo-secondary" }, "/", -1)),
|
|
327
|
-
a("span", null, R(e(Z)(w.totalUnit, !1)), 1),
|
|
328
|
-
a("span", null, R(((c = w.measurement) == null ? void 0 : c.abbrev) ?? w.unit.abbrev), 1)
|
|
329
|
-
]),
|
|
330
|
-
a("div", Dt, [
|
|
331
|
-
a("span", null, "(#" + R(w.seqNumber) + ")", 1),
|
|
332
|
-
m[1] || (m[1] = a("span", null, R(" "), -1)),
|
|
333
|
-
a("span", null, R(e(Re)(new Date(w.date))), 1)
|
|
334
|
-
])
|
|
335
|
-
]);
|
|
336
|
-
}), 128))
|
|
337
|
-
])
|
|
338
|
-
]);
|
|
339
|
-
}), 128))
|
|
340
|
-
]));
|
|
341
|
-
}
|
|
342
|
-
}), Vt = { class: "flex flex-col gap-8 py-16" }, Rt = { class: "flex items-center" }, Ot = { class: "flex-1 flex gap-1 items-center" }, Ut = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Bt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Mt = { class: "flex gap-8 w-full" }, Et = { class: "flex-1 flex flex-col gap-4" }, Lt = { class: "flex-1 flex flex-col gap-4" }, qt = { class: "flex gap-8 w-full" }, Nt = { class: "flex-1 flex flex-col gap-4" }, Ht = {
|
|
343
|
-
key: 0,
|
|
344
|
-
class: "flex-1 flex flex-col gap-4"
|
|
345
|
-
}, zt = /* @__PURE__ */ ue({
|
|
346
|
-
__name: "TransferItem",
|
|
347
|
-
props: {
|
|
348
|
-
cellByColId: {},
|
|
349
|
-
comparePriceBySku: {},
|
|
350
|
-
showComparePrice: { type: Boolean },
|
|
351
|
-
row: {}
|
|
352
|
-
},
|
|
353
|
-
setup(n) {
|
|
354
|
-
const { t: b } = ve();
|
|
355
|
-
return (i, d) => {
|
|
356
|
-
var o, w, c, s, r, y, k, S, p, u, h, C, B, P, A, M, X, te, G, K, j, _, g, U, se, Q, oe;
|
|
357
|
-
const m = I("FmLabel"), t = I("FmSpacer");
|
|
358
|
-
return F(), $("div", Vt, [
|
|
359
|
-
a("div", Rt, [
|
|
360
|
-
a("div", Ot, [
|
|
361
|
-
a("span", Ut, " (" + R(i.row.original.sku.code) + ") ", 1),
|
|
362
|
-
a("span", Bt, R(i.row.original.sku.name), 1)
|
|
363
|
-
]),
|
|
364
|
-
a("div", null, [
|
|
365
|
-
v(e(ye), {
|
|
366
|
-
render: (c = (w = (o = i.cellByColId.Delete) == null ? void 0 : o.column) == null ? void 0 : w.columnDef) == null ? void 0 : c.cell,
|
|
367
|
-
props: (r = (s = i.cellByColId.Delete) == null ? void 0 : s.getContext) == null ? void 0 : r.call(s)
|
|
368
|
-
}, null, 8, ["render", "props"])
|
|
369
|
-
])
|
|
370
|
-
]),
|
|
371
|
-
a("div", Mt, [
|
|
372
|
-
a("div", Et, [
|
|
373
|
-
v(m, {
|
|
374
|
-
label: e(b)(`inventory.transfer.form.items.table.${e(E).Code}`)
|
|
375
|
-
}, null, 8, ["label"]),
|
|
376
|
-
v(e(ye), {
|
|
377
|
-
render: (S = (k = (y = i.cellByColId[e(E).Code]) == null ? void 0 : y.column) == null ? void 0 : k.columnDef) == null ? void 0 : S.cell,
|
|
378
|
-
props: (u = (p = i.cellByColId[e(E).Code]) == null ? void 0 : p.getContext) == null ? void 0 : u.call(p)
|
|
379
|
-
}, null, 8, ["render", "props"]),
|
|
380
|
-
d[0] || (d[0] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
381
|
-
]),
|
|
382
|
-
a("div", Lt, [
|
|
383
|
-
v(m, {
|
|
384
|
-
label: e(b)(`inventory.transfer.form.items.table.${e(E).Name}`)
|
|
385
|
-
}, null, 8, ["label"]),
|
|
386
|
-
v(e(ye), {
|
|
387
|
-
render: (B = (C = (h = i.cellByColId[e(E).Name]) == null ? void 0 : h.column) == null ? void 0 : C.columnDef) == null ? void 0 : B.cell,
|
|
388
|
-
props: (A = (P = i.cellByColId[e(E).Name]) == null ? void 0 : P.getContext) == null ? void 0 : A.call(P)
|
|
389
|
-
}, null, 8, ["render", "props"]),
|
|
390
|
-
d[1] || (d[1] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
391
|
-
])
|
|
392
|
-
]),
|
|
393
|
-
a("div", qt, [
|
|
394
|
-
a("div", Nt, [
|
|
395
|
-
v(m, {
|
|
396
|
-
label: e(b)(`inventory.transfer.form.items.table.${e(E).Amount}`)
|
|
397
|
-
}, null, 8, ["label"]),
|
|
398
|
-
v(e(ye), {
|
|
399
|
-
render: (te = (X = (M = i.cellByColId[e(E).Amount]) == null ? void 0 : M.column) == null ? void 0 : X.columnDef) == null ? void 0 : te.cell,
|
|
400
|
-
props: (K = (G = i.cellByColId[e(E).Amount]) == null ? void 0 : G.getContext) == null ? void 0 : K.call(G)
|
|
401
|
-
}, null, 8, ["render", "props"]),
|
|
402
|
-
d[2] || (d[2] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
403
|
-
]),
|
|
404
|
-
i.cellByColId[e(E).Cost] ? (F(), $("div", Ht, [
|
|
405
|
-
v(Ye, { "z-index": 50 }, {
|
|
406
|
-
default: O(() => [
|
|
407
|
-
v(m, {
|
|
408
|
-
label: e(b)(`inventory.transfer.form.items.table.${e(E).Cost}2`)
|
|
409
|
-
}, null, 8, ["label"])
|
|
410
|
-
]),
|
|
411
|
-
_: 1
|
|
412
|
-
}),
|
|
413
|
-
v(e(ye), {
|
|
414
|
-
render: (g = (_ = (j = i.cellByColId[e(E).Cost]) == null ? void 0 : j.column) == null ? void 0 : _.columnDef) == null ? void 0 : g.cell,
|
|
415
|
-
props: (se = (U = i.cellByColId[e(E).Cost]) == null ? void 0 : U.getContext) == null ? void 0 : se.call(U)
|
|
416
|
-
}, null, 8, ["render", "props"]),
|
|
417
|
-
d[3] || (d[3] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
418
|
-
])) : z("", !0)
|
|
419
|
-
]),
|
|
420
|
-
i.showComparePrice && Object.keys(i.comparePriceBySku[(Q = i.row.original.sku) == null ? void 0 : Q._id] ?? {}).length > 0 ? (F(), $(ie, { key: 0 }, [
|
|
421
|
-
v(t, { class: "h-8" }),
|
|
422
|
-
v(Ze, {
|
|
423
|
-
prices: i.comparePriceBySku[(oe = i.row.original.sku) == null ? void 0 : oe._id]
|
|
424
|
-
}, null, 8, ["prices"])
|
|
425
|
-
], 64)) : z("", !0)
|
|
426
|
-
]);
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
function Ce(n) {
|
|
431
|
-
return mt.parse(n);
|
|
432
|
-
}
|
|
433
|
-
function Fe(n) {
|
|
434
|
-
return {
|
|
435
|
-
_id: n.doc._id,
|
|
436
|
-
internal: n.type,
|
|
437
|
-
contactName: n.doc.profile.name,
|
|
438
|
-
name: n.doc.profile.name,
|
|
439
|
-
email: n.doc.profile.email,
|
|
440
|
-
phoneNumber: n.doc.profile.phoneNo,
|
|
441
|
-
registrationNumber: n.doc.profile.regNo,
|
|
442
|
-
address: n.doc.profile.address
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
function jt(n, b, i = !1, d = !1) {
|
|
446
|
-
const m = Te(), t = Oe();
|
|
447
|
-
t.watchLocation(async () => {
|
|
448
|
-
var B;
|
|
449
|
-
await m.readSuppliers();
|
|
450
|
-
const p = n();
|
|
451
|
-
if ((B = p.supplier) != null && B._id) return;
|
|
452
|
-
const u = d ? m.suppliers[0] : m.businessSuppliers[0], C = (i ? t.locations.filter((P) => P.doc._id !== t.currentLocation.doc._id) : t.locations)[0];
|
|
453
|
-
b({
|
|
454
|
-
...p,
|
|
455
|
-
supplier: u ? Ce(u) : C ? Fe(C) : p.supplier
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
const o = T(
|
|
459
|
-
() => {
|
|
460
|
-
var p, u;
|
|
461
|
-
return typeof ((u = (p = n()) == null ? void 0 : p.supplier) == null ? void 0 : u.internal) == "string" ? V.TRANSFER : V.PURCHASE;
|
|
462
|
-
}
|
|
463
|
-
), w = T({
|
|
464
|
-
get() {
|
|
465
|
-
var p, u;
|
|
466
|
-
return (u = (p = n()) == null ? void 0 : p.supplier) == null ? void 0 : u._id;
|
|
467
|
-
},
|
|
468
|
-
set(p) {
|
|
469
|
-
const u = n() ?? {};
|
|
470
|
-
if (o.value === V.PURCHASE) {
|
|
471
|
-
const A = (d ? m.suppliers : m.businessSuppliers).find((M) => M._id === p);
|
|
472
|
-
b({
|
|
473
|
-
...u,
|
|
474
|
-
supplier: A ? Ce(A) : u.supplier
|
|
475
|
-
});
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
const B = (i ? t.locations.filter((P) => P.doc._id !== t.currentLocation.doc._id) : t.locations).find((P) => P.doc._id === p);
|
|
479
|
-
b({
|
|
480
|
-
...u,
|
|
481
|
-
supplier: B ? Fe(B) : u.supplier
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
}), c = T(() => m.locationSuppliers.map(Ce)), s = T(() => m.businessSuppliers.map(Ce)), r = T(() => {
|
|
485
|
-
const p = [...c.value], u = [...s.value];
|
|
486
|
-
return d ? [...u, ...p] : u;
|
|
487
|
-
}), y = T(() => {
|
|
488
|
-
var h;
|
|
489
|
-
const p = ((h = t._currentLocation) == null ? void 0 : h.type) === We.warehouse;
|
|
490
|
-
return (i ? t.locations.filter((C) => C.doc._id !== t.currentLocation.doc._id) : t.locations).filter((C) => p || C.acceptRequest).map(Fe);
|
|
491
|
-
}), k = T(() => {
|
|
492
|
-
if (o.value === V.PURCHASE) {
|
|
493
|
-
const u = c.value.map((C) => ({
|
|
494
|
-
label: C.name,
|
|
495
|
-
value: C._id
|
|
496
|
-
})), h = s.value.map((C) => ({
|
|
497
|
-
label: C.name,
|
|
498
|
-
sublabel: "Business supplier",
|
|
499
|
-
value: C._id
|
|
500
|
-
}));
|
|
501
|
-
return d ? [...u, ...h] : h;
|
|
502
|
-
}
|
|
503
|
-
return y.value.map((u) => ({
|
|
504
|
-
label: u.name,
|
|
505
|
-
sublabel: u.internal ? `${u.internal}` : void 0,
|
|
506
|
-
value: u._id
|
|
507
|
-
}));
|
|
508
|
-
}), S = T(() => {
|
|
509
|
-
var C, B;
|
|
510
|
-
const p = (B = (C = n()) == null ? void 0 : C.supplier) == null ? void 0 : B._id;
|
|
511
|
-
if (o.value === V.PURCHASE) {
|
|
512
|
-
const P = m.suppliers.find((A) => A._id === p);
|
|
513
|
-
return P ? Ce(P) : null;
|
|
514
|
-
}
|
|
515
|
-
const h = t.locations.find((P) => P.doc._id);
|
|
516
|
-
return h ? Fe(h) : null;
|
|
517
|
-
});
|
|
518
|
-
return {
|
|
519
|
-
transferLocationModel: w,
|
|
520
|
-
transferLocationOptions: k,
|
|
521
|
-
locationOptionsTypePurchase: r,
|
|
522
|
-
locationOptionsTypePurchaseLocationLevel: c,
|
|
523
|
-
locationOptionsTypeTransfer: y,
|
|
524
|
-
selectedLocation: S
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
function Qt(n) {
|
|
528
|
-
const b = T({
|
|
529
|
-
get() {
|
|
530
|
-
const t = n.getEffectiveAt();
|
|
531
|
-
return t ? new Date(t) : null;
|
|
532
|
-
},
|
|
533
|
-
set(t) {
|
|
534
|
-
n.setEffectiveAt((t == null ? void 0 : t.toISOString()) ?? null);
|
|
535
|
-
}
|
|
536
|
-
}), i = T({
|
|
537
|
-
get() {
|
|
538
|
-
return !!b.value;
|
|
539
|
-
},
|
|
540
|
-
set(t) {
|
|
541
|
-
t ? b.value = /* @__PURE__ */ new Date() : b.value = null;
|
|
542
|
-
}
|
|
543
|
-
}), d = T({
|
|
544
|
-
get() {
|
|
545
|
-
return b.value === null ? "" : Re(b.value);
|
|
546
|
-
},
|
|
547
|
-
set(t) {
|
|
548
|
-
t ? b.value = /* @__PURE__ */ new Date(`${t} ${m.value}`) : b.value = null;
|
|
549
|
-
}
|
|
550
|
-
}), m = T({
|
|
551
|
-
get() {
|
|
552
|
-
return b.value === null ? "" : ft(b.value);
|
|
553
|
-
},
|
|
554
|
-
set(t) {
|
|
555
|
-
t ? b.value = /* @__PURE__ */ new Date(`${d.value} ${t}`) : b.value = null;
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
return {
|
|
559
|
-
backdatePo: b,
|
|
560
|
-
backdateSwitch: i,
|
|
561
|
-
backdateModel: d,
|
|
562
|
-
backdateTimeModel: m
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
const Wt = {
|
|
566
|
-
width: "24",
|
|
567
|
-
height: "24",
|
|
568
|
-
viewBox: "0 0 24 24",
|
|
569
|
-
fill: "none",
|
|
570
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
571
|
-
}, Yt = ["fill"], Zt = ["fill"], Kt = ["stroke"], Jt = ["stroke"], Xt = /* @__PURE__ */ ue({
|
|
572
|
-
__name: "SparkIcon",
|
|
573
|
-
props: {
|
|
574
|
-
size: {
|
|
575
|
-
type: Number,
|
|
576
|
-
default: 24
|
|
577
|
-
},
|
|
578
|
-
color: {
|
|
579
|
-
type: String,
|
|
580
|
-
default: "#c7c7cc"
|
|
581
|
-
}
|
|
582
|
-
},
|
|
583
|
-
setup(n) {
|
|
584
|
-
return (b, i) => (F(), $("svg", Wt, [
|
|
585
|
-
a("path", {
|
|
586
|
-
d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
|
|
587
|
-
fill: n.color
|
|
588
|
-
}, null, 8, Yt),
|
|
589
|
-
a("path", {
|
|
590
|
-
d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
|
|
591
|
-
fill: n.color
|
|
592
|
-
}, null, 8, Zt),
|
|
593
|
-
a("path", {
|
|
594
|
-
d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
|
|
595
|
-
stroke: n.color,
|
|
596
|
-
"stroke-width": "1.5",
|
|
597
|
-
"stroke-linecap": "round",
|
|
598
|
-
"stroke-linejoin": "round"
|
|
599
|
-
}, null, 8, Kt),
|
|
600
|
-
a("path", {
|
|
601
|
-
d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
|
|
602
|
-
stroke: n.color,
|
|
603
|
-
"stroke-width": "1.5",
|
|
604
|
-
"stroke-linecap": "round",
|
|
605
|
-
"stroke-linejoin": "round"
|
|
606
|
-
}, null, 8, Jt)
|
|
607
|
-
]));
|
|
608
|
-
}
|
|
609
|
-
}), Gt = { class: "flex gap-8 items-center" }, es = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, ts = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, ss = { class: "flex items-center w-full" }, os = { class: "flex-1" }, ns = { class: "fm-typo-en-title-sm-800" }, ls = { class: "flex items-start gap-8" }, as = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, rs = { class: "flex gap-1" }, Le = /* @__PURE__ */ ue({
|
|
610
|
-
__name: "ForecastStock",
|
|
611
|
-
props: {
|
|
612
|
-
disabled: { type: Boolean }
|
|
613
|
-
},
|
|
614
|
-
emits: ["update:poItems"],
|
|
615
|
-
setup(n, { emit: b }) {
|
|
616
|
-
const i = b, d = H(!1), m = H(7), t = ht(), o = Ve(), w = Ue(), { t: c } = ve();
|
|
617
|
-
async function s() {
|
|
618
|
-
if (m.value < 1)
|
|
619
|
-
return;
|
|
620
|
-
d.value = !1, await t.readPurchaseOrder(m.value);
|
|
621
|
-
const r = [];
|
|
622
|
-
if (t.purchaseOrderForecast.skus.length <= 0) {
|
|
623
|
-
o.open({
|
|
624
|
-
message: c("inventory.transfer.form.items.forecastStock.notAvailable"),
|
|
625
|
-
type: "info"
|
|
626
|
-
});
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
const y = t.purchaseOrderForecast.skus.reduce((k, S) => {
|
|
630
|
-
const p = w.skus.find((C) => C._id === S.id);
|
|
631
|
-
if (k.find((C) => C.sku._id === S.id) || !p)
|
|
632
|
-
return k;
|
|
633
|
-
const h = {
|
|
634
|
-
sku: p,
|
|
635
|
-
code: p.code,
|
|
636
|
-
name: p.name,
|
|
637
|
-
quantity: {
|
|
638
|
-
amount: S.amount,
|
|
639
|
-
precision: 0
|
|
640
|
-
}
|
|
641
|
-
};
|
|
642
|
-
return k.push(h), k;
|
|
643
|
-
}, r);
|
|
644
|
-
i("update:poItems", y);
|
|
645
|
-
}
|
|
646
|
-
return (r, y) => {
|
|
647
|
-
const k = I("FmButton"), S = I("FmIcon"), p = I("FmStepperField"), u = I("FmPopover");
|
|
648
|
-
return F(), Y(u, {
|
|
649
|
-
disabled: r.disabled,
|
|
650
|
-
class: "flex",
|
|
651
|
-
"show-popover": d.value,
|
|
652
|
-
onPopoverChanged: y[3] || (y[3] = (h) => d.value = h)
|
|
653
|
-
}, {
|
|
654
|
-
"popover-button": O(() => [
|
|
655
|
-
v(k, {
|
|
656
|
-
label: "unused",
|
|
657
|
-
variant: "secondary",
|
|
658
|
-
"text-color": r.disabled ? "disabled" : "primary",
|
|
659
|
-
"bg-color": "transparent",
|
|
660
|
-
"border-color": r.disabled ? "disabled" : "primary",
|
|
661
|
-
disabled: r.disabled
|
|
662
|
-
}, {
|
|
663
|
-
default: O(() => [
|
|
664
|
-
a("div", Gt, [
|
|
665
|
-
v(Xt, {
|
|
666
|
-
size: 24,
|
|
667
|
-
color: r.disabled ? "#c7c7cc" : "#ff7823"
|
|
668
|
-
}, null, 8, ["color"]),
|
|
669
|
-
a("div", es, R(e(c)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
670
|
-
])
|
|
671
|
-
]),
|
|
672
|
-
_: 1
|
|
673
|
-
}, 8, ["text-color", "border-color", "disabled"])
|
|
674
|
-
]),
|
|
675
|
-
default: O(() => [
|
|
676
|
-
a("div", ts, [
|
|
677
|
-
a("div", ss, [
|
|
678
|
-
a("div", os, [
|
|
679
|
-
v(St, { "z-index": 99 }, {
|
|
680
|
-
default: O(() => [
|
|
681
|
-
a("p", ns, R(e(c)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
682
|
-
]),
|
|
683
|
-
_: 1
|
|
684
|
-
})
|
|
685
|
-
]),
|
|
686
|
-
v(k, {
|
|
687
|
-
icon: "close",
|
|
688
|
-
size: "md",
|
|
689
|
-
variant: "tertiary",
|
|
690
|
-
onClick: y[0] || (y[0] = (h) => d.value = !1)
|
|
691
|
-
})
|
|
692
|
-
]),
|
|
693
|
-
v(p, {
|
|
694
|
-
modelValue: m.value,
|
|
695
|
-
"onUpdate:modelValue": y[1] || (y[1] = (h) => m.value = h),
|
|
696
|
-
label: e(c)("inventory.transfer.form.items.forecastStock.days"),
|
|
697
|
-
rules: [e(Pe)(1)]
|
|
698
|
-
}, {
|
|
699
|
-
"helper-text": O(() => [
|
|
700
|
-
a("div", ls, [
|
|
701
|
-
v(S, {
|
|
702
|
-
name: "warning",
|
|
703
|
-
size: "sm",
|
|
704
|
-
class: "text-fm-color-system-warning-300"
|
|
705
|
-
}),
|
|
706
|
-
a("div", as, R(e(c)("inventory.transfer.form.items.forecastStock.replace")), 1)
|
|
707
|
-
])
|
|
708
|
-
]),
|
|
709
|
-
_: 1
|
|
710
|
-
}, 8, ["modelValue", "label", "rules"]),
|
|
711
|
-
a("div", rs, [
|
|
712
|
-
y[4] || (y[4] = a("div", { class: "grow" }, null, -1)),
|
|
713
|
-
v(k, {
|
|
714
|
-
label: e(c)("common.cancel"),
|
|
715
|
-
variant: "tertiary",
|
|
716
|
-
onClick: y[2] || (y[2] = (h) => d.value = !1)
|
|
717
|
-
}, null, 8, ["label"]),
|
|
718
|
-
v(k, {
|
|
719
|
-
label: e(c)("inventory.transfer.form.items.forecastStock.generate"),
|
|
720
|
-
onClick: s
|
|
721
|
-
}, null, 8, ["label"])
|
|
722
|
-
])
|
|
723
|
-
])
|
|
724
|
-
]),
|
|
725
|
-
_: 1
|
|
726
|
-
}, 8, ["disabled", "show-popover"]);
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
function is() {
|
|
731
|
-
const n = Ve(), b = He(), i = H(!1);
|
|
732
|
-
De(i, (o) => {
|
|
733
|
-
o && (m.value = !0, d().finally(() => {
|
|
734
|
-
m.value = !1;
|
|
735
|
-
}));
|
|
736
|
-
});
|
|
737
|
-
async function d() {
|
|
738
|
-
try {
|
|
739
|
-
const { startDate: o, endDate: w } = yt(6), r = (await b.getPurchaseOrders({ start: o, end: w })).filter(
|
|
740
|
-
(y) => {
|
|
741
|
-
var k, S;
|
|
742
|
-
return y.status === vt.enum.COMPLETE && ((k = y.supplier) == null ? void 0 : k.internal) !== "warehouse" && ((S = y.supplier) == null ? void 0 : S.internal) !== "restaurant";
|
|
743
|
-
}
|
|
744
|
-
).reduce((y, k) => {
|
|
745
|
-
const S = new Date(bt(k._id)), p = k.supplier._id;
|
|
746
|
-
for (const u of k.items) {
|
|
747
|
-
if (!u.totalCost) continue;
|
|
748
|
-
const h = y[u.sku._id] ?? {}, C = h[p] ?? [];
|
|
749
|
-
C.push({
|
|
750
|
-
date: S.toISOString(),
|
|
751
|
-
totalUnit: u.quantity,
|
|
752
|
-
totalCost: u.totalCost,
|
|
753
|
-
unit: u.sku.unit,
|
|
754
|
-
measurement: u.measurement,
|
|
755
|
-
seqNumber: k.seqNumber
|
|
756
|
-
}), h[p] = C, y[u.sku._id] = h;
|
|
757
|
-
}
|
|
758
|
-
return y;
|
|
759
|
-
}, {});
|
|
760
|
-
t.value = r;
|
|
761
|
-
} catch {
|
|
762
|
-
n.open({
|
|
763
|
-
title: "Something went wrong",
|
|
764
|
-
message: "Cannot retrieve supplier purchase history. Please try again."
|
|
765
|
-
}), i.value = !1;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
const m = H(!1), t = H({});
|
|
769
|
-
return {
|
|
770
|
-
comparePricesToggle: i,
|
|
771
|
-
comparePriceFetching: m,
|
|
772
|
-
comparePriceBySku: t
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
const us = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, ds = { key: 0 }, cs = ["colspan"], ps = /* @__PURE__ */ ue({
|
|
776
|
-
__name: "TransferItemTable",
|
|
777
|
-
props: {
|
|
778
|
-
row: {},
|
|
779
|
-
comparePriceBySku: {},
|
|
780
|
-
showComparePrice: { type: Boolean }
|
|
781
|
-
},
|
|
782
|
-
setup(n) {
|
|
783
|
-
function b(i) {
|
|
784
|
-
return i.column.columnDef.meta;
|
|
785
|
-
}
|
|
786
|
-
return (i, d) => {
|
|
787
|
-
var m, t;
|
|
788
|
-
return F(), $(ie, null, [
|
|
789
|
-
a("tr", {
|
|
790
|
-
class: N(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
|
|
791
|
-
"bg-fm-color-neutral-gray-100": i.row.getIsSelected()
|
|
792
|
-
}])
|
|
793
|
-
}, [
|
|
794
|
-
(F(!0), $(ie, null, $e(i.row.getVisibleCells(), (o) => {
|
|
795
|
-
var w, c, s, r;
|
|
796
|
-
return F(), $("td", {
|
|
797
|
-
key: o.id,
|
|
798
|
-
class: N([
|
|
799
|
-
"h-[52px] px-16 text-fm-color-typo-primary",
|
|
800
|
-
((w = b(o)) == null ? void 0 : w.cellClass) ?? "px-16"
|
|
801
|
-
]),
|
|
802
|
-
style: et({
|
|
803
|
-
width: (c = b(o)) == null ? void 0 : c.width,
|
|
804
|
-
maxWidth: (s = b(o)) == null ? void 0 : s.maxWidth,
|
|
805
|
-
textAlign: ((r = b(o)) == null ? void 0 : r.textAlign) ?? "left"
|
|
806
|
-
})
|
|
807
|
-
}, [
|
|
808
|
-
a("span", us, [
|
|
809
|
-
v(e(ye), {
|
|
810
|
-
render: o.column.columnDef.cell,
|
|
811
|
-
props: o.getContext()
|
|
812
|
-
}, null, 8, ["render", "props"])
|
|
813
|
-
])
|
|
814
|
-
], 6);
|
|
815
|
-
}), 128))
|
|
816
|
-
], 2),
|
|
817
|
-
i.showComparePrice && Object.keys(i.comparePriceBySku[(m = i.row.original.sku) == null ? void 0 : m._id] ?? {}).length > 0 ? (F(), $("tr", ds, [
|
|
818
|
-
a("td", {
|
|
819
|
-
colspan: i.row.getVisibleCells().length
|
|
820
|
-
}, [
|
|
821
|
-
v(Ze, {
|
|
822
|
-
prices: i.comparePriceBySku[(t = i.row.original.sku) == null ? void 0 : t._id]
|
|
823
|
-
}, null, 8, ["prices"])
|
|
824
|
-
], 8, cs)
|
|
825
|
-
])) : z("", !0)
|
|
826
|
-
], 64);
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
}), ms = { class: "flex flex-col gap-4" }, fs = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, ys = { class: "flex flex-col gap-16" }, vs = { class: "flex flex-col gap-24" }, bs = { class: "flex flex-col gap-8" }, _s = { class: "flex flex-col gap-4" }, gs = { class: "flex flex-col gap-8" }, ks = { class: "flex flex-col gap-4" }, Cs = {
|
|
830
|
-
key: 2,
|
|
831
|
-
class: "flex flex-col gap-8"
|
|
832
|
-
}, hs = { class: "flex flex-col gap-4" }, xs = {
|
|
833
|
-
key: 3,
|
|
834
|
-
class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
|
|
835
|
-
}, ws = {
|
|
836
|
-
key: 0,
|
|
837
|
-
class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
|
|
838
|
-
}, Ss = { class: "flex-1" }, Fs = { class: "flex-1" }, Ps = {
|
|
839
|
-
key: 1,
|
|
840
|
-
class: "flex items-center gap-4"
|
|
841
|
-
}, Ts = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, Is = { class: "flex flex-col gap-16" }, $s = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, As = { class: "flex gap-8" }, Ds = { key: 0 }, Vs = /* @__PURE__ */ ue({
|
|
842
|
-
__name: "TransferForm2",
|
|
843
|
-
props: {
|
|
844
|
-
modelValue: {},
|
|
845
|
-
request: {},
|
|
846
|
-
disabled: { type: Boolean },
|
|
847
|
-
suppliers: {},
|
|
848
|
-
skus: {},
|
|
849
|
-
lastClosingDate: {}
|
|
850
|
-
},
|
|
851
|
-
emits: ["validation-success", "form:ready"],
|
|
852
|
-
setup(n, { expose: b, emit: i }) {
|
|
853
|
-
const d = n, m = i, t = xt(), { t: o } = ve(), w = Oe(), c = Ue(), s = kt(), r = Te(), y = ze(), k = nt(), { breakpoints: S } = Ne(), p = T(() => S.value.xs || S.value.sm), u = T(
|
|
854
|
-
() => k.templates.value.find((l) => l._id === t.template)
|
|
855
|
-
), h = T(() => t.status === "DRAFT" || !t._rev);
|
|
856
|
-
De(u, (l) => {
|
|
857
|
-
l && h.value && (t.supplier = (l == null ? void 0 : l.purchaseOrder.supplier) ?? t.supplier);
|
|
858
|
-
}), qe(async () => {
|
|
859
|
-
var l, f;
|
|
860
|
-
try {
|
|
861
|
-
if (!t.template) return;
|
|
862
|
-
if (await k.loadTemplate(t.template), !t.items.length) {
|
|
863
|
-
t.items = ((l = u.value) == null ? void 0 : l.purchaseOrder.items) ?? [];
|
|
864
|
-
const q = s.currentLocationSubsidiary();
|
|
865
|
-
t.netSuite = {
|
|
866
|
-
...t.netSuite,
|
|
867
|
-
subsidiary: {
|
|
868
|
-
id: q.id,
|
|
869
|
-
name: q.name
|
|
870
|
-
}
|
|
871
|
-
};
|
|
872
|
-
const ne = s.getAvailableItems((f = t.netSuite) == null ? void 0 : f.subsidiary.id), ee = t.items.map((W) => W.sku._id).filter((W) => ne.includes(W));
|
|
873
|
-
t.items = t.items.filter((W) => ee.includes(W.sku._id));
|
|
874
|
-
}
|
|
875
|
-
} finally {
|
|
876
|
-
m("form:ready");
|
|
877
|
-
}
|
|
878
|
-
});
|
|
879
|
-
const C = T(
|
|
880
|
-
() => w.currentLocation.type === We.restaurant
|
|
881
|
-
);
|
|
882
|
-
w.watchLocation(async () => {
|
|
883
|
-
location && (t.supplier || (t.supplier = r.suppliers.find((l) => l) ?? t.supplier));
|
|
884
|
-
});
|
|
885
|
-
const B = st(), P = jt(
|
|
886
|
-
() => t,
|
|
887
|
-
(l) => {
|
|
888
|
-
Object.assign(t, l);
|
|
889
|
-
},
|
|
890
|
-
!0,
|
|
891
|
-
!0
|
|
892
|
-
), A = T({
|
|
893
|
-
get() {
|
|
894
|
-
var l;
|
|
895
|
-
return typeof ((l = t == null ? void 0 : t.supplier) == null ? void 0 : l.internal) == "string" ? V.TRANSFER : V.PURCHASE;
|
|
896
|
-
},
|
|
897
|
-
set(l) {
|
|
898
|
-
var q;
|
|
899
|
-
const f = typeof ((q = t == null ? void 0 : t.supplier) == null ? void 0 : q.internal) == "string" ? V.TRANSFER : V.PURCHASE;
|
|
900
|
-
l !== f && (t.supplier = l === V.PURCHASE ? P.locationOptionsTypePurchase.value[0] : P.locationOptionsTypeTransfer.value[0]);
|
|
901
|
-
}
|
|
902
|
-
}), M = T(() => P.transferLocationOptions.value), X = T({
|
|
903
|
-
get() {
|
|
904
|
-
return t.supplier._id;
|
|
905
|
-
},
|
|
906
|
-
set(l) {
|
|
907
|
-
P.transferLocationModel.value = l;
|
|
908
|
-
}
|
|
909
|
-
}), te = T({
|
|
910
|
-
get() {
|
|
911
|
-
return t.remark ?? void 0;
|
|
912
|
-
},
|
|
913
|
-
set(l) {
|
|
914
|
-
t.remark = l;
|
|
915
|
-
}
|
|
916
|
-
}), G = T(() => s.currentLocationSubsidiary()), { backdatePo: K, backdateSwitch: j, backdateModel: _, backdateTimeModel: g } = Qt({
|
|
917
|
-
getEffectiveAt() {
|
|
918
|
-
return t.effectiveAt;
|
|
919
|
-
},
|
|
920
|
-
setEffectiveAt(l) {
|
|
921
|
-
t.effectiveAt = l;
|
|
922
|
-
}
|
|
923
|
-
}), { comparePricesToggle: U, comparePriceFetching: se, comparePriceBySku: Q } = is(), oe = H();
|
|
924
|
-
b({
|
|
925
|
-
validateInputs: () => {
|
|
926
|
-
var l, f;
|
|
927
|
-
(f = (l = oe.value) == null ? void 0 : l.validateInputs) == null || f.call(l);
|
|
928
|
-
},
|
|
929
|
-
resetInputsValidation: () => {
|
|
930
|
-
var l, f;
|
|
931
|
-
(f = (l = oe.value) == null ? void 0 : l.resetInputsValidation) == null || f.call(l);
|
|
932
|
-
},
|
|
933
|
-
resetInputs: () => {
|
|
934
|
-
var l, f;
|
|
935
|
-
(f = (l = oe.value) == null ? void 0 : l.resetInputs) == null || f.call(l);
|
|
936
|
-
}
|
|
937
|
-
});
|
|
938
|
-
const Ke = Pt({
|
|
939
|
-
updateItem: (l) => {
|
|
940
|
-
t.items = t.items.map((f) => f.sku._id !== l.sku._id ? f : l);
|
|
941
|
-
},
|
|
942
|
-
deleteItem: (l) => {
|
|
943
|
-
t.items = t.items.filter((f) => f.sku._id !== l.sku._id);
|
|
944
|
-
},
|
|
945
|
-
get supplier() {
|
|
946
|
-
return t.supplier;
|
|
947
|
-
},
|
|
948
|
-
get items() {
|
|
949
|
-
return t.items;
|
|
950
|
-
},
|
|
951
|
-
get transferType() {
|
|
952
|
-
return A.value;
|
|
953
|
-
},
|
|
954
|
-
get template() {
|
|
955
|
-
return u.value;
|
|
956
|
-
},
|
|
957
|
-
get disabled() {
|
|
958
|
-
return d.disabled;
|
|
959
|
-
}
|
|
960
|
-
}), Je = T(() => Ke.columnDefs.value);
|
|
961
|
-
function Xe() {
|
|
962
|
-
var he, xe, be, we;
|
|
963
|
-
const l = new Set((be = (xe = (he = u.value) == null ? void 0 : he.purchaseOrder) == null ? void 0 : xe.items) == null ? void 0 : be.map((D) => D.sku._id)), f = s.getAvailableItems((we = t.netSuite) == null ? void 0 : we.subsidiary.id), q = l.size ? c.skus.filter((D) => l.has(D._id)) : c.skus, ne = q.map((D) => D._id).filter((D) => f.includes(D)), ee = q.map(
|
|
964
|
-
(D) => ({
|
|
965
|
-
label: D.name,
|
|
966
|
-
sublabel: D.code,
|
|
967
|
-
value: D,
|
|
968
|
-
disabled: !ne.includes(D._id)
|
|
969
|
-
})
|
|
970
|
-
), W = ee.filter((D) => {
|
|
971
|
-
var le;
|
|
972
|
-
return (le = t.items) == null ? void 0 : le.find((de) => de.sku._id === D.value._id);
|
|
973
|
-
}).map((D) => D.value);
|
|
974
|
-
B.open({
|
|
975
|
-
title: o("inventory.transfer.form.items.selectItem"),
|
|
976
|
-
closeButton: !0,
|
|
977
|
-
contentComponent: Ct,
|
|
978
|
-
contentComponentProps: {
|
|
979
|
-
modelValue: W,
|
|
980
|
-
items: ee,
|
|
981
|
-
virtualScroll: !0
|
|
982
|
-
},
|
|
983
|
-
primaryActions: {
|
|
984
|
-
text: o("common.confirm"),
|
|
985
|
-
close: !0
|
|
986
|
-
},
|
|
987
|
-
secondaryActions: {
|
|
988
|
-
text: o("common.close"),
|
|
989
|
-
close: !0,
|
|
990
|
-
variant: "tertiary"
|
|
991
|
-
}
|
|
992
|
-
}).onPrimary((D) => {
|
|
993
|
-
const le = t.items ?? [], de = D.map((J) => {
|
|
994
|
-
var Se, _e;
|
|
995
|
-
const ce = le.find((pe) => pe.sku._id === J._id);
|
|
996
|
-
if (ce)
|
|
997
|
-
return ce;
|
|
998
|
-
const ae = ((_e = (Se = u.value) == null ? void 0 : Se.purchaseOrder.items) == null ? void 0 : _e.find(
|
|
999
|
-
(pe) => pe.sku._id === J._id
|
|
1000
|
-
)) ?? {
|
|
1001
|
-
sku: J,
|
|
1002
|
-
code: J.code,
|
|
1003
|
-
name: J.name,
|
|
1004
|
-
quantity: {
|
|
1005
|
-
amount: 1,
|
|
1006
|
-
precision: 0
|
|
1007
|
-
}
|
|
1008
|
-
};
|
|
1009
|
-
return A.value == V.PURCHASE && (ae.totalCost = re(
|
|
1010
|
-
ae.sku,
|
|
1011
|
-
ae.quantity,
|
|
1012
|
-
ae.measurement,
|
|
1013
|
-
{
|
|
1014
|
-
supplier: t.supplier
|
|
1015
|
-
}
|
|
1016
|
-
)), ae;
|
|
1017
|
-
});
|
|
1018
|
-
de.sort((J, ce) => J.sku.code.localeCompare(ce.sku.code)), t.items = de;
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
function Bs(l) {
|
|
1022
|
-
return l;
|
|
1023
|
-
}
|
|
1024
|
-
return (l, f) => {
|
|
1025
|
-
var _e, pe;
|
|
1026
|
-
const q = I("FmChip"), ne = I("FmLabel"), ee = I("FmField"), W = I("FmSelect"), he = I("FmTextField"), xe = I("FmTextarea"), be = I("FmSwitch"), we = I("FmDatePicker"), D = I("FmTimePicker"), le = I("FmFormGroup"), de = I("FmIcon"), J = I("FmButton"), ce = I("FmTooltip"), ae = I("FmTable"), Se = I("FmForm");
|
|
1027
|
-
return F(), $("div", ms, [
|
|
1028
|
-
a("div", fs, [
|
|
1029
|
-
(_e = d.modelValue) != null && _e.template ? (F(), Y(q, {
|
|
1030
|
-
key: 0,
|
|
1031
|
-
variant: l.disabled ? "warning" : void 0,
|
|
1032
|
-
label: `${e(o)("inventory.transfer.template.title")}: ${((pe = u.value) == null ? void 0 : pe.name) ?? e(o)("inventory.transfer.form.loading")}`,
|
|
1033
|
-
icon: "summarize",
|
|
1034
|
-
compact: ""
|
|
1035
|
-
}, null, 8, ["variant", "label"])) : z("", !0),
|
|
1036
|
-
v(q, {
|
|
1037
|
-
label: e(w).currentLocation.name,
|
|
1038
|
-
icon: "storefront",
|
|
1039
|
-
compact: ""
|
|
1040
|
-
}, null, 8, ["label"]),
|
|
1041
|
-
l.lastClosingDate ? (F(), Y(q, {
|
|
1042
|
-
key: 1,
|
|
1043
|
-
label: `${e(o)("inventory.transfer.form.lastClosing")}: ${e(Re)(l.lastClosingDate)} ${e(_t)(l.lastClosingDate)}`,
|
|
1044
|
-
icon: "calendar_month",
|
|
1045
|
-
compact: ""
|
|
1046
|
-
}, null, 8, ["label"])) : z("", !0)
|
|
1047
|
-
]),
|
|
1048
|
-
v(Se, {
|
|
1049
|
-
ref_key: "formRef",
|
|
1050
|
-
ref: oe,
|
|
1051
|
-
class: "flex flex-col gap-32",
|
|
1052
|
-
disabled: l.disabled,
|
|
1053
|
-
onValidationFailed: console.log,
|
|
1054
|
-
onValidationSuccess: f[12] || (f[12] = (Ie) => m("validation-success"))
|
|
1055
|
-
}, {
|
|
1056
|
-
default: O(() => {
|
|
1057
|
-
var Ie, Be;
|
|
1058
|
-
return [
|
|
1059
|
-
a("div", ys, [
|
|
1060
|
-
a("div", vs, [
|
|
1061
|
-
(Ie = d.modelValue) != null && Ie.template ? (F(), $(ie, { key: 0 }, [
|
|
1062
|
-
a("div", bs, [
|
|
1063
|
-
v(ne, {
|
|
1064
|
-
label: e(o)("inventory.transfer.form.type.title")
|
|
1065
|
-
}, null, 8, ["label"]),
|
|
1066
|
-
a("div", _s, [
|
|
1067
|
-
v(ee, null, {
|
|
1068
|
-
default: O(() => [
|
|
1069
|
-
a("span", {
|
|
1070
|
-
class: N({ "text-fm-color-typo-disabled": l.disabled })
|
|
1071
|
-
}, R(e(o)(`inventory.transfer.form.type.${A.value.toLocaleLowerCase("en-us")}`)), 3)
|
|
1072
|
-
]),
|
|
1073
|
-
_: 1
|
|
1074
|
-
}),
|
|
1075
|
-
a("div", {
|
|
1076
|
-
class: N([
|
|
1077
|
-
"fm-typo-en-body-sm-400",
|
|
1078
|
-
l.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
|
|
1079
|
-
])
|
|
1080
|
-
}, " This field is locked from template. ", 2)
|
|
1081
|
-
])
|
|
1082
|
-
]),
|
|
1083
|
-
a("div", gs, [
|
|
1084
|
-
v(ne, {
|
|
1085
|
-
label: A.value === e(V).PURCHASE ? e(o)("inventory.transfer.form.purchaseFrom") : e(o)("inventory.transfer.form.transferFrom")
|
|
1086
|
-
}, null, 8, ["label"]),
|
|
1087
|
-
a("div", ks, [
|
|
1088
|
-
v(ee, null, {
|
|
1089
|
-
default: O(() => {
|
|
1090
|
-
var x;
|
|
1091
|
-
return [
|
|
1092
|
-
a("span", {
|
|
1093
|
-
class: N({ "text-fm-color-typo-disabled": l.disabled })
|
|
1094
|
-
}, R((x = M.value.find((ge) => ge.value === X.value)) == null ? void 0 : x.label), 3)
|
|
1095
|
-
];
|
|
1096
|
-
}),
|
|
1097
|
-
_: 1
|
|
1098
|
-
}),
|
|
1099
|
-
a("div", {
|
|
1100
|
-
class: N([
|
|
1101
|
-
"fm-typo-en-body-sm-400",
|
|
1102
|
-
l.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
|
|
1103
|
-
])
|
|
1104
|
-
}, " This field is locked from template. ", 2)
|
|
1105
|
-
])
|
|
1106
|
-
])
|
|
1107
|
-
], 64)) : (F(), $(ie, { key: 1 }, [
|
|
1108
|
-
v(W, {
|
|
1109
|
-
label: e(o)("inventory.transfer.form.type.title"),
|
|
1110
|
-
"model-value": A.value,
|
|
1111
|
-
"onUpdate:modelValue": f[0] || (f[0] = (x) => A.value = x),
|
|
1112
|
-
items: [
|
|
1113
|
-
{
|
|
1114
|
-
label: e(o)("inventory.transfer.form.type.purchase"),
|
|
1115
|
-
value: e(V).PURCHASE,
|
|
1116
|
-
disabled: !e(P).locationOptionsTypePurchase.value.length,
|
|
1117
|
-
sublabel: e(P).locationOptionsTypePurchase.value.length ? void 0 : e(o)("inventory.transfer.form.noSupplierAvailable")
|
|
1118
|
-
},
|
|
1119
|
-
{
|
|
1120
|
-
label: e(o)("inventory.transfer.form.type.transfer"),
|
|
1121
|
-
value: e(V).TRANSFER,
|
|
1122
|
-
disabled: !e(P).locationOptionsTypeTransfer.value.length,
|
|
1123
|
-
sublabel: e(P).locationOptionsTypeTransfer.value.length ? void 0 : e(o)("inventory.transfer.form.noLocationAvailable")
|
|
1124
|
-
}
|
|
1125
|
-
],
|
|
1126
|
-
rules: [e(Pe)(1)(M.value)]
|
|
1127
|
-
}, null, 8, ["label", "model-value", "items", "rules"]),
|
|
1128
|
-
v(W, {
|
|
1129
|
-
label: A.value === e(V).PURCHASE ? e(o)("inventory.transfer.form.purchaseFrom") : e(o)("inventory.transfer.form.transferFrom"),
|
|
1130
|
-
modelValue: X.value,
|
|
1131
|
-
"onUpdate:modelValue": f[1] || (f[1] = (x) => X.value = x),
|
|
1132
|
-
items: M.value
|
|
1133
|
-
}, null, 8, ["label", "modelValue", "items"])
|
|
1134
|
-
], 64)),
|
|
1135
|
-
v(he, {
|
|
1136
|
-
label: e(o)("inventory.transfer.form.reference"),
|
|
1137
|
-
"label-mark": "optional",
|
|
1138
|
-
modelValue: e(t).ref,
|
|
1139
|
-
"onUpdate:modelValue": f[2] || (f[2] = (x) => e(t).ref = x)
|
|
1140
|
-
}, null, 8, ["label", "modelValue"]),
|
|
1141
|
-
v(xe, {
|
|
1142
|
-
label: e(o)("inventory.transfer.form.remark"),
|
|
1143
|
-
"label-mark": "optional",
|
|
1144
|
-
"max-length": 240,
|
|
1145
|
-
modelValue: te.value,
|
|
1146
|
-
"onUpdate:modelValue": f[3] || (f[3] = (x) => te.value = x),
|
|
1147
|
-
class: N([l.disabled ? "text-fm-color-typo-disabled " : ""])
|
|
1148
|
-
}, null, 8, ["label", "modelValue", "class"]),
|
|
1149
|
-
e(s).isEnabled ? (F(), $("div", Cs, [
|
|
1150
|
-
v(ne, {
|
|
1151
|
-
label: `NetSuite ${e(o)("inventory.transfer.form.netsuite.subsidiary")}`
|
|
1152
|
-
}, null, 8, ["label"]),
|
|
1153
|
-
a("div", hs, [
|
|
1154
|
-
v(ee, null, {
|
|
1155
|
-
default: O(() => {
|
|
1156
|
-
var x;
|
|
1157
|
-
return [
|
|
1158
|
-
a("span", {
|
|
1159
|
-
class: N({ "text-fm-color-typo-disabled": l.disabled })
|
|
1160
|
-
}, R((x = G.value) == null ? void 0 : x.fullName), 3)
|
|
1161
|
-
];
|
|
1162
|
-
}),
|
|
1163
|
-
_: 1
|
|
1164
|
-
}),
|
|
1165
|
-
a("div", {
|
|
1166
|
-
class: N([
|
|
1167
|
-
"fm-typo-en-body-sm-400",
|
|
1168
|
-
l.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
|
|
1169
|
-
])
|
|
1170
|
-
}, " This field is based on selected location. ", 2)
|
|
1171
|
-
])
|
|
1172
|
-
])) : z("", !0),
|
|
1173
|
-
e(y).enableBackdatePo ? (F(), $("div", xs, [
|
|
1174
|
-
a("div", {
|
|
1175
|
-
class: N([
|
|
1176
|
-
"flex",
|
|
1177
|
-
{
|
|
1178
|
-
"flex-col": p.value
|
|
1179
|
-
}
|
|
1180
|
-
])
|
|
1181
|
-
}, [
|
|
1182
|
-
v(be, {
|
|
1183
|
-
modelValue: e(j),
|
|
1184
|
-
"onUpdate:modelValue": f[4] || (f[4] = (x) => fe(j) ? j.value = x : null),
|
|
1185
|
-
label: e(o)("inventory.transfer.form.backdate.title"),
|
|
1186
|
-
sublabel: e(o)("inventory.transfer.form.backdate.subtitle"),
|
|
1187
|
-
"label-placement": "right",
|
|
1188
|
-
disabled: C.value && !l.lastClosingDate || l.disabled
|
|
1189
|
-
}, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
|
|
1190
|
-
a("div", {
|
|
1191
|
-
class: N({ hidden: p.value, "w-16": !p.value })
|
|
1192
|
-
}, null, 2),
|
|
1193
|
-
e(j) ? (F(), $("div", ws, [
|
|
1194
|
-
a("div", Ss, [
|
|
1195
|
-
v(we, {
|
|
1196
|
-
modelValue: e(_),
|
|
1197
|
-
"onUpdate:modelValue": f[5] || (f[5] = (x) => fe(_) ? _.value = x : null)
|
|
1198
|
-
}, null, 8, ["modelValue"])
|
|
1199
|
-
]),
|
|
1200
|
-
a("div", Fs, [
|
|
1201
|
-
v(D, {
|
|
1202
|
-
modelValue: e(g),
|
|
1203
|
-
"onUpdate:modelValue": f[6] || (f[6] = (x) => fe(g) ? g.value = x : null)
|
|
1204
|
-
}, null, 8, ["modelValue"])
|
|
1205
|
-
])
|
|
1206
|
-
])) : z("", !0)
|
|
1207
|
-
], 2),
|
|
1208
|
-
e(K) ? (F(), Y(le, {
|
|
1209
|
-
key: 0,
|
|
1210
|
-
modelValue: e(K),
|
|
1211
|
-
"onUpdate:modelValue": f[7] || (f[7] = (x) => fe(K) ? K.value = x : null),
|
|
1212
|
-
rules: [e(gt)(new Date(l.lastClosingDate), /* @__PURE__ */ new Date())]
|
|
1213
|
-
}, null, 8, ["modelValue", "rules"])) : z("", !0),
|
|
1214
|
-
C.value && !l.lastClosingDate ? (F(), $("div", Ps, [
|
|
1215
|
-
v(de, {
|
|
1216
|
-
name: "error",
|
|
1217
|
-
size: "sm",
|
|
1218
|
-
class: "text-fm-color-typo-warning"
|
|
1219
|
-
}),
|
|
1220
|
-
a("span", Ts, R(e(o)("inventory.transfer.form.backdate.error")), 1)
|
|
1221
|
-
])) : z("", !0)
|
|
1222
|
-
])) : z("", !0)
|
|
1223
|
-
])
|
|
1224
|
-
]),
|
|
1225
|
-
a("div", Is, [
|
|
1226
|
-
v(le, {
|
|
1227
|
-
"model-value": e(t).items,
|
|
1228
|
-
rules: [e(Pe)(1)]
|
|
1229
|
-
}, null, 8, ["model-value", "rules"]),
|
|
1230
|
-
a("div", {
|
|
1231
|
-
class: N([
|
|
1232
|
-
"flex gap-16",
|
|
1233
|
-
{
|
|
1234
|
-
"flex-col items-start": p.value,
|
|
1235
|
-
"items-center": !p.value
|
|
1236
|
-
}
|
|
1237
|
-
])
|
|
1238
|
-
}, [
|
|
1239
|
-
a("div", $s, R(e(o)("inventory.transfer.form.items.title")), 1),
|
|
1240
|
-
a("div", As, [
|
|
1241
|
-
v(J, {
|
|
1242
|
-
disabled: l.disabled,
|
|
1243
|
-
label: e(o)("inventory.transfer.form.items.addItem"),
|
|
1244
|
-
"prepend-icon": "add",
|
|
1245
|
-
variant: "secondary",
|
|
1246
|
-
"text-color": "primary",
|
|
1247
|
-
"bg-color": "transparent",
|
|
1248
|
-
"border-color": "primary",
|
|
1249
|
-
onClick: f[8] || (f[8] = (x) => Xe()),
|
|
1250
|
-
size: "md"
|
|
1251
|
-
}, null, 8, ["disabled", "label"]),
|
|
1252
|
-
e(t).template ? (F(), Y(ce, {
|
|
1253
|
-
key: 0,
|
|
1254
|
-
"z-index": 50
|
|
1255
|
-
}, {
|
|
1256
|
-
content: O(() => [
|
|
1257
|
-
a("div", null, R(e(o)("inventory.transfer.form.items.forecastStock.notAvailable")), 1)
|
|
1258
|
-
]),
|
|
1259
|
-
default: O(() => [
|
|
1260
|
-
v(Le, {
|
|
1261
|
-
"onUpdate:poItems": f[9] || (f[9] = (x) => e(t).items = x),
|
|
1262
|
-
disabled: ""
|
|
1263
|
-
})
|
|
1264
|
-
]),
|
|
1265
|
-
_: 1
|
|
1266
|
-
})) : (F(), Y(Le, {
|
|
1267
|
-
key: 1,
|
|
1268
|
-
"onUpdate:poItems": f[10] || (f[10] = (x) => e(t).items = x),
|
|
1269
|
-
disabled: l.disabled || !!e(t).template
|
|
1270
|
-
}, null, 8, ["disabled"]))
|
|
1271
|
-
])
|
|
1272
|
-
], 2),
|
|
1273
|
-
A.value === e(V).PURCHASE && h.value && e(y).enableTotalCost && ((Be = l.modelValue) != null && Be.items.length) ? (F(), $("div", Ds, [
|
|
1274
|
-
v(be, {
|
|
1275
|
-
label: e(se) ? e(o)("inventory.transfer.form.items.fetchingData") : e(o)("inventory.transfer.form.items.comparePriceHistory"),
|
|
1276
|
-
"prepend-icon": "compare_arrows",
|
|
1277
|
-
"label-placement": "right",
|
|
1278
|
-
"model-value": e(U),
|
|
1279
|
-
"onUpdate:modelValue": f[11] || (f[11] = (x) => fe(U) ? U.value = x : null),
|
|
1280
|
-
disabled: e(se) || l.disabled
|
|
1281
|
-
}, null, 8, ["label", "model-value", "disabled"])
|
|
1282
|
-
])) : z("", !0),
|
|
1283
|
-
(F(), Y(ae, {
|
|
1284
|
-
"column-defs": Je.value,
|
|
1285
|
-
"row-data": e(t).items,
|
|
1286
|
-
key: e(t).items.map((x) => x.sku._id).join("."),
|
|
1287
|
-
"hide-footer": "",
|
|
1288
|
-
"page-size": e(t).items.length
|
|
1289
|
-
}, {
|
|
1290
|
-
"table-row": O((x) => [
|
|
1291
|
-
v(ps, {
|
|
1292
|
-
"compare-price-by-sku": e(Q),
|
|
1293
|
-
"show-compare-price": A.value === e(V).PURCHASE && e(U),
|
|
1294
|
-
row: x
|
|
1295
|
-
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row"])
|
|
1296
|
-
]),
|
|
1297
|
-
"list-row": O((x) => [
|
|
1298
|
-
(F(), Y(wt, {
|
|
1299
|
-
row: x,
|
|
1300
|
-
key: e(t).items.map((ge) => ge.sku._id).join(".")
|
|
1301
|
-
}, {
|
|
1302
|
-
default: O((ge) => [
|
|
1303
|
-
v(zt, {
|
|
1304
|
-
"compare-price-by-sku": e(Q),
|
|
1305
|
-
"show-compare-price": A.value === e(V).PURCHASE && e(U),
|
|
1306
|
-
row: x,
|
|
1307
|
-
"cell-by-col-id": ge
|
|
1308
|
-
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
|
|
1309
|
-
]),
|
|
1310
|
-
_: 2
|
|
1311
|
-
}, 1032, ["row"]))
|
|
1312
|
-
]),
|
|
1313
|
-
_: 1
|
|
1314
|
-
}, 8, ["column-defs", "row-data", "page-size"]))
|
|
1315
|
-
])
|
|
1316
|
-
];
|
|
1317
|
-
}),
|
|
1318
|
-
_: 1
|
|
1319
|
-
}, 8, ["disabled", "onValidationFailed"])
|
|
1320
|
-
]);
|
|
1321
|
-
};
|
|
1322
|
-
}
|
|
1323
|
-
}), Rs = { class: "flex items-center" }, Os = { class: "fm-typo-en-title-md-800" }, Us = { class: "flex gap-4" }, Ks = /* @__PURE__ */ ue({
|
|
1324
|
-
__name: "TransferDialog",
|
|
1325
|
-
props: {
|
|
1326
|
-
mode: {},
|
|
1327
|
-
modelValue: {},
|
|
1328
|
-
templateId: {},
|
|
1329
|
-
show: { type: Boolean },
|
|
1330
|
-
lastClosingDate: {}
|
|
1331
|
-
},
|
|
1332
|
-
emits: ["update:show", "submitted"],
|
|
1333
|
-
setup(n, { expose: b, emit: i }) {
|
|
1334
|
-
var j;
|
|
1335
|
-
const d = n, m = i, t = He(), o = Ve(), w = Te(), c = Ue(), s = Oe(), { t: r } = ve(), y = H(!1), k = H(!1), S = H(!1);
|
|
1336
|
-
async function p(_) {
|
|
1337
|
-
if (_) {
|
|
1338
|
-
k.value = !1;
|
|
1339
|
-
try {
|
|
1340
|
-
await w.readSuppliers(), k.value = !0;
|
|
1341
|
-
} catch {
|
|
1342
|
-
o.open({
|
|
1343
|
-
title: r("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
|
|
1344
|
-
message: r("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
|
|
1345
|
-
type: "error"
|
|
1346
|
-
});
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
s.watchLocation(p);
|
|
1351
|
-
function u() {
|
|
1352
|
-
return {
|
|
1353
|
-
remark: void 0,
|
|
1354
|
-
ref: void 0,
|
|
1355
|
-
stockSnapshotId: void 0,
|
|
1356
|
-
effectiveAt: void 0,
|
|
1357
|
-
items: [],
|
|
1358
|
-
supplier: {
|
|
1359
|
-
_rev: void 0,
|
|
1360
|
-
email: void 0,
|
|
1361
|
-
internal: void 0,
|
|
1362
|
-
contactName: void 0,
|
|
1363
|
-
phoneNumber: void 0,
|
|
1364
|
-
registrationNumber: void 0,
|
|
1365
|
-
supplyItems: void 0,
|
|
1366
|
-
_id: "",
|
|
1367
|
-
name: "",
|
|
1368
|
-
address: {
|
|
1369
|
-
line2: void 0,
|
|
1370
|
-
line1: "",
|
|
1371
|
-
state: "",
|
|
1372
|
-
city: "",
|
|
1373
|
-
postcode: "",
|
|
1374
|
-
country: ""
|
|
1375
|
-
}
|
|
1376
|
-
},
|
|
1377
|
-
status: "DRAFT",
|
|
1378
|
-
_id: "",
|
|
1379
|
-
seqNumber: 0,
|
|
1380
|
-
deliveryOrder: [],
|
|
1381
|
-
template: d.templateId
|
|
1382
|
-
};
|
|
1383
|
-
}
|
|
1384
|
-
const h = ot(d, "show"), C = H(d.modelValue ?? u()), B = H(((j = d.modelValue) == null ? void 0 : j._id) ?? `${Math.random()}`);
|
|
1385
|
-
De(
|
|
1386
|
-
() => d.show,
|
|
1387
|
-
(_) => {
|
|
1388
|
-
var g;
|
|
1389
|
-
_ && (S.value = !1, C.value = d.modelValue ?? u(), B.value = ((g = d.modelValue) == null ? void 0 : g._id) ?? `${Math.random()}`);
|
|
1390
|
-
}
|
|
1391
|
-
);
|
|
1392
|
-
const P = T(() => !k.value || !S.value), A = T(() => {
|
|
1393
|
-
switch (d.mode) {
|
|
1394
|
-
case ke.READ:
|
|
1395
|
-
return "View transfer";
|
|
1396
|
-
case ke.CREATE:
|
|
1397
|
-
return r("inventory.transfer.receiveRequest.create.title");
|
|
1398
|
-
case ke.UPDATE:
|
|
1399
|
-
return r("inventory.transfer.receiveRequest.update.title");
|
|
1400
|
-
}
|
|
1401
|
-
return "";
|
|
1402
|
-
}), M = H();
|
|
1403
|
-
b({
|
|
1404
|
-
validateInputs: () => {
|
|
1405
|
-
var _, g;
|
|
1406
|
-
(g = (_ = M.value) == null ? void 0 : _.validateInputs) == null || g.call(_);
|
|
1407
|
-
},
|
|
1408
|
-
resetInputsValidation: () => {
|
|
1409
|
-
var _, g;
|
|
1410
|
-
(g = (_ = M.value) == null ? void 0 : _.resetInputsValidation) == null || g.call(_);
|
|
1411
|
-
},
|
|
1412
|
-
resetInputs: () => {
|
|
1413
|
-
var _, g;
|
|
1414
|
-
(g = (_ = M.value) == null ? void 0 : _.resetInputs) == null || g.call(_);
|
|
1415
|
-
}
|
|
1416
|
-
});
|
|
1417
|
-
async function X() {
|
|
1418
|
-
const _ = C.value;
|
|
1419
|
-
y.value = !0, (_.supplier.internal === "warehouse" || _.supplier.internal === "restaurant") && (_.items = _.items.map(({ totalCost: g, ...U }) => U));
|
|
1420
|
-
try {
|
|
1421
|
-
await t.createPurchaseOrder(_), await new Promise((g) => setTimeout(g, 1e3)), o.open({
|
|
1422
|
-
title: r("inventory.transfer.receiveRequest.create.success"),
|
|
1423
|
-
message: r("inventory.transfer.receiveRequest.create.successMessage"),
|
|
1424
|
-
type: "success"
|
|
1425
|
-
}), m("update:show", !1), m("submitted");
|
|
1426
|
-
} catch (g) {
|
|
1427
|
-
o.open({
|
|
1428
|
-
title: r("inventory.transfer.receiveRequest.create.error.title"),
|
|
1429
|
-
message: r("inventory.transfer.receiveRequest.create.error.message"),
|
|
1430
|
-
type: "error"
|
|
1431
|
-
}), console.error("Error in creating purchase order", g);
|
|
1432
|
-
} finally {
|
|
1433
|
-
y.value = !1;
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
async function te() {
|
|
1437
|
-
const _ = C.value;
|
|
1438
|
-
y.value = !0, (_.supplier.internal === "warehouse" || _.supplier.internal === "restaurant") && (_.items = _.items.map(({ totalCost: g, ...U }) => U));
|
|
1439
|
-
try {
|
|
1440
|
-
await t.updatePurchaseOrder(_), await new Promise((g) => setTimeout(g, 1e3)), o.open({
|
|
1441
|
-
title: r("inventory.transfer.receiveRequest.update.success"),
|
|
1442
|
-
message: r("inventory.transfer.receiveRequest.update.successMessage"),
|
|
1443
|
-
type: "success"
|
|
1444
|
-
}), m("update:show", !1), m("submitted");
|
|
1445
|
-
} catch (g) {
|
|
1446
|
-
o.open({
|
|
1447
|
-
title: r("inventory.transfer.receiveRequest.update.error.title"),
|
|
1448
|
-
message: r("inventory.transfer.receiveRequest.update.error.message"),
|
|
1449
|
-
type: "error"
|
|
1450
|
-
}), console.error("Error in updating purchase order", g);
|
|
1451
|
-
} finally {
|
|
1452
|
-
y.value = !1;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
function G() {
|
|
1456
|
-
switch (d.mode) {
|
|
1457
|
-
case ke.CREATE:
|
|
1458
|
-
return X();
|
|
1459
|
-
case ke.UPDATE:
|
|
1460
|
-
return te();
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
function K() {
|
|
1464
|
-
var _, g;
|
|
1465
|
-
(g = (_ = M.value) == null ? void 0 : _.validateInputs) == null || g.call(_);
|
|
1466
|
-
}
|
|
1467
|
-
return (_, g) => {
|
|
1468
|
-
const U = I("FmButton"), se = I("FmSideSheet");
|
|
1469
|
-
return F(), Y(se, {
|
|
1470
|
-
modelValue: e(h),
|
|
1471
|
-
"onUpdate:modelValue": g[3] || (g[3] = (Q) => fe(h) ? h.value = Q : null),
|
|
1472
|
-
"dismiss-away": "",
|
|
1473
|
-
"close-button": "",
|
|
1474
|
-
"max-width": 900
|
|
1475
|
-
}, {
|
|
1476
|
-
"side-sheet-header": O(() => [
|
|
1477
|
-
a("div", Rs, [
|
|
1478
|
-
a("div", Os, R(A.value), 1)
|
|
1479
|
-
])
|
|
1480
|
-
]),
|
|
1481
|
-
default: O(() => [
|
|
1482
|
-
(F(), Y(Vs, {
|
|
1483
|
-
class: "w-full",
|
|
1484
|
-
ref_key: "formRef",
|
|
1485
|
-
ref: M,
|
|
1486
|
-
"onForm:ready": g[0] || (g[0] = () => S.value = !0),
|
|
1487
|
-
onValidationSuccess: G,
|
|
1488
|
-
modelValue: C.value,
|
|
1489
|
-
"onUpdate:modelValue": g[1] || (g[1] = (Q) => C.value = Q),
|
|
1490
|
-
disabled: y.value || P.value,
|
|
1491
|
-
suppliers: e(w).suppliers,
|
|
1492
|
-
skus: e(c).skus,
|
|
1493
|
-
key: B.value,
|
|
1494
|
-
"last-closing-date": _.lastClosingDate
|
|
1495
|
-
}, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
|
|
1496
|
-
]),
|
|
1497
|
-
"side-sheet-footer": O(() => [
|
|
1498
|
-
a("div", Us, [
|
|
1499
|
-
v(U, {
|
|
1500
|
-
loading: y.value,
|
|
1501
|
-
disabled: P.value,
|
|
1502
|
-
label: e(r)("common.save"),
|
|
1503
|
-
onClick: K
|
|
1504
|
-
}, null, 8, ["loading", "disabled", "label"]),
|
|
1505
|
-
v(U, {
|
|
1506
|
-
disabled: P.value,
|
|
1507
|
-
variant: "tertiary",
|
|
1508
|
-
label: e(r)("common.close"),
|
|
1509
|
-
onClick: g[2] || (g[2] = (Q) => m("update:show", !1))
|
|
1510
|
-
}, null, 8, ["disabled", "label"])
|
|
1511
|
-
])
|
|
1512
|
-
]),
|
|
1513
|
-
_: 1
|
|
1514
|
-
}, 8, ["modelValue"]);
|
|
1515
|
-
};
|
|
1516
|
-
}
|
|
1517
|
-
});
|
|
1518
|
-
export {
|
|
1519
|
-
Ks as _,
|
|
1520
|
-
re as c,
|
|
1521
|
-
jt as u
|
|
1522
|
-
};
|