@feedmepos/mf-inventory-portal 1.8.0-dev.7 → 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.
Files changed (105) hide show
  1. package/dist/App-C8i7vBxz.js +1466 -0
  2. package/dist/{ApprovalView-1Y_jh_UJ.js → ApprovalView-GHgTeCBV.js} +9 -9
  3. package/dist/{BindingsDialog-VMvTLguN.js → BindingsDialog-C4-S2CWk.js} +2 -2
  4. package/dist/{BindingsPicker-KNRM5rMU.js → BindingsPicker-C7YUArBj.js} +2 -2
  5. package/dist/{BindingsTable-CSyNlNCL.js → BindingsTable-1Zoqi4ZS.js} +4 -4
  6. package/dist/{BulkReceiveRequestView-vOeHbWM_.js → BulkReceiveRequestView-Lakk8011.js} +19 -19
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DQuI04Yj.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DFSg0-gv.js} +1 -1
  8. package/dist/{ClosingDraftView-A2pJuhIb.js → ClosingDraftView-CnWFyWSE.js} +20 -20
  9. package/dist/ClosingHistoryView-Bkm0voU6.js +769 -0
  10. package/dist/{ClosingTemplateView-DpkNCyoB.js → ClosingTemplateView-Bz81JTsg.js} +18 -18
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DOpIDvsy.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-6s-24euf.js} +1 -1
  12. package/dist/{DefaultView-B4UuAqYu.js → DefaultView-1RRzbPB3.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-w0YcNH3F.js → DeliveryOrderPrintPreview-KcLqjOj1.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-BimIEHsW.js → EmailDialog.vue_vue_type_script_setup_true_lang-r0Q0qhoK.js} +663 -661
  15. package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-Cwmk3NLS.js +47 -0
  16. package/dist/FeatureCapabilityGate-C6t1VwKD.js +74 -0
  17. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang--54VR4oB.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-pzIzIWpX.js} +1 -1
  18. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B7j4ZSOe.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B6cFB4vX.js} +2 -2
  19. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D_y8VcCI.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D_o6pX9i.js} +2 -2
  20. package/dist/{FmMultiselectDialog-DMA5eR0C.js → FmMultiselectDialog-CC_Na_p1.js} +2 -2
  21. package/dist/{FmMultiselectDialog-BnZInvgp.js → FmMultiselectDialog-D0GhmOQ9.js} +2 -2
  22. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BXTUsnwN.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DQlSMRoB.js} +6 -6
  23. package/dist/{ImportView-C7Hah7MM.js → ImportView-DCcdEvy4.js} +6 -6
  24. package/dist/{IngredientsView-C4-8qNGD.js → IngredientsView-B2I2OPSb.js} +518 -523
  25. package/dist/{IntegrationExplorerView-D3leld2Z.js → IntegrationExplorerView-WK1EmwLA.js} +4 -4
  26. package/dist/{IntegrationView-BhRzry3g.js → IntegrationView-CeaL92Yj.js} +15 -15
  27. package/dist/{InventoryBindingForm-ewAgZ6e-.js → InventoryBindingForm-DgtaDM0I.js} +1 -1
  28. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bpo7Yv9A.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CqDN355J.js} +5 -5
  29. package/dist/{InventoryBindingSummary-e67GzHYr.js → InventoryBindingSummary-C_W456aj.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CKEzy2Uo.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BMDjCk9T.js} +1 -1
  31. package/dist/{FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-BBkF9lOE.js → PlanTierBadge.vue_vue_type_script_setup_true_lang-BSR_nyHY.js} +71 -94
  32. package/dist/PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-D6-lo7iI.js +79 -0
  33. package/dist/{ProductionRunDetailView-Ct7kr5Ht.js → ProductionRunDetailView-C9rxLBbL.js} +4 -4
  34. package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-7u0HQH67.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-DwBY6gIb.js} +7 -7
  35. package/dist/{ProductionRunView-odWyBZGx.js → ProductionRunView-DvMdVGz1.js} +3 -3
  36. package/dist/{PublishView-BXA3k8Cp.js → PublishView-Dv-W6ntx.js} +3 -3
  37. package/dist/{PurchaseOrderPrintPreview-DRugr4BU.js → PurchaseOrderPrintPreview-D1TAnJd_.js} +2 -2
  38. package/dist/{ReceiveRequestView-CeJs9NTD.js → ReceiveRequestView-Rc_uw_Ad.js} +13 -13
  39. package/dist/{RecipeView-BH0REMB3.js → RecipeView-ByUaGc4w.js} +16 -16
  40. package/dist/SettingsView-K5wAt8oo.js +1032 -0
  41. package/dist/StockView-B3EjdjVx.js +2615 -0
  42. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Ckw1_xIc.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CsRLy0xI.js} +1 -1
  43. package/dist/{SupplierView-DH9u6e2M.js → SupplierView-CLVupRN0.js} +298 -296
  44. package/dist/{SurchargeView-BPVEpc0f.js → SurchargeView-CToB_z5v.js} +7 -7
  45. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BRwxKmwb.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CvqIw9q6.js} +2 -2
  46. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BpiePSmo.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BGPuaJlU.js} +1 -1
  47. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DOQGPKiv.js → TransferDetails.vue_vue_type_script_setup_true_lang-8ydaQEw-.js} +785 -769
  48. package/dist/{TransferTemplateView-CEVRsKL7.js → TransferTemplateView-BnfALwmw.js} +20 -20
  49. package/dist/{UnitCostHistoryView-06rIaX_M.js → UnitCostHistoryView-BMB2MeTh.js} +4 -4
  50. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-C2zidBrl.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-Dn8Y8zfp.js} +4 -4
  51. package/dist/{UnitView-Xk_F9SYG.js → UnitView-Bl8jws6R.js} +8 -8
  52. package/dist/{WarehouseView-bmpLmpcX.js → WarehouseView-BurSM1jg.js} +8 -8
  53. package/dist/{WastageTemplateView-CWV1pFxM.js → WastageTemplateView-DRfJ9LGR.js} +15 -15
  54. package/dist/api/license.d.ts +1 -0
  55. package/dist/{app-CURawLhs.js → app-Duum3eHx.js} +16 -16
  56. package/dist/app.js +1 -1
  57. package/dist/{closing-template-q_KGB4jO.js → closing-template-BE41yfue.js} +1 -1
  58. package/dist/components/FeatureCapabilityGate.spec.d.ts +1 -0
  59. package/dist/components/FeatureCapabilityGate.vue.d.ts +2 -0
  60. package/dist/{date2-3kdweNLp.js → date2-DrhO3BxU.js} +1 -1
  61. package/dist/{dayjs.min-DHE73-wM.js → dayjs.min-CQp6EpOp.js} +1 -1
  62. package/dist/{decimal-CAnQe2Ib.js → decimal-Cq0qUT4r.js} +2 -2
  63. package/dist/{defineDeepModel-CctS67Do.js → defineDeepModel-DRC39nJs.js} +1 -1
  64. package/dist/{duplicate-template-Jk2V2Ezg.js → duplicate-template-j2ymeDNH.js} +1 -1
  65. package/dist/{feature-D9n0IC0c.js → feature-C0hQza5A.js} +125 -103
  66. package/dist/feature-flags/vue.spec.d.ts +1 -0
  67. package/dist/{format-time-from-id-Bmzpbg-8.js → format-time-from-id-BmJoI3jT.js} +1 -1
  68. package/dist/{format-unit-display-CVg4Bl5L.js → format-unit-display-CRgIMXsD.js} +13 -13
  69. package/dist/{id-to-date-DPCcxufP.js → id-to-date-CuFZDvIr.js} +1 -1
  70. package/dist/{import-export.helper-bmGZwUBB.js → import-export.helper-B43zbsbj.js} +6 -6
  71. package/dist/{index-zCBA-X6R.js → index-BYDjs08n.js} +1 -1
  72. package/dist/{index-CFNNQo-7.js → index-Cwvg7EHd.js} +3 -3
  73. package/dist/{index-yt6MlAFG.js → index-DXNYZeq3.js} +1 -1
  74. package/dist/{lz-string-CqlY9MC2.js → lz-string-6DgW1cPF.js} +1 -1
  75. package/dist/{netsuite-DudeltN_.js → netsuite-BSpmyaE1.js} +2 -2
  76. package/dist/{number-BoePMDs8.js → number-5ZeFx-wN.js} +3 -3
  77. package/dist/{predefined-templates-DT32p04n.js → predefined-templates-C0jtb4T7.js} +1 -1
  78. package/dist/{purchase-order-template-LaRpWA04.js → purchase-order-template-B5Pjddfi.js} +1 -1
  79. package/dist/{recalculationUtils-BYN393eE.js → recalculationUtils-DtJWwWSj.js} +1 -1
  80. package/dist/{row-action.enum-BiP5wkT6.js → row-action.enum-BDDJNSi0.js} +1 -1
  81. package/dist/{rules-CQT0uAAo.js → rules-CinZKpvV.js} +2 -2
  82. package/dist/{stock-CVybjhUm.js → stock-1n-4iyqz.js} +3 -3
  83. package/dist/{stock-B9XerL9c.js → stock-BKMDvf5S.js} +1 -1
  84. package/dist/stores/feature.d.ts +5 -0
  85. package/dist/style.css +1 -1
  86. package/dist/{supplier-dpHijd2E.js → supplier-Cv8HRNou.js} +2 -2
  87. package/dist/{surcharge-BZ4STY5J.js → surcharge-ktE1pRyy.js} +1 -1
  88. package/dist/tsconfig.app.tsbuildinfo +1 -1
  89. package/dist/{uom-rules-Da5Lngvp.js → uom-rules-DCnXmEkb.js} +1 -1
  90. package/dist/{use-ingredient-select-dialog-C3YsT5l-.js → use-ingredient-select-dialog-CYUUVrCI.js} +2 -2
  91. package/dist/{use-inventory-binding-dialog-BSsyrcGe.js → use-inventory-binding-dialog-Dugj9i-6.js} +2 -2
  92. package/dist/{use-template-enabled-locations-BmJUzSUm.js → use-template-enabled-locations-BlZ7WAqX.js} +2 -2
  93. package/dist/{use-transfer-locations-frEk_aBH.js → use-transfer-locations-CUDFnsVH.js} +2 -2
  94. package/dist/{useHrmPermission-Cyjm0y9a.js → useHrmPermission-BOwmXi9H.js} +1 -1
  95. package/dist/{useNavigationMenu-CnTsOF9T.js → useNavigationMenu-CbNKFBwx.js} +58 -57
  96. package/dist/{useSseClient-D_7o9nuf.js → useSseClient-CdyQh47h.js} +1 -1
  97. package/dist/views/settings/PlanLicenseDisplay.spec.d.ts +1 -0
  98. package/dist/views/settings/PlanLicenseDisplay.vue.d.ts +15 -0
  99. package/dist/{vue-i18n-DwAcG7yc.js → vue-i18n-dSKy66Jh.js} +169 -169
  100. package/dist/{xlsx.util-C7S-uyqm.js → xlsx.util-pjzuMquw.js} +2 -2
  101. package/package.json +5 -5
  102. package/dist/App-Bo29Nwt0.js +0 -1537
  103. package/dist/ClosingHistoryView-woRmvmYT.js +0 -761
  104. package/dist/SettingsView-Dc27wyk-.js +0 -977
  105. package/dist/StockView-DrHLzosW.js +0 -2616
@@ -0,0 +1,1032 @@
1
+ import { defineComponent as ee, ref as _, computed as E, watch as j, resolveComponent as L, createElementBlock as i, openBlock as o, createElementVNode as l, toDisplayString as C, Fragment as A, renderList as W, createBlock as O, createCommentVNode as Z, createVNode as m, nextTick as xe, createSlots as he, withCtx as z, normalizeClass as ue, unref as S, withModifiers as ke, h as V, Teleport as we } from "vue";
2
+ import { _ as Fe } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
3
+ import { B as Y, g as Te, r as Se, s as $e, u as De, a as ae, b as Ce, c as Be, d as be, e as Ve, f as Ie } from "./predefined-templates-C0jtb4T7.js";
4
+ import { useSnackbar as Pe, components as X } from "@feedmepos/ui-library";
5
+ import { _ as ze } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
+ import { H as se, I as Oe, u as _e } from "./app-Duum3eHx.js";
7
+ import { useCoreStore as ye, useI18n as Ee } from "@feedmepos/mf-common";
8
+ import "./dayjs.min-CQp6EpOp.js";
9
+ import { a as Le, b as Ae, I as Ne, u as Ue } from "./feature-C0hQza5A.js";
10
+ import { _ as He, D as Me } from "./FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-Cwmk3NLS.js";
11
+ import { _ as Re } from "./ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DFSg0-gv.js";
12
+ import { _ as je, a as Ke } from "./PlanTierBadge.vue_vue_type_script_setup_true_lang-BSR_nyHY.js";
13
+ const qe = { class: "p-3" }, Ge = { class: "text-sm font-semibold text-gray-700 mb-4 pb-2 border-b border-gray-200" }, Ye = { class: "flex flex-col gap-3" }, We = {
14
+ key: 0,
15
+ class: "flex items-center justify-between py-1"
16
+ }, Je = { class: "text-[13px] text-gray-600" }, Qe = { class: "text-[13px] text-gray-600" }, Xe = ["value", "rows", "placeholder", "onInput"], Ze = {
17
+ key: 5,
18
+ class: "flex items-center justify-between py-1"
19
+ }, et = { class: "text-[13px] text-gray-600" }, tt = ["value", "onInput"], lt = /* @__PURE__ */ ee({
20
+ __name: "BlockConfigPanel",
21
+ props: {
22
+ block: {}
23
+ },
24
+ emits: ["update"],
25
+ setup(N, { emit: h }) {
26
+ const T = N, k = h;
27
+ function w(n) {
28
+ var g;
29
+ if ((g = n.config) != null && g.configFields && Array.isArray(n.config.configFields)) {
30
+ const f = n.config.configFields.map((d) => ({ ...d })), x = new Set(f.map((d) => d.key)), a = Y[n.tag], D = a ? a.initialConfigFields().filter((d) => !x.has(d.key)) : [];
31
+ return [...f, ...D];
32
+ }
33
+ const r = Y[n.tag];
34
+ return r ? r.initialConfigFields() : [];
35
+ }
36
+ const p = _(w(T.block)), $ = E(() => {
37
+ const n = Y[T.block.tag];
38
+ return (n == null ? void 0 : n.label) ?? T.block.tag;
39
+ });
40
+ j(
41
+ () => T.block,
42
+ (n) => {
43
+ p.value = w(n);
44
+ },
45
+ { deep: !0 }
46
+ );
47
+ function v(n, r) {
48
+ const g = p.value[n];
49
+ g && (g.value = r, y());
50
+ }
51
+ function y() {
52
+ k("update", {
53
+ ...T.block.config || {},
54
+ configFields: p.value.map((n) => ({ ...n }))
55
+ });
56
+ }
57
+ return (n, r) => {
58
+ const g = L("FmSwitch"), f = L("FmTextField"), x = L("FmSelect");
59
+ return o(), i("div", qe, [
60
+ l("div", Ge, C($.value) + " Settings ", 1),
61
+ l("div", Ye, [
62
+ (o(!0), i(A, null, W(p.value, (a, D) => (o(), i("div", {
63
+ key: a.key
64
+ }, [
65
+ a.type === "toggle" ? (o(), i("div", We, [
66
+ l("label", Je, C(a.label), 1),
67
+ m(g, {
68
+ "model-value": a.value,
69
+ "onUpdate:modelValue": (d) => v(D, d)
70
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
71
+ ])) : a.type === "text" ? (o(), O(f, {
72
+ key: 1,
73
+ label: a.label,
74
+ "model-value": a.value,
75
+ placeholder: a.placeholder,
76
+ "onUpdate:modelValue": (d) => v(D, d)
77
+ }, null, 8, ["label", "model-value", "placeholder", "onUpdate:modelValue"])) : a.type === "textarea" ? (o(), i(A, { key: 2 }, [
78
+ l("div", Qe, C(a.label), 1),
79
+ l("textarea", {
80
+ class: "w-full font-mono text-[13px] p-2 border border-gray-300 rounded resize-y box-border focus:outline-none focus:border-blue-600",
81
+ value: a.value,
82
+ rows: a.rows ?? 8,
83
+ placeholder: a.placeholder,
84
+ onInput: (d) => v(D, d.target.value)
85
+ }, null, 40, Xe)
86
+ ], 64)) : a.type === "select" ? (o(), O(x, {
87
+ key: 3,
88
+ label: a.label,
89
+ "model-value": a.value,
90
+ items: a.options || [],
91
+ "item-label": "label",
92
+ "item-value": "value",
93
+ "onUpdate:modelValue": (d) => v(D, d)
94
+ }, null, 8, ["label", "model-value", "items", "onUpdate:modelValue"])) : a.type === "number" ? (o(), O(f, {
95
+ key: 4,
96
+ label: a.label,
97
+ type: "number",
98
+ "model-value": String(a.value),
99
+ "onUpdate:modelValue": (d) => v(D, Number(d))
100
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"])) : a.type === "color" ? (o(), i("div", Ze, [
101
+ l("label", et, C(a.label), 1),
102
+ l("input", {
103
+ type: "color",
104
+ value: a.value,
105
+ class: "color-input w-9 h-7 p-0 border border-gray-300 rounded cursor-pointer bg-transparent",
106
+ onInput: (d) => v(D, d.target.value)
107
+ }, null, 40, tt)
108
+ ])) : Z("", !0)
109
+ ]))), 128))
110
+ ])
111
+ ]);
112
+ };
113
+ }
114
+ }), ot = /* @__PURE__ */ ze(lt, [["__scopeId", "data-v-840687bf"]]), at = { class: "h-full flex flex-col" }, st = { class: "flex-1 overflow-auto p-4 bg-gray-100" }, nt = /* @__PURE__ */ ee({
115
+ __name: "TemplatePreview",
116
+ props: {
117
+ blocks: {},
118
+ previewData: {},
119
+ selectedBlockId: {},
120
+ templateType: {}
121
+ },
122
+ setup(N) {
123
+ const h = N, T = _(null);
124
+ let k = null;
125
+ function w() {
126
+ return !k && T.value && (k = T.value.attachShadow({ mode: "open" })), k;
127
+ }
128
+ const p = E(() => h.previewData ?? Te(h.templateType));
129
+ j(
130
+ () => [h.blocks, p.value, T.value],
131
+ () => {
132
+ const v = w();
133
+ if (v) {
134
+ try {
135
+ const y = Se(h.blocks, p.value), n = $e(y);
136
+ v.innerHTML = `
137
+ <style>
138
+ :host { display: block; }
139
+ .preview-scale-wrapper {
140
+ transform-origin: top left;
141
+ transform: scale(0.75);
142
+ width: 133.33%;
143
+ }
144
+ .preview-content {
145
+ max-width: 800px;
146
+ margin: auto;
147
+ padding: 30px;
148
+ border: 1px solid #eee;
149
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
150
+ background: white;
151
+ font-size: 16px;
152
+ line-height: 1.5;
153
+ font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
154
+ color: #555;
155
+ }
156
+ </style>
157
+ <div class="preview-scale-wrapper">
158
+ <div class="preview-content">${n}</div>
159
+ </div>
160
+ `;
161
+ } catch (y) {
162
+ v.innerHTML = `<div style="color:red;padding:20px;">Error rendering template: ${y}</div>`;
163
+ }
164
+ xe(() => $(h.selectedBlockId));
165
+ }
166
+ },
167
+ { deep: !0, immediate: !0 }
168
+ ), j(
169
+ () => h.selectedBlockId,
170
+ (v) => $(v)
171
+ );
172
+ function $(v) {
173
+ if (!k || (k.querySelectorAll("[data-block-id].highlight").forEach((n) => {
174
+ n.classList.remove("highlight");
175
+ }), !v)) return;
176
+ const y = k.querySelector(`[data-block-id="${v}"]`);
177
+ y && (y.classList.add("highlight"), y.scrollIntoView({ behavior: "smooth", block: "nearest" }));
178
+ }
179
+ return (v, y) => (o(), i("div", at, [
180
+ y[0] || (y[0] = l("div", { class: "text-xs font-semibold text-gray-400 uppercase tracking-wider px-3 py-2 border-b border-gray-200" }, " Live Preview ", -1)),
181
+ l("div", st, [
182
+ l("div", {
183
+ ref_key: "shadowHost",
184
+ ref: T
185
+ }, null, 512)
186
+ ])
187
+ ]));
188
+ }
189
+ }), rt = { class: "flex items-center gap-2 text-base font-semibold" }, it = { key: 1 }, ut = { key: 2 }, ct = {
190
+ key: 0,
191
+ class: "p-6"
192
+ }, dt = {
193
+ key: 0,
194
+ class: "flex justify-center items-center h-40 text-gray-400"
195
+ }, pt = {
196
+ key: 1,
197
+ class: "grid grid-cols-2 gap-8"
198
+ }, mt = ["onClick"], vt = { class: "flex items-center justify-center w-12 h-12 rounded-xl bg-gray-100 text-gray-500 group-hover:bg-blue-100 group-hover:text-blue-600 transition-colors" }, ft = { class: "text-center" }, yt = { class: "text-sm font-semibold text-gray-700 group-hover:text-blue-700" }, gt = { class: "text-xs text-gray-400 mt-1" }, bt = {
199
+ key: 0,
200
+ class: "absolute top-2.5 right-2.5 text-[10px] font-medium text-green-600 bg-green-50 border border-green-200 px-2 py-0.5 rounded-full"
201
+ }, _t = {
202
+ key: 1,
203
+ class: "absolute top-2.5 right-2.5 text-[10px] font-medium text-gray-400 bg-gray-100 px-2 py-0.5 rounded-full"
204
+ }, xt = {
205
+ key: 1,
206
+ class: "flex justify-center items-center h-[400px] text-gray-400"
207
+ }, ht = {
208
+ key: 2,
209
+ class: "flex h-[calc(100vh-120px)] border-t border-gray-200"
210
+ }, kt = { class: "w-[280px] border-r border-gray-200 overflow-y-auto shrink-0" }, wt = { class: "px-3 pt-3 pb-2" }, Ft = { class: "flex flex-col" }, Tt = ["onClick"], St = { class: "border-y border-gray-100" }, $t = ["onDragstart", "onDragover", "onDrop", "onClick"], Dt = { class: "flex-1" }, Ct = { class: "flex gap-1 opacity-50 hover:opacity-100" }, Bt = {
211
+ key: 0,
212
+ class: "py-6 px-4 text-center text-gray-400 text-[13px]"
213
+ }, Vt = {
214
+ key: 0,
215
+ class: "border-t border-gray-200"
216
+ }, It = {
217
+ key: 1,
218
+ class: "flex items-center justify-center text-gray-400 text-[13px] py-8"
219
+ }, Pt = { class: "p-3 border-t border-gray-200" }, zt = { class: "flex-1 overflow-hidden" }, Ot = { class: "ml-auto flex gap-2" }, Et = { class: "p-4" }, Lt = { class: "flex items-center gap-1.5 mt-3 text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded px-3 py-2" }, At = { class: "p-4" }, Nt = { class: "flex items-center gap-1.5 mt-3 text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded px-3 py-2" }, Ut = /* @__PURE__ */ ee({
220
+ __name: "PrintTemplateEditorDialog",
221
+ props: {
222
+ modelValue: { type: Boolean }
223
+ },
224
+ emits: ["update:modelValue", "saved"],
225
+ setup(N, { emit: h }) {
226
+ const T = N, k = h, w = De(), p = Pe(), $ = ye(), v = E({
227
+ get: () => T.modelValue,
228
+ set: (u) => k("update:modelValue", u)
229
+ }), y = _(!1), n = _(!1), r = _(ae()), g = _(null), f = _(se.Enum.purchaseOrder), x = _("Purchase Order Template"), a = _(null), D = _(!1), d = _(!1), I = _("select-type"), J = [
230
+ {
231
+ label: "Purchase Order",
232
+ value: se.Enum.purchaseOrder,
233
+ icon: "receipt_long",
234
+ description: "Customize the layout for purchase order printouts"
235
+ },
236
+ {
237
+ label: "Transfer Order",
238
+ value: se.Enum.transferOrder,
239
+ icon: "swap_horiz",
240
+ description: "Customize the layout for transfer order printouts"
241
+ },
242
+ {
243
+ label: "Goods Received Note",
244
+ value: se.Enum.goodsReceivedNote,
245
+ icon: "fact_check",
246
+ description: "Customize the layout for GRN printouts"
247
+ },
248
+ {
249
+ label: "Delivery Order",
250
+ value: se.Enum.deliveryOrder,
251
+ icon: "local_shipping",
252
+ description: "Customize the layout for delivery order printouts"
253
+ }
254
+ ], K = _(/* @__PURE__ */ new Set()), Q = E(
255
+ () => r.value.find((u) => u.id === g.value) ?? null
256
+ ), U = _(null), H = _(null);
257
+ j(v, async (u) => {
258
+ if (u) {
259
+ I.value = "select-type", y.value = !0;
260
+ try {
261
+ const e = await w.browse();
262
+ K.value = new Set(e.map((b) => b.type));
263
+ } catch {
264
+ } finally {
265
+ y.value = !1;
266
+ }
267
+ }
268
+ }), j(f, async () => {
269
+ g.value = null, await le();
270
+ });
271
+ async function ne(u) {
272
+ f.value = u, await le(), I.value = "editor";
273
+ }
274
+ function te() {
275
+ return {
276
+ purchaseOrder: "Purchase Order Template",
277
+ transferOrder: "Transfer Order Template",
278
+ goodsReceivedNote: "Goods Received Note Template",
279
+ deliveryOrder: "Delivery Order Template"
280
+ }[f.value] ?? "Purchase Order Template";
281
+ }
282
+ async function le() {
283
+ y.value = !0;
284
+ try {
285
+ const u = await w.browse();
286
+ K.value = new Set(u.map((b) => b.type));
287
+ const e = u.find((b) => b.type === f.value);
288
+ e ? (a.value = e._id, x.value = e.name, r.value = e.blocks.map((b) => ({ ...b }))) : (a.value = null, r.value = ae(), x.value = te());
289
+ } catch {
290
+ r.value = ae(), x.value = te();
291
+ } finally {
292
+ y.value = !1;
293
+ }
294
+ }
295
+ function ce(u) {
296
+ const e = {
297
+ id: Be(),
298
+ tag: u,
299
+ config: Ce(u)
300
+ };
301
+ r.value.push(e), g.value = e.id;
302
+ }
303
+ function de(u) {
304
+ const e = r.value.findIndex((b) => b.id === u);
305
+ e >= 0 && (r.value.splice(e, 1), g.value === u && (g.value = null));
306
+ }
307
+ function re(u) {
308
+ const e = r.value.find((b) => b.id === g.value);
309
+ if (e) {
310
+ const b = u.configFields || [], oe = be(e.tag);
311
+ e.config = { configFields: b, templateHtml: oe };
312
+ }
313
+ }
314
+ function pe(u) {
315
+ U.value = u;
316
+ }
317
+ function me(u, e) {
318
+ u.preventDefault(), H.value = e;
319
+ }
320
+ function ve() {
321
+ H.value = null;
322
+ }
323
+ function fe(u) {
324
+ if (U.value === null || U.value === u) {
325
+ U.value = null, H.value = null;
326
+ return;
327
+ }
328
+ const e = r.value.splice(U.value, 1)[0];
329
+ r.value.splice(u, 0, e), U.value = null, H.value = null;
330
+ }
331
+ function t() {
332
+ U.value = null, H.value = null;
333
+ }
334
+ async function s() {
335
+ var u;
336
+ n.value = !0;
337
+ try {
338
+ const e = (u = $.currentBusiness.value) == null ? void 0 : u._id;
339
+ if (!e)
340
+ throw new Error("Business ID is missing. Please select a business first.");
341
+ const b = r.value.map((c) => {
342
+ var ge;
343
+ const P = ((ge = c.config) == null ? void 0 : ge.configFields) || [], G = be(c.tag, P);
344
+ return {
345
+ ...c,
346
+ config: { configFields: P, templateHtml: G }
347
+ };
348
+ }), oe = Ve(b), M = {
349
+ name: x.value,
350
+ type: f.value,
351
+ blocks: oe,
352
+ businessId: e,
353
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
354
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
355
+ };
356
+ let R;
357
+ a.value ? R = await w.update(a.value, {
358
+ _id: a.value,
359
+ ...M
360
+ }) : (R = await w.create(M), a.value = R._id), K.value.add(f.value), d.value = !1, p == null || p.open({
361
+ title: "Success",
362
+ message: "Print template saved",
363
+ type: "success"
364
+ }), k("saved", R), v.value = !1;
365
+ } catch (e) {
366
+ p == null || p.open({
367
+ title: "Error",
368
+ message: (e == null ? void 0 : e.message) || "Failed to save template",
369
+ type: "error"
370
+ });
371
+ } finally {
372
+ n.value = !1;
373
+ }
374
+ }
375
+ async function B() {
376
+ if (a.value) {
377
+ n.value = !0;
378
+ try {
379
+ await w.delete(a.value), a.value = null, r.value = ae(), x.value = te(), K.value.delete(f.value), D.value = !1, p == null || p.open({
380
+ title: "Deleted",
381
+ message: "Print template deleted. Default layout will be used.",
382
+ type: "success"
383
+ }), k("saved", null), v.value = !1;
384
+ } catch (u) {
385
+ p == null || p.open({
386
+ title: "Error",
387
+ message: (u == null ? void 0 : u.message) || "Failed to delete template",
388
+ type: "error"
389
+ });
390
+ } finally {
391
+ n.value = !1;
392
+ }
393
+ }
394
+ }
395
+ function q() {
396
+ r.value = ae(), g.value = null;
397
+ }
398
+ function F(u) {
399
+ var e;
400
+ return ((e = Y[u]) == null ? void 0 : e.label) ?? u;
401
+ }
402
+ function ie(u) {
403
+ var e;
404
+ return ((e = Y[u]) == null ? void 0 : e.icon) ?? "widgets";
405
+ }
406
+ return (u, e) => {
407
+ const b = L("FmIcon"), oe = L("FmTextField"), M = L("FmButton"), R = L("FmDialog");
408
+ return o(), i(A, null, [
409
+ m(R, {
410
+ modelValue: v.value,
411
+ "onUpdate:modelValue": e[4] || (e[4] = (c) => v.value = c),
412
+ overlay: !0,
413
+ "close-button": "",
414
+ "max-width": "98vw",
415
+ "max-height": "98vh"
416
+ }, he({
417
+ "dialog-header": z(() => {
418
+ var c;
419
+ return [
420
+ l("div", rt, [
421
+ I.value === "editor" ? (o(), i("button", {
422
+ key: 0,
423
+ class: "flex items-center justify-center w-7 h-7 rounded hover:bg-gray-100 transition-colors text-gray-500",
424
+ onClick: e[0] || (e[0] = (P) => I.value = "select-type")
425
+ }, [
426
+ m(b, {
427
+ name: "arrow_back",
428
+ size: "sm"
429
+ })
430
+ ])) : Z("", !0),
431
+ I.value === "select-type" ? (o(), i("span", it, "Print Template Editor")) : (o(), i("span", ut, C((c = J.find((P) => P.value === f.value)) == null ? void 0 : c.label) + " Template", 1))
432
+ ])
433
+ ];
434
+ }),
435
+ default: z(() => [
436
+ I.value === "select-type" ? (o(), i("div", ct, [
437
+ e[7] || (e[7] = l("p", { class: "text-sm text-gray-500 mb-5" }, " Select a template type to customize its print layout. ", -1)),
438
+ y.value ? (o(), i("div", dt, " Loading... ")) : (o(), i("div", pt, [
439
+ (o(), i(A, null, W(J, (c) => l("div", {
440
+ key: c.value,
441
+ class: ue(["group relative flex flex-col items-center gap-3 p-6 rounded-xl border-2 border-gray-200 cursor-pointer transition-all hover:border-blue-400 hover:shadow-md", {
442
+ "border-blue-500 bg-blue-50/50 shadow-md": f.value === c.value && I.value === "select-type"
443
+ }]),
444
+ onClick: (P) => ne(c.value)
445
+ }, [
446
+ l("div", vt, [
447
+ m(b, {
448
+ name: c.icon,
449
+ size: "sm"
450
+ }, null, 8, ["name"])
451
+ ]),
452
+ l("div", ft, [
453
+ l("div", yt, C(c.label), 1),
454
+ l("div", gt, C(c.description), 1)
455
+ ]),
456
+ K.value.has(c.value) ? (o(), i("span", bt, "Customized")) : (o(), i("span", _t, "Default"))
457
+ ], 10, mt)), 64))
458
+ ]))
459
+ ])) : y.value ? (o(), i("div", xt, e[8] || (e[8] = [
460
+ l("div", null, "Loading template...", -1)
461
+ ]))) : (o(), i("div", ht, [
462
+ l("div", kt, [
463
+ l("div", wt, [
464
+ m(oe, {
465
+ modelValue: x.value,
466
+ "onUpdate:modelValue": e[1] || (e[1] = (c) => x.value = c),
467
+ placeholder: "Template name",
468
+ label: "Template Name"
469
+ }, null, 8, ["modelValue"])
470
+ ]),
471
+ e[9] || (e[9] = l("div", { class: "text-xs font-semibold text-gray-400 uppercase tracking-wider px-3 py-2" }, " Add Blocks ", -1)),
472
+ l("div", Ft, [
473
+ (o(!0), i(A, null, W(S(Oe).Values, (c) => (o(), i("div", {
474
+ key: c,
475
+ class: "group flex items-center gap-2 px-3 py-2 cursor-pointer text-[13px] text-gray-600 transition-colors hover:bg-gray-100",
476
+ onClick: (P) => ce(c)
477
+ }, [
478
+ m(b, {
479
+ name: S(Y)[c].icon,
480
+ size: "sm"
481
+ }, null, 8, ["name"]),
482
+ l("span", null, C(S(Y)[c].label), 1),
483
+ m(b, {
484
+ name: "add",
485
+ size: "sm",
486
+ class: "ml-auto opacity-0 text-blue-600 group-hover:opacity-100"
487
+ })
488
+ ], 8, Tt))), 128))
489
+ ]),
490
+ e[10] || (e[10] = l("div", { class: "text-xs font-semibold text-gray-400 uppercase tracking-wider px-3 py-2 mt-2" }, " Block Order ", -1)),
491
+ l("div", St, [
492
+ (o(!0), i(A, null, W(r.value, (c, P) => (o(), i("div", {
493
+ key: c.id,
494
+ class: ue(["flex items-center gap-2 px-3 py-2 cursor-pointer text-[13px] text-gray-600 border-b border-gray-100 transition-colors hover:bg-gray-100", {
495
+ "bg-blue-50 border-l-[3px] border-l-blue-600": c.id === g.value,
496
+ "border-t-2 border-t-blue-600": H.value === P
497
+ }]),
498
+ draggable: "true",
499
+ onDragstart: (G) => pe(P),
500
+ onDragover: (G) => me(G, P),
501
+ onDragleave: ve,
502
+ onDrop: (G) => fe(P),
503
+ onDragend: t,
504
+ onClick: (G) => g.value = c.id
505
+ }, [
506
+ m(b, {
507
+ name: "drag_indicator",
508
+ size: "sm",
509
+ class: "cursor-grab text-gray-300"
510
+ }),
511
+ m(b, {
512
+ name: ie(c.tag),
513
+ size: "sm"
514
+ }, null, 8, ["name"]),
515
+ l("span", Dt, C(F(c.tag)), 1),
516
+ l("div", Ct, [
517
+ m(b, {
518
+ name: "delete",
519
+ size: "sm",
520
+ class: "cursor-pointer text-gray-400 hover:text-red-500",
521
+ onClick: ke((G) => de(c.id), ["stop"])
522
+ }, null, 8, ["onClick"])
523
+ ])
524
+ ], 42, $t))), 128)),
525
+ r.value.length === 0 ? (o(), i("div", Bt, " Click a block above to add it ")) : Z("", !0)
526
+ ]),
527
+ Q.value ? (o(), i("div", Vt, [
528
+ (o(), O(ot, {
529
+ key: Q.value.id,
530
+ block: Q.value,
531
+ onUpdate: re
532
+ }, null, 8, ["block"]))
533
+ ])) : (o(), i("div", It, " Select a block to configure it ")),
534
+ l("div", Pt, [
535
+ m(M, {
536
+ label: "Reset to Default",
537
+ variant: "plain",
538
+ size: "md",
539
+ onClick: q
540
+ })
541
+ ])
542
+ ]),
543
+ l("div", zt, [
544
+ m(nt, {
545
+ blocks: r.value,
546
+ "selected-block-id": g.value,
547
+ "template-type": f.value
548
+ }, null, 8, ["blocks", "selected-block-id", "template-type"])
549
+ ])
550
+ ]))
551
+ ]),
552
+ _: 2
553
+ }, [
554
+ I.value === "editor" ? {
555
+ name: "dialog-footer",
556
+ fn: z(() => [
557
+ l("div", Ot, [
558
+ a.value ? (o(), O(M, {
559
+ key: 0,
560
+ label: "Delete Template",
561
+ variant: "destructive",
562
+ size: "md",
563
+ onClick: e[2] || (e[2] = (c) => D.value = !0)
564
+ })) : Z("", !0),
565
+ m(M, {
566
+ label: "Save Template",
567
+ variant: "primary",
568
+ size: "md",
569
+ onClick: e[3] || (e[3] = (c) => d.value = !0)
570
+ })
571
+ ])
572
+ ]),
573
+ key: "0"
574
+ } : void 0
575
+ ]), 1032, ["modelValue"]),
576
+ m(R, {
577
+ modelValue: d.value,
578
+ "onUpdate:modelValue": e[5] || (e[5] = (c) => d.value = c),
579
+ overlay: !0,
580
+ dismissAway: !0,
581
+ "close-button": "",
582
+ "max-width": "400px"
583
+ }, {
584
+ "dialog-header": z(() => e[11] || (e[11] = [
585
+ l("span", null, "Save Print Template?", -1)
586
+ ])),
587
+ "dialog-footer": z(() => [
588
+ m(M, {
589
+ class: "ml-auto",
590
+ label: "Save",
591
+ variant: "primary",
592
+ size: "md",
593
+ loading: n.value,
594
+ onClick: s
595
+ }, null, 8, ["loading"])
596
+ ]),
597
+ default: z(() => [
598
+ l("div", Et, [
599
+ e[13] || (e[13] = l("p", null, "Are you sure you want to save this print template?", -1)),
600
+ e[14] || (e[14] = l("p", { class: "text-gray-500 text-sm mt-2" }, " This template will be used for all future prints of this type. ", -1)),
601
+ l("div", Lt, [
602
+ m(b, {
603
+ name: "warning",
604
+ size: "sm"
605
+ }),
606
+ e[12] || (e[12] = l("span", null, "This will affect all locations under this business.", -1))
607
+ ])
608
+ ])
609
+ ]),
610
+ _: 1
611
+ }, 8, ["modelValue"]),
612
+ m(R, {
613
+ modelValue: D.value,
614
+ "onUpdate:modelValue": e[6] || (e[6] = (c) => D.value = c),
615
+ overlay: !0,
616
+ dismissAway: !0,
617
+ "close-button": "",
618
+ "max-width": "400px"
619
+ }, {
620
+ "dialog-header": z(() => e[15] || (e[15] = [
621
+ l("span", null, "Delete Print Template?", -1)
622
+ ])),
623
+ "dialog-footer": z(() => [
624
+ m(M, {
625
+ class: "ml-auto",
626
+ label: "Delete",
627
+ variant: "destructive",
628
+ size: "md",
629
+ loading: n.value,
630
+ onClick: B
631
+ }, null, 8, ["loading"])
632
+ ]),
633
+ default: z(() => [
634
+ l("div", At, [
635
+ e[17] || (e[17] = l("p", null, "Are you sure you want to delete this print template?", -1)),
636
+ e[18] || (e[18] = l("p", { class: "text-gray-500 text-sm mt-2" }, " The default print layout will be used for all future prints. ", -1)),
637
+ l("div", Nt, [
638
+ m(b, {
639
+ name: "warning",
640
+ size: "sm"
641
+ }),
642
+ e[16] || (e[16] = l("span", null, "This will affect all locations under this business.", -1))
643
+ ])
644
+ ])
645
+ ]),
646
+ _: 1
647
+ }, 8, ["modelValue"])
648
+ ], 64);
649
+ };
650
+ }
651
+ }), Ht = { class: "flex flex-wrap items-center gap-8 border-b border-fm-color-neutral-gray-200 pb-16" }, Mt = {
652
+ key: 0,
653
+ class: "text-fm-color-typo-secondary"
654
+ }, Rt = {
655
+ key: 1,
656
+ class: "text-fm-color-typo-secondary"
657
+ }, jt = {
658
+ key: 2,
659
+ class: "text-fm-color-typo-error"
660
+ }, Kt = {
661
+ key: 4,
662
+ class: "fm-typo-en-body-md-600"
663
+ }, qt = {
664
+ key: 5,
665
+ class: "text-fm-color-typo-secondary"
666
+ }, Gt = /* @__PURE__ */ ee({
667
+ __name: "PlanLicenseDisplay",
668
+ props: {
669
+ scopeDbName: {}
670
+ },
671
+ setup(N) {
672
+ const h = N, T = _e(), k = Le(), w = E(() => T.locationByDbName[h.scopeDbName ?? ""]), p = E(() => {
673
+ var r;
674
+ const n = (r = w.value) == null ? void 0 : r.doc;
675
+ return n ? n.id || n._id : void 0;
676
+ }), $ = _(null), v = _(!1), y = _(!1);
677
+ return j(
678
+ p,
679
+ async (n, r, g) => {
680
+ if ($.value = null, y.value = !1, !n) return;
681
+ let f = !1;
682
+ g(() => {
683
+ f = !0;
684
+ }), v.value = !0;
685
+ try {
686
+ const x = await k.getInventoryPlan(n);
687
+ f || ($.value = x);
688
+ } catch {
689
+ f || (y.value = !0);
690
+ } finally {
691
+ f || (v.value = !1);
692
+ }
693
+ },
694
+ { immediate: !0 }
695
+ ), (n, r) => (o(), i("div", Ht, [
696
+ r[0] || (r[0] = l("span", { class: "fm-typo-en-body-md-600" }, "Inventory plan", -1)),
697
+ w.value ? v.value ? (o(), i("span", Rt, "Loading…")) : y.value ? (o(), i("span", jt, "Could not load plan")) : $.value === "Premium" ? (o(), O(je, {
698
+ key: 3,
699
+ tier: "premium"
700
+ })) : $.value === "Standard" ? (o(), i("span", Kt, "Standard")) : (o(), i("span", qt, "No plan assigned")) : (o(), i("span", Mt, "Select a location to view its plan"))
701
+ ]));
702
+ }
703
+ }), Yt = { class: "flex min-h-0 w-full flex-col gap-12" }, Wt = { class: "flex w-full flex-wrap items-center gap-8" }, Jt = /* @__PURE__ */ ee({
704
+ __name: "FeatureFlagView",
705
+ setup(N) {
706
+ const h = Ue(), T = _e(), k = ye(), w = Ae(), p = X.FmSwitch, $ = X.FmTable, v = X.FmMenu, y = X.FmMenuDivider, n = X.FmMenuHeader, r = X.FmMenuItem, g = /* @__PURE__ */ new Set(), f = {
707
+ inventory_pos_closing_v1: "Use v2: Closing Draft and Closing Template.",
708
+ inventory_pos_convert_v1: "Use Production Item instead."
709
+ }, x = _([]), a = _(null), D = ["In use", "Deprecate Soon", "Deprecated"], d = _(null), I = _({}), J = _(!1), K = {
710
+ inventory_netsuite_inventory_transfer_out: ["netsuite"],
711
+ inventory_portal_accept_require_fulfillment: ["mobile"],
712
+ inventory_portal_must_use_transfer_template: ["mobile"],
713
+ inventory_portal_po_operate_v2: ["mobile"],
714
+ inventory_portal_xilnex_transfer_note: ["mobile"],
715
+ inventory_pos_adjust_v1: ["mobile", "pos-v7", "pos-7.8"],
716
+ inventory_pos_adjust_v2_wastage: ["mobile", "pos-v7", "pos-7.8"],
717
+ inventory_pos_allow_receive_order: ["mobile", "pos-v7", "pos-7.8"],
718
+ inventory_pos_closing_v1: ["mobile", "pos-v7", "pos-7.8"],
719
+ inventory_pos_closing_v2: ["mobile", "pos-v7", "pos-7.8"],
720
+ inventory_pos_convert_v1: ["mobile", "pos-v7", "pos-7.8"],
721
+ inventory_pos_costing: ["mobile"],
722
+ inventory_pos_stock_return: ["mobile"],
723
+ inventory_pos_transfer_require_fulfillment: ["mobile", "pos-v7", "pos-7.8"],
724
+ inventory_purchase_order_approval: ["mobile"]
725
+ }, Q = E(
726
+ () => Object.values(Ne).map((t) => {
727
+ const s = h.flags.find((B) => B.name === t);
728
+ return {
729
+ name: t,
730
+ enabled: (s == null ? void 0 : s.enabled) ?? null,
731
+ domains: ["portal", ...K[t] ?? []],
732
+ features: Ke(t)
733
+ };
734
+ })
735
+ ), U = E(
736
+ () => [...new Set(Q.value.flatMap((t) => t.domains))].sort()
737
+ ), H = E(
738
+ () => Q.value.filter(
739
+ (t) => (x.value.length === 0 || x.value.some((s) => t.domains.includes(s))) && (!a.value || re(t) === a.value)
740
+ )
741
+ );
742
+ function ne(t) {
743
+ x.value = x.value.includes(t) ? x.value.filter((s) => s !== t) : [...x.value, t];
744
+ }
745
+ function te() {
746
+ x.value = [], a.value = null;
747
+ }
748
+ function le(t) {
749
+ return t.domains.includes("mobile") || t.domains.some((s) => s.startsWith("pos-"));
750
+ }
751
+ function ce(t) {
752
+ return d.value && le(t) ? I.value[t.name] === !0 : t.enabled === !0;
753
+ }
754
+ async function de(t) {
755
+ if (!t) {
756
+ I.value = {};
757
+ return;
758
+ }
759
+ const s = t;
760
+ J.value = !0;
761
+ try {
762
+ const { flags: B } = await w.listForScope(s);
763
+ d.value === s && (I.value = Object.fromEntries(B.map((q) => [q.name, q.enabled])));
764
+ } catch (B) {
765
+ console.error("Unable to load feature flags for the selected scope", B), d.value === s && (I.value = {});
766
+ } finally {
767
+ d.value === s && (J.value = !1);
768
+ }
769
+ }
770
+ j(
771
+ () => {
772
+ var t;
773
+ return (t = k.currentBusiness.value) != null && t._id ? `business_${k.currentBusiness.value._id}` : null;
774
+ },
775
+ (t) => {
776
+ var s;
777
+ d.value || (d.value = ((s = T._currentLocation) == null ? void 0 : s.dbName) ?? t);
778
+ },
779
+ { immediate: !0 }
780
+ ), j(d, de, { immediate: !0 });
781
+ function re(t) {
782
+ return g.has(t.name) ? "Deprecated" : f[t.name] ? "Deprecate Soon" : "In use";
783
+ }
784
+ function pe(t) {
785
+ return t === "Deprecated" ? "bg-red-50 text-red-700" : t === "Deprecate Soon" ? "bg-fm-color-state-warning-subtle text-fm-color-state-warning-base" : "bg-green-50 text-green-700";
786
+ }
787
+ function me(t) {
788
+ return t.features.length === 0 ? ["Controls the availability of this inventory feature."] : t.features.length === 1 ? [t.features[0].controls] : t.features.map((s) => `${s.label}: ${s.controls}`);
789
+ }
790
+ function ve(t) {
791
+ return g.has(t.name) ? "This flag is deprecated. Use its supported replacement for new work." : f[t.name];
792
+ }
793
+ const fe = E(() => [
794
+ {
795
+ accessorKey: "name",
796
+ header: "Feature flag",
797
+ meta: { width: "27%" },
798
+ cell: ({ row: t }) => V("div", { class: "flex flex-wrap items-center gap-2" }, [
799
+ V("span", { class: "break-all font-mono text-xs text-gray-700" }, t.original.name),
800
+ ...t.original.features.slice(0, 1).map(
801
+ (s) => V(He, {
802
+ tier: s.category === "premium" ? "premium" : "standard",
803
+ category: s.category,
804
+ deprecateSoon: s.deprecateSoon,
805
+ informative: !0
806
+ })
807
+ )
808
+ ])
809
+ },
810
+ {
811
+ id: "domains",
812
+ header: "Domains",
813
+ meta: { width: "19%" },
814
+ cell: ({ row: t }) => V(
815
+ "div",
816
+ { class: "flex flex-wrap gap-2" },
817
+ t.original.domains.map(
818
+ (s) => V(
819
+ "span",
820
+ {
821
+ class: "rounded-full bg-fm-color-neutral-gray-100 px-2 py-0.5 text-xs font-medium text-fm-color-typo-secondary"
822
+ },
823
+ s
824
+ )
825
+ )
826
+ )
827
+ },
828
+ {
829
+ id: "description",
830
+ header: "Description",
831
+ meta: { width: "29%" },
832
+ cell: ({ row: t }) => {
833
+ const s = ve(t.original);
834
+ return V("div", { class: "flex flex-col gap-2 text-xs" }, [
835
+ ...me(t.original).map(
836
+ (B) => V("span", { class: "text-fm-color-typo-secondary" }, B)
837
+ ),
838
+ ...s ? [V("span", { class: "text-fm-color-state-warning-base" }, s)] : []
839
+ ]);
840
+ }
841
+ },
842
+ {
843
+ id: "status",
844
+ header: "Status",
845
+ meta: { width: "13%" },
846
+ cell: ({ row: t }) => {
847
+ const s = re(t.original);
848
+ return s === "Deprecate Soon" ? V(Me) : V(
849
+ "span",
850
+ {
851
+ class: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${pe(s)}`
852
+ },
853
+ s
854
+ );
855
+ }
856
+ },
857
+ {
858
+ id: "availability",
859
+ header: "Availability",
860
+ meta: { width: "12%" },
861
+ cell: ({ row: t }) => {
862
+ const s = !!d.value && le(t.original);
863
+ return V("div", { class: "flex flex-col items-end gap-2" }, [
864
+ V(p, { modelValue: ce(t.original), disabled: !0, showIcon: !0 }),
865
+ ...s && J.value ? [V("span", { class: "text-xs text-gray-500" }, "Loading location value…")] : [],
866
+ ...t.original.features.some((B) => B.category === "premium") && t.original.enabled !== !0 && !s ? [V("span", { class: "text-xs text-gray-500" }, "Controlled by the Premium plan")] : []
867
+ ]);
868
+ }
869
+ }
870
+ ]);
871
+ return (t, s) => {
872
+ const B = L("FmChip"), q = L("FmButton");
873
+ return o(), i("div", Yt, [
874
+ m(Gt, { "scope-db-name": d.value }, null, 8, ["scope-db-name"]),
875
+ l("div", Wt, [
876
+ m(Re, {
877
+ "model-value": d.value,
878
+ "onUpdate:modelValue": s[0] || (s[0] = (F) => d.value = F),
879
+ "selection-only": "",
880
+ "show-business": ""
881
+ }, null, 8, ["model-value"]),
882
+ (o(!0), i(A, null, W(x.value, (F) => (o(), O(B, {
883
+ key: F,
884
+ label: `domain in ${F}`,
885
+ removable: "",
886
+ onChipClosed: (ie) => ne(F)
887
+ }, null, 8, ["label", "onChipClosed"]))), 128)),
888
+ a.value ? (o(), O(B, {
889
+ key: 0,
890
+ label: `status in ${a.value}`,
891
+ removable: "",
892
+ onChipClosed: s[1] || (s[1] = (F) => a.value = null)
893
+ }, null, 8, ["label"])) : Z("", !0),
894
+ m(S(v), {
895
+ "close-on-click": !1,
896
+ width: 288,
897
+ "max-height": 420,
898
+ placement: "bottom-start"
899
+ }, {
900
+ "menu-button": z(() => [
901
+ m(q, {
902
+ label: "Filter",
903
+ "prepend-icon": "add",
904
+ variant: "secondary"
905
+ })
906
+ ]),
907
+ default: z(() => [
908
+ m(S(n), { label: "Domains" }),
909
+ (o(!0), i(A, null, W(U.value, (F) => (o(), O(S(r), {
910
+ key: F,
911
+ label: F,
912
+ selectable: "",
913
+ "has-checkbox": "",
914
+ "model-value": x.value.includes(F),
915
+ onClick: (ie) => ne(F)
916
+ }, null, 8, ["label", "model-value", "onClick"]))), 128)),
917
+ m(S(y)),
918
+ m(S(n), { label: "Status" }),
919
+ (o(), i(A, null, W(D, (F) => m(S(r), {
920
+ key: F,
921
+ label: F,
922
+ selectable: "",
923
+ "has-checkbox": "",
924
+ "model-value": a.value === F,
925
+ onClick: (ie) => a.value = a.value === F ? null : F
926
+ }, null, 8, ["label", "model-value", "onClick"])), 64))
927
+ ]),
928
+ _: 1
929
+ }),
930
+ x.value.length || a.value ? (o(), O(q, {
931
+ key: 1,
932
+ label: "Clear all",
933
+ variant: "tertiary",
934
+ onClick: te
935
+ })) : Z("", !0)
936
+ ]),
937
+ m(S($), {
938
+ "column-defs": fe.value,
939
+ "row-data": H.value,
940
+ "page-size": 50,
941
+ "hide-footer": "",
942
+ "shrink-at": !1
943
+ }, null, 8, ["column-defs", "row-data"])
944
+ ]);
945
+ };
946
+ }
947
+ }), Qt = { class: "flex w-full flex-col gap-16 p-16" }, Xt = {
948
+ key: 0,
949
+ class: "py-32 text-center"
950
+ }, Zt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, el = {
951
+ class: "flex gap-2 border-b border-gray-200",
952
+ role: "tablist"
953
+ }, tl = ["aria-selected"], ll = ["aria-selected"], ol = { key: 0 }, al = { class: "flex items-center justify-between gap-12" }, sl = { class: "fm-typo-en-heading-sm-600 text-fm-color-typo-primary" }, nl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rl = {
954
+ key: 1,
955
+ class: "w-full"
956
+ }, il = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, hl = /* @__PURE__ */ ee({
957
+ __name: "SettingsView",
958
+ setup(N) {
959
+ const { t: h } = Ee(), T = ye(), k = Ie(), w = _(!1), p = _("order"), $ = E(() => {
960
+ var n, r;
961
+ return ((r = (n = T.sessionUser.value) == null ? void 0 : n.role) == null ? void 0 : r.isAdmin) === !0;
962
+ });
963
+ function v() {
964
+ k.invalidate(), k.fetchTemplates();
965
+ }
966
+ function y() {
967
+ k.fetchTemplates(), w.value = !0;
968
+ }
969
+ return (n, r) => {
970
+ const g = L("FmButton");
971
+ return o(), O(Fe, {
972
+ title: S(h)("inventory.settings.title")
973
+ }, {
974
+ default: z(() => [
975
+ l("div", Qt, [
976
+ $.value ? (o(), i(A, { key: 1 }, [
977
+ l("div", el, [
978
+ l("button", {
979
+ type: "button",
980
+ role: "tab",
981
+ "aria-selected": p.value === "order",
982
+ class: ue([
983
+ "border-b-2 px-3 py-2 text-sm font-medium",
984
+ p.value === "order" ? "border-fm-color-primary text-fm-color-primary" : "border-transparent text-gray-500"
985
+ ]),
986
+ onClick: r[0] || (r[0] = (f) => p.value = "order")
987
+ }, C(S(h)("inventory.settings.order.title")), 11, tl),
988
+ l("button", {
989
+ type: "button",
990
+ role: "tab",
991
+ "aria-selected": p.value === "features",
992
+ class: ue([
993
+ "border-b-2 px-3 py-2 text-sm font-medium",
994
+ p.value === "features" ? "border-fm-color-primary text-fm-color-primary" : "border-transparent text-gray-500"
995
+ ]),
996
+ onClick: r[1] || (r[1] = (f) => p.value = "features")
997
+ }, C(S(h)("inventory.settings.features.title")), 11, ll)
998
+ ]),
999
+ p.value === "order" ? (o(), i("div", ol, [
1000
+ l("div", al, [
1001
+ l("h2", sl, C(S(h)("inventory.settings.order.printTemplates")), 1),
1002
+ m(g, {
1003
+ onClick: y,
1004
+ variant: "secondary",
1005
+ label: S(h)("inventory.settings.printTemplate.edit")
1006
+ }, null, 8, ["label"])
1007
+ ]),
1008
+ l("p", nl, C(S(h)("inventory.settings.printTemplate.description")), 1)
1009
+ ])) : (o(), i("div", rl, [
1010
+ l("p", il, C(S(h)("inventory.settings.features.description")), 1),
1011
+ m(Jt)
1012
+ ]))
1013
+ ], 64)) : (o(), i("div", Xt, [
1014
+ l("p", Zt, C(S(h)("inventory.settings.adminOnly")), 1)
1015
+ ]))
1016
+ ]),
1017
+ (o(), O(we, { to: "body" }, [
1018
+ m(Ut, {
1019
+ modelValue: w.value,
1020
+ "onUpdate:modelValue": r[2] || (r[2] = (f) => w.value = f),
1021
+ onSaved: v
1022
+ }, null, 8, ["modelValue"])
1023
+ ]))
1024
+ ]),
1025
+ _: 1
1026
+ }, 8, ["title"]);
1027
+ };
1028
+ }
1029
+ });
1030
+ export {
1031
+ hl as default
1032
+ };