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