@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
@@ -1,581 +0,0 @@
1
- import { defineComponent as N, ref as x, onMounted as le, resolveComponent as F, openBlock as h, createElementBlock as $, Fragment as re, createElementVNode as b, toDisplayString as ie, createVNode as y, createCommentVNode as H, computed as V, watch as ce, createBlock as M, withCtx as I, unref as v, isRef as Z, normalizeClass as ue, normalizeStyle as de, Teleport as me, normalizeProps as pe, guardReactiveProps as fe } from "vue";
2
- import { u as P, c as G, S as ve, a as q, R as ye, U as ge, _ as be, A as _e, e as ee, f as we, j as Re } from "./app-DURkcZal.js";
3
- import { useDialog as he, useSnackbar as ae, useProxiedModel as te, useBreakpoints as Ce } from "@feedmepos/ui-library";
4
- import { i as xe, _ as Ee } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { F as R, D as ne, R as z } from "./row-action.enum-PMKMRrZR.js";
6
- import { _ as se, t as Fe, d as ke } from "./xlsx.util-DLtch7r5.js";
7
- import { defineStore as Ve, storeToRefs as Se } from "pinia";
8
- import { c as De, _ as Ae, F as oe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
- import { useI18n as Y } from "@feedmepos/mf-common";
10
- import { u as $e, _ as Ie, a as Pe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ohHZLOuR.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 }, Be = /* @__PURE__ */ N({
15
- __name: "DeleteDialog",
16
- props: {
17
- type: {},
18
- data: {},
19
- message: {},
20
- bindedItems: {}
21
- },
22
- setup(_) {
23
- const d = _, p = x(d.bindedItems || []), l = x(!1);
24
- le(() => {
25
- a();
26
- });
27
- async function a() {
28
- var i, o;
29
- !l.value && ((i = d.data) != null && i._id) && (l.value = !0, p.value = await P().getAffectedMenu((o = d.data) == null ? void 0 : o._id), l.value = !1);
30
- }
31
- return (i, o) => {
32
- const c = F("FmSpacer"), f = F("FmCircularProgress");
33
- return h(), $(re, null, [
34
- b("p", null, ie(i.message), 1),
35
- l.value ? (h(), $("div", Te, [
36
- y(c),
37
- b("div", null, [
38
- y(f, { size: "xl" })
39
- ]),
40
- o[0] || (o[0] = b("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
41
- y(c)
42
- ])) : (h(), $("div", Me, [
43
- o[2] || (o[2] = b("br", null, null, -1)),
44
- p.value.length > 0 ? (h(), $("div", Ue, [
45
- o[1] || (o[1] = b("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
46
- y(se, {
47
- name: "Menu",
48
- bindings: p.value
49
- }, null, 8, ["bindings"])
50
- ])) : H("", !0)
51
- ]))
52
- ], 64);
53
- };
54
- }
55
- }), K = Ve("recipeForm", function() {
56
- const d = he(), p = ae(), l = P(), a = x(!1), i = x();
57
- function o() {
58
- const t = {
59
- recipe: {},
60
- mode: R.CREATE,
61
- show: !0,
62
- "onUpdate:show"(u) {
63
- i.value.show = u;
64
- }
65
- };
66
- i.value = t;
67
- }
68
- async function c(t) {
69
- const u = {
70
- recipe: G(t),
71
- mode: R.UPDATE,
72
- show: !0,
73
- "onUpdate:show"(s) {
74
- i.value.show = s;
75
- }
76
- };
77
- i.value = u;
78
- }
79
- async function f(t) {
80
- a.value = !0;
81
- try {
82
- await l.deleteRecipe(t), p.open({
83
- title: "Success",
84
- message: `Deleted ${t.name}`,
85
- type: "success"
86
- });
87
- } catch (u) {
88
- u instanceof ve && xe(u) ? d.open({
89
- title: "Cannot delete recipe",
90
- contentComponent: Ee,
91
- contentComponentProps: {
92
- subject: (t == null ? void 0 : t.name) ?? "",
93
- items: u.errorResponse.message
94
- },
95
- secondaryActions: {
96
- text: "Close",
97
- close: !0
98
- }
99
- }) : console.log("unable to delete recipe", u), p.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", u);
104
- } finally {
105
- a.value = !1;
106
- }
107
- }
108
- function m(t) {
109
- d.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: Be,
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(() => f(t));
128
- }
129
- return {
130
- createRecipe: o,
131
- updateRecipe: c,
132
- deleteRecipe: m,
133
- recipeDialogProps: i,
134
- recipeViewLoading: a
135
- };
136
- });
137
- function Le() {
138
- const { updateRecipe: _, deleteRecipe: d } = K(), { t: p } = Y();
139
- async function l(o, c) {
140
- const f = G(c);
141
- if (o === z.Edit) {
142
- await _(f);
143
- return;
144
- }
145
- if (o === z.Delete) {
146
- await d(f);
147
- return;
148
- }
149
- }
150
- const a = [
151
- {
152
- accessorKey: "recipe",
153
- header: () => p("inventory.recipe.name"),
154
- size: 400
155
- },
156
- {
157
- accessorKey: "ingredients",
158
- header: () => p("inventory.recipe.ingredients"),
159
- size: "auto"
160
- },
161
- {
162
- id: "action",
163
- header: "",
164
- cell(o) {
165
- return De(
166
- [ne[z.Edit], ne[z.Delete]],
167
- (c) => {
168
- l(c, o.row.original.original);
169
- }
170
- );
171
- },
172
- enableSorting: !1,
173
- size: 40,
174
- meta: {
175
- cellClass: "",
176
- headerClass: ""
177
- }
178
- }
179
- ];
180
- function i(o) {
181
- const c = P();
182
- return o.map((f) => ({
183
- recipe: f.name,
184
- ingredients: f.contains.map((m) => {
185
- var u, s;
186
- const t = c.skuById[m.id];
187
- return t ? `${t.name} (${q(m.amount)}${((u = m.measurement) == null ? void 0 : u.abbrev) ?? ((s = t == null ? void 0 : t.unit) == null ? void 0 : s.abbrev)})` : null;
188
- }).filter((m) => m).join(", "),
189
- original: f
190
- }));
191
- }
192
- return { columnDefs: a, formatRowData: i };
193
- }
194
- const ze = { class: "flex flex-col gap-40" }, Ne = {
195
- key: 0,
196
- 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"
197
- }, Ye = {
198
- key: 0,
199
- class: "flex flex-col items-center w-full h-full gap-24"
200
- }, je = { key: 1 }, He = /* @__PURE__ */ N({
201
- __name: "RecipeForm",
202
- props: {
203
- mode: {},
204
- modelValue: {},
205
- disabled: { type: Boolean }
206
- },
207
- emits: ["update:modelValue", "click:submit"],
208
- setup(_, { expose: d, emit: p }) {
209
- var k;
210
- const l = _, a = p, { t: i } = Y(), o = V({
211
- get() {
212
- var e;
213
- return ((e = l.modelValue) == null ? void 0 : e.name) ?? "";
214
- },
215
- set(e) {
216
- const n = l.modelValue ?? {};
217
- n.name = e, a("update:modelValue", n);
218
- }
219
- }), c = V({
220
- get() {
221
- var e;
222
- return ((e = l.modelValue) == null ? void 0 : e.contains) ?? [];
223
- },
224
- set(e) {
225
- const n = l.modelValue ?? {};
226
- n.contains = e, a("update:modelValue", n);
227
- }
228
- });
229
- function f() {
230
- a("click:submit");
231
- }
232
- const m = x();
233
- d({
234
- validateInputs: () => {
235
- var e, n;
236
- (n = (e = m.value) == null ? void 0 : e.validateInputs) == null || n.call(e);
237
- },
238
- resetInputsValidation: () => {
239
- var e, n;
240
- (n = (e = m.value) == null ? void 0 : e.resetInputsValidation) == null || n.call(e);
241
- },
242
- resetInputs: () => {
243
- var e, n;
244
- (n = (e = m.value) == null ? void 0 : e.resetInputs) == null || n.call(e);
245
- }
246
- });
247
- const t = P(), u = x([]), s = x(!1), w = x(!1);
248
- ce(s, async (e) => {
249
- C(e);
250
- });
251
- async function C(e) {
252
- var n, S;
253
- e && !w.value && ((n = l.modelValue) != null && n._id) && (w.value = !0, u.value = await t.getAffectedMenu((S = l.modelValue) == null ? void 0 : S._id), w.value = !1);
254
- }
255
- const r = V(
256
- () => t.recipes.map((e) => ({ label: e.name, value: e.name }))
257
- ), g = x((k = l.modelValue) == null ? void 0 : k.name);
258
- return (e, n) => {
259
- const S = F("FmTextField"), j = F("FmCard"), A = F("FmSwitch"), D = F("FmSpacer"), U = F("FmCircularProgress"), B = F("FmForm");
260
- return h(), M(B, {
261
- ref_key: "formRef",
262
- ref: m,
263
- onValidationSuccess: f
264
- }, {
265
- default: I(() => [
266
- b("div", ze, [
267
- y(S, {
268
- disabled: e.disabled,
269
- label: v(i)("inventory.recipe.name"),
270
- "model-value": o.value,
271
- "onUpdate:modelValue": n[0] || (n[0] = (E) => o.value = E),
272
- rules: [
273
- v(ye)(),
274
- v(ge)(r.value, g.value, (E) => `[${E.value}] already exists`)
275
- ],
276
- "label-mark": "required"
277
- }, null, 8, ["disabled", "label", "model-value", "rules"]),
278
- y(j, {
279
- variant: "outlined",
280
- class: "p-16"
281
- }, {
282
- default: I(() => {
283
- var E;
284
- return [
285
- y(be, {
286
- id: (E = e.modelValue) == null ? void 0 : E._id,
287
- disabled: e.disabled,
288
- "model-value": c.value,
289
- "onUpdate:modelValue": n[1] || (n[1] = (T) => c.value = T),
290
- rules: [v(_e)(1)]
291
- }, null, 8, ["id", "disabled", "model-value", "rules"])
292
- ];
293
- }),
294
- _: 1
295
- })
296
- ]),
297
- e.mode !== v(R).CREATE ? (h(), $("div", Ne, [
298
- b("div", null, [
299
- y(A, {
300
- label: "Show binded items",
301
- modelValue: s.value,
302
- "onUpdate:modelValue": n[2] || (n[2] = (E) => s.value = E),
303
- "label-placement": "right",
304
- disabled: w.value
305
- }, null, 8, ["modelValue", "disabled"])
306
- ]),
307
- w.value ? (h(), $("div", Ye, [
308
- y(D),
309
- b("div", null, [
310
- y(U, { size: "xl" })
311
- ]),
312
- n[3] || (n[3] = b("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
313
- y(D)
314
- ])) : (h(), $("div", je, [
315
- s.value && u.value.length ? (h(), M(se, {
316
- key: 0,
317
- name: "Menu",
318
- bindings: u.value
319
- }, null, 8, ["bindings"])) : H("", !0)
320
- ]))
321
- ])) : H("", !0)
322
- ]),
323
- _: 1
324
- }, 512);
325
- };
326
- }
327
- }), qe = { class: "flex gap-4" }, Ke = /* @__PURE__ */ N({
328
- __name: "RecipeDialog",
329
- props: {
330
- show: { type: Boolean },
331
- recipe: {},
332
- mode: { default: R.READ }
333
- },
334
- emits: ["update:show"],
335
- setup(_) {
336
- const d = _, p = P(), l = ae(), { t: a } = Y(), i = te(d, "show"), o = te(d, "recipe"), c = V(() => {
337
- switch (d.mode) {
338
- case R.READ:
339
- return "";
340
- case R.UPDATE:
341
- return a("inventory.recipe.update.title");
342
- case R.CREATE:
343
- return a("inventory.recipe.create.title");
344
- }
345
- return "";
346
- }), f = V(() => {
347
- switch (d.mode) {
348
- case R.READ:
349
- return "";
350
- case R.UPDATE:
351
- return a("common.save");
352
- case R.CREATE:
353
- return a("common.add");
354
- }
355
- return "";
356
- }), m = x(), t = x(!1);
357
- async function u() {
358
- t.value = !0;
359
- try {
360
- const r = G(o.value);
361
- r.precision ?? (r.precision = 0), r.measurements ?? (r.measurements = []), await p.createRecipe(r), i.value = !1, l.open({
362
- title: a("common.success"),
363
- message: a("inventory.recipe.create.success", { name: o.value.name }),
364
- type: "success"
365
- });
366
- } catch (r) {
367
- r instanceof ee || l.open({
368
- title: a("inventory.recipe.create.error.title"),
369
- message: a("inventory.recipe.create.error.message"),
370
- type: "error"
371
- });
372
- } finally {
373
- t.value = !1;
374
- }
375
- }
376
- async function s() {
377
- t.value = !0;
378
- try {
379
- await p.updateRecipe(o.value), i.value = !1, l.open({
380
- title: a("common.success"),
381
- message: a("inventory.recipe.update.success", { name: o.value.name }),
382
- type: "success"
383
- });
384
- } catch (r) {
385
- r instanceof ee || l.open({
386
- title: a("inventory.recipe.update.error.title"),
387
- message: a("inventory.recipe.update.error.message"),
388
- type: "error"
389
- });
390
- } finally {
391
- t.value = !1;
392
- }
393
- }
394
- function w() {
395
- var r, g;
396
- (g = (r = m.value) == null ? void 0 : r.validateInputs) == null || g.call(r);
397
- }
398
- function C() {
399
- switch (d.mode) {
400
- case R.READ:
401
- return;
402
- case R.UPDATE:
403
- return s();
404
- case R.CREATE:
405
- return u();
406
- }
407
- }
408
- return (r, g) => {
409
- const k = F("FmButton"), e = F("FmSideSheet");
410
- return h(), M(e, {
411
- "model-value": v(i),
412
- "onUpdate:modelValue": g[3] || (g[3] = (n) => Z(i) ? i.value = n : null),
413
- header: c.value,
414
- "close-button": "",
415
- "dismiss-away": "",
416
- "max-width": 500
417
- }, {
418
- "side-sheet-footer": I(() => [
419
- b("div", qe, [
420
- y(k, {
421
- loading: t.value,
422
- label: f.value,
423
- onClick: w
424
- }, null, 8, ["loading", "label"]),
425
- y(k, {
426
- disabled: t.value,
427
- label: v(a)("common.close"),
428
- variant: "tertiary",
429
- onClick: g[2] || (g[2] = (n) => i.value = !1)
430
- }, null, 8, ["disabled", "label"])
431
- ])
432
- ]),
433
- default: I(() => [
434
- y(He, {
435
- class: "w-full",
436
- ref_key: "hasValidationExpose",
437
- ref: m,
438
- modelValue: v(o),
439
- "onUpdate:modelValue": g[0] || (g[0] = (n) => Z(o) ? o.value = n : null),
440
- mode: r.mode,
441
- disabled: t.value,
442
- "onClick:submit": g[1] || (g[1] = (n) => C())
443
- }, null, 8, ["modelValue", "mode", "disabled"])
444
- ]),
445
- _: 1
446
- }, 8, ["model-value", "header"]);
447
- };
448
- }
449
- });
450
- function Ge() {
451
- const _ = P(), d = _.recipes, p = _.recipeById, l = _.skuById, a = d.flatMap((c, f) => {
452
- var m;
453
- if ((m = c.contains) != null && m.length) {
454
- const t = c.contains.filter((s) => s.type === "RECIPE"), u = c.contains.filter((s) => s.type === "SKU");
455
- return [
456
- ...f === 0 ? [] : [["", "", "", "", "", ""]],
457
- ...t.map(
458
- (s, w) => {
459
- var C;
460
- return [
461
- w === 0 ? c.name : "",
462
- "RECIPE",
463
- "",
464
- (C = p[s.id]) == null ? void 0 : C.name,
465
- q(s.amount),
466
- "UNIT"
467
- ];
468
- }
469
- ),
470
- ...u.map(
471
- (s, w) => {
472
- var C, r, g, k;
473
- return [
474
- !t.length && w === 0 ? c.name : "",
475
- "INGREDIENT",
476
- (C = l[s.id]) == null ? void 0 : C.code,
477
- (r = l[s.id]) == null ? void 0 : r.name,
478
- q(s.amount),
479
- s.measurement ? s.measurement.abbrev : (k = (g = l[s.id]) == null ? void 0 : g.unit) == null ? void 0 : k.abbrev
480
- ];
481
- }
482
- )
483
- ];
484
- }
485
- return [
486
- ...f === 0 ? [] : [["", "", "", "", "", ""]],
487
- [c.name, "No bindings", "", "", "", ""]
488
- ];
489
- }), o = Fe(a, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
490
- ke(o, `RECIPE_${we(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
491
- }
492
- const Je = { class: "flex flex-col py-8" }, Oe = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Qe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = /* @__PURE__ */ N({
493
- __name: "RecipeView",
494
- setup(_) {
495
- const d = P(), p = V(() => d.recipes), l = Re(), { createRecipe: a, updateRecipe: i } = K(), { recipeDialogProps: o, recipeViewLoading: c } = Se(K()), { columnDefs: f, formatRowData: m } = Le(), t = V(() => m(p.value));
496
- function u(n) {
497
- n === "add" && a();
498
- }
499
- const s = x(""), w = V(() => c.value), { breakpoints: C } = Ce(), r = V(() => C.value.xs || C.value.sm), g = V(() => r.value ? 10 : 20), k = $e(), { t: e } = Y();
500
- return (n, S) => {
501
- const j = F("FmTable");
502
- return h(), M(Ie, {
503
- title: v(e)("inventory.recipe.title"),
504
- actions: [
505
- {
506
- label: v(e)("inventory.recipe.create.title"),
507
- value: "add",
508
- isPrimary: !0,
509
- prependIcon: "add"
510
- }
511
- ],
512
- "onClick:action": u
513
- }, {
514
- default: I(() => [
515
- b("div", {
516
- class: ue([
517
- "flex flex-col gap-8 max-h-full",
518
- {
519
- "p-0": r.value,
520
- "px-24 ": !r.value
521
- }
522
- ])
523
- }, [
524
- y(Pe, {
525
- searchable: "",
526
- search: s.value,
527
- "onUpdate:search": S[0] || (S[0] = (A) => s.value = A),
528
- actions: [{ icon: "ios_share", onClick: v(Ge) }]
529
- }, null, 8, ["search", "actions"]),
530
- (h(), M(j, {
531
- style: de(v(k).tableHeight),
532
- "column-defs": v(f),
533
- "row-data": t.value,
534
- "search-value": s.value,
535
- loading: !v(l)._currentLocation || w.value,
536
- onRowClick: S[1] || (S[1] = (A) => v(i)(A.original.original)),
537
- key: p.value.length,
538
- "page-size": g.value
539
- }, {
540
- "list-row": I((A) => [
541
- y(Ae, {
542
- row: A,
543
- onRowClick: (D) => v(i)(D.original)
544
- }, {
545
- default: I((D) => {
546
- var U, B, E, T, J, O, Q, W, L, X;
547
- return [
548
- b("div", Je, [
549
- b("div", Oe, [
550
- y(v(oe), {
551
- render: (E = (B = (U = D.recipe) == null ? void 0 : U.column) == null ? void 0 : B.columnDef) == null ? void 0 : E.cell,
552
- props: (J = (T = D.recipe) == null ? void 0 : T.getContext) == null ? void 0 : J.call(T)
553
- }, null, 8, ["render", "props"])
554
- ]),
555
- b("div", Qe, [
556
- y(v(oe), {
557
- render: (W = (Q = (O = D.ingredients) == null ? void 0 : O.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
558
- props: (X = (L = D.ingredients) == null ? void 0 : L.getContext) == null ? void 0 : X.call(L)
559
- }, null, 8, ["render", "props"])
560
- ])
561
- ])
562
- ];
563
- }),
564
- _: 2
565
- }, 1032, ["row", "onRowClick"])
566
- ]),
567
- _: 1
568
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
569
- ], 2),
570
- (h(), M(me, { to: "body" }, [
571
- y(Ke, pe(fe(v(o))), null, 16)
572
- ]))
573
- ]),
574
- _: 1
575
- }, 8, ["title", "actions"]);
576
- };
577
- }
578
- });
579
- export {
580
- rt as default
581
- };