@feedmepos/mf-inventory-portal 0.0.19-dev.1 → 0.0.19-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ApprovalView-CS7NtcBA.js +120 -0
- package/dist/{BindingsDialog-DpC48bqK.js → BindingsDialog-BA2w-qkY.js} +5 -6
- package/dist/{BindingsPicker-BU52g6zk.js → BindingsPicker-wf7b30Bk.js} +6 -7
- package/dist/{BindingsTable-aIuFdScv.js → BindingsTable-mqqSPDbO.js} +4 -6
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CViUEhuw.js +272 -0
- package/dist/IngredientsView-BVX31o67.js +1750 -0
- package/dist/IntegrationView-DFdl_238.js +1172 -0
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BuyM580N.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BENFVQkL.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-EeKhENYH.js → PurchaseOrderPrintPreview-06PokYt4.js} +13 -13
- package/dist/ReceiveRequestView-ck-05Ly7.js +1394 -0
- package/dist/RecipeView-CiOb2lvU.js +572 -0
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
- package/dist/StockView-5LkTxYI2.js +1876 -0
- package/dist/SupplierView-BAfC5Wcw.js +801 -0
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-qZDMkkIZ.js +1031 -0
- package/dist/UnitView-wsbXOcbf.js +638 -0
- package/dist/WarehouseView-DHhDNAk8.js +1050 -0
- package/dist/api/bill.d.ts +2 -2
- package/dist/app-DNCC20Aq.js +66729 -0
- package/dist/app.d.ts +1031 -0
- package/dist/app.js +5 -3
- package/dist/components/FmDroppableField.vue.d.ts +1 -1
- package/dist/{decimal-BAZuuTcd.js → decimal-DaXHxukU.js} +1 -1
- package/dist/{stock-estimate-CL4HShG8.js → id-to-date-XiomI6dP.js} +12 -13
- package/dist/{layout-BnTfCS_X.js → layout-DvgFrTEG.js} +14 -14
- package/dist/router/name.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-CjAH8O1y.js → supplier-BepZrUgL.js} +3 -3
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- 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/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +12 -12
- 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/unit/composables/use-unit-form.d.ts +14 -2
- package/dist/views/unit/composables/use-unit-table.d.ts +1 -2
- package/dist/{xlsx-vUzm_udV.js → xlsx-DaxqUL1h.js} +1 -1
- package/dist/xlsx.util-Dwiw0sTo.js +109 -0
- package/package.json +6 -5
- package/dist/ApprovalView-BTZwnKLf.js +0 -118
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js +0 -268
- package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js +0 -143
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js +0 -236
- package/dist/IngredientsView-DMyEGdik.js +0 -1767
- package/dist/IntegrationView-Dn_qL_vC.js +0 -1166
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DGTLUrb9.js +0 -276
- package/dist/ReceiveRequestView-BOdgbFFM.js +0 -1394
- package/dist/RecipeView-B1aNLDIK.js +0 -573
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
- package/dist/StockView-C_Ur_jTg.js +0 -1862
- package/dist/SupplierView-CXfOoHTr.js +0 -796
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kjV5Eazv.js +0 -1028
- package/dist/UnitView-DHXfAsnq.js +0 -635
- package/dist/WarehouseView-DMwbxs1q.js +0 -1043
- package/dist/app-BkcO8oNJ.js +0 -66113
- package/dist/date2-Cvp5iJkI.js +0 -95
- package/dist/dayjs.min-D1_pOsO7.js +0 -282
- package/dist/fuzzy-0roCBvgC.js +0 -41
- package/dist/index-B_aEOJsR.js +0 -21515
- package/dist/number-DLj3W3RW.js +0 -97
- package/dist/rules-CCmXA0Yi.js +0 -85
- package/dist/use-inventory-binding-dialog-GkJOzE6V.js +0 -93
- package/dist/xlsx.util-B_bqymTM.js +0 -107
|
@@ -1,1394 +0,0 @@
|
|
|
1
|
-
import { defineComponent as Ve, openBlock as g, createElementBlock as F, createElementVNode as l, Fragment as Te, renderList as Xe, toDisplayString as J, unref as u, mergeModels as Mt, reactive as ta, computed as P, onMounted as Ot, useModel as aa, watch as he, ref as Y, resolveComponent as k, createBlock as G, withCtx as A, createVNode as i, createCommentVNode as z, normalizeClass as Be, normalizeStyle as jt, resolveDynamicComponent as sa, h as N, isRef as oa, Teleport as la, mergeProps as It } from "vue";
|
|
2
|
-
import { I as ot, d as ye, p as ge, q as na, f as nt, a as Kt, C as lt, u as ra, r as Ze, t as ua } from "./app-BkcO8oNJ.js";
|
|
3
|
-
import { i as Nt, _ as ia, a as ca } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js";
|
|
4
|
-
import { u as Gt, p as da, P as D, a as ma, b as pa, _ as fa, g as va } from "./TransferDetails.vue_vue_type_script_setup_true_lang-kjV5Eazv.js";
|
|
5
|
-
import { i as Wt, a as K, t as _a, c as ya } from "./number-DLj3W3RW.js";
|
|
6
|
-
import { _ as ga, u as ha, i as ba, e as Ca } from "./stock-estimate-CL4HShG8.js";
|
|
7
|
-
import { d as qt } from "./dayjs.min-D1_pOsO7.js";
|
|
8
|
-
import { useDialog as xa, useSnackbar as rt, components as oe, useProxiedModel as ka, useBreakpoints as wa } from "@feedmepos/ui-library";
|
|
9
|
-
import { R as Ht, F as Fe } from "./row-action.enum-BwQbURNh.js";
|
|
10
|
-
import { useCoreStore as Sa } from "@feedmepos/mf-common";
|
|
11
|
-
import { _ as Da } from "./FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js";
|
|
12
|
-
import { F as X, _ as Bt, u as Fa } from "./layout-BnTfCS_X.js";
|
|
13
|
-
import { R as Qe, B as Ta, A as Va, a as Ra, M as Pa } from "./rules-CCmXA0Yi.js";
|
|
14
|
-
import { c as Je, g as Aa, d as Ua, a as Lt } from "./date2-Cvp5iJkI.js";
|
|
15
|
-
import { u as Zt } from "./supplier-CjAH8O1y.js";
|
|
16
|
-
import { _ as $a } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js";
|
|
17
|
-
import { F as Ea, i as Ma } from "./index-B_aEOJsR.js";
|
|
18
|
-
import { _ as Oa, F as Ia } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js";
|
|
19
|
-
import "./array-AvWd53LI.js";
|
|
20
|
-
const Na = {
|
|
21
|
-
width: "24",
|
|
22
|
-
height: "24",
|
|
23
|
-
viewBox: "0 0 24 24",
|
|
24
|
-
fill: "none",
|
|
25
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
26
|
-
}, qa = ["fill"], Ha = ["fill"], La = ["stroke"], za = ["stroke"], Ya = /* @__PURE__ */ Ve({
|
|
27
|
-
__name: "SparkIcon",
|
|
28
|
-
props: {
|
|
29
|
-
size: {
|
|
30
|
-
type: Number,
|
|
31
|
-
default: 24
|
|
32
|
-
},
|
|
33
|
-
color: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: "#c7c7cc"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
setup(W) {
|
|
39
|
-
return (te, ee) => (g(), F("svg", Na, [
|
|
40
|
-
l("path", {
|
|
41
|
-
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",
|
|
42
|
-
fill: W.color
|
|
43
|
-
}, null, 8, qa),
|
|
44
|
-
l("path", {
|
|
45
|
-
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",
|
|
46
|
-
fill: W.color
|
|
47
|
-
}, null, 8, Ha),
|
|
48
|
-
l("path", {
|
|
49
|
-
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",
|
|
50
|
-
stroke: W.color,
|
|
51
|
-
"stroke-width": "1.5",
|
|
52
|
-
"stroke-linecap": "round",
|
|
53
|
-
"stroke-linejoin": "round"
|
|
54
|
-
}, null, 8, La),
|
|
55
|
-
l("path", {
|
|
56
|
-
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",
|
|
57
|
-
stroke: W.color,
|
|
58
|
-
"stroke-width": "1.5",
|
|
59
|
-
"stroke-linecap": "round",
|
|
60
|
-
"stroke-linejoin": "round"
|
|
61
|
-
}, null, 8, za)
|
|
62
|
-
]));
|
|
63
|
-
}
|
|
64
|
-
}), ja = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, Ka = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, Ga = { class: "w-[450px] xs:w-full flex" }, Wa = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Ba = /* @__PURE__ */ l("span", { class: "text-fm-color-typo-secondary" }, "/", -1), Za = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Qa = /* @__PURE__ */ l("span", null, /* @__PURE__ */ J(" "), -1), zt = /* @__PURE__ */ Ve({
|
|
65
|
-
__name: "SupplierPriceHistory",
|
|
66
|
-
props: {
|
|
67
|
-
prices: {}
|
|
68
|
-
},
|
|
69
|
-
setup(W) {
|
|
70
|
-
const te = Zt();
|
|
71
|
-
function ee(x) {
|
|
72
|
-
return te.suppliers.find((M) => M._id === x);
|
|
73
|
-
}
|
|
74
|
-
return (x, M) => (g(), F("div", ja, [
|
|
75
|
-
(g(!0), F(Te, null, Xe(Object.keys(x.prices), (T) => {
|
|
76
|
-
var w;
|
|
77
|
-
return g(), F("div", {
|
|
78
|
-
key: T,
|
|
79
|
-
class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
|
|
80
|
-
}, [
|
|
81
|
-
l("div", Ka, J((w = ee(T)) == null ? void 0 : w.name), 1),
|
|
82
|
-
l("div", Ga, [
|
|
83
|
-
(g(!0), F(Te, null, Xe(x.prices[T].slice(0, 3), (f) => {
|
|
84
|
-
var O;
|
|
85
|
-
return g(), F("div", {
|
|
86
|
-
key: f.date,
|
|
87
|
-
class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
|
|
88
|
-
}, [
|
|
89
|
-
l("div", Wa, [
|
|
90
|
-
l("span", null, J(f.totalCost ? u(Wt)(f.totalCost) : "No data"), 1),
|
|
91
|
-
Ba,
|
|
92
|
-
l("span", null, J(u(K)(f.totalUnit, !1)), 1),
|
|
93
|
-
l("span", null, J(((O = f.measurement) == null ? void 0 : O.abbrev) ?? f.unit.abbrev), 1)
|
|
94
|
-
]),
|
|
95
|
-
l("div", Za, [
|
|
96
|
-
l("span", null, "(#" + J(f.seqNumber) + ")", 1),
|
|
97
|
-
Qa,
|
|
98
|
-
l("span", null, J(u(Je)(new Date(f.date))), 1)
|
|
99
|
-
])
|
|
100
|
-
]);
|
|
101
|
-
}), 128))
|
|
102
|
-
])
|
|
103
|
-
]);
|
|
104
|
-
}), 128))
|
|
105
|
-
]));
|
|
106
|
-
}
|
|
107
|
-
}), Ja = { class: "flex flex-col w-full gap-40" }, Xa = { class: "flex flex-col gap-8" }, es = /* @__PURE__ */ l("div", { class: "fm-typo-en-title-sm-800" }, "Transfer details", -1), ts = { class: "flex items-center gap-8" }, as = /* @__PURE__ */ l("div", null, null, -1), ss = { class: "flex flex-col gap-4" }, os = {
|
|
108
|
-
key: 0,
|
|
109
|
-
class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
|
|
110
|
-
}, ls = { class: "flex xs:flex-col sm:flex-col" }, ns = /* @__PURE__ */ l("div", { class: "xs:hidden sm:hidden h-48 lg:w-16 md:w-16" }, null, -1), rs = {
|
|
111
|
-
key: 0,
|
|
112
|
-
class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
|
|
113
|
-
}, us = { class: "flex-1" }, is = { class: "flex-1" }, cs = {
|
|
114
|
-
key: 1,
|
|
115
|
-
class: "flex items-center gap-4"
|
|
116
|
-
}, ds = /* @__PURE__ */ l("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), ms = { class: "flex flex-col gap-8" }, ps = { class: "flex items-center xs:flex-col xs:gap-4" }, fs = /* @__PURE__ */ l("div", { class: "xs:w-full flex-1 fm-typo-en-title-sm-800" }, "Transfer items", -1), vs = {
|
|
117
|
-
key: 0,
|
|
118
|
-
class: "xs:w-full"
|
|
119
|
-
}, _s = { class: "flex gap-2" }, ys = ["disabled"], gs = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, hs = { class: "flex items-center" }, bs = /* @__PURE__ */ l("p", { class: "flex-1 fm-typo-en-title-sm-800" }, "Forecast stock", -1), Cs = { class: "flex items-start gap-8" }, xs = /* @__PURE__ */ l("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Selecting forecast stock will replace your current item selection. ", -1), ks = { class: "flex gap-1" }, ws = /* @__PURE__ */ l("div", { class: "grow" }, null, -1), Ss = { key: 0 }, Ds = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, Fs = { key: 0 }, Ts = ["colspan"], Vs = { class: "flex flex-col gap-4" }, Rs = { class: "flex items-center" }, Ps = { class: "flex-1" }, As = { class: "grid grid-cols-2 gap-4" }, Us = { class: "flex flex-col" }, $s = { class: "flex flex-col" }, Es = { class: "flex flex-col" }, Ms = { class: "h-24" }, Os = {
|
|
120
|
-
key: 0,
|
|
121
|
-
class: "flex flex-col",
|
|
122
|
-
"data-cy": "fm-table-list-view-cost-label"
|
|
123
|
-
}, Is = {
|
|
124
|
-
key: 0,
|
|
125
|
-
class: "flex gap-4 text-fm-color-typo-primary fm-typo-en-body-lg-600"
|
|
126
|
-
}, Ns = /* @__PURE__ */ Ve({
|
|
127
|
-
__name: "TransferForm",
|
|
128
|
-
props: /* @__PURE__ */ Mt({
|
|
129
|
-
modelValue: {},
|
|
130
|
-
disabled: { type: Boolean },
|
|
131
|
-
suppliers: { default: () => [] },
|
|
132
|
-
skus: { default: () => [] },
|
|
133
|
-
lastClosingDate: {}
|
|
134
|
-
}, {
|
|
135
|
-
modelValue: {
|
|
136
|
-
default: {
|
|
137
|
-
ref: "",
|
|
138
|
-
supplier: null
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
modelModifiers: {}
|
|
142
|
-
}),
|
|
143
|
-
emits: /* @__PURE__ */ Mt(["validation-success"], ["update:modelValue"]),
|
|
144
|
-
setup(W, { expose: te, emit: ee }) {
|
|
145
|
-
const x = nt(), M = ha(), T = Sa(), w = Gt(), f = Kt(), O = ta({}), _ = W;
|
|
146
|
-
function de(e) {
|
|
147
|
-
return Object.prototype.hasOwnProperty.call(e, "_rev") && Object.prototype.hasOwnProperty.call(e, "status");
|
|
148
|
-
}
|
|
149
|
-
const b = P(() => !de(_.modelValue) || _.modelValue.status === "DRAFT");
|
|
150
|
-
Ot(() => {
|
|
151
|
-
const e = _.modelValue;
|
|
152
|
-
if (de(e))
|
|
153
|
-
for (const t of e.items) {
|
|
154
|
-
const a = L(t), n = t.totalCost ?? Ea.reset();
|
|
155
|
-
a ? O[t.sku._id] = a.amount !== n.amount || a.precision !== n.precision : O[t.sku._id] = !0;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
const q = P(() => {
|
|
159
|
-
var a;
|
|
160
|
-
if (b.value)
|
|
161
|
-
return !0;
|
|
162
|
-
const e = _.lastClosingDate, t = (a = _.modelValue) != null && a._id ? da(_.modelValue._id) : null;
|
|
163
|
-
return !e || !t ? !1 : t.getTime() > e.getTime();
|
|
164
|
-
}), H = ee, m = aa(W, "modelValue"), B = P({
|
|
165
|
-
get() {
|
|
166
|
-
var e;
|
|
167
|
-
return ((e = m.value) == null ? void 0 : e.remark) ?? "";
|
|
168
|
-
},
|
|
169
|
-
set(e) {
|
|
170
|
-
m.value.remark = e;
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
he([() => _.suppliers], () => {
|
|
174
|
-
if (o.value === D.PURCHASE) {
|
|
175
|
-
m.value.supplier = _.suppliers[0];
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
const U = P(() => _.disabled), le = P(() => m.value.items ?? []), V = (e) => {
|
|
180
|
-
const { name: t, address: a, regNo: n, phoneNo: s } = e.doc.profile;
|
|
181
|
-
return {
|
|
182
|
-
_id: e.doc._id,
|
|
183
|
-
internal: e.type === ot.restaurant ? ge.enum.restaurant : ge.enum.warehouse,
|
|
184
|
-
name: t,
|
|
185
|
-
registrationNumber: n,
|
|
186
|
-
address: a,
|
|
187
|
-
contactName: t,
|
|
188
|
-
phoneNumber: s,
|
|
189
|
-
disabled: !e.acceptRequest || e.dbName === x.currentLocation.dbName
|
|
190
|
-
};
|
|
191
|
-
}, E = [
|
|
192
|
-
{
|
|
193
|
-
label: "Purchase",
|
|
194
|
-
value: D.PURCHASE
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
label: "Transfer",
|
|
198
|
-
value: D.TRANSFER
|
|
199
|
-
}
|
|
200
|
-
], o = Y(D.PURCHASE), c = P(() => {
|
|
201
|
-
var t;
|
|
202
|
-
const e = ((t = x._currentLocation) == null ? void 0 : t.type) === ot.warehouse;
|
|
203
|
-
return x.locations.filter((a) => {
|
|
204
|
-
var s;
|
|
205
|
-
return !(a.dbName === ((s = x._currentLocation) == null ? void 0 : s.dbName)) && (!e || a.type === ot.warehouse) && a.acceptRequest;
|
|
206
|
-
});
|
|
207
|
-
}), y = P(() => o.value === D.PURCHASE ? _.suppliers.map((e) => ({
|
|
208
|
-
label: e.name,
|
|
209
|
-
value: e._id,
|
|
210
|
-
disabled: !1
|
|
211
|
-
})) : c.value.map(V).map((e) => ({
|
|
212
|
-
label: e.disabled ? `${e.name} (Upgrade POS)` : e.name,
|
|
213
|
-
value: e._id,
|
|
214
|
-
disabled: e.disabled
|
|
215
|
-
}))), S = P({
|
|
216
|
-
get() {
|
|
217
|
-
var e;
|
|
218
|
-
return ((e = m.value.supplier) == null ? void 0 : e._id) ?? null;
|
|
219
|
-
},
|
|
220
|
-
set(e) {
|
|
221
|
-
if (o.value === D.PURCHASE) {
|
|
222
|
-
m.value.supplier = _.suppliers.find((a) => a._id === e) ?? null, m.value.items && (m.value.items = m.value.items.map((a) => ({
|
|
223
|
-
...a,
|
|
224
|
-
totalCost: L(a)
|
|
225
|
-
})));
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
const t = x.locations.find((a) => a.doc._id === e);
|
|
229
|
-
t ? m.value.supplier = V(t) : m.value.supplier = null;
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
function $(e) {
|
|
233
|
-
switch (e) {
|
|
234
|
-
case lt.MY:
|
|
235
|
-
return "MYR";
|
|
236
|
-
case lt.SG:
|
|
237
|
-
return "SGD";
|
|
238
|
-
case lt.ID:
|
|
239
|
-
return "IDR";
|
|
240
|
-
default:
|
|
241
|
-
return "MYR";
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function L(e) {
|
|
245
|
-
var j, Z, ue, qe, He, Le;
|
|
246
|
-
if (O[e.sku._id])
|
|
247
|
-
return e.totalCost;
|
|
248
|
-
const t = e.measurement, a = (qe = (ue = (Z = (j = _.modelValue) == null ? void 0 : j.supplier) == null ? void 0 : Z.supplyItems) == null ? void 0 : ue.find(
|
|
249
|
-
(ke) => ke.skuId === e.sku._id
|
|
250
|
-
)) == null ? void 0 : qe.defaultCost, n = e.sku.defaultCost, s = a ?? n, d = s == null ? void 0 : s.costPerUnit, r = d ? s != null && s.measurement ? +K(d) / +K(s == null ? void 0 : s.measurement.conversion) : +K(d) : void 0, v = r ? t ? r * +K(t.conversion) : r : void 0, C = v ? +K(e.quantity) * v : void 0;
|
|
251
|
-
return C ? {
|
|
252
|
-
..._a(C ?? 0, 2),
|
|
253
|
-
currency: $(((He = T.currentCountry) == null ? void 0 : He.value) ?? ye)
|
|
254
|
-
} : {
|
|
255
|
-
amount: 1,
|
|
256
|
-
precision: 0,
|
|
257
|
-
currency: $(((Le = T.currentCountry) == null ? void 0 : Le.value) ?? ye)
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
function me(e) {
|
|
261
|
-
var t;
|
|
262
|
-
o.value = e, S.value = ((t = y.value.find((a) => !a.disabled)) == null ? void 0 : t.value) ?? null, e === D.PURCHASE && f.enableTotalCost && (m.value.items = m.value.items.map((a) => {
|
|
263
|
-
const n = L(a);
|
|
264
|
-
return {
|
|
265
|
-
...a,
|
|
266
|
-
totalCost: n
|
|
267
|
-
};
|
|
268
|
-
}));
|
|
269
|
-
}
|
|
270
|
-
he([() => _.modelValue], ([e]) => {
|
|
271
|
-
var t, a, n;
|
|
272
|
-
((t = e == null ? void 0 : e.supplier) == null ? void 0 : t.internal) === ge.enum.restaurant || ((a = e == null ? void 0 : e.supplier) == null ? void 0 : a.internal) === ge.enum.warehouse ? o.value = D.TRANSFER : o.value = D.PURCHASE, S.value = ((n = y.value.find((s) => {
|
|
273
|
-
var d, r;
|
|
274
|
-
return s.value === ((r = (d = _.modelValue) == null ? void 0 : d.supplier) == null ? void 0 : r._id);
|
|
275
|
-
})) == null ? void 0 : n.value) ?? null;
|
|
276
|
-
}), Ot(() => {
|
|
277
|
-
var e, t, a, n, s, d, r;
|
|
278
|
-
((t = (e = _.modelValue) == null ? void 0 : e.supplier) == null ? void 0 : t.internal) === ge.enum.restaurant || ((n = (a = _.modelValue) == null ? void 0 : a.supplier) == null ? void 0 : n.internal) === ge.enum.warehouse ? o.value = D.TRANSFER : o.value = D.PURCHASE, S.value = (s = _.modelValue) != null && s.supplier ? ((d = y.value.find((v) => {
|
|
279
|
-
var C, R;
|
|
280
|
-
return v.value === ((R = (C = _.modelValue) == null ? void 0 : C.supplier) == null ? void 0 : R._id);
|
|
281
|
-
})) == null ? void 0 : d.value) ?? null : ((r = y.value.find((v) => !v.disabled)) == null ? void 0 : r.value) ?? null;
|
|
282
|
-
});
|
|
283
|
-
const pe = xa(), ne = Y(7), ae = Y(!1), be = rt();
|
|
284
|
-
async function Re() {
|
|
285
|
-
if (ne.value < 1)
|
|
286
|
-
return;
|
|
287
|
-
ae.value = !1, await M.readPurchaseOrder(ne.value);
|
|
288
|
-
const e = {
|
|
289
|
-
...m.value
|
|
290
|
-
}, t = [];
|
|
291
|
-
if (M.purchaseOrderForecast.skus.length <= 0) {
|
|
292
|
-
be.open({ message: "There is no forecast at the moment.", type: "info" });
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
e.items = M.purchaseOrderForecast.skus.reduce((a, n) => {
|
|
296
|
-
const s = _.skus.find((v) => v._id === n.id);
|
|
297
|
-
if (a.find((v) => v.sku._id === n.id) || !s)
|
|
298
|
-
return a;
|
|
299
|
-
const r = {
|
|
300
|
-
sku: s,
|
|
301
|
-
code: s.code,
|
|
302
|
-
name: s.name,
|
|
303
|
-
quantity: {
|
|
304
|
-
amount: n.amount,
|
|
305
|
-
precision: 0
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
return a.push(r), a;
|
|
309
|
-
}, t), m.value = e;
|
|
310
|
-
}
|
|
311
|
-
function se(e) {
|
|
312
|
-
var d, r, v, C, R, j;
|
|
313
|
-
const t = (C = (v = (r = (d = _.modelValue) == null ? void 0 : d.supplier) == null ? void 0 : r.supplyItems) == null ? void 0 : v.find(
|
|
314
|
-
(Z) => Z.skuId === e.sku._id
|
|
315
|
-
)) == null ? void 0 : C.defaultCost, a = e.sku.defaultCost, n = ((R = t == null ? void 0 : t.costPerUnit) == null ? void 0 : R.amount) ?? 0, s = ((j = a == null ? void 0 : a.costPerUnit) == null ? void 0 : j.amount) ?? 0;
|
|
316
|
-
return n || s;
|
|
317
|
-
}
|
|
318
|
-
function Pe() {
|
|
319
|
-
const e = _.skus.map((a) => ({
|
|
320
|
-
label: a.name,
|
|
321
|
-
sublabel: a.code,
|
|
322
|
-
value: a
|
|
323
|
-
})), t = e.filter((a) => {
|
|
324
|
-
var n;
|
|
325
|
-
return (n = m.value.items) == null ? void 0 : n.find((s) => s.sku._id === a.value._id);
|
|
326
|
-
}).map((a) => a.value);
|
|
327
|
-
pe.open({
|
|
328
|
-
title: "Select item",
|
|
329
|
-
closeButton: !0,
|
|
330
|
-
contentComponent: Da,
|
|
331
|
-
contentComponentProps: {
|
|
332
|
-
modelValue: t,
|
|
333
|
-
items: e
|
|
334
|
-
},
|
|
335
|
-
primaryActions: {
|
|
336
|
-
text: "Confirm",
|
|
337
|
-
close: !0
|
|
338
|
-
},
|
|
339
|
-
secondaryActions: {
|
|
340
|
-
text: "Close",
|
|
341
|
-
close: !0,
|
|
342
|
-
variant: "tertiary"
|
|
343
|
-
}
|
|
344
|
-
}).onPrimary((a) => {
|
|
345
|
-
const n = {
|
|
346
|
-
...m.value
|
|
347
|
-
}, s = n.items ?? [], d = a.map((r) => {
|
|
348
|
-
const v = s.find((R) => R.sku._id === r._id);
|
|
349
|
-
if (v)
|
|
350
|
-
return v;
|
|
351
|
-
const C = {
|
|
352
|
-
sku: r,
|
|
353
|
-
code: r.code,
|
|
354
|
-
name: r.name,
|
|
355
|
-
quantity: {
|
|
356
|
-
amount: 1,
|
|
357
|
-
precision: 0
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
return o.value === D.PURCHASE && f.enableTotalCost && (se(C) ? C.totalCost = L(C) : (O[C.sku._id] = !0, C.totalCost = null)), C;
|
|
361
|
-
});
|
|
362
|
-
d.sort((r, v) => r.sku.code.localeCompare(v.sku.code)), n.items = d, m.value = n;
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
function Ae(e, t) {
|
|
366
|
-
var a;
|
|
367
|
-
if (e === Ht.Delete) {
|
|
368
|
-
const n = ((a = m.value) == null ? void 0 : a.items) ?? [];
|
|
369
|
-
m.value.items = n.filter((s) => s.sku._id !== t);
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
function Ue(e, t) {
|
|
374
|
-
var n;
|
|
375
|
-
const a = ((n = m.value) == null ? void 0 : n.items) ?? [];
|
|
376
|
-
m.value.items = a.map((s) => s.sku._id !== e ? s : t ? (s.measurement = t, f.enableTotalCost && (s.totalCost = L(s)), s) : (delete s.measurement, s.totalCost = L(s), s));
|
|
377
|
-
}
|
|
378
|
-
function $e(e, t) {
|
|
379
|
-
const a = m.value, n = a.items ?? [];
|
|
380
|
-
a.items = n.map((s) => (s.sku._id !== e || (s.code = t), s));
|
|
381
|
-
}
|
|
382
|
-
function fe(e, t) {
|
|
383
|
-
const a = m.value, n = a.items ?? [];
|
|
384
|
-
a.items = n.map((s) => (s.sku._id !== e || (s.name = t), s));
|
|
385
|
-
}
|
|
386
|
-
function Ee(e, t) {
|
|
387
|
-
const a = m.value, n = a.items ?? [];
|
|
388
|
-
a.items = n.map((s) => (s.sku._id !== e || (s.quantity = t, f.enableTotalCost && (s.totalCost = L(s))), s));
|
|
389
|
-
}
|
|
390
|
-
function Me(e, t) {
|
|
391
|
-
const a = +t, n = m.value, s = n.items ?? [];
|
|
392
|
-
t.length > 0 && isFinite(a) ? n.items = s.map((d) => {
|
|
393
|
-
var r;
|
|
394
|
-
return d.sku._id !== e || (d.totalCost = {
|
|
395
|
-
...ya(a),
|
|
396
|
-
currency: $(((r = T.currentCountry) == null ? void 0 : r.value) ?? ye)
|
|
397
|
-
}), d;
|
|
398
|
-
}) : n.items = s.map((d) => {
|
|
399
|
-
var r;
|
|
400
|
-
return d.sku._id !== e || (d.totalCost = {
|
|
401
|
-
amount: 0,
|
|
402
|
-
precision: 0,
|
|
403
|
-
currency: $(((r = T.currentCountry) == null ? void 0 : r.value) ?? ye)
|
|
404
|
-
}), d;
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
const Ce = [
|
|
408
|
-
{
|
|
409
|
-
header: "Code",
|
|
410
|
-
accessorKey: "code",
|
|
411
|
-
size: 96,
|
|
412
|
-
cell(e) {
|
|
413
|
-
const t = e.row.original;
|
|
414
|
-
return b.value ? N(oe.FmTextField, {
|
|
415
|
-
modelValue: t.code,
|
|
416
|
-
"onUpdate:modelValue": (a) => {
|
|
417
|
-
$e(t.sku._id, a);
|
|
418
|
-
},
|
|
419
|
-
rules: [Qe()],
|
|
420
|
-
labelMark: "required"
|
|
421
|
-
}) : t.code;
|
|
422
|
-
},
|
|
423
|
-
enableSorting: !1
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
id: "Name",
|
|
427
|
-
header: "Name",
|
|
428
|
-
minSize: 300,
|
|
429
|
-
cell(e) {
|
|
430
|
-
const t = e.row.original;
|
|
431
|
-
return b.value ? N(oe.FmTextField, {
|
|
432
|
-
modelValue: t.name,
|
|
433
|
-
"onUpdate:modelValue": (a) => {
|
|
434
|
-
fe(t.sku._id, a);
|
|
435
|
-
},
|
|
436
|
-
rules: [Qe()],
|
|
437
|
-
labelMark: "required"
|
|
438
|
-
}) : t.name;
|
|
439
|
-
},
|
|
440
|
-
enableSorting: !1
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
id: "Amount",
|
|
444
|
-
header: "Amount",
|
|
445
|
-
minSize: 300,
|
|
446
|
-
cell(e) {
|
|
447
|
-
var n, s, d, r;
|
|
448
|
-
const t = e.row.original, a = (d = (s = (n = m.value) == null ? void 0 : n.items) == null ? void 0 : s.find) == null ? void 0 : d.call(s, (v) => v.sku._id === t.sku._id);
|
|
449
|
-
return a ? b.value ? N(Oa, {
|
|
450
|
-
style: {
|
|
451
|
-
flex: "1 1 0%"
|
|
452
|
-
},
|
|
453
|
-
modelValue: {
|
|
454
|
-
amount: a.quantity ?? { amount: 1, precision: 0 },
|
|
455
|
-
measurement: a.measurement ?? null
|
|
456
|
-
},
|
|
457
|
-
key: a.sku._id,
|
|
458
|
-
unit: a.sku.unit,
|
|
459
|
-
"onUpdate:modelValue": (v) => {
|
|
460
|
-
Ee(t.sku._id, v.amount), Ue(t.sku._id, v.measurement);
|
|
461
|
-
},
|
|
462
|
-
rules: [Ia(0)],
|
|
463
|
-
applyDefaultRules: !0
|
|
464
|
-
}) : `${K(a.quantity ?? { amount: 1, precision: 0 })} ${((r = a.measurement) == null ? void 0 : r.abbrev) ?? a.sku.unit.abbrev}` : null;
|
|
465
|
-
},
|
|
466
|
-
enableSorting: !1
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
id: "Cost",
|
|
470
|
-
header: () => {
|
|
471
|
-
var e, t;
|
|
472
|
-
return N(
|
|
473
|
-
$a,
|
|
474
|
-
{
|
|
475
|
-
zIndex: 50,
|
|
476
|
-
class: "whitespace-nowrap"
|
|
477
|
-
},
|
|
478
|
-
[
|
|
479
|
-
`Total cost (${$(((e = T.currentCountry) == null ? void 0 : e.value) ?? ye) === "MYR" ? "RM" : $(((t = T.currentCountry) == null ? void 0 : t.value) ?? ye)})`
|
|
480
|
-
]
|
|
481
|
-
);
|
|
482
|
-
},
|
|
483
|
-
size: 180,
|
|
484
|
-
cell(e) {
|
|
485
|
-
var n, s, d;
|
|
486
|
-
const t = e.row.original, a = (d = (s = (n = m.value) == null ? void 0 : n.items) == null ? void 0 : s.find) == null ? void 0 : d.call(s, (r) => r.sku._id === t.sku._id);
|
|
487
|
-
return q.value ? O[(a == null ? void 0 : a.sku._id) ?? ""] || a && !se(a) ? N(
|
|
488
|
-
oe.FmTextField,
|
|
489
|
-
{
|
|
490
|
-
style: {
|
|
491
|
-
flex: "1 1 0%"
|
|
492
|
-
},
|
|
493
|
-
modelValue: a != null && a.totalCost ? +K(a == null ? void 0 : a.totalCost) : "",
|
|
494
|
-
"onUpdate:modelValue": (r) => {
|
|
495
|
-
Me(t.sku._id, r);
|
|
496
|
-
},
|
|
497
|
-
rules: [Ra(0), Pa(2)]
|
|
498
|
-
},
|
|
499
|
-
a && se(a) ? {
|
|
500
|
-
append: N(oe.FmButton, {
|
|
501
|
-
prependIcon: "close",
|
|
502
|
-
variant: "tertiary",
|
|
503
|
-
onClick: () => {
|
|
504
|
-
var v;
|
|
505
|
-
O[(a == null ? void 0 : a.sku._id) ?? ""] = !1;
|
|
506
|
-
const r = ((v = m.value) == null ? void 0 : v.items) ?? [];
|
|
507
|
-
m.value.items = r.map((C) => (f.enableTotalCost && (C.totalCost = L(C)), C));
|
|
508
|
-
}
|
|
509
|
-
})
|
|
510
|
-
} : {}
|
|
511
|
-
) : N(
|
|
512
|
-
"div",
|
|
513
|
-
{
|
|
514
|
-
class: "flex items-center gap-4"
|
|
515
|
-
},
|
|
516
|
-
[
|
|
517
|
-
N(oe.FmButton, {
|
|
518
|
-
prependIcon: "edit",
|
|
519
|
-
variant: "tertiary",
|
|
520
|
-
onClick: () => {
|
|
521
|
-
O[(a == null ? void 0 : a.sku._id) ?? ""] = !0;
|
|
522
|
-
}
|
|
523
|
-
}),
|
|
524
|
-
N(
|
|
525
|
-
"div",
|
|
526
|
-
{
|
|
527
|
-
class: "text-fm-color-typo-primary fm-typo-en-body-lg-400"
|
|
528
|
-
},
|
|
529
|
-
K((a == null ? void 0 : a.totalCost) ?? { amount: 1, precision: 0 })
|
|
530
|
-
)
|
|
531
|
-
]
|
|
532
|
-
) : N(
|
|
533
|
-
"div",
|
|
534
|
-
{
|
|
535
|
-
style: {
|
|
536
|
-
display: "flex",
|
|
537
|
-
alignItems: "center",
|
|
538
|
-
gap: "4px"
|
|
539
|
-
}
|
|
540
|
-
},
|
|
541
|
-
[
|
|
542
|
-
N(
|
|
543
|
-
"div",
|
|
544
|
-
a != null && a.totalCost ? +K((a == null ? void 0 : a.totalCost) ?? { amount: 1, precision: 0 }) : "0.00"
|
|
545
|
-
),
|
|
546
|
-
N(
|
|
547
|
-
oe.FmTooltip,
|
|
548
|
-
{
|
|
549
|
-
content: _.lastClosingDate ? `Last closing was already done at ${Je(_.lastClosingDate)} ${Lt(_.lastClosingDate)}. You may no longer change total cost of this purchase order.` : "You may only change the total cost if you have done a closing with recent costing feature.",
|
|
550
|
-
placement: "left",
|
|
551
|
-
zIndex: 50
|
|
552
|
-
},
|
|
553
|
-
[
|
|
554
|
-
N(oe.FmIcon, {
|
|
555
|
-
name: "info",
|
|
556
|
-
size: "sm",
|
|
557
|
-
color: "typo-secondary"
|
|
558
|
-
})
|
|
559
|
-
]
|
|
560
|
-
)
|
|
561
|
-
]
|
|
562
|
-
);
|
|
563
|
-
},
|
|
564
|
-
enableSorting: !1
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
id: "Delete",
|
|
568
|
-
header: "",
|
|
569
|
-
cell(e) {
|
|
570
|
-
return N(oe.FmButton, {
|
|
571
|
-
class: "delete-button",
|
|
572
|
-
type: "button",
|
|
573
|
-
icon: "delete",
|
|
574
|
-
variant: "tertiary",
|
|
575
|
-
size: "md",
|
|
576
|
-
onClick: () => {
|
|
577
|
-
Ae(Ht.Delete, e.row.original.sku._id);
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
},
|
|
581
|
-
enableSorting: !1,
|
|
582
|
-
size: 40,
|
|
583
|
-
meta: {
|
|
584
|
-
cellClass: "",
|
|
585
|
-
headerClass: ""
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
], re = P(
|
|
589
|
-
() => b.value ? Ce : Ce.filter((e) => e.id !== "Delete")
|
|
590
|
-
), Oe = P(() => o.value === D.PURCHASE && f.enableTotalCost ? re.value : re.value.filter((e) => e.id !== "Cost")), ve = Y();
|
|
591
|
-
te({
|
|
592
|
-
validateInputs: () => {
|
|
593
|
-
var e, t;
|
|
594
|
-
(t = (e = ve.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
|
|
595
|
-
},
|
|
596
|
-
resetInputsValidation: () => {
|
|
597
|
-
var e, t;
|
|
598
|
-
(t = (e = ve.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
|
|
599
|
-
},
|
|
600
|
-
resetInputs: () => {
|
|
601
|
-
var e, t;
|
|
602
|
-
(t = (e = ve.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
const _e = Y(!1);
|
|
606
|
-
he(_e, (e) => {
|
|
607
|
-
e && (Ie.value = !0, Qt().finally(() => {
|
|
608
|
-
Ie.value = !1;
|
|
609
|
-
}));
|
|
610
|
-
});
|
|
611
|
-
async function Qt() {
|
|
612
|
-
try {
|
|
613
|
-
const { startDate: e, endDate: t } = Aa(6), s = (await w.getPurchaseOrders({ start: e, end: t })).filter(
|
|
614
|
-
(d) => {
|
|
615
|
-
var r, v;
|
|
616
|
-
return d.status === na.enum.COMPLETE && ((r = d.supplier) == null ? void 0 : r.internal) !== "warehouse" && ((v = d.supplier) == null ? void 0 : v.internal) !== "restaurant";
|
|
617
|
-
}
|
|
618
|
-
).reduce((d, r) => {
|
|
619
|
-
const v = new Date(Ma(r._id)), C = r.supplier._id;
|
|
620
|
-
for (const R of r.items) {
|
|
621
|
-
if (!R.totalCost) continue;
|
|
622
|
-
const j = d[R.sku._id] ?? {}, Z = j[C] ?? [];
|
|
623
|
-
Z.push({
|
|
624
|
-
date: v.toISOString(),
|
|
625
|
-
totalUnit: R.quantity,
|
|
626
|
-
totalCost: R.totalCost,
|
|
627
|
-
unit: R.sku.unit,
|
|
628
|
-
measurement: R.measurement,
|
|
629
|
-
seqNumber: r.seqNumber
|
|
630
|
-
}), j[C] = Z, d[R.sku._id] = j;
|
|
631
|
-
}
|
|
632
|
-
return d;
|
|
633
|
-
}, {});
|
|
634
|
-
xe.value = s;
|
|
635
|
-
} catch {
|
|
636
|
-
be.open({
|
|
637
|
-
title: "Something went wrong",
|
|
638
|
-
message: "Cannot retrieve supplier purchase history. Please try again."
|
|
639
|
-
}), _e.value = !1;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
const Ie = Y(!1), xe = Y({});
|
|
643
|
-
function Ne(e) {
|
|
644
|
-
return e.column.columnDef.meta;
|
|
645
|
-
}
|
|
646
|
-
const I = P({
|
|
647
|
-
get() {
|
|
648
|
-
var e, t;
|
|
649
|
-
return (e = _.modelValue) != null && e.effectiveAt ? new Date((t = _.modelValue) == null ? void 0 : t.effectiveAt) : null;
|
|
650
|
-
},
|
|
651
|
-
set(e) {
|
|
652
|
-
m.value.effectiveAt = (e == null ? void 0 : e.toISOString()) ?? null;
|
|
653
|
-
}
|
|
654
|
-
}), tt = P({
|
|
655
|
-
get() {
|
|
656
|
-
return !!I.value;
|
|
657
|
-
},
|
|
658
|
-
set(e) {
|
|
659
|
-
e ? I.value = /* @__PURE__ */ new Date() : I.value = null;
|
|
660
|
-
}
|
|
661
|
-
}), at = P({
|
|
662
|
-
get() {
|
|
663
|
-
return I.value === null ? "" : Je(I.value);
|
|
664
|
-
},
|
|
665
|
-
set(e) {
|
|
666
|
-
e ? I.value = /* @__PURE__ */ new Date(`${e} ${st.value}`) : I.value = null;
|
|
667
|
-
}
|
|
668
|
-
}), st = P({
|
|
669
|
-
get() {
|
|
670
|
-
return I.value === null ? "" : Ua(I.value);
|
|
671
|
-
},
|
|
672
|
-
set(e) {
|
|
673
|
-
e ? I.value = /* @__PURE__ */ new Date(`${at.value} ${e}`) : I.value = null;
|
|
674
|
-
}
|
|
675
|
-
}), ut = P(() => {
|
|
676
|
-
var e;
|
|
677
|
-
return (e = x._currentLocation) == null ? void 0 : e.dbName.startsWith("restaurant");
|
|
678
|
-
});
|
|
679
|
-
return (e, t) => {
|
|
680
|
-
const a = k("FmChip"), n = k("FmSelect"), s = k("FmMenuItem"), d = k("FmTextField"), r = k("FmTextarea"), v = k("FmSwitch"), C = k("FmDatePicker"), R = k("FmTimePicker"), j = k("FmFormGroup"), Z = k("FmIcon"), ue = k("FmButton"), qe = k("FmCard"), He = k("FmStepperField"), Le = k("FmPopover"), ke = k("FmLabel"), Jt = k("FmSpacer"), Xt = k("FmTable"), ea = k("FmForm");
|
|
681
|
-
return g(), G(ea, {
|
|
682
|
-
ref_key: "formRef",
|
|
683
|
-
ref: ve,
|
|
684
|
-
onReset: t[14] || (t[14] = (ze) => o.value = u(D).PURCHASE),
|
|
685
|
-
onValidationSuccess: t[15] || (t[15] = (ze) => H("validation-success")),
|
|
686
|
-
disabled: U.value
|
|
687
|
-
}, {
|
|
688
|
-
default: A(() => {
|
|
689
|
-
var ze, it, ct, dt;
|
|
690
|
-
return [
|
|
691
|
-
l("div", Ja, [
|
|
692
|
-
l("div", Xa, [
|
|
693
|
-
es,
|
|
694
|
-
l("div", ts, [
|
|
695
|
-
i(a, {
|
|
696
|
-
label: u(x).currentLocation.name,
|
|
697
|
-
icon: "storefront",
|
|
698
|
-
compact: ""
|
|
699
|
-
}, null, 8, ["label"]),
|
|
700
|
-
(it = (ze = u(T).currentRestaurant) == null ? void 0 : ze.value) != null && it.posVersion ? (g(), G(a, {
|
|
701
|
-
key: 0,
|
|
702
|
-
label: `POS v${(dt = (ct = u(T).currentRestaurant) == null ? void 0 : ct.value) == null ? void 0 : dt.posVersion}`,
|
|
703
|
-
icon: "point_of_sale",
|
|
704
|
-
compact: ""
|
|
705
|
-
}, null, 8, ["label"])) : z("", !0),
|
|
706
|
-
e.lastClosingDate ? (g(), G(a, {
|
|
707
|
-
key: 1,
|
|
708
|
-
label: `Last closing: ${u(Je)(e.lastClosingDate)} ${u(Lt)(e.lastClosingDate)}`,
|
|
709
|
-
icon: "calendar_month",
|
|
710
|
-
compact: ""
|
|
711
|
-
}, null, 8, ["label"])) : z("", !0)
|
|
712
|
-
]),
|
|
713
|
-
as,
|
|
714
|
-
l("div", ss, [
|
|
715
|
-
i(n, {
|
|
716
|
-
items: E,
|
|
717
|
-
rules: [u(Qe)()],
|
|
718
|
-
"label-mark": "required",
|
|
719
|
-
label: "Transfer type",
|
|
720
|
-
"model-value": o.value,
|
|
721
|
-
"onUpdate:modelValue": t[0] || (t[0] = (p) => me(p)),
|
|
722
|
-
disabled: U.value || !b.value,
|
|
723
|
-
"data-cy": "fm-select-transaction-type"
|
|
724
|
-
}, null, 8, ["rules", "model-value", "disabled"]),
|
|
725
|
-
i(n, {
|
|
726
|
-
label: o.value === u(D).PURCHASE ? "Supplier" : "Transfer From",
|
|
727
|
-
items: y.value,
|
|
728
|
-
modelValue: S.value,
|
|
729
|
-
"onUpdate:modelValue": t[1] || (t[1] = (p) => S.value = p),
|
|
730
|
-
disabled: U.value || !b.value,
|
|
731
|
-
rules: [u(Qe)()],
|
|
732
|
-
"label-mark": "required"
|
|
733
|
-
}, {
|
|
734
|
-
"menu-wrapper": A(({ handleItemChange: p }) => [
|
|
735
|
-
(g(!0), F(Te, null, Xe(y.value, (h) => (g(), G(s, {
|
|
736
|
-
key: h.value,
|
|
737
|
-
"model-value": h.value === S.value,
|
|
738
|
-
disabled: h.disabled,
|
|
739
|
-
label: h.label,
|
|
740
|
-
"onUpdate:modelValue": (ie) => p(ie, h)
|
|
741
|
-
}, null, 8, ["model-value", "disabled", "label", "onUpdate:modelValue"]))), 128))
|
|
742
|
-
]),
|
|
743
|
-
_: 1
|
|
744
|
-
}, 8, ["label", "items", "modelValue", "disabled", "rules"]),
|
|
745
|
-
i(d, {
|
|
746
|
-
label: "Reference",
|
|
747
|
-
modelValue: m.value.ref,
|
|
748
|
-
"onUpdate:modelValue": t[2] || (t[2] = (p) => m.value.ref = p),
|
|
749
|
-
"label-mark": "optional",
|
|
750
|
-
disabled: U.value || !b.value
|
|
751
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
752
|
-
i(r, {
|
|
753
|
-
label: "Remark",
|
|
754
|
-
modelValue: B.value,
|
|
755
|
-
"onUpdate:modelValue": t[3] || (t[3] = (p) => B.value = p),
|
|
756
|
-
"label-mark": "optional",
|
|
757
|
-
"max-length": 240,
|
|
758
|
-
disabled: U.value || !b.value,
|
|
759
|
-
"show-word-count": ""
|
|
760
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
761
|
-
u(f).enableBackdatePo ? (g(), F("div", os, [
|
|
762
|
-
l("div", ls, [
|
|
763
|
-
i(v, {
|
|
764
|
-
modelValue: tt.value,
|
|
765
|
-
"onUpdate:modelValue": t[4] || (t[4] = (p) => tt.value = p),
|
|
766
|
-
label: "Backdate transfer",
|
|
767
|
-
sublabel: "Apply transfer to older date",
|
|
768
|
-
"label-placement": "right",
|
|
769
|
-
disabled: U.value || !b.value || ut.value && !e.lastClosingDate
|
|
770
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
771
|
-
ns,
|
|
772
|
-
tt.value ? (g(), F("div", rs, [
|
|
773
|
-
l("div", us, [
|
|
774
|
-
i(C, {
|
|
775
|
-
modelValue: at.value,
|
|
776
|
-
"onUpdate:modelValue": t[5] || (t[5] = (p) => at.value = p)
|
|
777
|
-
}, null, 8, ["modelValue"])
|
|
778
|
-
]),
|
|
779
|
-
l("div", is, [
|
|
780
|
-
i(R, {
|
|
781
|
-
modelValue: st.value,
|
|
782
|
-
"onUpdate:modelValue": t[6] || (t[6] = (p) => st.value = p)
|
|
783
|
-
}, null, 8, ["modelValue"])
|
|
784
|
-
])
|
|
785
|
-
])) : z("", !0)
|
|
786
|
-
]),
|
|
787
|
-
I.value ? (g(), G(j, {
|
|
788
|
-
key: 0,
|
|
789
|
-
modelValue: I.value,
|
|
790
|
-
"onUpdate:modelValue": t[7] || (t[7] = (p) => I.value = p),
|
|
791
|
-
rules: [u(Ta)(new Date(e.lastClosingDate), /* @__PURE__ */ new Date())]
|
|
792
|
-
}, null, 8, ["modelValue", "rules"])) : z("", !0),
|
|
793
|
-
ut.value && !e.lastClosingDate ? (g(), F("div", cs, [
|
|
794
|
-
i(Z, {
|
|
795
|
-
name: "error",
|
|
796
|
-
size: "sm",
|
|
797
|
-
class: "text-fm-color-typo-warning"
|
|
798
|
-
}),
|
|
799
|
-
ds
|
|
800
|
-
])) : z("", !0)
|
|
801
|
-
])) : z("", !0)
|
|
802
|
-
])
|
|
803
|
-
]),
|
|
804
|
-
l("div", ms, [
|
|
805
|
-
i(j, {
|
|
806
|
-
"model-value": m.value.items,
|
|
807
|
-
rules: [
|
|
808
|
-
function(h) {
|
|
809
|
-
return h && h.length > 0 || "Must have at least one item!";
|
|
810
|
-
}
|
|
811
|
-
]
|
|
812
|
-
}, {
|
|
813
|
-
default: A(() => {
|
|
814
|
-
var p;
|
|
815
|
-
return [
|
|
816
|
-
l("div", ps, [
|
|
817
|
-
fs,
|
|
818
|
-
o.value === u(D).PURCHASE && b.value && u(f).enableTotalCost ? (g(), F("div", vs, [
|
|
819
|
-
i(v, {
|
|
820
|
-
label: Ie.value ? "Fetching data..." : "Compare price history",
|
|
821
|
-
"prepend-icon": "compare_arrows",
|
|
822
|
-
"label-placement": "right",
|
|
823
|
-
"model-value": _e.value,
|
|
824
|
-
"onUpdate:modelValue": t[8] || (t[8] = (h) => _e.value = h),
|
|
825
|
-
disabled: Ie.value || !((p = m.value) != null && p.items) || m.value.items.length === 0
|
|
826
|
-
}, null, 8, ["label", "model-value", "disabled"])
|
|
827
|
-
])) : z("", !0)
|
|
828
|
-
])
|
|
829
|
-
];
|
|
830
|
-
}),
|
|
831
|
-
_: 1
|
|
832
|
-
}, 8, ["model-value", "rules"]),
|
|
833
|
-
l("div", _s, [
|
|
834
|
-
i(ue, {
|
|
835
|
-
disabled: U.value || !b.value,
|
|
836
|
-
label: "Add Item",
|
|
837
|
-
"prepend-icon": "add",
|
|
838
|
-
variant: "plain",
|
|
839
|
-
class: "border-2 rounded-lg border-fm-color-primary",
|
|
840
|
-
onClick: t[9] || (t[9] = (p) => Pe()),
|
|
841
|
-
size: "md"
|
|
842
|
-
}, null, 8, ["disabled"]),
|
|
843
|
-
i(Le, {
|
|
844
|
-
disabled: U.value || !b.value,
|
|
845
|
-
class: "flex",
|
|
846
|
-
"show-popover": ae.value,
|
|
847
|
-
onPopoverChanged: t[13] || (t[13] = (p) => ae.value = p)
|
|
848
|
-
}, {
|
|
849
|
-
"popover-button": A(() => [
|
|
850
|
-
i(qe, {
|
|
851
|
-
class: Be([
|
|
852
|
-
"flex justify-center items-center gap-[8px] border-2 py-1 px-12 rounded-lg cursor-not-allowed",
|
|
853
|
-
U.value || !b.value ? " border-fm-color-neutral-gray-200" : "border-fm-color-primary"
|
|
854
|
-
]),
|
|
855
|
-
variant: "flat"
|
|
856
|
-
}, {
|
|
857
|
-
default: A(() => [
|
|
858
|
-
i(Ya, {
|
|
859
|
-
size: 24,
|
|
860
|
-
color: U.value || !b.value ? "#c7c7cc" : "#ff7823"
|
|
861
|
-
}, null, 8, ["color"]),
|
|
862
|
-
l("button", {
|
|
863
|
-
type: "button",
|
|
864
|
-
disabled: U.value,
|
|
865
|
-
class: Be([
|
|
866
|
-
"fm-typo-cn-body-lg-600",
|
|
867
|
-
U.value || !b.value ? " text-fm-color-neutral-gray-200 cursor-not-allowed" : "text-fm-color-primary"
|
|
868
|
-
])
|
|
869
|
-
}, " Forecast stock ", 10, ys)
|
|
870
|
-
]),
|
|
871
|
-
_: 1
|
|
872
|
-
}, 8, ["class"])
|
|
873
|
-
]),
|
|
874
|
-
default: A(() => [
|
|
875
|
-
l("div", gs, [
|
|
876
|
-
l("div", hs, [
|
|
877
|
-
i(ga, { "z-index": 99 }, {
|
|
878
|
-
default: A(() => [
|
|
879
|
-
bs
|
|
880
|
-
]),
|
|
881
|
-
_: 1
|
|
882
|
-
}),
|
|
883
|
-
i(ue, {
|
|
884
|
-
icon: "close",
|
|
885
|
-
size: "md",
|
|
886
|
-
variant: "tertiary",
|
|
887
|
-
onClick: t[10] || (t[10] = (p) => ae.value = !1)
|
|
888
|
-
})
|
|
889
|
-
]),
|
|
890
|
-
i(He, {
|
|
891
|
-
modelValue: ne.value,
|
|
892
|
-
"onUpdate:modelValue": t[11] || (t[11] = (p) => ne.value = p),
|
|
893
|
-
label: "Enter day to forecast stock",
|
|
894
|
-
rules: [u(Va)(1)]
|
|
895
|
-
}, {
|
|
896
|
-
"helper-text": A(() => [
|
|
897
|
-
l("div", Cs, [
|
|
898
|
-
i(Z, {
|
|
899
|
-
name: "warning",
|
|
900
|
-
size: "sm",
|
|
901
|
-
class: "text-fm-color-system-warning-300"
|
|
902
|
-
}),
|
|
903
|
-
xs
|
|
904
|
-
])
|
|
905
|
-
]),
|
|
906
|
-
_: 1
|
|
907
|
-
}, 8, ["modelValue", "rules"]),
|
|
908
|
-
l("div", ks, [
|
|
909
|
-
ws,
|
|
910
|
-
i(ue, {
|
|
911
|
-
label: "Cancel",
|
|
912
|
-
variant: "tertiary",
|
|
913
|
-
onClick: t[12] || (t[12] = (p) => ae.value = !1)
|
|
914
|
-
}),
|
|
915
|
-
i(ue, {
|
|
916
|
-
label: "Generate",
|
|
917
|
-
onClick: Re
|
|
918
|
-
})
|
|
919
|
-
])
|
|
920
|
-
])
|
|
921
|
-
]),
|
|
922
|
-
_: 1
|
|
923
|
-
}, 8, ["disabled", "show-popover"])
|
|
924
|
-
]),
|
|
925
|
-
le.value.length ? (g(), F("div", Ss, [
|
|
926
|
-
(g(), G(Xt, {
|
|
927
|
-
"row-data": le.value,
|
|
928
|
-
"column-defs": Oe.value,
|
|
929
|
-
key: o.value,
|
|
930
|
-
"data-cy": "fm-table-transfer-items",
|
|
931
|
-
"hide-footer": "",
|
|
932
|
-
"page-size": le.value.length
|
|
933
|
-
}, {
|
|
934
|
-
"table-row": A((p) => {
|
|
935
|
-
var h, ie;
|
|
936
|
-
return [
|
|
937
|
-
l("tr", {
|
|
938
|
-
class: Be(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
|
|
939
|
-
"bg-fm-color-neutral-gray-100": p.getIsSelected()
|
|
940
|
-
}])
|
|
941
|
-
}, [
|
|
942
|
-
(g(!0), F(Te, null, Xe(p.getVisibleCells(), (Q) => {
|
|
943
|
-
var we, ce, Se, De;
|
|
944
|
-
return g(), F("td", {
|
|
945
|
-
key: Q.id,
|
|
946
|
-
class: Be([
|
|
947
|
-
"h-[52px] px-16 text-fm-color-typo-primary",
|
|
948
|
-
((we = Ne(Q)) == null ? void 0 : we.cellClass) ?? "px-16"
|
|
949
|
-
]),
|
|
950
|
-
style: jt({
|
|
951
|
-
width: (ce = Ne(Q)) == null ? void 0 : ce.width,
|
|
952
|
-
maxWidth: (Se = Ne(Q)) == null ? void 0 : Se.maxWidth,
|
|
953
|
-
textAlign: ((De = Ne(Q)) == null ? void 0 : De.textAlign) ?? "left"
|
|
954
|
-
})
|
|
955
|
-
}, [
|
|
956
|
-
l("span", Ds, [
|
|
957
|
-
i(u(X), {
|
|
958
|
-
render: Q.column.columnDef.cell,
|
|
959
|
-
props: Q.getContext()
|
|
960
|
-
}, null, 8, ["render", "props"])
|
|
961
|
-
])
|
|
962
|
-
], 6);
|
|
963
|
-
}), 128))
|
|
964
|
-
], 2),
|
|
965
|
-
o.value === u(D).PURCHASE && _e.value && Object.keys(xe.value[(h = p.original.sku) == null ? void 0 : h._id] ?? {}).length > 0 ? (g(), F("tr", Fs, [
|
|
966
|
-
l("td", {
|
|
967
|
-
colspan: p.getVisibleCells().length
|
|
968
|
-
}, [
|
|
969
|
-
i(zt, {
|
|
970
|
-
prices: xe.value[(ie = p.original.sku) == null ? void 0 : ie._id]
|
|
971
|
-
}, null, 8, ["prices"])
|
|
972
|
-
], 8, Ts)
|
|
973
|
-
])) : z("", !0)
|
|
974
|
-
];
|
|
975
|
-
}),
|
|
976
|
-
"list-row": A((p) => [
|
|
977
|
-
i(Bt, { row: p }, {
|
|
978
|
-
default: A((h) => {
|
|
979
|
-
var ie, Q, we, ce, Se, De, mt, pt, Ye, ft, vt, _t, yt, je, gt, ht, bt, Ct, Ke, xt, kt, wt, St, Dt, Ft, Ge, Tt, Vt, Rt, Pt, At, We, Ut, $t, Et;
|
|
980
|
-
return [
|
|
981
|
-
l("div", Vs, [
|
|
982
|
-
l("div", Rs, [
|
|
983
|
-
l("div", Ps, J(p.original.sku.name), 1),
|
|
984
|
-
l("div", null, [
|
|
985
|
-
i(u(X), {
|
|
986
|
-
render: (we = (Q = (ie = h.Delete) == null ? void 0 : ie.column) == null ? void 0 : Q.columnDef) == null ? void 0 : we.cell,
|
|
987
|
-
props: (Se = (ce = h.Delete) == null ? void 0 : ce.getContext) == null ? void 0 : Se.call(ce)
|
|
988
|
-
}, null, 8, ["render", "props"])
|
|
989
|
-
])
|
|
990
|
-
]),
|
|
991
|
-
l("div", As, [
|
|
992
|
-
l("div", Us, [
|
|
993
|
-
i(ke, { label: "Code" }),
|
|
994
|
-
i(u(X), {
|
|
995
|
-
render: (pt = (mt = (De = h.code) == null ? void 0 : De.column) == null ? void 0 : mt.columnDef) == null ? void 0 : pt.cell,
|
|
996
|
-
props: (ft = (Ye = h.code) == null ? void 0 : Ye.getContext) == null ? void 0 : ft.call(Ye)
|
|
997
|
-
}, null, 8, ["render", "props"])
|
|
998
|
-
]),
|
|
999
|
-
l("div", $s, [
|
|
1000
|
-
i(ke, { label: "Name" }),
|
|
1001
|
-
i(u(X), {
|
|
1002
|
-
render: (yt = (_t = (vt = h.Name) == null ? void 0 : vt.column) == null ? void 0 : _t.columnDef) == null ? void 0 : yt.cell,
|
|
1003
|
-
props: (gt = (je = h.Name) == null ? void 0 : je.getContext) == null ? void 0 : gt.call(je)
|
|
1004
|
-
}, null, 8, ["render", "props"])
|
|
1005
|
-
]),
|
|
1006
|
-
l("div", Es, [
|
|
1007
|
-
l("div", Ms, [
|
|
1008
|
-
i(ke, { label: "Amount" })
|
|
1009
|
-
]),
|
|
1010
|
-
i(u(X), {
|
|
1011
|
-
render: (Ct = (bt = (ht = h.Amount) == null ? void 0 : ht.column) == null ? void 0 : bt.columnDef) == null ? void 0 : Ct.cell,
|
|
1012
|
-
props: (xt = (Ke = h.Amount) == null ? void 0 : Ke.getContext) == null ? void 0 : xt.call(Ke)
|
|
1013
|
-
}, null, 8, ["render", "props"])
|
|
1014
|
-
]),
|
|
1015
|
-
o.value === u(D).PURCHASE && h.Cost ? (g(), F("div", Os, [
|
|
1016
|
-
typeof ((St = (wt = (kt = h.Cost) == null ? void 0 : kt.column) == null ? void 0 : wt.columnDef) == null ? void 0 : St.header) == "function" ? (g(), F("div", Is, [
|
|
1017
|
-
(g(), G(sa(
|
|
1018
|
-
(Vt = (Ft = (Dt = h.Cost) == null ? void 0 : Dt.column) == null ? void 0 : Ft.columnDef) == null ? void 0 : Vt.header(
|
|
1019
|
-
(Tt = (Ge = h.Cost) == null ? void 0 : Ge.getContext) == null ? void 0 : Tt.call(Ge)
|
|
1020
|
-
)
|
|
1021
|
-
)))
|
|
1022
|
-
])) : z("", !0),
|
|
1023
|
-
i(u(X), {
|
|
1024
|
-
render: (At = (Pt = (Rt = h.Cost) == null ? void 0 : Rt.column) == null ? void 0 : Pt.columnDef) == null ? void 0 : At.cell,
|
|
1025
|
-
props: (Ut = (We = h.Cost) == null ? void 0 : We.getContext) == null ? void 0 : Ut.call(We)
|
|
1026
|
-
}, null, 8, ["render", "props"])
|
|
1027
|
-
])) : z("", !0)
|
|
1028
|
-
]),
|
|
1029
|
-
o.value === u(D).PURCHASE && _e.value && Object.keys(xe.value[($t = p.original.sku) == null ? void 0 : $t._id] ?? {}).length > 0 ? (g(), F(Te, { key: 0 }, [
|
|
1030
|
-
i(Jt, { class: "h-8" }),
|
|
1031
|
-
i(zt, {
|
|
1032
|
-
prices: xe.value[(Et = p.original.sku) == null ? void 0 : Et._id]
|
|
1033
|
-
}, null, 8, ["prices"])
|
|
1034
|
-
], 64)) : z("", !0)
|
|
1035
|
-
])
|
|
1036
|
-
];
|
|
1037
|
-
}),
|
|
1038
|
-
_: 2
|
|
1039
|
-
}, 1032, ["row"])
|
|
1040
|
-
]),
|
|
1041
|
-
_: 1
|
|
1042
|
-
}, 8, ["row-data", "column-defs", "page-size"]))
|
|
1043
|
-
])) : z("", !0)
|
|
1044
|
-
])
|
|
1045
|
-
])
|
|
1046
|
-
];
|
|
1047
|
-
}),
|
|
1048
|
-
_: 1
|
|
1049
|
-
}, 8, ["disabled"]);
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
|
-
}), qs = { class: "flex items-center" }, Hs = { class: "fm-typo-en-title-md-800" }, Ls = { class: "flex gap-4" }, zs = /* @__PURE__ */ Ve({
|
|
1053
|
-
__name: "TransferDialog",
|
|
1054
|
-
props: {
|
|
1055
|
-
mode: {},
|
|
1056
|
-
modelValue: {},
|
|
1057
|
-
show: { type: Boolean },
|
|
1058
|
-
lastClosingDate: {}
|
|
1059
|
-
},
|
|
1060
|
-
emits: ["update:show", "submitted"],
|
|
1061
|
-
setup(W, { expose: te, emit: ee }) {
|
|
1062
|
-
const x = W, M = ee, T = Gt(), w = rt(), f = Zt(), O = ra(), _ = nt();
|
|
1063
|
-
async function de(o) {
|
|
1064
|
-
if (o) {
|
|
1065
|
-
H.value = !0;
|
|
1066
|
-
try {
|
|
1067
|
-
await f.readSuppliers(), H.value = !1;
|
|
1068
|
-
} catch {
|
|
1069
|
-
w.open({
|
|
1070
|
-
title: "Unable to fetch list of suppliers",
|
|
1071
|
-
message: "Try to refresh page to retry operation",
|
|
1072
|
-
type: "error"
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
_.watchLocation(de);
|
|
1078
|
-
const b = ka(x, "show"), q = Y(x.modelValue ?? {});
|
|
1079
|
-
he([() => x.modelValue], () => {
|
|
1080
|
-
q.value = x.modelValue ?? {};
|
|
1081
|
-
});
|
|
1082
|
-
const H = Y(!1), m = P(() => {
|
|
1083
|
-
switch (x.mode) {
|
|
1084
|
-
case Fe.CREATE:
|
|
1085
|
-
return "Add transfer";
|
|
1086
|
-
case Fe.READ:
|
|
1087
|
-
return "View transfer";
|
|
1088
|
-
case Fe.UPDATE:
|
|
1089
|
-
return "Edit transfer";
|
|
1090
|
-
}
|
|
1091
|
-
return "";
|
|
1092
|
-
}), B = Y();
|
|
1093
|
-
te({
|
|
1094
|
-
validateInputs: () => {
|
|
1095
|
-
var o, c;
|
|
1096
|
-
(c = (o = B.value) == null ? void 0 : o.validateInputs) == null || c.call(o);
|
|
1097
|
-
},
|
|
1098
|
-
resetInputsValidation: () => {
|
|
1099
|
-
var o, c;
|
|
1100
|
-
(c = (o = B.value) == null ? void 0 : o.resetInputsValidation) == null || c.call(o);
|
|
1101
|
-
},
|
|
1102
|
-
resetInputs: () => {
|
|
1103
|
-
var o, c;
|
|
1104
|
-
(c = (o = B.value) == null ? void 0 : o.resetInputs) == null || c.call(o);
|
|
1105
|
-
}
|
|
1106
|
-
});
|
|
1107
|
-
async function U() {
|
|
1108
|
-
const o = q.value;
|
|
1109
|
-
H.value = !0, (o.supplier.internal === "warehouse" || o.supplier.internal === "restaurant") && (o.items = o.items.map(({ totalCost: c, ...y }) => y));
|
|
1110
|
-
try {
|
|
1111
|
-
await T.createPurchaseOrder(o), await new Promise((c) => setTimeout(c, 1e3)), w.open({
|
|
1112
|
-
title: "Created",
|
|
1113
|
-
message: "Your transfer draft has been created!",
|
|
1114
|
-
type: "success"
|
|
1115
|
-
}), M("update:show", !1), M("submitted");
|
|
1116
|
-
} catch (c) {
|
|
1117
|
-
w.open({
|
|
1118
|
-
title: "Cannot create purchase order",
|
|
1119
|
-
message: "Report to system administrator for troubleshooting.",
|
|
1120
|
-
type: "error"
|
|
1121
|
-
}), console.error("Error in creating purchase order", c);
|
|
1122
|
-
} finally {
|
|
1123
|
-
H.value = !1;
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
async function le() {
|
|
1127
|
-
const o = q.value;
|
|
1128
|
-
H.value = !0, (o.supplier.internal === "warehouse" || o.supplier.internal === "restaurant") && (o.items = o.items.map(({ totalCost: c, ...y }) => y));
|
|
1129
|
-
try {
|
|
1130
|
-
await T.updatePurchaseOrder(o), await new Promise((c) => setTimeout(c, 1e3)), w.open({
|
|
1131
|
-
title: "Updated",
|
|
1132
|
-
message: "Your transfer draft has been updated!",
|
|
1133
|
-
type: "success"
|
|
1134
|
-
}), M("update:show", !1), M("submitted");
|
|
1135
|
-
} catch (c) {
|
|
1136
|
-
w.open({
|
|
1137
|
-
title: "Cannot update purchase order",
|
|
1138
|
-
message: "Report to system administrator for troubleshooting.",
|
|
1139
|
-
type: "error"
|
|
1140
|
-
}), console.error("Error in updating purchase order", c);
|
|
1141
|
-
} finally {
|
|
1142
|
-
H.value = !1;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
function V() {
|
|
1146
|
-
switch (x.mode) {
|
|
1147
|
-
case Fe.CREATE:
|
|
1148
|
-
return U();
|
|
1149
|
-
case Fe.UPDATE:
|
|
1150
|
-
return le();
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
function E() {
|
|
1154
|
-
var o, c;
|
|
1155
|
-
(c = (o = B.value) == null ? void 0 : o.validateInputs) == null || c.call(o);
|
|
1156
|
-
}
|
|
1157
|
-
return (o, c) => {
|
|
1158
|
-
const y = k("FmButton"), S = k("FmSideSheet");
|
|
1159
|
-
return g(), G(S, {
|
|
1160
|
-
modelValue: u(b),
|
|
1161
|
-
"onUpdate:modelValue": c[2] || (c[2] = ($) => oa(b) ? b.value = $ : null),
|
|
1162
|
-
"dismiss-away": "",
|
|
1163
|
-
"close-button": "",
|
|
1164
|
-
"max-width": 900
|
|
1165
|
-
}, {
|
|
1166
|
-
"side-sheet-header": A(() => [
|
|
1167
|
-
l("div", qs, [
|
|
1168
|
-
l("div", Hs, J(m.value), 1)
|
|
1169
|
-
])
|
|
1170
|
-
]),
|
|
1171
|
-
default: A(() => [
|
|
1172
|
-
(g(), G(Ns, {
|
|
1173
|
-
class: "w-full",
|
|
1174
|
-
ref_key: "formRef",
|
|
1175
|
-
ref: B,
|
|
1176
|
-
onValidationSuccess: V,
|
|
1177
|
-
modelValue: q.value,
|
|
1178
|
-
"onUpdate:modelValue": c[0] || (c[0] = ($) => q.value = $),
|
|
1179
|
-
disabled: H.value,
|
|
1180
|
-
suppliers: u(f).suppliers,
|
|
1181
|
-
skus: u(O).skus,
|
|
1182
|
-
key: q.value._id ?? "",
|
|
1183
|
-
"last-closing-date": o.lastClosingDate
|
|
1184
|
-
}, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
|
|
1185
|
-
]),
|
|
1186
|
-
"side-sheet-footer": A(() => [
|
|
1187
|
-
l("div", Ls, [
|
|
1188
|
-
i(y, {
|
|
1189
|
-
loading: H.value,
|
|
1190
|
-
label: "Save",
|
|
1191
|
-
onClick: E
|
|
1192
|
-
}, null, 8, ["loading"]),
|
|
1193
|
-
i(y, {
|
|
1194
|
-
disabled: H.value,
|
|
1195
|
-
variant: "tertiary",
|
|
1196
|
-
label: "Close",
|
|
1197
|
-
onClick: c[1] || (c[1] = ($) => M("update:show", !1))
|
|
1198
|
-
}, null, 8, ["disabled"])
|
|
1199
|
-
])
|
|
1200
|
-
]),
|
|
1201
|
-
_: 1
|
|
1202
|
-
}, 8, ["modelValue"]);
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
}), Ys = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, js = { class: "flex flex-col py-8" }, Ks = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Ws = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1" }, Bs = {
|
|
1206
|
-
key: 0,
|
|
1207
|
-
class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
|
|
1208
|
-
}, Zs = { class: "pt-8" }, Yt = "ReceiveRequestViewSearchCriteria", yo = /* @__PURE__ */ Ve({
|
|
1209
|
-
__name: "ReceiveRequestView",
|
|
1210
|
-
setup(W) {
|
|
1211
|
-
const te = rt();
|
|
1212
|
-
Ze.object({
|
|
1213
|
-
name: Ze.string().optional().nullable(),
|
|
1214
|
-
startDate: Ze.string().optional().nullable(),
|
|
1215
|
-
endDate: Ze.string().optional().nullable()
|
|
1216
|
-
});
|
|
1217
|
-
const ee = ua(), x = Kt();
|
|
1218
|
-
function M() {
|
|
1219
|
-
const V = {
|
|
1220
|
-
name: "",
|
|
1221
|
-
...Nt()
|
|
1222
|
-
}, E = ee.getItem(Yt);
|
|
1223
|
-
if (!E)
|
|
1224
|
-
return V;
|
|
1225
|
-
try {
|
|
1226
|
-
return JSON.parse(E);
|
|
1227
|
-
} catch {
|
|
1228
|
-
return V;
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
function T() {
|
|
1232
|
-
ee.setItem(Yt, JSON.stringify(w.value));
|
|
1233
|
-
}
|
|
1234
|
-
const w = Y(M()), f = ma("receive/request", w.value), { columnDefs: O } = pa("receive/request", f), _ = nt();
|
|
1235
|
-
async function de() {
|
|
1236
|
-
const V = `inventory-record_${qt(w.value.startDate).format("DD-MM-YYYY_HH-mm")}-${qt(w.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`, E = f.purchaseOrders.value.flatMap(
|
|
1237
|
-
(c) => c.items.map((y) => {
|
|
1238
|
-
const S = new Date(ba(c._id) ?? ""), $ = c.effectiveAt ? new Date(c.effectiveAt) : void 0, L = K(
|
|
1239
|
-
va(y.sku, c.deliveryOrder || [])
|
|
1240
|
-
), me = K(y.quantity);
|
|
1241
|
-
return {
|
|
1242
|
-
"SKU code": y.code,
|
|
1243
|
-
"SKU name": y.name,
|
|
1244
|
-
"PO #": c.seqNumber,
|
|
1245
|
-
"Effective at": $,
|
|
1246
|
-
Date: S,
|
|
1247
|
-
Status: c.status,
|
|
1248
|
-
Reference: c.ref ?? "",
|
|
1249
|
-
"Received quantity": L,
|
|
1250
|
-
"Ordered quantity": me,
|
|
1251
|
-
Unit: y.sku.unit.abbrev,
|
|
1252
|
-
"Total cost": y.totalCost ? Wt(y.totalCost) : null
|
|
1253
|
-
};
|
|
1254
|
-
})
|
|
1255
|
-
), o = [
|
|
1256
|
-
"SKU code",
|
|
1257
|
-
"SKU name",
|
|
1258
|
-
"PO #",
|
|
1259
|
-
"Date",
|
|
1260
|
-
"Status",
|
|
1261
|
-
"Reference",
|
|
1262
|
-
"Received quantity",
|
|
1263
|
-
"Ordered quantity",
|
|
1264
|
-
"Unit"
|
|
1265
|
-
];
|
|
1266
|
-
x.enableBackdatePo && o.insert("Effective at", 4), x.enableTotalCost && o.push("Total cost"), await Ca(
|
|
1267
|
-
[
|
|
1268
|
-
{
|
|
1269
|
-
name: "purchases",
|
|
1270
|
-
data: E,
|
|
1271
|
-
columns: o
|
|
1272
|
-
}
|
|
1273
|
-
],
|
|
1274
|
-
V
|
|
1275
|
-
), te.open({
|
|
1276
|
-
title: "Success",
|
|
1277
|
-
message: `Exported ${V}`,
|
|
1278
|
-
type: "success"
|
|
1279
|
-
});
|
|
1280
|
-
}
|
|
1281
|
-
const b = Y(Nt()), q = Y("");
|
|
1282
|
-
he([() => b.value], ([V]) => {
|
|
1283
|
-
!V.startDate || !V.endDate || (w.value.startDate = V.startDate, w.value.endDate = V.endDate, f.updateDateRange(
|
|
1284
|
-
w.value.startDate,
|
|
1285
|
-
w.value.endDate
|
|
1286
|
-
), T());
|
|
1287
|
-
}), he([() => q.value], () => {
|
|
1288
|
-
T();
|
|
1289
|
-
});
|
|
1290
|
-
function H(V) {
|
|
1291
|
-
V === "create" && f.promptCreateTransferDialog();
|
|
1292
|
-
}
|
|
1293
|
-
const { breakpoints: m } = wa(), B = P(() => m.value.xs || m.value.sm ? 10 : 20), U = Fa(), le = P(() => [
|
|
1294
|
-
{
|
|
1295
|
-
icon: "refresh",
|
|
1296
|
-
onClick: f.fetchData
|
|
1297
|
-
},
|
|
1298
|
-
{
|
|
1299
|
-
icon: "ios_share",
|
|
1300
|
-
onClick: de
|
|
1301
|
-
}
|
|
1302
|
-
]);
|
|
1303
|
-
return (V, E) => {
|
|
1304
|
-
const o = k("FmTable");
|
|
1305
|
-
return g(), G(ia, {
|
|
1306
|
-
title: "Receive and Request",
|
|
1307
|
-
actions: [{ label: "Create transfer", value: "create", isPrimary: !0, prependIcon: "add" }],
|
|
1308
|
-
"onClick:action": H
|
|
1309
|
-
}, {
|
|
1310
|
-
default: A(() => {
|
|
1311
|
-
var c;
|
|
1312
|
-
return [
|
|
1313
|
-
l("div", Ys, [
|
|
1314
|
-
i(ca, {
|
|
1315
|
-
"date-range-query": "",
|
|
1316
|
-
"date-range": b.value,
|
|
1317
|
-
"onUpdate:dateRange": E[0] || (E[0] = (y) => b.value = y),
|
|
1318
|
-
searchable: "",
|
|
1319
|
-
"change-location": "",
|
|
1320
|
-
search: q.value,
|
|
1321
|
-
"onUpdate:search": E[1] || (E[1] = (y) => q.value = y),
|
|
1322
|
-
actions: le.value
|
|
1323
|
-
}, null, 8, ["date-range", "search", "actions"]),
|
|
1324
|
-
(g(), G(o, {
|
|
1325
|
-
style: jt(u(U).tableHeight),
|
|
1326
|
-
"column-defs": u(O),
|
|
1327
|
-
"row-data": u(f).purchaseOrders.value,
|
|
1328
|
-
"search-value": q.value,
|
|
1329
|
-
loading: !u(_)._currentLocation || u(f).loading.value,
|
|
1330
|
-
onRowClick: E[2] || (E[2] = (y) => u(f).promptShowTransferDetails(y.original)),
|
|
1331
|
-
key: (c = u(_)._currentLocation) == null ? void 0 : c.dbName,
|
|
1332
|
-
"page-size": B.value
|
|
1333
|
-
}, {
|
|
1334
|
-
"list-row": A((y) => [
|
|
1335
|
-
i(Bt, {
|
|
1336
|
-
row: y,
|
|
1337
|
-
onRowClick: u(f).promptShowTransferDetails
|
|
1338
|
-
}, {
|
|
1339
|
-
default: A((S) => {
|
|
1340
|
-
var $, L, me, pe, ne, ae, be, Re, se, Pe, Ae, Ue, $e, fe, Ee, Me, et, Ce, re, Oe;
|
|
1341
|
-
return [
|
|
1342
|
-
l("div", js, [
|
|
1343
|
-
l("div", Ks, [
|
|
1344
|
-
i(u(X), {
|
|
1345
|
-
render: (me = (L = ($ = S._id) == null ? void 0 : $.column) == null ? void 0 : L.columnDef) == null ? void 0 : me.cell,
|
|
1346
|
-
props: (ne = (pe = S._id) == null ? void 0 : pe.getContext) == null ? void 0 : ne.call(pe)
|
|
1347
|
-
}, null, 8, ["render", "props"])
|
|
1348
|
-
]),
|
|
1349
|
-
l("div", Gs, [
|
|
1350
|
-
i(u(X), {
|
|
1351
|
-
render: (Re = (be = (ae = S.supplier_name) == null ? void 0 : ae.column) == null ? void 0 : be.columnDef) == null ? void 0 : Re.cell,
|
|
1352
|
-
props: (Pe = (se = S.supplier_name) == null ? void 0 : se.getContext) == null ? void 0 : Pe.call(se)
|
|
1353
|
-
}, null, 8, ["render", "props"])
|
|
1354
|
-
]),
|
|
1355
|
-
l("div", Ws, J(y.original.items.map((ve) => `${ve.name}`).join(", ")), 1),
|
|
1356
|
-
y.original.ref ? (g(), F("div", Bs, [
|
|
1357
|
-
i(u(X), {
|
|
1358
|
-
render: ($e = (Ue = (Ae = S.ref) == null ? void 0 : Ae.column) == null ? void 0 : Ue.columnDef) == null ? void 0 : $e.cell,
|
|
1359
|
-
props: (Ee = (fe = S.ref) == null ? void 0 : fe.getContext) == null ? void 0 : Ee.call(fe)
|
|
1360
|
-
}, null, 8, ["render", "props"])
|
|
1361
|
-
])) : z("", !0),
|
|
1362
|
-
l("div", Zs, [
|
|
1363
|
-
i(u(X), {
|
|
1364
|
-
render: (Ce = (et = (Me = S.status) == null ? void 0 : Me.column) == null ? void 0 : et.columnDef) == null ? void 0 : Ce.cell,
|
|
1365
|
-
props: (Oe = (re = S.status) == null ? void 0 : re.getContext) == null ? void 0 : Oe.call(re)
|
|
1366
|
-
}, null, 8, ["render", "props"])
|
|
1367
|
-
])
|
|
1368
|
-
])
|
|
1369
|
-
];
|
|
1370
|
-
}),
|
|
1371
|
-
_: 2
|
|
1372
|
-
}, 1032, ["row", "onRowClick"])
|
|
1373
|
-
]),
|
|
1374
|
-
_: 1
|
|
1375
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1376
|
-
]),
|
|
1377
|
-
(g(), G(la, { to: "body" }, [
|
|
1378
|
-
i(zs, It(u(f).transferDialogProps.value, {
|
|
1379
|
-
onSubmitted: u(f).fetchData
|
|
1380
|
-
}), null, 16, ["onSubmitted"]),
|
|
1381
|
-
i(fa, It(u(f).transferDetailsProps.value, {
|
|
1382
|
-
onSubmitted: u(f).fetchData
|
|
1383
|
-
}), null, 16, ["onSubmitted"])
|
|
1384
|
-
]))
|
|
1385
|
-
];
|
|
1386
|
-
}),
|
|
1387
|
-
_: 1
|
|
1388
|
-
});
|
|
1389
|
-
};
|
|
1390
|
-
}
|
|
1391
|
-
});
|
|
1392
|
-
export {
|
|
1393
|
-
yo as default
|
|
1394
|
-
};
|