@feedmepos/mf-inventory-portal 1.0.9 → 1.0.10-dev.2

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 (107) hide show
  1. package/dist/{App-RT4bBubX.js → App-COPx00z6.js} +50 -49
  2. package/dist/{ApprovalView-BgOWHNMD.js → ApprovalView-DEtUW_BD.js} +24 -24
  3. package/dist/{BindingsDialog-Dip74zuT.js → BindingsDialog-8WUk3Dv3.js} +2 -2
  4. package/dist/{BindingsPicker-DMQXwEn4.js → BindingsPicker-D8ABQZWj.js} +7 -7
  5. package/dist/{BindingsTable-Czz32F7d.js → BindingsTable-E4ObCYZW.js} +5 -5
  6. package/dist/{ClosingDraftView-Ps4DgRNG.js → ClosingDraftView-BuwTXzoD.js} +499 -498
  7. package/dist/{ClosingTemplateView-EjVLgUCH.js → ClosingTemplateView-Dwlu2WDi.js} +10 -10
  8. package/dist/{DeliveryOrderPrintPreview-C52aY34D.js → DeliveryOrderPrintPreview-CZQP0ZBf.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-MSqPw_6t.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CIpktJ_p.js} +32 -32
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DbN_e9U8.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BAsfttD3.js} +51 -51
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DHuB4hRb.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BtLdE9Qw.js} +1 -1
  12. package/dist/{IngredientGroupView-CRTjNc-p.js → IngredientGroupView-DKncarkj.js} +11 -11
  13. package/dist/{IngredientsView-CuLOu_v9.js → IngredientsView-DJhR4pNL.js} +15 -14
  14. package/dist/IntegrationView-DbehNBiT.js +10361 -0
  15. package/dist/{InventoryBindingForm-C1NfSdOs.js → InventoryBindingForm-CakKTaAx.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BJ7h3Nr6.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-qrYebXqE.js} +94 -89
  17. package/dist/{InventoryBindingSummary-CFjSwhxA.js → InventoryBindingSummary-ax4kqODn.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B73N8AvB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BD8iRcNk.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-rve3vJhu.js → PremiumBadge.vue_vue_type_script_setup_true_lang-D13DAIwe.js} +10 -10
  20. package/dist/{PublishView-Bj0JawUb.js → PublishView-BMQzmmkT.js} +12 -12
  21. package/dist/{PurchaseOrderPrintPreview-DCAZVrDM.js → PurchaseOrderPrintPreview-CdbxZWLq.js} +4 -4
  22. package/dist/{ReceiveRequestView-B_bWd1hC.js → ReceiveRequestView-Blxchs0k.js} +53 -52
  23. package/dist/RecipeView-Bnigp2lS.js +8493 -0
  24. package/dist/{StockView-CsZ2hfAY.js → StockView-B4p6XQPR.js} +73 -72
  25. package/dist/{SupplierView-BUaouKYm.js → SupplierView-ojORzTSY.js} +12 -11
  26. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-G478rFCP.js +1894 -0
  27. package/dist/{TransferTemplateView-Rq7N13OR.js → TransferTemplateView-DTN23wTJ.js} +291 -290
  28. package/dist/{UnitView-C9j2RjtY.js → UnitView-w-bUgjIw.js} +23 -23
  29. package/dist/{WarehouseView-Ct6TWKej.js → WarehouseView-cJ7u4vTr.js} +26 -26
  30. package/dist/api/bill.d.ts +2 -2
  31. package/dist/api/food-market-hub.d.ts +1 -1
  32. package/dist/api/inventory.d.ts +110 -44
  33. package/dist/api/netsuite.d.ts +191 -8
  34. package/dist/api/purchase-order.d.ts +5 -1
  35. package/dist/{app-Cryb1Kx8.js → app-DtLEhFCD.js} +19871 -19809
  36. package/dist/app.d.ts +7 -7
  37. package/dist/app.js +2 -2
  38. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +30 -8
  39. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  40. package/dist/components/shell/inventory/binding-ui.vue.d.ts +27 -5
  41. package/dist/composable/usePromise.d.ts +41 -0
  42. package/dist/{decimal-Ko0ukH7B.js → decimal-D0mDm48J.js} +1 -1
  43. package/dist/feature-GZEf4CLT.js +17427 -0
  44. package/dist/{format-unit-display-C1sTywhb.js → format-unit-display-Dl7kbJn1.js} +60 -60
  45. package/dist/{index-BAyyesj2.js → index-BglOiNaU.js} +7 -6
  46. package/dist/{index-WgH7CKAS.js → index-DKLr1Nm9.js} +1 -1
  47. package/dist/main.d.ts +1 -0
  48. package/dist/{stock-BVCXjojk.js → stock-V0Qm2pTD.js} +3 -3
  49. package/dist/stores/feature.d.ts +3 -20
  50. package/dist/stores/integration/foodmarkethub.d.ts +1 -1
  51. package/dist/stores/integration/netsuite.d.ts +22 -7
  52. package/dist/stores/inventory.d.ts +132 -44
  53. package/dist/stores/location.d.ts +137 -137
  54. package/dist/{supplier-Brxhm840.js → supplier-DK4PWcz4.js} +4 -4
  55. package/dist/tsconfig.app.tsbuildinfo +1 -1
  56. package/dist/{use-ingredient-select-dialog-DCAYNC6e.js → use-ingredient-select-dialog-BfJ-qHni.js} +1 -1
  57. package/dist/{use-inventory-binding-dialog-TYwx9mzF.js → use-inventory-binding-dialog-C5IYjwW5.js} +1 -1
  58. package/dist/views/adjustment-template/wastage-template/actions.d.ts +228 -228
  59. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +2 -2
  60. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +1 -1
  61. package/dist/views/adjustment-template/wastage-template/table.d.ts +234 -234
  62. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +140 -136
  63. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +420 -408
  64. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +4 -4
  65. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +252 -252
  66. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +252 -252
  67. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +12 -12
  68. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  69. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +8 -8
  70. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +3 -3
  71. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +4 -4
  72. package/dist/views/integration/components/ApplyProduct.vue.d.ts +2 -2
  73. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +2 -2
  74. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +2 -2
  75. package/dist/views/integration/components/netsuite/InventoryTransfer.vue.d.ts +48 -0
  76. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +180 -0
  77. package/dist/views/integration/components/netsuite/NetSuiteSideSheet.vue.d.ts +24 -0
  78. package/dist/views/integration/components/netsuite/NetSuiteSideSheetProps.d.ts +8 -0
  79. package/dist/views/integration/components/netsuite/{AddLocationDialog.vue.d.ts → business/AddLocationDialog.vue.d.ts} +204 -204
  80. package/dist/views/integration/components/netsuite/{LocationConfigurationDialog.vue.d.ts → business/BusinessNetSuiteSideSheet.vue.d.ts} +3 -3
  81. package/dist/views/integration/components/netsuite/{LocationConfigurationDialogProps.d.ts → business/BusinessNetSuiteSideSheetProps.d.ts} +1 -5
  82. package/dist/views/integration/components/netsuite/{NetSuiteLocationField.vue.d.ts → business/NetSuiteLocationField.vue.d.ts} +11 -9
  83. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +665 -637
  84. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +22 -22
  85. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +44 -44
  86. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +11 -11
  87. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +614 -0
  88. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1190 -1142
  89. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1192 -1144
  90. package/dist/views/receive-request/constants/po-action-to-ui-style.d.ts +6 -0
  91. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +46 -2
  92. package/dist/views/recipe/components/recipe-override-form-field/RecipeOverrideFormField.vue.d.ts +61 -0
  93. package/dist/views/recipe/composables/use-recipe-overrides-form-field.d.ts +10 -0
  94. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  95. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +14 -14
  96. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +22 -22
  97. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +17 -17
  98. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +11 -11
  99. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +805 -805
  100. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +805 -805
  101. package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +33 -33
  102. package/dist/vue-i18n-3LoKMrMa.js +2365 -0
  103. package/package.json +8 -5
  104. package/dist/IntegrationView-DXxwE0z8.js +0 -2148
  105. package/dist/RecipeView-m7aSOTrT.js +0 -616
  106. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DqImAdxA.js +0 -1746
  107. package/dist/vue-i18n-B-kKlljK.js +0 -2365
@@ -1,616 +0,0 @@
1
- import { defineComponent as q, ref as E, onMounted as re, resolveComponent as F, openBlock as x, createElementBlock as I, Fragment as ie, createElementVNode as h, toDisplayString as ue, createVNode as g, createCommentVNode as K, computed as k, watch as ce, createBlock as T, withCtx as P, unref as _, isRef as Z, normalizeClass as de, normalizeStyle as me, Teleport as pe, normalizeProps as fe, guardReactiveProps as ve } from "vue";
2
- import { a as A, e as V, f as O, S as ye, h as ge, D as ee, i as j, j as Y, F as te, m as be, U as _e, A as we, q as ne, r as Re, v as he, s as Ve, u as xe, B as Ce, _ as Ee, C as Se, E as Fe, G as oe } from "./app-Cryb1Kx8.js";
3
- import { useDialog as ke, useSnackbar as se, useProxiedModel as ae, useBreakpoints as De } from "@feedmepos/ui-library";
4
- import { i as Ae, _ as $e } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { _ as le } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-DHuB4hRb.js";
6
- import { defineStore as Ie, storeToRefs as Pe } from "pinia";
7
- import { useI18n as H } from "@feedmepos/mf-common";
8
- import { _ as Be } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BJ7h3Nr6.js";
9
- import { _ as Te } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
10
- const Me = {
11
- key: 0,
12
- class: "flex flex-col items-center w-full h-full gap-24"
13
- }, Ue = { key: 1 }, Ne = { key: 0 }, Le = /* @__PURE__ */ q({
14
- __name: "DeleteDialog",
15
- props: {
16
- type: {},
17
- data: {},
18
- message: {},
19
- bindedItems: {}
20
- },
21
- setup(w) {
22
- const p = w, f = E(p.bindedItems || []), l = E(!1);
23
- re(() => {
24
- r();
25
- });
26
- async function r() {
27
- var u, i;
28
- !l.value && ((u = p.data) != null && u._id) && (l.value = !0, f.value = await A().getAffectedMenu((i = p.data) == null ? void 0 : i._id), l.value = !1);
29
- }
30
- return (u, i) => {
31
- const v = F("FmSpacer"), d = F("FmCircularProgress");
32
- return x(), I(ie, null, [
33
- h("p", null, ue(u.message), 1),
34
- l.value ? (x(), I("div", Me, [
35
- g(v),
36
- h("div", null, [
37
- g(d, { size: "xl" })
38
- ]),
39
- i[0] || (i[0] = h("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
40
- g(v)
41
- ])) : (x(), I("div", Ue, [
42
- i[2] || (i[2] = h("br", null, null, -1)),
43
- f.value.length > 0 ? (x(), I("div", Ne, [
44
- i[1] || (i[1] = h("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
45
- g(le, {
46
- name: "Menu",
47
- bindings: f.value
48
- }, null, 8, ["bindings"])
49
- ])) : K("", !0)
50
- ]))
51
- ], 64);
52
- };
53
- }
54
- }), G = Ie("recipeForm", function() {
55
- const p = ke(), f = se(), l = A(), r = E(!1), u = E();
56
- function i() {
57
- const t = {
58
- recipe: {},
59
- mode: V.CREATE,
60
- show: !0,
61
- "onUpdate:show"(s) {
62
- u.value.show = s;
63
- }
64
- };
65
- u.value = t;
66
- }
67
- async function v(t) {
68
- const s = {
69
- recipe: O(t),
70
- mode: V.UPDATE,
71
- show: !0,
72
- "onUpdate:show"(o) {
73
- u.value.show = o;
74
- }
75
- };
76
- u.value = s;
77
- }
78
- async function d(t) {
79
- r.value = !0;
80
- try {
81
- await l.deleteRecipe(t), f.open({
82
- title: "Success",
83
- message: `Deleted ${t.name}`,
84
- type: "success"
85
- });
86
- } catch (s) {
87
- s instanceof ye && Ae(s) ? p.open({
88
- title: "Cannot delete recipe",
89
- contentComponent: $e,
90
- contentComponentProps: {
91
- subject: (t == null ? void 0 : t.name) ?? "",
92
- items: s.errorResponse.message
93
- },
94
- secondaryActions: {
95
- text: "Close",
96
- close: !0
97
- }
98
- }) : console.log("unable to delete recipe", s), f.open({
99
- title: `Cannot delete ${t == null ? void 0 : t.name}`,
100
- message: "Please try again.",
101
- type: "error"
102
- }), console.error("failed to delete recipe", s);
103
- } finally {
104
- r.value = !1;
105
- }
106
- }
107
- function m(t) {
108
- p.open({
109
- title: `Delete ${(t == null ? void 0 : t.name) ?? "recipe"}?`,
110
- closeButton: !1,
111
- primaryActions: {
112
- text: "Delete",
113
- close: !0,
114
- variant: "destructive"
115
- },
116
- secondaryActions: {
117
- text: "Cancel",
118
- close: !0
119
- },
120
- contentComponent: Le,
121
- contentComponentProps: {
122
- type: "menu",
123
- data: t,
124
- message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
125
- }
126
- }).onPrimary(() => d(t));
127
- }
128
- return {
129
- createRecipe: i,
130
- updateRecipe: v,
131
- deleteRecipe: m,
132
- recipeDialogProps: u,
133
- recipeViewLoading: r
134
- };
135
- });
136
- function ze() {
137
- const { updateRecipe: w, deleteRecipe: p } = G(), f = A(), { t: l } = H();
138
- async function r(d, m) {
139
- const t = O(m);
140
- if (d === j.Edit) {
141
- await w(t);
142
- return;
143
- }
144
- if (d === j.Delete) {
145
- await p(t);
146
- return;
147
- }
148
- }
149
- function u(d, m) {
150
- const t = d.filter((o) => o.type === te.enum.SKU), s = d.filter((o) => o.type === te.enum.RECIPE);
151
- return [
152
- ...t.map((o) => ({ ...o, recipeIds: [...m] })),
153
- ...s.filter((o) => f.recipeById[o.id] && !m.has(o.id)).flatMap(
154
- (o) => u(f.recipeById[o.id].contains, /* @__PURE__ */ new Set([...m, o.id]))
155
- )
156
- ];
157
- }
158
- const i = [
159
- {
160
- accessorKey: "recipe",
161
- header: () => l("inventory.recipe.name"),
162
- size: 400
163
- },
164
- {
165
- accessorKey: "ingredients",
166
- header: () => l("inventory.recipe.ingredients"),
167
- size: "auto"
168
- },
169
- {
170
- id: "action",
171
- header: "",
172
- cell(d) {
173
- return ge(
174
- [ee[j.Edit], ee[j.Delete]],
175
- (m) => {
176
- r(m, d.row.original.original);
177
- }
178
- );
179
- },
180
- enableSorting: !1,
181
- size: 40,
182
- meta: {
183
- cellClass: "",
184
- headerClass: ""
185
- }
186
- }
187
- ];
188
- function v(d) {
189
- const m = A();
190
- return d.map((t) => ({
191
- recipe: t.name,
192
- ingredients: u(t.contains, /* @__PURE__ */ new Set([t._id])).map((s) => {
193
- var c, b, a, y, C;
194
- const o = m.skuById[s.id];
195
- return o ? s.recipeIds.slice(1).length ? `(linked recipe ${(c = m.recipeById[s.recipeIds.at(-1) ?? ""]) == null ? void 0 : c.name}) ${o.name} (${Y(s.amount)}${((b = s.measurement) == null ? void 0 : b.abbrev) ?? ((a = o == null ? void 0 : o.unit) == null ? void 0 : a.abbrev)})` : `${o.name} (${Y(s.amount)}${((y = s.measurement) == null ? void 0 : y.abbrev) ?? ((C = o == null ? void 0 : o.unit) == null ? void 0 : C.abbrev)})` : null;
196
- }).filter((s) => s).join(", "),
197
- original: t
198
- }));
199
- }
200
- return { columnDefs: i, formatRowData: v };
201
- }
202
- const je = { class: "flex flex-col gap-40" }, Ye = {
203
- key: 0,
204
- 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"
205
- }, qe = {
206
- key: 0,
207
- class: "flex flex-col items-center w-full h-full gap-24"
208
- }, He = { key: 1 }, Ke = { class: "mt-32" }, Ge = /* @__PURE__ */ q({
209
- __name: "RecipeForm",
210
- props: {
211
- mode: {},
212
- modelValue: {},
213
- disabled: { type: Boolean }
214
- },
215
- emits: ["update:modelValue", "click:submit"],
216
- setup(w, { expose: p, emit: f }) {
217
- var S;
218
- const l = w, r = f, { t: u } = H(), i = k({
219
- get() {
220
- var e;
221
- return ((e = l.modelValue) == null ? void 0 : e.name) ?? "";
222
- },
223
- set(e) {
224
- const n = l.modelValue ?? {};
225
- n.name = e, r("update:modelValue", n);
226
- }
227
- }), v = k({
228
- get() {
229
- var e;
230
- return ((e = l.modelValue) == null ? void 0 : e.contains) ?? [];
231
- },
232
- set(e) {
233
- const n = l.modelValue ?? {};
234
- n.contains = e, r("update:modelValue", n);
235
- }
236
- }), d = k({
237
- get() {
238
- var e;
239
- return ((e = l.modelValue) == null ? void 0 : e.customAttributes) ?? {};
240
- },
241
- set(e) {
242
- const n = l.modelValue ? {
243
- ...l.modelValue
244
- } : {};
245
- n.customAttributes = e, r("update:modelValue", n);
246
- }
247
- });
248
- function m() {
249
- r("click:submit");
250
- }
251
- const t = E();
252
- p({
253
- validateInputs: () => {
254
- var e, n;
255
- (n = (e = t.value) == null ? void 0 : e.validateInputs) == null || n.call(e);
256
- },
257
- resetInputsValidation: () => {
258
- var e, n;
259
- (n = (e = t.value) == null ? void 0 : e.resetInputsValidation) == null || n.call(e);
260
- },
261
- resetInputs: () => {
262
- var e, n;
263
- (n = (e = t.value) == null ? void 0 : e.resetInputs) == null || n.call(e);
264
- }
265
- });
266
- const s = A(), o = E([]), c = E(!1), b = E(!1);
267
- ce(c, async (e) => {
268
- a(e);
269
- });
270
- async function a(e) {
271
- var n, B;
272
- e && !b.value && ((n = l.modelValue) != null && n._id) && (b.value = !0, o.value = await s.getAffectedMenu((B = l.modelValue) == null ? void 0 : B._id), b.value = !1);
273
- }
274
- const y = k(
275
- () => s.recipes.map((e) => ({ label: e.name, value: e.name }))
276
- ), C = E((S = l.modelValue) == null ? void 0 : S.name);
277
- return (e, n) => {
278
- const B = F("FmTextField"), $ = F("FmCard"), D = F("FmSwitch"), M = F("FmSpacer"), U = F("FmCircularProgress"), N = F("FmForm");
279
- return x(), T(N, {
280
- ref_key: "formRef",
281
- ref: t,
282
- onValidationSuccess: m
283
- }, {
284
- default: P(() => [
285
- h("div", je, [
286
- g(B, {
287
- disabled: e.disabled,
288
- label: _(u)("inventory.recipe.name"),
289
- "model-value": i.value,
290
- "onUpdate:modelValue": n[0] || (n[0] = (R) => i.value = R),
291
- rules: [
292
- _(be)(),
293
- _(_e)(y.value, C.value, (R) => `[${R.value}] already exists`)
294
- ],
295
- "label-mark": "required"
296
- }, null, 8, ["disabled", "label", "model-value", "rules"]),
297
- g($, {
298
- variant: "outlined",
299
- class: "p-16"
300
- }, {
301
- default: P(() => {
302
- var R;
303
- return [
304
- g(Be, {
305
- id: (R = e.modelValue) == null ? void 0 : R._id,
306
- disabled: e.disabled,
307
- "model-value": v.value,
308
- "onUpdate:modelValue": n[1] || (n[1] = (L) => v.value = L),
309
- rules: [_(we)(1)]
310
- }, null, 8, ["id", "disabled", "model-value", "rules"])
311
- ];
312
- }),
313
- _: 1
314
- })
315
- ]),
316
- e.mode !== _(V).CREATE ? (x(), I("div", Ye, [
317
- h("div", null, [
318
- g(D, {
319
- label: "Show binded items",
320
- modelValue: c.value,
321
- "onUpdate:modelValue": n[2] || (n[2] = (R) => c.value = R),
322
- "label-placement": "right",
323
- disabled: b.value
324
- }, null, 8, ["modelValue", "disabled"])
325
- ]),
326
- b.value ? (x(), I("div", qe, [
327
- g(M),
328
- h("div", null, [
329
- g(U, { size: "xl" })
330
- ]),
331
- n[4] || (n[4] = h("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
332
- g(M)
333
- ])) : (x(), I("div", He, [
334
- c.value && o.value.length ? (x(), T(le, {
335
- key: 0,
336
- name: "Menu",
337
- bindings: o.value
338
- }, null, 8, ["bindings"])) : K("", !0)
339
- ]))
340
- ])) : K("", !0),
341
- h("div", Ke, [
342
- g(Te, {
343
- entity: "inventoryRecipe",
344
- modelValue: d.value,
345
- "onUpdate:modelValue": n[3] || (n[3] = (R) => d.value = R)
346
- }, null, 8, ["modelValue"])
347
- ])
348
- ]),
349
- _: 1
350
- }, 512);
351
- };
352
- }
353
- }), Oe = { class: "flex gap-4" }, Je = /* @__PURE__ */ q({
354
- __name: "RecipeDialog",
355
- props: {
356
- show: { type: Boolean },
357
- recipe: {},
358
- mode: { default: V.READ }
359
- },
360
- emits: ["update:show"],
361
- setup(w) {
362
- const p = w, f = A(), l = se(), { t: r } = H(), u = ae(p, "show"), i = ae(p, "recipe"), v = k(() => {
363
- switch (p.mode) {
364
- case V.READ:
365
- return "";
366
- case V.UPDATE:
367
- return r("inventory.recipe.update.title");
368
- case V.CREATE:
369
- return r("inventory.recipe.create.title");
370
- }
371
- return "";
372
- }), d = k(() => {
373
- switch (p.mode) {
374
- case V.READ:
375
- return "";
376
- case V.UPDATE:
377
- return r("common.save");
378
- case V.CREATE:
379
- return r("common.add");
380
- }
381
- return "";
382
- }), m = E(), t = E(!1);
383
- async function s() {
384
- t.value = !0;
385
- try {
386
- const a = O(i.value);
387
- a.precision ?? (a.precision = 0), a.measurements ?? (a.measurements = []), await f.createRecipe(a), u.value = !1, l.open({
388
- title: r("inventory.common.success"),
389
- message: r("inventory.recipe.create.success", { name: i.value.name }),
390
- type: "success"
391
- });
392
- } catch (a) {
393
- a instanceof ne || l.open({
394
- title: r("inventory.recipe.create.error.title"),
395
- message: r("inventory.recipe.create.error.message"),
396
- type: "error"
397
- });
398
- } finally {
399
- t.value = !1;
400
- }
401
- }
402
- async function o() {
403
- t.value = !0;
404
- try {
405
- await f.updateRecipe(i.value), u.value = !1, l.open({
406
- title: r("inventory.common.success"),
407
- message: r("inventory.recipe.update.success", { name: i.value.name }),
408
- type: "success"
409
- });
410
- } catch (a) {
411
- a instanceof ne || l.open({
412
- title: r("inventory.recipe.update.error.title"),
413
- message: r("inventory.recipe.update.error.message"),
414
- type: "error"
415
- });
416
- } finally {
417
- t.value = !1;
418
- }
419
- }
420
- function c() {
421
- var a, y;
422
- (y = (a = m.value) == null ? void 0 : a.validateInputs) == null || y.call(a);
423
- }
424
- function b() {
425
- switch (p.mode) {
426
- case V.READ:
427
- return;
428
- case V.UPDATE:
429
- return o();
430
- case V.CREATE:
431
- return s();
432
- }
433
- }
434
- return (a, y) => {
435
- const C = F("FmButton"), S = F("FmSideSheet");
436
- return x(), T(S, {
437
- "model-value": _(u),
438
- "onUpdate:modelValue": y[3] || (y[3] = (e) => Z(u) ? u.value = e : null),
439
- header: v.value,
440
- "close-button": "",
441
- "dismiss-away": "",
442
- "max-width": 500
443
- }, {
444
- "side-sheet-footer": P(() => [
445
- h("div", Oe, [
446
- g(C, {
447
- loading: t.value,
448
- label: d.value,
449
- onClick: c
450
- }, null, 8, ["loading", "label"]),
451
- g(C, {
452
- disabled: t.value,
453
- label: _(r)("common.close"),
454
- variant: "tertiary",
455
- onClick: y[2] || (y[2] = (e) => u.value = !1)
456
- }, null, 8, ["disabled", "label"])
457
- ])
458
- ]),
459
- default: P(() => [
460
- g(Ge, {
461
- class: "w-full",
462
- ref_key: "hasValidationExpose",
463
- ref: m,
464
- modelValue: _(i),
465
- "onUpdate:modelValue": y[0] || (y[0] = (e) => Z(i) ? i.value = e : null),
466
- mode: a.mode,
467
- disabled: t.value,
468
- "onClick:submit": y[1] || (y[1] = (e) => b())
469
- }, null, 8, ["modelValue", "mode", "disabled"])
470
- ]),
471
- _: 1
472
- }, 8, ["model-value", "header"]);
473
- };
474
- }
475
- });
476
- function Qe(w) {
477
- return !w || Object.keys(w).length === 0 ? "" : Object.entries(w).map(([p, f]) => `${p}: ${f}`).join(", ");
478
- }
479
- function We() {
480
- const w = A(), p = w.recipes, f = w.recipeById, l = w.skuById, r = p.flatMap((v, d) => {
481
- var t;
482
- const m = Qe(v.customAttributes);
483
- if ((t = v.contains) != null && t.length) {
484
- const s = v.contains.filter((c) => c.type === "RECIPE"), o = v.contains.filter((c) => c.type === "SKU");
485
- return [
486
- ...d === 0 ? [] : [["", "", "", "", "", "", ""]],
487
- ...s.map(
488
- (c, b) => {
489
- var a;
490
- return [
491
- b === 0 ? v.name : "",
492
- "RECIPE",
493
- "",
494
- (a = f[c.id]) == null ? void 0 : a.name,
495
- Y(c.amount),
496
- "UNIT",
497
- b === 0 ? m : ""
498
- ];
499
- }
500
- ),
501
- ...o.map(
502
- (c, b) => {
503
- var a, y, C, S;
504
- return [
505
- !s.length && b === 0 ? v.name : "",
506
- "INGREDIENT",
507
- (a = l[c.id]) == null ? void 0 : a.code,
508
- (y = l[c.id]) == null ? void 0 : y.name,
509
- Y(c.amount),
510
- c.measurement ? c.measurement.abbrev : (S = (C = l[c.id]) == null ? void 0 : C.unit) == null ? void 0 : S.abbrev,
511
- !s.length && b === 0 ? m : ""
512
- ];
513
- }
514
- )
515
- ];
516
- }
517
- return [
518
- ...d === 0 ? [] : [["", "", "", "", "", "", ""]],
519
- [v.name, "No bindings", "", "", "", "", m]
520
- ];
521
- }), i = Re(r, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
522
- he(i, `RECIPE_${Ve(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
523
- }
524
- const Xe = { class: "flex flex-col py-8" }, Ze = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, et = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ct = /* @__PURE__ */ q({
525
- __name: "RecipeView",
526
- setup(w) {
527
- const p = A(), f = k(() => p.recipes), l = xe(), { createRecipe: r, updateRecipe: u } = G(), { recipeDialogProps: i, recipeViewLoading: v } = Pe(G()), { columnDefs: d, formatRowData: m } = ze(), t = k(() => m(f.value));
528
- function s(e) {
529
- if (e === "add")
530
- return r();
531
- if (e === "export")
532
- return We();
533
- }
534
- const o = E(""), c = k(() => v.value), { breakpoints: b } = De(), a = k(() => b.value.xs || b.value.sm), y = k(() => a.value ? 10 : 20), C = Ce(), { t: S } = H();
535
- return (e, n) => {
536
- const B = F("FmTable");
537
- return x(), T(Ee, {
538
- title: _(S)("inventory.recipe.title"),
539
- actions: [
540
- {
541
- label: _(S)("inventory.recipe.create.title"),
542
- value: "add",
543
- isPrimary: !0,
544
- prependIcon: "add"
545
- },
546
- { label: _(S)("common.export"), value: "export", isPrimary: !1 }
547
- ],
548
- "onClick:action": s
549
- }, {
550
- default: P(() => [
551
- h("div", {
552
- class: de([
553
- "flex flex-col gap-8 max-h-full",
554
- {
555
- "p-0": a.value,
556
- "px-24 ": !a.value
557
- }
558
- ])
559
- }, [
560
- g(Se, {
561
- searchable: "",
562
- search: o.value,
563
- "onUpdate:search": n[0] || (n[0] = ($) => o.value = $)
564
- }, null, 8, ["search"]),
565
- (x(), T(B, {
566
- style: me(_(C).tableHeight),
567
- "column-defs": _(d),
568
- "row-data": t.value,
569
- "search-value": o.value,
570
- loading: !_(l)._currentLocation || c.value,
571
- onRowClick: n[1] || (n[1] = ($) => _(u)($.original.original)),
572
- key: f.value.length,
573
- "page-size": y.value
574
- }, {
575
- "list-row": P(($) => [
576
- g(Fe, {
577
- row: $,
578
- onRowClick: (D) => _(u)(D.original)
579
- }, {
580
- default: P((D) => {
581
- var M, U, N, R, L, J, Q, W, z, X;
582
- return [
583
- h("div", Xe, [
584
- h("div", Ze, [
585
- g(_(oe), {
586
- render: (N = (U = (M = D.recipe) == null ? void 0 : M.column) == null ? void 0 : U.columnDef) == null ? void 0 : N.cell,
587
- props: (L = (R = D.recipe) == null ? void 0 : R.getContext) == null ? void 0 : L.call(R)
588
- }, null, 8, ["render", "props"])
589
- ]),
590
- h("div", et, [
591
- g(_(oe), {
592
- render: (W = (Q = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
593
- props: (X = (z = D.ingredients) == null ? void 0 : z.getContext) == null ? void 0 : X.call(z)
594
- }, null, 8, ["render", "props"])
595
- ])
596
- ])
597
- ];
598
- }),
599
- _: 2
600
- }, 1032, ["row", "onRowClick"])
601
- ]),
602
- _: 1
603
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
604
- ], 2),
605
- (x(), T(pe, { to: "body" }, [
606
- g(Je, fe(ve(_(i))), null, 16)
607
- ]))
608
- ]),
609
- _: 1
610
- }, 8, ["title", "actions"]);
611
- };
612
- }
613
- });
614
- export {
615
- ct as default
616
- };