@feedmepos/mf-inventory-portal 0.0.22-dev.5 → 0.0.22-dev.50

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 (144) hide show
  1. package/dist/ApprovalView-CyIOcyG5.js +140 -0
  2. package/dist/{BindingsDialog-DQJhC3Mo.js → BindingsDialog-BXePN5iL.js} +10 -10
  3. package/dist/{BindingsPicker-YfbPb_dG.js → BindingsPicker-Bd_qb0aO.js} +15 -15
  4. package/dist/{BindingsTable-D3MVcHXZ.js → BindingsTable-BV-nP9HU.js} +4 -4
  5. package/dist/ClosingTemplateView-CSvWLccZ.js +1829 -0
  6. package/dist/FmDroppableField-DwZ6ujPh.js +154 -0
  7. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DpCoW_-F.js +266 -0
  8. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js +435 -0
  9. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-C8k7pSPT.js +51 -0
  10. package/dist/IngredientGroupView-C0hPeD41.js +608 -0
  11. package/dist/IngredientsView-CpwVIGXd.js +1608 -0
  12. package/dist/IntegrationView-Bt8pGAHS.js +1225 -0
  13. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-wsBLYBpB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-yA-qJUUz.js} +1 -1
  14. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BqcqoKyN.js +116 -0
  15. package/dist/{PurchaseOrderPrintPreview-BcAmgmD8.js → PurchaseOrderPrintPreview-D3ugzCW_.js} +7 -7
  16. package/dist/ReceiveRequestView-D14YTEEe.js +4073 -0
  17. package/dist/RecipeView-D0WsMfKm.js +594 -0
  18. package/dist/Standalone.vue.d.ts +2 -0
  19. package/dist/StockView-sxI0L6MP.js +7770 -0
  20. package/dist/SupplierView-clAkARuW.js +1468 -0
  21. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9NU1m6S.js +1150 -0
  22. package/dist/TransferTemplateView-DpI6kVqX.js +1258 -0
  23. package/dist/{UnitView-B95q8Xrj.js → UnitView-CneJsDum.js} +18 -18
  24. package/dist/{WarehouseView-CHGXvyeS.js → WarehouseView-DYbFWTlh.js} +176 -177
  25. package/dist/api/bill.d.ts +84 -238
  26. package/dist/api/closing-template.d.ts +6 -4
  27. package/dist/api/inventory.d.ts +282 -91
  28. package/dist/api/netsuite.d.ts +71 -0
  29. package/dist/api/purchase-order-template.d.ts +4 -6
  30. package/dist/api/supplier.d.ts +1 -0
  31. package/dist/{app-CfXF4jdF.js → app-B4pi48sM.js} +26414 -24985
  32. package/dist/app.d.ts +88 -3
  33. package/dist/app.js +3 -3
  34. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  35. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  36. package/dist/components/FmMultiselectDialog.vue.d.ts +3 -9
  37. package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
  38. package/dist/components/FmUnitInputRules.d.ts +2 -0
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
  40. package/dist/components/map/GoogleMap.vue.d.ts +4 -4
  41. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  42. package/dist/components/shell/inventory/binding-ui.vue.d.ts +2 -2
  43. package/dist/{decimal-BZ7tX47r.js → decimal-C8O2p3Sg.js} +1 -1
  44. package/dist/defineDeepModel-BXP1vLGf.js +13 -0
  45. package/dist/extensions/array.d.ts +1 -0
  46. package/dist/format-time-from-id-DgW7OJL_.js +15 -0
  47. package/dist/format-unit-display-BP4O0Pym.js +1195 -0
  48. package/dist/helper/rules.d.ts +7 -0
  49. package/dist/helper/rules.spec.d.ts +1 -0
  50. package/dist/helper/xlsx.util.d.ts +7 -0
  51. package/dist/router/name.d.ts +1 -0
  52. package/dist/stores/api.d.ts +1 -0
  53. package/dist/stores/feature.d.ts +0 -1
  54. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  55. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  56. package/dist/stores/integration/foodmarkethub.d.ts +391 -0
  57. package/dist/stores/integration/index.d.ts +7 -0
  58. package/dist/stores/integration/netsuite.d.ts +102 -0
  59. package/dist/stores/inventory.d.ts +294 -9
  60. package/dist/stores/location.d.ts +508 -503
  61. package/dist/stores/supplier.d.ts +124 -4
  62. package/dist/style.css +1 -1
  63. package/dist/supplier-D-8XhuF_.js +77 -0
  64. package/dist/tsconfig.app.tsbuildinfo +1 -1
  65. package/dist/use-template-enabled-locations-2-C2E4j3k-.js +85 -0
  66. package/dist/views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts +2 -0
  67. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
  68. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
  69. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
  70. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +877 -1038
  71. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +882 -1049
  72. package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
  73. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
  74. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
  75. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
  76. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
  77. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
  78. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
  79. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
  80. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  81. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  82. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
  83. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  84. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  85. package/dist/views/integration/FoodMarketHub.vue.d.ts +2 -0
  86. package/dist/views/integration/NetSuite.vue.d.ts +2 -0
  87. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +7 -7
  88. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +7 -7
  89. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  90. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +49 -0
  91. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1961 -87
  92. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  93. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
  94. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
  95. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2377 -292
  96. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2329 -244
  97. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
  98. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  99. package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
  100. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +32 -2
  101. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  102. package/dist/views/supplier/components/supplier-import/SupplierImport.vue.d.ts +2 -0
  103. package/dist/views/supplier/components/supplier-import/SupplierImportItem.vue.d.ts +12 -0
  104. package/dist/views/supplier/components/supplier-import/SupplierImportItemProps.d.ts +6 -0
  105. package/dist/views/supplier/composables/use-supplier-actions.d.ts +10 -0
  106. package/dist/views/supplier/helpers/import-export.helper.d.ts +50 -0
  107. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  108. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  109. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  110. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
  111. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
  112. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
  113. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  114. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  115. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  116. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1277 -1478
  117. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1697 -906
  118. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  119. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -247
  120. package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
  121. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  122. package/dist/{xlsx-BtP1Qjj6.js → xlsx-Dsy-fxZw.js} +1525 -1525
  123. package/dist/xlsx.util-CxGmvsp9.js +78 -0
  124. package/package.json +10 -7
  125. package/dist/ApprovalView-BdaNwUBc.js +0 -129
  126. package/dist/ClosingTemplateView-BpErgepi.js +0 -1030
  127. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D3B7kOlU.js +0 -372
  128. package/dist/IngredientsView-GqrkpCm5.js +0 -1758
  129. package/dist/IntegrationView-7c3MpUzS.js +0 -1141
  130. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BIwdObb1.js +0 -88
  131. package/dist/ReceiveRequestView-BAuXvzQW.js +0 -215
  132. package/dist/RecipeView-C6tZPQ-K.js +0 -581
  133. package/dist/StockView-4uXHYz4E.js +0 -1892
  134. package/dist/SupplierView-CuWvKCWY.js +0 -827
  135. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CTQ9HIqf.js +0 -740
  136. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang--6JoXOLD.js +0 -1409
  137. package/dist/TransferTemplateView-D1Lfi3aW.js +0 -1230
  138. package/dist/defineDeepModel-BKAs9qN6.js +0 -13
  139. package/dist/format-time-from-id-B7ZE4sdX.js +0 -15
  140. package/dist/id-to-date-D1lOqIir.js +0 -30
  141. package/dist/purchase-order-transaction-type-tZ7cj1dz.js +0 -702
  142. package/dist/supplier-BIDBk5S6.js +0 -69
  143. package/dist/use-template-enabled-locations-DlMnS9WJ.js +0 -57
  144. package/dist/xlsx.util-BKFiH-ig.js +0 -109
@@ -0,0 +1,154 @@
1
+ import { defineComponent as U, ref as d, computed as y, resolveComponent as k, openBlock as s, createElementBlock as c, createElementVNode as p, createCommentVNode as S, renderSlot as u, createBlock as C, normalizeClass as f, toDisplayString as F, unref as B } from "vue";
2
+ import { useI18n as W } from "@feedmepos/mf-common";
3
+ import { X } from "./app-B4pi48sM.js";
4
+ const q = {
5
+ key: 0,
6
+ class: "relative"
7
+ }, G = ["accept", "disabled"], H = { class: "flex flex-col gap-8" }, J = ["accept", "disabled"], K = /* @__PURE__ */ U({
8
+ __name: "FmDroppableField",
9
+ props: {
10
+ buttonLabel: {},
11
+ label: { default: "" },
12
+ disabled: { type: Boolean, default: !1 },
13
+ accept: { default: "" },
14
+ maxFileSize: { default: 8e6 },
15
+ contentClass: {}
16
+ },
17
+ emits: ["file-upload", "file-rejected"],
18
+ setup(T, { emit: V }) {
19
+ const l = T, g = V, { t: r } = W(), t = d(!1), i = d(null), n = d(null), m = d(), R = (e) => {
20
+ l.disabled || (e.stopPropagation(), e.preventDefault());
21
+ }, $ = (e) => {
22
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !0);
23
+ }, j = (e) => {
24
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !1);
25
+ }, E = (e) => {
26
+ var a;
27
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !1, h((a = e.dataTransfer) == null ? void 0 : a.files));
28
+ };
29
+ function h(e) {
30
+ if (e)
31
+ if (m.value = e, i.value = I(e[0]), n.value = P(e[0]), i.value && n.value)
32
+ g("file-upload", e[0]);
33
+ else {
34
+ const a = L();
35
+ g("file-rejected", [
36
+ {
37
+ file: e[0],
38
+ reason: a
39
+ }
40
+ ]);
41
+ }
42
+ }
43
+ const L = () => {
44
+ const e = new Array();
45
+ return i.value || e.push("invalid-type"), n.value || e.push("invalid-size"), e;
46
+ }, I = (e) => {
47
+ if (!l.accept) return !0;
48
+ const a = l.accept.split(",").map((o) => o.trim());
49
+ for (const o of a)
50
+ if (w(o)) {
51
+ if (D(o) === D(e.type)) return !0;
52
+ } else if (A(e) === o || e.type === o) return !0;
53
+ return !1;
54
+ }, P = (e) => e.size <= l.maxFileSize, w = (e) => e.indexOf("*") !== -1, A = (e) => "." + e.name.split(".").pop(), D = (e) => e.substring(0, e.indexOf("/")), O = y(() => {
55
+ if (t.value) return r("inventory.formField.dropField.dropToUpload");
56
+ if (i.value) {
57
+ if (!n.value)
58
+ return r("inventory.formField.dropField.fileSizeExceeded", { size: l.maxFileSize });
59
+ } else return r("inventory.formField.dropField.invalidFileType");
60
+ return "";
61
+ }), v = y(() => m.value ? !i.value || !n.value : !1), _ = (e) => {
62
+ const a = e.target;
63
+ h(a.files);
64
+ }, N = y(() => {
65
+ var e;
66
+ return (e = m.value) == null ? void 0 : e.item(0);
67
+ }), b = d();
68
+ return (e, a) => {
69
+ const o = k("FmLabel"), x = k("FmButton");
70
+ return s(), c("label", {
71
+ class: "fm-droppable-field",
72
+ ref_key: "fmButtonRef",
73
+ ref: b
74
+ }, [
75
+ e.$slots.default ? (s(), c("div", q, [
76
+ p("input", {
77
+ accept: e.accept,
78
+ disabled: e.disabled,
79
+ class: "fm-droppable-field__input",
80
+ type: "file",
81
+ onChange: _
82
+ }, null, 40, G)
83
+ ])) : S("", !0),
84
+ u(e.$slots, "default", {
85
+ isDragging: t.value,
86
+ isValidFileType: i.value,
87
+ isValidFileSize: n.value,
88
+ singleValidFile: N.value,
89
+ openFileDialog: () => {
90
+ var z;
91
+ return console.log("click", b.value), (z = b.value) == null ? void 0 : z.click();
92
+ }
93
+ }, () => [
94
+ p("div", H, [
95
+ e.$slots.label ? u(e.$slots, "label", { key: 0 }, void 0, !0) : (s(), C(o, {
96
+ key: 1,
97
+ label: e.label
98
+ }, null, 8, ["label"]))
99
+ ]),
100
+ p("div", {
101
+ class: f([[
102
+ e.contentClass ? e.contentClass : "w-full h-full",
103
+ {
104
+ "fm-droppable-field__container--dragging": t.value,
105
+ "fm-droppable-field__container--invalid": v.value && !e.disabled,
106
+ "fm-droppable-field__container--disabled": e.disabled
107
+ }
108
+ ], "fm-droppable-field__container"]),
109
+ onDragenter: R,
110
+ onDragleave: j,
111
+ onDragover: $,
112
+ onDrop: E
113
+ }, [
114
+ (t.value || v.value) && !e.disabled ? (s(), c("div", {
115
+ key: 0,
116
+ class: f({
117
+ "fm-typo-en-body-lg-600": !0,
118
+ "text-fm-color-primary": t.value,
119
+ "text-fm-color-typo-error": v.value
120
+ })
121
+ }, F(O.value), 3)) : (s(), C(x, {
122
+ key: 1,
123
+ disabled: e.disabled,
124
+ label: e.buttonLabel ?? "Add files",
125
+ size: "md",
126
+ variant: "secondary"
127
+ }, null, 8, ["disabled", "label"])),
128
+ u(e.$slots, "accept-text", {}, () => [
129
+ l.accept ? (s(), c("div", {
130
+ key: 0,
131
+ class: f([[e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-md-400"])
132
+ }, F(B(r)("inventory.formField.dropField.accepts", { fileTypes: e.accept })), 3)) : S("", !0)
133
+ ], !0),
134
+ p("input", {
135
+ accept: e.accept,
136
+ disabled: e.disabled,
137
+ class: "fm-droppable-field__input",
138
+ type: "file",
139
+ onChange: _
140
+ }, null, 40, J)
141
+ ], 34),
142
+ u(e.$slots, "helper-text", {}, () => [
143
+ p("div", {
144
+ class: f([[e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-sm-400"])
145
+ }, F(B(r)("inventory.formField.dropField.maxSize", { size: e.maxFileSize })), 3)
146
+ ], !0)
147
+ ], !0)
148
+ ], 512);
149
+ };
150
+ }
151
+ }), Z = /* @__PURE__ */ X(K, [["__scopeId", "data-v-e121b2c1"]]);
152
+ export {
153
+ Z as F
154
+ };
@@ -0,0 +1,266 @@
1
+ import { a as P, t as B, a7 as A, i as D, ad as R, am as H, an as V } from "./app-B4pi48sM.js";
2
+ import { u as j } from "./supplier-D-8XhuF_.js";
3
+ import { P as S } from "./format-unit-display-BP4O0Pym.js";
4
+ import { computed as y, defineComponent as $, mergeModels as W, useModel as J, resolveComponent as w, openBlock as F, createElementBlock as I, normalizeStyle as K, createElementVNode as N, createVNode as Q, withCtx as X, createBlock as x, createCommentVNode as E, Fragment as Y, renderList as Z, unref as M } from "vue";
5
+ function ne(c, i, t, s) {
6
+ var b, g, u;
7
+ if (s != null && s.manualTotalCost)
8
+ return s == null ? void 0 : s.manualTotalCost;
9
+ const e = (u = (g = (b = s == null ? void 0 : s.supplier) == null ? void 0 : b.supplyItems) == null ? void 0 : g.find(
10
+ (r) => r.skuId === c._id
11
+ )) == null ? void 0 : u.defaultCost, o = c.defaultCost, n = e ?? o, l = n == null ? void 0 : n.costPerUnit, a = l ? n != null && n.measurement ? +P(l) / +P(n == null ? void 0 : n.measurement.conversion) : +P(l) : void 0, p = a ? t ? a * +P(t.conversion) : a : void 0, d = p ? +P(i) * p : void 0;
12
+ return d ? {
13
+ ...B(d ?? 0, 2),
14
+ currency: A()
15
+ } : {
16
+ amount: 0,
17
+ precision: 0,
18
+ currency: A()
19
+ };
20
+ }
21
+ function _(c) {
22
+ return H.parse(c);
23
+ }
24
+ function T(c) {
25
+ return {
26
+ _id: c.doc._id,
27
+ internal: c.type,
28
+ contactName: c.doc.profile.name,
29
+ name: c.doc.profile.name ?? "",
30
+ email: c.doc.profile.email,
31
+ phoneNumber: c.doc.profile.phoneNo,
32
+ registrationNumber: c.doc.profile.regNo,
33
+ address: c.doc.profile.address ?? {
34
+ line1: "",
35
+ state: "",
36
+ city: "",
37
+ postcode: "",
38
+ country: ""
39
+ }
40
+ };
41
+ }
42
+ function oe(c, i, t = !1, s = !1) {
43
+ const e = j(), o = D();
44
+ o.watchLocation(async () => {
45
+ var v;
46
+ await e.readSuppliers();
47
+ const u = c();
48
+ if ((v = u.supplier) != null && v._id) return;
49
+ const r = s ? e.suppliers[0] : e.businessSuppliers[0], f = (t ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations)[0];
50
+ i({
51
+ ...u,
52
+ supplier: r ? _(r) : f ? T(f) : u.supplier
53
+ });
54
+ });
55
+ const n = y(
56
+ () => {
57
+ var u, r;
58
+ return typeof ((r = (u = c()) == null ? void 0 : u.supplier) == null ? void 0 : r.internal) == "string" ? S.TRANSFER : S.PURCHASE;
59
+ }
60
+ ), l = y({
61
+ get() {
62
+ var u, r;
63
+ return (r = (u = c()) == null ? void 0 : u.supplier) == null ? void 0 : r._id;
64
+ },
65
+ set(u) {
66
+ const r = c() ?? {};
67
+ if (n.value === S.PURCHASE) {
68
+ const C = (s ? e.suppliers : e.businessSuppliers).find((U) => U._id === u);
69
+ i({
70
+ ...r,
71
+ supplier: C ? _(C) : r.supplier
72
+ });
73
+ return;
74
+ }
75
+ const v = (t ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations).find((m) => m.doc._id === u);
76
+ i({
77
+ ...r,
78
+ supplier: v ? T(v) : r.supplier
79
+ });
80
+ }
81
+ }), a = y(() => e.locationSuppliers.map(_)), p = y(() => e.businessSuppliers.map(_)), d = y(() => {
82
+ const u = [...a.value], r = [...p.value];
83
+ return s ? [...r, ...u] : r;
84
+ }), k = y(() => {
85
+ var h;
86
+ const u = ((h = o._currentLocation) == null ? void 0 : h.type) === R.warehouse;
87
+ return (t ? o.locations.filter((f) => f.doc._id !== o.currentLocation.doc._id) : o.locations).filter((f) => u || f.acceptRequest).map(T);
88
+ }), b = y(() => {
89
+ if (n.value === S.PURCHASE) {
90
+ const r = a.value.map((f) => ({
91
+ label: f.name,
92
+ value: f._id
93
+ })), h = p.value.map((f) => ({
94
+ label: f.name,
95
+ sublabel: "Business supplier",
96
+ value: f._id
97
+ }));
98
+ return s ? [...r, ...h] : h;
99
+ }
100
+ return k.value.map((r) => ({
101
+ label: r.name,
102
+ sublabel: r.internal ? `${r.internal}` : void 0,
103
+ value: r._id
104
+ }));
105
+ }), g = y(() => {
106
+ var f, v;
107
+ const u = (v = (f = c()) == null ? void 0 : f.supplier) == null ? void 0 : v._id;
108
+ if (n.value === S.PURCHASE) {
109
+ const m = e.suppliers.find((C) => C._id === u);
110
+ return m ? _(m) : null;
111
+ }
112
+ const h = o.locations.find((m) => m.doc._id);
113
+ return h ? T(h) : null;
114
+ });
115
+ return {
116
+ transferLocationModel: l,
117
+ transferLocationOptions: b,
118
+ locationOptionsTypePurchase: d,
119
+ locationOptionsTypePurchaseLocationLevel: a,
120
+ locationOptionsTypeTransfer: k,
121
+ selectedLocation: g
122
+ };
123
+ }
124
+ class O {
125
+ static getDescendantProperty(i, t, s = []) {
126
+ let e, o, n, l, a, p;
127
+ if (t) {
128
+ if (n = t.indexOf("."), n === -1 ? e = t : (e = t.slice(0, n), o = t.slice(n + 1)), l = i[e], l !== null && typeof l < "u")
129
+ if (!o && (typeof l == "string" || typeof l == "number"))
130
+ s.push(l);
131
+ else if (Object.prototype.toString.call(l) === "[object Array]")
132
+ for (a = 0, p = l.length; a < p; a++)
133
+ O.getDescendantProperty(l[a], o, s);
134
+ else o && O.getDescendantProperty(l, o, s);
135
+ } else
136
+ s.push(i);
137
+ return s;
138
+ }
139
+ }
140
+ class L {
141
+ constructor(i = [], t = [], s = {}) {
142
+ Array.isArray(t) || (s = t, t = []), this.haystack = i, this.keys = t, this.options = Object.assign({
143
+ caseSensitive: !1,
144
+ sort: !1
145
+ }, s);
146
+ }
147
+ search(i = "") {
148
+ if (i === "")
149
+ return this.haystack;
150
+ const t = [];
151
+ for (let s = 0; s < this.haystack.length; s++) {
152
+ const e = this.haystack[s];
153
+ if (this.keys.length === 0) {
154
+ const o = L.isMatch(e, i, this.options.caseSensitive);
155
+ o && t.push({ item: e, score: o });
156
+ } else
157
+ for (let o = 0; o < this.keys.length; o++) {
158
+ const n = O.getDescendantProperty(e, this.keys[o]);
159
+ let l = !1;
160
+ for (let a = 0; a < n.length; a++) {
161
+ const p = L.isMatch(n[a], i, this.options.caseSensitive);
162
+ if (p) {
163
+ l = !0, t.push({ item: e, score: p });
164
+ break;
165
+ }
166
+ }
167
+ if (l)
168
+ break;
169
+ }
170
+ }
171
+ return this.options.sort && t.sort((s, e) => s.score - e.score), t.map((s) => s.item);
172
+ }
173
+ static isMatch(i, t, s) {
174
+ i = String(i), t = String(t), s || (i = i.toLocaleLowerCase(), t = t.toLocaleLowerCase());
175
+ const e = L.nearestIndexesFor(i, t);
176
+ return e ? i === t ? 1 : e.length > 1 ? 2 + (e[e.length - 1] - e[0]) : 2 + e[0] : !1;
177
+ }
178
+ static nearestIndexesFor(i, t) {
179
+ const s = t.split("");
180
+ let e = [];
181
+ return L.indexesOfFirstLetter(i, t).forEach((n, l) => {
182
+ let a = n + 1;
183
+ e[l] = [n];
184
+ for (let p = 1; p < s.length; p++) {
185
+ const d = s[p];
186
+ if (a = i.indexOf(d, a), a === -1) {
187
+ e[l] = !1;
188
+ break;
189
+ }
190
+ e[l].push(a), a++;
191
+ }
192
+ }), e = e.filter((n) => n !== !1), e.length ? e.sort((n, l) => n.length === 1 ? n[0] - l[0] : (n = n[n.length - 1] - n[0], l = l[l.length - 1] - l[0], n - l))[0] : !1;
193
+ }
194
+ static indexesOfFirstLetter(i, t) {
195
+ const s = t[0];
196
+ return i.split("").map((e, o) => e !== s ? !1 : o).filter((e) => e !== !1);
197
+ }
198
+ }
199
+ const z = { class: "sticky top-0 bg-white mb-8" }, G = { class: "overflow-y-auto pb-8" }, le = /* @__PURE__ */ $({
200
+ __name: "FmFilterableMenuOptions",
201
+ props: /* @__PURE__ */ W({
202
+ modelValue: {},
203
+ maxHeight: {},
204
+ width: {},
205
+ handleItemChange: { type: Function },
206
+ items: {},
207
+ options: {}
208
+ }, {
209
+ search: {},
210
+ searchModifiers: {}
211
+ }),
212
+ emits: ["update:search"],
213
+ setup(c) {
214
+ const i = c, t = J(c, "search"), s = y(
215
+ () => new L(i.items, ["label", "sublabel"], i.options)
216
+ ), e = y(() => s.value.search(t.value));
217
+ return (o, n) => {
218
+ const l = w("FmButton"), a = w("FmTextField"), p = w("FmMenuItem");
219
+ return F(), I("div", {
220
+ class: "relative",
221
+ style: K({ maxHeight: `${o.maxHeight}px`, width: o.width })
222
+ }, [
223
+ N("div", z, [
224
+ Q(a, {
225
+ modelValue: t.value,
226
+ "onUpdate:modelValue": n[1] || (n[1] = (d) => t.value = d),
227
+ placeholder: "Filter options"
228
+ }, {
229
+ append: X(() => [
230
+ t.value ? (F(), x(l, {
231
+ key: 0,
232
+ variant: "tertiary",
233
+ "prepend-icon": "close",
234
+ onClick: n[0] || (n[0] = (d) => t.value = "")
235
+ })) : E("", !0)
236
+ ]),
237
+ _: 1
238
+ }, 8, ["modelValue"])
239
+ ]),
240
+ N("div", G, [
241
+ (F(!0), I(Y, null, Z(e.value, (d, k) => (F(), x(p, {
242
+ key: k,
243
+ label: d.label,
244
+ sublabel: d.sublabel,
245
+ "model-value": M(V)(o.modelValue, d.value),
246
+ onClick: () => o.handleItemChange(M(V)(o.modelValue, d.value), d),
247
+ onVnodeMounted: (b) => {
248
+ var g;
249
+ return M(V)(o.modelValue, d.value) && ((g = b.el) == null || g.scrollIntoView({ behavior: "smooth", block: "center" }), console.log("scrollTo", b.el)), void 0;
250
+ }
251
+ }, null, 8, ["label", "sublabel", "model-value", "onClick", "onVnodeMounted"]))), 128)),
252
+ e.value.length ? E("", !0) : (F(), x(p, {
253
+ key: 0,
254
+ disabled: "",
255
+ label: "No options available"
256
+ }))
257
+ ])
258
+ ], 4);
259
+ };
260
+ }
261
+ });
262
+ export {
263
+ le as _,
264
+ ne as c,
265
+ oe as u
266
+ };