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