@feedmepos/mf-inventory-portal 1.7.7 → 1.7.8-dev.1
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.
- package/dist/App-DlVUYgYy.js +1047 -0
- package/dist/{ApprovalView-GQ3y8yRP.js → ApprovalView-Bdk4C5wD.js} +9 -9
- package/dist/{BindingsDialog-B_x8LMvt.js → BindingsDialog-B6u7V1u8.js} +2 -2
- package/dist/{BindingsPicker-C4rmlhNo.js → BindingsPicker-D7B5mm8g.js} +2 -2
- package/dist/{BindingsTable-SYw-DYjb.js → BindingsTable-D7ZJPHR7.js} +3 -3
- package/dist/{BulkReceiveRequestView-CMyD6XsB.js → BulkReceiveRequestView-BWxRKWJE.js} +913 -896
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-BnWxOouO.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CUrsAOwZ.js} +1 -1
- package/dist/{ClosingDraftView-BaSaIRL0.js → ClosingDraftView-C_sIDRvP.js} +19 -19
- package/dist/{ClosingHistoryView-DSmrywZa.js → ClosingHistoryView-Cwzo80YQ.js} +5 -5
- package/dist/{ClosingTemplateView-B37qyruZ.js → ClosingTemplateView-Cbz0dlpY.js} +16 -16
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-xiwiyiaY.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-3ec49Pdv.js} +1 -1
- package/dist/{DefaultView-HHRPuCzZ.js → DefaultView-mOSea0Oa.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-vxKT_EyZ.js → DeliveryOrderPrintPreview-Bt9nsKmn.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-CKThUy1e.js → EmailDialog.vue_vue_type_script_setup_true_lang-Ce6Q3kop.js} +4268 -4261
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-w76hrhQw.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CfBVwxQK.js} +6 -6
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-SVrNjS4I.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BATa-Wka.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DZdqasAP.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CvWSojxU.js} +2 -2
- package/dist/{FmMultiselectDialog-CmmTQGla.js → FmMultiselectDialog-BsvTzrby.js} +2 -2
- package/dist/{FmMultiselectDialog-CJXq4uI3.js → FmMultiselectDialog-DIFTmpRz.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CZD1CVvQ.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DXcylB-v.js} +5 -5
- package/dist/{ImportView-BJVRrKvB.js → ImportView-C9kypBwW.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-ujJY99aa.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-z-hJK1zo.js} +1 -1
- package/dist/{IngredientGroupView-B1JXaOhq.js → IngredientGroupView-BGjJGKVT.js} +5 -5
- package/dist/{IngredientsView-D6NKO-Gh.js → IngredientsView-BjXNg0Vx.js} +16 -16
- package/dist/{IntegrationExplorerView-BvdOXNvG.js → IntegrationExplorerView-D-pjheDc.js} +4 -4
- package/dist/{IntegrationView-2ZYIuc_C.js → IntegrationView-bnCMWSVE.js} +14 -14
- package/dist/{InventoryBindingForm-CcF_BDm-.js → InventoryBindingForm-DISnFdfn.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CNV_bnBT.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bda89_Sh.js} +5 -5
- package/dist/{InventoryBindingSummary-DiN6rNkt.js → InventoryBindingSummary-Cms6vLYz.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bo12cqUh.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-7H8gh0Th.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CimBirfu.js → PremiumBadge.vue_vue_type_script_setup_true_lang-TQMEeH4S.js} +1 -1
- package/dist/{ProductionView-P-LqTvzE.js → ProductionView-BZczYQgA.js} +7 -7
- package/dist/{PublishView-ZeEaZqqy.js → PublishView-eYiMIo4b.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-CExHtihT.js → PurchaseOrderPrintPreview-B3sOBHeN.js} +2 -2
- package/dist/{ReceiveRequestView-DL1Ss34y.js → ReceiveRequestView-B3FD3wAT.js} +14 -14
- package/dist/{RecipeView-HOLyv97y.js → RecipeView-DHCPXeD1.js} +90 -90
- package/dist/{SettingsView-CRdleCee.js → SettingsView-C4VR58Xb.js} +4 -4
- package/dist/{StockView-DBxrmHEr.js → StockView-CYdatpDA.js} +21 -21
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D4JR_U_Z.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D8G0d-yV.js} +1 -1
- package/dist/{SupplierView-BqijOCyT.js → SupplierView-CdcCkrQv.js} +12 -12
- package/dist/{SurchargeView-Xj3KUxjo.js → SurchargeView-BdpU2VOg.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BSPdcQZp.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-FXvBPs7E.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Dk7G0e7l.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CpImuFTv.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-xT6NiHzk.js → TransferDetails.vue_vue_type_script_setup_true_lang-C6qGdKcu.js} +20 -20
- package/dist/{TransferTemplateView-J92-tUO_.js → TransferTemplateView-CAuLJIce.js} +20 -20
- package/dist/{UnitCostHistoryView-g57cYtw5.js → UnitCostHistoryView-CMYuSYcS.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BdcVihLf.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-Dn07Q1Z_.js} +4 -4
- package/dist/{UnitView-BRTPJUUL.js → UnitView-Cu1Z_-g0.js} +8 -8
- package/dist/{WarehouseView-1QwCjF29.js → WarehouseView-B3JLmOko.js} +5 -5
- package/dist/{WastageTemplateView-DZKoMLRy.js → WastageTemplateView-w6f-HZjJ.js} +14 -14
- package/dist/api/changelog.d.ts +64 -0
- package/dist/{app-CegeEo5h.js → app-BfUr354t.js} +19647 -18885
- package/dist/app.d.ts +880 -15
- package/dist/app.js +1 -1
- package/dist/{closing-template-D5UxukOI.js → closing-template-DmAzhG2i.js} +1 -1
- package/dist/{date2-C-GDWzCe.js → date2-CyMMJm5A.js} +5 -5
- package/dist/{dayjs.min-Byig1yQ9.js → dayjs.min-BA15HxbN.js} +1 -1
- package/dist/{decimal-eroTbDqK.js → decimal-0ocbu5ZN.js} +2 -2
- package/dist/{defineDeepModel-QJOziCR5.js → defineDeepModel-DZlFGILU.js} +1 -1
- package/dist/{duplicate-template-DrZN_ru3.js → duplicate-template-BpYRxCwW.js} +1 -1
- package/dist/{feature-D6GXXPff.js → feature-Di266hn3.js} +2 -2
- package/dist/{format-time-from-id-Cj_s-cFT.js → format-time-from-id-CiuFUaBt.js} +1 -1
- package/dist/{format-unit-display-DN98qBJs.js → format-unit-display-DVN-f5bM.js} +27 -27
- package/dist/{import-export.helper-NknO9288.js → import-export.helper-YYchLXrd.js} +6 -6
- package/dist/{index-D2MIrxVZ.js → index-CZFpL5NN.js} +3 -3
- package/dist/{index-DPbEVw86.js → index-DXDIQRvE.js} +1 -1
- package/dist/{index-DYKM4puu.js → index-Dz-iDMyG.js} +1 -1
- package/dist/{inventory-core-dart.default-YlbNYG1d.js → inventory-core-dart.default-CQvVpmCX.js} +1 -1
- package/dist/{lz-string-K_57q5YR.js → lz-string-C-0ZBxAx.js} +1 -1
- package/dist/{netsuite-9yeyNqUg.js → netsuite-CUYrd2um.js} +2 -2
- package/dist/{number-CV-_xcmY.js → number-DWDf87J9.js} +3 -3
- package/dist/{predefined-templates-DuoWmhYv.js → predefined-templates-Fdnxyt1j.js} +1 -1
- package/dist/{purchase-order-template-BHlAdzEG.js → purchase-order-template-sMSNgOQV.js} +1 -1
- package/dist/{recalculationUtils-DVkOvHEE.js → recalculationUtils-CsUXkfGK.js} +1 -1
- package/dist/{rules-CTKq3x64.js → rules-BVRYA4MS.js} +2 -2
- package/dist/{stock-BSaEC2u4.js → stock-C1VAIIU5.js} +1 -1
- package/dist/{stock-B22_nRFF.js → stock-CrHC0uwY.js} +3 -3
- package/dist/style.css +1 -1
- package/dist/{supplier-DR_5qF95.js → supplier-FFjGTHf9.js} +2 -2
- package/dist/{surcharge-DSqDRLyV.js → surcharge-BHTAmupW.js} +8 -8
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-DeDTqzIO.js → uom-rules-DzYTvlTJ.js} +1 -1
- package/dist/{use-ingredient-select-dialog-r4uUF4br.js → use-ingredient-select-dialog-BAFlPMB9.js} +2 -2
- package/dist/{use-inventory-binding-dialog-COAfAZoQ.js → use-inventory-binding-dialog-Bxxu11Xd.js} +2 -2
- package/dist/{use-template-enabled-locations-CsjbDWWR.js → use-template-enabled-locations-ChfKQMBi.js} +2 -2
- package/dist/{use-transfer-locations-CE5jC9rF.js → use-transfer-locations-DIjSUQUb.js} +2 -2
- package/dist/{useHrmPermission-B1laswqe.js → useHrmPermission-D0b3bwuN.js} +1 -1
- package/dist/{useNavigationMenu-Dk50LuHw.js → useNavigationMenu-Djsq5Lqh.js} +2 -2
- package/dist/{useSseClient-DD0mCXGT.js → useSseClient-DG-WRahS.js} +1 -1
- package/dist/views/changelog/components/ChangelogDialog.vue.d.ts +19 -0
- package/dist/views/changelog/components/ChangelogFloatingButton.vue.d.ts +2 -0
- package/dist/views/changelog/components/ChangelogPanel.vue.d.ts +18 -0
- package/dist/views/changelog/composables/change-path.d.ts +10 -0
- package/dist/views/changelog/composables/commit-message.d.ts +9 -0
- package/dist/views/changelog/composables/commit-message.spec.d.ts +1 -0
- package/dist/views/changelog/composables/use-changelog.d.ts +36 -0
- package/dist/{vue-i18n-D8emVl6r.js → vue-i18n-XB_6fqU3.js} +501 -501
- package/dist/{xlsx.util-BFraXVxh.js → xlsx.util-mBtymf5F.js} +2 -2
- package/package.json +6 -6
- package/dist/App-Ct-clbwd.js +0 -311
|
@@ -0,0 +1,1047 @@
|
|
|
1
|
+
import { ref as S, onUnmounted as Ye, computed as x, defineComponent as W, watch as A, onMounted as _e, resolveComponent as D, createElementBlock as f, openBlock as u, createBlock as oe, createCommentVNode as T, unref as I, createVNode as w, createElementVNode as s, toDisplayString as y, Fragment as B, renderList as ee, withKeys as Le, normalizeClass as Ve, withModifiers as We, withCtx as M, createTextVNode as ie, h as Je, onBeforeUnmount as qe, Teleport as Xe, normalizeStyle as Qe, withDirectives as Ze, vModelText as et } from "vue";
|
|
2
|
+
import { _ as tt } from "./empty-placeholder-B0QU467o.js";
|
|
3
|
+
import { u as Ce, a as Ie, R as Y, d as nt, b as ot } from "./app-BfUr354t.js";
|
|
4
|
+
import { useCoreStore as ae, useI18n as ue } from "@feedmepos/mf-common";
|
|
5
|
+
import { useRouter as xe, useRoute as at } from "vue-router";
|
|
6
|
+
import { u as lt, a as st, I as rt } from "./feature-Di266hn3.js";
|
|
7
|
+
import { u as it } from "./netsuite-CUYrd2um.js";
|
|
8
|
+
import { u as De } from "./useNavigationMenu-Djsq5Lqh.js";
|
|
9
|
+
import { useBreakpoints as ut } from "@feedmepos/ui-library";
|
|
10
|
+
import { F as Pe } from "./FmAdminBadge-DlplQOHb.js";
|
|
11
|
+
import { i as ct, _ as dt } from "./FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CfBVwxQK.js";
|
|
12
|
+
import { t as mt, a as ft } from "./date2-CyMMJm5A.js";
|
|
13
|
+
import { _ as vt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
14
|
+
import { u as pt } from "./useTabStorage-BkIVScW_.js";
|
|
15
|
+
import { u as gt } from "./googlemap-D9vA7GsS.js";
|
|
16
|
+
function yt() {
|
|
17
|
+
return {
|
|
18
|
+
loadingHookInstalled: !1,
|
|
19
|
+
isLoading: !1
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const Q = S(yt());
|
|
23
|
+
function ht() {
|
|
24
|
+
const p = xe();
|
|
25
|
+
if (!Q.value.loadingHookInstalled) {
|
|
26
|
+
Q.value.loadingHookInstalled = !0;
|
|
27
|
+
const t = p.beforeEach(() => {
|
|
28
|
+
Q.value.isLoading = !0;
|
|
29
|
+
}), n = p.afterEach(() => {
|
|
30
|
+
Q.value.isLoading = !1;
|
|
31
|
+
});
|
|
32
|
+
Ye(() => {
|
|
33
|
+
Q.value.loadingHookInstalled = !1, t(), n();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
get isLoading() {
|
|
38
|
+
return Q.value.isLoading;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function _t() {
|
|
43
|
+
const { firstAccessibleRouteName: p } = De();
|
|
44
|
+
return { hasAnyAccessibleInventoryRoute: x(() => p.value !== null) };
|
|
45
|
+
}
|
|
46
|
+
const xt = {
|
|
47
|
+
key: 0,
|
|
48
|
+
class: "flex flex-col items-center w-full h-full gap-24"
|
|
49
|
+
}, bt = {
|
|
50
|
+
key: 1,
|
|
51
|
+
class: "flex flex-col pt-[200px] gap-32 items-center"
|
|
52
|
+
}, wt = { class: "flex flex-col gap-12 items-center text-center px-24 max-w-[600px]" }, $t = { class: "fm-typo-en-title-lg-600" }, kt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, St = {
|
|
53
|
+
key: 2,
|
|
54
|
+
class: "flex flex-col pt-[200px] gap-32 items-center"
|
|
55
|
+
}, Rt = { class: "flex flex-col gap-12 items-center text-center px-24 max-w-[1000px]" }, Ft = { class: "fm-typo-en-title-lg-600" }, Lt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, Vt = { class: "flex gap-16" }, Ct = { href: "https://feedme.ai/product/inventory/features?tab=plans_%26_prices" }, It = { href: "https://feedme.ai/form" }, Dt = /* @__PURE__ */ W({
|
|
56
|
+
__name: "InventoryView",
|
|
57
|
+
setup(p) {
|
|
58
|
+
const t = Ce(), n = Ie(), v = it(), i = ae(), l = xe(), m = ht(), r = lt(), { t: $ } = ue(), { hasAnyAccessibleInventoryRoute: k } = _t();
|
|
59
|
+
A(
|
|
60
|
+
[() => i.sessionUser.value, () => i.currentBusiness.value],
|
|
61
|
+
([V, g]) => {
|
|
62
|
+
_(V, g);
|
|
63
|
+
}
|
|
64
|
+
), _e(async () => {
|
|
65
|
+
await r.init(), await i.readBusinesses();
|
|
66
|
+
const V = i.sessionUser.value, g = i.currentBusiness.value;
|
|
67
|
+
_(V, g);
|
|
68
|
+
});
|
|
69
|
+
function _(V, g) {
|
|
70
|
+
!V || !g || F();
|
|
71
|
+
}
|
|
72
|
+
async function F() {
|
|
73
|
+
return await t.init(), await v.readSetting().catch((V) => {
|
|
74
|
+
console.error("[all] error on reading netsuite store", V);
|
|
75
|
+
}), await n.init();
|
|
76
|
+
}
|
|
77
|
+
const N = x(() => l.currentRoute.value.name === Y.TRANSFER_TEMPLATE ? r.enablePoTemplate : l.currentRoute.value.name === Y.INGREDIENT_GROUP ? r.enableIngredientGroup : !0), E = x(
|
|
78
|
+
() => l.currentRoute.value.matched.some((V) => {
|
|
79
|
+
var o;
|
|
80
|
+
const g = V.meta, L = g == null ? void 0 : g.validationManifest;
|
|
81
|
+
return (((o = L == null ? void 0 : L.requiredCaslPermissions) == null ? void 0 : o.length) ?? 0) > 0;
|
|
82
|
+
})
|
|
83
|
+
), O = x(() => {
|
|
84
|
+
if (!i.sessionUser.value) return !1;
|
|
85
|
+
if (t._locations !== null && t.locations.length === 0) return !0;
|
|
86
|
+
if (!r.isLoaded) return !1;
|
|
87
|
+
const L = l.currentRoute.value.name === Y.LOADING;
|
|
88
|
+
return !k.value && (L || E.value);
|
|
89
|
+
});
|
|
90
|
+
return (V, g) => {
|
|
91
|
+
const L = D("FmSpacer"), o = D("FmCircularProgress"), c = D("FmButton"), h = D("RouterView");
|
|
92
|
+
return u(), f("div", null, [
|
|
93
|
+
I(m).isLoading ? (u(), f("div", xt, [
|
|
94
|
+
w(L),
|
|
95
|
+
s("div", null, [
|
|
96
|
+
w(o, { size: "xl" })
|
|
97
|
+
]),
|
|
98
|
+
g[0] || (g[0] = s("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading page...", -1)),
|
|
99
|
+
w(L)
|
|
100
|
+
])) : O.value ? (u(), f("div", bt, [
|
|
101
|
+
g[1] || (g[1] = s("img", {
|
|
102
|
+
src: tt,
|
|
103
|
+
alt: "No permission",
|
|
104
|
+
class: "w-[200px] h-[200px]"
|
|
105
|
+
}, null, -1)),
|
|
106
|
+
s("div", wt, [
|
|
107
|
+
s("div", $t, y(I($)("inventory.common.noPermission.title")), 1),
|
|
108
|
+
s("div", kt, y(I($)("inventory.common.noPermission.description")), 1)
|
|
109
|
+
])
|
|
110
|
+
])) : N.value ? I(i).sessionUser.value ? (u(), oe(h, { key: 3 })) : T("", !0) : (u(), f("div", St, [
|
|
111
|
+
s("div", Rt, [
|
|
112
|
+
s("div", Ft, y(I($)("inventory.common.proPlan.title")), 1),
|
|
113
|
+
s("div", Lt, y(I($)("inventory.common.proPlan.subtitle")), 1)
|
|
114
|
+
]),
|
|
115
|
+
s("div", Vt, [
|
|
116
|
+
s("a", Ct, [
|
|
117
|
+
w(c, {
|
|
118
|
+
label: I($)("inventory.common.proPlan.comparePlans"),
|
|
119
|
+
variant: "secondary"
|
|
120
|
+
}, null, 8, ["label"])
|
|
121
|
+
]),
|
|
122
|
+
s("a", It, [
|
|
123
|
+
w(c, {
|
|
124
|
+
label: I($)("inventory.common.proPlan.callUs"),
|
|
125
|
+
"prepend-icon": "call"
|
|
126
|
+
}, null, 8, ["label"])
|
|
127
|
+
])
|
|
128
|
+
])
|
|
129
|
+
]))
|
|
130
|
+
]);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}), Ue = nt((p, 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(n, v) {
|
|
140
|
+
const i = n.indexOf("/");
|
|
141
|
+
if (i < 0) return [];
|
|
142
|
+
const l = n.slice(0, i), m = n.slice(i + 1), r = new URLSearchParams({ id: m });
|
|
143
|
+
v != null && r.set("limit", String(v));
|
|
144
|
+
const $ = `${p.inventoryBackendUrl}/${l}/changelog?${r.toString()}`;
|
|
145
|
+
return await t.get($);
|
|
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(n, v, i) {
|
|
153
|
+
if (!n) return [];
|
|
154
|
+
const l = new URLSearchParams({ start: v, end: i }), m = `${p.inventoryBackendUrl}/${n}/changelog/purchase-order?${l}`;
|
|
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(n, v, i) {
|
|
163
|
+
if (!n) return [];
|
|
164
|
+
const l = new URLSearchParams({ start: v, end: i }), m = `${p.inventoryBackendUrl}/${n}/changelog/closing-draft?${l}`;
|
|
165
|
+
return await t.get(m);
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* The domains the browser lists generically, declared in
|
|
169
|
+
* changelog-domains-pkg and served by the backend — a new browsable domain
|
|
170
|
+
* becomes a tab without a portal change. Backends predating the route
|
|
171
|
+
* yield an error the caller treats as "no extra domains".
|
|
172
|
+
*/
|
|
173
|
+
async listDomains(n) {
|
|
174
|
+
if (!n) return [];
|
|
175
|
+
const v = `${p.inventoryBackendUrl}/business_${n}/changelog/domains`;
|
|
176
|
+
return await t.get(v);
|
|
177
|
+
},
|
|
178
|
+
/**
|
|
179
|
+
* One generic domain's records, each with when it last changed. Business-
|
|
180
|
+
* scoped: the generic domains are configuration documents of the business
|
|
181
|
+
* db, not of a location.
|
|
182
|
+
*/
|
|
183
|
+
async listDomainRecords(n, v) {
|
|
184
|
+
if (!n) return [];
|
|
185
|
+
const i = `${p.inventoryBackendUrl}/business_${n}/changelog/domain/${encodeURIComponent(v)}`;
|
|
186
|
+
return await t.get(i);
|
|
187
|
+
},
|
|
188
|
+
/**
|
|
189
|
+
* One inventory module's records, each with when it last changed. Business-
|
|
190
|
+
* scoped, so the db is `business_<id>` — the same prefixed name the record's
|
|
191
|
+
* own changelog docId carries.
|
|
192
|
+
*/
|
|
193
|
+
async listInventory(n, v) {
|
|
194
|
+
if (!n) return [];
|
|
195
|
+
const i = `${p.inventoryBackendUrl}/business_${n}/changelog/inventory?module=${v}`;
|
|
196
|
+
return await t.get(i);
|
|
197
|
+
}
|
|
198
|
+
}));
|
|
199
|
+
function Pt() {
|
|
200
|
+
const p = Ue(), t = S([]), n = S(!1);
|
|
201
|
+
async function v(i, l) {
|
|
202
|
+
if (!i) {
|
|
203
|
+
t.value = [];
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
n.value = !0;
|
|
207
|
+
try {
|
|
208
|
+
t.value = await p.getRecordChangelog(i, l);
|
|
209
|
+
} catch (m) {
|
|
210
|
+
throw t.value = [], m;
|
|
211
|
+
} finally {
|
|
212
|
+
n.value = !1;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return { commits: t, isLoading: n, load: v };
|
|
216
|
+
}
|
|
217
|
+
function Te(p) {
|
|
218
|
+
if (!p) return null;
|
|
219
|
+
try {
|
|
220
|
+
const t = JSON.parse(p);
|
|
221
|
+
return typeof (t == null ? void 0 : t.changelogLabelKey) == "string" && typeof (t == null ? void 0 : t.verb) == "string" ? {
|
|
222
|
+
labelKey: t.changelogLabelKey,
|
|
223
|
+
verb: t.verb,
|
|
224
|
+
...typeof t.name == "string" ? { name: t.name } : {}
|
|
225
|
+
} : null;
|
|
226
|
+
} catch {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function Ut(p) {
|
|
231
|
+
return p.startsWith("inventory.changelog.");
|
|
232
|
+
}
|
|
233
|
+
const Be = "";
|
|
234
|
+
function he(p) {
|
|
235
|
+
const t = p.indexOf(Be);
|
|
236
|
+
return t === -1 ? { raw: p, human: p } : { raw: p.slice(0, t), human: p.slice(t + 1) };
|
|
237
|
+
}
|
|
238
|
+
const Tt = [
|
|
239
|
+
"inventory.changelog.label.recipe",
|
|
240
|
+
"inventory.changelog.label.sku",
|
|
241
|
+
"inventory.changelog.label.unit"
|
|
242
|
+
], Bt = [...Tt, "Recipe", "Ingredient", "Unit"];
|
|
243
|
+
function Ne(p) {
|
|
244
|
+
const { human: t } = he(p);
|
|
245
|
+
if (!t) return { type: "Document", name: "", field: [] };
|
|
246
|
+
const n = t.split(" › ");
|
|
247
|
+
return n.length >= 2 && Bt.includes(n[0]) ? { type: n[0], name: n[1], field: n.slice(2) } : { type: "Document", name: "", field: n };
|
|
248
|
+
}
|
|
249
|
+
const Nt = {
|
|
250
|
+
key: 0,
|
|
251
|
+
class: "flex justify-center p-16"
|
|
252
|
+
}, Et = {
|
|
253
|
+
key: 1,
|
|
254
|
+
class: "p-16 text-center text-gray-500"
|
|
255
|
+
}, At = {
|
|
256
|
+
key: 2,
|
|
257
|
+
class: "flex h-full min-h-0 gap-8"
|
|
258
|
+
}, Mt = { class: "w-1/3 shrink-0 overflow-y-auto border-r border-gray-200 pr-4" }, Ot = ["onClick", "onKeydown"], zt = { class: "fm-typo-en-body-md-600" }, Kt = { class: "text-xs text-gray-500" }, Gt = {
|
|
259
|
+
key: 0,
|
|
260
|
+
class: "flex-1 overflow-y-auto pl-4"
|
|
261
|
+
}, jt = { class: "mb-12 flex flex-col gap-2 border-b border-gray-200 pb-8" }, Ht = { class: "fm-typo-en-body-lg-600" }, Yt = { class: "text-xs text-gray-500" }, Wt = { class: "mb-12" }, Jt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary pl-8" }, qt = { class: "fm-typo-en-body-md-600 mb-8" }, Xt = { class: "flex flex-col gap-6" }, Qt = {
|
|
262
|
+
key: 0,
|
|
263
|
+
class: "text-gray-700"
|
|
264
|
+
}, Zt = { class: "min-w-[120px] shrink-0 text-gray-500" }, en = { class: "flex flex-wrap items-baseline gap-4" }, tn = {
|
|
265
|
+
key: 0,
|
|
266
|
+
class: "rounded bg-red-50 px-4 text-red-700"
|
|
267
|
+
}, nn = {
|
|
268
|
+
key: 1,
|
|
269
|
+
class: "text-gray-400"
|
|
270
|
+
}, on = {
|
|
271
|
+
key: 2,
|
|
272
|
+
class: "rounded bg-green-50 px-4 text-green-700"
|
|
273
|
+
}, an = {
|
|
274
|
+
key: 0,
|
|
275
|
+
class: "text-sm text-gray-500"
|
|
276
|
+
}, ln = {
|
|
277
|
+
key: 1,
|
|
278
|
+
class: "flex flex-col gap-16"
|
|
279
|
+
}, sn = { class: "flex items-center gap-4" }, rn = { class: "rounded bg-gray-100 px-2 py-1 text-xs" }, un = { class: "flex min-w-0 flex-wrap items-center gap-1 font-mono text-xs text-gray-600" }, cn = {
|
|
280
|
+
key: 0,
|
|
281
|
+
class: "text-gray-400"
|
|
282
|
+
}, dn = { class: "cursor-default" }, mn = {
|
|
283
|
+
key: 0,
|
|
284
|
+
class: "ml-auto shrink-0 text-xs text-gray-400"
|
|
285
|
+
}, fn = { class: "grid grid-cols-2 gap-2 font-mono text-xs" }, vn = { class: "m-0 min-h-[1.5em] overflow-x-auto whitespace-pre-wrap break-all rounded bg-red-50 p-4 text-red-700" }, pn = { class: "m-0 min-h-[1.5em] overflow-x-auto whitespace-pre-wrap break-all rounded bg-green-50 p-4 text-green-700" }, gn = {
|
|
286
|
+
key: 2,
|
|
287
|
+
class: "mt-16 break-all border-t border-gray-200 pt-8 font-mono text-xs text-gray-400"
|
|
288
|
+
}, yn = { key: 0 }, hn = /* @__PURE__ */ W({
|
|
289
|
+
__name: "ChangelogPanel",
|
|
290
|
+
props: {
|
|
291
|
+
commits: {},
|
|
292
|
+
isLoading: { type: Boolean }
|
|
293
|
+
},
|
|
294
|
+
setup(p) {
|
|
295
|
+
const t = p, { t: n } = ue(), v = S(null), i = S(!1), l = x(() => i.value ? "raw" : "friendly"), m = x(
|
|
296
|
+
() => t.commits.find((o) => o.id === v.value)
|
|
297
|
+
), r = x(() => {
|
|
298
|
+
var c;
|
|
299
|
+
const o = ((c = m.value) == null ? void 0 : c.changes) ?? [];
|
|
300
|
+
return l.value === "raw" ? o : o.filter((h) => he(h.path).raw !== "@payload" && !(h.from == null && h.to == null));
|
|
301
|
+
});
|
|
302
|
+
A(
|
|
303
|
+
() => t.commits,
|
|
304
|
+
(o) => {
|
|
305
|
+
var c;
|
|
306
|
+
o.find((h) => h.id === v.value) || (v.value = ((c = o[0]) == null ? void 0 : c.id) ?? null);
|
|
307
|
+
},
|
|
308
|
+
{ immediate: !0 }
|
|
309
|
+
);
|
|
310
|
+
function $(o) {
|
|
311
|
+
return o ? o.slice(0, 8) : "";
|
|
312
|
+
}
|
|
313
|
+
function k(o) {
|
|
314
|
+
return o ? new Date(o).toLocaleString() : "";
|
|
315
|
+
}
|
|
316
|
+
function _(o) {
|
|
317
|
+
const { raw: c } = he(o);
|
|
318
|
+
if (!c) {
|
|
319
|
+
const h = n("inventory.changelog.documentRoot");
|
|
320
|
+
return [{ display: h, full: h }];
|
|
321
|
+
}
|
|
322
|
+
return c.split(".").map((h) => ({
|
|
323
|
+
full: h,
|
|
324
|
+
display: h.length > 28 ? `${h.slice(0, 14)}…${h.slice(-8)}` : h
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
function F(o) {
|
|
328
|
+
return o;
|
|
329
|
+
}
|
|
330
|
+
function N(o) {
|
|
331
|
+
if (o == null) return "";
|
|
332
|
+
let c;
|
|
333
|
+
try {
|
|
334
|
+
c = JSON.parse(o);
|
|
335
|
+
} catch {
|
|
336
|
+
return o;
|
|
337
|
+
}
|
|
338
|
+
return l.value === "raw" ? JSON.stringify(c, null, 2) : c === null ? "—" : typeof c == "string" ? c : typeof c == "number" ? c.toLocaleString() : typeof c == "boolean" ? n(c ? "inventory.changelog.yes" : "inventory.changelog.no") : JSON.stringify(c, null, 2);
|
|
339
|
+
}
|
|
340
|
+
function E(o) {
|
|
341
|
+
return (o.authors || []).join(", ") || n("inventory.changelog.unknownActor");
|
|
342
|
+
}
|
|
343
|
+
function O(o) {
|
|
344
|
+
const c = Te(o.message);
|
|
345
|
+
if (!c) return o.message || n("inventory.changelog.noMessage");
|
|
346
|
+
const h = V(c.labelKey);
|
|
347
|
+
return c.name ? n(`inventory.changelog.message.${c.verb}`, { module: h, name: c.name }) : n(`inventory.changelog.message.${c.verb}NoName`, { module: h });
|
|
348
|
+
}
|
|
349
|
+
function V(o) {
|
|
350
|
+
return Ut(o) ? n(o) : o;
|
|
351
|
+
}
|
|
352
|
+
function g(o) {
|
|
353
|
+
if (o == null) return !1;
|
|
354
|
+
try {
|
|
355
|
+
const c = JSON.parse(o);
|
|
356
|
+
return c !== null && typeof c == "object";
|
|
357
|
+
} catch {
|
|
358
|
+
return !1;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
const L = x(() => {
|
|
362
|
+
const o = /* @__PURE__ */ new Map(), c = [];
|
|
363
|
+
for (const h of r.value) {
|
|
364
|
+
const P = Ne(h.path), z = `${P.type}${Be}${P.name}`;
|
|
365
|
+
let d = o.get(z);
|
|
366
|
+
d || (d = { header: P.name ? `${V(P.type)} "${P.name}"` : V(P.type), lines: [] }, o.set(z, d), c.push(d));
|
|
367
|
+
const U = P.field.map(V).join(" › "), R = U || (P.name ? `${V(P.type)} "${P.name}"` : V(P.type));
|
|
368
|
+
h.kind === "create" ? d.lines.push({ text: n("inventory.changelog.kind.created") }) : h.from != null && h.to != null ? d.lines.push({ label: U || R, from: h.from, to: h.to }) : h.to != null ? g(h.to) ? d.lines.push({ text: `${n("inventory.changelog.added")} ${R}` }) : d.lines.push({ label: U || R, to: h.to }) : h.from != null && d.lines.push({ text: `${n("inventory.changelog.kind.removed")} ${R}` });
|
|
369
|
+
}
|
|
370
|
+
return c;
|
|
371
|
+
});
|
|
372
|
+
return (o, c) => {
|
|
373
|
+
const h = D("FmCircularProgress"), P = D("FmSwitch"), z = D("FmTooltip");
|
|
374
|
+
return o.isLoading ? (u(), f("div", Nt, [
|
|
375
|
+
w(h)
|
|
376
|
+
])) : o.commits.length ? (u(), f("div", At, [
|
|
377
|
+
s("ol", Mt, [
|
|
378
|
+
(u(!0), f(B, null, ee(o.commits, (d) => (u(), f("li", {
|
|
379
|
+
key: d.id,
|
|
380
|
+
role: "button",
|
|
381
|
+
tabindex: "0",
|
|
382
|
+
class: Ve([
|
|
383
|
+
"cursor-pointer border-l-2 py-8 pl-12",
|
|
384
|
+
d.id === v.value ? "border-fm-color-primary bg-fm-color-primary-50" : "border-gray-200 hover:bg-gray-50"
|
|
385
|
+
]),
|
|
386
|
+
onClick: (U) => v.value = d.id,
|
|
387
|
+
onKeydown: [
|
|
388
|
+
Le((U) => v.value = d.id, ["enter"]),
|
|
389
|
+
Le(We((U) => v.value = d.id, ["prevent"]), ["space"])
|
|
390
|
+
]
|
|
391
|
+
}, [
|
|
392
|
+
s("div", zt, y(O(d)), 1),
|
|
393
|
+
s("div", Kt, y(E(d)) + " · " + y(k(d.at)) + " · " + y($(d.id)), 1)
|
|
394
|
+
], 42, Ot))), 128))
|
|
395
|
+
]),
|
|
396
|
+
m.value ? (u(), f("div", Gt, [
|
|
397
|
+
s("div", jt, [
|
|
398
|
+
s("div", Ht, y(O(m.value)), 1),
|
|
399
|
+
s("div", Yt, y(E(m.value)) + " · " + y(k(m.value.at)), 1)
|
|
400
|
+
]),
|
|
401
|
+
s("div", Wt, [
|
|
402
|
+
w(Pe, null, {
|
|
403
|
+
default: M(() => [
|
|
404
|
+
s("span", Jt, y(I(n)("inventory.changelog.tabRaw")), 1),
|
|
405
|
+
w(P, {
|
|
406
|
+
modelValue: i.value,
|
|
407
|
+
"onUpdate:modelValue": c[0] || (c[0] = (d) => i.value = d)
|
|
408
|
+
}, null, 8, ["modelValue"])
|
|
409
|
+
]),
|
|
410
|
+
_: 1
|
|
411
|
+
})
|
|
412
|
+
]),
|
|
413
|
+
l.value === "friendly" ? (u(), f(B, { key: 0 }, [
|
|
414
|
+
(u(!0), f(B, null, ee(L.value, (d, U) => (u(), f("div", {
|
|
415
|
+
key: U,
|
|
416
|
+
class: "mb-12 rounded-lg border border-gray-200 p-12"
|
|
417
|
+
}, [
|
|
418
|
+
s("div", qt, y(d.header), 1),
|
|
419
|
+
s("ul", Xt, [
|
|
420
|
+
(u(!0), f(B, null, ee(d.lines, (R, j) => (u(), f("li", {
|
|
421
|
+
key: j,
|
|
422
|
+
class: "flex flex-wrap items-baseline gap-8 text-sm"
|
|
423
|
+
}, [
|
|
424
|
+
R.text ? (u(), f("span", Qt, y(R.text), 1)) : (u(), f(B, { key: 1 }, [
|
|
425
|
+
s("span", Zt, y(R.label), 1),
|
|
426
|
+
s("span", en, [
|
|
427
|
+
R.from != null ? (u(), f("span", tn, y(N(R.from)), 1)) : T("", !0),
|
|
428
|
+
R.from != null && R.to != null ? (u(), f("span", nn, "→")) : T("", !0),
|
|
429
|
+
R.to != null ? (u(), f("span", on, y(N(R.to)), 1)) : T("", !0)
|
|
430
|
+
])
|
|
431
|
+
], 64))
|
|
432
|
+
]))), 128))
|
|
433
|
+
])
|
|
434
|
+
]))), 128)),
|
|
435
|
+
L.value.length ? T("", !0) : (u(), f("div", an, y(I(n)("inventory.changelog.empty")), 1))
|
|
436
|
+
], 64)) : (u(), f("ul", ln, [
|
|
437
|
+
(u(!0), f(B, null, ee(r.value, (d, U) => (u(), f("li", {
|
|
438
|
+
key: U,
|
|
439
|
+
class: "flex flex-col gap-2"
|
|
440
|
+
}, [
|
|
441
|
+
s("div", sn, [
|
|
442
|
+
s("span", rn, y(d.kind), 1),
|
|
443
|
+
s("div", un, [
|
|
444
|
+
(u(!0), f(B, null, ee(_(d.path), (R, j) => (u(), f(B, { key: j }, [
|
|
445
|
+
j > 0 ? (u(), f("span", cn, "›")) : T("", !0),
|
|
446
|
+
w(z, {
|
|
447
|
+
placement: "top",
|
|
448
|
+
content: R.full,
|
|
449
|
+
"z-index": 9999
|
|
450
|
+
}, {
|
|
451
|
+
default: M(() => [
|
|
452
|
+
s("span", dn, y(R.display), 1)
|
|
453
|
+
]),
|
|
454
|
+
_: 2
|
|
455
|
+
}, 1032, ["content"])
|
|
456
|
+
], 64))), 128))
|
|
457
|
+
]),
|
|
458
|
+
d.at ? (u(), f("span", mn, y(k(d.at)), 1)) : T("", !0)
|
|
459
|
+
]),
|
|
460
|
+
s("div", fn, [
|
|
461
|
+
s("pre", vn, y(N(d.from)), 1),
|
|
462
|
+
s("pre", pn, y(N(d.to)), 1)
|
|
463
|
+
])
|
|
464
|
+
]))), 128))
|
|
465
|
+
])),
|
|
466
|
+
l.value === "raw" ? (u(), f("div", gn, [
|
|
467
|
+
ie(y(m.value.id) + " ", 1),
|
|
468
|
+
m.value.parent ? (u(), f("span", yn, "← " + y(m.value.parent), 1)) : T("", !0)
|
|
469
|
+
])) : T("", !0)
|
|
470
|
+
])) : T("", !0)
|
|
471
|
+
])) : (u(), f("div", Et, y(I(n)("inventory.changelog.empty")), 1));
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
}), _n = { class: "flex flex-wrap items-center gap-16" }, xn = { class: "fm-typo-en-heading-lg-600" }, bn = { class: "flex h-full min-h-0 flex-col gap-12 p-16" }, wn = { class: "flex flex-wrap items-center gap-12" }, $n = { class: "flex shrink-0 items-center gap-8" }, kn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Sn = { class: "flex flex-wrap items-center gap-12" }, Rn = {
|
|
475
|
+
key: 0,
|
|
476
|
+
class: "fm-typo-en-body-md-600"
|
|
477
|
+
}, Fn = { class: "fm-typo-en-heading-md-600" }, ye = "inventory.changelog.label.", Ln = 1e3, Vn = /* @__PURE__ */ W({
|
|
478
|
+
__name: "ChangelogDialog",
|
|
479
|
+
props: {
|
|
480
|
+
modelValue: { type: Boolean }
|
|
481
|
+
},
|
|
482
|
+
emits: ["update:modelValue"],
|
|
483
|
+
setup(p, { emit: t }) {
|
|
484
|
+
const n = p, v = t, i = x({
|
|
485
|
+
get: () => n.modelValue,
|
|
486
|
+
set: (e) => v("update:modelValue", e)
|
|
487
|
+
}), { t: l } = ue(), m = ae(), r = Ie(), $ = Ce(), k = Ue(), { breakpoints: _ } = ut(), F = x(() => _.value.xs || _.value.sm), N = x(() => F.value ? "98vw" : "72vw"), { commits: E, isLoading: O, load: V } = Pt();
|
|
488
|
+
function g(e) {
|
|
489
|
+
return e ? new Date(e).toLocaleString() : "—";
|
|
490
|
+
}
|
|
491
|
+
function L(e) {
|
|
492
|
+
return [...e].sort((a, b) => (b.lastUpdate ?? "").localeCompare(a.lastUpdate ?? ""));
|
|
493
|
+
}
|
|
494
|
+
function o(e, a) {
|
|
495
|
+
V(e, a).catch((b) => console.error("changelog load failed", b));
|
|
496
|
+
}
|
|
497
|
+
const c = S([]);
|
|
498
|
+
async function h() {
|
|
499
|
+
var a;
|
|
500
|
+
const e = (a = m.currentBusiness.value) == null ? void 0 : a._id;
|
|
501
|
+
if (e)
|
|
502
|
+
try {
|
|
503
|
+
c.value = await k.listDomains(e);
|
|
504
|
+
} catch (b) {
|
|
505
|
+
console.error("changelog domain list load failed", b), c.value = [];
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const P = x(() => [
|
|
509
|
+
{ label: l("inventory.changelog.label.purchaseOrder"), value: "purchaseOrder" },
|
|
510
|
+
{ label: l("inventory.changelog.label.closingDraft"), value: "closingDraft" },
|
|
511
|
+
{ label: l("inventory.changelog.domainInventory"), value: "inventory" },
|
|
512
|
+
...c.value.map((e) => ({ label: l(e.labelKey), value: e.domain }))
|
|
513
|
+
]), z = S(P.value[0]), d = x(() => {
|
|
514
|
+
var e;
|
|
515
|
+
return ((e = z.value) == null ? void 0 : e.value) ?? "purchaseOrder";
|
|
516
|
+
}), U = x(
|
|
517
|
+
() => c.value.some((e) => e.domain === d.value)
|
|
518
|
+
), R = S(!1), j = x(
|
|
519
|
+
() => ["sku", "recipe", "unit"].map((e) => ({
|
|
520
|
+
label: l(ye + e),
|
|
521
|
+
value: e
|
|
522
|
+
}))
|
|
523
|
+
), ce = S(j.value[0]), le = x(() => {
|
|
524
|
+
var e;
|
|
525
|
+
return ((e = ce.value) == null ? void 0 : e.value) ?? "sku";
|
|
526
|
+
}), de = S(""), K = S(null), te = S(!1), be = x(() => {
|
|
527
|
+
var b;
|
|
528
|
+
const e = (b = m.currentBusiness.value) == null ? void 0 : b._id, a = r.inventory._id;
|
|
529
|
+
return e && a ? `business_${e}/${a}` : "";
|
|
530
|
+
}), se = S([]), me = S(!1);
|
|
531
|
+
async function we() {
|
|
532
|
+
var a;
|
|
533
|
+
const e = (a = m.currentBusiness.value) == null ? void 0 : a._id;
|
|
534
|
+
if (e) {
|
|
535
|
+
me.value = !0;
|
|
536
|
+
try {
|
|
537
|
+
se.value = L(await k.listInventory(e, le.value));
|
|
538
|
+
} catch (b) {
|
|
539
|
+
console.error("changelog inventory list load failed", b), se.value = [];
|
|
540
|
+
} finally {
|
|
541
|
+
me.value = !1;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
const Ee = x(
|
|
546
|
+
() => te.value ? se.value : se.value.filter((e) => !e.deleted)
|
|
547
|
+
), Ae = x(() => [
|
|
548
|
+
{ accessorKey: "id", header: () => l("inventory.closing.draft.table.id"), size: 320 },
|
|
549
|
+
{
|
|
550
|
+
id: "name",
|
|
551
|
+
header: () => l("inventory.common.name"),
|
|
552
|
+
accessorFn: (e) => e.name,
|
|
553
|
+
// Deleted records sit in the same list as live ones, so the row says which
|
|
554
|
+
// it is; nothing else distinguishes them.
|
|
555
|
+
cell: ({ row: e }) => e.original.deleted ? Je(
|
|
556
|
+
"span",
|
|
557
|
+
{ "data-deleted": "" },
|
|
558
|
+
`${e.original.name} (${l("inventory.changelog.deleted")})`
|
|
559
|
+
) : e.original.name
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
id: "lastUpdate",
|
|
563
|
+
header: () => l("inventory.changelog.column.lastUpdate"),
|
|
564
|
+
size: 200,
|
|
565
|
+
// Raw ISO is the sort key — clicking the header on formatted dates would
|
|
566
|
+
// order them lexicographically by locale string. Formatted only to display.
|
|
567
|
+
accessorFn: (e) => e.lastUpdate ?? "",
|
|
568
|
+
cell: ({ getValue: e }) => g(e() || void 0)
|
|
569
|
+
}
|
|
570
|
+
]);
|
|
571
|
+
function Me(e) {
|
|
572
|
+
K.value = e, R.value = !0, o(be.value, Ln);
|
|
573
|
+
}
|
|
574
|
+
function Oe(e, a) {
|
|
575
|
+
const b = Te(e.message);
|
|
576
|
+
return b && b.labelKey === ye + le.value && b.name === a.name ? !0 : (e.changes ?? []).some((q) => {
|
|
577
|
+
const G = Ne(q.path);
|
|
578
|
+
return G.type === ye + le.value && G.name === a.name;
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
const ze = x(() => {
|
|
582
|
+
const e = K.value;
|
|
583
|
+
return e ? E.value.filter((a) => Oe(a, e)) : [];
|
|
584
|
+
}), fe = S([]), ve = S(!1), pe = S(null);
|
|
585
|
+
async function Ke() {
|
|
586
|
+
var a;
|
|
587
|
+
const e = (a = m.currentBusiness.value) == null ? void 0 : a._id;
|
|
588
|
+
if (e) {
|
|
589
|
+
ve.value = !0;
|
|
590
|
+
try {
|
|
591
|
+
fe.value = L(
|
|
592
|
+
await k.listDomainRecords(e, d.value)
|
|
593
|
+
);
|
|
594
|
+
} catch (b) {
|
|
595
|
+
console.error("changelog domain records load failed", b), fe.value = [];
|
|
596
|
+
} finally {
|
|
597
|
+
ve.value = !1;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function Ge(e) {
|
|
602
|
+
var b;
|
|
603
|
+
const a = (b = m.currentBusiness.value) == null ? void 0 : b._id;
|
|
604
|
+
a && (pe.value = e, R.value = !0, o(`business_${a}/${e.id}`));
|
|
605
|
+
}
|
|
606
|
+
const ne = S(ct()), re = S([]), ge = S(!1), J = S(null), $e = x(() => {
|
|
607
|
+
const e = $._currentLocation;
|
|
608
|
+
return e ? `${e.name} (${e.doc.profile.code ?? "--"})` : "";
|
|
609
|
+
}), ke = x(() => [
|
|
610
|
+
{ accessorKey: "id", header: () => l("inventory.closing.draft.table.id"), size: 320 },
|
|
611
|
+
{
|
|
612
|
+
accessorKey: "name",
|
|
613
|
+
header: () => d.value === "purchaseOrder" ? l("inventory.changelog.column.seq") : l("inventory.common.name"),
|
|
614
|
+
size: 240
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
id: "lastUpdate",
|
|
618
|
+
header: () => l("inventory.changelog.column.lastUpdate"),
|
|
619
|
+
size: 200,
|
|
620
|
+
// Raw ISO is the sort key; see the note on the inventory table.
|
|
621
|
+
accessorFn: (e) => e.lastUpdate ?? "",
|
|
622
|
+
cell: ({ getValue: e }) => g(e() || void 0)
|
|
623
|
+
}
|
|
624
|
+
]);
|
|
625
|
+
async function Se() {
|
|
626
|
+
var q;
|
|
627
|
+
const e = (q = $._currentLocation) == null ? void 0 : q.dbName;
|
|
628
|
+
if (!e) return;
|
|
629
|
+
const a = mt(new Date(ne.value.startDate)).toISOString(), b = ft(new Date(ne.value.endDate)).toISOString();
|
|
630
|
+
ge.value = !0;
|
|
631
|
+
try {
|
|
632
|
+
re.value = L(
|
|
633
|
+
d.value === "purchaseOrder" ? await k.listPurchaseOrders(e, a, b) : await k.listClosingDrafts(e, a, b)
|
|
634
|
+
);
|
|
635
|
+
} catch (G) {
|
|
636
|
+
console.error("changelog location list load failed", G), re.value = [];
|
|
637
|
+
} finally {
|
|
638
|
+
ge.value = !1;
|
|
639
|
+
}
|
|
640
|
+
J.value && !re.value.find((G) => {
|
|
641
|
+
var X;
|
|
642
|
+
return G.id === ((X = J.value) == null ? void 0 : X.id);
|
|
643
|
+
}) && (J.value = null, o(""));
|
|
644
|
+
}
|
|
645
|
+
function je(e) {
|
|
646
|
+
J.value = e, R.value = !0, o(`${$.currentLocationDBName}/${e.id}`);
|
|
647
|
+
}
|
|
648
|
+
const He = x(() => {
|
|
649
|
+
var e, a, b;
|
|
650
|
+
return d.value === "inventory" ? ((e = K.value) == null ? void 0 : e.name) ?? "" : U.value ? ((a = pe.value) == null ? void 0 : a.name) ?? "" : ((b = J.value) == null ? void 0 : b.name) ?? "";
|
|
651
|
+
});
|
|
652
|
+
function Re() {
|
|
653
|
+
R.value = !1, d.value === "inventory" ? (K.value = null, te.value = !1, o(""), we().catch(
|
|
654
|
+
(e) => console.error("changelog inventory list failed", e)
|
|
655
|
+
)) : U.value ? (pe.value = null, o(""), Ke().catch(
|
|
656
|
+
(e) => console.error("changelog domain records failed", e)
|
|
657
|
+
)) : (J.value = null, o(""), Se().catch(
|
|
658
|
+
(e) => console.error("changelog location list failed", e)
|
|
659
|
+
));
|
|
660
|
+
}
|
|
661
|
+
return A(i, (e) => {
|
|
662
|
+
e && (h().catch(
|
|
663
|
+
(a) => console.error("changelog domain list failed", a)
|
|
664
|
+
), Re());
|
|
665
|
+
}), A(d, () => {
|
|
666
|
+
i.value && Re();
|
|
667
|
+
}), A(ne, () => {
|
|
668
|
+
i.value && d.value !== "inventory" && !U.value && Se().catch(
|
|
669
|
+
(e) => console.error("changelog location list failed", e)
|
|
670
|
+
);
|
|
671
|
+
}), A(te, (e) => {
|
|
672
|
+
var a;
|
|
673
|
+
!e && ((a = K.value) != null && a.deleted) && (K.value = null, R.value = !1);
|
|
674
|
+
}), A(le, () => {
|
|
675
|
+
K.value = null, R.value = !1, i.value && d.value === "inventory" && we().catch(
|
|
676
|
+
(e) => console.error("changelog inventory list failed", e)
|
|
677
|
+
);
|
|
678
|
+
}), A(be, (e) => {
|
|
679
|
+
K.value = null, i.value && d.value === "inventory" && o(e);
|
|
680
|
+
}), (e, a) => {
|
|
681
|
+
const b = D("FmButtonGroup"), q = D("FmSearch"), G = D("FmSwitch"), X = D("FmTable"), Fe = D("FmDialog");
|
|
682
|
+
return u(), f(B, null, [
|
|
683
|
+
w(Fe, {
|
|
684
|
+
modelValue: i.value,
|
|
685
|
+
"onUpdate:modelValue": a[8] || (a[8] = (C) => i.value = C),
|
|
686
|
+
"close-button": "",
|
|
687
|
+
"dismiss-away": "",
|
|
688
|
+
"min-width": "98vw",
|
|
689
|
+
"max-width": "98vw",
|
|
690
|
+
"max-height": "94vh",
|
|
691
|
+
"content-class": "!p-0 h-[86vh]"
|
|
692
|
+
}, {
|
|
693
|
+
"dialog-header": M(() => [
|
|
694
|
+
s("div", _n, [
|
|
695
|
+
s("div", xn, y(I(l)("inventory.changelog.title")), 1),
|
|
696
|
+
w(b, {
|
|
697
|
+
modelValue: z.value,
|
|
698
|
+
"onUpdate:modelValue": a[0] || (a[0] = (C) => z.value = C),
|
|
699
|
+
items: P.value
|
|
700
|
+
}, null, 8, ["modelValue", "items"])
|
|
701
|
+
])
|
|
702
|
+
]),
|
|
703
|
+
default: M(() => [
|
|
704
|
+
s("div", bn, [
|
|
705
|
+
d.value === "inventory" ? (u(), f(B, { key: 0 }, [
|
|
706
|
+
s("div", wn, [
|
|
707
|
+
w(b, {
|
|
708
|
+
modelValue: ce.value,
|
|
709
|
+
"onUpdate:modelValue": a[1] || (a[1] = (C) => ce.value = C),
|
|
710
|
+
items: j.value
|
|
711
|
+
}, null, 8, ["modelValue", "items"]),
|
|
712
|
+
w(q, {
|
|
713
|
+
modelValue: de.value,
|
|
714
|
+
"onUpdate:modelValue": a[2] || (a[2] = (C) => de.value = C),
|
|
715
|
+
class: "flex-1",
|
|
716
|
+
placeholder: I(l)("inventory.changelog.searchInventory")
|
|
717
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
718
|
+
s("div", $n, [
|
|
719
|
+
s("span", kn, y(I(l)("inventory.changelog.includeDeleted")), 1),
|
|
720
|
+
w(G, {
|
|
721
|
+
modelValue: te.value,
|
|
722
|
+
"onUpdate:modelValue": a[3] || (a[3] = (C) => te.value = C)
|
|
723
|
+
}, null, 8, ["modelValue"])
|
|
724
|
+
])
|
|
725
|
+
]),
|
|
726
|
+
w(X, {
|
|
727
|
+
class: "min-h-0 flex-1",
|
|
728
|
+
"row-data": Ee.value,
|
|
729
|
+
"column-defs": Ae.value,
|
|
730
|
+
"search-value": de.value,
|
|
731
|
+
loading: me.value,
|
|
732
|
+
"page-size": 20,
|
|
733
|
+
onRowClick: a[4] || (a[4] = (C) => Me(C.original))
|
|
734
|
+
}, null, 8, ["row-data", "column-defs", "search-value", "loading"])
|
|
735
|
+
], 64)) : U.value ? (u(), oe(X, {
|
|
736
|
+
key: 1,
|
|
737
|
+
class: "min-h-0 flex-1",
|
|
738
|
+
"row-data": fe.value,
|
|
739
|
+
"column-defs": ke.value,
|
|
740
|
+
loading: ve.value,
|
|
741
|
+
"page-size": 20,
|
|
742
|
+
onRowClick: a[5] || (a[5] = (C) => Ge(C.original))
|
|
743
|
+
}, null, 8, ["row-data", "column-defs", "loading"])) : (u(), f(B, { key: 2 }, [
|
|
744
|
+
s("div", Sn, [
|
|
745
|
+
w(dt, {
|
|
746
|
+
modelValue: ne.value,
|
|
747
|
+
"onUpdate:modelValue": a[6] || (a[6] = (C) => ne.value = C)
|
|
748
|
+
}, null, 8, ["modelValue"]),
|
|
749
|
+
$e.value ? (u(), f("span", Rn, y($e.value), 1)) : T("", !0)
|
|
750
|
+
]),
|
|
751
|
+
w(X, {
|
|
752
|
+
class: "min-h-0 flex-1",
|
|
753
|
+
"row-data": re.value,
|
|
754
|
+
"column-defs": ke.value,
|
|
755
|
+
loading: ge.value,
|
|
756
|
+
"page-size": 20,
|
|
757
|
+
onRowClick: a[7] || (a[7] = (C) => je(C.original))
|
|
758
|
+
}, null, 8, ["row-data", "column-defs", "loading"])
|
|
759
|
+
], 64))
|
|
760
|
+
])
|
|
761
|
+
]),
|
|
762
|
+
_: 1
|
|
763
|
+
}, 8, ["modelValue"]),
|
|
764
|
+
w(Fe, {
|
|
765
|
+
modelValue: R.value,
|
|
766
|
+
"onUpdate:modelValue": a[9] || (a[9] = (C) => R.value = C),
|
|
767
|
+
"close-button": "",
|
|
768
|
+
"dismiss-away": "",
|
|
769
|
+
"min-width": N.value,
|
|
770
|
+
"max-width": N.value,
|
|
771
|
+
"max-height": "86vh"
|
|
772
|
+
}, {
|
|
773
|
+
"dialog-header": M(() => [
|
|
774
|
+
s("div", Fn, y(He.value), 1)
|
|
775
|
+
]),
|
|
776
|
+
default: M(() => [
|
|
777
|
+
w(hn, {
|
|
778
|
+
commits: d.value === "inventory" ? ze.value : I(E),
|
|
779
|
+
"is-loading": I(O)
|
|
780
|
+
}, null, 8, ["commits", "is-loading"])
|
|
781
|
+
]),
|
|
782
|
+
_: 1
|
|
783
|
+
}, 8, ["modelValue", "min-width", "max-width"])
|
|
784
|
+
], 64);
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
}), Cn = /* @__PURE__ */ vt(Vn, [["__scopeId", "data-v-3fc1e3f3"]]), In = ["title"], Z = 48, H = 8, Dn = /* @__PURE__ */ W({
|
|
788
|
+
__name: "ChangelogFloatingButton",
|
|
789
|
+
setup(p) {
|
|
790
|
+
const { t } = ue(), n = ae(), v = x(() => {
|
|
791
|
+
var g;
|
|
792
|
+
return !!((g = n.sessionUser.value) != null && g.role.isAdmin);
|
|
793
|
+
}), i = S(!1), l = S({ x: 0, y: 0 });
|
|
794
|
+
function m(g, L, o) {
|
|
795
|
+
return Math.min(Math.max(g, L), o);
|
|
796
|
+
}
|
|
797
|
+
function r() {
|
|
798
|
+
const g = Math.max(H, window.innerWidth - Z - H), L = Math.max(H, window.innerHeight - Z - H), o = l.value.x + Z / 2;
|
|
799
|
+
l.value = {
|
|
800
|
+
x: o < window.innerWidth / 2 ? H : g,
|
|
801
|
+
y: m(l.value.y, H, L)
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
function $() {
|
|
805
|
+
l.value = { x: window.innerWidth - Z - H, y: Math.round(window.innerHeight / 2) };
|
|
806
|
+
}
|
|
807
|
+
_e(() => {
|
|
808
|
+
$(), window.addEventListener("resize", r), window.addEventListener("orientationchange", r);
|
|
809
|
+
}), qe(() => {
|
|
810
|
+
window.removeEventListener("resize", r), window.removeEventListener("orientationchange", r);
|
|
811
|
+
});
|
|
812
|
+
const k = S(!1);
|
|
813
|
+
let _ = null, F = !1;
|
|
814
|
+
function N(g) {
|
|
815
|
+
_ = { x: g.clientX, y: g.clientY, px: l.value.x, py: l.value.y }, k.value = !0, F = !1, g.currentTarget.setPointerCapture(g.pointerId);
|
|
816
|
+
}
|
|
817
|
+
function E(g) {
|
|
818
|
+
if (!_) return;
|
|
819
|
+
const L = g.clientX - _.x, o = g.clientY - _.y;
|
|
820
|
+
Math.abs(L) + Math.abs(o) > 3 && (F = !0), l.value = {
|
|
821
|
+
x: m(_.px + L, 0, window.innerWidth - Z),
|
|
822
|
+
y: m(_.py + o, 0, window.innerHeight - Z)
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function O() {
|
|
826
|
+
_ = null, k.value = !1, r();
|
|
827
|
+
}
|
|
828
|
+
function V() {
|
|
829
|
+
_ && (O(), F || (i.value = !0));
|
|
830
|
+
}
|
|
831
|
+
return (g, L) => {
|
|
832
|
+
const o = D("FmIcon");
|
|
833
|
+
return u(), oe(Xe, { to: "body" }, [
|
|
834
|
+
v.value ? (u(), f(B, { key: 0 }, [
|
|
835
|
+
s("button", {
|
|
836
|
+
type: "button",
|
|
837
|
+
title: I(t)("inventory.changelog.title"),
|
|
838
|
+
class: Ve([
|
|
839
|
+
"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",
|
|
840
|
+
k.value ? "cursor-grabbing" : "cursor-grab transition-[left,top] duration-200 ease-out"
|
|
841
|
+
]),
|
|
842
|
+
style: Qe({ left: `${l.value.x}px`, top: `${l.value.y}px` }),
|
|
843
|
+
onPointerdown: N,
|
|
844
|
+
onPointermove: E,
|
|
845
|
+
onPointerup: V,
|
|
846
|
+
onPointercancel: O
|
|
847
|
+
}, [
|
|
848
|
+
w(o, {
|
|
849
|
+
name: "history",
|
|
850
|
+
size: "md",
|
|
851
|
+
outline: ""
|
|
852
|
+
})
|
|
853
|
+
], 46, In),
|
|
854
|
+
w(Cn, {
|
|
855
|
+
modelValue: i.value,
|
|
856
|
+
"onUpdate:modelValue": L[0] || (L[0] = (c) => i.value = c)
|
|
857
|
+
}, null, 8, ["modelValue"])
|
|
858
|
+
], 64)) : T("", !0)
|
|
859
|
+
]);
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
}), Pn = { class: "flex items-center gap-2" }, Un = { class: "text-xs text-gray-400 font-normal" }, Tn = { class: "flex flex-col gap-3" }, Bn = { class: "max-h-[480px] flex flex-col gap-1" }, Nn = { class: "font-mono text-xs text-gray-700 break-all min-w-0" }, En = {
|
|
863
|
+
key: 0,
|
|
864
|
+
class: "inline-flex items-center gap-1 text-xs font-medium text-green-700 bg-green-50 px-2 py-0.5 rounded-full"
|
|
865
|
+
}, An = {
|
|
866
|
+
key: 1,
|
|
867
|
+
class: "inline-flex items-center gap-1 text-xs font-medium text-red-700 bg-red-50 px-2 py-0.5 rounded-full"
|
|
868
|
+
}, Mn = {
|
|
869
|
+
key: 2,
|
|
870
|
+
class: "inline-flex items-center gap-1 text-xs font-medium text-gray-500 bg-gray-100 px-2 py-0.5 rounded-full"
|
|
871
|
+
}, On = {
|
|
872
|
+
key: 0,
|
|
873
|
+
class: "text-center text-sm text-gray-400 py-4"
|
|
874
|
+
}, zn = /* @__PURE__ */ W({
|
|
875
|
+
__name: "FmFeatureFlagDialog",
|
|
876
|
+
setup(p) {
|
|
877
|
+
const t = S(!1), n = S(""), v = x(() => {
|
|
878
|
+
const { getFlagValue: m } = st();
|
|
879
|
+
return Object.values(rt).map((r) => {
|
|
880
|
+
const $ = m(r, (k) => k === "true");
|
|
881
|
+
return {
|
|
882
|
+
name: r,
|
|
883
|
+
enabled: $
|
|
884
|
+
};
|
|
885
|
+
});
|
|
886
|
+
}), i = x(() => {
|
|
887
|
+
const m = n.value.toLowerCase();
|
|
888
|
+
return m ? v.value.filter((r) => r.name.toLowerCase().includes(m)) : v.value;
|
|
889
|
+
}), l = x(() => {
|
|
890
|
+
const m = v.value.filter((k) => k.enabled === !0).length, r = v.value.filter((k) => k.enabled === !1).length, $ = v.value.filter((k) => k.enabled === null).length;
|
|
891
|
+
return { enabled: m, disabled: r, unknown: $, total: v.value.length };
|
|
892
|
+
});
|
|
893
|
+
return (m, r) => {
|
|
894
|
+
const $ = D("FmButton"), k = D("FmSpacer"), _ = D("FmDialog");
|
|
895
|
+
return u(), oe(_, {
|
|
896
|
+
modelValue: t.value,
|
|
897
|
+
"onUpdate:modelValue": r[2] || (r[2] = (F) => t.value = F),
|
|
898
|
+
overlay: !0
|
|
899
|
+
}, {
|
|
900
|
+
"dialog-button": M(() => [
|
|
901
|
+
w(Pe, null, {
|
|
902
|
+
default: M(() => [
|
|
903
|
+
w($, {
|
|
904
|
+
variant: "secondary",
|
|
905
|
+
label: "Feature flags"
|
|
906
|
+
})
|
|
907
|
+
]),
|
|
908
|
+
_: 1
|
|
909
|
+
})
|
|
910
|
+
]),
|
|
911
|
+
"dialog-header": M(() => [
|
|
912
|
+
s("div", Pn, [
|
|
913
|
+
r[3] || (r[3] = s("span", null, "Feature Flags", -1)),
|
|
914
|
+
s("span", Un, y(l.value.enabled) + " enabled · " + y(l.value.disabled) + " disabled · " + y(l.value.unknown) + " unknown ", 1)
|
|
915
|
+
])
|
|
916
|
+
]),
|
|
917
|
+
"dialog-footer": M(() => [
|
|
918
|
+
w(k, { class: "sm:hidden xs:hidden" }),
|
|
919
|
+
w($, {
|
|
920
|
+
class: "sm:w-full xs:w-full",
|
|
921
|
+
label: "Close",
|
|
922
|
+
size: "md",
|
|
923
|
+
variant: "primary",
|
|
924
|
+
onClick: r[1] || (r[1] = (F) => t.value = !1)
|
|
925
|
+
})
|
|
926
|
+
]),
|
|
927
|
+
default: M(() => [
|
|
928
|
+
s("div", Tn, [
|
|
929
|
+
Ze(s("input", {
|
|
930
|
+
"onUpdate:modelValue": r[0] || (r[0] = (F) => n.value = F),
|
|
931
|
+
type: "text",
|
|
932
|
+
placeholder: "Search flags...",
|
|
933
|
+
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"
|
|
934
|
+
}, null, 512), [
|
|
935
|
+
[et, n.value]
|
|
936
|
+
]),
|
|
937
|
+
s("div", Bn, [
|
|
938
|
+
(u(!0), f(B, null, ee(i.value, (F) => (u(), f("div", {
|
|
939
|
+
key: F.name,
|
|
940
|
+
class: "flex items-start justify-between gap-2 px-3 py-2 rounded-md hover:bg-gray-50 text-sm"
|
|
941
|
+
}, [
|
|
942
|
+
s("span", Nn, y(F.name), 1),
|
|
943
|
+
F.enabled === !0 ? (u(), f("span", En, r[4] || (r[4] = [
|
|
944
|
+
s("span", { class: "w-1.5 h-1.5 rounded-full bg-green-500" }, null, -1),
|
|
945
|
+
ie(" Enabled ")
|
|
946
|
+
]))) : F.enabled === !1 ? (u(), f("span", An, r[5] || (r[5] = [
|
|
947
|
+
s("span", { class: "w-1.5 h-1.5 rounded-full bg-red-500" }, null, -1),
|
|
948
|
+
ie(" Disabled ")
|
|
949
|
+
]))) : (u(), f("span", Mn, r[6] || (r[6] = [
|
|
950
|
+
s("span", { class: "w-1.5 h-1.5 rounded-full bg-gray-400" }, null, -1),
|
|
951
|
+
ie(" Unknown ")
|
|
952
|
+
])))
|
|
953
|
+
]))), 128)),
|
|
954
|
+
i.value.length === 0 ? (u(), f("div", On, ' No flags matching "' + y(n.value) + '" ', 1)) : T("", !0)
|
|
955
|
+
])
|
|
956
|
+
])
|
|
957
|
+
]),
|
|
958
|
+
_: 1
|
|
959
|
+
}, 8, ["modelValue"]);
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
}), Kn = { class: "h-full flex flex-col overflow-auto py-16 gap-2" }, Gn = /* @__PURE__ */ W({
|
|
963
|
+
__name: "NavigationTab",
|
|
964
|
+
setup(p) {
|
|
965
|
+
const t = at(), n = xe(), v = ae(), i = pt(), { menuItems: l } = De();
|
|
966
|
+
A([() => v.currentBusiness.value, () => t.name], ([_, F]) => {
|
|
967
|
+
(_ == null ? void 0 : _.menuVersion) === "v3" && (F === Y.INGREDIENTS || F === Y.RECIPE || F === Y.UNIT) && n.push({ name: Y.STOCK });
|
|
968
|
+
});
|
|
969
|
+
const m = x({
|
|
970
|
+
get() {
|
|
971
|
+
if (t.name)
|
|
972
|
+
return String(t.name);
|
|
973
|
+
},
|
|
974
|
+
set(_) {
|
|
975
|
+
_ && n.push({ name: _ });
|
|
976
|
+
}
|
|
977
|
+
}), r = x(
|
|
978
|
+
() => {
|
|
979
|
+
var _;
|
|
980
|
+
return `NavigationTab.${(_ = v.currentBusiness.value) == null ? void 0 : _._id}`;
|
|
981
|
+
}
|
|
982
|
+
), $ = S(!1), k = x({
|
|
983
|
+
get() {
|
|
984
|
+
return $.value;
|
|
985
|
+
},
|
|
986
|
+
set(_) {
|
|
987
|
+
$.value = _, _ || i.setItem(r.value, "true");
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
return A([() => r.value], () => {
|
|
991
|
+
$.value = !1, setTimeout(() => {
|
|
992
|
+
k.value = !i.getItem(r.value);
|
|
993
|
+
}, 2e3);
|
|
994
|
+
}), (_, F) => {
|
|
995
|
+
const N = D("FmCollapsibleTabs");
|
|
996
|
+
return u(), f("div", Kn, [
|
|
997
|
+
w(zn),
|
|
998
|
+
w(N, {
|
|
999
|
+
modelValue: m.value,
|
|
1000
|
+
"onUpdate:modelValue": F[0] || (F[0] = (E) => m.value = E),
|
|
1001
|
+
items: I(l)
|
|
1002
|
+
}, null, 8, ["modelValue", "items"])
|
|
1003
|
+
]);
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
typeof Promise.withResolvers > "u" && (Promise.withResolvers = () => {
|
|
1008
|
+
let p, t;
|
|
1009
|
+
return { promise: new Promise((v, i) => {
|
|
1010
|
+
p = v, t = i;
|
|
1011
|
+
}), resolve: p, reject: t };
|
|
1012
|
+
});
|
|
1013
|
+
typeof Promise.prototype.delayed > "u" && (Promise.prototype.delayed = async function(p) {
|
|
1014
|
+
return await new Promise((t) => setTimeout(t, p)), Promise.resolve(this);
|
|
1015
|
+
});
|
|
1016
|
+
const so = /* @__PURE__ */ W({
|
|
1017
|
+
__name: "App",
|
|
1018
|
+
setup(p) {
|
|
1019
|
+
const t = ae(), n = gt(), v = ot(), i = window.location.href.includes("print-preview");
|
|
1020
|
+
_e(() => {
|
|
1021
|
+
if (window.location.href.includes("print-preview")) {
|
|
1022
|
+
t.setEmbedded(!0), document.body.classList.add("print-mode");
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
t.registerSidebarComponent(Gn), n.initGoogleMap(v.appApi.googleMap).catch(() => {
|
|
1026
|
+
console.error("Google map cannot be loaded");
|
|
1027
|
+
});
|
|
1028
|
+
}), A([() => t.currentCountry.value], () => {
|
|
1029
|
+
l();
|
|
1030
|
+
});
|
|
1031
|
+
async function l() {
|
|
1032
|
+
var m;
|
|
1033
|
+
try {
|
|
1034
|
+
await t.readBusinesses(), t.currentBusiness.value = (m = t.businesses.value) == null ? void 0 : m.find((r) => r);
|
|
1035
|
+
} catch (r) {
|
|
1036
|
+
console.error("error when trying to reset businesses:", r);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
return (m, r) => (u(), f(B, null, [
|
|
1040
|
+
w(Dt),
|
|
1041
|
+
I(i) ? T("", !0) : (u(), oe(Dn, { key: 0 }))
|
|
1042
|
+
], 64));
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
export {
|
|
1046
|
+
so as default
|
|
1047
|
+
};
|