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