@feedmepos/mf-inventory-portal 1.2.59 → 1.2.60-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 (131) hide show
  1. package/dist/{App-Nwc0Ha2r.js → App-B_yr-6yL.js} +82 -78
  2. package/dist/{ApprovalView-Y5f915s3.js → ApprovalView-DoYBBuSD.js} +5 -5
  3. package/dist/{BindingsDialog-5N7R_u4c.js → BindingsDialog-DG7HOy6J.js} +5 -5
  4. package/dist/{BindingsPicker-BJwvLu2s.js → BindingsPicker-DVCYpyrR.js} +3 -3
  5. package/dist/{BindingsTable-B8sq-qXH.js → BindingsTable-CCel2b_W.js} +5 -5
  6. package/dist/{ClosingDraftView-BsyYOZsz.js → ClosingDraftView-CfM7gNBX.js} +891 -893
  7. package/dist/{ClosingHistoryView-BNpsMNy1.js → ClosingHistoryView-DWH4bFgg.js} +36 -36
  8. package/dist/{ClosingTemplateView-BBqbq07d.js → ClosingTemplateView-JYnnvm7L.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-CmOO7wuE.js → DeliveryOrderPrintPreview-BihBTJGj.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BXlY-Gu1.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CWjtQajS.js} +17 -17
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CAMkZRFI.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js} +2 -2
  12. package/dist/{FmMultiselectDialog-CwJUv9tG.js → FmMultiselectDialog-CxDviJZM.js} +16 -16
  13. package/dist/{FmMultiselectDialog-LagHyTQP.js → FmMultiselectDialog-D51nW6yj.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BmHFIkt1.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DLqUnROc.js} +16 -15
  15. package/dist/{ImportView-wQ_bNesb.js → ImportView-C52rZFib.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DtMrJIVs.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CjZmd-Sa.js} +1 -1
  17. package/dist/{IngredientGroupView-DsGMhdwu.js → IngredientGroupView-DTHpZP2L.js} +5 -5
  18. package/dist/{IngredientsView-JdjcLdOx.js → IngredientsView-CrCW6heJ.js} +25 -24
  19. package/dist/{IntegrationView-CMmSIRUk.js → IntegrationView--DZANrHj.js} +18 -17
  20. package/dist/{InventoryBindingForm-UL-UKtYW.js → InventoryBindingForm-DLTpv-zQ.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-r875PDKP.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-hkIg4Rbp.js} +17 -16
  22. package/dist/{InventoryBindingSummary-BDAuT62b.js → InventoryBindingSummary-D9ptV8Cw.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C5zOYiqR.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdPxhkg0.js} +5 -5
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-B2zppgqk.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ci3esisT.js} +2 -2
  25. package/dist/{PublishView-CSoZCSHT.js → PublishView-DxzL_D61.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-D5Qw44xo.js → PurchaseOrderPrintPreview-D0tg-2TC.js} +11 -11
  27. package/dist/{ReceiveRequestView-Chntp08E.js → ReceiveRequestView-2U534J1_.js} +251 -250
  28. package/dist/RecipeView-VZRyX3Mm.js +1558 -0
  29. package/dist/{StockView-CuCK7tD2.js → StockView-CvWbnYGz.js} +653 -651
  30. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CxjceLuZ.js +183 -0
  31. package/dist/{SupplierView-CA17Tz02.js → SupplierView-DMIunLvv.js} +20 -19
  32. package/dist/{SurchargeView-EIftjMCa.js → SurchargeView-jteWYvQz.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CqA6RmPy.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CyoUVoDH.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CYXsAP0i.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DAkKiy0Z.js} +1 -1
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BbbAEIcW.js → TransferDetails.vue_vue_type_script_setup_true_lang-CEXA3vvS.js} +77 -78
  36. package/dist/{TransferTemplateView-CYfbm9aS.js → TransferTemplateView-DMQ1WIij.js} +22 -21
  37. package/dist/UnitCostHistoryView-DQ3sXVAQ.js +651 -0
  38. package/dist/{UnitView-6s5CsGEQ.js → UnitView-p6eZ8G2C.js} +9 -9
  39. package/dist/{WarehouseView-BXDQOyFZ.js → WarehouseView-BIShkEPs.js} +5 -5
  40. package/dist/{WastageTemplateView-Cq92TiRs.js → WastageTemplateView-DCbczB_0.js} +14 -14
  41. package/dist/api/inventory.d.ts +126 -36
  42. package/dist/api/netsuite.d.ts +8 -1
  43. package/dist/api/stock-estimate.d.ts +2 -0
  44. package/dist/api/unit-cost-history.d.ts +28 -0
  45. package/dist/{app-DJuq_faF.js → app-BAVBNKKH.js} +7461 -6448
  46. package/dist/app.d.ts +236 -0
  47. package/dist/app.js +1 -1
  48. package/dist/{closing-template-D_zbp5V1.js → closing-template-DqxA750a.js} +1 -1
  49. package/dist/components/StockForecastProps.d.ts +6 -0
  50. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +37 -1
  51. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +14 -0
  52. package/dist/components/shell/inventory/binding-ui.vue.d.ts +16 -1
  53. package/dist/{date2-4vrHarNG.js → date2-CgwRU403.js} +1 -1
  54. package/dist/{dayjs.min-Dwp8614O.js → dayjs.min-CjWVK_Fe.js} +16 -16
  55. package/dist/{defineDeepModel-DVt2Wz9r.js → defineDeepModel-B1j_kSRA.js} +1 -1
  56. package/dist/{duplicate-template-CkYWeFtL.js → duplicate-template-iHtqE_uw.js} +1 -1
  57. package/dist/{feature-Beh-qc03.js → feature-DEryk-Cv.js} +94 -89
  58. package/dist/{format-time-from-id-84iLSxVu.js → format-time-from-id-C-mbWMLS.js} +1 -1
  59. package/dist/{format-unit-display-DfeNpWk4.js → format-unit-display-C8Hzskg0.js} +16 -15
  60. package/dist/helper/number.d.ts +2 -0
  61. package/dist/helper/type.d.ts +5 -0
  62. package/dist/{import-export.helper-fAVzQM2q.js → import-export.helper-DGg16RXI.js} +17 -16
  63. package/dist/{index-CoEqhZLm.js → index-BAkoTUB0.js} +1 -1
  64. package/dist/{index-B2_16R5E.js → index-BLowSL6G.js} +1471 -1412
  65. package/dist/{index-Chogzhcq.js → index-CLr4DPan.js} +3 -3
  66. package/dist/{lodash-Cx8BU1GH.js → lodash-D1_0uR01.js} +1 -1
  67. package/dist/{netsuite-C1bml-v1.js → netsuite-Bbxz8tiD.js} +60 -60
  68. package/dist/number-Cof88Fjz.js +232 -0
  69. package/dist/{purchase-order-template-BqFnJ-6B.js → purchase-order-template-B-sXEbRE.js} +1 -1
  70. package/dist/router/name.d.ts +1 -0
  71. package/dist/rules-CzPUVxD_.js +98 -0
  72. package/dist/{stock-KxT4JbNf.js → stock-BYPFH5a_.js} +1 -1
  73. package/dist/stock-D9E1uFb1.js +75 -0
  74. package/dist/stores/feature.d.ts +2 -0
  75. package/dist/stores/integration/netsuite.d.ts +8 -1
  76. package/dist/stores/inventory.d.ts +119 -30
  77. package/dist/{supplier-C7wUB1zT.js → supplier-wQYh275s.js} +2 -2
  78. package/dist/{surcharge-CjB_Qtbv.js → surcharge-Bi21qFa0.js} +1 -1
  79. package/dist/tsconfig.app.tsbuildinfo +1 -1
  80. package/dist/{use-ingredient-select-dialog-D5KSqA4Z.js → use-ingredient-select-dialog-DH-mXl8H.js} +2 -2
  81. package/dist/{use-inventory-binding-dialog-eGOvztV3.js → use-inventory-binding-dialog-i8E2CNuV.js} +2 -2
  82. package/dist/{use-template-enabled-locations-2-3kcVWPQm.js → use-template-enabled-locations-2-DRk9TskI.js} +2 -2
  83. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +64 -8
  84. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +192 -24
  85. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +8 -1
  86. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +96 -12
  87. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +96 -12
  88. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
  89. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +14 -0
  90. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +32 -4
  91. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +28 -0
  92. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +169 -0
  93. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +43 -0
  94. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +25 -0
  95. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +125 -0
  96. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +129 -0
  97. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +30 -0
  98. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +4 -0
  99. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +8 -1
  100. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +16 -2
  101. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +33 -5
  102. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +16 -2
  103. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +32 -4
  104. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +8 -1
  105. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +41 -6
  106. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +246 -36
  107. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +287 -42
  108. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +16 -0
  109. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -0
  110. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +16 -2
  111. package/dist/views/stock/type.d.ts +2 -0
  112. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +16 -2
  113. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +16 -2
  114. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +16 -2
  115. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -1
  116. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +24 -3
  117. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -12
  118. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -12
  119. package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +2 -0
  120. package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +19 -0
  121. package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +11 -0
  122. package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +65 -0
  123. package/dist/{vue-i18n-C6XNfngV.js → vue-i18n-Cf9iDkfk.js} +398 -398
  124. package/dist/{xlsx-BwNUbN_O.js → xlsx-lp5RXzSw.js} +398 -398
  125. package/dist/{xlsx.util-B_DE3inS.js → xlsx.util-BxpZNkEZ.js} +1 -1
  126. package/package.json +2 -2
  127. package/dist/RecipeView-Ck3Pa4fg.js +0 -646
  128. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-fMji2qKG.js +0 -172
  129. package/dist/decimal-Bf6AG_d3.js +0 -99
  130. package/dist/rules-y2OYGOro.js +0 -201
  131. package/dist/stock-BWUzlDTa.js +0 -75
@@ -1,172 +0,0 @@
1
- import { defineComponent as I, computed as x, openBlock as l, createElementBlock as d, createElementVNode as e, normalizeClass as b, toDisplayString as u, unref as p, ref as D, resolveComponent as B, Fragment as $, createVNode as k, createCommentVNode as N, withCtx as C, renderList as E } from "vue";
2
- import { useI18n as F, useCoreStore as A } from "@feedmepos/mf-common";
3
- import { u as U } from "./netsuite-C1bml-v1.js";
4
- function ee(o, n = !1) {
5
- var c;
6
- return o ? [
7
- {
8
- label: n ? o.abbrev : `1 ${o.name} (${o.abbrev})`,
9
- abbrev: o.abbrev,
10
- value: null
11
- },
12
- ...((c = o.measurements) == null ? void 0 : c.map((t) => ({
13
- label: n ? t.abbrev : `1 ${t.name} (${t.abbrev})`,
14
- abbrev: t.abbrev,
15
- value: t.id
16
- }))) ?? []
17
- ] : [];
18
- }
19
- var y = /* @__PURE__ */ ((o) => (o.noInfo = "no-info", o.low = "low", o.mid = "mid", o.high = "high", o))(y || {});
20
- const H = {
21
- key: 0,
22
- class: "flex"
23
- }, O = {
24
- key: 1,
25
- class: "flex"
26
- }, z = { class: "flex px-8 py-4 bg-fm-color-neutral-gray-100 fm-corner-radius-md gap-8" }, R = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, re = /* @__PURE__ */ I({
27
- __name: "StockForecast",
28
- props: {
29
- days: {},
30
- level: {}
31
- },
32
- setup(o) {
33
- const n = o, { t: m } = F(), c = x(() => n.level ? n.level : typeof n.days != "number" ? y.noInfo : n.days > 14 ? y.high : n.days >= 7 && n.days <= 14 ? y.mid : y.low);
34
- return (t, g) => typeof n.days == "number" ? (l(), d("div", H, [
35
- e("div", {
36
- class: b([
37
- `fm-forecast-notification-${c.value}`,
38
- "flex items-center gap-8 p-4 fm-corner-radius-md fm-typo-en-body-md-600"
39
- ])
40
- }, [
41
- e("div", {
42
- class: b([
43
- "fm-forecast-notification-indicator",
44
- `fm-forecast-notification-indicator-${c.value}`
45
- ])
46
- }, null, 2),
47
- e("div", null, u(p(m)("inventory.stock.prediction.days", [n.days])), 1)
48
- ], 2)
49
- ])) : (l(), d("div", O, [
50
- e("div", z, [
51
- e("p", R, u(p(m)("inventory.stock.prediction.noData")), 1)
52
- ])
53
- ]));
54
- }
55
- }), Y = {
56
- key: 0,
57
- class: "flex items-center gap-8"
58
- }, j = { class: "flex flex-col" }, q = { class: "fm-typo-en-heading-lg-600" }, G = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, J = {
59
- key: 0,
60
- class: "fm-typo-en-body-md-400 text-fm-color-system-warning-300"
61
- }, K = {
62
- key: 1,
63
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
64
- }, M = { class: "flex flex-col" }, Q = { class: "flex flex-col bg-fm-color-bg-secondary font-mono p-4 rounded-md" }, W = { class: "text-fm-color-typo-tertiary flex-shrink-0 fm-typo-en-body-md-400 whitespace-pre flex items-center" }, se = /* @__PURE__ */ I({
65
- __name: "SubsidiaryTreeDialog",
66
- setup(o) {
67
- const n = D(!1), { t: m } = F(), c = A(), t = U(), g = x(() => {
68
- var i;
69
- return ((i = c.sessionUser.value) == null ? void 0 : i.role.isAdmin) ?? !1;
70
- });
71
- function h(i, r = [], a = []) {
72
- const f = [];
73
- return i.forEach((s, V) => {
74
- const S = V === i.length - 1, P = [...r, S];
75
- let v = "";
76
- for (let _ = 0; _ < r.length; _++)
77
- v += r[_] ? " " : "│ ";
78
- v += S ? "└── " : "├── ", f.push({
79
- id: s.id,
80
- name: s.name,
81
- prefix: r.length === 0 ? "" : v,
82
- isCurrentBusiness: s.id === t.businessSubsidiaryId,
83
- isRoot: r.length === 0,
84
- isInPath: a.includes(s.id)
85
- }), s.children && s.children.length > 0 && f.push(...h(s.children, P, a));
86
- }), f;
87
- }
88
- function w(i, r) {
89
- return i.map((a) => r.includes(a.id) ? {
90
- ...a,
91
- // Recursively filter children
92
- children: a.children ? w(a.children, r) : []
93
- } : null).filter(Boolean);
94
- }
95
- const T = x(() => {
96
- if (!t.businessSubsidiaryId)
97
- return [];
98
- const i = t.getBusinessSubsidiaryTree(), r = t.getBusinessSubsidiaryPath();
99
- if (g.value)
100
- return h(i, [], r);
101
- const a = w(i, r);
102
- return h(a, [], r);
103
- });
104
- return (i, r) => {
105
- const a = B("FmButton"), f = B("FmDialog");
106
- return l(), d($, null, [
107
- p(t).isEnabled ? (l(), d("div", Y, [
108
- k(a, {
109
- "prepend-icon": "info",
110
- variant: "tertiary",
111
- onClick: r[0] || (r[0] = (s) => n.value = !0)
112
- })
113
- ])) : N("", !0),
114
- k(f, {
115
- modelValue: n.value,
116
- "onUpdate:modelValue": r[1] || (r[1] = (s) => n.value = s),
117
- "close-button": "",
118
- dismissAway: ""
119
- }, {
120
- "dialog-header": C(() => [
121
- e("div", j, [
122
- e("div", q, u(p(m)("inventory.integration.netsuite.subsidiaryHierarchy.title")), 1),
123
- e("p", G, u(p(m)("inventory.integration.netsuite.subsidiaryHierarchy.description")), 1),
124
- g.value ? (l(), d("p", J, " All subsidiaries are shown since you are an admin. ")) : (l(), d("p", K, " Only showing subsidiaries in your business path. ")),
125
- r[2] || (r[2] = e("div", { class: "flex flex-wrap gap-2 mt-4" }, [
126
- e("div", { class: "flex items-center gap-2 px-2 py-1 bg-fm-color-bg-brand-secondary rounded-md" }, [
127
- e("span", { class: "w-3 h-3 rounded-sm bg-green-400" }),
128
- e("span", { class: "fm-typo-en-body-sm-400" }, "Your Business")
129
- ]),
130
- e("div", { class: "flex items-center gap-2 px-2 py-1 bg-fm-color-bg-primary rounded-md border border-fm-color-border-secondary" }, [
131
- e("span", { class: "w-3 h-3 rounded-sm bg-gray-200 border-2 border-gray-400" }),
132
- e("span", { class: "fm-typo-en-body-sm-400" }, "Parent Subsidiary")
133
- ])
134
- ], -1))
135
- ])
136
- ]),
137
- default: C(() => [
138
- e("div", M, [
139
- e("div", Q, [
140
- (l(!0), d($, null, E(T.value, (s) => (l(), d("div", {
141
- key: s.id,
142
- class: "flex items-stretch"
143
- }, [
144
- e("span", W, u(s.prefix), 1),
145
- e("div", {
146
- class: b([
147
- "px-2 py-1 rounded-md flex-1",
148
- s.isCurrentBusiness ? "border-2 bg-green-200 border-green-400" : s.isInPath ? "border-2 bg-gray-200 border-gray-400" : "bg-fm-color-bg-primary border border-fm-color-border-secondary"
149
- ])
150
- }, [
151
- e("span", {
152
- class: b([
153
- s.isCurrentBusiness || s.isInPath ? "fm-typo-en-body-md-600 text-fm-color-typo-primary" : "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
154
- ])
155
- }, u(s.name), 3)
156
- ], 2)
157
- ]))), 128))
158
- ])
159
- ])
160
- ]),
161
- _: 1
162
- }, 8, ["modelValue"])
163
- ], 64);
164
- };
165
- }
166
- });
167
- export {
168
- y as S,
169
- re as _,
170
- se as a,
171
- ee as g
172
- };
@@ -1,99 +0,0 @@
1
- import "./app-DJuq_faF.js";
2
- import "./dayjs.min-Dwp8614O.js";
3
- function m(a) {
4
- function t(o, n = !0) {
5
- const e = Math.round(Math.log10(o));
6
- return isFinite(e) && e >= 0 ? Math.ceil(e) : n ? 0 : Math.floor(e);
7
- }
8
- function r(o) {
9
- const n = o.conversion;
10
- return i - n.precision + t(n.amount);
11
- }
12
- const i = a.precision;
13
- return a.measurements.reduce((o, n) => {
14
- const e = r(n);
15
- return e > o ? e : o;
16
- }, 0);
17
- }
18
- class c {
19
- static toDouble(t) {
20
- return t.amount / Math.pow(10, t.precision);
21
- }
22
- static multiplyDecimal(t, r) {
23
- let i = t.amount * r.amount, o = i == 0 ? 0 : t.precision + r.precision, n = i.toString();
24
- for (; n.length > 0 && n[n.length - 1] == "0" && o > 0; )
25
- i = i / 10, o -= 1, n = i.toString();
26
- return {
27
- amount: i,
28
- precision: o
29
- };
30
- }
31
- static divide(t, r) {
32
- return {
33
- amount: Math.floor(t.amount / r),
34
- precision: t.precision
35
- };
36
- }
37
- /// Adds two decimals and returns result of any max precision from [left] or [right]
38
- static addDecimal(t, r) {
39
- const i = c.normalize([t, r]), o = i[0], n = i[1];
40
- return {
41
- amount: o.amount + n.amount,
42
- precision: o.precision
43
- };
44
- }
45
- /// Multiplies amount if new precision is higher or rounds amount if new precision is lower
46
- ///
47
- /// e.g. 0.4 to 2 precision --> 0.40
48
- /// 0.47 to 1 precision --> 0.5
49
- /// 0.22 to 1 precision --> 0.0
50
- static toPrecision(t, r) {
51
- function i(n, e) {
52
- let s = n.amount;
53
- for (let u = n.precision; u < e; u++)
54
- s *= 10;
55
- return {
56
- amount: s,
57
- precision: e
58
- };
59
- }
60
- function o(n, e) {
61
- let s = n.amount;
62
- for (let u = n.precision; u > e; u--)
63
- s /= 10;
64
- return {
65
- amount: Number(s.toFixed(0)),
66
- precision: e
67
- };
68
- }
69
- return t.precision == r ? t : t.precision < r ? i(t, r) : o(t, r);
70
- }
71
- static equal(t, r) {
72
- const i = c.normalize([t, r]), o = i[0], n = i[1];
73
- return o.amount == n.amount;
74
- }
75
- static normalize(t) {
76
- const r = t.reduce(
77
- (i, o) => Math.max(i, Math.floor(o.precision)),
78
- 0
79
- );
80
- return t.map((i) => c.toPrecision(i, r));
81
- }
82
- }
83
- function f(a, t, r, i = !0) {
84
- let o = {
85
- ...a
86
- };
87
- if (r) {
88
- const n = typeof r == "string" ? t.measurements.find((s) => s.id === r) : r;
89
- if (!n)
90
- return "NaN";
91
- const e = m(t);
92
- return o.precision < e && (o = c.toPrecision(o, m(t))), o = c.divide(o, c.toDouble(n.conversion)), `${c.toDouble(o)} ${n.abbrev}`;
93
- }
94
- return i ? `${c.toDouble(o)} ${t.abbrev}` : c.toDouble(o);
95
- }
96
- export {
97
- c as F,
98
- f as g
99
- };
@@ -1,201 +0,0 @@
1
- import { w as s } from "./app-DJuq_faF.js";
2
- import "./dayjs.min-Dwp8614O.js";
3
- import { d, b } from "./date2-4vrHarNG.js";
4
- function P(t, n) {
5
- return s.convertPrecision({
6
- value: t,
7
- precision: n
8
- });
9
- }
10
- function $(t, n) {
11
- return s.subtract([t, n]);
12
- }
13
- function N(t, n) {
14
- return s.add([t, n]);
15
- }
16
- function D(t, n) {
17
- return s.multiply([t, n]);
18
- }
19
- function F(t, n) {
20
- return s.multiply([t, n]);
21
- }
22
- function l(t, n) {
23
- const r = +u(t), i = +u(n);
24
- return r / i;
25
- }
26
- function T(t, n) {
27
- t = f(t), n = f(n);
28
- const r = l(t, n);
29
- return c(r);
30
- }
31
- function w(t, n) {
32
- return t.precision >= n ? t : s.convertPrecision({ value: t, precision: n });
33
- }
34
- function f(t) {
35
- if (t.amount === 0) return c(0);
36
- const n = y(t.amount), r = t.precision - n;
37
- return s.convertPrecision({ value: t, precision: Math.max(0, r) });
38
- }
39
- function u(t, n = !0) {
40
- return n ? Number(t.amount / Math.pow(10, t.precision)).toFixed(t.precision) : Number(t.amount / Math.pow(10, t.precision)).toString();
41
- }
42
- function x(t, n) {
43
- n = n ?? h(t);
44
- const r = n, i = t.toFixed(r), e = i.includes(".") ? i.replace(/0+$/, "") : i;
45
- return e.endsWith(".") ? e.slice(0, e.length - 1) : e;
46
- }
47
- function O(t, n = !1, r = 2) {
48
- const i = Number(t.amount / Math.pow(10, t.precision)), e = i.toFixed(
49
- Number.isInteger(i) ? 2 : Math.min(4, Math.max(2, r))
50
- );
51
- return n ? `${e} ${t.currency}` : t.currency === "MYR" ? `RM ${e}` : `${t.currency} ${e}`;
52
- }
53
- function R(t) {
54
- return {
55
- ...t,
56
- amount: Math.abs(t.amount)
57
- };
58
- }
59
- function h(t) {
60
- if (!isFinite(t)) return 0;
61
- let n = 1, r = 0;
62
- for (; Math.round(t * n) / n !== t; )
63
- n *= 10, r++;
64
- return r;
65
- }
66
- function c(t) {
67
- const n = h(t);
68
- return {
69
- precision: n,
70
- amount: t * 10 ** n
71
- };
72
- }
73
- function q(t, n = 0, r = !1) {
74
- let i = 0;
75
- return Number.isNaN(Number(t)) || (r || Number(t) >= 0) && (i = Number(t)), {
76
- amount: Number((i * 10 ** n).toFixed(0)),
77
- precision: n
78
- };
79
- }
80
- function y(t) {
81
- const n = `${t}`, r = n.replace(/0*$/g, "");
82
- return n.length - r.length;
83
- }
84
- function M(t, n) {
85
- if (!n)
86
- return t.precision;
87
- const r = y(n.conversion.amount);
88
- return t.precision - n.conversion.precision + r;
89
- }
90
- function B() {
91
- return function(n) {
92
- return !!n || "Required";
93
- };
94
- }
95
- function m(t) {
96
- return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "amount") && Object.prototype.hasOwnProperty.call(t, "precision");
97
- }
98
- function L(t, n) {
99
- const r = typeof t == "object" ? +u(t) : t;
100
- function i(e) {
101
- return Object.prototype.hasOwnProperty.call(e, "length");
102
- }
103
- return function(o) {
104
- return m(o) && (o = +u(o)), Number.isFinite(+o) && (o = +o), i(o) ? o.length >= r ? !0 : typeof n == "function" ? n(o.length) : n ?? `Must be at least ${r}` : typeof o == "number" ? o >= r ? !0 : typeof n == "function" ? n(o) : n ?? `Must be at least ${r}` : `Cannot validate at least ${r}`;
105
- };
106
- }
107
- function C(t) {
108
- const n = typeof t == "object" ? +u(t) : t;
109
- function r(i) {
110
- return Object.prototype.hasOwnProperty.call(i, "length");
111
- }
112
- return function(e, o) {
113
- return m(e) && (e = +u(e)), r(e) ? e.length > n ? !0 : typeof o == "function" ? o(e.length) : o ?? `Must be more than ${n}` : typeof e == "number" ? e > n ? !0 : typeof o == "function" ? o(e) : o ?? `Must be more than ${n}` : `Cannot validate more than ${n}`;
114
- };
115
- }
116
- function V(t, n) {
117
- return t instanceof Date && n instanceof Date ? function(i) {
118
- const e = new Date(i);
119
- return isNaN(e.getTime()) ? "Invalid date" : e.getTime() < t.getTime() ? `Date must be at least ${d(t)} ${b(t)}` : e.getTime() >= n.getTime() ? `Date must be less than ${d(n)} ${b(n)}` : !0;
120
- } : typeof t == "number" && typeof n == "number" ? function(i) {
121
- const e = +i;
122
- return isNaN(e) ? "Invalid number" : e < t ? `Value must be at least ${t}` : e >= n ? `Value must be less than ${n}` : !0;
123
- } : function() {
124
- return "Progamming error: invalid range parameter.";
125
- };
126
- }
127
- function a() {
128
- return function(t) {
129
- if (t = String(t), t.length === 0)
130
- return !0;
131
- const n = +t;
132
- return isFinite(n) || "Must be a number";
133
- };
134
- }
135
- function Y(t, n) {
136
- return typeof t == "number" ? function(i) {
137
- const e = a()(i);
138
- return typeof e == "string" ? e : c(+i).precision > t ? `Precision cannot be more than ${t} decimal point.` : !0;
139
- } : function(i) {
140
- const e = a()(i);
141
- if (typeof e == "string")
142
- return e;
143
- const o = M(t, n);
144
- return c(+i).precision > o ? `Precision cannot be more than ${o} decimal point.` : !0;
145
- };
146
- }
147
- function S(t, n) {
148
- return function(i) {
149
- const e = a()(i);
150
- if (typeof e == "string")
151
- return e;
152
- const o = c(+i);
153
- return o.precision > t ? typeof n == "function" ? n(o.precision) : n ?? `Precision cannot be more than ${t}` : !0;
154
- };
155
- }
156
- function Z(t, n, r) {
157
- return function(e) {
158
- if (e === n) return !0;
159
- const o = t.find((p) => p.value === e);
160
- return o ? r ? r(o) : `Already used in ${o.label}` : !0;
161
- };
162
- }
163
- function U(t) {
164
- let n = typeof t == "number" ? c(t) : t;
165
- n = f(n);
166
- const r = u(n);
167
- return function(e) {
168
- if (!m(e)) {
169
- if (e = +e, Number.isNaN(e)) return !0;
170
- e = c(e);
171
- }
172
- return e = f(e), e.amount % n.amount === 0 && e.precision <= n.precision ? !0 : `${u(e)} must be a multiple of ${r}`;
173
- };
174
- }
175
- export {
176
- L as A,
177
- V as B,
178
- a as I,
179
- Y as M,
180
- B as R,
181
- Z as U,
182
- u as a,
183
- f as b,
184
- U as c,
185
- c as d,
186
- O as e,
187
- F as f,
188
- M as g,
189
- C as h,
190
- h as i,
191
- R as j,
192
- D as k,
193
- N as l,
194
- P as m,
195
- x as n,
196
- $ as o,
197
- T as p,
198
- S as q,
199
- q as t,
200
- w as u
201
- };
@@ -1,75 +0,0 @@
1
- import { u as i } from "./stock-KxT4JbNf.js";
2
- import { a as s, L as p } from "./app-DJuq_faF.js";
3
- import { ref as d, computed as k } from "vue";
4
- import { d as B } from "./rules-y2OYGOro.js";
5
- function m() {
6
- return {
7
- stockBalance: {
8
- _id: "",
9
- items: []
10
- },
11
- productBalance: []
12
- };
13
- }
14
- const v = B(0), f = {
15
- id: "",
16
- balance: v,
17
- closing: null,
18
- costs: null
19
- }, c = d(m()), w = () => {
20
- const r = s(), u = k(() => {
21
- var a;
22
- const o = (a = c.value.stockBalance.skus) == null ? void 0 : a.groupBy((t) => t.id), n = (t) => {
23
- var e;
24
- return ((e = o == null ? void 0 : o.get(t)) == null ? void 0 : e[0]) ?? { ...f, id: t };
25
- };
26
- return r.skus.map((t) => n(t._id));
27
- }), l = i();
28
- return {
29
- // state
30
- get stockBalance() {
31
- return {
32
- ...c.value.stockBalance,
33
- skus: u.value
34
- };
35
- },
36
- set stockBalance(o) {
37
- c.value.stockBalance = o;
38
- },
39
- get productBalance() {
40
- return c.value.productBalance;
41
- },
42
- set productBalance(o) {
43
- c.value.productBalance = o;
44
- },
45
- // actions
46
- async readStockBalance() {
47
- this.stockBalance = await l.readStockBalance();
48
- },
49
- async readProductBalance() {
50
- this.productBalance = [];
51
- const o = s(), n = p({
52
- recipes: o.recipes,
53
- skus: o.skus,
54
- skuGroups: o.skuGroups,
55
- inventoryBindingMapping: {},
56
- stockBalance: this.stockBalance
57
- // silent: true
58
- });
59
- function a(t, e) {
60
- return Object.prototype.hasOwnProperty.call(t, e);
61
- }
62
- for (const t in n.convertCountdown)
63
- if (a(n.convertCountdown, t)) {
64
- const e = n.convertCountdown[t];
65
- this.productBalance.push({
66
- id: t,
67
- count: e
68
- });
69
- }
70
- }
71
- };
72
- };
73
- export {
74
- w as u
75
- };