@feedmepos/mf-inventory-portal 0.0.19-dev.14 → 0.0.19-dev.15

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.
Files changed (38) hide show
  1. package/dist/{ApprovalView-BY13XuOu.js → ApprovalView-CRHU3Bv0.js} +5 -5
  2. package/dist/{BindingsDialog-B3PP-XkE.js → BindingsDialog-ChIRg0d3.js} +1 -1
  3. package/dist/{BindingsPicker-DL17pRty.js → BindingsPicker-BJAbeiDf.js} +1 -1
  4. package/dist/{BindingsTable-CjKOv7Yw.js → BindingsTable-5MxWD_qa.js} +1 -1
  5. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DoF7wwNT.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0j4VOis.js} +1 -1
  6. package/dist/{IngredientsView-C-rsKAsF.js → IngredientsView-qXrDtzSK.js} +4 -4
  7. package/dist/{IntegrationView-BkhfPSjM.js → IntegrationView-D6yFqod1.js} +2 -2
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Buc21sEN.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DGurlvYg.js} +1 -1
  9. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BRijSilS.js → PremiumBadge.vue_vue_type_script_setup_true_lang-2Ady4pB4.js} +1 -1
  10. package/dist/{PurchaseOrderPrintPreview-CGMMozPA.js → PurchaseOrderPrintPreview-BWwjMRqb.js} +1 -1
  11. package/dist/{ReceiveRequestView-Bk0pUeEm.js → ReceiveRequestView-C94SWDaj.js} +7 -7
  12. package/dist/{RecipeView-kzA9kIg8.js → RecipeView-CG9H_ZOo.js} +4 -4
  13. package/dist/{StockView-DF-ucES_.js → StockView-BdXGfDNl.js} +7 -7
  14. package/dist/{SupplierView-XlzsU00G.js → SupplierView-ClL2oc8K.js} +4 -4
  15. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Bp7AJiJ-.js → TransferDetails.vue_vue_type_script_setup_true_lang-DktBkwCx.js} +4 -4
  16. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BE95F9r1.js +1437 -0
  17. package/dist/{TransferTemplateView-CsA2SzQY.js → TransferTemplateView-BXrNS8pg.js} +26 -26
  18. package/dist/{UnitView-9VMIlEZ_.js → UnitView-Dx2vWJXi.js} +5 -5
  19. package/dist/{WarehouseView-JTYLFBsu.js → WarehouseView-UkmUZnqH.js} +3 -3
  20. package/dist/{app-kYGuBDV8.js → app-BLzTa0Ut.js} +4782 -4760
  21. package/dist/app.js +1 -1
  22. package/dist/components/FmMultiselectDialogProps.d.ts +3 -1
  23. package/dist/{decimal-E3w4eGHF.js → decimal-DLYVb_I_.js} +1 -1
  24. package/dist/format-unit-display-D_Z4TNZd.js +668 -0
  25. package/dist/{id-to-date-gyR82hWy.js → id-to-date-CKplrnj_.js} +1 -1
  26. package/dist/{layout-BTYR4n3X.js → layout-B9sdKjL9.js} +1 -1
  27. package/dist/stores/feature.d.ts +1 -0
  28. package/dist/stores/location.d.ts +4 -0
  29. package/dist/{supplier-Ed-Bva_-.js → supplier-BZ6HZcYB.js} +1 -1
  30. package/dist/tsconfig.app.tsbuildinfo +1 -1
  31. package/dist/views/receive-request/components/select-template-dialog/SelectTemplateDialog.vue.d.ts +8 -0
  32. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -1
  33. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1 -1
  34. package/dist/{xlsx-q6Ctgevr.js → xlsx-C3AV6UrJ.js} +1 -1
  35. package/dist/{xlsx.util-Cvqg56mI.js → xlsx.util-slrhXhsk.js} +2 -2
  36. package/package.json +1 -1
  37. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-D1NAkXMT.js +0 -1690
  38. package/dist/purchase-order-transaction-type-CUtdDhYo.js +0 -299
@@ -1,299 +0,0 @@
1
- import { n as j, j as $, ag as l, a7 as x, J as H, K as q, ah as Y, c as V, ad as W, w as G, b as J, a as K } from "./app-kYGuBDV8.js";
2
- import { ref as h, computed as Q } from "vue";
3
- import { i as Z } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DoF7wwNT.js";
4
- import { F as C } from "./row-action.enum-PMKMRrZR.js";
5
- import { useDialog as z, useSnackbar as X } from "@feedmepos/ui-library";
6
- const ee = j((a, t) => {
7
- const n = $();
8
- return {
9
- async readRequests(o) {
10
- const c = o ?? n.currentLocationDBName, s = `${a.inventoryBackendUrl}/${c}/purchase-request`;
11
- return await t.get(s);
12
- },
13
- async getPurchaseOrders({
14
- start: o,
15
- end: c
16
- }) {
17
- const s = n.currentLocationDBName, d = `${a.inventoryBackendUrl}/${s}/purchase-order`;
18
- return await t.get(`${d}?start=${o}&end=${c}`);
19
- },
20
- async getPurchaseOrderById(o) {
21
- const c = n.currentLocationDBName, s = `${a.inventoryBackendUrl}/${c}/purchase-order`;
22
- return await t.get(`${s}/${o}`);
23
- },
24
- async processPurchaseOrder(o, c) {
25
- const s = n.currentLocationDBName, d = c || s, p = `${a.inventoryBackendUrl}/${d}/purchase-order/run-operation`;
26
- return await t.put(p, o);
27
- },
28
- async createPurchaseOrder(o) {
29
- const c = n.currentLocationDBName, s = `${a.inventoryBackendUrl}/${c}/purchase-order`;
30
- return await t.post(s, o);
31
- },
32
- async updatePurchaseOrder(o) {
33
- const c = n.currentLocationDBName, s = `${a.inventoryBackendUrl}/${c}/purchase-order`;
34
- return await t.put(s, o);
35
- }
36
- };
37
- }), re = {
38
- [l.enum.confirmDraft]: {
39
- primaryActions: {
40
- text: "Confirm draft",
41
- close: !0
42
- },
43
- title: "Confirm draft?",
44
- message: "Purchase order cannot be changed after confirm draft.",
45
- successMessage: "Purchase order draft has been confirmed"
46
- },
47
- [l.enum.cancelDraft]: {
48
- primaryActions: {
49
- text: "Cancel draft",
50
- close: !0,
51
- variant: "destructive"
52
- },
53
- title: "Cancel draft?",
54
- message: "Purchase order cannot be changed after cancelled draft.",
55
- successMessage: "Purchase order draft has been cancelled"
56
- },
57
- [l.enum.submitRequest]: {
58
- primaryActions: {
59
- text: "Submit request",
60
- close: !0
61
- },
62
- title: "Confirm draft?",
63
- message: "Purchase order cannot be changed after confirm draft.",
64
- successMessage: "Purchase order draft has been submitted"
65
- },
66
- [l.enum.completeReceive]: {
67
- primaryActions: {
68
- text: "Mark received",
69
- close: !0
70
- },
71
- title: "Mark as received",
72
- message: "Purchase order cannot be changed after it has complete receiving.",
73
- successMessage: "Purchase order has been marked as received"
74
- },
75
- [l.enum.approveRequest]: {
76
- primaryActions: {
77
- text: "Approve request",
78
- close: !0
79
- },
80
- title: "Approve request?",
81
- message: "Purchase order will be approved.",
82
- successMessage: "Purchase order has been approved"
83
- },
84
- [l.enum.rejectRequest]: {
85
- primaryActions: {
86
- text: "Reject request",
87
- close: !0,
88
- variant: "destructive"
89
- },
90
- title: "Reject request?",
91
- message: "Purchase order will be rejected.",
92
- successMessage: "Purchase order has been rejected"
93
- }
94
- };
95
- function ue(a) {
96
- const t = O(a);
97
- return t === null ? "" : x(t);
98
- }
99
- function O(a) {
100
- const t = a.match(/\w+_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z).*/);
101
- if (!t) return null;
102
- const n = /* @__PURE__ */ new Date(`${t[1]}`);
103
- return isNaN(n.getTime()) ? null : n;
104
- }
105
- function ie(a, t) {
106
- const n = z(), o = $(), c = J(), s = h(!1), d = X(), p = ee(), y = h(new Array()), P = h(
107
- t != null && t.startDate && (t != null && t.endDate) ? t : Z()
108
- ), E = Q(() => {
109
- const r = new Date(P.value.startDate), e = new Date(P.value.endDate);
110
- return {
111
- start: H(r).toISOString(),
112
- end: q(e).toISOString()
113
- };
114
- }), D = h(new Array()), T = Y(), S = h(null), g = h();
115
- function U(r) {
116
- const e = {
117
- mode: C.CREATE,
118
- modelValue: r || void 0,
119
- show: !0,
120
- "onUpdate:show"(u) {
121
- g.value.show = u;
122
- },
123
- lastClosingDate: S.value
124
- };
125
- g.value = e;
126
- }
127
- function M(r) {
128
- const e = {
129
- mode: C.UPDATE,
130
- modelValue: V(r),
131
- show: !0,
132
- "onUpdate:show"(u) {
133
- g.value.show = u;
134
- },
135
- lastClosingDate: S.value
136
- };
137
- g.value = e;
138
- }
139
- async function B() {
140
- y.value = [], s.value = !0;
141
- try {
142
- y.value = await p.getPurchaseOrders(E.value).then((u) => u.sort((i, m) => m._id.localeCompare(i._id)));
143
- const r = await T.readLastClosing(!0), e = r == null ? void 0 : r._id;
144
- e && (S.value = O(e));
145
- } catch {
146
- d.open({
147
- title: "Something went wrong",
148
- message: "Error at fetching purchase orders",
149
- type: "error"
150
- });
151
- } finally {
152
- s.value = !1;
153
- }
154
- }
155
- async function _() {
156
- D.value = [], s.value = !0;
157
- try {
158
- D.value = await p.readRequests();
159
- } catch {
160
- d.open({
161
- title: "Something went wrong",
162
- message: "Error at fetching purchase requests",
163
- type: "error"
164
- });
165
- } finally {
166
- s.value = !1;
167
- }
168
- }
169
- function w() {
170
- switch (a) {
171
- case "receive/request":
172
- return B();
173
- case "approval":
174
- return _();
175
- }
176
- }
177
- function k(r, e) {
178
- P.value = {
179
- startDate: r,
180
- endDate: e
181
- }, w();
182
- }
183
- o.watchLocation(async (r) => {
184
- if (!r) {
185
- y.value = [];
186
- return;
187
- }
188
- await w();
189
- });
190
- const v = h(), N = h(Math.random().toString());
191
- async function F(r, e) {
192
- var f, b;
193
- const u = Math.random().toString();
194
- N.value = u;
195
- const i = a === "receive/request" ? o.currentLocation : e == null ? void 0 : e.to, m = {
196
- purchaseOrder: r,
197
- transferTo: i == null ? void 0 : i.name,
198
- transferToDbName: i == null ? void 0 : i.dbName,
199
- show: !0,
200
- canResubmit: !1,
201
- canApprove: a === "approval",
202
- "onUpdate:show"(A) {
203
- v.value.show = A;
204
- }
205
- };
206
- if (v.value = m, !(e || r.status !== W.enum.REQUESTING)) {
207
- try {
208
- e = (await p.readRequests(
209
- `${r.supplier.internal}_${r.supplier._id}`
210
- )).find((R) => R.purchaseOrderId === r._id);
211
- } catch {
212
- console.error("Error at fetching po request to check");
213
- }
214
- u === N.value && (v.value.canResubmit = !e, v.value.transferTo = (f = e == null ? void 0 : e.to) == null ? void 0 : f.name, v.value.transferToDbName = (b = e == null ? void 0 : e.to) == null ? void 0 : b.dbName);
215
- }
216
- }
217
- async function L(r, e, u, i) {
218
- s.value = !0;
219
- try {
220
- await p.processPurchaseOrder(
221
- {
222
- operation: e,
223
- doc: r,
224
- options: (
225
- // auto receive for supplier to warehouse
226
- (e === l.enum.confirmDraft || // auto receive for warehouse to warehouse
227
- e === l.enum.completeReceive) && c.autoReceiveWarehouse ? {
228
- autoReceive: !0
229
- } : void 0
230
- )
231
- },
232
- i
233
- ), await new Promise((b) => setTimeout(b, 1e3));
234
- const f = $().currentLocationDBName.startsWith("restaurant_");
235
- e === l.enum.confirmDraft && r.effectiveAt && f ? d.open({
236
- title: "Success",
237
- message: `${u}. The backdate will be reflected once your POS has received this change.`,
238
- type: "success"
239
- }) : d.open({
240
- title: "Success",
241
- message: u,
242
- type: "success"
243
- });
244
- } catch (m) {
245
- d.open({
246
- title: "Something went wrong",
247
- message: "Please try again.",
248
- type: "error"
249
- }), console.error("Error when submitting PO operation", e, r, m);
250
- } finally {
251
- s.value = !1, w();
252
- }
253
- }
254
- async function I(r, e, u) {
255
- const i = re[e];
256
- if (!i) {
257
- d.open({
258
- title: "Something went wrong",
259
- message: `Cannot process order: ${G(e)}`,
260
- type: "error"
261
- });
262
- return;
263
- }
264
- const { successMessage: m, ...f } = i;
265
- n.open({
266
- title: f.title,
267
- message: f.message,
268
- primaryActions: f.primaryActions
269
- }).onPrimary(() => {
270
- L(r, e, m, u);
271
- });
272
- }
273
- return {
274
- purchaseOrders: y,
275
- purchaseRequests: D,
276
- updateDateRange: k,
277
- fetchData: w,
278
- loading: s,
279
- transferDialogProps: g,
280
- promptCreateTransferDialog: U,
281
- promptUpdateTransferDialog: M,
282
- transferDetailsProps: v,
283
- promptShowTransferDetails: F,
284
- submitAction: I
285
- };
286
- }
287
- function de(a, t, n) {
288
- const o = (n == null ? void 0 : n.abbrev) ?? t.abbrev;
289
- return `${K(a, !1)} ${o}`;
290
- }
291
- var te = /* @__PURE__ */ ((a) => (a.PURCHASE = "PURCHASE", a.TRANSFER = "TRANSFER", a))(te || {});
292
- export {
293
- te as P,
294
- de as a,
295
- ee as b,
296
- re as d,
297
- ue as f,
298
- ie as u
299
- };