@feedmepos/mf-inventory-portal 0.0.17-dev.1 → 0.0.17-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ApprovalView-NJ4FogNu.js → ApprovalView-C72rFK1R.js} +9 -9
- package/dist/{BindingsDialog-B-j1k1SE.js → BindingsDialog-gL9pxfYy.js} +5 -5
- package/dist/{BindingsPicker-CEi3jyh0.js → BindingsPicker-5mFctYt_.js} +6 -6
- package/dist/{BindingsTable-DHYJ2Eqm.js → BindingsTable-C6x9dxpe.js} +26 -26
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-1XPAzm5R.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CYZ5Ecsh.js} +1 -1
- package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-DL98UqsQ.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-blApBVkg.js} +9 -9
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-Db_M7Cx1.js +236 -0
- package/dist/IngredientsView-P0zlf89O.js +1771 -0
- package/dist/{IntegrationView-DxqyRxVR.js → IntegrationView-C1SXz981.js} +4 -4
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang--KLpvU2e.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BfBvA1g5.js} +6 -6
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-HpuL5QhV.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CSuO9X2f.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-BGbCA7Al.js → PurchaseOrderPrintPreview-DGZafWSJ.js} +4 -4
- package/dist/ReceiveRequestView-C8yrU5NY.js +1435 -0
- package/dist/RecipeView-DJy1k_j1.js +581 -0
- package/dist/SingleColumnLayout.vue_vue_type_script_setup_true_lang-Dov3Uq2z.js +64 -0
- package/dist/{StockView-Pyk4MBIQ.js → StockView-CEmw7w_F.js} +13 -13
- package/dist/SupplierView-D0y-ASGR.js +804 -0
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Ctqjw3f1.js → TransferDetails.vue_vue_type_script_setup_true_lang-DzK7B6nw.js} +5 -5
- package/dist/{UnitView-DVauPXKw.js → UnitView-PnHtBAGc.js} +7 -7
- package/dist/{WarehouseView-BYivsQgQ.js → WarehouseView-DXhn95Vl.js} +4 -4
- package/dist/api/inventory.d.ts +105 -0
- package/dist/{app-DXqS7qYg.js → app-CjkBFVBh.js} +2693 -2664
- package/dist/app.js +1 -1
- package/dist/components/FmDroppableField.vue.d.ts +75 -0
- package/dist/components/FmUnitInputProps.d.ts +1 -0
- package/dist/components/FmUnitInputRules.d.ts +3 -1
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -0
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -0
- package/dist/{date2-B96h4mWb.js → date2-D-5KX0_X.js} +55 -46
- package/dist/{dayjs.min-CQkpEWlm.js → dayjs.min-BKYgFjeY.js} +526 -514
- package/dist/{decimal-DQOX97fs.js → decimal-CNnMmnJA.js} +1 -1
- package/dist/{fuzzy-Dr-kBYFA.js → fuzzy-BPDipSKr.js} +1 -1
- package/dist/helper/number.d.ts +8 -0
- package/dist/helper/random.d.ts +2 -0
- package/dist/helper/xlsx.util.d.ts +1 -0
- package/dist/{init-date-range-6CJBD0GL.js → init-date-range-58-0kupV.js} +1 -1
- package/dist/{layout-CVjYEZxq.js → layout-D2Kwl_3f.js} +12 -12
- package/dist/{rules-B_-yQn9M.js → rules-D0MrF_UU.js} +1 -1
- package/dist/{stock-estimate-DoU-A7bG.js → stock-estimate-CwklebfL.js} +2 -2
- package/dist/stores/inventory.d.ts +5 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-D2Wuv0oV.js → supplier-D4woY4Fa.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-Bc0Yx1fK.js → use-inventory-binding-dialog-C6CEI0CS.js} +2 -2
- package/dist/views/ingredients/components/import-ingredients/ImportIngredientItem.vue.d.ts +12 -0
- package/dist/views/ingredients/components/import-ingredients/ImportIngredientItemProps.d.ts +6 -0
- package/dist/views/ingredients/components/import-ingredients/ImportIngredients.vue.d.ts +2 -0
- package/dist/views/ingredients/components/import-ingredients/ImportIngredientsProps.d.ts +5 -0
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -0
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -0
- package/dist/views/ingredients/helper/import-export.helper.d.ts +47 -0
- package/dist/views/ingredients/helper/sku-id.helper.d.ts +1 -0
- package/dist/views/receive-request/components/supplier-price-history/SupplierPriceHistoryProps.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +5 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +4 -0
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +12 -0
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +4 -2
- package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
- package/dist/xlsx-BfH_6O8P.js +24004 -0
- package/dist/xlsx.util-BpHfmZp6.js +107 -0
- package/package.json +7 -6
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-DqD-jNxc.js +0 -229
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-BYi6BUwT.js +0 -49
- package/dist/IngredientsView-DNbppADe.js +0 -973
- package/dist/ReceiveRequestView-C1ae5dRi.js +0 -1434
- package/dist/RecipeView-BwP8jlG0.js +0 -596
- package/dist/SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js +0 -53
- package/dist/SupplierView-CVZ7bOgA.js +0 -803
- package/dist/xlsx-Vw9D2Jo4.js +0 -15510
|
@@ -1,1434 +0,0 @@
|
|
|
1
|
-
import { defineComponent as be, ref as N, watch as de, computed as $, resolveComponent as w, openBlock as _, createBlock as z, withCtx as A, createElementVNode as s, createVNode as n, toDisplayString as Z, createElementBlock as P, Fragment as Te, renderList as tt, unref as i, mergeModels as zt, reactive as sa, onMounted as jt, useModel as la, createCommentVNode as L, normalizeClass as Be, normalizeStyle as Bt, resolveDynamicComponent as na, h as q, isRef as ra, Teleport as ua, mergeProps as Yt } from "vue";
|
|
2
|
-
import { I as rt, d as ye, o as ge, p as ia, e as it, a as Jt, C as ut, u as ca, q as Je, r as da } from "./app-DXqS7qYg.js";
|
|
3
|
-
import { i as at } from "./init-date-range-6CJBD0GL.js";
|
|
4
|
-
import { u as Xt, p as ma, P as R, a as pa, b as fa, _ as va, g as _a } from "./TransferDetails.vue_vue_type_script_setup_true_lang-Ctqjw3f1.js";
|
|
5
|
-
import { k as ea, a as j, q as et, t as ya, s as ga, b as ba, u as ha, j as Kt, c as Ca } from "./date2-B96h4mWb.js";
|
|
6
|
-
import { _ as xa, u as ka, i as wa, e as Da } from "./stock-estimate-DoU-A7bG.js";
|
|
7
|
-
import { i as Sa, d as Gt } from "./dayjs.min-CQkpEWlm.js";
|
|
8
|
-
import { _ as Fa } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js";
|
|
9
|
-
import { _ as Va } from "./ChangeLocationComponent.vue_vue_type_script_setup_true_lang-1XPAzm5R.js";
|
|
10
|
-
import { useDialog as Ta, useSnackbar as ct, components as oe, useProxiedModel as Ra, useBreakpoints as Pa } from "@feedmepos/ui-library";
|
|
11
|
-
import { R as Wt, F as Ve } from "./row-action.enum-BwQbURNh.js";
|
|
12
|
-
import { useCoreStore as Ua } from "@feedmepos/mf-common";
|
|
13
|
-
import { _ as $a } from "./FmMultiselectDialog.vue_vue_type_script_setup_true_lang-DL98UqsQ.js";
|
|
14
|
-
import { F as W, _ as ta, u as Aa } from "./layout-CVjYEZxq.js";
|
|
15
|
-
import { R as Xe, B as Ea, A as Ma, a as Oa, M as Ia } from "./rules-B_-yQn9M.js";
|
|
16
|
-
import { u as aa } from "./supplier-D2Wuv0oV.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-DqD-jNxc.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 ?? at() }
|
|
23
|
-
},
|
|
24
|
-
emits: ["update:modelValue"],
|
|
25
|
-
setup(O, { emit: Q }) {
|
|
26
|
-
const Y = Q, h = N(at());
|
|
27
|
-
de(h, (x) => {
|
|
28
|
-
Y("update:modelValue", x);
|
|
29
|
-
});
|
|
30
|
-
const M = $(() => {
|
|
31
|
-
const { startDate: x, endDate: C } = h.value;
|
|
32
|
-
return !x && !C ? "" : `${x} - ${C}`;
|
|
33
|
-
});
|
|
34
|
-
return (x, C) => {
|
|
35
|
-
const f = w("FmIcon"), K = w("FmDateRangePicker");
|
|
36
|
-
return _(), z(K, {
|
|
37
|
-
"show-predefined-range": "",
|
|
38
|
-
modelValue: h.value,
|
|
39
|
-
"onUpdate:modelValue": C[0] || (C[0] = (y) => h.value = y),
|
|
40
|
-
"start-label": "",
|
|
41
|
-
"end-label": ""
|
|
42
|
-
}, {
|
|
43
|
-
"trigger-button": A(() => [
|
|
44
|
-
s("div", La, [
|
|
45
|
-
n(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) => (_(), P("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), Zt = /* @__PURE__ */ be({
|
|
101
|
-
__name: "SupplierPriceHistory",
|
|
102
|
-
props: {
|
|
103
|
-
prices: {}
|
|
104
|
-
},
|
|
105
|
-
setup(O) {
|
|
106
|
-
const Q = aa();
|
|
107
|
-
function Y(h) {
|
|
108
|
-
return Q.suppliers.find((M) => M._id === h);
|
|
109
|
-
}
|
|
110
|
-
return (h, M) => (_(), P("div", Ba, [
|
|
111
|
-
(_(!0), P(Te, null, tt(Object.keys(h.prices), (x) => {
|
|
112
|
-
var C;
|
|
113
|
-
return _(), P("div", {
|
|
114
|
-
key: x,
|
|
115
|
-
class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
|
|
116
|
-
}, [
|
|
117
|
-
s("div", Ja, Z((C = Y(x)) == null ? void 0 : C.name), 1),
|
|
118
|
-
s("div", Xa, [
|
|
119
|
-
(_(!0), P(Te, null, tt(h.prices[x].slice(0, 3), (f) => (_(), P("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(ea)(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(et)(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" }, Co = /* @__PURE__ */ s("div", { class: "xs:w-full flex-1 fm-typo-en-title-sm-800" }, "Transfer items", -1), xo = {
|
|
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), Uo = { key: 0 }, $o = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, Ao = { 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__ */ zt({
|
|
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__ */ zt(["validation-success"], ["update:modelValue"]),
|
|
177
|
-
setup(O, { expose: Q, emit: Y }) {
|
|
178
|
-
const h = it(), M = ka(), x = Ua(), C = Xt(), f = Jt(), 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
|
-
jt(() => {
|
|
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, r = la(O, "modelValue"), se = $({
|
|
201
|
-
get() {
|
|
202
|
-
var e;
|
|
203
|
-
return ((e = r.value) == null ? void 0 : e.remark) ?? "";
|
|
204
|
-
},
|
|
205
|
-
set(e) {
|
|
206
|
-
r.value.remark = e;
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
de([() => y.suppliers], () => {
|
|
210
|
-
if (v.value === R.PURCHASE) {
|
|
211
|
-
r.value.supplier = y.suppliers[0];
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
const F = $(() => y.disabled), le = $(() => r.value.items ?? []), me = (e) => {
|
|
216
|
-
const { name: t, address: a, regNo: l, phoneNo: o } = e.doc.profile;
|
|
217
|
-
return {
|
|
218
|
-
_id: e.doc._id,
|
|
219
|
-
internal: e.type === rt.restaurant ? ge.enum.restaurant : ge.enum.warehouse,
|
|
220
|
-
name: t,
|
|
221
|
-
registrationNumber: l,
|
|
222
|
-
address: a,
|
|
223
|
-
contactName: t,
|
|
224
|
-
phoneNumber: o,
|
|
225
|
-
disabled: !e.acceptRequest || e.dbName === h.currentLocation.dbName
|
|
226
|
-
};
|
|
227
|
-
}, E = [
|
|
228
|
-
{
|
|
229
|
-
label: "Purchase",
|
|
230
|
-
value: R.PURCHASE
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
label: "Transfer",
|
|
234
|
-
value: R.TRANSFER
|
|
235
|
-
}
|
|
236
|
-
], v = N(R.PURCHASE), c = $(() => {
|
|
237
|
-
var t;
|
|
238
|
-
const e = ((t = h._currentLocation) == null ? void 0 : t.type) === rt.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 === rt.warehouse) && a.acceptRequest;
|
|
242
|
-
});
|
|
243
|
-
}), u = $(() => v.value === R.PURCHASE ? y.suppliers.map((e) => ({
|
|
244
|
-
label: e.name,
|
|
245
|
-
value: e._id,
|
|
246
|
-
disabled: !1
|
|
247
|
-
})) : c.value.map(me).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 = r.value.supplier) == null ? void 0 : e._id) ?? null;
|
|
255
|
-
},
|
|
256
|
-
set(e) {
|
|
257
|
-
if (v.value === R.PURCHASE) {
|
|
258
|
-
r.value.supplier = y.suppliers.find((a) => a._id === e) ?? null, r.value.items && (r.value.items = r.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 ? r.value.supplier = me(t) : r.value.supplier = null;
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
function V(e) {
|
|
269
|
-
switch (e) {
|
|
270
|
-
case ut.MY:
|
|
271
|
-
return "MYR";
|
|
272
|
-
case ut.SG:
|
|
273
|
-
return "SGD";
|
|
274
|
-
case ut.ID:
|
|
275
|
-
return "IDR";
|
|
276
|
-
default:
|
|
277
|
-
return "MYR";
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
function D(e) {
|
|
281
|
-
var U, T, ee, ae, te, Ne, He, Le, ue, ze;
|
|
282
|
-
if (K[e.sku._id])
|
|
283
|
-
return e.totalCost;
|
|
284
|
-
const t = e.measurement, l = ((te = (ae = (ee = (T = (U = y.modelValue) == null ? void 0 : U.supplier) == null ? void 0 : T.supplyItems) == null ? void 0 : ee.find(
|
|
285
|
-
(nt) => nt.skuId === e.sku._id
|
|
286
|
-
)) == null ? void 0 : ae.defaultCost) == null ? void 0 : te.costPerUnit) ?? ((Ne = e.sku.defaultCost) == null ? void 0 : Ne.costPerUnit), o = l ? (He = e.sku.defaultCost) != null && He.measurement ? +j(l) / +j((Le = e.sku.defaultCost) == null ? void 0 : Le.measurement.conversion) : +j(l) : void 0, p = o ? t ? o * +j(t.conversion) : o : void 0, d = p ? +j(e.quantity) * p : void 0;
|
|
287
|
-
return e.totalCost ?? d ? {
|
|
288
|
-
...ya(d ?? 0, 2),
|
|
289
|
-
currency: V(((ue = x.currentCountry) == null ? void 0 : ue.value) ?? ye)
|
|
290
|
-
} : {
|
|
291
|
-
amount: 1,
|
|
292
|
-
precision: 0,
|
|
293
|
-
currency: V(((ze = x.currentCountry) == null ? void 0 : ze.value) ?? ye)
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
function pe(e) {
|
|
297
|
-
var t;
|
|
298
|
-
v.value = e, k.value = ((t = u.value.find((a) => !a.disabled)) == null ? void 0 : t.value) ?? null, e === R.PURCHASE && f.enableTotalCost && (r.value.items = r.value.items.map((a) => {
|
|
299
|
-
const l = D(a);
|
|
300
|
-
return {
|
|
301
|
-
...a,
|
|
302
|
-
totalCost: l
|
|
303
|
-
};
|
|
304
|
-
}));
|
|
305
|
-
}
|
|
306
|
-
de([() => y.modelValue], ([e]) => {
|
|
307
|
-
var t, a, l;
|
|
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 = R.TRANSFER : v.value = R.PURCHASE, k.value = ((l = u.value.find((o) => {
|
|
309
|
-
var p, d;
|
|
310
|
-
return o.value === ((d = (p = y.modelValue) == null ? void 0 : p.supplier) == null ? void 0 : d._id);
|
|
311
|
-
})) == null ? void 0 : l.value) ?? null;
|
|
312
|
-
}), jt(() => {
|
|
313
|
-
var e, t, a, l, o, p, d;
|
|
314
|
-
((t = (e = y.modelValue) == null ? void 0 : e.supplier) == null ? void 0 : t.internal) === ge.enum.restaurant || ((l = (a = y.modelValue) == null ? void 0 : a.supplier) == null ? void 0 : l.internal) === ge.enum.warehouse ? v.value = R.TRANSFER : v.value = R.PURCHASE, k.value = (o = y.modelValue) != null && o.supplier ? ((p = u.value.find((b) => {
|
|
315
|
-
var U, T;
|
|
316
|
-
return b.value === ((T = (U = y.modelValue) == null ? void 0 : U.supplier) == null ? void 0 : T._id);
|
|
317
|
-
})) == null ? void 0 : p.value) ?? null : ((d = u.value.find((b) => !b.disabled)) == null ? void 0 : d.value) ?? null;
|
|
318
|
-
});
|
|
319
|
-
const fe = Ta(), ne = N(7), B = N(!1), he = ct();
|
|
320
|
-
async function Re() {
|
|
321
|
-
if (ne.value < 1)
|
|
322
|
-
return;
|
|
323
|
-
B.value = !1, await M.readPurchaseOrder(ne.value);
|
|
324
|
-
const e = {
|
|
325
|
-
...r.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, l) => {
|
|
332
|
-
const o = y.skus.find((b) => b._id === l.id);
|
|
333
|
-
if (a.find((b) => b.sku._id === l.id) || !o)
|
|
334
|
-
return a;
|
|
335
|
-
const d = {
|
|
336
|
-
sku: o,
|
|
337
|
-
code: o.code,
|
|
338
|
-
name: o.name,
|
|
339
|
-
quantity: {
|
|
340
|
-
amount: l.amount,
|
|
341
|
-
precision: 0
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
return a.push(d), a;
|
|
345
|
-
}, t), r.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 l;
|
|
354
|
-
return (l = r.value.items) == null ? void 0 : l.find((o) => o.sku._id === a.value._id);
|
|
355
|
-
}).map((a) => a.value);
|
|
356
|
-
fe.open({
|
|
357
|
-
title: "Select item",
|
|
358
|
-
closeButton: !0,
|
|
359
|
-
contentComponent: $a,
|
|
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 l = {
|
|
375
|
-
...r.value
|
|
376
|
-
}, o = l.items ?? [], p = a.map((d) => {
|
|
377
|
-
const b = o.find((T) => T.sku._id === d._id);
|
|
378
|
-
if (b)
|
|
379
|
-
return b;
|
|
380
|
-
const U = {
|
|
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 === R.PURCHASE && f.enableTotalCost && (U.totalCost = D(U)), U;
|
|
390
|
-
});
|
|
391
|
-
p.sort((d, b) => d.sku.code.localeCompare(b.sku.code)), l.items = p, r.value = l;
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
function Ue(e, t) {
|
|
395
|
-
var a;
|
|
396
|
-
if (e === Wt.Delete) {
|
|
397
|
-
const l = ((a = r.value) == null ? void 0 : a.items) ?? [];
|
|
398
|
-
r.value.items = l.filter((o) => o.sku._id !== t);
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
function ve(e, t) {
|
|
403
|
-
var l;
|
|
404
|
-
const a = ((l = r.value) == null ? void 0 : l.items) ?? [];
|
|
405
|
-
r.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));
|
|
406
|
-
}
|
|
407
|
-
function $e(e, t) {
|
|
408
|
-
const a = r.value, l = a.items ?? [];
|
|
409
|
-
a.items = l.map((o) => (o.sku._id !== e || (o.code = t), o));
|
|
410
|
-
}
|
|
411
|
-
function Ae(e, t) {
|
|
412
|
-
const a = r.value, l = a.items ?? [];
|
|
413
|
-
a.items = l.map((o) => (o.sku._id !== e || (o.name = t), o));
|
|
414
|
-
}
|
|
415
|
-
function Ee(e, t) {
|
|
416
|
-
const a = r.value, l = a.items ?? [];
|
|
417
|
-
a.items = l.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, l = r.value, o = l.items ?? [];
|
|
421
|
-
t.length > 0 && isFinite(a) ? l.items = o.map((p) => {
|
|
422
|
-
var d;
|
|
423
|
-
return p.sku._id !== e || (p.totalCost = {
|
|
424
|
-
...Ca(a),
|
|
425
|
-
currency: V(((d = x.currentCountry) == null ? void 0 : d.value) ?? ye)
|
|
426
|
-
}), p;
|
|
427
|
-
}) : l.items = o.map((p) => {
|
|
428
|
-
var d;
|
|
429
|
-
return p.sku._id !== e || (p.totalCost = {
|
|
430
|
-
amount: 0,
|
|
431
|
-
precision: 0,
|
|
432
|
-
currency: V(((d = x.currentCountry) == null ? void 0 : d.value) ?? ye)
|
|
433
|
-
}), p;
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
const xe = [
|
|
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
|
-
$e(t.sku._id, a);
|
|
447
|
-
},
|
|
448
|
-
rules: [Xe()],
|
|
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
|
-
Ae(t.sku._id, a);
|
|
464
|
-
},
|
|
465
|
-
rules: [Xe()],
|
|
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 l, o, p, d;
|
|
477
|
-
const t = e.row.original, a = (p = (o = (l = r.value) == null ? void 0 : l.items) == null ? void 0 : o.find) == null ? void 0 : p.call(o, (b) => b.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": (b) => {
|
|
489
|
-
Ee(t.sku._id, b.amount), ve(t.sku._id, b.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 = x.currentCountry) == null ? void 0 : e.value) ?? ye) === "MYR" ? "RM" : V(((t = x.currentCountry) == null ? void 0 : t.value) ?? ye)})`
|
|
509
|
-
]
|
|
510
|
-
);
|
|
511
|
-
},
|
|
512
|
-
size: 180,
|
|
513
|
-
cell(e) {
|
|
514
|
-
var l, o, p;
|
|
515
|
-
const t = e.row.original, a = (p = (o = (l = r.value) == null ? void 0 : l.items) == null ? void 0 : o.find) == null ? void 0 : p.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 b;
|
|
534
|
-
K[(a == null ? void 0 : a.sku._id) ?? ""] = !1;
|
|
535
|
-
const d = ((b = r.value) == null ? void 0 : b.items) ?? [];
|
|
536
|
-
r.value.items = d.map((U) => (f.enableTotalCost && (U.totalCost = D(U)), U));
|
|
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 ${et(y.lastClosingDate)} ${Kt(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
|
-
Ue(Wt.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 ? xe : xe.filter((e) => e.id !== "Delete")
|
|
619
|
-
), Oe = $(() => v.value === R.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
|
-
de(G, (e) => {
|
|
636
|
-
e && (_e.value = !0, Ie().finally(() => {
|
|
637
|
-
_e.value = !1;
|
|
638
|
-
}));
|
|
639
|
-
});
|
|
640
|
-
async function Ie() {
|
|
641
|
-
try {
|
|
642
|
-
const { startDate: e, endDate: t } = ga(6), o = (await C.getPurchaseOrders({ start: e, end: t })).reverse().filter(
|
|
643
|
-
(p) => {
|
|
644
|
-
var d, b;
|
|
645
|
-
return p.status === ia.enum.COMPLETE && ((d = p.supplier) == null ? void 0 : d.internal) !== "warehouse" && ((b = p.supplier) == null ? void 0 : b.internal) !== "restaurant";
|
|
646
|
-
}
|
|
647
|
-
).reduce((p, d) => {
|
|
648
|
-
const b = new Date(Sa(d._id)), U = d.supplier._id;
|
|
649
|
-
for (const T of d.items) {
|
|
650
|
-
if (!T.totalCost) continue;
|
|
651
|
-
const ee = p[T.sku._id] ?? {}, ae = ee[U] ?? [], te = T.measurement ? ba(T.quantity, T.measurement.conversion) : T.quantity;
|
|
652
|
-
ae.push({
|
|
653
|
-
date: b.toISOString(),
|
|
654
|
-
totalUnit: te,
|
|
655
|
-
totalCost: T.totalCost,
|
|
656
|
-
unit: T.sku.unit,
|
|
657
|
-
seqNumber: d.seqNumber
|
|
658
|
-
}), ee[U] = ae, p[T.sku._id] = ee;
|
|
659
|
-
}
|
|
660
|
-
return p;
|
|
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 _e = 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
|
-
r.value.effectiveAt = (e == null ? void 0 : e.toISOString()) ?? null;
|
|
681
|
-
}
|
|
682
|
-
}), ot = $({
|
|
683
|
-
get() {
|
|
684
|
-
return !!I.value;
|
|
685
|
-
},
|
|
686
|
-
set(e) {
|
|
687
|
-
e ? I.value = /* @__PURE__ */ new Date() : I.value = null;
|
|
688
|
-
}
|
|
689
|
-
}), st = $({
|
|
690
|
-
get() {
|
|
691
|
-
return I.value === null ? "" : et(I.value);
|
|
692
|
-
},
|
|
693
|
-
set(e) {
|
|
694
|
-
e ? I.value = /* @__PURE__ */ new Date(`${e} ${lt.value}`) : I.value = null;
|
|
695
|
-
}
|
|
696
|
-
}), lt = $({
|
|
697
|
-
get() {
|
|
698
|
-
return I.value === null ? "" : ha(I.value);
|
|
699
|
-
},
|
|
700
|
-
set(e) {
|
|
701
|
-
e ? I.value = /* @__PURE__ */ new Date(`${st.value} ${e}`) : I.value = null;
|
|
702
|
-
}
|
|
703
|
-
}), dt = $(() => {
|
|
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"), l = w("FmSelect"), o = w("FmMenuItem"), p = w("FmTextField"), d = w("FmTextarea"), b = w("FmSwitch"), U = w("FmDatePicker"), T = w("FmTimePicker"), ee = w("FmFormGroup"), ae = w("FmIcon"), te = w("FmButton"), Ne = w("FmCard"), He = w("FmStepperField"), Le = w("FmPopover"), ue = w("FmLabel"), ze = w("FmSpacer"), nt = w("FmTable"), oa = w("FmForm");
|
|
709
|
-
return _(), z(oa, {
|
|
710
|
-
ref_key: "formRef",
|
|
711
|
-
ref: re,
|
|
712
|
-
onReset: t[14] || (t[14] = (je) => v.value = i(R).PURCHASE),
|
|
713
|
-
onValidationSuccess: t[15] || (t[15] = (je) => H("validation-success")),
|
|
714
|
-
disabled: F.value
|
|
715
|
-
}, {
|
|
716
|
-
default: A(() => {
|
|
717
|
-
var je, mt, pt, ft;
|
|
718
|
-
return [
|
|
719
|
-
s("div", so, [
|
|
720
|
-
s("div", lo, [
|
|
721
|
-
no,
|
|
722
|
-
s("div", ro, [
|
|
723
|
-
n(a, {
|
|
724
|
-
label: i(h).currentLocation.name,
|
|
725
|
-
icon: "storefront",
|
|
726
|
-
compact: ""
|
|
727
|
-
}, null, 8, ["label"]),
|
|
728
|
-
(mt = (je = i(x).currentRestaurant) == null ? void 0 : je.value) != null && mt.posVersion ? (_(), z(a, {
|
|
729
|
-
key: 0,
|
|
730
|
-
label: `POS v${(ft = (pt = i(x).currentRestaurant) == null ? void 0 : pt.value) == null ? void 0 : ft.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(et)(e.lastClosingDate)} ${i(Kt)(e.lastClosingDate)}`,
|
|
737
|
-
icon: "calendar_month",
|
|
738
|
-
compact: ""
|
|
739
|
-
}, null, 8, ["label"])) : L("", !0)
|
|
740
|
-
]),
|
|
741
|
-
uo,
|
|
742
|
-
s("div", io, [
|
|
743
|
-
n(l, {
|
|
744
|
-
items: E,
|
|
745
|
-
rules: [i(Xe)()],
|
|
746
|
-
"label-mark": "required",
|
|
747
|
-
label: "Transfer type",
|
|
748
|
-
"model-value": v.value,
|
|
749
|
-
"onUpdate:modelValue": t[0] || (t[0] = (m) => pe(m)),
|
|
750
|
-
disabled: F.value || !S.value,
|
|
751
|
-
"data-cy": "fm-select-transaction-type"
|
|
752
|
-
}, null, 8, ["rules", "model-value", "disabled"]),
|
|
753
|
-
n(l, {
|
|
754
|
-
label: v.value === i(R).PURCHASE ? "Supplier" : "Transfer From",
|
|
755
|
-
items: u.value,
|
|
756
|
-
modelValue: k.value,
|
|
757
|
-
"onUpdate:modelValue": t[1] || (t[1] = (m) => k.value = m),
|
|
758
|
-
disabled: F.value || !S.value,
|
|
759
|
-
rules: [i(Xe)()],
|
|
760
|
-
"label-mark": "required"
|
|
761
|
-
}, {
|
|
762
|
-
"menu-wrapper": A(({ handleItemChange: m }) => [
|
|
763
|
-
(_(!0), P(Te, null, tt(u.value, (g) => (_(), z(o, {
|
|
764
|
-
key: g.value,
|
|
765
|
-
"model-value": g.value === k.value,
|
|
766
|
-
disabled: g.disabled,
|
|
767
|
-
label: g.label,
|
|
768
|
-
"onUpdate:modelValue": (ie) => m(ie, g)
|
|
769
|
-
}, null, 8, ["model-value", "disabled", "label", "onUpdate:modelValue"]))), 128))
|
|
770
|
-
]),
|
|
771
|
-
_: 1
|
|
772
|
-
}, 8, ["label", "items", "modelValue", "disabled", "rules"]),
|
|
773
|
-
n(p, {
|
|
774
|
-
label: "Reference",
|
|
775
|
-
modelValue: r.value.ref,
|
|
776
|
-
"onUpdate:modelValue": t[2] || (t[2] = (m) => r.value.ref = m),
|
|
777
|
-
"label-mark": "optional",
|
|
778
|
-
disabled: F.value || !S.value
|
|
779
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
780
|
-
n(d, {
|
|
781
|
-
label: "Remark",
|
|
782
|
-
modelValue: se.value,
|
|
783
|
-
"onUpdate:modelValue": t[3] || (t[3] = (m) => se.value = m),
|
|
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 ? (_(), P("div", co, [
|
|
790
|
-
s("div", mo, [
|
|
791
|
-
n(b, {
|
|
792
|
-
modelValue: ot.value,
|
|
793
|
-
"onUpdate:modelValue": t[4] || (t[4] = (m) => ot.value = m),
|
|
794
|
-
label: "Backdate transfer",
|
|
795
|
-
sublabel: "Apply transfer to older date",
|
|
796
|
-
"label-placement": "right",
|
|
797
|
-
disabled: F.value || !S.value || dt.value && !e.lastClosingDate
|
|
798
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
799
|
-
po,
|
|
800
|
-
ot.value ? (_(), P("div", fo, [
|
|
801
|
-
s("div", vo, [
|
|
802
|
-
n(U, {
|
|
803
|
-
modelValue: st.value,
|
|
804
|
-
"onUpdate:modelValue": t[5] || (t[5] = (m) => st.value = m)
|
|
805
|
-
}, null, 8, ["modelValue"])
|
|
806
|
-
]),
|
|
807
|
-
s("div", _o, [
|
|
808
|
-
n(T, {
|
|
809
|
-
modelValue: lt.value,
|
|
810
|
-
"onUpdate:modelValue": t[6] || (t[6] = (m) => lt.value = m)
|
|
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] = (m) => I.value = m),
|
|
819
|
-
rules: [i(Ea)(new Date(e.lastClosingDate), /* @__PURE__ */ new Date())]
|
|
820
|
-
}, null, 8, ["modelValue", "rules"])) : L("", !0),
|
|
821
|
-
dt.value && !e.lastClosingDate ? (_(), P("div", yo, [
|
|
822
|
-
n(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
|
-
n(ee, {
|
|
834
|
-
"model-value": r.value.items,
|
|
835
|
-
rules: [
|
|
836
|
-
function(g) {
|
|
837
|
-
return g && g.length > 0 || "Must have at least one item!";
|
|
838
|
-
}
|
|
839
|
-
]
|
|
840
|
-
}, {
|
|
841
|
-
default: A(() => {
|
|
842
|
-
var m;
|
|
843
|
-
return [
|
|
844
|
-
s("div", ho, [
|
|
845
|
-
Co,
|
|
846
|
-
v.value === i(R).PURCHASE && S.value && i(f).enableTotalCost ? (_(), P("div", xo, [
|
|
847
|
-
n(b, {
|
|
848
|
-
label: _e.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] = (g) => G.value = g),
|
|
853
|
-
disabled: _e.value || !((m = r.value) != null && m.items) || r.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
|
-
n(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] = (m) => Pe()),
|
|
869
|
-
size: "md"
|
|
870
|
-
}, null, 8, ["disabled"]),
|
|
871
|
-
n(Le, {
|
|
872
|
-
disabled: F.value || !S.value,
|
|
873
|
-
class: "flex",
|
|
874
|
-
"show-popover": B.value,
|
|
875
|
-
onPopoverChanged: t[13] || (t[13] = (m) => B.value = m)
|
|
876
|
-
}, {
|
|
877
|
-
"popover-button": A(() => [
|
|
878
|
-
n(Ne, {
|
|
879
|
-
class: Be([
|
|
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
|
-
n(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: Be([
|
|
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
|
-
n(xa, { "z-index": 99 }, {
|
|
906
|
-
default: A(() => [
|
|
907
|
-
Fo
|
|
908
|
-
]),
|
|
909
|
-
_: 1
|
|
910
|
-
}),
|
|
911
|
-
n(te, {
|
|
912
|
-
icon: "close",
|
|
913
|
-
size: "md",
|
|
914
|
-
variant: "tertiary",
|
|
915
|
-
onClick: t[10] || (t[10] = (m) => B.value = !1)
|
|
916
|
-
})
|
|
917
|
-
]),
|
|
918
|
-
n(He, {
|
|
919
|
-
modelValue: ne.value,
|
|
920
|
-
"onUpdate:modelValue": t[11] || (t[11] = (m) => ne.value = m),
|
|
921
|
-
label: "Enter day to forecast stock",
|
|
922
|
-
rules: [i(Ma)(1)]
|
|
923
|
-
}, {
|
|
924
|
-
"helper-text": A(() => [
|
|
925
|
-
s("div", Vo, [
|
|
926
|
-
n(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
|
-
n(te, {
|
|
939
|
-
label: "Cancel",
|
|
940
|
-
variant: "tertiary",
|
|
941
|
-
onClick: t[12] || (t[12] = (m) => B.value = !1)
|
|
942
|
-
}),
|
|
943
|
-
n(te, {
|
|
944
|
-
label: "Generate",
|
|
945
|
-
onClick: Re
|
|
946
|
-
})
|
|
947
|
-
])
|
|
948
|
-
])
|
|
949
|
-
]),
|
|
950
|
-
_: 1
|
|
951
|
-
}, 8, ["disabled", "show-popover"])
|
|
952
|
-
]),
|
|
953
|
-
le.value.length ? (_(), P("div", Uo, [
|
|
954
|
-
(_(), z(nt, {
|
|
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((m) => {
|
|
963
|
-
var g, ie;
|
|
964
|
-
return [
|
|
965
|
-
s("tr", {
|
|
966
|
-
class: Be(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
|
|
967
|
-
"bg-fm-color-neutral-gray-100": m.getIsSelected()
|
|
968
|
-
}])
|
|
969
|
-
}, [
|
|
970
|
-
(_(!0), P(Te, null, tt(m.getVisibleCells(), (J) => {
|
|
971
|
-
var De, ce, Se, Fe;
|
|
972
|
-
return _(), P("td", {
|
|
973
|
-
key: J.id,
|
|
974
|
-
class: Be([
|
|
975
|
-
"h-[52px] px-16 text-fm-color-typo-primary",
|
|
976
|
-
((De = qe(J)) == null ? void 0 : De.cellClass) ?? "px-16"
|
|
977
|
-
]),
|
|
978
|
-
style: Bt({
|
|
979
|
-
width: (ce = qe(J)) == null ? void 0 : ce.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", $o, [
|
|
985
|
-
n(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(R).PURCHASE && G.value && Object.keys(we.value[(g = m.original.sku) == null ? void 0 : g._id] ?? {}).length > 0 ? (_(), P("tr", Ao, [
|
|
994
|
-
s("td", {
|
|
995
|
-
colspan: m.getVisibleCells().length
|
|
996
|
-
}, [
|
|
997
|
-
n(Zt, {
|
|
998
|
-
prices: we.value[(ie = m.original.sku) == null ? void 0 : ie._id]
|
|
999
|
-
}, null, 8, ["prices"])
|
|
1000
|
-
], 8, Eo)
|
|
1001
|
-
])) : L("", !0)
|
|
1002
|
-
];
|
|
1003
|
-
}),
|
|
1004
|
-
"list-row": A((m) => [
|
|
1005
|
-
n(ta, { row: m }, {
|
|
1006
|
-
default: A((g) => {
|
|
1007
|
-
var ie, J, De, ce, Se, Fe, vt, _t, Ye, yt, gt, bt, ht, Ke, Ct, xt, kt, wt, Ge, Dt, St, Ft, Vt, We, Tt, Rt, Pt, Ut, $t, At, Ze, Et, Mt, Ot, It, qt, Qe, Nt, Ht, Lt;
|
|
1008
|
-
return [
|
|
1009
|
-
s("div", Mo, [
|
|
1010
|
-
s("div", Oo, [
|
|
1011
|
-
s("div", Io, Z(m.original.sku.name), 1),
|
|
1012
|
-
s("div", null, [
|
|
1013
|
-
n(i(W), {
|
|
1014
|
-
render: (De = (J = (ie = g.Delete) == null ? void 0 : ie.column) == null ? void 0 : J.columnDef) == null ? void 0 : De.cell,
|
|
1015
|
-
props: (Se = (ce = g.Delete) == null ? void 0 : ce.getContext) == null ? void 0 : Se.call(ce)
|
|
1016
|
-
}, null, 8, ["render", "props"])
|
|
1017
|
-
])
|
|
1018
|
-
]),
|
|
1019
|
-
s("div", qo, [
|
|
1020
|
-
s("div", No, [
|
|
1021
|
-
n(ue, { label: "Code" }),
|
|
1022
|
-
n(i(W), {
|
|
1023
|
-
render: (_t = (vt = (Fe = g.code) == null ? void 0 : Fe.column) == null ? void 0 : vt.columnDef) == null ? void 0 : _t.cell,
|
|
1024
|
-
props: (yt = (Ye = g.code) == null ? void 0 : Ye.getContext) == null ? void 0 : yt.call(Ye)
|
|
1025
|
-
}, null, 8, ["render", "props"])
|
|
1026
|
-
]),
|
|
1027
|
-
s("div", Ho, [
|
|
1028
|
-
n(ue, { label: "Name" }),
|
|
1029
|
-
n(i(W), {
|
|
1030
|
-
render: (ht = (bt = (gt = g.Name) == null ? void 0 : gt.column) == null ? void 0 : bt.columnDef) == null ? void 0 : ht.cell,
|
|
1031
|
-
props: (Ct = (Ke = g.Name) == null ? void 0 : Ke.getContext) == null ? void 0 : Ct.call(Ke)
|
|
1032
|
-
}, null, 8, ["render", "props"])
|
|
1033
|
-
]),
|
|
1034
|
-
s("div", Lo, [
|
|
1035
|
-
n(ue, { label: "Amount" }),
|
|
1036
|
-
n(i(W), {
|
|
1037
|
-
render: (wt = (kt = (xt = g.Amount) == null ? void 0 : xt.column) == null ? void 0 : kt.columnDef) == null ? void 0 : wt.cell,
|
|
1038
|
-
props: (Dt = (Ge = g.Amount) == null ? void 0 : Ge.getContext) == null ? void 0 : Dt.call(Ge)
|
|
1039
|
-
}, null, 8, ["render", "props"])
|
|
1040
|
-
]),
|
|
1041
|
-
s("div", zo, [
|
|
1042
|
-
n(ue, { label: "Unit" }),
|
|
1043
|
-
n(i(W), {
|
|
1044
|
-
render: (Vt = (Ft = (St = g.Unit) == null ? void 0 : St.column) == null ? void 0 : Ft.columnDef) == null ? void 0 : Vt.cell,
|
|
1045
|
-
props: (Tt = (We = g.Unit) == null ? void 0 : We.getContext) == null ? void 0 : Tt.call(We)
|
|
1046
|
-
}, null, 8, ["render", "props"])
|
|
1047
|
-
]),
|
|
1048
|
-
v.value === i(R).PURCHASE && g.Cost ? (_(), P("div", jo, [
|
|
1049
|
-
typeof ((Ut = (Pt = (Rt = g.Cost) == null ? void 0 : Rt.column) == null ? void 0 : Pt.columnDef) == null ? void 0 : Ut.header) == "function" ? (_(), P("div", Yo, [
|
|
1050
|
-
(_(), z(na(
|
|
1051
|
-
(Mt = (At = ($t = g.Cost) == null ? void 0 : $t.column) == null ? void 0 : At.columnDef) == null ? void 0 : Mt.header(
|
|
1052
|
-
(Et = (Ze = g.Cost) == null ? void 0 : Ze.getContext) == null ? void 0 : Et.call(Ze)
|
|
1053
|
-
)
|
|
1054
|
-
)))
|
|
1055
|
-
])) : L("", !0),
|
|
1056
|
-
n(i(W), {
|
|
1057
|
-
render: (qt = (It = (Ot = g.Cost) == null ? void 0 : Ot.column) == null ? void 0 : It.columnDef) == null ? void 0 : qt.cell,
|
|
1058
|
-
props: (Nt = (Qe = g.Cost) == null ? void 0 : Qe.getContext) == null ? void 0 : Nt.call(Qe)
|
|
1059
|
-
}, null, 8, ["render", "props"])
|
|
1060
|
-
])) : L("", !0)
|
|
1061
|
-
]),
|
|
1062
|
-
v.value === i(R).PURCHASE && G.value && Object.keys(we.value[(Ht = m.original.sku) == null ? void 0 : Ht._id] ?? {}).length > 0 ? (_(), P(Te, { key: 0 }, [
|
|
1063
|
-
n(ze, { class: "h-8" }),
|
|
1064
|
-
n(Zt, {
|
|
1065
|
-
prices: we.value[(Lt = m.original.sku) == null ? void 0 : Lt._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, x = Xt(), C = ct(), f = aa(), K = ca(), y = it();
|
|
1096
|
-
async function S(c) {
|
|
1097
|
-
if (c) {
|
|
1098
|
-
r.value = !0;
|
|
1099
|
-
try {
|
|
1100
|
-
await f.readSuppliers(), r.value = !1;
|
|
1101
|
-
} catch {
|
|
1102
|
-
C.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
|
-
de([() => h.modelValue], () => {
|
|
1113
|
-
H.value = h.modelValue ?? {};
|
|
1114
|
-
});
|
|
1115
|
-
const r = 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
|
-
r.value = !0, (c.supplier.internal === "warehouse" || c.supplier.internal === "restaurant") && (c.items = c.items.map(({ totalCost: u, ...k }) => k));
|
|
1143
|
-
try {
|
|
1144
|
-
await x.createPurchaseOrder(c), await new Promise((u) => setTimeout(u, 1e3)), C.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
|
-
C.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
|
-
r.value = !1;
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
async function me() {
|
|
1160
|
-
const c = H.value;
|
|
1161
|
-
r.value = !0, (c.supplier.internal === "warehouse" || c.supplier.internal === "restaurant") && (c.items = c.items.map(({ totalCost: u, ...k }) => k));
|
|
1162
|
-
try {
|
|
1163
|
-
await x.updatePurchaseOrder(c), await new Promise((u) => setTimeout(u, 1e3)), C.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
|
-
C.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
|
-
r.value = !1;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
function E() {
|
|
1179
|
-
switch (h.mode) {
|
|
1180
|
-
case Ve.CREATE:
|
|
1181
|
-
return le();
|
|
1182
|
-
case Ve.UPDATE:
|
|
1183
|
-
return me();
|
|
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: E,
|
|
1210
|
-
modelValue: H.value,
|
|
1211
|
-
"onUpdate:modelValue": u[0] || (u[0] = (D) => H.value = D),
|
|
1212
|
-
disabled: r.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
|
-
n(k, {
|
|
1222
|
-
loading: r.value,
|
|
1223
|
-
label: "Save",
|
|
1224
|
-
onClick: v
|
|
1225
|
-
}, null, 8, ["loading"]),
|
|
1226
|
-
n(k, {
|
|
1227
|
-
disabled: r.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" }, Qt = "ReceiveRequestViewSearchCriteria", Ds = /* @__PURE__ */ be({
|
|
1242
|
-
__name: "ReceiveRequestView",
|
|
1243
|
-
setup(O) {
|
|
1244
|
-
const Q = ct();
|
|
1245
|
-
Je.object({
|
|
1246
|
-
name: Je.string().optional().nullable(),
|
|
1247
|
-
startDate: Je.string().optional().nullable(),
|
|
1248
|
-
endDate: Je.string().optional().nullable()
|
|
1249
|
-
});
|
|
1250
|
-
const Y = da(), h = Jt();
|
|
1251
|
-
function M() {
|
|
1252
|
-
const E = {
|
|
1253
|
-
name: "",
|
|
1254
|
-
...at()
|
|
1255
|
-
}, v = Y.getItem(Qt);
|
|
1256
|
-
if (!v)
|
|
1257
|
-
return E;
|
|
1258
|
-
try {
|
|
1259
|
-
return JSON.parse(v);
|
|
1260
|
-
} catch {
|
|
1261
|
-
return E;
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
function x() {
|
|
1265
|
-
Y.setItem(Qt, JSON.stringify(C.value));
|
|
1266
|
-
}
|
|
1267
|
-
const C = N(M()), f = pa("receive/request", C.value), { columnDefs: K } = fa("receive/request", f), y = it();
|
|
1268
|
-
async function S() {
|
|
1269
|
-
const E = `inventory-record_${Gt(C.value.startDate).format("DD-MM-YYYY_HH-mm")}-${Gt(C.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, pe = j(
|
|
1272
|
-
_a(k.sku, u.deliveryOrder || [])
|
|
1273
|
-
), fe = 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": pe,
|
|
1283
|
-
"Ordered quantity": fe,
|
|
1284
|
-
Unit: k.sku.unit.abbrev,
|
|
1285
|
-
"Total cost": k.totalCost ? ea(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
|
-
E
|
|
1308
|
-
), Q.open({
|
|
1309
|
-
title: "Success",
|
|
1310
|
-
message: `Exported ${E}`,
|
|
1311
|
-
type: "success"
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1314
|
-
const X = N(at()), H = N("");
|
|
1315
|
-
de([() => X.value], ([E]) => {
|
|
1316
|
-
!E.startDate || !E.endDate || (C.value.startDate = E.startDate, C.value.endDate = E.endDate, f.updateDateRange(
|
|
1317
|
-
C.value.startDate,
|
|
1318
|
-
C.value.endDate
|
|
1319
|
-
), x());
|
|
1320
|
-
}), de([() => H.value], () => {
|
|
1321
|
-
x();
|
|
1322
|
-
});
|
|
1323
|
-
function r(E) {
|
|
1324
|
-
E === "create" && f.promptCreateTransferDialog();
|
|
1325
|
-
}
|
|
1326
|
-
const { breakpoints: se } = Pa(), F = $(() => se.value.xs || se.value.sm ? 10 : 20), le = Aa(), me = [
|
|
1327
|
-
{
|
|
1328
|
-
label: "Refresh",
|
|
1329
|
-
icon: "refresh",
|
|
1330
|
-
key: "refresh"
|
|
1331
|
-
},
|
|
1332
|
-
{ label: "Export", icon: "ios_share", key: "export" }
|
|
1333
|
-
];
|
|
1334
|
-
return (E, 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": r
|
|
1340
|
-
}, {
|
|
1341
|
-
default: A(() => {
|
|
1342
|
-
var k;
|
|
1343
|
-
return [
|
|
1344
|
-
s("div", Bo, [
|
|
1345
|
-
s("div", Jo, [
|
|
1346
|
-
s("div", Xo, [
|
|
1347
|
-
n(Va),
|
|
1348
|
-
n(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
|
-
n(c, {
|
|
1355
|
-
searchable: "",
|
|
1356
|
-
"search-model": H.value,
|
|
1357
|
-
"onUpdate:searchModel": v[1] || (v[1] = (V) => H.value = V),
|
|
1358
|
-
actions: me,
|
|
1359
|
-
"onClick:actionExport": S,
|
|
1360
|
-
"onClick:actionRefresh": i(f).fetchData
|
|
1361
|
-
}, null, 8, ["search-model", "onClick:actionRefresh"])
|
|
1362
|
-
])
|
|
1363
|
-
]),
|
|
1364
|
-
(_(), z(u, {
|
|
1365
|
-
style: Bt(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
|
-
n(ta, {
|
|
1376
|
-
row: V,
|
|
1377
|
-
onRowClick: i(f).promptShowTransferDetails
|
|
1378
|
-
}, {
|
|
1379
|
-
default: A((D) => {
|
|
1380
|
-
var pe, fe, ne, B, he, Re, Pe, Ue, ve, $e, Ae, Ee, Me, Ce, xe, ke, Oe, re, G, Ie;
|
|
1381
|
-
return [
|
|
1382
|
-
s("div", ts, [
|
|
1383
|
-
s("div", as, [
|
|
1384
|
-
n(i(W), {
|
|
1385
|
-
render: (ne = (fe = (pe = D._id) == null ? void 0 : pe.column) == null ? void 0 : fe.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
|
-
n(i(W), {
|
|
1391
|
-
render: (Ue = (Pe = (Re = D.supplier_name) == null ? void 0 : Re.column) == null ? void 0 : Pe.columnDef) == null ? void 0 : Ue.cell,
|
|
1392
|
-
props: ($e = (ve = D.supplier_name) == null ? void 0 : ve.getContext) == null ? void 0 : $e.call(ve)
|
|
1393
|
-
}, null, 8, ["render", "props"])
|
|
1394
|
-
]),
|
|
1395
|
-
s("div", ss, Z(V.original.items.map((_e) => `${_e.name}`).join(", ")), 1),
|
|
1396
|
-
V.original.ref ? (_(), P("div", ls, [
|
|
1397
|
-
n(i(W), {
|
|
1398
|
-
render: (Me = (Ee = (Ae = D.ref) == null ? void 0 : Ae.column) == null ? void 0 : Ee.columnDef) == null ? void 0 : Me.cell,
|
|
1399
|
-
props: (xe = (Ce = D.ref) == null ? void 0 : Ce.getContext) == null ? void 0 : xe.call(Ce)
|
|
1400
|
-
}, null, 8, ["render", "props"])
|
|
1401
|
-
])) : L("", !0),
|
|
1402
|
-
s("div", ns, [
|
|
1403
|
-
n(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
|
-
n(Qo, Yt(i(f).transferDialogProps.value, {
|
|
1419
|
-
onSubmitted: i(f).fetchData
|
|
1420
|
-
}), null, 16, ["onSubmitted"]),
|
|
1421
|
-
n(va, Yt(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
|
-
};
|