@feedmepos/mf-inventory-portal 0.0.22-dev.33 → 0.0.22-dev.34

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 (43) hide show
  1. package/dist/{ApprovalView-CKBg-CUO.js → ApprovalView-2pX2IV1F.js} +9 -10
  2. package/dist/{BindingsDialog-BHQkDST3.js → BindingsDialog-EyImpE9g.js} +1 -1
  3. package/dist/{BindingsPicker-DtGzKn9l.js → BindingsPicker-CbBNBcWW.js} +1 -1
  4. package/dist/{BindingsTable-CSKzOCxK.js → BindingsTable-CJeV7Dd2.js} +1 -1
  5. package/dist/{ClosingTemplateView-CcO_vSoD.js → ClosingTemplateView-BDEooji1.js} +5 -5
  6. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DZtc5R4Z.js +266 -0
  7. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CC55eT4X.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-z-BBBTkh.js} +1 -1
  8. package/dist/{IngredientsView-DKf2RyTT.js → IngredientsView-BvKaI0nb.js} +3 -3
  9. package/dist/{IntegrationView-IT9fT1o3.js → IntegrationView-1lXCciJp.js} +120 -120
  10. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BfQYvMQo.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bgd922-L.js} +1 -1
  11. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-Bexig132.js +116 -0
  12. package/dist/{PurchaseOrderPrintPreview-CmUwBVJj.js → PurchaseOrderPrintPreview-036mLqRD.js} +1 -1
  13. package/dist/ReceiveRequestView-BGlxEJkh.js +1626 -0
  14. package/dist/{RecipeView-DoVjHcdn.js → RecipeView-BuiA-2uY.js} +3 -3
  15. package/dist/{StockView-0e2NTA6y.js → StockView-BKX6NX-g.js} +14 -15
  16. package/dist/{SupplierView-Kp_qdI0x.js → SupplierView-Ck5hH5gT.js} +3 -3
  17. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DFDc3P3S.js +1139 -0
  18. package/dist/TransferTemplateView-ByYEje9E.js +1237 -0
  19. package/dist/{UnitView-Bn4Di9oJ.js → UnitView-DB2hQFMC.js} +4 -4
  20. package/dist/{WarehouseView-D_UpeFJI.js → WarehouseView-CFJiuhpx.js} +2 -2
  21. package/dist/{app-Cp8AtZVK.js → app-Z9P39kGh.js} +31 -31
  22. package/dist/app.js +1 -1
  23. package/dist/{decimal-BdGSddMR.js → decimal-DIe_fFDH.js} +1 -1
  24. package/dist/{defineDeepModel-BmWycBqN.js → defineDeepModel-DH8vhBpR.js} +3 -3
  25. package/dist/format-time-from-id-CAjL4U2X.js +15 -0
  26. package/dist/purchase-order-transaction-type-BJDnbhdk.js +338 -0
  27. package/dist/{supplier-nSbJROl8.js → supplier-wJJ7ATk2.js} +1 -1
  28. package/dist/tsconfig.app.tsbuildinfo +1 -1
  29. package/dist/{use-template-enabled-locations-2-DHQhRyhX.js → use-template-enabled-locations-2-CeSeHnX0.js} +1 -1
  30. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  31. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  32. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +5 -8
  33. package/dist/{xlsx-CyyozDQ4.js → xlsx-DrDljHnF.js} +1 -1
  34. package/dist/{xlsx.util-io3Y9wY0.js → xlsx.util-BwF0vRjF.js} +2 -2
  35. package/package.json +1 -1
  36. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-B1Hplfop.js +0 -88
  37. package/dist/ReceiveRequestView-CowLFbXJ.js +0 -215
  38. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-pOCLtZSW.js +0 -858
  39. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-YgNt1e4d.js +0 -1678
  40. package/dist/TransferTemplateView-DnZqm1NS.js +0 -1244
  41. package/dist/format-time-from-id-bNKNgPR2.js +0 -15
  42. package/dist/id-to-date-uL3PyIfz.js +0 -30
  43. package/dist/purchase-order-transaction-type-DQvXZvHo.js +0 -685
@@ -0,0 +1,338 @@
1
+ import { F as C, D as w, R as h } from "./row-action.enum-PMKMRrZR.js";
2
+ import { c as O } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
3
+ import { o as x, u as S, c as D, ao as P, z as B, j as M, a as L } from "./app-Z9P39kGh.js";
4
+ import { f as z } from "./format-time-from-id-CAjL4U2X.js";
5
+ import { useCoreStore as K, useI18n as j } from "@feedmepos/mf-common";
6
+ import { useDialog as V, useSnackbar as H, FmButtonVariant as R, components as U } from "@feedmepos/ui-library";
7
+ import { defineStore as q } from "pinia";
8
+ import { ref as b, h as A } from "vue";
9
+ import { useRouter as G } from "vue-router";
10
+ const F = x((t, a) => {
11
+ function o() {
12
+ var l;
13
+ return `business_${((l = K().currentBusiness.value) == null ? void 0 : l._id) ?? ""}`;
14
+ }
15
+ return {
16
+ async getTemplate(n) {
17
+ const r = o(), l = `${t.inventoryBackendUrl}/${r}/purchase-order-template/${n}`;
18
+ return a.get(l);
19
+ },
20
+ async readTemplates() {
21
+ const n = o(), r = `${t.inventoryBackendUrl}/${n}/purchase-order-template`;
22
+ return a.get(r);
23
+ },
24
+ async createTemplate(n) {
25
+ const r = o(), l = `${t.inventoryBackendUrl}/${r}/purchase-order-template`;
26
+ return a.post(l, n);
27
+ },
28
+ async updateTemplate(n) {
29
+ const r = o(), l = `${t.inventoryBackendUrl}/${r}/purchase-order-template`;
30
+ return a.put(l, n);
31
+ },
32
+ async deleteTemplate(n) {
33
+ const r = o(), l = `${t.inventoryBackendUrl}/${r}/purchase-order-template`;
34
+ return a.delete(l, { _id: n._id, _rev: n._rev });
35
+ }
36
+ };
37
+ });
38
+ function I(t) {
39
+ const a = S(), o = t.sku, n = a.skuById[o._id];
40
+ if (n.unit._id !== o.unit._id) return !0;
41
+ const r = t.measurement;
42
+ return r ? !a.unitById[n.unit._id].measurements.find((v) => v.id === r.id) : !1;
43
+ }
44
+ const J = q("transferTemplateActions", () => {
45
+ const t = V(), a = H(), o = F(), n = G(), r = b({});
46
+ function l() {
47
+ r.value = {
48
+ mode: C.CREATE,
49
+ show: !0,
50
+ "onUpdate:show"(e) {
51
+ r.value.show = e;
52
+ }
53
+ };
54
+ }
55
+ function m(e) {
56
+ r.value = {
57
+ mode: C.UPDATE,
58
+ modelValue: e,
59
+ show: !0,
60
+ "onUpdate:show"(i) {
61
+ r.value.show = i;
62
+ }
63
+ };
64
+ }
65
+ function v(e, i, f) {
66
+ t.open({
67
+ title: `Confirm deleting template ${e.name}?`,
68
+ message: "Deleted template can no longer be retrieved",
69
+ primaryActions: {
70
+ text: "Delete",
71
+ variant: R.Destructive,
72
+ close: !0
73
+ },
74
+ secondaryActions: {
75
+ text: "Cancel",
76
+ variant: R.Plain,
77
+ close: !0
78
+ }
79
+ }).onPrimary(async () => {
80
+ a.open({
81
+ title: `Deleting ${e.name}`,
82
+ type: "info"
83
+ });
84
+ try {
85
+ i.value = !0;
86
+ const [d] = await Promise.allSettled([
87
+ o.deleteTemplate(e),
88
+ new Promise((u) => setTimeout(u, 1e3))
89
+ ]);
90
+ if (d.status === "rejected") throw d.reason;
91
+ a.open({
92
+ title: `Deleted ${e.name}`,
93
+ type: "success"
94
+ });
95
+ } catch (d) {
96
+ a.open({
97
+ title: `Unable to delete ${e.name}`,
98
+ message: `See error from server: ${d}`,
99
+ type: "error"
100
+ }), console.error("error on deleting purchase order template", d);
101
+ } finally {
102
+ i.value = !1, f();
103
+ }
104
+ });
105
+ }
106
+ const p = b({});
107
+ function _(e) {
108
+ p.value = {
109
+ template: e,
110
+ show: !0,
111
+ "onUpdate:show"(i) {
112
+ p.value.show = i;
113
+ },
114
+ "onAction:edit"() {
115
+ p.value.show = !1, m(D(e));
116
+ }
117
+ };
118
+ }
119
+ function s(e) {
120
+ const i = M(), { promise: f, resolve: d } = Promise.withResolvers(), u = (c) => {
121
+ d(c);
122
+ }, $ = e.filter(
123
+ (c) => {
124
+ var g;
125
+ return (!c.locations || c.locations.find((E) => E.doc._id === i.currentLocation.doc._id)) && ((g = c.purchaseOrder.supplier) == null ? void 0 : g._id) !== i.currentLocation.doc._id;
126
+ }
127
+ );
128
+ if (!$.length)
129
+ return t.open({
130
+ title: "Select one template",
131
+ message: "There is no available template in your business. Configure a new template?",
132
+ primaryActions: {
133
+ text: "Close",
134
+ close: !0
135
+ },
136
+ secondaryActions: {
137
+ text: "Close",
138
+ close: !0
139
+ }
140
+ }).onPrimary(() => {
141
+ n.push({ name: P.TRANSFER_TEMPLATE }), u(void 0);
142
+ }).onSecondary(() => u(void 0)).onClose(() => u(void 0)), f;
143
+ const N = $.map((c) => {
144
+ const g = !c.purchaseOrder.items.length || c.purchaseOrder.items.some(I);
145
+ return {
146
+ label: c.name,
147
+ value: c._id,
148
+ disabled: g,
149
+ sublabel: g ? "This template is invalid. Update this template." : void 0
150
+ };
151
+ });
152
+ return t.open({
153
+ title: "Select one template",
154
+ contentComponent: B,
155
+ contentComponentProps: {
156
+ items: N,
157
+ singleSelect: !0
158
+ },
159
+ primaryActions: {
160
+ text: "Confirm",
161
+ close: !0
162
+ },
163
+ secondaryActions: {
164
+ text: "Close",
165
+ close: !0
166
+ },
167
+ tertiaryActions: {
168
+ text: "Templates",
169
+ close: !0
170
+ }
171
+ }).onPrimary((c) => Array.isArray(c) ? u(c[0]) : null).onSecondary(() => u(void 0)).onTertiary(() => {
172
+ n.push({ name: P.TRANSFER_TEMPLATE }), u(void 0);
173
+ }).onClose(() => u(void 0)), f;
174
+ }
175
+ return {
176
+ createTemplate: l,
177
+ viewTemplate: _,
178
+ updateTemplate: m,
179
+ deleteTemplate: v,
180
+ getTemplateId: s,
181
+ templateDialogProps: r,
182
+ templateDetailsProps: p
183
+ };
184
+ });
185
+ function k(t) {
186
+ const { skuById: a } = S(), o = D(t);
187
+ return o.purchaseOrder.items = t.purchaseOrder.items.filter((n) => a[n.sku._id]), o;
188
+ }
189
+ const y = b(!1), T = b(new Array());
190
+ function ae() {
191
+ const { t } = j(), { viewTemplate: a, updateTemplate: o, deleteTemplate: n } = J(), r = F(), l = S();
192
+ async function m() {
193
+ T.value = [], y.value = !0;
194
+ try {
195
+ const [s] = await Promise.all([
196
+ r.readTemplates(),
197
+ l.readInventory()
198
+ ]).delayed(1e3);
199
+ T.value = s.map(k);
200
+ } catch (s) {
201
+ console.log("Something went wrong when fetching templates:", s);
202
+ } finally {
203
+ y.value = !1;
204
+ }
205
+ }
206
+ async function v(s) {
207
+ if (!T.value.find((e) => e._id)) {
208
+ y.value = !0;
209
+ try {
210
+ T.value = [
211
+ await r.getTemplate(s).then(k).delayed(1e3)
212
+ ];
213
+ } catch (e) {
214
+ console.log("Something went wrong when fetching templates:", e);
215
+ } finally {
216
+ y.value = !1;
217
+ }
218
+ }
219
+ }
220
+ function p(s, e) {
221
+ switch (e = D(e), s) {
222
+ case h.Details:
223
+ return a(e);
224
+ case h.Edit:
225
+ return o(e);
226
+ case h.Delete:
227
+ return n(e, y, m);
228
+ }
229
+ }
230
+ return {
231
+ columnDefs: [
232
+ {
233
+ id: "_id",
234
+ accessorKey: "_id",
235
+ header: () => t("inventory.transfer.table.createdAt"),
236
+ cell(s) {
237
+ return z(`${s.getValue()}`);
238
+ },
239
+ enableSorting: !0
240
+ },
241
+ {
242
+ id: "name",
243
+ accessorKey: "name",
244
+ header: () => t("inventory.transfer.table.name"),
245
+ enableSorting: !0,
246
+ size: 200
247
+ },
248
+ {
249
+ id: "noOfItems",
250
+ accessorKey: "purchaseOrder.items.length",
251
+ header: () => t("inventory.transfer.table.noOfItems"),
252
+ enableSorting: !1,
253
+ meta: {
254
+ width: "10rem",
255
+ textAlign: "right"
256
+ },
257
+ cell(s) {
258
+ const e = Number(s.getValue()) || 0, i = s.row.original.purchaseOrder.items.some(I);
259
+ return e === 0 || i ? A("div", { class: "flex justify-end gap-4 items-center" }, [
260
+ A(
261
+ U.FmTooltip,
262
+ {},
263
+ {
264
+ content() {
265
+ return i ? "The template is invalid due to invalid unit on some of the items. Please update this template." : "The template is invalid due to deleted ingredients. Please update this template.";
266
+ },
267
+ default() {
268
+ return A(U.FmIcon, {
269
+ name: "error",
270
+ color: "system-error-300",
271
+ size: "sm"
272
+ });
273
+ }
274
+ }
275
+ ),
276
+ e
277
+ ]) : e;
278
+ }
279
+ },
280
+ {
281
+ id: "enabledLocations",
282
+ accessorKey: "purchaseOrder.locations.length",
283
+ header: () => "Enabled outlets",
284
+ cell(s) {
285
+ var i;
286
+ const e = (i = s.row.original.locations) == null ? void 0 : i.length;
287
+ return e ? `${e}` : "All";
288
+ },
289
+ enableSorting: !1,
290
+ meta: {
291
+ width: "10rem",
292
+ textAlign: "right"
293
+ }
294
+ },
295
+ {
296
+ id: "ref",
297
+ accessorKey: "purchaseOrder.ref",
298
+ header: () => t("inventory.transfer.table.reference"),
299
+ enableSorting: !1,
300
+ size: "auto"
301
+ },
302
+ {
303
+ id: "action",
304
+ cell(s) {
305
+ const e = s.row.original, i = [
306
+ w[h.Details],
307
+ w[h.Edit],
308
+ w[h.Delete]
309
+ ];
310
+ return O(i, (f) => p(f, e));
311
+ },
312
+ enableSorting: !1,
313
+ size: 40,
314
+ meta: {
315
+ cellClass: "",
316
+ headerClass: ""
317
+ }
318
+ }
319
+ ],
320
+ templates: T,
321
+ loading: y,
322
+ fetchTemplates: m,
323
+ loadTemplate: v
324
+ };
325
+ }
326
+ function se(t, a, o) {
327
+ const n = (o == null ? void 0 : o.abbrev) ?? a.abbrev;
328
+ return `${L(t, !1)} ${n}`;
329
+ }
330
+ var Q = /* @__PURE__ */ ((t) => (t.PURCHASE = "PURCHASE", t.TRANSFER = "TRANSFER", t))(Q || {});
331
+ export {
332
+ Q as P,
333
+ F as a,
334
+ J as b,
335
+ se as f,
336
+ I as t,
337
+ ae as u
338
+ };
@@ -1,4 +1,4 @@
1
- import { o as S, j as u, V as m, W as y } from "./app-Cp8AtZVK.js";
1
+ import { o as S, j as u, V as m, W as y } from "./app-Z9P39kGh.js";
2
2
  import { useCoreStore as c } from "@feedmepos/mf-common";
3
3
  import { defineStore as b } from "pinia";
4
4
  import { ref as l, computed as v } from "vue";