@feedmepos/mf-inventory-portal 0.0.22-dev.4 → 0.0.22-dev.41

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