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