@feedmepos/mf-inventory-portal 1.7.8-dev.0 → 1.7.8-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 (95) hide show
  1. package/dist/App-U47rY2Jb.js +1047 -0
  2. package/dist/{ApprovalView-B4q5mqes.js → ApprovalView-B9FANJAO.js} +9 -9
  3. package/dist/{BindingsDialog-B_LjWtSV.js → BindingsDialog-BgSDKyBG.js} +2 -2
  4. package/dist/{BindingsPicker-B-0waWJB.js → BindingsPicker-D0vxwn7C.js} +2 -2
  5. package/dist/{BindingsTable-CMZWm4ZL.js → BindingsTable-C5reUXmA.js} +3 -3
  6. package/dist/{BulkReceiveRequestView-DPozDWQD.js → BulkReceiveRequestView-DwLRo67t.js} +19 -19
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DEZB5R56.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-BUTlcssb.js} +1 -1
  8. package/dist/{ClosingDraftView-BYkJg-R4.js → ClosingDraftView-B1zZ3aIa.js} +19 -19
  9. package/dist/{ClosingHistoryView-Djy_dIWY.js → ClosingHistoryView-CU18j78j.js} +5 -5
  10. package/dist/{ClosingTemplateView-DKBLzKtu.js → ClosingTemplateView-BqDtL7ow.js} +16 -16
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-CH9kPcx5.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-Cl_pGeUh.js} +1 -1
  12. package/dist/{DefaultView-BRW9EIZh.js → DefaultView-Gid5oA6p.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-CcLwWI3S.js → DeliveryOrderPrintPreview-9xYdwvYj.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-DcZwy14F.js → EmailDialog.vue_vue_type_script_setup_true_lang-DJpX9Krf.js} +2251 -2251
  15. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-BQOLDYzb.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-nl3FRdHk.js} +1 -1
  16. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bt0eURos.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bny1eKDG.js} +2 -2
  17. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DdnsFwk-.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjSnlgdR.js} +2 -2
  18. package/dist/{FmMultiselectDialog-CVFXYx33.js → FmMultiselectDialog-TqAkWUct.js} +2 -2
  19. package/dist/{FmMultiselectDialog-B1KagbRR.js → FmMultiselectDialog-b3oeCeNm.js} +1 -1
  20. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DRxDsOtR.js → FmUnitInput.vue_vue_type_script_setup_true_lang-C05vgRcd.js} +5 -5
  21. package/dist/{ImportView-tuRtpDS3.js → ImportView-xUT7qw16.js} +6 -6
  22. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-UctOljlp.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Rb3mLGHB.js} +1 -1
  23. package/dist/{IngredientGroupView-CxHASJov.js → IngredientGroupView-DEmt1Nt2.js} +5 -5
  24. package/dist/{IngredientsView-I_NoY6H0.js → IngredientsView-C71EIjYh.js} +15 -15
  25. package/dist/{IntegrationExplorerView-DB3_aXAV.js → IntegrationExplorerView-J-CDF7z3.js} +4 -4
  26. package/dist/{IntegrationView-JxkVQewS.js → IntegrationView-DQz4LVNR.js} +2226 -2257
  27. package/dist/{InventoryBindingForm-CLKh2-Ef.js → InventoryBindingForm-DhLq-Usu.js} +1 -1
  28. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-dSxe0nHQ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D0jdszMn.js} +5 -5
  29. package/dist/{InventoryBindingSummary-B1IlrBo6.js → InventoryBindingSummary-D8uUEt6E.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B6QWqTod.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DyA3ldCI.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CW54hiSd.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DxBIFJBj.js} +1 -1
  32. package/dist/{ProductionView-DUNGnQEg.js → ProductionView--6IWl-7i.js} +7 -7
  33. package/dist/{PublishView-GBCruZ-w.js → PublishView-Db2agQ9W.js} +3 -3
  34. package/dist/{PurchaseOrderPrintPreview-Fo2tLSO5.js → PurchaseOrderPrintPreview-YconyHNq.js} +2 -2
  35. package/dist/{ReceiveRequestView-B4gPHwMV.js → ReceiveRequestView-Difh1lL5.js} +14 -14
  36. package/dist/{RecipeView-BR3VA_0D.js → RecipeView-BW72z99u.js} +17 -17
  37. package/dist/{SettingsView-BczYIrR-.js → SettingsView-CmaWy05N.js} +4 -4
  38. package/dist/{StockView-DZyaHXe3.js → StockView-D0rgzA23.js} +21 -21
  39. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DgBvjMZN.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CXFnxoxS.js} +1 -1
  40. package/dist/{SupplierView-g0MNvSO2.js → SupplierView-CRd_rgz2.js} +12 -12
  41. package/dist/{SurchargeView-MuoYcxap.js → SurchargeView-Bwyn5pGN.js} +6 -6
  42. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-DbG2xt4U.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-bwBYqedG.js} +2 -2
  43. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BXKv2j2R.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-B1Ygs7u3.js} +1 -1
  44. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-k8_ucJn5.js → TransferDetails.vue_vue_type_script_setup_true_lang-B8WiPRIm.js} +20 -20
  45. package/dist/{TransferTemplateView-IL8bL6W2.js → TransferTemplateView-DsrX-RtB.js} +20 -20
  46. package/dist/{UnitCostHistoryView-D2NG4GHN.js → UnitCostHistoryView-BAxvHdRS.js} +4 -4
  47. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BOc6nlA9.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-Cr65A-G_.js} +4 -4
  48. package/dist/{UnitView-Dg9t1qUE.js → UnitView-BHd4lqWW.js} +7 -7
  49. package/dist/{WarehouseView-Bk0OfnU4.js → WarehouseView-DYifatvo.js} +5 -5
  50. package/dist/{WastageTemplateView-UmEEALA1.js → WastageTemplateView-xL8JVZek.js} +14 -14
  51. package/dist/api/changelog.d.ts +18 -0
  52. package/dist/{app-05jiAJnw.js → app-COKbtOA1.js} +27 -19
  53. package/dist/app.d.ts +8 -0
  54. package/dist/app.js +1 -1
  55. package/dist/{closing-template-SQIDVXpI.js → closing-template-Bq6pmQSd.js} +1 -1
  56. package/dist/{date2-CnQ-plxk.js → date2-CofSmYX_.js} +1 -1
  57. package/dist/{dayjs.min-CQUk3G17.js → dayjs.min-trXBuULa.js} +1 -1
  58. package/dist/{decimal-DD5QGGH8.js → decimal-DYB7G8ew.js} +2 -2
  59. package/dist/{defineDeepModel-C8Llkit7.js → defineDeepModel-C6XCyElP.js} +1 -1
  60. package/dist/{duplicate-template-BwLwRZXS.js → duplicate-template-CZLpC0rN.js} +1 -1
  61. package/dist/{feature-7eCXC9nQ.js → feature-Cbh3pnRj.js} +2 -2
  62. package/dist/{format-time-from-id-Bty8dxXQ.js → format-time-from-id-OaWsMH6F.js} +1 -1
  63. package/dist/{format-unit-display-SJe9iKBr.js → format-unit-display-DKOe2Ppl.js} +12 -12
  64. package/dist/{import-export.helper-CMc5rD06.js → import-export.helper-ZIrat15C.js} +6 -6
  65. package/dist/{index-BRJ7Ys9V.js → index-BHemLKdK.js} +3 -3
  66. package/dist/{index-DcjoHL6D.js → index-BpO95fSn.js} +1 -1
  67. package/dist/{index-CiCDb-aF.js → index-Dcn2QZGA.js} +1 -1
  68. package/dist/{inventory-core-dart.default-0faW3OGz.js → inventory-core-dart.default-Dd6MmFba.js} +1 -1
  69. package/dist/{lz-string-DbZLr0IA.js → lz-string-CVdKtz16.js} +1 -1
  70. package/dist/{netsuite-BU5IuQNf.js → netsuite-C0SGMd47.js} +2 -2
  71. package/dist/{number-DvZJcu2N.js → number-Bi7AWAN2.js} +3 -3
  72. package/dist/{predefined-templates-E4JzADwF.js → predefined-templates-L1kkS5g4.js} +1 -1
  73. package/dist/{purchase-order-template-B6z8EahZ.js → purchase-order-template-Brk4EUzk.js} +1 -1
  74. package/dist/{recalculationUtils-B_LV5xTn.js → recalculationUtils-D6xZMdzy.js} +1 -1
  75. package/dist/{rules-BoXqX10l.js → rules--pM-Unx3.js} +2 -2
  76. package/dist/{stock-Dy-Zteij.js → stock-CYOnWr3j.js} +3 -3
  77. package/dist/{stock-D5Vjh3qn.js → stock-Cu6RYbIs.js} +1 -1
  78. package/dist/style.css +1 -1
  79. package/dist/{supplier-8_XKZUX2.js → supplier-CA8KF1mH.js} +2 -2
  80. package/dist/{surcharge-C7DsqmPY.js → surcharge-DF9qRHpB.js} +1 -1
  81. package/dist/tsconfig.app.tsbuildinfo +1 -1
  82. package/dist/{uom-rules-B4YF_ueP.js → uom-rules-BG4sWtFl.js} +1 -1
  83. package/dist/{use-ingredient-select-dialog-BPGzdwcV.js → use-ingredient-select-dialog-Hg6ZfIBZ.js} +2 -2
  84. package/dist/{use-inventory-binding-dialog-DYeYv1Lr.js → use-inventory-binding-dialog-BIMMsFZL.js} +2 -2
  85. package/dist/{use-template-enabled-locations-Czv-2BCl.js → use-template-enabled-locations-DbPL-RjZ.js} +2 -2
  86. package/dist/{use-transfer-locations-BEhFaiIF.js → use-transfer-locations-CAy8I4Gf.js} +2 -2
  87. package/dist/{useHrmPermission-DNOCARgd.js → useHrmPermission-Cp3-GUqd.js} +1 -1
  88. package/dist/{useNavigationMenu-CJiSVVq0.js → useNavigationMenu-ClMKGUkQ.js} +2 -2
  89. package/dist/{useSseClient-Cc-8N-dD.js → useSseClient-DV1y9ywo.js} +1 -1
  90. package/dist/views/integration/components/CodemaxInvoiceReceipt.vue.d.ts +2 -12
  91. package/dist/views/integration/helper/codemax-receipt.d.ts +11 -17
  92. package/dist/{vue-i18n-MLvug4V3.js → vue-i18n-CwUASG3Y.js} +304 -304
  93. package/dist/{xlsx.util-D59-BdmQ.js → xlsx.util-uIqKDV5h.js} +2 -2
  94. package/package.json +3 -3
  95. package/dist/App-9hCIA42i.js +0 -978
@@ -1,978 +0,0 @@
1
- import { ref as F, onUnmounted as Ae, computed as x, defineComponent as W, watch as M, onMounted as fe, resolveComponent as U, createElementBlock as c, openBlock as r, createBlock as re, createCommentVNode as D, unref as I, createVNode as b, createElementVNode as l, toDisplayString as y, Fragment as N, renderList as Z, withKeys as be, normalizeClass as we, withModifiers as Me, withCtx as O, createTextVNode as se, h as Oe, onBeforeUnmount as ze, Teleport as Ke, normalizeStyle as Ge, withDirectives as je, vModelText as He } from "vue";
2
- import { _ as Ye } from "./empty-placeholder-B0QU467o.js";
3
- import { u as $e, a as ke, R as Y, d as We, b as Je } from "./app-05jiAJnw.js";
4
- import { useCoreStore as oe, useI18n as ie } from "@feedmepos/mf-common";
5
- import { useRouter as ve, useRoute as qe } from "vue-router";
6
- import { u as Xe, a as Qe, I as Ze } from "./feature-7eCXC9nQ.js";
7
- import { u as et } from "./netsuite-BU5IuQNf.js";
8
- import { u as Se } from "./useNavigationMenu-CJiSVVq0.js";
9
- import { useBreakpoints as tt } from "@feedmepos/ui-library";
10
- import { F as Re } from "./FmAdminBadge-DlplQOHb.js";
11
- import { i as nt, _ as ot } from "./FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-BQOLDYzb.js";
12
- import { t as at, a as lt } from "./date2-CnQ-plxk.js";
13
- import { _ as st } from "./_plugin-vue_export-helper-CHgC5LLL.js";
14
- import { u as rt } from "./useTabStorage-BkIVScW_.js";
15
- import { u as it } from "./googlemap-D9vA7GsS.js";
16
- function ut() {
17
- return {
18
- loadingHookInstalled: !1,
19
- isLoading: !1
20
- };
21
- }
22
- const X = F(ut());
23
- function ct() {
24
- const f = ve();
25
- if (!X.value.loadingHookInstalled) {
26
- X.value.loadingHookInstalled = !0;
27
- const t = f.beforeEach(() => {
28
- X.value.isLoading = !0;
29
- }), o = f.afterEach(() => {
30
- X.value.isLoading = !1;
31
- });
32
- Ae(() => {
33
- X.value.loadingHookInstalled = !1, t(), o();
34
- });
35
- }
36
- return {
37
- get isLoading() {
38
- return X.value.isLoading;
39
- }
40
- };
41
- }
42
- function dt() {
43
- const { firstAccessibleRouteName: f } = Se();
44
- return { hasAnyAccessibleInventoryRoute: x(() => f.value !== null) };
45
- }
46
- const mt = {
47
- key: 0,
48
- class: "flex flex-col items-center w-full h-full gap-24"
49
- }, ft = {
50
- key: 1,
51
- class: "flex flex-col pt-[200px] gap-32 items-center"
52
- }, vt = { class: "flex flex-col gap-12 items-center text-center px-24 max-w-[600px]" }, pt = { class: "fm-typo-en-title-lg-600" }, gt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, yt = {
53
- key: 2,
54
- class: "flex flex-col pt-[200px] gap-32 items-center"
55
- }, ht = { class: "flex flex-col gap-12 items-center text-center px-24 max-w-[1000px]" }, _t = { class: "fm-typo-en-title-lg-600" }, xt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, bt = { class: "flex gap-16" }, wt = { href: "https://feedme.ai/product/inventory/features?tab=plans_%26_prices" }, $t = { href: "https://feedme.ai/form" }, kt = /* @__PURE__ */ W({
56
- __name: "InventoryView",
57
- setup(f) {
58
- const t = $e(), o = ke(), v = et(), i = oe(), a = ve(), m = ct(), s = Xe(), { t: w } = ie(), { hasAnyAccessibleInventoryRoute: $ } = dt();
59
- M(
60
- [() => i.sessionUser.value, () => i.currentBusiness.value],
61
- ([V, p]) => {
62
- _(V, p);
63
- }
64
- ), fe(async () => {
65
- await s.init(), await i.readBusinesses();
66
- const V = i.sessionUser.value, p = i.currentBusiness.value;
67
- _(V, p);
68
- });
69
- function _(V, p) {
70
- !V || !p || k();
71
- }
72
- async function k() {
73
- return await t.init(), await v.readSetting().catch((V) => {
74
- console.error("[all] error on reading netsuite store", V);
75
- }), await o.init();
76
- }
77
- const E = x(() => a.currentRoute.value.name === Y.TRANSFER_TEMPLATE ? s.enablePoTemplate : a.currentRoute.value.name === Y.INGREDIENT_GROUP ? s.enableIngredientGroup : !0), A = x(
78
- () => a.currentRoute.value.matched.some((V) => {
79
- var n;
80
- const p = V.meta, S = p == null ? void 0 : p.validationManifest;
81
- return (((n = S == null ? void 0 : S.requiredCaslPermissions) == null ? void 0 : n.length) ?? 0) > 0;
82
- })
83
- ), z = x(() => {
84
- if (!i.sessionUser.value) return !1;
85
- if (t._locations !== null && t.locations.length === 0) return !0;
86
- if (!s.isLoaded) return !1;
87
- const S = a.currentRoute.value.name === Y.LOADING;
88
- return !$.value && (S || A.value);
89
- });
90
- return (V, p) => {
91
- const S = U("FmSpacer"), n = U("FmCircularProgress"), u = U("FmButton"), g = U("RouterView");
92
- return r(), c("div", null, [
93
- I(m).isLoading ? (r(), c("div", mt, [
94
- b(S),
95
- l("div", null, [
96
- b(n, { size: "xl" })
97
- ]),
98
- p[0] || (p[0] = l("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading page...", -1)),
99
- b(S)
100
- ])) : z.value ? (r(), c("div", ft, [
101
- p[1] || (p[1] = l("img", {
102
- src: Ye,
103
- alt: "No permission",
104
- class: "w-[200px] h-[200px]"
105
- }, null, -1)),
106
- l("div", vt, [
107
- l("div", pt, y(I(w)("inventory.common.noPermission.title")), 1),
108
- l("div", gt, y(I(w)("inventory.common.noPermission.description")), 1)
109
- ])
110
- ])) : E.value ? I(i).sessionUser.value ? (r(), re(g, { key: 3 })) : D("", !0) : (r(), c("div", yt, [
111
- l("div", ht, [
112
- l("div", _t, y(I(w)("inventory.common.proPlan.title")), 1),
113
- l("div", xt, y(I(w)("inventory.common.proPlan.subtitle")), 1)
114
- ]),
115
- l("div", bt, [
116
- l("a", wt, [
117
- b(u, {
118
- label: I(w)("inventory.common.proPlan.comparePlans"),
119
- variant: "secondary"
120
- }, null, 8, ["label"])
121
- ]),
122
- l("a", $t, [
123
- b(u, {
124
- label: I(w)("inventory.common.proPlan.callUs"),
125
- "prepend-icon": "call"
126
- }, null, 8, ["label"])
127
- ])
128
- ])
129
- ]))
130
- ]);
131
- };
132
- }
133
- }), Fe = We((f, t) => ({
134
- /**
135
- * Commits for one record. recordId is the changelog docId, `${dbName}/${id}`.
136
- * The dbName scopes the (access-checked) backend route; only the bare id is
137
- * sent — the backend rebuilds the docId server-side.
138
- */
139
- async getRecordChangelog(o, v) {
140
- const i = o.indexOf("/");
141
- if (i < 0) return [];
142
- const a = o.slice(0, i), m = o.slice(i + 1), s = new URLSearchParams({ id: m });
143
- v != null && s.set("limit", String(v));
144
- const w = `${f.inventoryBackendUrl}/${a}/changelog?${s.toString()}`;
145
- return await t.get(w);
146
- },
147
- /**
148
- * Purchase orders in a date range, each with when it last changed. The
149
- * backend joins the orders to their newest commit, so no ids travel and the
150
- * browser makes one request instead of list-then-ask-for-timestamps.
151
- */
152
- async listPurchaseOrders(o, v, i) {
153
- if (!o) return [];
154
- const a = new URLSearchParams({ start: v, end: i }), m = `${f.inventoryBackendUrl}/${o}/changelog/purchase-order?${a}`;
155
- return await t.get(m);
156
- },
157
- /**
158
- * Closing drafts created in a date range, each with when it last changed.
159
- * Closing groups come back as rows of their own — their submit/approve/
160
- * reject is recorded against the group document, not its parent.
161
- */
162
- async listClosingDrafts(o, v, i) {
163
- if (!o) return [];
164
- const a = new URLSearchParams({ start: v, end: i }), m = `${f.inventoryBackendUrl}/${o}/changelog/closing-draft?${a}`;
165
- return await t.get(m);
166
- },
167
- /**
168
- * One inventory module's records, each with when it last changed. Business-
169
- * scoped, so the db is `business_<id>` — the same prefixed name the record's
170
- * own changelog docId carries.
171
- */
172
- async listInventory(o, v) {
173
- if (!o) return [];
174
- const i = `${f.inventoryBackendUrl}/business_${o}/changelog/inventory?module=${v}`;
175
- return await t.get(i);
176
- }
177
- }));
178
- function St() {
179
- const f = Fe(), t = F([]), o = F(!1);
180
- async function v(i, a) {
181
- if (!i) {
182
- t.value = [];
183
- return;
184
- }
185
- o.value = !0;
186
- try {
187
- t.value = await f.getRecordChangelog(i, a);
188
- } catch (m) {
189
- throw t.value = [], m;
190
- } finally {
191
- o.value = !1;
192
- }
193
- }
194
- return { commits: t, isLoading: o, load: v };
195
- }
196
- function Ve(f) {
197
- if (!f) return null;
198
- try {
199
- const t = JSON.parse(f);
200
- return typeof (t == null ? void 0 : t.changelogLabelKey) == "string" && typeof (t == null ? void 0 : t.verb) == "string" ? {
201
- labelKey: t.changelogLabelKey,
202
- verb: t.verb,
203
- ...typeof t.name == "string" ? { name: t.name } : {}
204
- } : null;
205
- } catch {
206
- return null;
207
- }
208
- }
209
- function Rt(f) {
210
- return f.startsWith("inventory.changelog.");
211
- }
212
- const Le = "";
213
- function me(f) {
214
- const t = f.indexOf(Le);
215
- return t === -1 ? { raw: f, human: f } : { raw: f.slice(0, t), human: f.slice(t + 1) };
216
- }
217
- const Ft = [
218
- "inventory.changelog.label.recipe",
219
- "inventory.changelog.label.sku",
220
- "inventory.changelog.label.unit"
221
- ], Vt = [...Ft, "Recipe", "Ingredient", "Unit"];
222
- function Ie(f) {
223
- const { human: t } = me(f);
224
- if (!t) return { type: "Document", name: "", field: [] };
225
- const o = t.split(" › ");
226
- return o.length >= 2 && Vt.includes(o[0]) ? { type: o[0], name: o[1], field: o.slice(2) } : { type: "Document", name: "", field: o };
227
- }
228
- const Lt = {
229
- key: 0,
230
- class: "flex justify-center p-16"
231
- }, It = {
232
- key: 1,
233
- class: "p-16 text-center text-gray-500"
234
- }, Pt = {
235
- key: 2,
236
- class: "flex h-full min-h-0 gap-8"
237
- }, Ct = { class: "w-1/3 shrink-0 overflow-y-auto border-r border-gray-200 pr-4" }, Ut = ["onClick", "onKeydown"], Tt = { class: "fm-typo-en-body-md-600" }, Dt = { class: "text-xs text-gray-500" }, Nt = {
238
- key: 0,
239
- class: "flex-1 overflow-y-auto pl-4"
240
- }, Et = { class: "mb-12 flex flex-col gap-2 border-b border-gray-200 pb-8" }, Bt = { class: "fm-typo-en-body-lg-600" }, At = { class: "text-xs text-gray-500" }, Mt = { class: "mb-12" }, Ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary pl-8" }, zt = { class: "fm-typo-en-body-md-600 mb-8" }, Kt = { class: "flex flex-col gap-6" }, Gt = {
241
- key: 0,
242
- class: "text-gray-700"
243
- }, jt = { class: "min-w-[120px] shrink-0 text-gray-500" }, Ht = { class: "flex flex-wrap items-baseline gap-4" }, Yt = {
244
- key: 0,
245
- class: "rounded bg-red-50 px-4 text-red-700"
246
- }, Wt = {
247
- key: 1,
248
- class: "text-gray-400"
249
- }, Jt = {
250
- key: 2,
251
- class: "rounded bg-green-50 px-4 text-green-700"
252
- }, qt = {
253
- key: 0,
254
- class: "text-sm text-gray-500"
255
- }, Xt = {
256
- key: 1,
257
- class: "flex flex-col gap-16"
258
- }, Qt = { class: "flex items-center gap-4" }, Zt = { class: "rounded bg-gray-100 px-2 py-1 text-xs" }, en = { class: "flex min-w-0 flex-wrap items-center gap-1 font-mono text-xs text-gray-600" }, tn = {
259
- key: 0,
260
- class: "text-gray-400"
261
- }, nn = { class: "cursor-default" }, on = {
262
- key: 0,
263
- class: "ml-auto shrink-0 text-xs text-gray-400"
264
- }, an = { class: "grid grid-cols-2 gap-2 font-mono text-xs" }, ln = { class: "m-0 min-h-[1.5em] overflow-x-auto whitespace-pre-wrap break-all rounded bg-red-50 p-4 text-red-700" }, sn = { class: "m-0 min-h-[1.5em] overflow-x-auto whitespace-pre-wrap break-all rounded bg-green-50 p-4 text-green-700" }, rn = {
265
- key: 2,
266
- class: "mt-16 break-all border-t border-gray-200 pt-8 font-mono text-xs text-gray-400"
267
- }, un = { key: 0 }, cn = /* @__PURE__ */ W({
268
- __name: "ChangelogPanel",
269
- props: {
270
- commits: {},
271
- isLoading: { type: Boolean }
272
- },
273
- setup(f) {
274
- const t = f, { t: o } = ie(), v = F(null), i = F(!1), a = x(() => i.value ? "raw" : "friendly"), m = x(
275
- () => t.commits.find((n) => n.id === v.value)
276
- ), s = x(() => {
277
- var u;
278
- const n = ((u = m.value) == null ? void 0 : u.changes) ?? [];
279
- return a.value === "raw" ? n : n.filter((g) => me(g.path).raw !== "@payload" && !(g.from == null && g.to == null));
280
- });
281
- M(
282
- () => t.commits,
283
- (n) => {
284
- var u;
285
- n.find((g) => g.id === v.value) || (v.value = ((u = n[0]) == null ? void 0 : u.id) ?? null);
286
- },
287
- { immediate: !0 }
288
- );
289
- function w(n) {
290
- return n ? n.slice(0, 8) : "";
291
- }
292
- function $(n) {
293
- return n ? new Date(n).toLocaleString() : "";
294
- }
295
- function _(n) {
296
- const { raw: u } = me(n);
297
- if (!u) {
298
- const g = o("inventory.changelog.documentRoot");
299
- return [{ display: g, full: g }];
300
- }
301
- return u.split(".").map((g) => ({
302
- full: g,
303
- display: g.length > 28 ? `${g.slice(0, 14)}…${g.slice(-8)}` : g
304
- }));
305
- }
306
- function k(n) {
307
- return n;
308
- }
309
- function E(n) {
310
- if (n == null) return "";
311
- let u;
312
- try {
313
- u = JSON.parse(n);
314
- } catch {
315
- return n;
316
- }
317
- return a.value === "raw" ? JSON.stringify(u, null, 2) : u === null ? "—" : typeof u == "string" ? u : typeof u == "number" ? u.toLocaleString() : typeof u == "boolean" ? o(u ? "inventory.changelog.yes" : "inventory.changelog.no") : JSON.stringify(u, null, 2);
318
- }
319
- function A(n) {
320
- return (n.authors || []).join(", ") || o("inventory.changelog.unknownActor");
321
- }
322
- function z(n) {
323
- const u = Ve(n.message);
324
- if (!u) return n.message || o("inventory.changelog.noMessage");
325
- const g = V(u.labelKey);
326
- return u.name ? o(`inventory.changelog.message.${u.verb}`, { module: g, name: u.name }) : o(`inventory.changelog.message.${u.verb}NoName`, { module: g });
327
- }
328
- function V(n) {
329
- return Rt(n) ? o(n) : n;
330
- }
331
- function p(n) {
332
- if (n == null) return !1;
333
- try {
334
- const u = JSON.parse(n);
335
- return u !== null && typeof u == "object";
336
- } catch {
337
- return !1;
338
- }
339
- }
340
- const S = x(() => {
341
- const n = /* @__PURE__ */ new Map(), u = [];
342
- for (const g of s.value) {
343
- const R = Ie(g.path), B = `${R.type}${Le}${R.name}`;
344
- let h = n.get(B);
345
- h || (h = { header: R.name ? `${V(R.type)} "${R.name}"` : V(R.type), lines: [] }, n.set(B, h), u.push(h));
346
- const T = R.field.map(V).join(" › "), L = T || (R.name ? `${V(R.type)} "${R.name}"` : V(R.type));
347
- g.kind === "create" ? h.lines.push({ text: o("inventory.changelog.kind.created") }) : g.from != null && g.to != null ? h.lines.push({ label: T || L, from: g.from, to: g.to }) : g.to != null ? p(g.to) ? h.lines.push({ text: `${o("inventory.changelog.added")} ${L}` }) : h.lines.push({ label: T || L, to: g.to }) : g.from != null && h.lines.push({ text: `${o("inventory.changelog.kind.removed")} ${L}` });
348
- }
349
- return u;
350
- });
351
- return (n, u) => {
352
- const g = U("FmCircularProgress"), R = U("FmSwitch"), B = U("FmTooltip");
353
- return n.isLoading ? (r(), c("div", Lt, [
354
- b(g)
355
- ])) : n.commits.length ? (r(), c("div", Pt, [
356
- l("ol", Ct, [
357
- (r(!0), c(N, null, Z(n.commits, (h) => (r(), c("li", {
358
- key: h.id,
359
- role: "button",
360
- tabindex: "0",
361
- class: we([
362
- "cursor-pointer border-l-2 py-8 pl-12",
363
- h.id === v.value ? "border-fm-color-primary bg-fm-color-primary-50" : "border-gray-200 hover:bg-gray-50"
364
- ]),
365
- onClick: (T) => v.value = h.id,
366
- onKeydown: [
367
- be((T) => v.value = h.id, ["enter"]),
368
- be(Me((T) => v.value = h.id, ["prevent"]), ["space"])
369
- ]
370
- }, [
371
- l("div", Tt, y(z(h)), 1),
372
- l("div", Dt, y(A(h)) + " · " + y($(h.at)) + " · " + y(w(h.id)), 1)
373
- ], 42, Ut))), 128))
374
- ]),
375
- m.value ? (r(), c("div", Nt, [
376
- l("div", Et, [
377
- l("div", Bt, y(z(m.value)), 1),
378
- l("div", At, y(A(m.value)) + " · " + y($(m.value.at)), 1)
379
- ]),
380
- l("div", Mt, [
381
- b(Re, null, {
382
- default: O(() => [
383
- l("span", Ot, y(I(o)("inventory.changelog.tabRaw")), 1),
384
- b(R, {
385
- modelValue: i.value,
386
- "onUpdate:modelValue": u[0] || (u[0] = (h) => i.value = h)
387
- }, null, 8, ["modelValue"])
388
- ]),
389
- _: 1
390
- })
391
- ]),
392
- a.value === "friendly" ? (r(), c(N, { key: 0 }, [
393
- (r(!0), c(N, null, Z(S.value, (h, T) => (r(), c("div", {
394
- key: T,
395
- class: "mb-12 rounded-lg border border-gray-200 p-12"
396
- }, [
397
- l("div", zt, y(h.header), 1),
398
- l("ul", Kt, [
399
- (r(!0), c(N, null, Z(h.lines, (L, K) => (r(), c("li", {
400
- key: K,
401
- class: "flex flex-wrap items-baseline gap-8 text-sm"
402
- }, [
403
- L.text ? (r(), c("span", Gt, y(L.text), 1)) : (r(), c(N, { key: 1 }, [
404
- l("span", jt, y(L.label), 1),
405
- l("span", Ht, [
406
- L.from != null ? (r(), c("span", Yt, y(E(L.from)), 1)) : D("", !0),
407
- L.from != null && L.to != null ? (r(), c("span", Wt, "→")) : D("", !0),
408
- L.to != null ? (r(), c("span", Jt, y(E(L.to)), 1)) : D("", !0)
409
- ])
410
- ], 64))
411
- ]))), 128))
412
- ])
413
- ]))), 128)),
414
- S.value.length ? D("", !0) : (r(), c("div", qt, y(I(o)("inventory.changelog.empty")), 1))
415
- ], 64)) : (r(), c("ul", Xt, [
416
- (r(!0), c(N, null, Z(s.value, (h, T) => (r(), c("li", {
417
- key: T,
418
- class: "flex flex-col gap-2"
419
- }, [
420
- l("div", Qt, [
421
- l("span", Zt, y(h.kind), 1),
422
- l("div", en, [
423
- (r(!0), c(N, null, Z(_(h.path), (L, K) => (r(), c(N, { key: K }, [
424
- K > 0 ? (r(), c("span", tn, "›")) : D("", !0),
425
- b(B, {
426
- placement: "top",
427
- content: L.full,
428
- "z-index": 9999
429
- }, {
430
- default: O(() => [
431
- l("span", nn, y(L.display), 1)
432
- ]),
433
- _: 2
434
- }, 1032, ["content"])
435
- ], 64))), 128))
436
- ]),
437
- h.at ? (r(), c("span", on, y($(h.at)), 1)) : D("", !0)
438
- ]),
439
- l("div", an, [
440
- l("pre", ln, y(E(h.from)), 1),
441
- l("pre", sn, y(E(h.to)), 1)
442
- ])
443
- ]))), 128))
444
- ])),
445
- a.value === "raw" ? (r(), c("div", rn, [
446
- se(y(m.value.id) + " ", 1),
447
- m.value.parent ? (r(), c("span", un, "← " + y(m.value.parent), 1)) : D("", !0)
448
- ])) : D("", !0)
449
- ])) : D("", !0)
450
- ])) : (r(), c("div", It, y(I(o)("inventory.changelog.empty")), 1));
451
- };
452
- }
453
- }), dn = { class: "flex flex-wrap items-center gap-16" }, mn = { class: "fm-typo-en-heading-lg-600" }, fn = { class: "flex h-full min-h-0 flex-col gap-12 p-16" }, vn = { class: "flex flex-wrap items-center gap-12" }, pn = { class: "flex shrink-0 items-center gap-8" }, gn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yn = { class: "flex flex-wrap items-center gap-12" }, hn = {
454
- key: 0,
455
- class: "fm-typo-en-body-md-600"
456
- }, _n = { class: "fm-typo-en-heading-md-600" }, de = "inventory.changelog.label.", xn = 1e3, bn = /* @__PURE__ */ W({
457
- __name: "ChangelogDialog",
458
- props: {
459
- modelValue: { type: Boolean }
460
- },
461
- emits: ["update:modelValue"],
462
- setup(f, { emit: t }) {
463
- const o = f, v = t, i = x({
464
- get: () => o.modelValue,
465
- set: (e) => v("update:modelValue", e)
466
- }), { t: a } = ie(), m = oe(), s = ke(), w = $e(), $ = Fe(), { breakpoints: _ } = tt(), k = x(() => _.value.xs || _.value.sm), E = x(() => k.value ? "98vw" : "72vw"), { commits: A, isLoading: z, load: V } = St();
467
- function p(e) {
468
- return e ? new Date(e).toLocaleString() : "—";
469
- }
470
- function S(e) {
471
- return [...e].sort((d, P) => (P.lastUpdate ?? "").localeCompare(d.lastUpdate ?? ""));
472
- }
473
- function n(e, d) {
474
- V(e, d).catch((P) => console.error("changelog load failed", P));
475
- }
476
- const u = x(() => [
477
- { label: a("inventory.changelog.label.purchaseOrder"), value: "purchaseOrder" },
478
- { label: a("inventory.changelog.label.closingDraft"), value: "closingDraft" },
479
- { label: a("inventory.changelog.domainInventory"), value: "inventory" }
480
- ]), g = F(u.value[0]), R = x(() => {
481
- var e;
482
- return ((e = g.value) == null ? void 0 : e.value) ?? "purchaseOrder";
483
- }), B = F(!1), h = x(
484
- () => ["sku", "recipe", "unit"].map((e) => ({
485
- label: a(de + e),
486
- value: e
487
- }))
488
- ), T = F(h.value[0]), L = x(() => {
489
- var e;
490
- return ((e = T.value) == null ? void 0 : e.value) ?? "sku";
491
- }), K = F(""), G = F(null), ee = F(!1), pe = x(() => {
492
- var P;
493
- const e = (P = m.currentBusiness.value) == null ? void 0 : P._id, d = s.inventory._id;
494
- return e && d ? `business_${e}/${d}` : "";
495
- }), ae = F([]), ue = F(!1);
496
- async function ge() {
497
- var d;
498
- const e = (d = m.currentBusiness.value) == null ? void 0 : d._id;
499
- if (e) {
500
- ue.value = !0;
501
- try {
502
- ae.value = S(await $.listInventory(e, L.value));
503
- } catch (P) {
504
- console.error("changelog inventory list load failed", P), ae.value = [];
505
- } finally {
506
- ue.value = !1;
507
- }
508
- }
509
- }
510
- const Pe = x(
511
- () => ee.value ? ae.value : ae.value.filter((e) => !e.deleted)
512
- ), Ce = x(() => [
513
- { accessorKey: "id", header: () => a("inventory.closing.draft.table.id"), size: 320 },
514
- {
515
- id: "name",
516
- header: () => a("inventory.common.name"),
517
- accessorFn: (e) => e.name,
518
- // Deleted records sit in the same list as live ones, so the row says which
519
- // it is; nothing else distinguishes them.
520
- cell: ({ row: e }) => e.original.deleted ? Oe(
521
- "span",
522
- { "data-deleted": "" },
523
- `${e.original.name} (${a("inventory.changelog.deleted")})`
524
- ) : e.original.name
525
- },
526
- {
527
- id: "lastUpdate",
528
- header: () => a("inventory.changelog.column.lastUpdate"),
529
- size: 200,
530
- // Raw ISO is the sort key — clicking the header on formatted dates would
531
- // order them lexicographically by locale string. Formatted only to display.
532
- accessorFn: (e) => e.lastUpdate ?? "",
533
- cell: ({ getValue: e }) => p(e() || void 0)
534
- }
535
- ]);
536
- function Ue(e) {
537
- G.value = e, B.value = !0, n(pe.value, xn);
538
- }
539
- function Te(e, d) {
540
- const P = Ve(e.message);
541
- return P && P.labelKey === de + L.value && P.name === d.name ? !0 : (e.changes ?? []).some((q) => {
542
- const j = Ie(q.path);
543
- return j.type === de + L.value && j.name === d.name;
544
- });
545
- }
546
- const De = x(() => {
547
- const e = G.value;
548
- return e ? A.value.filter((d) => Te(d, e)) : [];
549
- }), te = F(nt()), le = F([]), ce = F(!1), J = F(null), ye = x(() => {
550
- const e = w._currentLocation;
551
- return e ? `${e.name} (${e.doc.profile.code ?? "--"})` : "";
552
- }), Ne = x(() => [
553
- { accessorKey: "id", header: () => a("inventory.closing.draft.table.id"), size: 320 },
554
- {
555
- accessorKey: "name",
556
- header: () => R.value === "purchaseOrder" ? a("inventory.changelog.column.seq") : a("inventory.common.name"),
557
- size: 240
558
- },
559
- {
560
- id: "lastUpdate",
561
- header: () => a("inventory.changelog.column.lastUpdate"),
562
- size: 200,
563
- // Raw ISO is the sort key; see the note on the inventory table.
564
- accessorFn: (e) => e.lastUpdate ?? "",
565
- cell: ({ getValue: e }) => p(e() || void 0)
566
- }
567
- ]);
568
- async function he() {
569
- var q;
570
- const e = (q = w._currentLocation) == null ? void 0 : q.dbName;
571
- if (!e) return;
572
- const d = at(new Date(te.value.startDate)).toISOString(), P = lt(new Date(te.value.endDate)).toISOString();
573
- ce.value = !0;
574
- try {
575
- le.value = S(
576
- R.value === "purchaseOrder" ? await $.listPurchaseOrders(e, d, P) : await $.listClosingDrafts(e, d, P)
577
- );
578
- } catch (j) {
579
- console.error("changelog location list load failed", j), le.value = [];
580
- } finally {
581
- ce.value = !1;
582
- }
583
- J.value && !le.value.find((j) => {
584
- var ne;
585
- return j.id === ((ne = J.value) == null ? void 0 : ne.id);
586
- }) && (J.value = null, n(""));
587
- }
588
- function Ee(e) {
589
- J.value = e, B.value = !0, n(`${w.currentLocationDBName}/${e.id}`);
590
- }
591
- const Be = x(() => {
592
- var e, d;
593
- return R.value === "inventory" ? ((e = G.value) == null ? void 0 : e.name) ?? "" : ((d = J.value) == null ? void 0 : d.name) ?? "";
594
- });
595
- function _e() {
596
- B.value = !1, R.value === "inventory" ? (G.value = null, ee.value = !1, n(""), ge().catch(
597
- (e) => console.error("changelog inventory list failed", e)
598
- )) : (J.value = null, n(""), he().catch(
599
- (e) => console.error("changelog location list failed", e)
600
- ));
601
- }
602
- return M(i, (e) => {
603
- e && _e();
604
- }), M(R, () => {
605
- i.value && _e();
606
- }), M(te, () => {
607
- i.value && R.value !== "inventory" && he().catch(
608
- (e) => console.error("changelog location list failed", e)
609
- );
610
- }), M(ee, (e) => {
611
- var d;
612
- !e && ((d = G.value) != null && d.deleted) && (G.value = null, B.value = !1);
613
- }), M(L, () => {
614
- G.value = null, B.value = !1, i.value && R.value === "inventory" && ge().catch(
615
- (e) => console.error("changelog inventory list failed", e)
616
- );
617
- }), M(pe, (e) => {
618
- G.value = null, i.value && R.value === "inventory" && n(e);
619
- }), (e, d) => {
620
- const P = U("FmButtonGroup"), q = U("FmSearch"), j = U("FmSwitch"), ne = U("FmTable"), xe = U("FmDialog");
621
- return r(), c(N, null, [
622
- b(xe, {
623
- modelValue: i.value,
624
- "onUpdate:modelValue": d[7] || (d[7] = (C) => i.value = C),
625
- "close-button": "",
626
- "dismiss-away": "",
627
- "min-width": "98vw",
628
- "max-width": "98vw",
629
- "max-height": "94vh",
630
- "content-class": "!p-0 h-[86vh]"
631
- }, {
632
- "dialog-header": O(() => [
633
- l("div", dn, [
634
- l("div", mn, y(I(a)("inventory.changelog.title")), 1),
635
- b(P, {
636
- modelValue: g.value,
637
- "onUpdate:modelValue": d[0] || (d[0] = (C) => g.value = C),
638
- items: u.value
639
- }, null, 8, ["modelValue", "items"])
640
- ])
641
- ]),
642
- default: O(() => [
643
- l("div", fn, [
644
- R.value === "inventory" ? (r(), c(N, { key: 0 }, [
645
- l("div", vn, [
646
- b(P, {
647
- modelValue: T.value,
648
- "onUpdate:modelValue": d[1] || (d[1] = (C) => T.value = C),
649
- items: h.value
650
- }, null, 8, ["modelValue", "items"]),
651
- b(q, {
652
- modelValue: K.value,
653
- "onUpdate:modelValue": d[2] || (d[2] = (C) => K.value = C),
654
- class: "flex-1",
655
- placeholder: I(a)("inventory.changelog.searchInventory")
656
- }, null, 8, ["modelValue", "placeholder"]),
657
- l("div", pn, [
658
- l("span", gn, y(I(a)("inventory.changelog.includeDeleted")), 1),
659
- b(j, {
660
- modelValue: ee.value,
661
- "onUpdate:modelValue": d[3] || (d[3] = (C) => ee.value = C)
662
- }, null, 8, ["modelValue"])
663
- ])
664
- ]),
665
- b(ne, {
666
- class: "min-h-0 flex-1",
667
- "row-data": Pe.value,
668
- "column-defs": Ce.value,
669
- "search-value": K.value,
670
- loading: ue.value,
671
- "page-size": 20,
672
- onRowClick: d[4] || (d[4] = (C) => Ue(C.original))
673
- }, null, 8, ["row-data", "column-defs", "search-value", "loading"])
674
- ], 64)) : (r(), c(N, { key: 1 }, [
675
- l("div", yn, [
676
- b(ot, {
677
- modelValue: te.value,
678
- "onUpdate:modelValue": d[5] || (d[5] = (C) => te.value = C)
679
- }, null, 8, ["modelValue"]),
680
- ye.value ? (r(), c("span", hn, y(ye.value), 1)) : D("", !0)
681
- ]),
682
- b(ne, {
683
- class: "min-h-0 flex-1",
684
- "row-data": le.value,
685
- "column-defs": Ne.value,
686
- loading: ce.value,
687
- "page-size": 20,
688
- onRowClick: d[6] || (d[6] = (C) => Ee(C.original))
689
- }, null, 8, ["row-data", "column-defs", "loading"])
690
- ], 64))
691
- ])
692
- ]),
693
- _: 1
694
- }, 8, ["modelValue"]),
695
- b(xe, {
696
- modelValue: B.value,
697
- "onUpdate:modelValue": d[8] || (d[8] = (C) => B.value = C),
698
- "close-button": "",
699
- "dismiss-away": "",
700
- "min-width": E.value,
701
- "max-width": E.value,
702
- "max-height": "86vh"
703
- }, {
704
- "dialog-header": O(() => [
705
- l("div", _n, y(Be.value), 1)
706
- ]),
707
- default: O(() => [
708
- b(cn, {
709
- commits: R.value === "inventory" ? De.value : I(A),
710
- "is-loading": I(z)
711
- }, null, 8, ["commits", "is-loading"])
712
- ]),
713
- _: 1
714
- }, 8, ["modelValue", "min-width", "max-width"])
715
- ], 64);
716
- };
717
- }
718
- }), wn = /* @__PURE__ */ st(bn, [["__scopeId", "data-v-fedde99f"]]), $n = ["title"], Q = 48, H = 8, kn = /* @__PURE__ */ W({
719
- __name: "ChangelogFloatingButton",
720
- setup(f) {
721
- const { t } = ie(), o = oe(), v = x(() => {
722
- var p;
723
- return !!((p = o.sessionUser.value) != null && p.role.isAdmin);
724
- }), i = F(!1), a = F({ x: 0, y: 0 });
725
- function m(p, S, n) {
726
- return Math.min(Math.max(p, S), n);
727
- }
728
- function s() {
729
- const p = Math.max(H, window.innerWidth - Q - H), S = Math.max(H, window.innerHeight - Q - H), n = a.value.x + Q / 2;
730
- a.value = {
731
- x: n < window.innerWidth / 2 ? H : p,
732
- y: m(a.value.y, H, S)
733
- };
734
- }
735
- function w() {
736
- a.value = { x: window.innerWidth - Q - H, y: Math.round(window.innerHeight / 2) };
737
- }
738
- fe(() => {
739
- w(), window.addEventListener("resize", s), window.addEventListener("orientationchange", s);
740
- }), ze(() => {
741
- window.removeEventListener("resize", s), window.removeEventListener("orientationchange", s);
742
- });
743
- const $ = F(!1);
744
- let _ = null, k = !1;
745
- function E(p) {
746
- _ = { x: p.clientX, y: p.clientY, px: a.value.x, py: a.value.y }, $.value = !0, k = !1, p.currentTarget.setPointerCapture(p.pointerId);
747
- }
748
- function A(p) {
749
- if (!_) return;
750
- const S = p.clientX - _.x, n = p.clientY - _.y;
751
- Math.abs(S) + Math.abs(n) > 3 && (k = !0), a.value = {
752
- x: m(_.px + S, 0, window.innerWidth - Q),
753
- y: m(_.py + n, 0, window.innerHeight - Q)
754
- };
755
- }
756
- function z() {
757
- _ = null, $.value = !1, s();
758
- }
759
- function V() {
760
- _ && (z(), k || (i.value = !0));
761
- }
762
- return (p, S) => {
763
- const n = U("FmIcon");
764
- return r(), re(Ke, { to: "body" }, [
765
- v.value ? (r(), c(N, { key: 0 }, [
766
- l("button", {
767
- type: "button",
768
- title: I(t)("inventory.changelog.title"),
769
- class: we([
770
- "fixed z-50 flex h-48 w-48 touch-none items-center justify-center rounded-full border border-gray-200 bg-white shadow-lg hover:bg-gray-50",
771
- $.value ? "cursor-grabbing" : "cursor-grab transition-[left,top] duration-200 ease-out"
772
- ]),
773
- style: Ge({ left: `${a.value.x}px`, top: `${a.value.y}px` }),
774
- onPointerdown: E,
775
- onPointermove: A,
776
- onPointerup: V,
777
- onPointercancel: z
778
- }, [
779
- b(n, {
780
- name: "history",
781
- size: "md",
782
- outline: ""
783
- })
784
- ], 46, $n),
785
- b(wn, {
786
- modelValue: i.value,
787
- "onUpdate:modelValue": S[0] || (S[0] = (u) => i.value = u)
788
- }, null, 8, ["modelValue"])
789
- ], 64)) : D("", !0)
790
- ]);
791
- };
792
- }
793
- }), Sn = { class: "flex items-center gap-2" }, Rn = { class: "text-xs text-gray-400 font-normal" }, Fn = { class: "flex flex-col gap-3" }, Vn = { class: "max-h-[480px] flex flex-col gap-1" }, Ln = { class: "font-mono text-xs text-gray-700 break-all min-w-0" }, In = {
794
- key: 0,
795
- class: "inline-flex items-center gap-1 text-xs font-medium text-green-700 bg-green-50 px-2 py-0.5 rounded-full"
796
- }, Pn = {
797
- key: 1,
798
- class: "inline-flex items-center gap-1 text-xs font-medium text-red-700 bg-red-50 px-2 py-0.5 rounded-full"
799
- }, Cn = {
800
- key: 2,
801
- class: "inline-flex items-center gap-1 text-xs font-medium text-gray-500 bg-gray-100 px-2 py-0.5 rounded-full"
802
- }, Un = {
803
- key: 0,
804
- class: "text-center text-sm text-gray-400 py-4"
805
- }, Tn = /* @__PURE__ */ W({
806
- __name: "FmFeatureFlagDialog",
807
- setup(f) {
808
- const t = F(!1), o = F(""), v = x(() => {
809
- const { getFlagValue: m } = Qe();
810
- return Object.values(Ze).map((s) => {
811
- const w = m(s, ($) => $ === "true");
812
- return {
813
- name: s,
814
- enabled: w
815
- };
816
- });
817
- }), i = x(() => {
818
- const m = o.value.toLowerCase();
819
- return m ? v.value.filter((s) => s.name.toLowerCase().includes(m)) : v.value;
820
- }), a = x(() => {
821
- const m = v.value.filter(($) => $.enabled === !0).length, s = v.value.filter(($) => $.enabled === !1).length, w = v.value.filter(($) => $.enabled === null).length;
822
- return { enabled: m, disabled: s, unknown: w, total: v.value.length };
823
- });
824
- return (m, s) => {
825
- const w = U("FmButton"), $ = U("FmSpacer"), _ = U("FmDialog");
826
- return r(), re(_, {
827
- modelValue: t.value,
828
- "onUpdate:modelValue": s[2] || (s[2] = (k) => t.value = k),
829
- overlay: !0
830
- }, {
831
- "dialog-button": O(() => [
832
- b(Re, null, {
833
- default: O(() => [
834
- b(w, {
835
- variant: "secondary",
836
- label: "Feature flags"
837
- })
838
- ]),
839
- _: 1
840
- })
841
- ]),
842
- "dialog-header": O(() => [
843
- l("div", Sn, [
844
- s[3] || (s[3] = l("span", null, "Feature Flags", -1)),
845
- l("span", Rn, y(a.value.enabled) + " enabled · " + y(a.value.disabled) + " disabled · " + y(a.value.unknown) + " unknown ", 1)
846
- ])
847
- ]),
848
- "dialog-footer": O(() => [
849
- b($, { class: "sm:hidden xs:hidden" }),
850
- b(w, {
851
- class: "sm:w-full xs:w-full",
852
- label: "Close",
853
- size: "md",
854
- variant: "primary",
855
- onClick: s[1] || (s[1] = (k) => t.value = !1)
856
- })
857
- ]),
858
- default: O(() => [
859
- l("div", Fn, [
860
- je(l("input", {
861
- "onUpdate:modelValue": s[0] || (s[0] = (k) => o.value = k),
862
- type: "text",
863
- placeholder: "Search flags...",
864
- class: "w-full px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500"
865
- }, null, 512), [
866
- [He, o.value]
867
- ]),
868
- l("div", Vn, [
869
- (r(!0), c(N, null, Z(i.value, (k) => (r(), c("div", {
870
- key: k.name,
871
- class: "flex items-start justify-between gap-2 px-3 py-2 rounded-md hover:bg-gray-50 text-sm"
872
- }, [
873
- l("span", Ln, y(k.name), 1),
874
- k.enabled === !0 ? (r(), c("span", In, s[4] || (s[4] = [
875
- l("span", { class: "w-1.5 h-1.5 rounded-full bg-green-500" }, null, -1),
876
- se(" Enabled ")
877
- ]))) : k.enabled === !1 ? (r(), c("span", Pn, s[5] || (s[5] = [
878
- l("span", { class: "w-1.5 h-1.5 rounded-full bg-red-500" }, null, -1),
879
- se(" Disabled ")
880
- ]))) : (r(), c("span", Cn, s[6] || (s[6] = [
881
- l("span", { class: "w-1.5 h-1.5 rounded-full bg-gray-400" }, null, -1),
882
- se(" Unknown ")
883
- ])))
884
- ]))), 128)),
885
- i.value.length === 0 ? (r(), c("div", Un, ' No flags matching "' + y(o.value) + '" ', 1)) : D("", !0)
886
- ])
887
- ])
888
- ]),
889
- _: 1
890
- }, 8, ["modelValue"]);
891
- };
892
- }
893
- }), Dn = { class: "h-full flex flex-col overflow-auto py-16 gap-2" }, Nn = /* @__PURE__ */ W({
894
- __name: "NavigationTab",
895
- setup(f) {
896
- const t = qe(), o = ve(), v = oe(), i = rt(), { menuItems: a } = Se();
897
- M([() => v.currentBusiness.value, () => t.name], ([_, k]) => {
898
- (_ == null ? void 0 : _.menuVersion) === "v3" && (k === Y.INGREDIENTS || k === Y.RECIPE || k === Y.UNIT) && o.push({ name: Y.STOCK });
899
- });
900
- const m = x({
901
- get() {
902
- if (t.name)
903
- return String(t.name);
904
- },
905
- set(_) {
906
- _ && o.push({ name: _ });
907
- }
908
- }), s = x(
909
- () => {
910
- var _;
911
- return `NavigationTab.${(_ = v.currentBusiness.value) == null ? void 0 : _._id}`;
912
- }
913
- ), w = F(!1), $ = x({
914
- get() {
915
- return w.value;
916
- },
917
- set(_) {
918
- w.value = _, _ || i.setItem(s.value, "true");
919
- }
920
- });
921
- return M([() => s.value], () => {
922
- w.value = !1, setTimeout(() => {
923
- $.value = !i.getItem(s.value);
924
- }, 2e3);
925
- }), (_, k) => {
926
- const E = U("FmCollapsibleTabs");
927
- return r(), c("div", Dn, [
928
- b(Tn),
929
- b(E, {
930
- modelValue: m.value,
931
- "onUpdate:modelValue": k[0] || (k[0] = (A) => m.value = A),
932
- items: I(a)
933
- }, null, 8, ["modelValue", "items"])
934
- ]);
935
- };
936
- }
937
- });
938
- typeof Promise.withResolvers > "u" && (Promise.withResolvers = () => {
939
- let f, t;
940
- return { promise: new Promise((v, i) => {
941
- f = v, t = i;
942
- }), resolve: f, reject: t };
943
- });
944
- typeof Promise.prototype.delayed > "u" && (Promise.prototype.delayed = async function(f) {
945
- return await new Promise((t) => setTimeout(t, f)), Promise.resolve(this);
946
- });
947
- const Qn = /* @__PURE__ */ W({
948
- __name: "App",
949
- setup(f) {
950
- const t = oe(), o = it(), v = Je(), i = window.location.href.includes("print-preview");
951
- fe(() => {
952
- if (window.location.href.includes("print-preview")) {
953
- t.setEmbedded(!0), document.body.classList.add("print-mode");
954
- return;
955
- }
956
- t.registerSidebarComponent(Nn), o.initGoogleMap(v.appApi.googleMap).catch(() => {
957
- console.error("Google map cannot be loaded");
958
- });
959
- }), M([() => t.currentCountry.value], () => {
960
- a();
961
- });
962
- async function a() {
963
- var m;
964
- try {
965
- await t.readBusinesses(), t.currentBusiness.value = (m = t.businesses.value) == null ? void 0 : m.find((s) => s);
966
- } catch (s) {
967
- console.error("error when trying to reset businesses:", s);
968
- }
969
- }
970
- return (m, s) => (r(), c(N, null, [
971
- b(kt),
972
- I(i) ? D("", !0) : (r(), re(kn, { key: 0 }))
973
- ], 64));
974
- }
975
- });
976
- export {
977
- Qn as default
978
- };