@feedmepos/mf-inventory-portal 0.0.22-dev.2 → 0.0.22-dev.21

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 (81) hide show
  1. package/dist/App.vue.d.ts +2 -0
  2. package/dist/{ApprovalView-D7WEr35k.js → ApprovalView-CCYykhrK.js} +14 -14
  3. package/dist/{BindingsDialog-C-3uO6pD.js → BindingsDialog-33VV_AST.js} +1 -1
  4. package/dist/{BindingsPicker-B3tGisCE.js → BindingsPicker-BKu4vN8J.js} +8 -8
  5. package/dist/{BindingsTable-CPtiH3vj.js → BindingsTable-Dd0h5gDf.js} +1 -1
  6. package/dist/ClosingTemplateView-BhevjTLl.js +1067 -0
  7. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ohHZLOuR.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-3gp56NNJ.js} +14 -16
  8. package/dist/{IngredientsView-D-EKGLq9.js → IngredientsView-DckIH9eR.js} +5 -6
  9. package/dist/{IntegrationView-BVAO_vch.js → IntegrationView-BqQ4jRIp.js} +2 -2
  10. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CJYmB7Ct.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Vi0q_bDz.js} +1 -1
  11. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BxkM-SOw.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BIL8LWRz.js} +1 -1
  12. package/dist/{PurchaseOrderPrintPreview-CP-mK62z.js → PurchaseOrderPrintPreview-Ct7daTTa.js} +1 -1
  13. package/dist/{ReceiveRequestView-x8WTvuDk.js → ReceiveRequestView-B4wHTogG.js} +25 -26
  14. package/dist/RecipeView-DuE4cXLz.js +590 -0
  15. package/dist/Standalone.vue.d.ts +2 -0
  16. package/dist/{StockView-SyWxT4Ee.js → StockView-Bn9v2Ix8.js} +602 -585
  17. package/dist/{SupplierView-a0HAZJau.js → SupplierView-C8rqHSOV.js} +37 -37
  18. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CStnY5Zh.js +851 -0
  19. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DRKiv_t8.js +1511 -0
  20. package/dist/TransferTemplateView-RM6Y-WL4.js +1209 -0
  21. package/dist/{UnitView-B3c7W5lw.js → UnitView-BXISVrop.js} +4 -4
  22. package/dist/{WarehouseView-DDV-yslF.js → WarehouseView-B055eB90.js} +18 -18
  23. package/dist/api/closing-template.d.ts +14 -0
  24. package/dist/api/inventory.d.ts +5 -7
  25. package/dist/api/netsuite.d.ts +46 -0
  26. package/dist/api/purchase-order-template.d.ts +0 -4
  27. package/dist/{app-DURkcZal.js → app-9algzyce.js} +16045 -15403
  28. package/dist/app.d.ts +6 -0
  29. package/dist/app.js +2 -2
  30. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  31. package/dist/components/FmUnitInputRules.d.ts +2 -0
  32. package/dist/{decimal-BGJlFDm8.js → decimal-CMuMGm4y.js} +1 -1
  33. package/dist/{defineDeepModel-pATZSiCT.js → defineDeepModel-CjPowyho.js} +1 -1
  34. package/dist/extensions/promises.d.ts +14 -0
  35. package/dist/{format-time-from-id-BCAuJEq2.js → format-time-from-id-DNKcbBFm.js} +1 -1
  36. package/dist/helper/date2.d.ts +1 -0
  37. package/dist/helper/rules.d.ts +7 -0
  38. package/dist/helper/rules.spec.d.ts +1 -0
  39. package/dist/{id-to-date-CVHmTOJk.js → id-to-date-C6W4aVdr.js} +1 -1
  40. package/dist/purchase-order-transaction-type-CscRvNAR.js +680 -0
  41. package/dist/stores/api.d.ts +1 -0
  42. package/dist/stores/feature.d.ts +0 -1
  43. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  44. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  45. package/dist/stores/inventory.d.ts +7 -0
  46. package/dist/stores/location.d.ts +24 -42
  47. package/dist/stores/netsuite.d.ts +56 -0
  48. package/dist/stores/route.d.ts +0 -5
  49. package/dist/stores/warehouse.d.ts +4 -7
  50. package/dist/style.css +1 -1
  51. package/dist/{supplier-DmBbGAwf.js → supplier-BiCX3dpL.js} +1 -1
  52. package/dist/tsconfig.app.tsbuildinfo +1 -1
  53. package/dist/use-template-enabled-locations-2-Dtg2qOTm.js +85 -0
  54. package/dist/views/closing-template/components/closing-template-publish/ClosingTemplatePublish.vue.d.ts +6 -0
  55. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +276 -84
  56. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +341 -85
  57. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  58. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +916 -0
  59. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  60. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +788 -152
  61. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +800 -164
  62. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  63. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -7
  64. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +2 -2
  65. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1285 -109
  66. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +399 -993
  67. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +345 -0
  68. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
  69. package/dist/{xlsx-1DLm6bBD.js → xlsx-fKJqx2Qc.js} +1 -1
  70. package/dist/{xlsx.util-DLtch7r5.js → xlsx.util-LOnzE3KS.js} +2 -2
  71. package/package.json +5 -5
  72. package/dist/ClosingTemplateView-Df0lgpjS.js +0 -928
  73. package/dist/RecipeView-BysIWI1W.js +0 -581
  74. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-ckp8gcT_.js +0 -740
  75. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BSvpuWY9.js +0 -1409
  76. package/dist/TransferTemplateView-BGi6zd6d.js +0 -1350
  77. package/dist/array-ClJzD_Lt.js +0 -30
  78. package/dist/layout/InventoryLayout.vue.d.ts +0 -2
  79. package/dist/layout/layout-routes.d.ts +0 -6
  80. package/dist/purchase-order-transaction-type-DvSpCSXr.js +0 -712
  81. package/dist/use-template-enabled-locations-BiuOdu1M.js +0 -57
@@ -0,0 +1,590 @@
1
+ import { defineComponent as Y, ref as x, onMounted as ie, resolveComponent as F, openBlock as E, createElementBlock as A, Fragment as re, createElementVNode as w, toDisplayString as ce, createVNode as g, createCommentVNode as K, computed as k, watch as ue, createBlock as T, withCtx as P, unref as y, isRef as Z, normalizeClass as de, normalizeStyle as me, Teleport as pe, normalizeProps as fe, guardReactiveProps as ve } from "vue";
2
+ import { u as I, c as G, S as ye, a as z, k as ee, R as ge, U as be, _ as _e, A as we, e as te, f as Re, j as he } from "./app-9algzyce.js";
3
+ import { useDialog as Ce, useSnackbar as se, useProxiedModel as ne, useBreakpoints as Ee } from "@feedmepos/ui-library";
4
+ import { i as xe, _ as Se } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
+ import { F as C, D as oe, R as L } from "./row-action.enum-PMKMRrZR.js";
6
+ import { _ as le, t as Fe, d as ke } from "./xlsx.util-LOnzE3KS.js";
7
+ import { defineStore as Ve, storeToRefs as De } from "pinia";
8
+ import { c as Ie, _ as $e, F as ae } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
+ import { useI18n as j } from "@feedmepos/mf-common";
10
+ import { u as Ae, _ as Pe, a as Be } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-3gp56NNJ.js";
11
+ const Te = {
12
+ key: 0,
13
+ class: "flex flex-col items-center w-full h-full gap-24"
14
+ }, Me = { key: 1 }, Ue = { key: 0 }, Ne = /* @__PURE__ */ Y({
15
+ __name: "DeleteDialog",
16
+ props: {
17
+ type: {},
18
+ data: {},
19
+ message: {},
20
+ bindedItems: {}
21
+ },
22
+ setup(R) {
23
+ const p = R, v = x(p.bindedItems || []), i = x(!1);
24
+ ie(() => {
25
+ l();
26
+ });
27
+ async function l() {
28
+ var c, r;
29
+ !i.value && ((c = p.data) != null && c._id) && (i.value = !0, v.value = await I().getAffectedMenu((r = p.data) == null ? void 0 : r._id), i.value = !1);
30
+ }
31
+ return (c, r) => {
32
+ const f = F("FmSpacer"), d = F("FmCircularProgress");
33
+ return E(), A(re, null, [
34
+ w("p", null, ce(c.message), 1),
35
+ i.value ? (E(), A("div", Te, [
36
+ g(f),
37
+ w("div", null, [
38
+ g(d, { size: "xl" })
39
+ ]),
40
+ r[0] || (r[0] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
41
+ g(f)
42
+ ])) : (E(), A("div", Me, [
43
+ r[2] || (r[2] = w("br", null, null, -1)),
44
+ v.value.length > 0 ? (E(), A("div", Ue, [
45
+ r[1] || (r[1] = w("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
46
+ g(le, {
47
+ name: "Menu",
48
+ bindings: v.value
49
+ }, null, 8, ["bindings"])
50
+ ])) : K("", !0)
51
+ ]))
52
+ ], 64);
53
+ };
54
+ }
55
+ }), q = Ve("recipeForm", function() {
56
+ const p = Ce(), v = se(), i = I(), l = x(!1), c = x();
57
+ function r() {
58
+ const t = {
59
+ recipe: {},
60
+ mode: C.CREATE,
61
+ show: !0,
62
+ "onUpdate:show"(a) {
63
+ c.value.show = a;
64
+ }
65
+ };
66
+ c.value = t;
67
+ }
68
+ async function f(t) {
69
+ const a = {
70
+ recipe: G(t),
71
+ mode: C.UPDATE,
72
+ show: !0,
73
+ "onUpdate:show"(e) {
74
+ c.value.show = e;
75
+ }
76
+ };
77
+ c.value = a;
78
+ }
79
+ async function d(t) {
80
+ l.value = !0;
81
+ try {
82
+ await i.deleteRecipe(t), v.open({
83
+ title: "Success",
84
+ message: `Deleted ${t.name}`,
85
+ type: "success"
86
+ });
87
+ } catch (a) {
88
+ a instanceof ye && xe(a) ? p.open({
89
+ title: "Cannot delete recipe",
90
+ contentComponent: Se,
91
+ contentComponentProps: {
92
+ subject: (t == null ? void 0 : t.name) ?? "",
93
+ items: a.errorResponse.message
94
+ },
95
+ secondaryActions: {
96
+ text: "Close",
97
+ close: !0
98
+ }
99
+ }) : console.log("unable to delete recipe", a), v.open({
100
+ title: `Cannot delete ${t == null ? void 0 : t.name}`,
101
+ message: "Please try again.",
102
+ type: "error"
103
+ }), console.error("failed to delete recipe", a);
104
+ } finally {
105
+ l.value = !1;
106
+ }
107
+ }
108
+ function u(t) {
109
+ p.open({
110
+ title: `Delete ${(t == null ? void 0 : t.name) ?? "recipe"}?`,
111
+ closeButton: !1,
112
+ primaryActions: {
113
+ text: "Delete",
114
+ close: !0,
115
+ variant: "destructive"
116
+ },
117
+ secondaryActions: {
118
+ text: "Cancel",
119
+ close: !0
120
+ },
121
+ contentComponent: Ne,
122
+ contentComponentProps: {
123
+ type: "menu",
124
+ data: t,
125
+ message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
126
+ }
127
+ }).onPrimary(() => d(t));
128
+ }
129
+ return {
130
+ createRecipe: r,
131
+ updateRecipe: f,
132
+ deleteRecipe: u,
133
+ recipeDialogProps: c,
134
+ recipeViewLoading: l
135
+ };
136
+ });
137
+ function Le() {
138
+ const { updateRecipe: R, deleteRecipe: p } = q(), v = I(), { t: i } = j();
139
+ async function l(d, u) {
140
+ const t = G(u);
141
+ if (d === L.Edit) {
142
+ await R(t);
143
+ return;
144
+ }
145
+ if (d === L.Delete) {
146
+ await p(t);
147
+ return;
148
+ }
149
+ }
150
+ function c(d, u) {
151
+ const t = d.filter((e) => e.type === ee.enum.SKU), a = d.filter((e) => e.type === ee.enum.RECIPE);
152
+ return [
153
+ ...t.map((e) => ({ ...e, recipeIds: [...u] })),
154
+ ...a.filter((e) => v.recipeById[e.id] && !u.has(e.id)).flatMap(
155
+ (e) => c(v.recipeById[e.id].contains, /* @__PURE__ */ new Set([...u, e.id]))
156
+ )
157
+ ];
158
+ }
159
+ const r = [
160
+ {
161
+ accessorKey: "recipe",
162
+ header: () => i("inventory.recipe.name"),
163
+ size: 400
164
+ },
165
+ {
166
+ accessorKey: "ingredients",
167
+ header: () => i("inventory.recipe.ingredients"),
168
+ size: "auto"
169
+ },
170
+ {
171
+ id: "action",
172
+ header: "",
173
+ cell(d) {
174
+ return Ie(
175
+ [oe[L.Edit], oe[L.Delete]],
176
+ (u) => {
177
+ l(u, d.row.original.original);
178
+ }
179
+ );
180
+ },
181
+ enableSorting: !1,
182
+ size: 40,
183
+ meta: {
184
+ cellClass: "",
185
+ headerClass: ""
186
+ }
187
+ }
188
+ ];
189
+ function f(d) {
190
+ const u = I();
191
+ return d.map((t) => ({
192
+ recipe: t.name,
193
+ ingredients: c(t.contains, /* @__PURE__ */ new Set([t._id])).map((a) => {
194
+ var b, _, s, m, h;
195
+ const e = u.skuById[a.id];
196
+ return e ? a.recipeIds.slice(1).length ? `(linked recipe ${(b = u.recipeById[a.recipeIds.at(-1) ?? ""]) == null ? void 0 : b.name}) ${e.name} (${z(a.amount)}${((_ = a.measurement) == null ? void 0 : _.abbrev) ?? ((s = e == null ? void 0 : e.unit) == null ? void 0 : s.abbrev)})` : `${e.name} (${z(a.amount)}${((m = a.measurement) == null ? void 0 : m.abbrev) ?? ((h = e == null ? void 0 : e.unit) == null ? void 0 : h.abbrev)})` : null;
197
+ }).filter((a) => a).join(", "),
198
+ original: t
199
+ }));
200
+ }
201
+ return { columnDefs: r, formatRowData: f };
202
+ }
203
+ const ze = { class: "flex flex-col gap-40" }, Ye = {
204
+ key: 0,
205
+ class: "col-span-2 mt-16 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
206
+ }, je = {
207
+ key: 0,
208
+ class: "flex flex-col items-center w-full h-full gap-24"
209
+ }, He = { key: 1 }, Ke = /* @__PURE__ */ Y({
210
+ __name: "RecipeForm",
211
+ props: {
212
+ mode: {},
213
+ modelValue: {},
214
+ disabled: { type: Boolean }
215
+ },
216
+ emits: ["update:modelValue", "click:submit"],
217
+ setup(R, { expose: p, emit: v }) {
218
+ var h;
219
+ const i = R, l = v, { t: c } = j(), r = k({
220
+ get() {
221
+ var n;
222
+ return ((n = i.modelValue) == null ? void 0 : n.name) ?? "";
223
+ },
224
+ set(n) {
225
+ const o = i.modelValue ?? {};
226
+ o.name = n, l("update:modelValue", o);
227
+ }
228
+ }), f = k({
229
+ get() {
230
+ var n;
231
+ return ((n = i.modelValue) == null ? void 0 : n.contains) ?? [];
232
+ },
233
+ set(n) {
234
+ const o = i.modelValue ?? {};
235
+ o.contains = n, l("update:modelValue", o);
236
+ }
237
+ });
238
+ function d() {
239
+ l("click:submit");
240
+ }
241
+ const u = x();
242
+ p({
243
+ validateInputs: () => {
244
+ var n, o;
245
+ (o = (n = u.value) == null ? void 0 : n.validateInputs) == null || o.call(n);
246
+ },
247
+ resetInputsValidation: () => {
248
+ var n, o;
249
+ (o = (n = u.value) == null ? void 0 : n.resetInputsValidation) == null || o.call(n);
250
+ },
251
+ resetInputs: () => {
252
+ var n, o;
253
+ (o = (n = u.value) == null ? void 0 : n.resetInputs) == null || o.call(n);
254
+ }
255
+ });
256
+ const t = I(), a = x([]), e = x(!1), b = x(!1);
257
+ ue(e, async (n) => {
258
+ _(n);
259
+ });
260
+ async function _(n) {
261
+ var o, V;
262
+ n && !b.value && ((o = i.modelValue) != null && o._id) && (b.value = !0, a.value = await t.getAffectedMenu((V = i.modelValue) == null ? void 0 : V._id), b.value = !1);
263
+ }
264
+ const s = k(
265
+ () => t.recipes.map((n) => ({ label: n.name, value: n.name }))
266
+ ), m = x((h = i.modelValue) == null ? void 0 : h.name);
267
+ return (n, o) => {
268
+ const V = F("FmTextField"), H = F("FmCard"), $ = F("FmSwitch"), D = F("FmSpacer"), M = F("FmCircularProgress"), U = F("FmForm");
269
+ return E(), T(U, {
270
+ ref_key: "formRef",
271
+ ref: u,
272
+ onValidationSuccess: d
273
+ }, {
274
+ default: P(() => [
275
+ w("div", ze, [
276
+ g(V, {
277
+ disabled: n.disabled,
278
+ label: y(c)("inventory.recipe.name"),
279
+ "model-value": r.value,
280
+ "onUpdate:modelValue": o[0] || (o[0] = (S) => r.value = S),
281
+ rules: [
282
+ y(ge)(),
283
+ y(be)(s.value, m.value, (S) => `[${S.value}] already exists`)
284
+ ],
285
+ "label-mark": "required"
286
+ }, null, 8, ["disabled", "label", "model-value", "rules"]),
287
+ g(H, {
288
+ variant: "outlined",
289
+ class: "p-16"
290
+ }, {
291
+ default: P(() => {
292
+ var S;
293
+ return [
294
+ g(_e, {
295
+ id: (S = n.modelValue) == null ? void 0 : S._id,
296
+ disabled: n.disabled,
297
+ "model-value": f.value,
298
+ "onUpdate:modelValue": o[1] || (o[1] = (B) => f.value = B),
299
+ rules: [y(we)(1)]
300
+ }, null, 8, ["id", "disabled", "model-value", "rules"])
301
+ ];
302
+ }),
303
+ _: 1
304
+ })
305
+ ]),
306
+ n.mode !== y(C).CREATE ? (E(), A("div", Ye, [
307
+ w("div", null, [
308
+ g($, {
309
+ label: "Show binded items",
310
+ modelValue: e.value,
311
+ "onUpdate:modelValue": o[2] || (o[2] = (S) => e.value = S),
312
+ "label-placement": "right",
313
+ disabled: b.value
314
+ }, null, 8, ["modelValue", "disabled"])
315
+ ]),
316
+ b.value ? (E(), A("div", je, [
317
+ g(D),
318
+ w("div", null, [
319
+ g(M, { size: "xl" })
320
+ ]),
321
+ o[3] || (o[3] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
322
+ g(D)
323
+ ])) : (E(), A("div", He, [
324
+ e.value && a.value.length ? (E(), T(le, {
325
+ key: 0,
326
+ name: "Menu",
327
+ bindings: a.value
328
+ }, null, 8, ["bindings"])) : K("", !0)
329
+ ]))
330
+ ])) : K("", !0)
331
+ ]),
332
+ _: 1
333
+ }, 512);
334
+ };
335
+ }
336
+ }), qe = { class: "flex gap-4" }, Ge = /* @__PURE__ */ Y({
337
+ __name: "RecipeDialog",
338
+ props: {
339
+ show: { type: Boolean },
340
+ recipe: {},
341
+ mode: { default: C.READ }
342
+ },
343
+ emits: ["update:show"],
344
+ setup(R) {
345
+ const p = R, v = I(), i = se(), { t: l } = j(), c = ne(p, "show"), r = ne(p, "recipe"), f = k(() => {
346
+ switch (p.mode) {
347
+ case C.READ:
348
+ return "";
349
+ case C.UPDATE:
350
+ return l("inventory.recipe.update.title");
351
+ case C.CREATE:
352
+ return l("inventory.recipe.create.title");
353
+ }
354
+ return "";
355
+ }), d = k(() => {
356
+ switch (p.mode) {
357
+ case C.READ:
358
+ return "";
359
+ case C.UPDATE:
360
+ return l("common.save");
361
+ case C.CREATE:
362
+ return l("common.add");
363
+ }
364
+ return "";
365
+ }), u = x(), t = x(!1);
366
+ async function a() {
367
+ t.value = !0;
368
+ try {
369
+ const s = G(r.value);
370
+ s.precision ?? (s.precision = 0), s.measurements ?? (s.measurements = []), await v.createRecipe(s), c.value = !1, i.open({
371
+ title: l("common.success"),
372
+ message: l("inventory.recipe.create.success", { name: r.value.name }),
373
+ type: "success"
374
+ });
375
+ } catch (s) {
376
+ s instanceof te || i.open({
377
+ title: l("inventory.recipe.create.error.title"),
378
+ message: l("inventory.recipe.create.error.message"),
379
+ type: "error"
380
+ });
381
+ } finally {
382
+ t.value = !1;
383
+ }
384
+ }
385
+ async function e() {
386
+ t.value = !0;
387
+ try {
388
+ await v.updateRecipe(r.value), c.value = !1, i.open({
389
+ title: l("common.success"),
390
+ message: l("inventory.recipe.update.success", { name: r.value.name }),
391
+ type: "success"
392
+ });
393
+ } catch (s) {
394
+ s instanceof te || i.open({
395
+ title: l("inventory.recipe.update.error.title"),
396
+ message: l("inventory.recipe.update.error.message"),
397
+ type: "error"
398
+ });
399
+ } finally {
400
+ t.value = !1;
401
+ }
402
+ }
403
+ function b() {
404
+ var s, m;
405
+ (m = (s = u.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
406
+ }
407
+ function _() {
408
+ switch (p.mode) {
409
+ case C.READ:
410
+ return;
411
+ case C.UPDATE:
412
+ return e();
413
+ case C.CREATE:
414
+ return a();
415
+ }
416
+ }
417
+ return (s, m) => {
418
+ const h = F("FmButton"), n = F("FmSideSheet");
419
+ return E(), T(n, {
420
+ "model-value": y(c),
421
+ "onUpdate:modelValue": m[3] || (m[3] = (o) => Z(c) ? c.value = o : null),
422
+ header: f.value,
423
+ "close-button": "",
424
+ "dismiss-away": "",
425
+ "max-width": 500
426
+ }, {
427
+ "side-sheet-footer": P(() => [
428
+ w("div", qe, [
429
+ g(h, {
430
+ loading: t.value,
431
+ label: d.value,
432
+ onClick: b
433
+ }, null, 8, ["loading", "label"]),
434
+ g(h, {
435
+ disabled: t.value,
436
+ label: y(l)("common.close"),
437
+ variant: "tertiary",
438
+ onClick: m[2] || (m[2] = (o) => c.value = !1)
439
+ }, null, 8, ["disabled", "label"])
440
+ ])
441
+ ]),
442
+ default: P(() => [
443
+ g(Ke, {
444
+ class: "w-full",
445
+ ref_key: "hasValidationExpose",
446
+ ref: u,
447
+ modelValue: y(r),
448
+ "onUpdate:modelValue": m[0] || (m[0] = (o) => Z(r) ? r.value = o : null),
449
+ mode: s.mode,
450
+ disabled: t.value,
451
+ "onClick:submit": m[1] || (m[1] = (o) => _())
452
+ }, null, 8, ["modelValue", "mode", "disabled"])
453
+ ]),
454
+ _: 1
455
+ }, 8, ["model-value", "header"]);
456
+ };
457
+ }
458
+ });
459
+ function Oe() {
460
+ const R = I(), p = R.recipes, v = R.recipeById, i = R.skuById, l = p.flatMap((f, d) => {
461
+ var u;
462
+ if ((u = f.contains) != null && u.length) {
463
+ const t = f.contains.filter((e) => e.type === "RECIPE"), a = f.contains.filter((e) => e.type === "SKU");
464
+ return [
465
+ ...d === 0 ? [] : [["", "", "", "", "", ""]],
466
+ ...t.map(
467
+ (e, b) => {
468
+ var _;
469
+ return [
470
+ b === 0 ? f.name : "",
471
+ "RECIPE",
472
+ "",
473
+ (_ = v[e.id]) == null ? void 0 : _.name,
474
+ z(e.amount),
475
+ "UNIT"
476
+ ];
477
+ }
478
+ ),
479
+ ...a.map(
480
+ (e, b) => {
481
+ var _, s, m, h;
482
+ return [
483
+ !t.length && b === 0 ? f.name : "",
484
+ "INGREDIENT",
485
+ (_ = i[e.id]) == null ? void 0 : _.code,
486
+ (s = i[e.id]) == null ? void 0 : s.name,
487
+ z(e.amount),
488
+ e.measurement ? e.measurement.abbrev : (h = (m = i[e.id]) == null ? void 0 : m.unit) == null ? void 0 : h.abbrev
489
+ ];
490
+ }
491
+ )
492
+ ];
493
+ }
494
+ return [
495
+ ...d === 0 ? [] : [["", "", "", "", "", ""]],
496
+ [f.name, "No bindings", "", "", "", ""]
497
+ ];
498
+ }), r = Fe(l, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
499
+ ke(r, `RECIPE_${Re(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
500
+ }
501
+ const Je = { class: "flex flex-col py-8" }, Qe = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, We = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = /* @__PURE__ */ Y({
502
+ __name: "RecipeView",
503
+ setup(R) {
504
+ const p = I(), v = k(() => p.recipes), i = he(), { createRecipe: l, updateRecipe: c } = q(), { recipeDialogProps: r, recipeViewLoading: f } = De(q()), { columnDefs: d, formatRowData: u } = Le(), t = k(() => u(v.value));
505
+ function a(o) {
506
+ o === "add" && l();
507
+ }
508
+ const e = x(""), b = k(() => f.value), { breakpoints: _ } = Ee(), s = k(() => _.value.xs || _.value.sm), m = k(() => s.value ? 10 : 20), h = Ae(), { t: n } = j();
509
+ return (o, V) => {
510
+ const H = F("FmTable");
511
+ return E(), T(Pe, {
512
+ title: y(n)("inventory.recipe.title"),
513
+ actions: [
514
+ {
515
+ label: y(n)("inventory.recipe.create.title"),
516
+ value: "add",
517
+ isPrimary: !0,
518
+ prependIcon: "add"
519
+ }
520
+ ],
521
+ "onClick:action": a
522
+ }, {
523
+ default: P(() => [
524
+ w("div", {
525
+ class: de([
526
+ "flex flex-col gap-8 max-h-full",
527
+ {
528
+ "p-0": s.value,
529
+ "px-24 ": !s.value
530
+ }
531
+ ])
532
+ }, [
533
+ g(Be, {
534
+ searchable: "",
535
+ search: e.value,
536
+ "onUpdate:search": V[0] || (V[0] = ($) => e.value = $),
537
+ actions: [{ icon: "ios_share", onClick: y(Oe) }]
538
+ }, null, 8, ["search", "actions"]),
539
+ (E(), T(H, {
540
+ style: me(y(h).tableHeight),
541
+ "column-defs": y(d),
542
+ "row-data": t.value,
543
+ "search-value": e.value,
544
+ loading: !y(i)._currentLocation || b.value,
545
+ onRowClick: V[1] || (V[1] = ($) => y(c)($.original.original)),
546
+ key: v.value.length,
547
+ "page-size": m.value
548
+ }, {
549
+ "list-row": P(($) => [
550
+ g($e, {
551
+ row: $,
552
+ onRowClick: (D) => y(c)(D.original)
553
+ }, {
554
+ default: P((D) => {
555
+ var M, U, S, B, O, J, Q, W, N, X;
556
+ return [
557
+ w("div", Je, [
558
+ w("div", Qe, [
559
+ g(y(ae), {
560
+ render: (S = (U = (M = D.recipe) == null ? void 0 : M.column) == null ? void 0 : U.columnDef) == null ? void 0 : S.cell,
561
+ props: (O = (B = D.recipe) == null ? void 0 : B.getContext) == null ? void 0 : O.call(B)
562
+ }, null, 8, ["render", "props"])
563
+ ]),
564
+ w("div", We, [
565
+ g(y(ae), {
566
+ render: (W = (Q = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
567
+ props: (X = (N = D.ingredients) == null ? void 0 : N.getContext) == null ? void 0 : X.call(N)
568
+ }, null, 8, ["render", "props"])
569
+ ])
570
+ ])
571
+ ];
572
+ }),
573
+ _: 2
574
+ }, 1032, ["row", "onRowClick"])
575
+ ]),
576
+ _: 1
577
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
578
+ ], 2),
579
+ (E(), T(pe, { to: "body" }, [
580
+ g(Ge, fe(ve(y(r))), null, 16)
581
+ ]))
582
+ ]),
583
+ _: 1
584
+ }, 8, ["title", "actions"]);
585
+ };
586
+ }
587
+ });
588
+ export {
589
+ rt as default
590
+ };
@@ -1,2 +1,4 @@
1
+ import '@/extensions/array';
2
+ import '@/extensions/promises';
1
3
  declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
4
  export default _default;