@feedmepos/mf-inventory-portal 0.0.18-dev.3 → 0.0.19-dev.10
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-BgTTFiOw.js +121 -0
- package/dist/{BindingsDialog-CVeD1mOn.js → BindingsDialog-BROnpXEI.js} +9 -10
- package/dist/{BindingsPicker-K04aOoGr.js → BindingsPicker-aQHfS_vY.js} +7 -8
- package/dist/{BindingsTable-65aYkpX7.js → BindingsTable-DvtIQMFk.js} +4 -6
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DR9YAhaJ.js +272 -0
- package/dist/IngredientsView-BgAQCCD-.js +1751 -0
- package/dist/IntegrationView-DEBb_X5K.js +1172 -0
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-kidodonU.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-VF3PDSzP.js} +1 -1
- package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BIRzNfFN.js +88 -0
- package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js +29 -0
- package/dist/{PurchaseOrderPrintPreview-B4uzudnC.js → PurchaseOrderPrintPreview-D2zNGZhx.js} +4 -4
- package/dist/ReceiveRequestView-Dc5JlUMC.js +208 -0
- package/dist/RecipeView-C1DBn8pW.js +573 -0
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
- package/dist/StockView-6wi6BEOE.js +1877 -0
- package/dist/SupplierView-CS7YdL5Q.js +801 -0
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CBbbXOhl.js +745 -0
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-CWEypKBc.js +1662 -0
- package/dist/TransferTemplateView-C1hmdeKM.js +933 -0
- package/dist/UnitView-BUdKTKch.js +638 -0
- package/dist/WarehouseView-BbreEn79.js +1050 -0
- package/dist/api/bill.d.ts +2 -2
- package/dist/api/purchase-order-template.d.ts +7 -0
- package/dist/app-B3oV5Muh.js +67059 -0
- package/dist/app.d.ts +1111 -0
- package/dist/app.js +7 -3
- package/dist/components/FmDroppableField.vue.d.ts +1 -1
- package/dist/components/FmMultiselectDialogProps.d.ts +7 -0
- 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-ziY3648r.js → decimal-DzjRPmPY.js} +1 -1
- package/dist/helper/country.d.ts +2 -0
- package/dist/id-to-date-CG1QobkF.js +30 -0
- package/dist/layout-qEWDq5Vs.js +147 -0
- package/dist/purchase-order-transaction-type-D-GMrgDp.js +294 -0
- package/dist/router/name.d.ts +2 -1
- 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-BE_AQA4h.js +54 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/views/dev/components/FmMultiselectDialogGrouped.vue.d.ts +2 -0
- 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/composables/use-ingredient-form.d.ts +14 -2
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -2
- 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/SparkIcon.vue.d.ts +1 -1
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +4 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +22 -0
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -1
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +187 -0
- package/dist/views/receive-request/components/transfer-form/components/TransferItem.vue.d.ts +23 -0
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +21 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-backdate-po.d.ts +9 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-compare-price.d.ts +6 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +112 -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 +18 -12
- package/dist/views/receive-request/helper/get-transfer-type.d.ts +2 -0
- package/dist/views/recipe/composables/use-recipe-form.d.ts +14 -2
- package/dist/views/recipe/composables/use-recipe-table.d.ts +1 -2
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
- package/dist/views/stock/composables/use-stock-action.d.ts +26 -0
- package/dist/views/stock/composables/use-stock-table.d.ts +1 -8
- package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
- 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 +290 -0
- package/dist/views/unit/composables/use-unit-form.d.ts +14 -2
- package/dist/views/unit/composables/use-unit-table.d.ts +1 -2
- package/dist/{xlsx-BG4CsaGF.js → xlsx-BGXLmGtO.js} +1 -1
- package/dist/xlsx.util-DxU-P-ww.js +109 -0
- package/package.json +6 -5
- package/dist/ApprovalView-G-u9nPxH.js +0 -118
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DgHp7KgJ.js +0 -268
- package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-C5WBLEy3.js +0 -143
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-QKFZeZKM.js +0 -236
- package/dist/IngredientsView-6Q2UWsu-.js +0 -1776
- package/dist/IntegrationView-ZMPPIopU.js +0 -1166
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-C8YTZoBw.js +0 -276
- package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js +0 -35
- package/dist/ReceiveRequestView-DuHtLwZN.js +0 -1394
- package/dist/RecipeView-CRj0pC9N.js +0 -573
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
- package/dist/StockView-CQbeZ5pU.js +0 -1862
- package/dist/SupplierView-CrfQATQf.js +0 -796
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CLUo-Tve.js +0 -1028
- package/dist/UnitView-D1acjiRV.js +0 -635
- package/dist/WarehouseView-DID1G1qK.js +0 -1043
- package/dist/app-D1teOEQX.js +0 -66113
- package/dist/date2-6Vt_hnAG.js +0 -95
- package/dist/dayjs.min-Co7-8-Mb.js +0 -282
- package/dist/fuzzy-gvHXFsh0.js +0 -41
- package/dist/index-Do1KDD1S.js +0 -21515
- package/dist/layout-BxDEsp4a.js +0 -151
- package/dist/number-Dvvpk3SV.js +0 -97
- package/dist/row-action.enum-BwQbURNh.js +0 -28
- package/dist/rules-CQu9yXsg.js +0 -85
- package/dist/stock-estimate-Wysv30cx.js +0 -122
- package/dist/supplier-BFdAYn3E.js +0 -65
- package/dist/use-inventory-binding-dialog-CuyOzZ5r.js +0 -93
- package/dist/xlsx.util-BkVYceD0.js +0 -107
|
@@ -0,0 +1,1662 @@
|
|
|
1
|
+
import { reactive as He, onMounted as je, computed as P, h as O, getCurrentInstance as Me, watch as Oe, defineComponent as ne, openBlock as x, createElementBlock as D, Fragment as ve, renderList as Ae, createElementVNode as u, toDisplayString as N, unref as n, resolveComponent as F, createVNode as k, withCtx as I, createCommentVNode as Z, ref as V, createBlock as L, normalizeClass as De, normalizeStyle as tt, isRef as ce } from "vue";
|
|
2
|
+
import { useBreakpoints as ot, components as oe, FmButtonVariant as Ie, useSnackbar as Te, useDialog as Ke, useProxiedModel as st } from "@feedmepos/ui-library";
|
|
3
|
+
import { F as ae, D as Le, R as ye } from "./row-action.enum-7jVyol1k.js";
|
|
4
|
+
import { P as S, u as at, f as nt, a as Ye } from "./purchase-order-transaction-type-D-GMrgDp.js";
|
|
5
|
+
import { a as G, t as rt, a2 as Ve, D as lt, b as We, R as Ne, $ as it, a0 as ut, r as ct, G as Ze, l as dt, A as Ue, M as pt, a3 as Ge, c as Qe, a5 as mt, O as Be, P as Re, a6 as ft, j as Q, a7 as yt, u as Ee, n as vt, a8 as bt, a9 as ht, aa as _t, E as gt, ab as Ct, y as kt } from "./app-B3oV5Muh.js";
|
|
6
|
+
import { _ as Je, u as wt } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-BIRzNfFN.js";
|
|
7
|
+
import { useI18n as be } from "@feedmepos/mf-common";
|
|
8
|
+
import "vue-router";
|
|
9
|
+
import { u as xe } from "./supplier-BE_AQA4h.js";
|
|
10
|
+
import { F as de, c as Tt, _ as xt } from "./layout-qEWDq5Vs.js";
|
|
11
|
+
import { _ as St } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
12
|
+
import { defineStore as Ft } from "pinia";
|
|
13
|
+
function se(e, p, s, l) {
|
|
14
|
+
var y, f, i;
|
|
15
|
+
if (l != null && l.manualTotalCost)
|
|
16
|
+
return l == null ? void 0 : l.manualTotalCost;
|
|
17
|
+
const c = (i = (f = (y = l == null ? void 0 : l.supplier) == null ? void 0 : y.supplyItems) == null ? void 0 : f.find(
|
|
18
|
+
(b) => b.skuId === e._id
|
|
19
|
+
)) == null ? void 0 : i.defaultCost, t = e.defaultCost, d = c ?? t, g = d == null ? void 0 : d.costPerUnit, v = g ? d != null && d.measurement ? +G(g) / +G(d == null ? void 0 : d.measurement.conversion) : +G(g) : void 0, o = v ? s ? v * +G(s.conversion) : v : void 0, a = o ? +G(p) * o : void 0;
|
|
20
|
+
return a ? {
|
|
21
|
+
...rt(a ?? 0, 2),
|
|
22
|
+
currency: Ve()
|
|
23
|
+
} : {
|
|
24
|
+
amount: 0,
|
|
25
|
+
precision: 0,
|
|
26
|
+
currency: Ve()
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
var U = /* @__PURE__ */ ((e) => (e.Code = "Code", e.Name = "Name", e.Amount = "Amount", e.Cost = "Cost", e.Delete = "Delete", e))(U || {});
|
|
30
|
+
const Pt = () => {
|
|
31
|
+
const { t: e } = be();
|
|
32
|
+
return O(
|
|
33
|
+
Je,
|
|
34
|
+
{
|
|
35
|
+
zIndex: 50,
|
|
36
|
+
class: "whitespace-nowrap"
|
|
37
|
+
},
|
|
38
|
+
e("inventory.transfer.form.items.table.Cost", [Ge()])
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
function $t(e) {
|
|
42
|
+
const { t: p } = be(), s = He({}), { breakpoints: l } = ot(), c = We();
|
|
43
|
+
je(() => {
|
|
44
|
+
for (const v of e.items) {
|
|
45
|
+
if (!v.totalCost)
|
|
46
|
+
continue;
|
|
47
|
+
const o = se(v.sku, v.quantity, v.measurement, {
|
|
48
|
+
supplier: e.supplier
|
|
49
|
+
}), a = v.totalCost ?? lt.reset();
|
|
50
|
+
o ? s[v.sku._id] = o.amount !== a.amount || o.precision !== a.precision : s[v.sku._id] = !0;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
function t(v) {
|
|
54
|
+
var a, r, y, f, i, b, w;
|
|
55
|
+
return !!(((r = (a = v.defaultCost) == null ? void 0 : a.costPerUnit) == null ? void 0 : r.amount) ?? ((w = (b = (i = (f = (y = e.supplier) == null ? void 0 : y.supplyItems) == null ? void 0 : f.find(($) => $.skuId === v._id)) == null ? void 0 : i.defaultCost) == null ? void 0 : b.costPerUnit) == null ? void 0 : w.amount));
|
|
56
|
+
}
|
|
57
|
+
const d = [
|
|
58
|
+
{
|
|
59
|
+
id: "Code",
|
|
60
|
+
header: () => p("inventory.transfer.form.items.table.Code"),
|
|
61
|
+
accessorKey: "code",
|
|
62
|
+
size: 96,
|
|
63
|
+
cell(v) {
|
|
64
|
+
const o = v.row.original;
|
|
65
|
+
return O(oe.FmTextField, {
|
|
66
|
+
modelValue: o.code,
|
|
67
|
+
"onUpdate:modelValue": (a) => {
|
|
68
|
+
e.updateItem({
|
|
69
|
+
...o,
|
|
70
|
+
code: a
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
key: o.sku._id,
|
|
74
|
+
rules: [Ne()],
|
|
75
|
+
labelMark: "required"
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
enableSorting: !1
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "Name",
|
|
82
|
+
header: () => p("inventory.transfer.form.items.table.Name"),
|
|
83
|
+
minSize: 300,
|
|
84
|
+
cell(v) {
|
|
85
|
+
const o = v.row.original;
|
|
86
|
+
return O(oe.FmTextField, {
|
|
87
|
+
modelValue: o.name,
|
|
88
|
+
"onUpdate:modelValue": (a) => {
|
|
89
|
+
e.updateItem({
|
|
90
|
+
...o,
|
|
91
|
+
name: a
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
key: o.sku._id,
|
|
95
|
+
rules: [Ne()],
|
|
96
|
+
labelMark: "required"
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
enableSorting: !1
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "Amount",
|
|
103
|
+
header: () => p("inventory.transfer.form.items.table.Amount"),
|
|
104
|
+
minSize: 200,
|
|
105
|
+
cell(v) {
|
|
106
|
+
var r, y, f;
|
|
107
|
+
const o = v.row.original, a = !!((f = (y = (r = e.template) == null ? void 0 : r.purchaseOrder) == null ? void 0 : y.items) != null && f.find(
|
|
108
|
+
(i) => i.sku._id === o.sku._id
|
|
109
|
+
));
|
|
110
|
+
return O(it, {
|
|
111
|
+
style: {
|
|
112
|
+
flex: "1 1 0%"
|
|
113
|
+
},
|
|
114
|
+
modelValue: {
|
|
115
|
+
amount: o.quantity ?? { amount: 1, precision: 0 },
|
|
116
|
+
measurement: o.measurement ?? null
|
|
117
|
+
},
|
|
118
|
+
key: o.sku._id,
|
|
119
|
+
unit: o.sku.unit,
|
|
120
|
+
"onUpdate:modelValue": (i) => {
|
|
121
|
+
const b = {
|
|
122
|
+
...o,
|
|
123
|
+
quantity: i.amount,
|
|
124
|
+
measurement: i.measurement
|
|
125
|
+
};
|
|
126
|
+
c.enableTotalCost && (b.totalCost = se(o.sku, o.quantity, o.measurement, {
|
|
127
|
+
supplier: e.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: s[o.sku._id] ? b.totalCost : void 0
|
|
131
|
+
})), e.updateItem(b);
|
|
132
|
+
},
|
|
133
|
+
stepper: o.quantityStep,
|
|
134
|
+
disableUnit: a,
|
|
135
|
+
disabled: e.disabled,
|
|
136
|
+
rules: [
|
|
137
|
+
ut(
|
|
138
|
+
+G(
|
|
139
|
+
o.minimumQuantity ?? {
|
|
140
|
+
amount: 1,
|
|
141
|
+
precision: ct(o.sku.unit, o.measurement)
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
)
|
|
145
|
+
],
|
|
146
|
+
applyDefaultRules: !0
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
enableSorting: !1
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "Cost",
|
|
153
|
+
header: Pt,
|
|
154
|
+
size: 180,
|
|
155
|
+
cell(v) {
|
|
156
|
+
const o = v.row.original, a = t(o.sku), r = l.value.xs || l.value.sm;
|
|
157
|
+
return !s[o.sku._id] && a ? O(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
class: [
|
|
161
|
+
"flex gap-4 fm-typo-en-body-md-400 items-center",
|
|
162
|
+
e.disabled ? "text-fm-color-typo-disabled" : ""
|
|
163
|
+
],
|
|
164
|
+
key: o.sku._id
|
|
165
|
+
},
|
|
166
|
+
[
|
|
167
|
+
O(oe.FmButton, {
|
|
168
|
+
prependIcon: "edit",
|
|
169
|
+
variant: Ie.Tertiary,
|
|
170
|
+
disabled: e.disabled,
|
|
171
|
+
onClick() {
|
|
172
|
+
e.updateItem({
|
|
173
|
+
...o,
|
|
174
|
+
totalCost: se(o.sku, o.quantity, o.measurement, {
|
|
175
|
+
supplier: e.supplier
|
|
176
|
+
})
|
|
177
|
+
}), s[o.sku._id] = !0;
|
|
178
|
+
}
|
|
179
|
+
}),
|
|
180
|
+
O(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
class: "flex flex-col"
|
|
184
|
+
},
|
|
185
|
+
[
|
|
186
|
+
O(
|
|
187
|
+
"span",
|
|
188
|
+
r ? Ze(
|
|
189
|
+
se(o.sku, o.quantity, o.measurement, {
|
|
190
|
+
supplier: e.supplier
|
|
191
|
+
})
|
|
192
|
+
) : G(
|
|
193
|
+
se(o.sku, o.quantity, o.measurement, {
|
|
194
|
+
supplier: e.supplier
|
|
195
|
+
})
|
|
196
|
+
)
|
|
197
|
+
),
|
|
198
|
+
O(
|
|
199
|
+
"span",
|
|
200
|
+
{
|
|
201
|
+
class: [
|
|
202
|
+
"fm-typo-en-body-sm-400",
|
|
203
|
+
e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
"Auto-calculated"
|
|
207
|
+
)
|
|
208
|
+
]
|
|
209
|
+
)
|
|
210
|
+
]
|
|
211
|
+
) : O(
|
|
212
|
+
oe.FmTextField,
|
|
213
|
+
{
|
|
214
|
+
modelValue: G(o.totalCost ?? { amount: 0, precision: 0 }),
|
|
215
|
+
key: o.sku._id,
|
|
216
|
+
"onUpdate:modelValue": (y) => {
|
|
217
|
+
e.updateItem({
|
|
218
|
+
...o,
|
|
219
|
+
totalCost: {
|
|
220
|
+
...dt(+y),
|
|
221
|
+
currency: Ve()
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
rules: [Ue(0), pt(2)]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
prepend() {
|
|
229
|
+
return r ? O(
|
|
230
|
+
"div",
|
|
231
|
+
{
|
|
232
|
+
class: [
|
|
233
|
+
"text-fm-typo-en-body-lg-400",
|
|
234
|
+
e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
Ge()
|
|
238
|
+
) : null;
|
|
239
|
+
},
|
|
240
|
+
append() {
|
|
241
|
+
return a ? O(oe.FmButton, {
|
|
242
|
+
prependIcon: "close",
|
|
243
|
+
variant: "tertiary",
|
|
244
|
+
disabled: e.disabled,
|
|
245
|
+
onClick() {
|
|
246
|
+
e.updateItem({
|
|
247
|
+
...o,
|
|
248
|
+
// NOTE: different from PO template, if a default cost is reenabled,
|
|
249
|
+
// the total cost will automatically assigned
|
|
250
|
+
totalCost: se(o.sku, o.quantity, o.measurement, {
|
|
251
|
+
supplier: e.supplier
|
|
252
|
+
})
|
|
253
|
+
}), s[o.sku._id] = !1;
|
|
254
|
+
}
|
|
255
|
+
}) : null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
enableSorting: !1
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: "Delete",
|
|
264
|
+
header: "",
|
|
265
|
+
cell(v) {
|
|
266
|
+
const o = v.row.original;
|
|
267
|
+
return O(oe.FmButton, {
|
|
268
|
+
key: o.sku._id,
|
|
269
|
+
class: "delete-button",
|
|
270
|
+
type: "button",
|
|
271
|
+
icon: "delete",
|
|
272
|
+
variant: "tertiary",
|
|
273
|
+
size: "md",
|
|
274
|
+
disabled: e.disabled,
|
|
275
|
+
onClick: () => {
|
|
276
|
+
e.deleteItem(o);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
enableSorting: !1,
|
|
281
|
+
size: 40,
|
|
282
|
+
meta: {
|
|
283
|
+
cellClass: "",
|
|
284
|
+
headerClass: ""
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
];
|
|
288
|
+
return {
|
|
289
|
+
columnDefs: P(() => c.enableTotalCost && e.transferType === S.PURCHASE ? d : d.filter(
|
|
290
|
+
(v) => v.id !== "Cost"
|
|
291
|
+
/* Cost */
|
|
292
|
+
))
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function At(e = "modelValue") {
|
|
296
|
+
var t, d;
|
|
297
|
+
const p = ((t = Me()) == null ? void 0 : t.props) ?? {}, s = ((d = Me()) == null ? void 0 : d.emit) ?? (() => {
|
|
298
|
+
}), l = He(Qe(p[e])), c = `update:${mt(e)}`;
|
|
299
|
+
return Oe(l, (g) => {
|
|
300
|
+
s(c, g);
|
|
301
|
+
}), l;
|
|
302
|
+
}
|
|
303
|
+
const Dt = { 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" }, Vt = { class: "w-[450px] xs:w-full flex" }, Rt = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Ot = /* @__PURE__ */ u("span", { class: "text-fm-color-typo-secondary" }, "/", -1), Ut = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Bt = /* @__PURE__ */ u("span", null, /* @__PURE__ */ N(" "), -1), Xe = /* @__PURE__ */ ne({
|
|
304
|
+
__name: "SupplierPriceHistory",
|
|
305
|
+
props: {
|
|
306
|
+
prices: {}
|
|
307
|
+
},
|
|
308
|
+
setup(e) {
|
|
309
|
+
const p = xe();
|
|
310
|
+
function s(l) {
|
|
311
|
+
return p.suppliers.find((c) => c._id === l);
|
|
312
|
+
}
|
|
313
|
+
return (l, c) => (x(), D("div", Dt, [
|
|
314
|
+
(x(!0), D(ve, null, Ae(Object.keys(l.prices), (t) => {
|
|
315
|
+
var d;
|
|
316
|
+
return x(), D("div", {
|
|
317
|
+
key: t,
|
|
318
|
+
class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
|
|
319
|
+
}, [
|
|
320
|
+
u("div", It, N((d = s(t)) == null ? void 0 : d.name), 1),
|
|
321
|
+
u("div", Vt, [
|
|
322
|
+
(x(!0), D(ve, null, Ae(l.prices[t].slice(0, 3), (g) => {
|
|
323
|
+
var v;
|
|
324
|
+
return x(), D("div", {
|
|
325
|
+
key: g.date,
|
|
326
|
+
class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
|
|
327
|
+
}, [
|
|
328
|
+
u("div", Rt, [
|
|
329
|
+
u("span", null, N(g.totalCost ? n(Ze)(g.totalCost) : "No data"), 1),
|
|
330
|
+
Ot,
|
|
331
|
+
u("span", null, N(n(G)(g.totalUnit, !1)), 1),
|
|
332
|
+
u("span", null, N(((v = g.measurement) == null ? void 0 : v.abbrev) ?? g.unit.abbrev), 1)
|
|
333
|
+
]),
|
|
334
|
+
u("div", Ut, [
|
|
335
|
+
u("span", null, "(#" + N(g.seqNumber) + ")", 1),
|
|
336
|
+
Bt,
|
|
337
|
+
u("span", null, N(n(Be)(new Date(g.date))), 1)
|
|
338
|
+
])
|
|
339
|
+
]);
|
|
340
|
+
}), 128))
|
|
341
|
+
])
|
|
342
|
+
]);
|
|
343
|
+
}), 128))
|
|
344
|
+
]));
|
|
345
|
+
}
|
|
346
|
+
}), Et = { class: "flex flex-col gap-8 py-16" }, Mt = { class: "flex items-center" }, Lt = { class: "flex-1 flex gap-1 items-center" }, Nt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, qt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, zt = { class: "flex gap-8 w-full" }, Ht = { class: "flex-1 flex flex-col gap-4" }, jt = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Kt = { class: "flex-1 flex flex-col gap-4" }, Yt = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Wt = { class: "flex gap-8 w-full" }, Zt = { class: "flex-1 flex flex-col gap-4" }, Gt = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Qt = { class: "flex-1 flex flex-col gap-4" }, Jt = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Xt = /* @__PURE__ */ ne({
|
|
347
|
+
__name: "TransferItem",
|
|
348
|
+
props: {
|
|
349
|
+
cellByColId: {},
|
|
350
|
+
comparePriceBySku: {},
|
|
351
|
+
showComparePrice: { type: Boolean },
|
|
352
|
+
row: {}
|
|
353
|
+
},
|
|
354
|
+
setup(e) {
|
|
355
|
+
const { t: p } = be();
|
|
356
|
+
return (s, l) => {
|
|
357
|
+
var d, g, v, o, a, r, y, f, i, b, w, $, q, z, B, H, j, J, M, E, h, C, R, X, K, he, Se;
|
|
358
|
+
const c = F("FmLabel"), t = F("FmSpacer");
|
|
359
|
+
return x(), D("div", Et, [
|
|
360
|
+
u("div", Mt, [
|
|
361
|
+
u("div", Lt, [
|
|
362
|
+
u("span", Nt, " (" + N(s.row.original.sku.code) + ") ", 1),
|
|
363
|
+
u("span", qt, N(s.row.original.sku.name), 1)
|
|
364
|
+
]),
|
|
365
|
+
u("div", null, [
|
|
366
|
+
k(n(de), {
|
|
367
|
+
render: (v = (g = (d = s.cellByColId.Delete) == null ? void 0 : d.column) == null ? void 0 : g.columnDef) == null ? void 0 : v.cell,
|
|
368
|
+
props: (a = (o = s.cellByColId.Delete) == null ? void 0 : o.getContext) == null ? void 0 : a.call(o)
|
|
369
|
+
}, null, 8, ["render", "props"])
|
|
370
|
+
])
|
|
371
|
+
]),
|
|
372
|
+
u("div", zt, [
|
|
373
|
+
u("div", Ht, [
|
|
374
|
+
k(c, {
|
|
375
|
+
label: n(p)(`inventory.transfer.form.items.table.${n(U).Code}`)
|
|
376
|
+
}, null, 8, ["label"]),
|
|
377
|
+
k(n(de), {
|
|
378
|
+
render: (f = (y = (r = s.cellByColId[n(U).Code]) == null ? void 0 : r.column) == null ? void 0 : y.columnDef) == null ? void 0 : f.cell,
|
|
379
|
+
props: (b = (i = s.cellByColId[n(U).Code]) == null ? void 0 : i.getContext) == null ? void 0 : b.call(i)
|
|
380
|
+
}, null, 8, ["render", "props"]),
|
|
381
|
+
jt
|
|
382
|
+
]),
|
|
383
|
+
u("div", Kt, [
|
|
384
|
+
k(c, {
|
|
385
|
+
label: n(p)(`inventory.transfer.form.items.table.${n(U).Name}`)
|
|
386
|
+
}, null, 8, ["label"]),
|
|
387
|
+
k(n(de), {
|
|
388
|
+
render: (q = ($ = (w = s.cellByColId[n(U).Name]) == null ? void 0 : w.column) == null ? void 0 : $.columnDef) == null ? void 0 : q.cell,
|
|
389
|
+
props: (B = (z = s.cellByColId[n(U).Name]) == null ? void 0 : z.getContext) == null ? void 0 : B.call(z)
|
|
390
|
+
}, null, 8, ["render", "props"]),
|
|
391
|
+
Yt
|
|
392
|
+
])
|
|
393
|
+
]),
|
|
394
|
+
u("div", Wt, [
|
|
395
|
+
u("div", Zt, [
|
|
396
|
+
k(c, {
|
|
397
|
+
label: n(p)(`inventory.transfer.form.items.table.${n(U).Amount}`)
|
|
398
|
+
}, null, 8, ["label"]),
|
|
399
|
+
k(n(de), {
|
|
400
|
+
render: (J = (j = (H = s.cellByColId[n(U).Amount]) == null ? void 0 : H.column) == null ? void 0 : j.columnDef) == null ? void 0 : J.cell,
|
|
401
|
+
props: (E = (M = s.cellByColId[n(U).Amount]) == null ? void 0 : M.getContext) == null ? void 0 : E.call(M)
|
|
402
|
+
}, null, 8, ["render", "props"]),
|
|
403
|
+
Gt
|
|
404
|
+
]),
|
|
405
|
+
u("div", Qt, [
|
|
406
|
+
k(Je, { "z-index": 50 }, {
|
|
407
|
+
default: I(() => [
|
|
408
|
+
k(c, {
|
|
409
|
+
label: n(p)(`inventory.transfer.form.items.table.${n(U).Cost}2`)
|
|
410
|
+
}, null, 8, ["label"])
|
|
411
|
+
]),
|
|
412
|
+
_: 1
|
|
413
|
+
}),
|
|
414
|
+
k(n(de), {
|
|
415
|
+
render: (R = (C = (h = s.cellByColId[n(U).Cost]) == null ? void 0 : h.column) == null ? void 0 : C.columnDef) == null ? void 0 : R.cell,
|
|
416
|
+
props: (K = (X = s.cellByColId[n(U).Cost]) == null ? void 0 : X.getContext) == null ? void 0 : K.call(X)
|
|
417
|
+
}, null, 8, ["render", "props"]),
|
|
418
|
+
Jt
|
|
419
|
+
])
|
|
420
|
+
]),
|
|
421
|
+
s.showComparePrice && Object.keys(s.comparePriceBySku[(he = s.row.original.sku) == null ? void 0 : he._id] ?? {}).length > 0 ? (x(), D(ve, { key: 0 }, [
|
|
422
|
+
k(t, { class: "h-8" }),
|
|
423
|
+
k(Xe, {
|
|
424
|
+
prices: s.comparePriceBySku[(Se = s.row.original.sku) == null ? void 0 : Se._id]
|
|
425
|
+
}, null, 8, ["prices"])
|
|
426
|
+
], 64)) : Z("", !0)
|
|
427
|
+
]);
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
function ke(e) {
|
|
432
|
+
return ft.parse(e);
|
|
433
|
+
}
|
|
434
|
+
function we(e) {
|
|
435
|
+
return {
|
|
436
|
+
_id: e.doc._id,
|
|
437
|
+
internal: e.type,
|
|
438
|
+
contactName: e.doc.profile.name,
|
|
439
|
+
name: e.doc.profile.name,
|
|
440
|
+
email: e.doc.profile.email,
|
|
441
|
+
phoneNumber: e.doc.profile.phoneNo,
|
|
442
|
+
registrationNumber: e.doc.profile.regNo,
|
|
443
|
+
address: e.doc.profile.address
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
function eo(e, p) {
|
|
447
|
+
const s = xe(), l = Q();
|
|
448
|
+
l.watchLocation(async () => {
|
|
449
|
+
await s.readSuppliers();
|
|
450
|
+
const a = e();
|
|
451
|
+
if (a.supplier._id) return;
|
|
452
|
+
const r = s.suppliers[0], y = l.locations[0];
|
|
453
|
+
p({
|
|
454
|
+
...a,
|
|
455
|
+
supplier: r ? ke(r) : y ? we(y) : a.supplier
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
const c = P(
|
|
459
|
+
() => {
|
|
460
|
+
var a, r;
|
|
461
|
+
return typeof ((r = (a = e()) == null ? void 0 : a.supplier) == null ? void 0 : r.internal) == "string" ? S.TRANSFER : S.PURCHASE;
|
|
462
|
+
}
|
|
463
|
+
), t = P({
|
|
464
|
+
get() {
|
|
465
|
+
var a, r;
|
|
466
|
+
return (r = (a = e()) == null ? void 0 : a.supplier) == null ? void 0 : r._id;
|
|
467
|
+
},
|
|
468
|
+
set(a) {
|
|
469
|
+
const r = e() ?? {};
|
|
470
|
+
if (c.value === S.PURCHASE) {
|
|
471
|
+
const i = s.suppliers.find((b) => b._id === a);
|
|
472
|
+
p({
|
|
473
|
+
...r,
|
|
474
|
+
supplier: i ? ke(i) : r.supplier
|
|
475
|
+
});
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const f = l.locations.find((i) => i.doc._id === a);
|
|
479
|
+
p({
|
|
480
|
+
...r,
|
|
481
|
+
supplier: f ? we(f) : r.supplier
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
}), d = P(() => s.suppliers.map(ke)), g = P(() => {
|
|
485
|
+
var r;
|
|
486
|
+
const a = ((r = l._currentLocation) == null ? void 0 : r.type) === Re.warehouse;
|
|
487
|
+
return l.locations.filter((y) => {
|
|
488
|
+
var i;
|
|
489
|
+
return !(y.dbName === ((i = l._currentLocation) == null ? void 0 : i.dbName)) && (!a || y.type === Re.warehouse) && y.acceptRequest;
|
|
490
|
+
}).map(we);
|
|
491
|
+
}), v = P(() => c.value === S.PURCHASE ? d.value.map((r) => ({
|
|
492
|
+
label: r.name,
|
|
493
|
+
value: r._id
|
|
494
|
+
})) : g.value.map((r) => ({
|
|
495
|
+
label: r.name,
|
|
496
|
+
sublabel: r.internal ? `${r.internal}` : void 0,
|
|
497
|
+
value: r._id
|
|
498
|
+
}))), o = P(() => {
|
|
499
|
+
var f, i;
|
|
500
|
+
const a = (i = (f = e()) == null ? void 0 : f.supplier) == null ? void 0 : i._id;
|
|
501
|
+
if (c.value === S.PURCHASE) {
|
|
502
|
+
const b = s.suppliers.find((w) => w._id === a);
|
|
503
|
+
return b ? ke(b) : null;
|
|
504
|
+
}
|
|
505
|
+
const y = l.locations.find((b) => b.doc._id);
|
|
506
|
+
return y ? we(y) : null;
|
|
507
|
+
});
|
|
508
|
+
return {
|
|
509
|
+
transferLocationModel: t,
|
|
510
|
+
transferLocationOptions: v,
|
|
511
|
+
locationOptionsTypePurchase: d,
|
|
512
|
+
locationOptionsTypeTransfer: g,
|
|
513
|
+
selectedLocation: o
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
function to(e) {
|
|
517
|
+
const p = P({
|
|
518
|
+
get() {
|
|
519
|
+
const t = e.getEffectiveAt();
|
|
520
|
+
return t ? new Date(t) : null;
|
|
521
|
+
},
|
|
522
|
+
set(t) {
|
|
523
|
+
e.setEffectiveAt((t == null ? void 0 : t.toISOString()) ?? null);
|
|
524
|
+
}
|
|
525
|
+
}), s = P({
|
|
526
|
+
get() {
|
|
527
|
+
return !!p.value;
|
|
528
|
+
},
|
|
529
|
+
set(t) {
|
|
530
|
+
t ? p.value = /* @__PURE__ */ new Date() : p.value = null;
|
|
531
|
+
}
|
|
532
|
+
}), l = P({
|
|
533
|
+
get() {
|
|
534
|
+
return p.value === null ? "" : Be(p.value);
|
|
535
|
+
},
|
|
536
|
+
set(t) {
|
|
537
|
+
t ? p.value = /* @__PURE__ */ new Date(`${t} ${c.value}`) : p.value = null;
|
|
538
|
+
}
|
|
539
|
+
}), c = P({
|
|
540
|
+
get() {
|
|
541
|
+
return p.value === null ? "" : yt(p.value);
|
|
542
|
+
},
|
|
543
|
+
set(t) {
|
|
544
|
+
t ? p.value = /* @__PURE__ */ new Date(`${l.value} ${t}`) : p.value = null;
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
return {
|
|
548
|
+
backdatePo: p,
|
|
549
|
+
backdateSwitch: s,
|
|
550
|
+
backdateModel: l,
|
|
551
|
+
backdateTimeModel: c
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
const oo = {
|
|
555
|
+
width: "24",
|
|
556
|
+
height: "24",
|
|
557
|
+
viewBox: "0 0 24 24",
|
|
558
|
+
fill: "none",
|
|
559
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
560
|
+
}, so = ["fill"], ao = ["fill"], no = ["stroke"], ro = ["stroke"], lo = /* @__PURE__ */ ne({
|
|
561
|
+
__name: "SparkIcon",
|
|
562
|
+
props: {
|
|
563
|
+
size: {
|
|
564
|
+
type: Number,
|
|
565
|
+
default: 24
|
|
566
|
+
},
|
|
567
|
+
color: {
|
|
568
|
+
type: String,
|
|
569
|
+
default: "#c7c7cc"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
setup(e) {
|
|
573
|
+
return (p, s) => (x(), D("svg", oo, [
|
|
574
|
+
u("path", {
|
|
575
|
+
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",
|
|
576
|
+
fill: e.color
|
|
577
|
+
}, null, 8, so),
|
|
578
|
+
u("path", {
|
|
579
|
+
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",
|
|
580
|
+
fill: e.color
|
|
581
|
+
}, null, 8, ao),
|
|
582
|
+
u("path", {
|
|
583
|
+
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",
|
|
584
|
+
stroke: e.color,
|
|
585
|
+
"stroke-width": "1.5",
|
|
586
|
+
"stroke-linecap": "round",
|
|
587
|
+
"stroke-linejoin": "round"
|
|
588
|
+
}, null, 8, no),
|
|
589
|
+
u("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
|
+
stroke: e.color,
|
|
592
|
+
"stroke-width": "1.5",
|
|
593
|
+
"stroke-linecap": "round",
|
|
594
|
+
"stroke-linejoin": "round"
|
|
595
|
+
}, null, 8, ro)
|
|
596
|
+
]));
|
|
597
|
+
}
|
|
598
|
+
}), io = { class: "flex gap-8 items-center" }, uo = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-lg-600 line-clamp-1" }, "Forecast stock", -1), co = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, po = { class: "flex items-center w-full" }, mo = { class: "flex-1" }, fo = /* @__PURE__ */ u("p", { class: "fm-typo-en-title-sm-800" }, "Forecast stock", -1), yo = { class: "flex items-start gap-8" }, vo = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Selecting forecast stock will replace your current item selection. ", -1), bo = { class: "flex gap-1" }, ho = /* @__PURE__ */ u("div", { class: "grow" }, null, -1), qe = /* @__PURE__ */ ne({
|
|
599
|
+
__name: "ForecastStock",
|
|
600
|
+
props: {
|
|
601
|
+
disabled: { type: Boolean }
|
|
602
|
+
},
|
|
603
|
+
emits: ["update:poItems"],
|
|
604
|
+
setup(e, { emit: p }) {
|
|
605
|
+
const s = p, l = V(!1), c = V(7), t = wt(), d = Te(), g = Ee();
|
|
606
|
+
async function v() {
|
|
607
|
+
if (c.value < 1)
|
|
608
|
+
return;
|
|
609
|
+
l.value = !1, await t.readPurchaseOrder(c.value);
|
|
610
|
+
const o = [];
|
|
611
|
+
if (t.purchaseOrderForecast.skus.length <= 0) {
|
|
612
|
+
d.open({ message: "There is no forecast at the moment.", type: "info" });
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
const a = t.purchaseOrderForecast.skus.reduce((r, y) => {
|
|
616
|
+
const f = g.skus.find((w) => w._id === y.id);
|
|
617
|
+
if (r.find((w) => w.sku._id === y.id) || !f)
|
|
618
|
+
return r;
|
|
619
|
+
const b = {
|
|
620
|
+
sku: f,
|
|
621
|
+
code: f.code,
|
|
622
|
+
name: f.name,
|
|
623
|
+
quantity: {
|
|
624
|
+
amount: y.amount,
|
|
625
|
+
precision: 0
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
return r.push(b), r;
|
|
629
|
+
}, o);
|
|
630
|
+
s("update:poItems", a);
|
|
631
|
+
}
|
|
632
|
+
return (o, a) => {
|
|
633
|
+
const r = F("FmButton"), y = F("FmIcon"), f = F("FmStepperField"), i = F("FmPopover");
|
|
634
|
+
return x(), L(i, {
|
|
635
|
+
disabled: o.disabled,
|
|
636
|
+
class: "flex",
|
|
637
|
+
"show-popover": l.value,
|
|
638
|
+
onPopoverChanged: a[3] || (a[3] = (b) => l.value = b)
|
|
639
|
+
}, {
|
|
640
|
+
"popover-button": I(() => [
|
|
641
|
+
k(r, {
|
|
642
|
+
label: "unused",
|
|
643
|
+
variant: "secondary",
|
|
644
|
+
"text-color": o.disabled ? "disabled" : "primary",
|
|
645
|
+
"bg-color": "transparent",
|
|
646
|
+
"border-color": o.disabled ? "disabled" : "primary",
|
|
647
|
+
disabled: o.disabled
|
|
648
|
+
}, {
|
|
649
|
+
default: I(() => [
|
|
650
|
+
u("div", io, [
|
|
651
|
+
k(lo, {
|
|
652
|
+
size: 24,
|
|
653
|
+
color: o.disabled ? "#c7c7cc" : "#ff7823"
|
|
654
|
+
}, null, 8, ["color"]),
|
|
655
|
+
uo
|
|
656
|
+
])
|
|
657
|
+
]),
|
|
658
|
+
_: 1
|
|
659
|
+
}, 8, ["text-color", "border-color", "disabled"])
|
|
660
|
+
]),
|
|
661
|
+
default: I(() => [
|
|
662
|
+
u("div", co, [
|
|
663
|
+
u("div", po, [
|
|
664
|
+
u("div", mo, [
|
|
665
|
+
k(St, { "z-index": 99 }, {
|
|
666
|
+
default: I(() => [
|
|
667
|
+
fo
|
|
668
|
+
]),
|
|
669
|
+
_: 1
|
|
670
|
+
})
|
|
671
|
+
]),
|
|
672
|
+
k(r, {
|
|
673
|
+
icon: "close",
|
|
674
|
+
size: "md",
|
|
675
|
+
variant: "tertiary",
|
|
676
|
+
onClick: a[0] || (a[0] = (b) => l.value = !1)
|
|
677
|
+
})
|
|
678
|
+
]),
|
|
679
|
+
k(f, {
|
|
680
|
+
modelValue: c.value,
|
|
681
|
+
"onUpdate:modelValue": a[1] || (a[1] = (b) => c.value = b),
|
|
682
|
+
label: "Enter day to forecast stock",
|
|
683
|
+
rules: [n(Ue)(1)]
|
|
684
|
+
}, {
|
|
685
|
+
"helper-text": I(() => [
|
|
686
|
+
u("div", yo, [
|
|
687
|
+
k(y, {
|
|
688
|
+
name: "warning",
|
|
689
|
+
size: "sm",
|
|
690
|
+
class: "text-fm-color-system-warning-300"
|
|
691
|
+
}),
|
|
692
|
+
vo
|
|
693
|
+
])
|
|
694
|
+
]),
|
|
695
|
+
_: 1
|
|
696
|
+
}, 8, ["modelValue", "rules"]),
|
|
697
|
+
u("div", bo, [
|
|
698
|
+
ho,
|
|
699
|
+
k(r, {
|
|
700
|
+
label: "Cancel",
|
|
701
|
+
variant: "tertiary",
|
|
702
|
+
onClick: a[2] || (a[2] = (b) => l.value = !1)
|
|
703
|
+
}),
|
|
704
|
+
k(r, {
|
|
705
|
+
label: "Generate",
|
|
706
|
+
onClick: v
|
|
707
|
+
})
|
|
708
|
+
])
|
|
709
|
+
])
|
|
710
|
+
]),
|
|
711
|
+
_: 1
|
|
712
|
+
}, 8, ["disabled", "show-popover"]);
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
}), et = vt((e, p) => ({
|
|
716
|
+
async getTemplate(s) {
|
|
717
|
+
const l = Q(), c = `${e.inventoryBackendUrl}/${l.currentLocationDBName}/purchase-order-template/${s}`;
|
|
718
|
+
return p.get(c);
|
|
719
|
+
},
|
|
720
|
+
async readTemplates() {
|
|
721
|
+
const s = Q(), l = `${e.inventoryBackendUrl}/${s.currentLocationDBName}/purchase-order-template`;
|
|
722
|
+
return p.get(l);
|
|
723
|
+
},
|
|
724
|
+
async createTemplate(s) {
|
|
725
|
+
const l = Q(), c = `${e.inventoryBackendUrl}/${l.currentLocationDBName}/purchase-order-template`;
|
|
726
|
+
return p.post(c, s);
|
|
727
|
+
},
|
|
728
|
+
async updateTemplate(s) {
|
|
729
|
+
const l = Q(), c = `${e.inventoryBackendUrl}/${l.currentLocationDBName}/purchase-order-template`;
|
|
730
|
+
return p.post(c, s);
|
|
731
|
+
},
|
|
732
|
+
async deleteTemplate(s) {
|
|
733
|
+
const l = Q(), c = `${e.inventoryBackendUrl}/${l.currentLocationDBName}/purchase-order-template`;
|
|
734
|
+
return p.delete(c, { _id: s._id, _rev: s._rev });
|
|
735
|
+
}
|
|
736
|
+
})), _o = Ft("transferTemplateActions", () => {
|
|
737
|
+
const e = at("receive/request"), p = Ke(), s = Te(), l = et(), c = V({});
|
|
738
|
+
function t() {
|
|
739
|
+
c.value = {
|
|
740
|
+
mode: ae.CREATE,
|
|
741
|
+
show: !0,
|
|
742
|
+
"onUpdate:show"(a) {
|
|
743
|
+
c.value.show = a;
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
function d(a) {
|
|
748
|
+
c.value = {
|
|
749
|
+
mode: ae.UPDATE,
|
|
750
|
+
modelValue: a,
|
|
751
|
+
show: !0,
|
|
752
|
+
"onUpdate:show"(r) {
|
|
753
|
+
c.value.show = r;
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function g(a, r, y) {
|
|
758
|
+
p.open({
|
|
759
|
+
title: `Confirm deleting template ${a.name}?`,
|
|
760
|
+
message: "Deleted template can no longer be retrieved",
|
|
761
|
+
primaryActions: {
|
|
762
|
+
text: "Delete",
|
|
763
|
+
variant: Ie.Destructive,
|
|
764
|
+
close: !0
|
|
765
|
+
},
|
|
766
|
+
secondaryActions: {
|
|
767
|
+
text: "Cancel",
|
|
768
|
+
variant: Ie.Plain,
|
|
769
|
+
close: !0
|
|
770
|
+
}
|
|
771
|
+
}).onPrimary(async () => {
|
|
772
|
+
s.open({
|
|
773
|
+
title: `Deleting ${a.name}`,
|
|
774
|
+
type: "info"
|
|
775
|
+
});
|
|
776
|
+
try {
|
|
777
|
+
r.value = !0;
|
|
778
|
+
const [f] = await Promise.allSettled([
|
|
779
|
+
l.deleteTemplate(a),
|
|
780
|
+
new Promise((i) => setTimeout(i, 1e3))
|
|
781
|
+
]);
|
|
782
|
+
if (f.status === "rejected") throw f.reason;
|
|
783
|
+
s.open({
|
|
784
|
+
title: `Deleted ${a.name}`,
|
|
785
|
+
type: "success"
|
|
786
|
+
});
|
|
787
|
+
} catch (f) {
|
|
788
|
+
s.open({
|
|
789
|
+
title: `Unable to delete ${a.name}`,
|
|
790
|
+
message: `See error from server: ${f}`,
|
|
791
|
+
type: "error"
|
|
792
|
+
}), console.error("error on deleting purchase order template", f);
|
|
793
|
+
} finally {
|
|
794
|
+
r.value = !1, y();
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
function v(a) {
|
|
799
|
+
}
|
|
800
|
+
function o(a) {
|
|
801
|
+
e.promptCreateTransferDialog({
|
|
802
|
+
...a.purchaseOrder,
|
|
803
|
+
template: a._id
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
return {
|
|
807
|
+
createTemplate: t,
|
|
808
|
+
viewTemplate: v,
|
|
809
|
+
updateTemplate: d,
|
|
810
|
+
deleteTemplate: g,
|
|
811
|
+
useTemplate: o,
|
|
812
|
+
templateDialogProps: c,
|
|
813
|
+
transferFormDialogProps: e.transferDialogProps
|
|
814
|
+
};
|
|
815
|
+
});
|
|
816
|
+
function $e(e) {
|
|
817
|
+
var s;
|
|
818
|
+
return ((s = e == null ? void 0 : e.supplier) == null ? void 0 : s.internal) ? S.TRANSFER : S.PURCHASE;
|
|
819
|
+
}
|
|
820
|
+
const ze = "use";
|
|
821
|
+
function go() {
|
|
822
|
+
const { t: e } = be(), { viewTemplate: p, updateTemplate: s, deleteTemplate: l, useTemplate: c } = _o(), t = V(new Array()), d = V(!1), g = Q(), v = et();
|
|
823
|
+
async function o() {
|
|
824
|
+
if (t.value = [], !!g._currentLocation) {
|
|
825
|
+
d.value = !0;
|
|
826
|
+
try {
|
|
827
|
+
const [f] = await Promise.all([
|
|
828
|
+
v.readTemplates(),
|
|
829
|
+
new Promise((i) => setTimeout(i, 1e3))
|
|
830
|
+
]);
|
|
831
|
+
t.value = f;
|
|
832
|
+
} catch (f) {
|
|
833
|
+
console.log("Something went wrong when fetching templates:", f);
|
|
834
|
+
} finally {
|
|
835
|
+
d.value = !1;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
async function a(f) {
|
|
840
|
+
if (!t.value.find((i) => i._id) && g._currentLocation) {
|
|
841
|
+
d.value = !0;
|
|
842
|
+
try {
|
|
843
|
+
const [i] = await Promise.all([
|
|
844
|
+
v.getTemplate(f),
|
|
845
|
+
new Promise((b) => setTimeout(b, 1e3))
|
|
846
|
+
]);
|
|
847
|
+
t.value = [i];
|
|
848
|
+
} catch (i) {
|
|
849
|
+
console.log("Something went wrong when fetching templates:", i);
|
|
850
|
+
} finally {
|
|
851
|
+
d.value = !1;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
function r(f, i) {
|
|
856
|
+
switch (i = Qe(i), f) {
|
|
857
|
+
case ze:
|
|
858
|
+
return c(i);
|
|
859
|
+
case ye.Details:
|
|
860
|
+
return p(i);
|
|
861
|
+
case ye.Edit:
|
|
862
|
+
return s(i);
|
|
863
|
+
case ye.Delete:
|
|
864
|
+
return l(i, d, o);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return { columnDefs: [
|
|
868
|
+
{
|
|
869
|
+
id: "_id",
|
|
870
|
+
accessorKey: "_id",
|
|
871
|
+
header: () => e("inventory.transfer.table.createdAt"),
|
|
872
|
+
cell(f) {
|
|
873
|
+
return nt(`${f.getValue()}`);
|
|
874
|
+
},
|
|
875
|
+
enableSorting: !0
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
id: "name",
|
|
879
|
+
accessorKey: "name",
|
|
880
|
+
header: () => e("inventory.transfer.table.name"),
|
|
881
|
+
enableSorting: !0,
|
|
882
|
+
size: 200
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
id: "supplier",
|
|
886
|
+
accessorKey: "purchaseOrder.supplier.name",
|
|
887
|
+
header: () => e("inventory.transfer.table.transferFrom"),
|
|
888
|
+
enableSorting: !0,
|
|
889
|
+
size: 200
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
id: "type",
|
|
893
|
+
header: () => e("inventory.transfer.receiveRequest.details.type.title"),
|
|
894
|
+
enableSorting: !0,
|
|
895
|
+
sortingFn(f, i) {
|
|
896
|
+
const b = $e(f.original.purchaseOrder), w = $e(i.original.purchaseOrder);
|
|
897
|
+
return b.localeCompare(w);
|
|
898
|
+
},
|
|
899
|
+
size: 200,
|
|
900
|
+
cell(f) {
|
|
901
|
+
const i = $e(f.row.original.purchaseOrder), b = e(
|
|
902
|
+
`inventory.transfer.receiveRequest.details.type.${i.toLocaleLowerCase()}`
|
|
903
|
+
);
|
|
904
|
+
return O(oe.FmChip, {
|
|
905
|
+
label: b,
|
|
906
|
+
class: "fm-chip-transfer-info",
|
|
907
|
+
compact: !0
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
id: "noOfItems",
|
|
913
|
+
accessorKey: "purchaseOrder.items.length",
|
|
914
|
+
header: () => e("inventory.transfer.table.noOfItems"),
|
|
915
|
+
enableSorting: !1,
|
|
916
|
+
meta: {
|
|
917
|
+
width: "10rem",
|
|
918
|
+
textAlign: "right"
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
id: "ref",
|
|
923
|
+
accessorKey: "purchaseOrder.ref",
|
|
924
|
+
header: () => e("inventory.transfer.table.reference"),
|
|
925
|
+
enableSorting: !1,
|
|
926
|
+
size: "auto"
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
id: "action",
|
|
930
|
+
cell(f) {
|
|
931
|
+
const i = f.row.original, b = [
|
|
932
|
+
{
|
|
933
|
+
label: e("inventory.transfer.template.use"),
|
|
934
|
+
value: ze,
|
|
935
|
+
color: "text-fm-color-typo-primary"
|
|
936
|
+
},
|
|
937
|
+
Le[ye.Edit],
|
|
938
|
+
Le[ye.Delete]
|
|
939
|
+
];
|
|
940
|
+
return Tt(b, (w) => r(w, i));
|
|
941
|
+
},
|
|
942
|
+
enableSorting: !1,
|
|
943
|
+
size: 40,
|
|
944
|
+
meta: {
|
|
945
|
+
cellClass: "",
|
|
946
|
+
headerClass: ""
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
], templates: t, loading: d, fetchTemplates: o, loadTemplate: a };
|
|
950
|
+
}
|
|
951
|
+
function Co() {
|
|
952
|
+
const e = Te(), p = Ye(), s = V(!1);
|
|
953
|
+
Oe(s, (d) => {
|
|
954
|
+
d && (c.value = !0, l().finally(() => {
|
|
955
|
+
c.value = !1;
|
|
956
|
+
}));
|
|
957
|
+
});
|
|
958
|
+
async function l() {
|
|
959
|
+
try {
|
|
960
|
+
const { startDate: d, endDate: g } = bt(6), a = (await p.getPurchaseOrders({ start: d, end: g })).filter(
|
|
961
|
+
(r) => {
|
|
962
|
+
var y, f;
|
|
963
|
+
return r.status === ht.enum.COMPLETE && ((y = r.supplier) == null ? void 0 : y.internal) !== "warehouse" && ((f = r.supplier) == null ? void 0 : f.internal) !== "restaurant";
|
|
964
|
+
}
|
|
965
|
+
).reduce((r, y) => {
|
|
966
|
+
const f = new Date(_t(y._id)), i = y.supplier._id;
|
|
967
|
+
for (const b of y.items) {
|
|
968
|
+
if (!b.totalCost) continue;
|
|
969
|
+
const w = r[b.sku._id] ?? {}, $ = w[i] ?? [];
|
|
970
|
+
$.push({
|
|
971
|
+
date: f.toISOString(),
|
|
972
|
+
totalUnit: b.quantity,
|
|
973
|
+
totalCost: b.totalCost,
|
|
974
|
+
unit: b.sku.unit,
|
|
975
|
+
measurement: b.measurement,
|
|
976
|
+
seqNumber: y.seqNumber
|
|
977
|
+
}), w[i] = $, r[b.sku._id] = w;
|
|
978
|
+
}
|
|
979
|
+
return r;
|
|
980
|
+
}, {});
|
|
981
|
+
t.value = a;
|
|
982
|
+
} catch {
|
|
983
|
+
e.open({
|
|
984
|
+
title: "Something went wrong",
|
|
985
|
+
message: "Cannot retrieve supplier purchase history. Please try again."
|
|
986
|
+
}), s.value = !1;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
const c = V(!1), t = V({});
|
|
990
|
+
return {
|
|
991
|
+
comparePricesToggle: s,
|
|
992
|
+
comparePriceFetching: c,
|
|
993
|
+
comparePriceBySku: t
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
const ko = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, wo = { key: 0 }, To = ["colspan"], xo = /* @__PURE__ */ ne({
|
|
997
|
+
__name: "TransferItemTable",
|
|
998
|
+
props: {
|
|
999
|
+
row: {},
|
|
1000
|
+
comparePriceBySku: {},
|
|
1001
|
+
showComparePrice: { type: Boolean }
|
|
1002
|
+
},
|
|
1003
|
+
setup(e) {
|
|
1004
|
+
function p(s) {
|
|
1005
|
+
return s.column.columnDef.meta;
|
|
1006
|
+
}
|
|
1007
|
+
return (s, l) => {
|
|
1008
|
+
var c, t;
|
|
1009
|
+
return x(), D(ve, null, [
|
|
1010
|
+
u("tr", {
|
|
1011
|
+
class: De(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
|
|
1012
|
+
"bg-fm-color-neutral-gray-100": s.row.getIsSelected()
|
|
1013
|
+
}])
|
|
1014
|
+
}, [
|
|
1015
|
+
(x(!0), D(ve, null, Ae(s.row.getVisibleCells(), (d) => {
|
|
1016
|
+
var g, v, o, a;
|
|
1017
|
+
return x(), D("td", {
|
|
1018
|
+
key: d.id,
|
|
1019
|
+
class: De([
|
|
1020
|
+
"h-[52px] px-16 text-fm-color-typo-primary",
|
|
1021
|
+
((g = p(d)) == null ? void 0 : g.cellClass) ?? "px-16"
|
|
1022
|
+
]),
|
|
1023
|
+
style: tt({
|
|
1024
|
+
width: (v = p(d)) == null ? void 0 : v.width,
|
|
1025
|
+
maxWidth: (o = p(d)) == null ? void 0 : o.maxWidth,
|
|
1026
|
+
textAlign: ((a = p(d)) == null ? void 0 : a.textAlign) ?? "left"
|
|
1027
|
+
})
|
|
1028
|
+
}, [
|
|
1029
|
+
u("span", ko, [
|
|
1030
|
+
k(n(de), {
|
|
1031
|
+
render: d.column.columnDef.cell,
|
|
1032
|
+
props: d.getContext()
|
|
1033
|
+
}, null, 8, ["render", "props"])
|
|
1034
|
+
])
|
|
1035
|
+
], 6);
|
|
1036
|
+
}), 128))
|
|
1037
|
+
], 2),
|
|
1038
|
+
s.showComparePrice && Object.keys(s.comparePriceBySku[(c = s.row.original.sku) == null ? void 0 : c._id] ?? {}).length > 0 ? (x(), D("tr", wo, [
|
|
1039
|
+
u("td", {
|
|
1040
|
+
colspan: s.row.getVisibleCells().length
|
|
1041
|
+
}, [
|
|
1042
|
+
k(Xe, {
|
|
1043
|
+
prices: s.comparePriceBySku[(t = s.row.original.sku) == null ? void 0 : t._id]
|
|
1044
|
+
}, null, 8, ["prices"])
|
|
1045
|
+
], 8, To)
|
|
1046
|
+
])) : Z("", !0)
|
|
1047
|
+
], 64);
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
}), So = { class: "flex flex-col gap-4" }, Fo = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, Po = { class: "flex flex-col gap-16" }, $o = { class: "flex flex-col gap-24" }, Ao = {
|
|
1051
|
+
key: 0,
|
|
1052
|
+
class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
|
|
1053
|
+
}, Do = { class: "flex xs:flex-col sm:flex-col" }, Io = /* @__PURE__ */ u("div", { class: "xs:hidden sm:hidden h-48 lg:w-16 md:w-16" }, null, -1), Vo = {
|
|
1054
|
+
key: 0,
|
|
1055
|
+
class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
|
|
1056
|
+
}, Ro = { class: "flex-1" }, Oo = { class: "flex-1" }, Uo = {
|
|
1057
|
+
key: 1,
|
|
1058
|
+
class: "flex items-center gap-4"
|
|
1059
|
+
}, Bo = /* @__PURE__ */ u("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, " Cannot backdate without an initial closing made to the system. ", -1), Eo = { class: "flex flex-col gap-16" }, Mo = { class: "flex sm:flex-col xs:flex-col gap-16 items-center xs:items-start sm:items-start" }, Lo = /* @__PURE__ */ u("div", { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, "Transfer items", -1), No = { class: "flex gap-8" }, qo = /* @__PURE__ */ u("div", null, "Forecast is not available on transfer document created from a template.", -1), zo = {
|
|
1060
|
+
key: 0,
|
|
1061
|
+
class: "xs:w-full"
|
|
1062
|
+
}, Ho = /* @__PURE__ */ ne({
|
|
1063
|
+
__name: "TransferForm2",
|
|
1064
|
+
props: {
|
|
1065
|
+
modelValue: {},
|
|
1066
|
+
disabled: { type: Boolean },
|
|
1067
|
+
suppliers: {},
|
|
1068
|
+
skus: {},
|
|
1069
|
+
lastClosingDate: {}
|
|
1070
|
+
},
|
|
1071
|
+
emits: ["validation-success", "form:ready"],
|
|
1072
|
+
setup(e, { expose: p, emit: s }) {
|
|
1073
|
+
const l = e, c = s, t = At(), { t: d } = be(), g = Q(), v = Ee(), o = xe(), a = We(), r = go(), y = P(
|
|
1074
|
+
() => r.templates.value.find((m) => m._id === t.template)
|
|
1075
|
+
), f = P(() => t.status === "DRAFT" || !t._rev);
|
|
1076
|
+
je(async () => {
|
|
1077
|
+
try {
|
|
1078
|
+
if (!t.template) return;
|
|
1079
|
+
await r.loadTemplate(t.template);
|
|
1080
|
+
} finally {
|
|
1081
|
+
c("form:ready");
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
const i = P(
|
|
1085
|
+
() => g.currentLocation.type === Re.restaurant
|
|
1086
|
+
);
|
|
1087
|
+
g.watchLocation(async () => {
|
|
1088
|
+
location && (t.supplier || (t.supplier = o.suppliers.find((m) => m) ?? t.supplier));
|
|
1089
|
+
});
|
|
1090
|
+
const b = Ke(), w = eo(
|
|
1091
|
+
() => t,
|
|
1092
|
+
(m) => {
|
|
1093
|
+
Object.assign(t, m);
|
|
1094
|
+
}
|
|
1095
|
+
), $ = P({
|
|
1096
|
+
get() {
|
|
1097
|
+
var m;
|
|
1098
|
+
return typeof ((m = t == null ? void 0 : t.supplier) == null ? void 0 : m.internal) == "string" ? S.TRANSFER : S.PURCHASE;
|
|
1099
|
+
},
|
|
1100
|
+
set(m) {
|
|
1101
|
+
var Y;
|
|
1102
|
+
const _ = typeof ((Y = t == null ? void 0 : t.supplier) == null ? void 0 : Y.internal) == "string" ? S.TRANSFER : S.PURCHASE;
|
|
1103
|
+
m !== _ && (t.supplier = m === S.PURCHASE ? w.locationOptionsTypePurchase.value[0] : w.locationOptionsTypeTransfer.value[0]);
|
|
1104
|
+
}
|
|
1105
|
+
}), q = P(() => w.transferLocationOptions.value), z = P({
|
|
1106
|
+
get() {
|
|
1107
|
+
return t.supplier._id;
|
|
1108
|
+
},
|
|
1109
|
+
set(m) {
|
|
1110
|
+
w.transferLocationModel.value = m;
|
|
1111
|
+
}
|
|
1112
|
+
}), B = P({
|
|
1113
|
+
get() {
|
|
1114
|
+
return t.remark ?? void 0;
|
|
1115
|
+
},
|
|
1116
|
+
set(m) {
|
|
1117
|
+
t.remark = m;
|
|
1118
|
+
}
|
|
1119
|
+
}), { backdatePo: H, backdateSwitch: j, backdateModel: J, backdateTimeModel: M } = to({
|
|
1120
|
+
getEffectiveAt() {
|
|
1121
|
+
return t.effectiveAt;
|
|
1122
|
+
},
|
|
1123
|
+
setEffectiveAt(m) {
|
|
1124
|
+
t.effectiveAt = m;
|
|
1125
|
+
}
|
|
1126
|
+
}), { comparePricesToggle: E, comparePriceFetching: h, comparePriceBySku: C } = Co(), R = V();
|
|
1127
|
+
p({
|
|
1128
|
+
validateInputs: () => {
|
|
1129
|
+
var m, _;
|
|
1130
|
+
(_ = (m = R.value) == null ? void 0 : m.validateInputs) == null || _.call(m);
|
|
1131
|
+
},
|
|
1132
|
+
resetInputsValidation: () => {
|
|
1133
|
+
var m, _;
|
|
1134
|
+
(_ = (m = R.value) == null ? void 0 : m.resetInputsValidation) == null || _.call(m);
|
|
1135
|
+
},
|
|
1136
|
+
resetInputs: () => {
|
|
1137
|
+
var m, _;
|
|
1138
|
+
(_ = (m = R.value) == null ? void 0 : m.resetInputs) == null || _.call(m);
|
|
1139
|
+
}
|
|
1140
|
+
});
|
|
1141
|
+
const X = $t({
|
|
1142
|
+
updateItem: (m) => {
|
|
1143
|
+
t.items = t.items.map((_) => _.sku._id !== m.sku._id ? _ : m);
|
|
1144
|
+
},
|
|
1145
|
+
deleteItem: (m) => {
|
|
1146
|
+
t.items = t.items.filter((_) => _.sku._id !== m.sku._id);
|
|
1147
|
+
},
|
|
1148
|
+
get supplier() {
|
|
1149
|
+
return t.supplier;
|
|
1150
|
+
},
|
|
1151
|
+
get items() {
|
|
1152
|
+
return t.items;
|
|
1153
|
+
},
|
|
1154
|
+
get transferType() {
|
|
1155
|
+
return $.value;
|
|
1156
|
+
},
|
|
1157
|
+
get template() {
|
|
1158
|
+
return y.value;
|
|
1159
|
+
},
|
|
1160
|
+
get disabled() {
|
|
1161
|
+
return l.disabled;
|
|
1162
|
+
}
|
|
1163
|
+
}), K = P(() => X.columnDefs.value);
|
|
1164
|
+
function he() {
|
|
1165
|
+
var _e, me, ge;
|
|
1166
|
+
let m;
|
|
1167
|
+
((A) => {
|
|
1168
|
+
A.IsInTemplate = "IsInTemplate", A.IsOutsideTemplate = "IsOutsideTemplate";
|
|
1169
|
+
})(m || (m = {}));
|
|
1170
|
+
const _ = [
|
|
1171
|
+
{
|
|
1172
|
+
id: "IsInTemplate",
|
|
1173
|
+
label: "From template",
|
|
1174
|
+
sublabel: "These are defined in the template"
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
id: "IsOutsideTemplate",
|
|
1178
|
+
label: "Other",
|
|
1179
|
+
collapse: !0
|
|
1180
|
+
}
|
|
1181
|
+
], Y = new Set((ge = (me = (_e = y.value) == null ? void 0 : _e.purchaseOrder) == null ? void 0 : me.items) == null ? void 0 : ge.map((A) => A.sku._id)), pe = v.skus.map(
|
|
1182
|
+
(A) => ({
|
|
1183
|
+
label: A.name,
|
|
1184
|
+
sublabel: A.code,
|
|
1185
|
+
value: A,
|
|
1186
|
+
groupId: Y.has(A._id) ? "IsInTemplate" : "IsOutsideTemplate"
|
|
1187
|
+
/* IsOutsideTemplate */
|
|
1188
|
+
})
|
|
1189
|
+
), Fe = pe.filter((A) => {
|
|
1190
|
+
var ee;
|
|
1191
|
+
return (ee = t.items) == null ? void 0 : ee.find((re) => re.sku._id === A.value._id);
|
|
1192
|
+
}).map((A) => A.value);
|
|
1193
|
+
b.open({
|
|
1194
|
+
title: "Select item",
|
|
1195
|
+
closeButton: !0,
|
|
1196
|
+
contentComponent: kt,
|
|
1197
|
+
contentComponentProps: {
|
|
1198
|
+
modelValue: Fe,
|
|
1199
|
+
items: pe,
|
|
1200
|
+
groups: Y.size ? _ : void 0
|
|
1201
|
+
},
|
|
1202
|
+
primaryActions: {
|
|
1203
|
+
text: "Confirm",
|
|
1204
|
+
close: !0
|
|
1205
|
+
},
|
|
1206
|
+
secondaryActions: {
|
|
1207
|
+
text: "Close",
|
|
1208
|
+
close: !0,
|
|
1209
|
+
variant: "tertiary"
|
|
1210
|
+
}
|
|
1211
|
+
}).onPrimary((A) => {
|
|
1212
|
+
const ee = t.items ?? [], re = A.map((W) => {
|
|
1213
|
+
var Ce, fe;
|
|
1214
|
+
const le = ee.find((ie) => ie.sku._id === W._id);
|
|
1215
|
+
if (le)
|
|
1216
|
+
return le;
|
|
1217
|
+
const te = ((fe = (Ce = y.value) == null ? void 0 : Ce.purchaseOrder.items) == null ? void 0 : fe.find(
|
|
1218
|
+
(ie) => ie.sku._id === W._id
|
|
1219
|
+
)) ?? {
|
|
1220
|
+
sku: W,
|
|
1221
|
+
code: W.code,
|
|
1222
|
+
name: W.name,
|
|
1223
|
+
quantity: {
|
|
1224
|
+
amount: 1,
|
|
1225
|
+
precision: 0
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
return $.value == S.PURCHASE && (te.totalCost = se(
|
|
1229
|
+
te.sku,
|
|
1230
|
+
te.quantity,
|
|
1231
|
+
te.measurement,
|
|
1232
|
+
{
|
|
1233
|
+
supplier: t.supplier
|
|
1234
|
+
}
|
|
1235
|
+
)), te;
|
|
1236
|
+
});
|
|
1237
|
+
re.sort((W, le) => W.sku.code.localeCompare(le.sku.code)), t.items = re;
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
function Se(m) {
|
|
1241
|
+
return m;
|
|
1242
|
+
}
|
|
1243
|
+
return (m, _) => {
|
|
1244
|
+
var fe, ie;
|
|
1245
|
+
const Y = F("FmChip"), pe = F("FmSelect"), Fe = F("FmTextField"), _e = F("FmTextarea"), me = F("FmSwitch"), ge = F("FmDatePicker"), A = F("FmTimePicker"), ee = F("FmFormGroup"), re = F("FmIcon"), W = F("FmButton"), le = F("FmTooltip"), te = F("FmTable"), Ce = F("FmForm");
|
|
1246
|
+
return x(), D("div", So, [
|
|
1247
|
+
u("div", Fo, [
|
|
1248
|
+
(fe = l.modelValue) != null && fe.template ? (x(), L(Y, {
|
|
1249
|
+
key: 0,
|
|
1250
|
+
variant: m.disabled ? "warning" : void 0,
|
|
1251
|
+
label: `Template: ${((ie = y.value) == null ? void 0 : ie.name) ?? "Loading..."}`,
|
|
1252
|
+
icon: "summarize",
|
|
1253
|
+
compact: ""
|
|
1254
|
+
}, null, 8, ["variant", "label"])) : Z("", !0),
|
|
1255
|
+
k(Y, {
|
|
1256
|
+
label: n(g).currentLocation.name,
|
|
1257
|
+
icon: "storefront",
|
|
1258
|
+
compact: ""
|
|
1259
|
+
}, null, 8, ["label"]),
|
|
1260
|
+
m.lastClosingDate ? (x(), L(Y, {
|
|
1261
|
+
key: 1,
|
|
1262
|
+
label: `Last closing: ${n(Be)(m.lastClosingDate)} ${n(gt)(m.lastClosingDate)}`,
|
|
1263
|
+
icon: "calendar_month",
|
|
1264
|
+
compact: ""
|
|
1265
|
+
}, null, 8, ["label"])) : Z("", !0)
|
|
1266
|
+
]),
|
|
1267
|
+
k(Ce, {
|
|
1268
|
+
ref_key: "formRef",
|
|
1269
|
+
ref: R,
|
|
1270
|
+
class: "flex flex-col gap-32",
|
|
1271
|
+
disabled: m.disabled,
|
|
1272
|
+
onValidationFailed: console.log,
|
|
1273
|
+
onValidationSuccess: _[12] || (_[12] = (Pe) => c("validation-success"))
|
|
1274
|
+
}, {
|
|
1275
|
+
default: I(() => {
|
|
1276
|
+
var Pe;
|
|
1277
|
+
return [
|
|
1278
|
+
u("div", Po, [
|
|
1279
|
+
u("div", $o, [
|
|
1280
|
+
k(pe, {
|
|
1281
|
+
label: n(d)("inventory.transfer.form.type.title"),
|
|
1282
|
+
"model-value": $.value,
|
|
1283
|
+
"onUpdate:modelValue": _[0] || (_[0] = (T) => $.value = T),
|
|
1284
|
+
items: [
|
|
1285
|
+
{
|
|
1286
|
+
label: n(d)(
|
|
1287
|
+
`inventory.transfer.form.type.${n(S).PURCHASE.toLocaleLowerCase()}`
|
|
1288
|
+
),
|
|
1289
|
+
value: n(S).PURCHASE,
|
|
1290
|
+
disabled: !n(w).locationOptionsTypePurchase.value.length,
|
|
1291
|
+
sublabel: n(w).locationOptionsTypePurchase.value.length ? void 0 : "No supplier available"
|
|
1292
|
+
},
|
|
1293
|
+
{
|
|
1294
|
+
label: n(d)(
|
|
1295
|
+
`inventory.transfer.form.type.${n(S).TRANSFER.toLocaleLowerCase()}`
|
|
1296
|
+
),
|
|
1297
|
+
value: n(S).TRANSFER,
|
|
1298
|
+
disabled: !n(w).locationOptionsTypeTransfer.value.length,
|
|
1299
|
+
sublabel: n(w).locationOptionsTypeTransfer.value.length ? void 0 : "No location available"
|
|
1300
|
+
}
|
|
1301
|
+
],
|
|
1302
|
+
rules: [n(Ue)(1)(q.value)]
|
|
1303
|
+
}, null, 8, ["label", "model-value", "items", "rules"]),
|
|
1304
|
+
k(pe, {
|
|
1305
|
+
label: $.value === n(S).PURCHASE ? "Purchase from" : "Transfer from",
|
|
1306
|
+
modelValue: z.value,
|
|
1307
|
+
"onUpdate:modelValue": _[1] || (_[1] = (T) => z.value = T),
|
|
1308
|
+
items: q.value
|
|
1309
|
+
}, null, 8, ["label", "modelValue", "items"]),
|
|
1310
|
+
k(Fe, {
|
|
1311
|
+
label: "Reference",
|
|
1312
|
+
"label-mark": "optional",
|
|
1313
|
+
modelValue: n(t).ref,
|
|
1314
|
+
"onUpdate:modelValue": _[2] || (_[2] = (T) => n(t).ref = T)
|
|
1315
|
+
}, null, 8, ["modelValue"]),
|
|
1316
|
+
k(_e, {
|
|
1317
|
+
label: "Remark",
|
|
1318
|
+
"label-mark": "optional",
|
|
1319
|
+
"max-length": 240,
|
|
1320
|
+
modelValue: B.value,
|
|
1321
|
+
"onUpdate:modelValue": _[3] || (_[3] = (T) => B.value = T),
|
|
1322
|
+
class: De([m.disabled ? "text-fm-color-typo-disabled " : ""])
|
|
1323
|
+
}, null, 8, ["modelValue", "class"]),
|
|
1324
|
+
n(a).enableBackdatePo ? (x(), D("div", Ao, [
|
|
1325
|
+
u("div", Do, [
|
|
1326
|
+
k(me, {
|
|
1327
|
+
modelValue: n(j),
|
|
1328
|
+
"onUpdate:modelValue": _[4] || (_[4] = (T) => ce(j) ? j.value = T : null),
|
|
1329
|
+
label: "Backdate transfer",
|
|
1330
|
+
sublabel: "Apply transfer to older date",
|
|
1331
|
+
"label-placement": "right",
|
|
1332
|
+
disabled: i.value && !m.lastClosingDate || m.disabled
|
|
1333
|
+
}, null, 8, ["modelValue", "disabled"]),
|
|
1334
|
+
Io,
|
|
1335
|
+
n(j) ? (x(), D("div", Vo, [
|
|
1336
|
+
u("div", Ro, [
|
|
1337
|
+
k(ge, {
|
|
1338
|
+
modelValue: n(J),
|
|
1339
|
+
"onUpdate:modelValue": _[5] || (_[5] = (T) => ce(J) ? J.value = T : null)
|
|
1340
|
+
}, null, 8, ["modelValue"])
|
|
1341
|
+
]),
|
|
1342
|
+
u("div", Oo, [
|
|
1343
|
+
k(A, {
|
|
1344
|
+
modelValue: n(M),
|
|
1345
|
+
"onUpdate:modelValue": _[6] || (_[6] = (T) => ce(M) ? M.value = T : null)
|
|
1346
|
+
}, null, 8, ["modelValue"])
|
|
1347
|
+
])
|
|
1348
|
+
])) : Z("", !0)
|
|
1349
|
+
]),
|
|
1350
|
+
n(H) ? (x(), L(ee, {
|
|
1351
|
+
key: 0,
|
|
1352
|
+
modelValue: n(H),
|
|
1353
|
+
"onUpdate:modelValue": _[7] || (_[7] = (T) => ce(H) ? H.value = T : null),
|
|
1354
|
+
rules: [n(Ct)(new Date(m.lastClosingDate), /* @__PURE__ */ new Date())]
|
|
1355
|
+
}, null, 8, ["modelValue", "rules"])) : Z("", !0),
|
|
1356
|
+
i.value && !m.lastClosingDate ? (x(), D("div", Uo, [
|
|
1357
|
+
k(re, {
|
|
1358
|
+
name: "error",
|
|
1359
|
+
size: "sm",
|
|
1360
|
+
class: "text-fm-color-typo-warning"
|
|
1361
|
+
}),
|
|
1362
|
+
Bo
|
|
1363
|
+
])) : Z("", !0)
|
|
1364
|
+
])) : Z("", !0)
|
|
1365
|
+
])
|
|
1366
|
+
]),
|
|
1367
|
+
u("div", Eo, [
|
|
1368
|
+
k(ee, {
|
|
1369
|
+
"model-value": n(t).items,
|
|
1370
|
+
rules: [
|
|
1371
|
+
function(ue) {
|
|
1372
|
+
return ue && ue.length > 0 || "Must have at least one item!";
|
|
1373
|
+
}
|
|
1374
|
+
]
|
|
1375
|
+
}, null, 8, ["model-value", "rules"]),
|
|
1376
|
+
u("div", Mo, [
|
|
1377
|
+
Lo,
|
|
1378
|
+
u("div", No, [
|
|
1379
|
+
k(W, {
|
|
1380
|
+
disabled: m.disabled,
|
|
1381
|
+
label: "Add Item",
|
|
1382
|
+
"prepend-icon": "add",
|
|
1383
|
+
variant: "secondary",
|
|
1384
|
+
"text-color": "primary",
|
|
1385
|
+
"bg-color": "transparent",
|
|
1386
|
+
"border-color": "primary",
|
|
1387
|
+
onClick: _[8] || (_[8] = (T) => he()),
|
|
1388
|
+
size: "md"
|
|
1389
|
+
}, null, 8, ["disabled"]),
|
|
1390
|
+
n(t).template ? (x(), L(le, {
|
|
1391
|
+
key: 0,
|
|
1392
|
+
"z-index": 50
|
|
1393
|
+
}, {
|
|
1394
|
+
content: I(() => [
|
|
1395
|
+
qo
|
|
1396
|
+
]),
|
|
1397
|
+
default: I(() => [
|
|
1398
|
+
k(qe, {
|
|
1399
|
+
"onUpdate:poItems": _[9] || (_[9] = (T) => n(t).items = T),
|
|
1400
|
+
disabled: ""
|
|
1401
|
+
})
|
|
1402
|
+
]),
|
|
1403
|
+
_: 1
|
|
1404
|
+
})) : (x(), L(qe, {
|
|
1405
|
+
key: 1,
|
|
1406
|
+
"onUpdate:poItems": _[10] || (_[10] = (T) => n(t).items = T),
|
|
1407
|
+
disabled: m.disabled || !!n(t).template
|
|
1408
|
+
}, null, 8, ["disabled"]))
|
|
1409
|
+
])
|
|
1410
|
+
]),
|
|
1411
|
+
$.value === n(S).PURCHASE && f.value && n(a).enableTotalCost && ((Pe = m.modelValue) != null && Pe.items.length) ? (x(), D("div", zo, [
|
|
1412
|
+
k(me, {
|
|
1413
|
+
label: n(h) ? "Fetching data..." : "Compare price history",
|
|
1414
|
+
"prepend-icon": "compare_arrows",
|
|
1415
|
+
"label-placement": "right",
|
|
1416
|
+
"model-value": n(E),
|
|
1417
|
+
"onUpdate:modelValue": _[11] || (_[11] = (T) => ce(E) ? E.value = T : null),
|
|
1418
|
+
disabled: n(h) || m.disabled
|
|
1419
|
+
}, null, 8, ["label", "model-value", "disabled"])
|
|
1420
|
+
])) : Z("", !0),
|
|
1421
|
+
(x(), L(te, {
|
|
1422
|
+
"column-defs": K.value,
|
|
1423
|
+
"row-data": n(t).items,
|
|
1424
|
+
key: n(t).items.map((T) => T.sku._id).join("."),
|
|
1425
|
+
"hide-footer": ""
|
|
1426
|
+
}, {
|
|
1427
|
+
"table-row": I((T) => [
|
|
1428
|
+
k(xo, {
|
|
1429
|
+
"compare-price-by-sku": n(C),
|
|
1430
|
+
"show-compare-price": $.value === n(S).PURCHASE && n(E),
|
|
1431
|
+
row: T
|
|
1432
|
+
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row"])
|
|
1433
|
+
]),
|
|
1434
|
+
"list-row": I((T) => [
|
|
1435
|
+
(x(), L(xt, {
|
|
1436
|
+
row: T,
|
|
1437
|
+
key: n(t).items.map((ue) => ue.sku._id).join(".")
|
|
1438
|
+
}, {
|
|
1439
|
+
default: I((ue) => [
|
|
1440
|
+
k(Xt, {
|
|
1441
|
+
"compare-price-by-sku": n(C),
|
|
1442
|
+
"show-compare-price": $.value === n(S).PURCHASE && n(E),
|
|
1443
|
+
row: T,
|
|
1444
|
+
"cell-by-col-id": ue
|
|
1445
|
+
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
|
|
1446
|
+
]),
|
|
1447
|
+
_: 2
|
|
1448
|
+
}, 1032, ["row"]))
|
|
1449
|
+
]),
|
|
1450
|
+
_: 1
|
|
1451
|
+
}, 8, ["column-defs", "row-data"]))
|
|
1452
|
+
])
|
|
1453
|
+
];
|
|
1454
|
+
}),
|
|
1455
|
+
_: 1
|
|
1456
|
+
}, 8, ["disabled", "onValidationFailed"])
|
|
1457
|
+
]);
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
}), jo = { class: "flex items-center" }, Ko = { class: "fm-typo-en-title-md-800" }, Yo = { class: "flex gap-4" }, rs = /* @__PURE__ */ ne({
|
|
1461
|
+
__name: "TransferDialog",
|
|
1462
|
+
props: {
|
|
1463
|
+
mode: {},
|
|
1464
|
+
modelValue: {},
|
|
1465
|
+
template: {},
|
|
1466
|
+
show: { type: Boolean },
|
|
1467
|
+
lastClosingDate: {}
|
|
1468
|
+
},
|
|
1469
|
+
emits: ["update:show", "submitted"],
|
|
1470
|
+
setup(e, { expose: p, emit: s }) {
|
|
1471
|
+
var E;
|
|
1472
|
+
const l = e, c = s, t = Ye(), d = Te(), g = xe(), v = Ee(), o = Q(), a = V(!1), r = V(!1), y = V(!1);
|
|
1473
|
+
async function f(h) {
|
|
1474
|
+
if (h) {
|
|
1475
|
+
r.value = !1;
|
|
1476
|
+
try {
|
|
1477
|
+
await g.readSuppliers(), r.value = !0;
|
|
1478
|
+
} catch {
|
|
1479
|
+
d.open({
|
|
1480
|
+
title: "Unable to fetch list of suppliers",
|
|
1481
|
+
message: "Try to refresh page to retry operation",
|
|
1482
|
+
type: "error"
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
o.watchLocation(f);
|
|
1488
|
+
function i() {
|
|
1489
|
+
return {
|
|
1490
|
+
remark: void 0,
|
|
1491
|
+
ref: void 0,
|
|
1492
|
+
stockSnapshotId: void 0,
|
|
1493
|
+
effectiveAt: void 0,
|
|
1494
|
+
items: [],
|
|
1495
|
+
supplier: {
|
|
1496
|
+
_rev: void 0,
|
|
1497
|
+
email: void 0,
|
|
1498
|
+
internal: void 0,
|
|
1499
|
+
contactName: void 0,
|
|
1500
|
+
phoneNumber: void 0,
|
|
1501
|
+
registrationNumber: void 0,
|
|
1502
|
+
supplyItems: void 0,
|
|
1503
|
+
_id: "",
|
|
1504
|
+
name: "",
|
|
1505
|
+
address: {
|
|
1506
|
+
line2: void 0,
|
|
1507
|
+
line1: "",
|
|
1508
|
+
state: "",
|
|
1509
|
+
city: "",
|
|
1510
|
+
postcode: "",
|
|
1511
|
+
country: ""
|
|
1512
|
+
}
|
|
1513
|
+
},
|
|
1514
|
+
status: "DRAFT",
|
|
1515
|
+
_id: "",
|
|
1516
|
+
seqNumber: 0,
|
|
1517
|
+
deliveryOrder: []
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
const b = st(l, "show"), w = V(l.modelValue ?? i()), $ = V(((E = l.modelValue) == null ? void 0 : E._id) ?? `${Math.random()}`);
|
|
1521
|
+
Oe(
|
|
1522
|
+
() => l.show,
|
|
1523
|
+
(h) => {
|
|
1524
|
+
var C;
|
|
1525
|
+
h && (y.value = !1, w.value = l.modelValue ?? i(), $.value = ((C = l.modelValue) == null ? void 0 : C._id) ?? `${Math.random()}`);
|
|
1526
|
+
}
|
|
1527
|
+
);
|
|
1528
|
+
const q = P(() => !r.value || !y.value), z = P(() => {
|
|
1529
|
+
switch (l.mode) {
|
|
1530
|
+
case ae.CREATE:
|
|
1531
|
+
return "Add transfer";
|
|
1532
|
+
case ae.READ:
|
|
1533
|
+
return "View transfer";
|
|
1534
|
+
case ae.UPDATE:
|
|
1535
|
+
return "Edit transfer";
|
|
1536
|
+
}
|
|
1537
|
+
return "";
|
|
1538
|
+
}), B = V();
|
|
1539
|
+
p({
|
|
1540
|
+
validateInputs: () => {
|
|
1541
|
+
var h, C;
|
|
1542
|
+
(C = (h = B.value) == null ? void 0 : h.validateInputs) == null || C.call(h);
|
|
1543
|
+
},
|
|
1544
|
+
resetInputsValidation: () => {
|
|
1545
|
+
var h, C;
|
|
1546
|
+
(C = (h = B.value) == null ? void 0 : h.resetInputsValidation) == null || C.call(h);
|
|
1547
|
+
},
|
|
1548
|
+
resetInputs: () => {
|
|
1549
|
+
var h, C;
|
|
1550
|
+
(C = (h = B.value) == null ? void 0 : h.resetInputs) == null || C.call(h);
|
|
1551
|
+
}
|
|
1552
|
+
});
|
|
1553
|
+
async function H() {
|
|
1554
|
+
const h = w.value;
|
|
1555
|
+
a.value = !0, (h.supplier.internal === "warehouse" || h.supplier.internal === "restaurant") && (h.items = h.items.map(({ totalCost: C, ...R }) => R));
|
|
1556
|
+
try {
|
|
1557
|
+
await t.createPurchaseOrder(h), await new Promise((C) => setTimeout(C, 1e3)), d.open({
|
|
1558
|
+
title: "Created",
|
|
1559
|
+
message: "Your transfer draft has been created!",
|
|
1560
|
+
type: "success"
|
|
1561
|
+
}), c("update:show", !1), c("submitted");
|
|
1562
|
+
} catch (C) {
|
|
1563
|
+
d.open({
|
|
1564
|
+
title: "Cannot create purchase order",
|
|
1565
|
+
message: "Report to system administrator for troubleshooting.",
|
|
1566
|
+
type: "error"
|
|
1567
|
+
}), console.error("Error in creating purchase order", C);
|
|
1568
|
+
} finally {
|
|
1569
|
+
a.value = !1;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
async function j() {
|
|
1573
|
+
const h = w.value;
|
|
1574
|
+
a.value = !0, (h.supplier.internal === "warehouse" || h.supplier.internal === "restaurant") && (h.items = h.items.map(({ totalCost: C, ...R }) => R));
|
|
1575
|
+
try {
|
|
1576
|
+
await t.updatePurchaseOrder(h), await new Promise((C) => setTimeout(C, 1e3)), d.open({
|
|
1577
|
+
title: "Updated",
|
|
1578
|
+
message: "Your transfer draft has been updated!",
|
|
1579
|
+
type: "success"
|
|
1580
|
+
}), c("update:show", !1), c("submitted");
|
|
1581
|
+
} catch (C) {
|
|
1582
|
+
d.open({
|
|
1583
|
+
title: "Cannot update purchase order",
|
|
1584
|
+
message: "Report to system administrator for troubleshooting.",
|
|
1585
|
+
type: "error"
|
|
1586
|
+
}), console.error("Error in updating purchase order", C);
|
|
1587
|
+
} finally {
|
|
1588
|
+
a.value = !1;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
function J() {
|
|
1592
|
+
switch (l.mode) {
|
|
1593
|
+
case ae.CREATE:
|
|
1594
|
+
return H();
|
|
1595
|
+
case ae.UPDATE:
|
|
1596
|
+
return j();
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
function M() {
|
|
1600
|
+
var h, C;
|
|
1601
|
+
(C = (h = B.value) == null ? void 0 : h.validateInputs) == null || C.call(h);
|
|
1602
|
+
}
|
|
1603
|
+
return (h, C) => {
|
|
1604
|
+
const R = F("FmButton"), X = F("FmSideSheet");
|
|
1605
|
+
return x(), L(X, {
|
|
1606
|
+
modelValue: n(b),
|
|
1607
|
+
"onUpdate:modelValue": C[3] || (C[3] = (K) => ce(b) ? b.value = K : null),
|
|
1608
|
+
"dismiss-away": "",
|
|
1609
|
+
"close-button": "",
|
|
1610
|
+
"max-width": 900
|
|
1611
|
+
}, {
|
|
1612
|
+
"side-sheet-header": I(() => [
|
|
1613
|
+
u("div", jo, [
|
|
1614
|
+
u("div", Ko, N(z.value), 1)
|
|
1615
|
+
])
|
|
1616
|
+
]),
|
|
1617
|
+
default: I(() => [
|
|
1618
|
+
(x(), L(Ho, {
|
|
1619
|
+
class: "w-full",
|
|
1620
|
+
ref_key: "formRef",
|
|
1621
|
+
ref: B,
|
|
1622
|
+
"onForm:ready": C[0] || (C[0] = () => y.value = !0),
|
|
1623
|
+
onValidationSuccess: J,
|
|
1624
|
+
modelValue: w.value,
|
|
1625
|
+
"onUpdate:modelValue": C[1] || (C[1] = (K) => w.value = K),
|
|
1626
|
+
disabled: a.value || q.value,
|
|
1627
|
+
suppliers: n(g).suppliers,
|
|
1628
|
+
skus: n(v).skus,
|
|
1629
|
+
key: $.value,
|
|
1630
|
+
"last-closing-date": h.lastClosingDate
|
|
1631
|
+
}, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
|
|
1632
|
+
]),
|
|
1633
|
+
"side-sheet-footer": I(() => [
|
|
1634
|
+
u("div", Yo, [
|
|
1635
|
+
k(R, {
|
|
1636
|
+
loading: a.value,
|
|
1637
|
+
disabled: q.value,
|
|
1638
|
+
label: "Save",
|
|
1639
|
+
onClick: M
|
|
1640
|
+
}, null, 8, ["loading", "disabled"]),
|
|
1641
|
+
k(R, {
|
|
1642
|
+
disabled: q.value,
|
|
1643
|
+
variant: "tertiary",
|
|
1644
|
+
label: "Close",
|
|
1645
|
+
onClick: C[2] || (C[2] = (K) => c("update:show", !1))
|
|
1646
|
+
}, null, 8, ["disabled"])
|
|
1647
|
+
])
|
|
1648
|
+
]),
|
|
1649
|
+
_: 1
|
|
1650
|
+
}, 8, ["modelValue"]);
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
});
|
|
1654
|
+
export {
|
|
1655
|
+
rs as _,
|
|
1656
|
+
et as a,
|
|
1657
|
+
_o as b,
|
|
1658
|
+
se as c,
|
|
1659
|
+
At as d,
|
|
1660
|
+
go as e,
|
|
1661
|
+
eo as u
|
|
1662
|
+
};
|