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