@feedmepos/mf-inventory-portal 1.7.9-dev.0 → 1.7.9-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.
- package/dist/App-BYCW0L94.js +1403 -0
- package/dist/{ApprovalView-Bc6xo-gg.js → ApprovalView-pmI_SFo7.js} +9 -9
- package/dist/{BindingsDialog-BbTkoM05.js → BindingsDialog-D902flPr.js} +2 -2
- package/dist/{BindingsPicker-CkK79U9V.js → BindingsPicker-JEKsY59b.js} +2 -2
- package/dist/{BindingsTable-CmdCc1mG.js → BindingsTable-DqlzOIxF.js} +4 -4
- package/dist/{BulkReceiveRequestView-BOt07CYr.js → BulkReceiveRequestView-Chw7ma2k.js} +19 -19
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-YMRGpkS4.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Cct8Ko19.js} +1 -1
- package/dist/{ClosingDraftView-Dec1xuFQ.js → ClosingDraftView-D1ymRsd2.js} +19 -19
- package/dist/{ClosingHistoryView-DuX0UpLC.js → ClosingHistoryView-5yr_itIV.js} +5 -5
- package/dist/{ClosingTemplateView-DBPGxWt2.js → ClosingTemplateView-MDl5Zq-g.js} +16 -16
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DWfblvtV.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-BcG0gWV4.js} +1 -1
- package/dist/{DefaultView-D_XfvHrs.js → DefaultView-dOfbL3iF.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-DfAAAfCJ.js → DeliveryOrderPrintPreview-BfVgQOx8.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-CdcBrUHW.js → EmailDialog.vue_vue_type_script_setup_true_lang-DHspOJQW.js} +2250 -2250
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-lge1DZ4v.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-B7NLu0us.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DjYAwlg9.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C0nunKjx.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-vwp2n9KL.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CMst9tkA.js} +2 -2
- package/dist/{FmMultiselectDialog-BTVaIESZ.js → FmMultiselectDialog-BjBx94pY.js} +1 -1
- package/dist/{FmMultiselectDialog-C-kDJtv_.js → FmMultiselectDialog-Dt54hvqw.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Mo-hF_cA.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DtG9Ieo_.js} +6 -6
- package/dist/{ImportView-CRAFZVSk.js → ImportView-CdZN8k_Y.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CuEDzJ0s.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-iCpYEneM.js} +1 -1
- package/dist/{IngredientGroupView-OeeBfJau.js → IngredientGroupView-BBVS1mKn.js} +5 -5
- package/dist/{IngredientsView-BHX3xUDm.js → IngredientsView-BGOaAUzR.js} +17 -16
- package/dist/{IntegrationExplorerView-BwxSGD2N.js → IntegrationExplorerView-UUBCmqdR.js} +4 -4
- package/dist/{IntegrationView-CevJNVqG.js → IntegrationView-B2YowH-i.js} +14 -14
- package/dist/{InventoryBindingForm-wE--IP2D.js → InventoryBindingForm-kDx6Mvhn.js} +1 -1
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-C8bktmYH.js +563 -0
- package/dist/{InventoryBindingSummary-BQ-U7tHs.js → InventoryBindingSummary-DJrBTa8_.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-jnXbX2lS.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DHk9uEAP.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BNMCbrIo.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Dx1VktdW.js} +1 -1
- package/dist/{ProductionView-CvU9N_mb.js → ProductionView-CxUcsRBP.js} +7 -7
- package/dist/{PublishView-BNnxGtEQ.js → PublishView-DtP-Ms7q.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-Bq9kMWdx.js → PurchaseOrderPrintPreview-C_qC2KF5.js} +2 -2
- package/dist/{ReceiveRequestView-zUSU0Uvq.js → ReceiveRequestView-Dy3BpqsP.js} +14 -14
- package/dist/RecipeView-DeR7pqj8.js +3625 -0
- package/dist/{SettingsView-CPgsU8Kr.js → SettingsView-C7ZXmatO.js} +4 -4
- package/dist/{StockView-D-TJzHhP.js → StockView-wFLnNSRr.js} +21 -21
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B6ez4H3Z.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Fxh3-Nqi.js} +1 -1
- package/dist/{SupplierView-D-rODe-B.js → SupplierView-CeTDNDDK.js} +12 -12
- package/dist/{SurchargeView-C88KTCML.js → SurchargeView-BQJnCdPA.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CFIK8eEl.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-D1zxuH66.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BNjjTYtk.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BFkh3Ubb.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-E0FeDPFB.js → TransferDetails.vue_vue_type_script_setup_true_lang-CZVDhXNz.js} +20 -20
- package/dist/{TransferTemplateView-f9A4-wEL.js → TransferTemplateView-XaI2T5fa.js} +20 -20
- package/dist/{UnitCostHistoryView-D26St5yl.js → UnitCostHistoryView-DTNW7-mk.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-D2z5vabu.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-vRsEjVJc.js} +4 -4
- package/dist/{UnitView-algS_4rD.js → UnitView-DXnyzkj3.js} +7 -7
- package/dist/{WarehouseView-BRM-euG4.js → WarehouseView-iEHFgIqh.js} +5 -5
- package/dist/{WastageTemplateView-BWPYvTMC.js → WastageTemplateView-CGDUCPbr.js} +14 -14
- package/dist/api/changelog.d.ts +69 -1
- package/dist/{app-BI1fLJ8H.js → app-BIXJtvvD.js} +35 -23
- package/dist/app.d.ts +26 -8
- package/dist/app.js +1 -1
- package/dist/{closing-template-DRQ-A04S.js → closing-template-CLY-r6Cf.js} +1 -1
- package/dist/{date2-paxg81i_.js → date2-DbYQycSa.js} +1 -1
- package/dist/{dayjs.min-CqWwbKI1.js → dayjs.min-Dv7-fEed.js} +1 -1
- package/dist/{decimal-tY0JrFld.js → decimal-B8YR17QC.js} +2 -2
- package/dist/{defineDeepModel-CaP78Goh.js → defineDeepModel-C5ncgNxj.js} +1 -1
- package/dist/{duplicate-template-pTXXQ0VS.js → duplicate-template-CAlG1nzV.js} +1 -1
- package/dist/{feature-B2r32qOO.js → feature-BLSNLI5y.js} +2 -2
- package/dist/{format-time-from-id-DXMYus4N.js → format-time-from-id-D5DcWpHS.js} +1 -1
- package/dist/{format-unit-display-5hlsZBY2.js → format-unit-display-Ch97dVXx.js} +12 -12
- package/dist/{import-export.helper-BiC2Ghbl.js → import-export.helper-CvUFSOa1.js} +6 -6
- package/dist/{index-rqdAWR69.js → index-Bk8DOv4n.js} +3306 -3232
- package/dist/{index-KP2-U9x_.js → index-CXzVUrJS.js} +3 -3
- package/dist/{index-B7eouqPa.js → index-rRPErzP4.js} +1 -1
- package/dist/{inventory-core-dart.default-ClRRaGtG.js → inventory-core-dart.default-Cj7CxnpK.js} +1 -1
- package/dist/{lz-string-CAl-OrXa.js → lz-string-DWkGPESZ.js} +1 -1
- package/dist/{netsuite-cH4OybGV.js → netsuite-Cn0y1rH3.js} +2 -2
- package/dist/{number-BzmDQm_s.js → number-CxbQxQwj.js} +3 -3
- package/dist/{predefined-templates-Baz8GEGx.js → predefined-templates-CrSoG3R9.js} +1 -1
- package/dist/{purchase-order-template-0So3c2iS.js → purchase-order-template-BmQQnrEl.js} +1 -1
- package/dist/{recalculationUtils-DJlz5mJL.js → recalculationUtils-CSnowXma.js} +1 -1
- package/dist/{rules-BKdtla9-.js → rules-CurdOAcA.js} +2 -2
- package/dist/{stock-D8M5e53w.js → stock-BdDR_L8p.js} +1 -1
- package/dist/{stock-HCSCwSH0.js → stock-BiqEgcgU.js} +3 -3
- package/dist/style.css +1 -1
- package/dist/{supplier-1mbcQSiQ.js → supplier-CsjbmP_P.js} +2 -2
- package/dist/{surcharge-DuxYBaWV.js → surcharge--kBjIIst.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-Dkbgtow8.js → uom-rules-D8UPS06O.js} +1 -1
- package/dist/{use-ingredient-select-dialog-BXvBvELI.js → use-ingredient-select-dialog-BZdrpLOE.js} +2 -2
- package/dist/{use-inventory-binding-dialog-2lrzHWdQ.js → use-inventory-binding-dialog-CkNxixT2.js} +2 -2
- package/dist/{use-template-enabled-locations-CrDuAaCj.js → use-template-enabled-locations-Dkl1_1F-.js} +2 -2
- package/dist/{use-transfer-locations-C4oTuW_f.js → use-transfer-locations-Bmj4zTJj.js} +2 -2
- package/dist/{useHrmPermission-CxeYlUgA.js → useHrmPermission-DcBe_-Q6.js} +1 -1
- package/dist/{useNavigationMenu-BWgwgA4U.js → useNavigationMenu-CsRbtAc7.js} +2 -2
- package/dist/{useSseClient-DPA1zg96.js → useSseClient-hl2SQF5b.js} +1 -1
- package/dist/views/changelog/components/ChangelogPanel.spec.d.ts +1 -0
- package/dist/views/changelog/components/ChangelogPanel.vue.d.ts +2 -0
- package/dist/views/changelog/composables/use-changelog.d.ts +54 -2
- package/dist/views/changelog/composables/use-inventory-record-commits.d.ts +97 -0
- package/dist/views/changelog/composables/use-inventory-record-commits.spec.d.ts +1 -0
- package/dist/views/changelog/composables/use-snapshot-diff.d.ts +29 -0
- package/dist/views/changelog/composables/use-snapshot-diff.spec.d.ts +1 -0
- package/dist/views/changelog/composables/value-tree.d.ts +14 -0
- package/dist/views/changelog/composables/value-tree.spec.d.ts +1 -0
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +2 -0
- package/dist/views/ingredients/components/inventory-binding/RecipeBindingBreakdown.vue.d.ts +25 -0
- package/dist/views/ingredients/components/inventory-binding/composables/recipe-breakdown.d.ts +34 -0
- package/dist/views/ingredients/components/inventory-binding/composables/recipe-breakdown.spec.d.ts +1 -0
- package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +2 -0
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +4 -0
- package/dist/views/recipe/composables/use-recipe-table.d.ts +11 -0
- package/dist/{vue-i18n-BSfpVmaF.js → vue-i18n-yL99yI4f.js} +169 -169
- package/dist/{xlsx.util-DSA9o0Zu.js → xlsx.util-B8azJxkS.js} +2 -2
- package/package.json +2 -2
- package/dist/App-DvBMEcuJ.js +0 -1155
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-O5IbSGWu.js +0 -441
- package/dist/RecipeView-DkXOK1Iy.js +0 -3584
|
@@ -0,0 +1,1403 @@
|
|
|
1
|
+
import { ref as L, onUnmounted as st, computed as C, defineComponent as le, watch as W, onMounted as Fe, resolveComponent as O, createElementBlock as d, openBlock as i, createBlock as fe, createCommentVNode as E, unref as D, createVNode as I, createElementVNode as y, toDisplayString as b, Fragment as A, renderList as Z, withKeys as Be, normalizeClass as ne, withModifiers as lt, withCtx as Q, createTextVNode as oe, h as rt, onBeforeUnmount as it, Teleport as ut, normalizeStyle as ct, withDirectives as dt, vModelText as ft } from "vue";
|
|
2
|
+
import { _ as mt } from "./empty-placeholder-B0QU467o.js";
|
|
3
|
+
import { u as Oe, a as je, R as se, d as pt, S as vt, b as gt } from "./app-BIXJtvvD.js";
|
|
4
|
+
import { useCoreStore as ve, useI18n as _e } from "@feedmepos/mf-common";
|
|
5
|
+
import { useRouter as Ee, useRoute as yt } from "vue-router";
|
|
6
|
+
import { u as ht, a as _t, I as xt } from "./feature-BLSNLI5y.js";
|
|
7
|
+
import { u as bt } from "./netsuite-Cn0y1rH3.js";
|
|
8
|
+
import { u as Ke } from "./useNavigationMenu-CsRbtAc7.js";
|
|
9
|
+
import { useBreakpoints as wt } from "@feedmepos/ui-library";
|
|
10
|
+
import { F as ze } from "./FmAdminBadge-DlplQOHb.js";
|
|
11
|
+
import { i as kt, _ as St } from "./FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-B7NLu0us.js";
|
|
12
|
+
import { F as $t } from "./decimal-B8YR17QC.js";
|
|
13
|
+
import { t as Lt, a as Ct } from "./date2-DbYQycSa.js";
|
|
14
|
+
import { _ as Rt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
15
|
+
import { u as Dt } from "./useTabStorage-BkIVScW_.js";
|
|
16
|
+
import { u as It } from "./googlemap-D9vA7GsS.js";
|
|
17
|
+
function Ft() {
|
|
18
|
+
return {
|
|
19
|
+
loadingHookInstalled: !1,
|
|
20
|
+
isLoading: !1
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const ce = L(Ft());
|
|
24
|
+
function Et() {
|
|
25
|
+
const a = Ee();
|
|
26
|
+
if (!ce.value.loadingHookInstalled) {
|
|
27
|
+
ce.value.loadingHookInstalled = !0;
|
|
28
|
+
const t = a.beforeEach(() => {
|
|
29
|
+
ce.value.isLoading = !0;
|
|
30
|
+
}), e = a.afterEach(() => {
|
|
31
|
+
ce.value.isLoading = !1;
|
|
32
|
+
});
|
|
33
|
+
st(() => {
|
|
34
|
+
ce.value.loadingHookInstalled = !1, t(), e();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
get isLoading() {
|
|
39
|
+
return ce.value.isLoading;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function Nt() {
|
|
44
|
+
const { firstAccessibleRouteName: a } = Ke();
|
|
45
|
+
return { hasAnyAccessibleInventoryRoute: C(() => a.value !== null) };
|
|
46
|
+
}
|
|
47
|
+
const Pt = {
|
|
48
|
+
key: 0,
|
|
49
|
+
class: "flex flex-col items-center w-full h-full gap-24"
|
|
50
|
+
}, Tt = {
|
|
51
|
+
key: 1,
|
|
52
|
+
class: "flex flex-col pt-[200px] gap-32 items-center"
|
|
53
|
+
}, Vt = { class: "flex flex-col gap-12 items-center text-center px-24 max-w-[600px]" }, Ut = { class: "fm-typo-en-title-lg-600" }, Bt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, At = {
|
|
54
|
+
key: 2,
|
|
55
|
+
class: "flex flex-col pt-[200px] gap-32 items-center"
|
|
56
|
+
}, Mt = { class: "flex flex-col gap-12 items-center text-center px-24 max-w-[1000px]" }, Ot = { class: "fm-typo-en-title-lg-600" }, jt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, Kt = { class: "flex gap-16" }, zt = { href: "https://feedme.ai/product/inventory/features?tab=plans_%26_prices" }, Gt = { href: "https://feedme.ai/form" }, Ht = /* @__PURE__ */ le({
|
|
57
|
+
__name: "InventoryView",
|
|
58
|
+
setup(a) {
|
|
59
|
+
const t = Oe(), e = je(), l = bt(), s = ve(), o = Ee(), u = Et(), r = ht(), { t: v } = _e(), { hasAnyAccessibleInventoryRoute: g } = Nt();
|
|
60
|
+
W(
|
|
61
|
+
[() => s.sessionUser.value, () => s.currentBusiness.value],
|
|
62
|
+
([B, h]) => {
|
|
63
|
+
_(B, h);
|
|
64
|
+
}
|
|
65
|
+
), Fe(async () => {
|
|
66
|
+
await r.init(), await s.readBusinesses();
|
|
67
|
+
const B = s.sessionUser.value, h = s.currentBusiness.value;
|
|
68
|
+
_(B, h);
|
|
69
|
+
});
|
|
70
|
+
function _(B, h) {
|
|
71
|
+
!B || !h || $();
|
|
72
|
+
}
|
|
73
|
+
async function $() {
|
|
74
|
+
return await t.init(), await l.readSetting().catch((B) => {
|
|
75
|
+
console.error("[all] error on reading netsuite store", B);
|
|
76
|
+
}), await e.init();
|
|
77
|
+
}
|
|
78
|
+
const Y = C(() => o.currentRoute.value.name === se.TRANSFER_TEMPLATE ? r.enablePoTemplate : o.currentRoute.value.name === se.INGREDIENT_GROUP ? r.enableIngredientGroup : !0), j = C(
|
|
79
|
+
() => o.currentRoute.value.matched.some((B) => {
|
|
80
|
+
var P;
|
|
81
|
+
const h = B.meta, N = h == null ? void 0 : h.validationManifest;
|
|
82
|
+
return (((P = N == null ? void 0 : N.requiredCaslPermissions) == null ? void 0 : P.length) ?? 0) > 0;
|
|
83
|
+
})
|
|
84
|
+
), ee = C(() => {
|
|
85
|
+
if (!s.sessionUser.value) return !1;
|
|
86
|
+
if (t._locations !== null && t.locations.length === 0) return !0;
|
|
87
|
+
if (!r.isLoaded) return !1;
|
|
88
|
+
const N = o.currentRoute.value.name === se.LOADING;
|
|
89
|
+
return !g.value && (N || j.value);
|
|
90
|
+
});
|
|
91
|
+
return (B, h) => {
|
|
92
|
+
const N = O("FmSpacer"), P = O("FmCircularProgress"), K = O("FmButton"), re = O("RouterView");
|
|
93
|
+
return i(), d("div", null, [
|
|
94
|
+
D(u).isLoading ? (i(), d("div", Pt, [
|
|
95
|
+
I(N),
|
|
96
|
+
y("div", null, [
|
|
97
|
+
I(P, { size: "xl" })
|
|
98
|
+
]),
|
|
99
|
+
h[0] || (h[0] = y("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading page...", -1)),
|
|
100
|
+
I(N)
|
|
101
|
+
])) : ee.value ? (i(), d("div", Tt, [
|
|
102
|
+
h[1] || (h[1] = y("img", {
|
|
103
|
+
src: mt,
|
|
104
|
+
alt: "No permission",
|
|
105
|
+
class: "w-[200px] h-[200px]"
|
|
106
|
+
}, null, -1)),
|
|
107
|
+
y("div", Vt, [
|
|
108
|
+
y("div", Ut, b(D(v)("inventory.common.noPermission.title")), 1),
|
|
109
|
+
y("div", Bt, b(D(v)("inventory.common.noPermission.description")), 1)
|
|
110
|
+
])
|
|
111
|
+
])) : Y.value ? D(s).sessionUser.value ? (i(), fe(re, { key: 3 })) : E("", !0) : (i(), d("div", At, [
|
|
112
|
+
y("div", Mt, [
|
|
113
|
+
y("div", Ot, b(D(v)("inventory.common.proPlan.title")), 1),
|
|
114
|
+
y("div", jt, b(D(v)("inventory.common.proPlan.subtitle")), 1)
|
|
115
|
+
]),
|
|
116
|
+
y("div", Kt, [
|
|
117
|
+
y("a", zt, [
|
|
118
|
+
I(K, {
|
|
119
|
+
label: D(v)("inventory.common.proPlan.comparePlans"),
|
|
120
|
+
variant: "secondary"
|
|
121
|
+
}, null, 8, ["label"])
|
|
122
|
+
]),
|
|
123
|
+
y("a", Gt, [
|
|
124
|
+
I(K, {
|
|
125
|
+
label: D(v)("inventory.common.proPlan.callUs"),
|
|
126
|
+
"prepend-icon": "call"
|
|
127
|
+
}, null, 8, ["label"])
|
|
128
|
+
])
|
|
129
|
+
])
|
|
130
|
+
]))
|
|
131
|
+
]);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}), Ce = {
|
|
135
|
+
// Template/PO item rows carry no id of their own — the embedded sku's _id is
|
|
136
|
+
// the element identity, and kit names the element from that object's name
|
|
137
|
+
// field, so an item change reads "Items › <sku name> › …" instead of a bare
|
|
138
|
+
// index. Arrays where the key isn't usable (an element without sku._id, or
|
|
139
|
+
// duplicates) fall back to identity_fields, then positional — unchanged.
|
|
140
|
+
array_keys: { items: "sku._id" },
|
|
141
|
+
identity_fields: ["_id", "id"],
|
|
142
|
+
name_fields: ["name", "code"],
|
|
143
|
+
ignored_fields: [
|
|
144
|
+
"_id",
|
|
145
|
+
"_rev",
|
|
146
|
+
"_deleted",
|
|
147
|
+
"__v",
|
|
148
|
+
"updatedAt",
|
|
149
|
+
"createdAt",
|
|
150
|
+
"updatedBy",
|
|
151
|
+
"createdBy"
|
|
152
|
+
],
|
|
153
|
+
label_keys: {
|
|
154
|
+
prefix: "inventory.changelog.label.",
|
|
155
|
+
fields: [
|
|
156
|
+
"abbrev",
|
|
157
|
+
"alternatives",
|
|
158
|
+
"amount",
|
|
159
|
+
"code",
|
|
160
|
+
"contains",
|
|
161
|
+
"conversion",
|
|
162
|
+
"convert",
|
|
163
|
+
"costPerUnit",
|
|
164
|
+
"customAttributes",
|
|
165
|
+
"default",
|
|
166
|
+
"defaultCost",
|
|
167
|
+
"inventoryBindings",
|
|
168
|
+
"isInactive",
|
|
169
|
+
"low",
|
|
170
|
+
"measurement",
|
|
171
|
+
"measurements",
|
|
172
|
+
"mid",
|
|
173
|
+
"name",
|
|
174
|
+
"operationalGroup",
|
|
175
|
+
"precision",
|
|
176
|
+
"priority",
|
|
177
|
+
"recipe",
|
|
178
|
+
"rules",
|
|
179
|
+
"sku",
|
|
180
|
+
"thresholds",
|
|
181
|
+
"trackingMeasurement",
|
|
182
|
+
"type",
|
|
183
|
+
"unit",
|
|
184
|
+
"valuation",
|
|
185
|
+
"version"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
}, Re = {
|
|
189
|
+
...Ce,
|
|
190
|
+
array_keys: {
|
|
191
|
+
measurements: "id",
|
|
192
|
+
"unit.measurements": "id",
|
|
193
|
+
"convert.inventoryBindings": "id",
|
|
194
|
+
"convert.inventoryBindings.alternatives": "_id",
|
|
195
|
+
contains: "id",
|
|
196
|
+
"contains.alternatives": "_id"
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
function Jt(a) {
|
|
200
|
+
return a instanceof vt && a.errorResponse.statusCode === 409;
|
|
201
|
+
}
|
|
202
|
+
const xe = pt((a, t) => ({
|
|
203
|
+
/**
|
|
204
|
+
* Commits for one record. recordId is the changelog docId, `${dbName}/${id}`.
|
|
205
|
+
* The dbName scopes the (access-checked) backend route; only the bare id is
|
|
206
|
+
* sent — the backend rebuilds the docId server-side.
|
|
207
|
+
*/
|
|
208
|
+
async getRecordChangelog(e, l, s) {
|
|
209
|
+
const o = e.indexOf("/");
|
|
210
|
+
if (o < 0) return [];
|
|
211
|
+
const u = e.slice(0, o), r = e.slice(o + 1), v = new URLSearchParams({ id: r });
|
|
212
|
+
l != null && v.set("limit", String(l)), s && (v.set("explain", "1"), v.set("schema", JSON.stringify(s)));
|
|
213
|
+
const g = `${a.inventoryBackendUrl}/${u}/changelog?${v.toString()}`;
|
|
214
|
+
return await t.get(g);
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* Purchase orders in a date range, each with when it last changed. The
|
|
218
|
+
* backend joins the orders to their newest commit, so no ids travel and the
|
|
219
|
+
* browser makes one request instead of list-then-ask-for-timestamps.
|
|
220
|
+
*/
|
|
221
|
+
async listPurchaseOrders(e, l, s) {
|
|
222
|
+
if (!e) return [];
|
|
223
|
+
const o = new URLSearchParams({ start: l, end: s }), u = `${a.inventoryBackendUrl}/${e}/changelog/purchase-order?${o}`;
|
|
224
|
+
return await t.get(u);
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* Closing drafts created in a date range, each with when it last changed.
|
|
228
|
+
* Closing groups come back as rows of their own — their submit/approve/
|
|
229
|
+
* reject is recorded against the group document, not its parent.
|
|
230
|
+
*/
|
|
231
|
+
async listClosingDrafts(e, l, s) {
|
|
232
|
+
if (!e) return [];
|
|
233
|
+
const o = new URLSearchParams({ start: l, end: s }), u = `${a.inventoryBackendUrl}/${e}/changelog/closing-draft?${o}`;
|
|
234
|
+
return await t.get(u);
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* A kit-dialect record's whole document, at HEAD or as of (and including)
|
|
238
|
+
* commit `at`. Same dbName/id split as getRecordChangelog. Rejects with a
|
|
239
|
+
* 409 (see isStateConflict) when the record's history predates the kit
|
|
240
|
+
* write path — the backend passthrough for kit httpapi's GET /api/state.
|
|
241
|
+
*/
|
|
242
|
+
async getState(e, l, s) {
|
|
243
|
+
const o = new URLSearchParams({ id: l });
|
|
244
|
+
s && o.set("at", s);
|
|
245
|
+
const u = `${a.inventoryBackendUrl}/${e}/changelog/state?${o.toString()}`;
|
|
246
|
+
return await t.get(u);
|
|
247
|
+
},
|
|
248
|
+
/**
|
|
249
|
+
* The domains the browser lists generically, declared in
|
|
250
|
+
* changelog-domains-pkg and served by the backend — a new browsable domain
|
|
251
|
+
* becomes a tab without a portal change. Backends predating the route
|
|
252
|
+
* yield an error the caller treats as "no extra domains".
|
|
253
|
+
*/
|
|
254
|
+
async listDomains(e) {
|
|
255
|
+
if (!e) return [];
|
|
256
|
+
const l = `${a.inventoryBackendUrl}/business_${e}/changelog/domains`;
|
|
257
|
+
return await t.get(l);
|
|
258
|
+
},
|
|
259
|
+
/**
|
|
260
|
+
* One generic domain's records, each with when it last changed. Business-
|
|
261
|
+
* scoped: the generic domains are configuration documents of the business
|
|
262
|
+
* db, not of a location.
|
|
263
|
+
*/
|
|
264
|
+
async listDomainRecords(e, l) {
|
|
265
|
+
if (!e) return [];
|
|
266
|
+
const s = `${a.inventoryBackendUrl}/business_${e}/changelog/domain/${encodeURIComponent(l)}`;
|
|
267
|
+
return await t.get(s);
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* One inventory module's records, each with when it last changed. Business-
|
|
271
|
+
* scoped, so the db is `business_<id>` — the same prefixed name the record's
|
|
272
|
+
* own changelog docId carries.
|
|
273
|
+
*/
|
|
274
|
+
async listInventory(e, l) {
|
|
275
|
+
if (!e) return [];
|
|
276
|
+
const s = `${a.inventoryBackendUrl}/business_${e}/changelog/inventory?module=${l}`;
|
|
277
|
+
return await t.get(s);
|
|
278
|
+
}
|
|
279
|
+
}));
|
|
280
|
+
function Yt() {
|
|
281
|
+
const a = xe(), t = L([]), e = L(!1);
|
|
282
|
+
async function l(s, o, u) {
|
|
283
|
+
if (!s) {
|
|
284
|
+
t.value = [];
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
e.value = !0;
|
|
288
|
+
try {
|
|
289
|
+
t.value = await a.getRecordChangelog(s, o, u);
|
|
290
|
+
} catch (r) {
|
|
291
|
+
throw t.value = [], r;
|
|
292
|
+
} finally {
|
|
293
|
+
e.value = !1;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return { commits: t, isLoading: e, load: l };
|
|
297
|
+
}
|
|
298
|
+
const Ge = 1e3;
|
|
299
|
+
function Xt(a, t) {
|
|
300
|
+
return [...a, ...t].sort((e, l) => l.at.localeCompare(e.at));
|
|
301
|
+
}
|
|
302
|
+
function Wt() {
|
|
303
|
+
const a = xe(), t = L([]);
|
|
304
|
+
async function e(l) {
|
|
305
|
+
if (t.value = [], !!l)
|
|
306
|
+
try {
|
|
307
|
+
t.value = await a.getRecordChangelog(
|
|
308
|
+
l,
|
|
309
|
+
Ge,
|
|
310
|
+
Re
|
|
311
|
+
);
|
|
312
|
+
} catch (s) {
|
|
313
|
+
console.error("changelog per-entity load failed", s);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return { commits: t, load: e };
|
|
317
|
+
}
|
|
318
|
+
function He(a) {
|
|
319
|
+
if (!a) return null;
|
|
320
|
+
try {
|
|
321
|
+
const t = JSON.parse(a);
|
|
322
|
+
return typeof (t == null ? void 0 : t.changelogLabelKey) == "string" && typeof (t == null ? void 0 : t.verb) == "string" ? {
|
|
323
|
+
labelKey: t.changelogLabelKey,
|
|
324
|
+
verb: t.verb,
|
|
325
|
+
...typeof t.name == "string" ? { name: t.name } : {}
|
|
326
|
+
} : null;
|
|
327
|
+
} catch {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function Je(a) {
|
|
332
|
+
return a.startsWith("inventory.changelog.");
|
|
333
|
+
}
|
|
334
|
+
const Ye = "";
|
|
335
|
+
function De(a) {
|
|
336
|
+
const t = a.indexOf(Ye);
|
|
337
|
+
return t === -1 ? { raw: a, human: a } : { raw: a.slice(0, t), human: a.slice(t + 1) };
|
|
338
|
+
}
|
|
339
|
+
const qt = [
|
|
340
|
+
"inventory.changelog.label.recipe",
|
|
341
|
+
"inventory.changelog.label.sku",
|
|
342
|
+
"inventory.changelog.label.unit"
|
|
343
|
+
], Zt = [...qt, "Recipe", "Ingredient", "Unit"];
|
|
344
|
+
function Qt(a) {
|
|
345
|
+
const { human: t } = De(a);
|
|
346
|
+
if (!t) return { type: "Document", name: "", field: [] };
|
|
347
|
+
const e = t.split(" › ");
|
|
348
|
+
return e.length >= 2 && Zt.includes(e[0]) ? { type: e[0], name: e[1], field: e.slice(2) } : { type: "Document", name: "", field: e };
|
|
349
|
+
}
|
|
350
|
+
const Ae = 800;
|
|
351
|
+
function Xe(a, t, e = 2) {
|
|
352
|
+
const l = Me(a), s = Me(t);
|
|
353
|
+
if (!l || !s) return null;
|
|
354
|
+
let o = 0;
|
|
355
|
+
for (; o < l.length && o < s.length && l[o] === s[o]; ) o++;
|
|
356
|
+
let u = 0;
|
|
357
|
+
for (; u < l.length - o && u < s.length - o && l[l.length - 1 - u] === s[s.length - 1 - u]; )
|
|
358
|
+
u++;
|
|
359
|
+
const r = l.slice(o, l.length - u), v = s.slice(o, s.length - u);
|
|
360
|
+
if (r.length > Ae || v.length > Ae) return null;
|
|
361
|
+
const g = (_) => ({ type: "same", text: _ });
|
|
362
|
+
return tn(
|
|
363
|
+
[...l.slice(0, o).map(g), ...en(r, v), ...l.slice(l.length - u).map(g)],
|
|
364
|
+
e
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
function Me(a) {
|
|
368
|
+
try {
|
|
369
|
+
const t = JSON.parse(a);
|
|
370
|
+
return t === null || typeof t != "object" ? null : JSON.stringify(t, null, 2).split(`
|
|
371
|
+
`);
|
|
372
|
+
} catch {
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function en(a, t) {
|
|
377
|
+
const e = a.length, l = t.length, s = Array.from({ length: e + 1 }, () => new Uint32Array(l + 1));
|
|
378
|
+
for (let v = e - 1; v >= 0; v--)
|
|
379
|
+
for (let g = l - 1; g >= 0; g--)
|
|
380
|
+
s[v][g] = a[v] === t[g] ? s[v + 1][g + 1] + 1 : Math.max(s[v + 1][g], s[v][g + 1]);
|
|
381
|
+
const o = [];
|
|
382
|
+
let u = 0, r = 0;
|
|
383
|
+
for (; u < e && r < l; )
|
|
384
|
+
a[u] === t[r] ? (o.push({ type: "same", text: a[u] }), u++, r++) : s[u + 1][r] >= s[u][r + 1] ? (o.push({ type: "del", text: a[u] }), u++) : (o.push({ type: "add", text: t[r] }), r++);
|
|
385
|
+
for (; u < e; ) o.push({ type: "del", text: a[u++] });
|
|
386
|
+
for (; r < l; ) o.push({ type: "add", text: t[r++] });
|
|
387
|
+
return o;
|
|
388
|
+
}
|
|
389
|
+
function tn(a, t) {
|
|
390
|
+
const e = a.map(() => !1);
|
|
391
|
+
a.forEach((o, u) => {
|
|
392
|
+
if (o.type !== "same")
|
|
393
|
+
for (let r = Math.max(0, u - t); r <= Math.min(a.length - 1, u + t); r++)
|
|
394
|
+
e[r] = !0;
|
|
395
|
+
});
|
|
396
|
+
const l = [];
|
|
397
|
+
let s = !1;
|
|
398
|
+
return a.forEach((o, u) => {
|
|
399
|
+
e[u] ? (l.push(o), s = !1) : s || (l.push({ type: "skip", text: "⋯" }), s = !0);
|
|
400
|
+
}), l;
|
|
401
|
+
}
|
|
402
|
+
function nn(a, t) {
|
|
403
|
+
let e;
|
|
404
|
+
try {
|
|
405
|
+
e = JSON.parse(a);
|
|
406
|
+
} catch {
|
|
407
|
+
return a;
|
|
408
|
+
}
|
|
409
|
+
return e === null ? "—" : typeof e == "number" ? e.toLocaleString() : typeof e == "boolean" ? t(e ? "inventory.changelog.yes" : "inventory.changelog.no") : String(e);
|
|
410
|
+
}
|
|
411
|
+
function Ie(a, t, e = 0, l) {
|
|
412
|
+
var g;
|
|
413
|
+
const s = a.label == null ? void 0 : Je(a.label) ? t(a.label) : a.label, o = s != null || a.value != null || a.display != null, u = !((g = a.kids) != null && g.length), r = [];
|
|
414
|
+
o && r.push({
|
|
415
|
+
depth: e,
|
|
416
|
+
// A bare array index says nothing a reader needs — a leaf list entry
|
|
417
|
+
// shows just its value. Branch nodes keep the index as their header.
|
|
418
|
+
label: s != null && u && /^\d+$/.test(s) ? void 0 : s,
|
|
419
|
+
text: u ? on(a, t, l) : void 0,
|
|
420
|
+
bookkeeping: !!a.bookkeeping
|
|
421
|
+
});
|
|
422
|
+
const v = o ? e + 1 : e;
|
|
423
|
+
for (const _ of a.kids ?? [])
|
|
424
|
+
r.push(...Ie(_, t, v, l));
|
|
425
|
+
return r;
|
|
426
|
+
}
|
|
427
|
+
function on(a, t, e) {
|
|
428
|
+
if (a.value == null) return a.display || void 0;
|
|
429
|
+
const l = nn(a.value, t);
|
|
430
|
+
return (e == null ? void 0 : e(l)) ?? a.display ?? l;
|
|
431
|
+
}
|
|
432
|
+
function $e(a, t) {
|
|
433
|
+
return JSON.stringify(a, null, 2).split(`
|
|
434
|
+
`).map((e) => ({ type: t, text: e }));
|
|
435
|
+
}
|
|
436
|
+
function an() {
|
|
437
|
+
const a = xe(), t = /* @__PURE__ */ new Map(), e = L(!1), l = L(null);
|
|
438
|
+
async function s(o) {
|
|
439
|
+
const u = t.get(o.id);
|
|
440
|
+
if (u) {
|
|
441
|
+
l.value = u;
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
e.value = !0;
|
|
445
|
+
try {
|
|
446
|
+
const r = o.doc_id.indexOf("/"), v = o.doc_id.slice(0, r), g = o.doc_id.slice(r + 1), [_, $] = await Promise.all([
|
|
447
|
+
o.parent ? a.getState(v, g, o.parent) : Promise.resolve({}),
|
|
448
|
+
a.getState(v, g, o.id)
|
|
449
|
+
]), j = { diff: o.parent ? Xe(JSON.stringify(_), JSON.stringify($)) ?? [
|
|
450
|
+
...$e(_, "del"),
|
|
451
|
+
...$e($, "add")
|
|
452
|
+
] : $e($, "add"), conflict: !1 };
|
|
453
|
+
t.set(o.id, j), l.value = j;
|
|
454
|
+
} catch (r) {
|
|
455
|
+
if (!Jt(r))
|
|
456
|
+
throw l.value = null, r;
|
|
457
|
+
const v = { diff: null, conflict: !0 };
|
|
458
|
+
t.set(o.id, v), l.value = v;
|
|
459
|
+
} finally {
|
|
460
|
+
e.value = !1;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return { isLoading: e, result: l, load: s };
|
|
464
|
+
}
|
|
465
|
+
const sn = {
|
|
466
|
+
key: 0,
|
|
467
|
+
class: "flex justify-center p-16"
|
|
468
|
+
}, ln = {
|
|
469
|
+
key: 1,
|
|
470
|
+
class: "p-16 text-center text-gray-500"
|
|
471
|
+
}, rn = {
|
|
472
|
+
key: 2,
|
|
473
|
+
class: "flex h-full min-h-0 gap-8"
|
|
474
|
+
}, un = { class: "w-1/3 shrink-0 overflow-y-auto border-r border-gray-200 pr-4" }, cn = ["onClick", "onKeydown"], dn = { class: "fm-typo-en-body-md-600" }, fn = { class: "text-xs text-gray-500" }, mn = {
|
|
475
|
+
key: 0,
|
|
476
|
+
class: "flex-1 overflow-y-auto pl-4"
|
|
477
|
+
}, pn = { class: "mb-12 flex flex-col gap-2 border-b border-gray-200 pb-8" }, vn = { class: "flex flex-wrap items-center gap-8" }, gn = { class: "fm-typo-en-body-lg-600" }, yn = {
|
|
478
|
+
key: 0,
|
|
479
|
+
class: "rounded-full bg-gray-100 px-8 text-xs text-gray-500"
|
|
480
|
+
}, hn = { class: "text-xs text-gray-500" }, _n = { class: "mb-12" }, xn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary pl-8" }, bn = {
|
|
481
|
+
key: 0,
|
|
482
|
+
class: "mb-12"
|
|
483
|
+
}, wn = {
|
|
484
|
+
key: 1,
|
|
485
|
+
class: "text-sm text-gray-400"
|
|
486
|
+
}, kn = {
|
|
487
|
+
key: 2,
|
|
488
|
+
class: "w-full overflow-x-auto rounded border border-gray-200 py-4 font-mono text-xs"
|
|
489
|
+
}, Sn = {
|
|
490
|
+
key: 0,
|
|
491
|
+
class: "text-xs text-gray-400"
|
|
492
|
+
}, $n = { class: "fm-typo-en-body-md-600" }, Ln = { class: "flex flex-col gap-6" }, Cn = {
|
|
493
|
+
key: 0,
|
|
494
|
+
class: "text-gray-700"
|
|
495
|
+
}, Rn = { class: "min-w-[120px] shrink-0 text-gray-500" }, Dn = {
|
|
496
|
+
key: 0,
|
|
497
|
+
class: "flex w-full flex-col gap-4"
|
|
498
|
+
}, In = {
|
|
499
|
+
key: 0,
|
|
500
|
+
class: "w-full overflow-x-auto rounded border border-gray-200 py-4 font-mono text-xs"
|
|
501
|
+
}, Fn = { key: 0 }, En = { key: 1 }, Nn = {
|
|
502
|
+
key: 1,
|
|
503
|
+
class: "w-full overflow-x-auto rounded border border-gray-200 py-4 font-mono text-xs"
|
|
504
|
+
}, Pn = { key: 0 }, Tn = { key: 1 }, Vn = {
|
|
505
|
+
key: 1,
|
|
506
|
+
class: "w-full overflow-x-auto rounded border border-gray-200 py-4 font-mono text-xs"
|
|
507
|
+
}, Un = {
|
|
508
|
+
key: 2,
|
|
509
|
+
class: "flex w-full flex-wrap items-baseline gap-4"
|
|
510
|
+
}, Bn = {
|
|
511
|
+
key: 0,
|
|
512
|
+
class: "rounded bg-red-50 px-4 text-red-700"
|
|
513
|
+
}, An = {
|
|
514
|
+
key: 1,
|
|
515
|
+
class: "text-gray-400"
|
|
516
|
+
}, Mn = {
|
|
517
|
+
key: 2,
|
|
518
|
+
class: "rounded bg-green-50 px-4 text-green-700"
|
|
519
|
+
}, On = {
|
|
520
|
+
key: 1,
|
|
521
|
+
class: "text-sm text-gray-500"
|
|
522
|
+
}, jn = {
|
|
523
|
+
key: 2,
|
|
524
|
+
class: "mt-16 break-all border-t border-gray-200 pt-8 font-mono text-xs text-gray-400"
|
|
525
|
+
}, Kn = { key: 0 }, zn = "capture baseline", Gn = /* @__PURE__ */ le({
|
|
526
|
+
__name: "ChangelogPanel",
|
|
527
|
+
props: {
|
|
528
|
+
commits: {},
|
|
529
|
+
isLoading: { type: Boolean },
|
|
530
|
+
resolveName: { type: Function }
|
|
531
|
+
},
|
|
532
|
+
setup(a) {
|
|
533
|
+
const t = a, { t: e } = _e(), l = L(null), s = C(
|
|
534
|
+
() => t.commits.find((c) => c.id === l.value)
|
|
535
|
+
), o = /* @__PURE__ */ new Set(["updatedAt", "createdAt", "updatedBy", "createdBy", "_rev"]), u = C(() => {
|
|
536
|
+
var x;
|
|
537
|
+
return (((x = s.value) == null ? void 0 : x.changes) ?? []).filter((F) => {
|
|
538
|
+
const { raw: q } = De(F.path);
|
|
539
|
+
return q === "@payload" || F.from == null && F.to == null ? !1 : !q.split(".").some((H) => o.has(H));
|
|
540
|
+
});
|
|
541
|
+
});
|
|
542
|
+
W(
|
|
543
|
+
() => t.commits,
|
|
544
|
+
(c) => {
|
|
545
|
+
var x;
|
|
546
|
+
c.find((F) => F.id === l.value) || (l.value = ((x = c[0]) == null ? void 0 : x.id) ?? null);
|
|
547
|
+
},
|
|
548
|
+
{ immediate: !0 }
|
|
549
|
+
);
|
|
550
|
+
const r = L(!1), { isLoading: v, result: g, load: _ } = an();
|
|
551
|
+
W([r, s], ([c, x]) => {
|
|
552
|
+
g.value = null, !(!c || !x) && _(x).catch((F) => {
|
|
553
|
+
console.error("changelog snapshot load failed", F), r.value = !1;
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
function $(c) {
|
|
557
|
+
return c ? c.slice(0, 8) : "";
|
|
558
|
+
}
|
|
559
|
+
function Y(c) {
|
|
560
|
+
return c ? new Date(c).toLocaleString() : "";
|
|
561
|
+
}
|
|
562
|
+
function j(c) {
|
|
563
|
+
if (c == null) return "";
|
|
564
|
+
let x;
|
|
565
|
+
try {
|
|
566
|
+
x = JSON.parse(c);
|
|
567
|
+
} catch {
|
|
568
|
+
return c;
|
|
569
|
+
}
|
|
570
|
+
return x === null ? "—" : typeof x == "string" ? x : typeof x == "number" ? x.toLocaleString() : typeof x == "boolean" ? e(x ? "inventory.changelog.yes" : "inventory.changelog.no") : JSON.stringify(x, null, 2);
|
|
571
|
+
}
|
|
572
|
+
function ee(c) {
|
|
573
|
+
return (c.authors || []).join(", ") || e("inventory.changelog.unknownActor");
|
|
574
|
+
}
|
|
575
|
+
function B(c) {
|
|
576
|
+
if (c.message === zn) return e("inventory.changelog.captureBaseline");
|
|
577
|
+
const x = He(c.message);
|
|
578
|
+
if (!x) return c.message || e("inventory.changelog.noMessage");
|
|
579
|
+
const F = h(x.labelKey);
|
|
580
|
+
return x.name ? e(`inventory.changelog.message.${x.verb}`, { module: F, name: x.name }) : e(`inventory.changelog.message.${x.verb}NoName`, { module: F });
|
|
581
|
+
}
|
|
582
|
+
function h(c) {
|
|
583
|
+
return Je(c) ? e(c) : c;
|
|
584
|
+
}
|
|
585
|
+
const N = (c) => /[^a-zA-Z]/.test(c);
|
|
586
|
+
function P(c, x) {
|
|
587
|
+
return c == null || x == null ? null : Xe(c, x);
|
|
588
|
+
}
|
|
589
|
+
function K(c) {
|
|
590
|
+
if (!(!c.to_value && !c.from_value))
|
|
591
|
+
return {
|
|
592
|
+
toTree: c.to_value ? Ie(c.to_value, e, 0, t.resolveName) : void 0,
|
|
593
|
+
fromTree: c.from_value ? Ie(c.from_value, e, 0, t.resolveName) : void 0
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
function re(c) {
|
|
597
|
+
return c === "add" ? "bg-green-50 text-green-700" : c === "del" ? "bg-red-50 text-red-700" : c === "skip" ? "text-gray-400" : "text-gray-600";
|
|
598
|
+
}
|
|
599
|
+
function me(c) {
|
|
600
|
+
return c.type === "skip" ? c.text : (c.type === "add" ? "+ " : c.type === "del" ? "- " : " ") + c.text;
|
|
601
|
+
}
|
|
602
|
+
const ie = C(() => {
|
|
603
|
+
const c = /* @__PURE__ */ new Map(), x = [], F = (p, m) => {
|
|
604
|
+
let R = c.get(p);
|
|
605
|
+
return R || (R = m(), c.set(p, R), x.push(R)), R;
|
|
606
|
+
}, q = () => F("@doc", () => ({ header: "", lines: [] })), H = (p, m) => {
|
|
607
|
+
var T;
|
|
608
|
+
if (p == null) return m;
|
|
609
|
+
let R;
|
|
610
|
+
try {
|
|
611
|
+
R = JSON.parse(p);
|
|
612
|
+
} catch {
|
|
613
|
+
R = p;
|
|
614
|
+
}
|
|
615
|
+
return (typeof R == "string" ? (T = t.resolveName) == null ? void 0 : T.call(t, R) : void 0) ?? m;
|
|
616
|
+
}, z = (p, m, R) => {
|
|
617
|
+
var T, M, G, X;
|
|
618
|
+
const S = K(m);
|
|
619
|
+
S ? p.lines.push({ label: R, ...S }) : m.from != null && m.to != null ? p.lines.push({
|
|
620
|
+
label: R,
|
|
621
|
+
from: m.from,
|
|
622
|
+
to: m.to,
|
|
623
|
+
diff: P(m.from, m.to),
|
|
624
|
+
fromDisplay: H(m.from, (T = m.display) == null ? void 0 : T.from),
|
|
625
|
+
toDisplay: H(m.to, (M = m.display) == null ? void 0 : M.to)
|
|
626
|
+
}) : m.to != null ? p.lines.push({ label: R, to: m.to, toDisplay: H(m.to, (G = m.display) == null ? void 0 : G.to) }) : p.lines.push({ label: R, from: m.from, fromDisplay: H(m.from, (X = m.display) == null ? void 0 : X.from) });
|
|
627
|
+
}, k = (p) => {
|
|
628
|
+
var R;
|
|
629
|
+
const m = p.element;
|
|
630
|
+
if (m) {
|
|
631
|
+
const S = F(`kit:${(m.trail ?? []).join(".")}:${m.id ?? ""}`, () => ({
|
|
632
|
+
kind: (m.trail ?? []).map(h).join(" › "),
|
|
633
|
+
header: m.name || m.id || "",
|
|
634
|
+
lines: []
|
|
635
|
+
}));
|
|
636
|
+
if ((R = p.field) != null && R.length)
|
|
637
|
+
z(S, p, p.field.map(h).join(" › "));
|
|
638
|
+
else {
|
|
639
|
+
S.badge = p.to != null ? "added" : "removed";
|
|
640
|
+
const T = K(p);
|
|
641
|
+
T && S.lines.push(T);
|
|
642
|
+
}
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
z(q(), p, (p.field ?? []).map(h).join(" › "));
|
|
646
|
+
};
|
|
647
|
+
for (const p of u.value) {
|
|
648
|
+
const { raw: m, human: R } = De(p.path);
|
|
649
|
+
if (p.kind === "create" && !m) {
|
|
650
|
+
const G = K(p);
|
|
651
|
+
q().lines.push(
|
|
652
|
+
G ? { label: e("inventory.changelog.kind.created"), ...G } : { text: e("inventory.changelog.kind.created") }
|
|
653
|
+
);
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
if (!p.path.includes(Ye) && (p.field || p.element)) {
|
|
657
|
+
k(p);
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
const S = m ? m.split(".") : [], T = R ? R.split(" › ") : [], M = S.findIndex((G, X) => X > 0 && N(G));
|
|
661
|
+
if (M > 0 && T.length === S.length) {
|
|
662
|
+
const G = T[M], X = F(S.slice(0, M + 1).join("."), () => ({
|
|
663
|
+
kind: T.slice(0, M).map(h).join(" › "),
|
|
664
|
+
header: G,
|
|
665
|
+
lines: []
|
|
666
|
+
})), ge = T.slice(M + 1).map(h).join(" › ");
|
|
667
|
+
if (ge) z(X, p, ge);
|
|
668
|
+
else if (p.from != null && p.to != null) z(X, p, G);
|
|
669
|
+
else {
|
|
670
|
+
X.badge = p.to != null ? "added" : "removed";
|
|
671
|
+
const ye = K(p);
|
|
672
|
+
ye && X.lines.push(ye);
|
|
673
|
+
}
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
z(q(), p, T.map(h).join(" › "));
|
|
677
|
+
}
|
|
678
|
+
return x;
|
|
679
|
+
});
|
|
680
|
+
return (c, x) => {
|
|
681
|
+
var H, z;
|
|
682
|
+
const F = O("FmCircularProgress"), q = O("FmSwitch");
|
|
683
|
+
return c.isLoading ? (i(), d("div", sn, [
|
|
684
|
+
I(F)
|
|
685
|
+
])) : c.commits.length ? (i(), d("div", rn, [
|
|
686
|
+
y("ol", un, [
|
|
687
|
+
(i(!0), d(A, null, Z(c.commits, (k) => (i(), d("li", {
|
|
688
|
+
key: k.id,
|
|
689
|
+
role: "button",
|
|
690
|
+
tabindex: "0",
|
|
691
|
+
class: ne([
|
|
692
|
+
"cursor-pointer border-l-2 py-8 pl-12",
|
|
693
|
+
k.id === l.value ? "border-fm-color-primary bg-fm-color-primary-50" : "border-gray-200 hover:bg-gray-50"
|
|
694
|
+
]),
|
|
695
|
+
onClick: (p) => l.value = k.id,
|
|
696
|
+
onKeydown: [
|
|
697
|
+
Be((p) => l.value = k.id, ["enter"]),
|
|
698
|
+
Be(lt((p) => l.value = k.id, ["prevent"]), ["space"])
|
|
699
|
+
]
|
|
700
|
+
}, [
|
|
701
|
+
y("div", dn, b(B(k)), 1),
|
|
702
|
+
y("div", fn, b(ee(k)) + " · " + b(Y(k.at)) + " · " + b($(k.id)), 1)
|
|
703
|
+
], 42, cn))), 128))
|
|
704
|
+
]),
|
|
705
|
+
s.value ? (i(), d("div", mn, [
|
|
706
|
+
y("div", pn, [
|
|
707
|
+
y("div", vn, [
|
|
708
|
+
y("div", gn, b(B(s.value)), 1),
|
|
709
|
+
s.value.parent ? E("", !0) : (i(), d("span", yn, b(D(e)("inventory.changelog.rootCommit")), 1))
|
|
710
|
+
]),
|
|
711
|
+
y("div", hn, b(ee(s.value)) + " · " + b(Y(s.value.at)), 1)
|
|
712
|
+
]),
|
|
713
|
+
y("div", _n, [
|
|
714
|
+
I(ze, null, {
|
|
715
|
+
default: Q(() => [
|
|
716
|
+
y("span", xn, b(D(e)("inventory.changelog.dataDiff")), 1),
|
|
717
|
+
I(q, {
|
|
718
|
+
modelValue: r.value,
|
|
719
|
+
"onUpdate:modelValue": x[0] || (x[0] = (k) => r.value = k)
|
|
720
|
+
}, null, 8, ["modelValue"])
|
|
721
|
+
]),
|
|
722
|
+
_: 1
|
|
723
|
+
})
|
|
724
|
+
]),
|
|
725
|
+
r.value ? (i(), d("div", bn, [
|
|
726
|
+
D(v) ? (i(), fe(F, { key: 0 })) : (H = D(g)) != null && H.conflict ? (i(), d("div", wn, b(D(e)("inventory.changelog.snapshotUnavailable")), 1)) : (z = D(g)) != null && z.diff ? (i(), d("div", kn, [
|
|
727
|
+
(i(!0), d(A, null, Z(D(g).diff, (k, p) => (i(), d("div", {
|
|
728
|
+
key: p,
|
|
729
|
+
class: ne(["whitespace-pre px-4", re(k.type)])
|
|
730
|
+
}, b(me(k)), 3))), 128))
|
|
731
|
+
])) : E("", !0)
|
|
732
|
+
])) : E("", !0),
|
|
733
|
+
(i(!0), d(A, null, Z(ie.value, (k, p) => (i(), d("div", {
|
|
734
|
+
key: p,
|
|
735
|
+
class: "mb-12 rounded-lg border border-gray-200 p-12"
|
|
736
|
+
}, [
|
|
737
|
+
k.kind || k.header || k.badge ? (i(), d("div", {
|
|
738
|
+
key: 0,
|
|
739
|
+
class: ne(["flex flex-wrap items-baseline gap-8", k.lines.length ? "mb-8" : ""])
|
|
740
|
+
}, [
|
|
741
|
+
k.kind ? (i(), d("span", Sn, b(k.kind), 1)) : E("", !0),
|
|
742
|
+
y("span", $n, b(k.header), 1),
|
|
743
|
+
k.badge ? (i(), d("span", {
|
|
744
|
+
key: 1,
|
|
745
|
+
class: ne(["rounded-full px-8 text-xs", k.badge === "added" ? "bg-green-100 text-green-700" : "bg-red-100 text-red-700"])
|
|
746
|
+
}, b(k.badge === "added" ? D(e)("inventory.changelog.added") : D(e)("inventory.changelog.kind.removed")), 3)) : E("", !0)
|
|
747
|
+
], 2)) : E("", !0),
|
|
748
|
+
y("ul", Ln, [
|
|
749
|
+
(i(!0), d(A, null, Z(k.lines, (m, R) => (i(), d("li", {
|
|
750
|
+
key: R,
|
|
751
|
+
class: "flex flex-wrap items-baseline gap-8 text-sm"
|
|
752
|
+
}, [
|
|
753
|
+
m.text ? (i(), d("span", Cn, b(m.text), 1)) : (i(), d(A, { key: 1 }, [
|
|
754
|
+
y("span", Rn, b(m.label), 1),
|
|
755
|
+
m.toTree || m.fromTree ? (i(), d("div", Dn, [
|
|
756
|
+
m.fromTree ? (i(), d("div", In, [
|
|
757
|
+
(i(!0), d(A, null, Z(m.fromTree, (S, T) => (i(), d("div", {
|
|
758
|
+
key: T,
|
|
759
|
+
class: ne(["flex items-baseline gap-4 px-4", S.bookkeeping ? "text-gray-400" : "text-red-700"])
|
|
760
|
+
}, [
|
|
761
|
+
(i(!0), d(A, null, Z(S.depth, (M) => (i(), d("span", {
|
|
762
|
+
key: M,
|
|
763
|
+
class: "inline-block w-16"
|
|
764
|
+
}))), 128)),
|
|
765
|
+
S.label ? (i(), d("span", Fn, [
|
|
766
|
+
oe(b(S.label), 1),
|
|
767
|
+
S.text ? (i(), d(A, { key: 0 }, [
|
|
768
|
+
oe(":")
|
|
769
|
+
], 64)) : E("", !0)
|
|
770
|
+
])) : E("", !0),
|
|
771
|
+
S.text ? (i(), d("span", En, b(S.text), 1)) : E("", !0)
|
|
772
|
+
], 2))), 128))
|
|
773
|
+
])) : E("", !0),
|
|
774
|
+
m.toTree ? (i(), d("div", Nn, [
|
|
775
|
+
(i(!0), d(A, null, Z(m.toTree, (S, T) => (i(), d("div", {
|
|
776
|
+
key: T,
|
|
777
|
+
class: ne(["flex items-baseline gap-4 px-4", S.bookkeeping ? "text-gray-400" : "text-green-700"])
|
|
778
|
+
}, [
|
|
779
|
+
(i(!0), d(A, null, Z(S.depth, (M) => (i(), d("span", {
|
|
780
|
+
key: M,
|
|
781
|
+
class: "inline-block w-16"
|
|
782
|
+
}))), 128)),
|
|
783
|
+
S.label ? (i(), d("span", Pn, [
|
|
784
|
+
oe(b(S.label), 1),
|
|
785
|
+
S.text ? (i(), d(A, { key: 0 }, [
|
|
786
|
+
oe(":")
|
|
787
|
+
], 64)) : E("", !0)
|
|
788
|
+
])) : E("", !0),
|
|
789
|
+
S.text ? (i(), d("span", Tn, b(S.text), 1)) : E("", !0)
|
|
790
|
+
], 2))), 128))
|
|
791
|
+
])) : E("", !0)
|
|
792
|
+
])) : m.diff ? (i(), d("div", Vn, [
|
|
793
|
+
(i(!0), d(A, null, Z(m.diff, (S, T) => (i(), d("div", {
|
|
794
|
+
key: T,
|
|
795
|
+
class: ne(["whitespace-pre px-4", re(S.type)])
|
|
796
|
+
}, b(me(S)), 3))), 128))
|
|
797
|
+
])) : (i(), d("span", Un, [
|
|
798
|
+
m.from != null ? (i(), d("span", Bn, b(m.fromDisplay ?? j(m.from)), 1)) : E("", !0),
|
|
799
|
+
m.from != null && m.to != null ? (i(), d("span", An, "→")) : E("", !0),
|
|
800
|
+
m.to != null ? (i(), d("span", Mn, b(m.toDisplay ?? j(m.to)), 1)) : E("", !0)
|
|
801
|
+
]))
|
|
802
|
+
], 64))
|
|
803
|
+
]))), 128))
|
|
804
|
+
])
|
|
805
|
+
]))), 128)),
|
|
806
|
+
ie.value.length ? E("", !0) : (i(), d("div", On, b(D(e)("inventory.changelog.empty")), 1)),
|
|
807
|
+
r.value ? (i(), d("div", jn, [
|
|
808
|
+
oe(b(s.value.id) + " ", 1),
|
|
809
|
+
s.value.parent ? (i(), d("span", Kn, "← " + b(s.value.parent), 1)) : E("", !0)
|
|
810
|
+
])) : E("", !0)
|
|
811
|
+
])) : E("", !0)
|
|
812
|
+
])) : (i(), d("div", ln, b(D(e)("inventory.changelog.empty")), 1));
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
}), Hn = { class: "flex flex-wrap items-center gap-16" }, Jn = { class: "fm-typo-en-heading-lg-600" }, Yn = { class: "flex h-full min-h-0 flex-col gap-12 p-16" }, Xn = { class: "flex flex-wrap items-center gap-12" }, Wn = { class: "flex shrink-0 items-center gap-8" }, qn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Zn = { class: "flex flex-wrap items-center gap-12" }, Qn = {
|
|
816
|
+
key: 0,
|
|
817
|
+
class: "fm-typo-en-body-md-600"
|
|
818
|
+
}, eo = { class: "fm-typo-en-heading-md-600" }, Le = "inventory.changelog.label.", to = /* @__PURE__ */ le({
|
|
819
|
+
__name: "ChangelogDialog",
|
|
820
|
+
props: {
|
|
821
|
+
modelValue: { type: Boolean }
|
|
822
|
+
},
|
|
823
|
+
emits: ["update:modelValue"],
|
|
824
|
+
setup(a, { emit: t }) {
|
|
825
|
+
const e = a, l = t, s = C({
|
|
826
|
+
get: () => e.modelValue,
|
|
827
|
+
set: (n) => l("update:modelValue", n)
|
|
828
|
+
}), { t: o } = _e(), u = ve(), r = je(), v = Oe(), g = xe(), { breakpoints: _ } = wt(), $ = C(() => _.value.xs || _.value.sm), Y = C(() => $.value ? "98vw" : "72vw"), { commits: j, isLoading: ee, load: B } = Yt();
|
|
829
|
+
function h(n) {
|
|
830
|
+
return n ? new Date(n).toLocaleString() : "—";
|
|
831
|
+
}
|
|
832
|
+
function N(n) {
|
|
833
|
+
return [...n].sort((f, w) => (w.lastUpdate ?? "").localeCompare(f.lastUpdate ?? ""));
|
|
834
|
+
}
|
|
835
|
+
function P(n, f, w) {
|
|
836
|
+
B(n, f, w).catch((V) => console.error("changelog load failed", V));
|
|
837
|
+
}
|
|
838
|
+
const K = L([]);
|
|
839
|
+
async function re() {
|
|
840
|
+
var f;
|
|
841
|
+
const n = (f = u.currentBusiness.value) == null ? void 0 : f._id;
|
|
842
|
+
if (n)
|
|
843
|
+
try {
|
|
844
|
+
K.value = await g.listDomains(n);
|
|
845
|
+
} catch (w) {
|
|
846
|
+
console.error("changelog domain list load failed", w), K.value = [];
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const me = C(() => [
|
|
850
|
+
{ label: o("inventory.changelog.label.purchaseOrder"), value: "purchaseOrder" },
|
|
851
|
+
{ label: o("inventory.changelog.label.closingDraft"), value: "closingDraft" },
|
|
852
|
+
{ label: o("inventory.changelog.domainInventory"), value: "inventory" },
|
|
853
|
+
...K.value.map((n) => ({ label: o(n.labelKey), value: n.domain }))
|
|
854
|
+
]), ie = L(me.value[0]), c = C(() => {
|
|
855
|
+
var n;
|
|
856
|
+
return ((n = ie.value) == null ? void 0 : n.value) ?? "purchaseOrder";
|
|
857
|
+
}), x = C(
|
|
858
|
+
() => K.value.some((n) => n.domain === c.value)
|
|
859
|
+
), F = L(!1), q = C(
|
|
860
|
+
() => ["sku", "recipe", "unit"].map((n) => ({
|
|
861
|
+
label: o(Le + n),
|
|
862
|
+
value: n
|
|
863
|
+
}))
|
|
864
|
+
), H = L(q.value[0]), z = C(() => {
|
|
865
|
+
var n;
|
|
866
|
+
return ((n = H.value) == null ? void 0 : n.value) ?? "sku";
|
|
867
|
+
}), k = L(""), p = L(null), m = L(!1), R = C(() => {
|
|
868
|
+
var w;
|
|
869
|
+
const n = (w = u.currentBusiness.value) == null ? void 0 : w._id, f = r.inventory._id;
|
|
870
|
+
return n && f ? `business_${n}/${f}` : "";
|
|
871
|
+
}), S = C(() => {
|
|
872
|
+
const n = /* @__PURE__ */ new Map(), f = r.inventory;
|
|
873
|
+
for (const w of [f.sku, f.recipe, f.unit, f.skuGroup])
|
|
874
|
+
for (const V of w ?? [])
|
|
875
|
+
V._id && V.name && n.set(V._id, V.name);
|
|
876
|
+
for (const w of f.unit ?? [])
|
|
877
|
+
for (const V of w.measurements ?? []) {
|
|
878
|
+
if (!V.id) continue;
|
|
879
|
+
const J = V.abbrev || V.name;
|
|
880
|
+
if (!J) continue;
|
|
881
|
+
const te = $t.toDouble(V.conversion);
|
|
882
|
+
n.set(V.id, te ? `${J} (1 ${J} = ${te} ${w.abbrev})` : J);
|
|
883
|
+
}
|
|
884
|
+
return n;
|
|
885
|
+
}), T = (n) => S.value.get(n), M = L([]), G = L(!1);
|
|
886
|
+
async function X() {
|
|
887
|
+
var f;
|
|
888
|
+
const n = (f = u.currentBusiness.value) == null ? void 0 : f._id;
|
|
889
|
+
if (n) {
|
|
890
|
+
G.value = !0;
|
|
891
|
+
try {
|
|
892
|
+
M.value = N(
|
|
893
|
+
await g.listInventory(n, z.value)
|
|
894
|
+
);
|
|
895
|
+
} catch (w) {
|
|
896
|
+
console.error("changelog inventory list load failed", w), M.value = [];
|
|
897
|
+
} finally {
|
|
898
|
+
G.value = !1;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
const ge = C(
|
|
903
|
+
() => m.value ? M.value : M.value.filter((n) => !n.deleted)
|
|
904
|
+
), ye = C(() => [
|
|
905
|
+
{ accessorKey: "id", header: () => o("inventory.closing.draft.table.id"), size: 320 },
|
|
906
|
+
{
|
|
907
|
+
id: "name",
|
|
908
|
+
header: () => o("inventory.common.name"),
|
|
909
|
+
accessorFn: (n) => n.name,
|
|
910
|
+
// Deleted records sit in the same list as live ones, so the row says which
|
|
911
|
+
// it is; nothing else distinguishes them.
|
|
912
|
+
cell: ({ row: n }) => n.original.deleted ? rt(
|
|
913
|
+
"span",
|
|
914
|
+
{ "data-deleted": "" },
|
|
915
|
+
`${n.original.name} (${o("inventory.changelog.deleted")})`
|
|
916
|
+
) : n.original.name
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
id: "lastUpdate",
|
|
920
|
+
header: () => o("inventory.changelog.column.lastUpdate"),
|
|
921
|
+
size: 200,
|
|
922
|
+
// Raw ISO is the sort key — clicking the header on formatted dates would
|
|
923
|
+
// order them lexicographically by locale string. Formatted only to display.
|
|
924
|
+
accessorFn: (n) => n.lastUpdate ?? "",
|
|
925
|
+
cell: ({ getValue: n }) => h(n() || void 0)
|
|
926
|
+
}
|
|
927
|
+
]), { commits: We, load: qe } = Wt();
|
|
928
|
+
function Ze(n) {
|
|
929
|
+
p.value = n, F.value = !0, P(R.value, Ge, Re), n.id && qe(`${R.value}/${z.value}/${n.id}`).catch(
|
|
930
|
+
(f) => console.error("changelog per-entity load failed", f)
|
|
931
|
+
);
|
|
932
|
+
}
|
|
933
|
+
function Qe(n, f) {
|
|
934
|
+
const w = He(n.message);
|
|
935
|
+
return w && w.labelKey === Le + z.value && w.name === f.name ? !0 : (n.changes ?? []).some((V) => {
|
|
936
|
+
const J = Qt(V.path);
|
|
937
|
+
return J.type === Le + z.value && J.name === f.name;
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
const et = C(() => {
|
|
941
|
+
const n = p.value;
|
|
942
|
+
if (!n) return [];
|
|
943
|
+
const f = j.value.filter((w) => Qe(w, n));
|
|
944
|
+
return Xt(f, We.value);
|
|
945
|
+
}), be = L([]), we = L(!1), ke = L(null);
|
|
946
|
+
async function tt() {
|
|
947
|
+
var f;
|
|
948
|
+
const n = (f = u.currentBusiness.value) == null ? void 0 : f._id;
|
|
949
|
+
if (n) {
|
|
950
|
+
we.value = !0;
|
|
951
|
+
try {
|
|
952
|
+
be.value = N(
|
|
953
|
+
await g.listDomainRecords(n, c.value)
|
|
954
|
+
);
|
|
955
|
+
} catch (w) {
|
|
956
|
+
console.error("changelog domain records load failed", w), be.value = [];
|
|
957
|
+
} finally {
|
|
958
|
+
we.value = !1;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
function nt(n) {
|
|
963
|
+
var w;
|
|
964
|
+
const f = (w = u.currentBusiness.value) == null ? void 0 : w._id;
|
|
965
|
+
f && (ke.value = n, F.value = !0, P(`business_${f}/${n.id}`, void 0, Ce));
|
|
966
|
+
}
|
|
967
|
+
const pe = L(kt()), he = L([]), Se = L(!1), ue = L(null), Ne = C(() => {
|
|
968
|
+
const n = v._currentLocation;
|
|
969
|
+
return n ? `${n.name} (${n.doc.profile.code ?? "--"})` : "";
|
|
970
|
+
}), Pe = C(() => [
|
|
971
|
+
{ accessorKey: "id", header: () => o("inventory.closing.draft.table.id"), size: 320 },
|
|
972
|
+
{
|
|
973
|
+
accessorKey: "name",
|
|
974
|
+
header: () => c.value === "purchaseOrder" ? o("inventory.changelog.column.seq") : o("inventory.common.name"),
|
|
975
|
+
size: 240
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
id: "lastUpdate",
|
|
979
|
+
header: () => o("inventory.changelog.column.lastUpdate"),
|
|
980
|
+
size: 200,
|
|
981
|
+
// Raw ISO is the sort key; see the note on the inventory table.
|
|
982
|
+
accessorFn: (n) => n.lastUpdate ?? "",
|
|
983
|
+
cell: ({ getValue: n }) => h(n() || void 0)
|
|
984
|
+
}
|
|
985
|
+
]);
|
|
986
|
+
async function Te() {
|
|
987
|
+
var V;
|
|
988
|
+
const n = (V = v._currentLocation) == null ? void 0 : V.dbName;
|
|
989
|
+
if (!n) return;
|
|
990
|
+
const f = Lt(new Date(pe.value.startDate)).toISOString(), w = Ct(new Date(pe.value.endDate)).toISOString();
|
|
991
|
+
Se.value = !0;
|
|
992
|
+
try {
|
|
993
|
+
he.value = N(
|
|
994
|
+
c.value === "purchaseOrder" ? await g.listPurchaseOrders(n, f, w) : await g.listClosingDrafts(n, f, w)
|
|
995
|
+
);
|
|
996
|
+
} catch (J) {
|
|
997
|
+
console.error("changelog location list load failed", J), he.value = [];
|
|
998
|
+
} finally {
|
|
999
|
+
Se.value = !1;
|
|
1000
|
+
}
|
|
1001
|
+
ue.value && !he.value.find((J) => {
|
|
1002
|
+
var te;
|
|
1003
|
+
return J.id === ((te = ue.value) == null ? void 0 : te.id);
|
|
1004
|
+
}) && (ue.value = null, P(""));
|
|
1005
|
+
}
|
|
1006
|
+
function ot(n) {
|
|
1007
|
+
ue.value = n, F.value = !0, P(`${v.currentLocationDBName}/${n.id}`, void 0, Ce);
|
|
1008
|
+
}
|
|
1009
|
+
const at = C(() => {
|
|
1010
|
+
var n, f, w;
|
|
1011
|
+
return c.value === "inventory" ? ((n = p.value) == null ? void 0 : n.name) ?? "" : x.value ? ((f = ke.value) == null ? void 0 : f.name) ?? "" : ((w = ue.value) == null ? void 0 : w.name) ?? "";
|
|
1012
|
+
});
|
|
1013
|
+
function Ve() {
|
|
1014
|
+
F.value = !1, c.value === "inventory" ? (p.value = null, m.value = !1, P(""), X().catch(
|
|
1015
|
+
(n) => console.error("changelog inventory list failed", n)
|
|
1016
|
+
)) : x.value ? (ke.value = null, P(""), tt().catch(
|
|
1017
|
+
(n) => console.error("changelog domain records failed", n)
|
|
1018
|
+
)) : (ue.value = null, P(""), Te().catch((n) => console.error("changelog location list failed", n)));
|
|
1019
|
+
}
|
|
1020
|
+
return W(s, (n) => {
|
|
1021
|
+
n && (re().catch((f) => console.error("changelog domain list failed", f)), Ve());
|
|
1022
|
+
}), W(c, () => {
|
|
1023
|
+
s.value && Ve();
|
|
1024
|
+
}), W(pe, () => {
|
|
1025
|
+
s.value && c.value !== "inventory" && !x.value && Te().catch((n) => console.error("changelog location list failed", n));
|
|
1026
|
+
}), W(m, (n) => {
|
|
1027
|
+
var f;
|
|
1028
|
+
!n && ((f = p.value) != null && f.deleted) && (p.value = null, F.value = !1);
|
|
1029
|
+
}), W(z, () => {
|
|
1030
|
+
p.value = null, F.value = !1, s.value && c.value === "inventory" && X().catch(
|
|
1031
|
+
(n) => console.error("changelog inventory list failed", n)
|
|
1032
|
+
);
|
|
1033
|
+
}), W(R, (n) => {
|
|
1034
|
+
p.value = null, s.value && c.value === "inventory" && P(n, void 0, Re);
|
|
1035
|
+
}), (n, f) => {
|
|
1036
|
+
const w = O("FmButtonGroup"), V = O("FmSearch"), J = O("FmSwitch"), te = O("FmTable"), Ue = O("FmDialog");
|
|
1037
|
+
return i(), d(A, null, [
|
|
1038
|
+
I(Ue, {
|
|
1039
|
+
modelValue: s.value,
|
|
1040
|
+
"onUpdate:modelValue": f[8] || (f[8] = (U) => s.value = U),
|
|
1041
|
+
"close-button": "",
|
|
1042
|
+
"dismiss-away": "",
|
|
1043
|
+
"min-width": "98vw",
|
|
1044
|
+
"max-width": "98vw",
|
|
1045
|
+
"max-height": "94vh",
|
|
1046
|
+
"content-class": "!p-0 h-[86vh]"
|
|
1047
|
+
}, {
|
|
1048
|
+
"dialog-header": Q(() => [
|
|
1049
|
+
y("div", Hn, [
|
|
1050
|
+
y("div", Jn, b(D(o)("inventory.changelog.title")), 1),
|
|
1051
|
+
I(w, {
|
|
1052
|
+
modelValue: ie.value,
|
|
1053
|
+
"onUpdate:modelValue": f[0] || (f[0] = (U) => ie.value = U),
|
|
1054
|
+
items: me.value
|
|
1055
|
+
}, null, 8, ["modelValue", "items"])
|
|
1056
|
+
])
|
|
1057
|
+
]),
|
|
1058
|
+
default: Q(() => [
|
|
1059
|
+
y("div", Yn, [
|
|
1060
|
+
c.value === "inventory" ? (i(), d(A, { key: 0 }, [
|
|
1061
|
+
y("div", Xn, [
|
|
1062
|
+
I(w, {
|
|
1063
|
+
modelValue: H.value,
|
|
1064
|
+
"onUpdate:modelValue": f[1] || (f[1] = (U) => H.value = U),
|
|
1065
|
+
items: q.value
|
|
1066
|
+
}, null, 8, ["modelValue", "items"]),
|
|
1067
|
+
I(V, {
|
|
1068
|
+
modelValue: k.value,
|
|
1069
|
+
"onUpdate:modelValue": f[2] || (f[2] = (U) => k.value = U),
|
|
1070
|
+
class: "flex-1",
|
|
1071
|
+
placeholder: D(o)("inventory.changelog.searchInventory")
|
|
1072
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
1073
|
+
y("div", Wn, [
|
|
1074
|
+
y("span", qn, b(D(o)("inventory.changelog.includeDeleted")), 1),
|
|
1075
|
+
I(J, {
|
|
1076
|
+
modelValue: m.value,
|
|
1077
|
+
"onUpdate:modelValue": f[3] || (f[3] = (U) => m.value = U)
|
|
1078
|
+
}, null, 8, ["modelValue"])
|
|
1079
|
+
])
|
|
1080
|
+
]),
|
|
1081
|
+
I(te, {
|
|
1082
|
+
class: "min-h-0 flex-1",
|
|
1083
|
+
"row-data": ge.value,
|
|
1084
|
+
"column-defs": ye.value,
|
|
1085
|
+
"search-value": k.value,
|
|
1086
|
+
loading: G.value,
|
|
1087
|
+
"page-size": 20,
|
|
1088
|
+
onRowClick: f[4] || (f[4] = (U) => Ze(U.original))
|
|
1089
|
+
}, null, 8, ["row-data", "column-defs", "search-value", "loading"])
|
|
1090
|
+
], 64)) : x.value ? (i(), fe(te, {
|
|
1091
|
+
key: 1,
|
|
1092
|
+
class: "min-h-0 flex-1",
|
|
1093
|
+
"row-data": be.value,
|
|
1094
|
+
"column-defs": Pe.value,
|
|
1095
|
+
loading: we.value,
|
|
1096
|
+
"page-size": 20,
|
|
1097
|
+
onRowClick: f[5] || (f[5] = (U) => nt(U.original))
|
|
1098
|
+
}, null, 8, ["row-data", "column-defs", "loading"])) : (i(), d(A, { key: 2 }, [
|
|
1099
|
+
y("div", Zn, [
|
|
1100
|
+
I(St, {
|
|
1101
|
+
modelValue: pe.value,
|
|
1102
|
+
"onUpdate:modelValue": f[6] || (f[6] = (U) => pe.value = U)
|
|
1103
|
+
}, null, 8, ["modelValue"]),
|
|
1104
|
+
Ne.value ? (i(), d("span", Qn, b(Ne.value), 1)) : E("", !0)
|
|
1105
|
+
]),
|
|
1106
|
+
I(te, {
|
|
1107
|
+
class: "min-h-0 flex-1",
|
|
1108
|
+
"row-data": he.value,
|
|
1109
|
+
"column-defs": Pe.value,
|
|
1110
|
+
loading: Se.value,
|
|
1111
|
+
"page-size": 20,
|
|
1112
|
+
onRowClick: f[7] || (f[7] = (U) => ot(U.original))
|
|
1113
|
+
}, null, 8, ["row-data", "column-defs", "loading"])
|
|
1114
|
+
], 64))
|
|
1115
|
+
])
|
|
1116
|
+
]),
|
|
1117
|
+
_: 1
|
|
1118
|
+
}, 8, ["modelValue"]),
|
|
1119
|
+
I(Ue, {
|
|
1120
|
+
modelValue: F.value,
|
|
1121
|
+
"onUpdate:modelValue": f[9] || (f[9] = (U) => F.value = U),
|
|
1122
|
+
"close-button": "",
|
|
1123
|
+
"dismiss-away": "",
|
|
1124
|
+
"min-width": Y.value,
|
|
1125
|
+
"max-width": Y.value,
|
|
1126
|
+
"max-height": "86vh"
|
|
1127
|
+
}, {
|
|
1128
|
+
"dialog-header": Q(() => [
|
|
1129
|
+
y("div", eo, b(at.value), 1)
|
|
1130
|
+
]),
|
|
1131
|
+
default: Q(() => [
|
|
1132
|
+
I(Gn, {
|
|
1133
|
+
commits: c.value === "inventory" ? et.value : D(j),
|
|
1134
|
+
"is-loading": D(ee),
|
|
1135
|
+
"resolve-name": T
|
|
1136
|
+
}, null, 8, ["commits", "is-loading"])
|
|
1137
|
+
]),
|
|
1138
|
+
_: 1
|
|
1139
|
+
}, 8, ["modelValue", "min-width", "max-width"])
|
|
1140
|
+
], 64);
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
}), no = /* @__PURE__ */ Rt(to, [["__scopeId", "data-v-e2abfb87"]]), oo = ["title"], de = 48, ae = 8, ao = /* @__PURE__ */ le({
|
|
1144
|
+
__name: "ChangelogFloatingButton",
|
|
1145
|
+
setup(a) {
|
|
1146
|
+
const { t } = _e(), e = ve(), l = C(() => {
|
|
1147
|
+
var h;
|
|
1148
|
+
return !!((h = e.sessionUser.value) != null && h.role.isAdmin);
|
|
1149
|
+
}), s = L(!1), o = L({ x: 0, y: 0 });
|
|
1150
|
+
function u(h, N, P) {
|
|
1151
|
+
return Math.min(Math.max(h, N), P);
|
|
1152
|
+
}
|
|
1153
|
+
function r() {
|
|
1154
|
+
const h = Math.max(ae, window.innerWidth - de - ae), N = Math.max(ae, window.innerHeight - de - ae), P = o.value.x + de / 2;
|
|
1155
|
+
o.value = {
|
|
1156
|
+
x: P < window.innerWidth / 2 ? ae : h,
|
|
1157
|
+
y: u(o.value.y, ae, N)
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
function v() {
|
|
1161
|
+
o.value = { x: window.innerWidth - de - ae, y: Math.round(window.innerHeight / 2) };
|
|
1162
|
+
}
|
|
1163
|
+
Fe(() => {
|
|
1164
|
+
v(), window.addEventListener("resize", r), window.addEventListener("orientationchange", r);
|
|
1165
|
+
}), it(() => {
|
|
1166
|
+
window.removeEventListener("resize", r), window.removeEventListener("orientationchange", r);
|
|
1167
|
+
});
|
|
1168
|
+
const g = L(!1);
|
|
1169
|
+
let _ = null, $ = !1;
|
|
1170
|
+
function Y(h) {
|
|
1171
|
+
_ = { x: h.clientX, y: h.clientY, px: o.value.x, py: o.value.y }, g.value = !0, $ = !1, h.currentTarget.setPointerCapture(h.pointerId);
|
|
1172
|
+
}
|
|
1173
|
+
function j(h) {
|
|
1174
|
+
if (!_) return;
|
|
1175
|
+
const N = h.clientX - _.x, P = h.clientY - _.y;
|
|
1176
|
+
Math.abs(N) + Math.abs(P) > 3 && ($ = !0), o.value = {
|
|
1177
|
+
x: u(_.px + N, 0, window.innerWidth - de),
|
|
1178
|
+
y: u(_.py + P, 0, window.innerHeight - de)
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
function ee() {
|
|
1182
|
+
_ = null, g.value = !1, r();
|
|
1183
|
+
}
|
|
1184
|
+
function B() {
|
|
1185
|
+
_ && (ee(), $ || (s.value = !0));
|
|
1186
|
+
}
|
|
1187
|
+
return (h, N) => {
|
|
1188
|
+
const P = O("FmIcon");
|
|
1189
|
+
return i(), fe(ut, { to: "body" }, [
|
|
1190
|
+
l.value ? (i(), d(A, { key: 0 }, [
|
|
1191
|
+
y("button", {
|
|
1192
|
+
type: "button",
|
|
1193
|
+
title: D(t)("inventory.changelog.title"),
|
|
1194
|
+
class: ne([
|
|
1195
|
+
"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",
|
|
1196
|
+
g.value ? "cursor-grabbing" : "cursor-grab transition-[left,top] duration-200 ease-out"
|
|
1197
|
+
]),
|
|
1198
|
+
style: ct({ left: `${o.value.x}px`, top: `${o.value.y}px` }),
|
|
1199
|
+
onPointerdown: Y,
|
|
1200
|
+
onPointermove: j,
|
|
1201
|
+
onPointerup: B,
|
|
1202
|
+
onPointercancel: ee
|
|
1203
|
+
}, [
|
|
1204
|
+
I(P, {
|
|
1205
|
+
name: "history",
|
|
1206
|
+
size: "md",
|
|
1207
|
+
outline: ""
|
|
1208
|
+
})
|
|
1209
|
+
], 46, oo),
|
|
1210
|
+
I(no, {
|
|
1211
|
+
modelValue: s.value,
|
|
1212
|
+
"onUpdate:modelValue": N[0] || (N[0] = (K) => s.value = K)
|
|
1213
|
+
}, null, 8, ["modelValue"])
|
|
1214
|
+
], 64)) : E("", !0)
|
|
1215
|
+
]);
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
}), so = { class: "flex items-center gap-2" }, lo = { class: "text-xs text-gray-400 font-normal" }, ro = { class: "flex flex-col gap-3" }, io = { class: "max-h-[480px] flex flex-col gap-1" }, uo = { class: "font-mono text-xs text-gray-700 break-all min-w-0" }, co = {
|
|
1219
|
+
key: 0,
|
|
1220
|
+
class: "inline-flex items-center gap-1 text-xs font-medium text-green-700 bg-green-50 px-2 py-0.5 rounded-full"
|
|
1221
|
+
}, fo = {
|
|
1222
|
+
key: 1,
|
|
1223
|
+
class: "inline-flex items-center gap-1 text-xs font-medium text-red-700 bg-red-50 px-2 py-0.5 rounded-full"
|
|
1224
|
+
}, mo = {
|
|
1225
|
+
key: 2,
|
|
1226
|
+
class: "inline-flex items-center gap-1 text-xs font-medium text-gray-500 bg-gray-100 px-2 py-0.5 rounded-full"
|
|
1227
|
+
}, po = {
|
|
1228
|
+
key: 0,
|
|
1229
|
+
class: "text-center text-sm text-gray-400 py-4"
|
|
1230
|
+
}, vo = /* @__PURE__ */ le({
|
|
1231
|
+
__name: "FmFeatureFlagDialog",
|
|
1232
|
+
setup(a) {
|
|
1233
|
+
const t = L(!1), e = L(""), l = C(() => {
|
|
1234
|
+
const { getFlagValue: u } = _t();
|
|
1235
|
+
return Object.values(xt).map((r) => {
|
|
1236
|
+
const v = u(r, (g) => g === "true");
|
|
1237
|
+
return {
|
|
1238
|
+
name: r,
|
|
1239
|
+
enabled: v
|
|
1240
|
+
};
|
|
1241
|
+
});
|
|
1242
|
+
}), s = C(() => {
|
|
1243
|
+
const u = e.value.toLowerCase();
|
|
1244
|
+
return u ? l.value.filter((r) => r.name.toLowerCase().includes(u)) : l.value;
|
|
1245
|
+
}), o = C(() => {
|
|
1246
|
+
const u = l.value.filter((g) => g.enabled === !0).length, r = l.value.filter((g) => g.enabled === !1).length, v = l.value.filter((g) => g.enabled === null).length;
|
|
1247
|
+
return { enabled: u, disabled: r, unknown: v, total: l.value.length };
|
|
1248
|
+
});
|
|
1249
|
+
return (u, r) => {
|
|
1250
|
+
const v = O("FmButton"), g = O("FmSpacer"), _ = O("FmDialog");
|
|
1251
|
+
return i(), fe(_, {
|
|
1252
|
+
modelValue: t.value,
|
|
1253
|
+
"onUpdate:modelValue": r[2] || (r[2] = ($) => t.value = $),
|
|
1254
|
+
overlay: !0
|
|
1255
|
+
}, {
|
|
1256
|
+
"dialog-button": Q(() => [
|
|
1257
|
+
I(ze, null, {
|
|
1258
|
+
default: Q(() => [
|
|
1259
|
+
I(v, {
|
|
1260
|
+
variant: "secondary",
|
|
1261
|
+
label: "Feature flags"
|
|
1262
|
+
})
|
|
1263
|
+
]),
|
|
1264
|
+
_: 1
|
|
1265
|
+
})
|
|
1266
|
+
]),
|
|
1267
|
+
"dialog-header": Q(() => [
|
|
1268
|
+
y("div", so, [
|
|
1269
|
+
r[3] || (r[3] = y("span", null, "Feature Flags", -1)),
|
|
1270
|
+
y("span", lo, b(o.value.enabled) + " enabled · " + b(o.value.disabled) + " disabled · " + b(o.value.unknown) + " unknown ", 1)
|
|
1271
|
+
])
|
|
1272
|
+
]),
|
|
1273
|
+
"dialog-footer": Q(() => [
|
|
1274
|
+
I(g, { class: "sm:hidden xs:hidden" }),
|
|
1275
|
+
I(v, {
|
|
1276
|
+
class: "sm:w-full xs:w-full",
|
|
1277
|
+
label: "Close",
|
|
1278
|
+
size: "md",
|
|
1279
|
+
variant: "primary",
|
|
1280
|
+
onClick: r[1] || (r[1] = ($) => t.value = !1)
|
|
1281
|
+
})
|
|
1282
|
+
]),
|
|
1283
|
+
default: Q(() => [
|
|
1284
|
+
y("div", ro, [
|
|
1285
|
+
dt(y("input", {
|
|
1286
|
+
"onUpdate:modelValue": r[0] || (r[0] = ($) => e.value = $),
|
|
1287
|
+
type: "text",
|
|
1288
|
+
placeholder: "Search flags...",
|
|
1289
|
+
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"
|
|
1290
|
+
}, null, 512), [
|
|
1291
|
+
[ft, e.value]
|
|
1292
|
+
]),
|
|
1293
|
+
y("div", io, [
|
|
1294
|
+
(i(!0), d(A, null, Z(s.value, ($) => (i(), d("div", {
|
|
1295
|
+
key: $.name,
|
|
1296
|
+
class: "flex items-start justify-between gap-2 px-3 py-2 rounded-md hover:bg-gray-50 text-sm"
|
|
1297
|
+
}, [
|
|
1298
|
+
y("span", uo, b($.name), 1),
|
|
1299
|
+
$.enabled === !0 ? (i(), d("span", co, r[4] || (r[4] = [
|
|
1300
|
+
y("span", { class: "w-1.5 h-1.5 rounded-full bg-green-500" }, null, -1),
|
|
1301
|
+
oe(" Enabled ")
|
|
1302
|
+
]))) : $.enabled === !1 ? (i(), d("span", fo, r[5] || (r[5] = [
|
|
1303
|
+
y("span", { class: "w-1.5 h-1.5 rounded-full bg-red-500" }, null, -1),
|
|
1304
|
+
oe(" Disabled ")
|
|
1305
|
+
]))) : (i(), d("span", mo, r[6] || (r[6] = [
|
|
1306
|
+
y("span", { class: "w-1.5 h-1.5 rounded-full bg-gray-400" }, null, -1),
|
|
1307
|
+
oe(" Unknown ")
|
|
1308
|
+
])))
|
|
1309
|
+
]))), 128)),
|
|
1310
|
+
s.value.length === 0 ? (i(), d("div", po, ' No flags matching "' + b(e.value) + '" ', 1)) : E("", !0)
|
|
1311
|
+
])
|
|
1312
|
+
])
|
|
1313
|
+
]),
|
|
1314
|
+
_: 1
|
|
1315
|
+
}, 8, ["modelValue"]);
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
}), go = { class: "h-full flex flex-col overflow-auto py-16 gap-2" }, yo = /* @__PURE__ */ le({
|
|
1319
|
+
__name: "NavigationTab",
|
|
1320
|
+
setup(a) {
|
|
1321
|
+
const t = yt(), e = Ee(), l = ve(), s = Dt(), { menuItems: o } = Ke();
|
|
1322
|
+
W([() => l.currentBusiness.value, () => t.name], ([_, $]) => {
|
|
1323
|
+
(_ == null ? void 0 : _.menuVersion) === "v3" && ($ === se.INGREDIENTS || $ === se.RECIPE || $ === se.UNIT) && e.push({ name: se.STOCK });
|
|
1324
|
+
});
|
|
1325
|
+
const u = C({
|
|
1326
|
+
get() {
|
|
1327
|
+
if (t.name)
|
|
1328
|
+
return String(t.name);
|
|
1329
|
+
},
|
|
1330
|
+
set(_) {
|
|
1331
|
+
_ && e.push({ name: _ });
|
|
1332
|
+
}
|
|
1333
|
+
}), r = C(
|
|
1334
|
+
() => {
|
|
1335
|
+
var _;
|
|
1336
|
+
return `NavigationTab.${(_ = l.currentBusiness.value) == null ? void 0 : _._id}`;
|
|
1337
|
+
}
|
|
1338
|
+
), v = L(!1), g = C({
|
|
1339
|
+
get() {
|
|
1340
|
+
return v.value;
|
|
1341
|
+
},
|
|
1342
|
+
set(_) {
|
|
1343
|
+
v.value = _, _ || s.setItem(r.value, "true");
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
return W([() => r.value], () => {
|
|
1347
|
+
v.value = !1, setTimeout(() => {
|
|
1348
|
+
g.value = !s.getItem(r.value);
|
|
1349
|
+
}, 2e3);
|
|
1350
|
+
}), (_, $) => {
|
|
1351
|
+
const Y = O("FmCollapsibleTabs");
|
|
1352
|
+
return i(), d("div", go, [
|
|
1353
|
+
I(vo),
|
|
1354
|
+
I(Y, {
|
|
1355
|
+
modelValue: u.value,
|
|
1356
|
+
"onUpdate:modelValue": $[0] || ($[0] = (j) => u.value = j),
|
|
1357
|
+
items: D(o)
|
|
1358
|
+
}, null, 8, ["modelValue", "items"])
|
|
1359
|
+
]);
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
typeof Promise.withResolvers > "u" && (Promise.withResolvers = () => {
|
|
1364
|
+
let a, t;
|
|
1365
|
+
return { promise: new Promise((l, s) => {
|
|
1366
|
+
a = l, t = s;
|
|
1367
|
+
}), resolve: a, reject: t };
|
|
1368
|
+
});
|
|
1369
|
+
typeof Promise.prototype.delayed > "u" && (Promise.prototype.delayed = async function(a) {
|
|
1370
|
+
return await new Promise((t) => setTimeout(t, a)), Promise.resolve(this);
|
|
1371
|
+
});
|
|
1372
|
+
const Po = /* @__PURE__ */ le({
|
|
1373
|
+
__name: "App",
|
|
1374
|
+
setup(a) {
|
|
1375
|
+
const t = ve(), e = It(), l = gt(), s = window.location.href.includes("print-preview");
|
|
1376
|
+
Fe(() => {
|
|
1377
|
+
if (window.location.href.includes("print-preview")) {
|
|
1378
|
+
t.setEmbedded(!0), document.body.classList.add("print-mode");
|
|
1379
|
+
return;
|
|
1380
|
+
}
|
|
1381
|
+
t.registerSidebarComponent(yo), e.initGoogleMap(l.appApi.googleMap).catch(() => {
|
|
1382
|
+
console.error("Google map cannot be loaded");
|
|
1383
|
+
});
|
|
1384
|
+
}), W([() => t.currentCountry.value], () => {
|
|
1385
|
+
o();
|
|
1386
|
+
});
|
|
1387
|
+
async function o() {
|
|
1388
|
+
var u;
|
|
1389
|
+
try {
|
|
1390
|
+
await t.readBusinesses(), t.currentBusiness.value = (u = t.businesses.value) == null ? void 0 : u.find((r) => r);
|
|
1391
|
+
} catch (r) {
|
|
1392
|
+
console.error("error when trying to reset businesses:", r);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
return (u, r) => (i(), d(A, null, [
|
|
1396
|
+
I(Ht),
|
|
1397
|
+
D(s) ? E("", !0) : (i(), fe(ao, { key: 0 }))
|
|
1398
|
+
], 64));
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
export {
|
|
1402
|
+
Po as default
|
|
1403
|
+
};
|