@feedmepos/mf-inventory-portal 1.7.0-dev.9 → 1.7.1-dev.0

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 (130) hide show
  1. package/dist/{App-DqkccxFd.js → App-B_ja37tB.js} +5 -5
  2. package/dist/ApprovalView-_wG6KeZl.js +249 -0
  3. package/dist/{BindingsDialog-CXBQwYIz.js → BindingsDialog-0IRWCLTc.js} +2 -2
  4. package/dist/{BindingsPicker-BfHSReUF.js → BindingsPicker-DCISa6Fx.js} +2 -2
  5. package/dist/{BindingsTable-CHxIsdzV.js → BindingsTable-B3CmHp97.js} +3 -3
  6. package/dist/BulkReceiveRequestView-Dmqm65c9.js +2025 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-BfN7GDOL.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-D4Nd89xp.js} +1 -1
  8. package/dist/{ClosingDraftView-BJQgyPTs.js → ClosingDraftView-DDWU93p0.js} +21 -21
  9. package/dist/{ClosingHistoryView-CLhL3Xfc.js → ClosingHistoryView-KdmhszIO.js} +7 -7
  10. package/dist/ClosingTemplateView-CQRujMB9.js +2346 -0
  11. package/dist/ConnectedBusinessView-Cu2QnRN9.js +533 -0
  12. package/dist/{DefaultView-BQ0Y_nGt.js → DefaultView-QAEDG6pS.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-DHDu2E0L.js → DeliveryOrderPrintPreview-B08SSOCX.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-Dqy7-a53.js → EmailDialog.vue_vue_type_script_setup_true_lang-DdzV_fzq.js} +13245 -13063
  15. package/dist/{FmAdminBadge-DlplQOHb.js → FmAdminBadge-DH_2w13D.js} +8 -8
  16. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-BeoDswK2.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CmH3uhTZ.js} +1 -1
  17. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dzqh8pM9.js +84 -0
  18. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bq1UiREV.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Df-yCfRe.js} +4 -4
  19. package/dist/{FmMultiselectDialog-BhDa1RwT.js → FmMultiselectDialog-DpPyNOpJ.js} +1 -1
  20. package/dist/{FmMultiselectDialog-CorNT8gl.js → FmMultiselectDialog-QEs0yct_.js} +2 -2
  21. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DYIDe_N1.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D8-IQUtA.js} +121 -119
  22. package/dist/{ImportView-C57uYZRr.js → ImportView-8qlgZSTO.js} +8 -8
  23. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-B96kvgzW.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CGWRbAF2.js} +1 -1
  24. package/dist/{IngredientGroupView-CwhJuG3d.js → IngredientGroupView-BI9SlKfz.js} +6 -6
  25. package/dist/{IngredientsView-oC9fFDvT.js → IngredientsView-1naUkKAi.js} +17 -17
  26. package/dist/{IntegrationExplorerView-4QvHjDRJ.js → IntegrationExplorerView-C6kyLz3y.js} +5 -5
  27. package/dist/{IntegrationView-D-DT3YJs.js → IntegrationView-DrmxLdlk.js} +15 -15
  28. package/dist/{InventoryBindingForm-CYw_09Za.js → InventoryBindingForm-CPNAgZkD.js} +1 -1
  29. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-urLsGkKG.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-sz_VtHRr.js} +5 -5
  30. package/dist/{InventoryBindingSummary-CgqWRDNo.js → InventoryBindingSummary-Cu98L10w.js} +1 -1
  31. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DLUlL05A.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-g2PDNQx-.js} +1 -1
  32. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-3m70pVwB.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BZEa61go.js} +1 -1
  33. package/dist/{ProductionView--WPitDlY.js → ProductionView-D8dxypqA.js} +8 -8
  34. package/dist/{PublishView-D0kB5NQ2.js → PublishView-C82UwIoz.js} +4 -4
  35. package/dist/{PurchaseOrderPrintPreview-B1M-Moro.js → PurchaseOrderPrintPreview-CP40tEma.js} +2 -2
  36. package/dist/ReceiveRequestView-DDo0Pb0J.js +514 -0
  37. package/dist/{RecipeView-C49tT8Cr.js → RecipeView-DB1DJQp7.js} +18 -18
  38. package/dist/{SettingsView-Dt7a_Nkx.js → SettingsView-DsS62lxW.js} +6 -6
  39. package/dist/{SingleColumnLayout.vue_vue_type_script_setup_true_lang-DwrLsWX_.js → SingleColumnLayout.vue_vue_type_script_setup_true_lang-DWsPvPE1.js} +1 -1
  40. package/dist/{StockView-CNzq9TSj.js → StockView-gcf7RCZz.js} +23 -23
  41. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cx-XCR_k.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-nXqFCKic.js} +1 -1
  42. package/dist/{SupplierView-7EbI5cfk.js → SupplierView-BIANlKLE.js} +13 -13
  43. package/dist/{SurchargeView-BbfzwuAB.js → SurchargeView-kRzaixM5.js} +7 -7
  44. package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-QMUVuthC.js +211 -0
  45. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-nO9sybW-.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BceIOuBq.js} +2 -2
  46. package/dist/TransferDetailsV3.vue_vue_type_script_setup_true_lang-DYAzxoHE.js +5991 -0
  47. package/dist/{TransferTemplateView-Bz5W7dh5.js → TransferTemplateView-Bq68Vh7t.js} +21 -21
  48. package/dist/{UnitCostHistoryView-5wAtW09L.js → UnitCostHistoryView-d0oLssyZ.js} +6 -6
  49. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-Ze6egaj8.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CLOotG6K.js} +4 -4
  50. package/dist/{UnitView-Mp8CL-lp.js → UnitView-BHfm2IE4.js} +8 -8
  51. package/dist/{WarehouseView-DRkIDq76.js → WarehouseView-CorSYwm6.js} +6 -6
  52. package/dist/{WastageTemplateView-CRLaJJnu.js → WastageTemplateView-CtYZwiRW.js} +15 -15
  53. package/dist/api/connected-business-mapping.d.ts +25 -0
  54. package/dist/api/purchase-order.d.ts +35 -1
  55. package/dist/{app-VqA3hs6t.js → app-37NZKFUI.js} +5557 -5192
  56. package/dist/app.d.ts +88 -0
  57. package/dist/app.js +1 -1
  58. package/dist/{closing-template-CdSV_waS.js → closing-template-C0dl45x2.js} +1 -1
  59. package/dist/components/FmFilterableMenuOptions.vue.d.ts +11 -2
  60. package/dist/connected-business-mapping-ywgqqyMr.js +37 -0
  61. package/dist/{date2-ybHWeys0.js → date2-r4KgBCs9.js} +1 -1
  62. package/dist/{dayjs.min-vhlHpfOd.js → dayjs.min-BKUldDi9.js} +1 -1
  63. package/dist/{decimal-BWaV7aqI.js → decimal-Cgmw6HIY.js} +2 -2
  64. package/dist/{defineDeepModel-Dh55Rpy6.js → defineDeepModel-DXLwZWst.js} +1 -1
  65. package/dist/{duplicate-template-BX4CtnXP.js → duplicate-template-DDA4QWPl.js} +1 -1
  66. package/dist/feature-B4BoCy_k.js +1548 -0
  67. package/dist/{format-time-from-id-CcnUAvw3.js → format-time-from-id-Dhjn5QgH.js} +1 -1
  68. package/dist/{format-unit-display-CpfisOsO.js → format-unit-display-g95-VuYJ.js} +12 -12
  69. package/dist/{import-export.helper-DkxUoI70.js → import-export.helper-DsZFPPqj.js} +6 -6
  70. package/dist/{index-CDTURjdV.js → index-B9WjF3Ox.js} +1 -1
  71. package/dist/{index-BWP_Oz85.js → index-C207KsUh.js} +3 -3
  72. package/dist/{index-C2-NacLA.js → index-D3Bmmx66.js} +1 -1
  73. package/dist/{inventory-core-dart.default-CCuIh47-.js → inventory-core-dart.default-NpD15h63.js} +7104 -5555
  74. package/dist/{jszip.min-CGd5HPaQ.js → jszip.min-B52cHzHI.js} +2 -2
  75. package/dist/{lz-string-DaTOnDE7.js → lz-string-CItFpr5-.js} +1 -1
  76. package/dist/{netsuite-Bv8m4JOq.js → netsuite-R_NkLn5t.js} +2 -2
  77. package/dist/{number-Blpf0ylx.js → number-BkC_lelq.js} +3 -3
  78. package/dist/{predefined-templates-CH1yqXrS.js → predefined-templates-CVT54o4V.js} +1 -1
  79. package/dist/{purchase-order-template-Hzi2jg5i.js → purchase-order-template-DvqAncB2.js} +1 -1
  80. package/dist/{recalculationUtils-Bg_M-poT.js → recalculationUtils-Cak1mo4o.js} +1 -1
  81. package/dist/router/name.d.ts +1 -0
  82. package/dist/{rules-CyLofMuT.js → rules--cnFg-PI.js} +2 -2
  83. package/dist/{stock-DfNx3w-V.js → stock-BLYAJxMj.js} +1 -1
  84. package/dist/{stock-vaSdMe5e.js → stock-DvquSog3.js} +3 -3
  85. package/dist/stores/feature.d.ts +2 -0
  86. package/dist/style.css +1 -1
  87. package/dist/{supplier-DPLDqUXZ.js → supplier-C5X8p_vd.js} +2 -2
  88. package/dist/{surcharge-0-XdT9aW.js → surcharge-CLkpleoW.js} +1 -1
  89. package/dist/tsconfig.app.tsbuildinfo +1 -1
  90. package/dist/{uom-rules-CbYmI74H.js → uom-rules-CykFo_pB.js} +1 -1
  91. package/dist/{use-ingredient-select-dialog-g1T1s6nQ.js → use-ingredient-select-dialog-DlxWMkAI.js} +2 -2
  92. package/dist/{use-inventory-binding-dialog-B0AniKhu.js → use-inventory-binding-dialog-DnWDyziu.js} +2 -2
  93. package/dist/{use-template-enabled-locations-DRkN8eSx.js → use-template-enabled-locations-SRgcWLO4.js} +2 -2
  94. package/dist/{use-transfer-locations-BG1GERbt.js → use-transfer-locations-D4f4Ib1r.js} +2 -2
  95. package/dist/{useHrmPermission-CUPAhcDP.js → useHrmPermission-lAc6ZHVZ.js} +1 -1
  96. package/dist/{useNavigationMenu-D2onvhoK.js → useNavigationMenu-CeN7TEwe.js} +59 -49
  97. package/dist/{useSseClient-DvQsSC57.js → useSseClient-C6ndlLpA.js} +1 -1
  98. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-search.d.ts +6 -0
  99. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-search.spec.d.ts +1 -0
  100. package/dist/views/connected-business/ConnectedBusinessMappingPanel.vue.d.ts +25 -0
  101. package/dist/views/connected-business/ConnectedBusinessView.vue.d.ts +2 -0
  102. package/dist/views/receive-request/components/CreateTransferChoice.vue.d.ts +27 -0
  103. package/dist/views/receive-request/components/transfer-details/TransferDetailsV3.vue.d.ts +18 -0
  104. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -0
  105. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  106. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +102 -2
  107. package/dist/views/receive-request/composables/fn.d.ts +2 -1
  108. package/dist/views/receive-request/composables/fn.spec.d.ts +1 -0
  109. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +119 -3
  110. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +642 -13
  111. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +720 -14
  112. package/dist/views/receive-request/helper/po-version.d.ts +6 -0
  113. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +524 -10
  114. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +102 -2
  115. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +4 -0
  116. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +8 -0
  117. package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +12 -0
  118. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +24 -0
  119. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +24 -0
  120. package/dist/{vue-i18n-CwNxhUsM.js → vue-i18n-DDqVG60p.js} +291 -291
  121. package/dist/{xlsx.util-dMHkd6XK.js → xlsx.util-BzQcPwvM.js} +2 -2
  122. package/package.json +3 -3
  123. package/dist/ApprovalView-CpeNbbnJ.js +0 -242
  124. package/dist/BulkReceiveRequestView-BFFeVxQF.js +0 -2011
  125. package/dist/ClosingTemplateView-DikY2_9d.js +0 -2270
  126. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B9CWp_AG.js +0 -76
  127. package/dist/ReceiveRequestView-B1NWO9ih.js +0 -345
  128. package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-CT0KDVR4.js +0 -178
  129. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DxSXLCtP.js +0 -4660
  130. package/dist/feature-_v_0Btg8.js +0 -1136
@@ -0,0 +1,533 @@
1
+ import { defineComponent as j, mergeModels as re, useModel as ue, ref as S, watch as H, computed as A, resolveComponent as M, createElementBlock as w, openBlock as m, createVNode as k, mergeProps as X, createBlock as V, unref as Q, withCtx as P, createElementVNode as u, createCommentVNode as I, toDisplayString as C, Fragment as de, renderList as me, onMounted as ce, h as T } from "vue";
2
+ import { components as ee, useDialog as pe, useSnackbar as fe } from "@feedmepos/ui-library";
3
+ import { u as te } from "./connected-business-mapping-ywgqqyMr.js";
4
+ import { useCoreStore as ne, useI18n as ve } from "@feedmepos/mf-common";
5
+ import { a as ye } from "./date2-r4KgBCs9.js";
6
+ import { _ as be } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DWsPvPE1.js";
7
+ import { w as ke, a as ge } from "./app-37NZKFUI.js";
8
+ import { I as G, M as _e, c as Z } from "./rules--cnFg-PI.js";
9
+ import { a as J } from "./FmMultiselectDialog-QEs0yct_.js";
10
+ import { a as xe, c as Se, t as he } from "./number-BkC_lelq.js";
11
+ import { _ as Be } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dzqh8pM9.js";
12
+ const we = { class: "flex flex-col" }, K = /* @__PURE__ */ j({
13
+ __name: "FmDecimalInput",
14
+ props: /* @__PURE__ */ re({
15
+ modelValue: {},
16
+ defaultRules: { type: Boolean },
17
+ textFieldRules: {},
18
+ decimalRules: {},
19
+ precision: {},
20
+ placeholder: {},
21
+ minLength: {},
22
+ maxLength: {},
23
+ inputmode: {},
24
+ type: {},
25
+ readonly: { type: Boolean },
26
+ labelMark: {},
27
+ prependIcon: {},
28
+ appendIcon: {},
29
+ showValidBorder: { type: Boolean },
30
+ labelInfo: {},
31
+ showWordCount: { type: Boolean },
32
+ invalid: { type: Boolean },
33
+ autofocus: { type: Boolean },
34
+ formatter: { type: Function },
35
+ decimal: {},
36
+ datalist: {},
37
+ shiftDatalist: { type: Boolean },
38
+ datalistMaxHeight: {},
39
+ datalistMinHeight: {},
40
+ offsetDatalist: {},
41
+ datalistPlacement: {},
42
+ datalistZIndex: {},
43
+ datalistWidth: {},
44
+ label: {},
45
+ disabled: { type: Boolean },
46
+ focused: { type: Boolean },
47
+ helperText: {},
48
+ helperState: {}
49
+ }, {
50
+ modelValue: {},
51
+ modelModifiers: {}
52
+ }),
53
+ emits: ["update:modelValue"],
54
+ setup($) {
55
+ const y = $, h = ue($, "modelValue"), c = S(xe(h.value ?? ke.reset())), B = G();
56
+ function x(p, b) {
57
+ return typeof b != "number" ? Se(p) : he(p, b);
58
+ }
59
+ H(c, (p) => {
60
+ B(p) == !0 && (h.value = x(+p, y.precision));
61
+ });
62
+ const v = A(() => y.defaultRules ? [typeof y.precision == "number" ? _e(y.precision) : G(), ...y.textFieldRules ?? []] : y.textFieldRules);
63
+ return (p, b) => {
64
+ const z = M("FmTextField"), i = M("FmFormGroup");
65
+ return m(), w("div", we, [
66
+ k(z, X(y, {
67
+ modelValue: c.value,
68
+ "onUpdate:modelValue": b[0] || (b[0] = (r) => c.value = r),
69
+ rules: v.value
70
+ }), null, 16, ["modelValue", "rules"]),
71
+ k(i, {
72
+ "model-value": h.value,
73
+ rules: p.decimalRules
74
+ }, null, 8, ["model-value", "rules"])
75
+ ]);
76
+ };
77
+ }
78
+ }), Ve = { class: "p-16 flex flex-col gap-16" }, Fe = { class: "flex items-center gap-8" }, Ie = { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, Ce = { class: "flex items-center gap-8" }, Ae = {
79
+ key: 0,
80
+ class: "border border-dashed fm-corner-radius-md p-24 text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
81
+ }, Me = {
82
+ key: 1,
83
+ class: "border border-dashed fm-corner-radius-md p-24 text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
84
+ }, Ne = { class: "flex items-center gap-12 p-12" }, Pe = { class: "flex-1 min-w-0" }, $e = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary line-clamp-1" }, ze = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary line-clamp-1" }, Re = { class: "flex-1 min-w-0" }, De = {
85
+ key: 0,
86
+ class: "min-w-0"
87
+ }, Ue = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary line-clamp-1" }, qe = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary line-clamp-1" }, Le = {
88
+ key: 2,
89
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
90
+ }, Qe = {
91
+ key: 0,
92
+ class: "border-t bg-fm-color-neutral-gray-100 p-12"
93
+ }, Ee = { class: "flex items-center gap-8" }, Te = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, He = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, je = { class: "flex items-center justify-end gap-8" }, Oe = /* @__PURE__ */ j({
94
+ __name: "ConnectedBusinessMappingPanel",
95
+ props: {
96
+ modelValue: { type: Boolean },
97
+ mapping: {},
98
+ editable: { type: Boolean }
99
+ },
100
+ emits: ["update:modelValue", "saved"],
101
+ setup($, { emit: y }) {
102
+ const { FmSideSheet: h } = ee, c = $, B = y, x = te(), v = ne(), p = ge(), b = pe(), z = fe(), i = S(null), r = S([]), g = S([]), R = S(!1), D = A(() => p.skus ?? []);
103
+ function q(e) {
104
+ var n;
105
+ return ((n = (v.businesses.value ?? []).find((a) => a._id === e || a.id === e)) == null ? void 0 : n.name) ?? e;
106
+ }
107
+ function L(e, t) {
108
+ const n = q(e);
109
+ return n !== e ? n : t ?? void 0;
110
+ }
111
+ function U(e) {
112
+ var t;
113
+ return ((t = c.mapping) == null ? void 0 : t.targetBusinessName) ?? q(e);
114
+ }
115
+ const o = A(() => {
116
+ var n;
117
+ const e = (n = v.currentBusiness.value) == null ? void 0 : n._id;
118
+ return (v.businesses.value ?? []).map((a) => ({ label: a.name ?? "", value: a._id ?? a.id ?? "" })).filter((a) => a.value && a.value !== e);
119
+ });
120
+ function s(e) {
121
+ return {
122
+ internalSku: e,
123
+ externalSku: null,
124
+ quantity: { amount: 1, precision: 0 },
125
+ externalQuantity: { amount: 1, precision: 0 }
126
+ };
127
+ }
128
+ const F = A({
129
+ get: () => c.modelValue,
130
+ set: (e) => B("update:modelValue", e)
131
+ });
132
+ async function _(e) {
133
+ g.value = [];
134
+ try {
135
+ g.value = await x.browseSkus(e);
136
+ } catch (t) {
137
+ console.error("Failed to load partner catalog", t);
138
+ }
139
+ }
140
+ H(
141
+ () => c.modelValue,
142
+ async (e) => {
143
+ if (!e) return;
144
+ v.readBusinesses().catch((n) => console.error("Failed to load businesses", n));
145
+ const t = c.mapping;
146
+ i.value = (t == null ? void 0 : t.targetBusinessId) ?? null, r.value = [], g.value = [], t && (await _(t.targetBusinessId), r.value = t.skuPairs.map((n) => {
147
+ const a = D.value.find((f) => f._id === n.skuId), d = g.value.find((f) => f._id === n.externalSkuId) ?? null;
148
+ return {
149
+ internalSku: a ?? {
150
+ _id: n.skuId,
151
+ code: "",
152
+ name: n.skuId,
153
+ unit: { _id: "", name: "", abbrev: "", precision: 0, measurements: [] }
154
+ },
155
+ externalSku: d,
156
+ quantity: n.quantity,
157
+ externalQuantity: n.externalQuantity
158
+ };
159
+ }));
160
+ }
161
+ ), H(i, (e, t) => {
162
+ e && e !== t && (_(e), r.value.forEach((n) => {
163
+ n.externalSku = null;
164
+ }));
165
+ });
166
+ function O() {
167
+ B("update:modelValue", !1);
168
+ }
169
+ function ae() {
170
+ const e = new Set(r.value.map((n) => n.internalSku._id)), t = D.value.map((n) => ({ label: n.name, value: n._id, sublabel: n.code }));
171
+ b.open({
172
+ title: "Add items",
173
+ closeButton: !0,
174
+ zIndex: 300,
175
+ contentComponent: J,
176
+ contentComponentProps: {
177
+ modelValue: [...e],
178
+ items: t,
179
+ virtualScroll: !0
180
+ },
181
+ primaryActions: { text: "Add", close: !0 },
182
+ secondaryActions: { text: "Cancel", close: !0, variant: "tertiary" }
183
+ }).onPrimary((n) => {
184
+ const a = new Set(n);
185
+ r.value = r.value.filter((f) => a.has(f.internalSku._id));
186
+ const d = new Set(r.value.map((f) => f.internalSku._id));
187
+ D.value.filter((f) => a.has(f._id) && !d.has(f._id)).forEach((f) => r.value.push(s(f)));
188
+ });
189
+ }
190
+ function oe(e) {
191
+ const t = new Map(
192
+ r.value.filter((n) => n !== e && n.externalSku).map((n) => [n.externalSku._id, n.internalSku.name])
193
+ );
194
+ return g.value.map((n) => {
195
+ const a = t.get(n._id);
196
+ return {
197
+ label: n.name,
198
+ value: n._id,
199
+ sublabel: a ? `Already linked to ${a}` : n.code,
200
+ disabled: !!a
201
+ };
202
+ });
203
+ }
204
+ function Y(e, t) {
205
+ e.externalSku = t ? g.value.find((n) => n._id === t) ?? null : null;
206
+ }
207
+ function le(e) {
208
+ b.open({
209
+ title: "Link partner item",
210
+ closeButton: !0,
211
+ zIndex: 300,
212
+ contentComponent: J,
213
+ contentComponentProps: {
214
+ modelValue: e.externalSku ? [e.externalSku._id] : [],
215
+ items: oe(e),
216
+ singleSelect: !0,
217
+ virtualScroll: !0
218
+ },
219
+ primaryActions: { text: "Link", close: !0 },
220
+ secondaryActions: { text: "Cancel", close: !0, variant: "tertiary" }
221
+ }).onPrimary((t) => Y(e, t[0] ?? null));
222
+ }
223
+ function se(e) {
224
+ r.value.splice(e, 1);
225
+ }
226
+ const W = A(
227
+ () => !!i.value && r.value.length > 0 && r.value.every(
228
+ (e) => (
229
+ // an item may stay unlinked (Not mapped) — only linked items need a valid equivalence;
230
+ // a zero/negative side would corrupt every transfer using it
231
+ !e.externalSku || e.quantity.amount > 0 && e.externalQuantity.amount > 0
232
+ )
233
+ )
234
+ );
235
+ async function ie() {
236
+ var e, t, n;
237
+ if (!(!W.value || !i.value)) {
238
+ R.value = !0;
239
+ try {
240
+ const a = {
241
+ targetBusinessId: i.value,
242
+ businessName: L(
243
+ ((e = v.currentBusiness.value) == null ? void 0 : e._id) ?? "",
244
+ (t = c.mapping) == null ? void 0 : t.businessName
245
+ ),
246
+ targetBusinessName: L(i.value, (n = c.mapping) == null ? void 0 : n.targetBusinessName),
247
+ skuPairs: r.value.filter((d) => d.externalSku).map((d) => ({
248
+ skuId: d.internalSku._id,
249
+ externalSkuId: d.externalSku._id,
250
+ quantity: d.quantity,
251
+ externalQuantity: d.externalQuantity
252
+ }))
253
+ };
254
+ c.mapping ? await x.update(c.mapping._id, a) : await x.create(a), B("saved"), O();
255
+ } catch (a) {
256
+ z.open({
257
+ title: "Failed to save mapping",
258
+ message: a instanceof Error ? a.message : "Please try again.",
259
+ type: "error"
260
+ }), console.error("Failed to save mapping", a);
261
+ } finally {
262
+ R.value = !1;
263
+ }
264
+ }
265
+ }
266
+ return (e, t) => {
267
+ const n = M("FmAvatar"), a = M("FmSelect"), d = M("FmButton"), f = M("FmIcon");
268
+ return m(), V(Q(h), {
269
+ modelValue: F.value,
270
+ "onUpdate:modelValue": t[4] || (t[4] = (l) => F.value = l),
271
+ header: e.mapping ? U(e.mapping.targetBusinessId) : "New mapping",
272
+ "max-width": 760
273
+ }, {
274
+ "side-sheet-footer": P(() => [
275
+ u("div", je, [
276
+ k(d, {
277
+ label: e.editable ? "Cancel" : "Close",
278
+ variant: "tertiary",
279
+ size: "md",
280
+ onClick: t[2] || (t[2] = (l) => O())
281
+ }, null, 8, ["label"]),
282
+ e.editable ? (m(), V(d, {
283
+ key: 0,
284
+ label: "Save mapping",
285
+ variant: "primary",
286
+ size: "md",
287
+ disabled: !W.value,
288
+ loading: R.value,
289
+ onClick: t[3] || (t[3] = (l) => ie())
290
+ }, null, 8, ["disabled", "loading"])) : I("", !0)
291
+ ])
292
+ ]),
293
+ default: P(() => [
294
+ u("div", Ve, [
295
+ t[7] || (t[7] = u("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Match your items with a partner business so stock transfers reconcile automatically. ", -1)),
296
+ k(a, {
297
+ label: "Business",
298
+ "label-mark": "required",
299
+ disabled: !e.editable || !!e.mapping,
300
+ modelValue: i.value,
301
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => i.value = l),
302
+ items: o.value
303
+ }, {
304
+ "menu-wrapper": P((l) => [
305
+ k(Be, X(l, {
306
+ items: o.value,
307
+ "model-value": i.value
308
+ }), {
309
+ "item-prefix": P(({ option: E }) => [
310
+ k(n, {
311
+ name: E.label,
312
+ size: "sm",
313
+ rounded: "md"
314
+ }, null, 8, ["name"])
315
+ ]),
316
+ _: 2
317
+ }, 1040, ["items", "model-value"])
318
+ ]),
319
+ default: P(() => [
320
+ u("div", Fe, [
321
+ i.value ? (m(), V(n, {
322
+ key: 0,
323
+ name: U(i.value),
324
+ size: "sm",
325
+ rounded: "md"
326
+ }, null, 8, ["name"])) : I("", !0),
327
+ u("span", Ie, C(i.value ? U(i.value) : "Select a business"), 1)
328
+ ])
329
+ ]),
330
+ _: 1
331
+ }, 8, ["disabled", "modelValue", "items"]),
332
+ u("div", Ce, [
333
+ t[5] || (t[5] = u("div", { class: "flex-1 fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, "Item mappings", -1)),
334
+ e.editable ? (m(), V(d, {
335
+ key: 0,
336
+ label: "Add items",
337
+ "prepend-icon": "add",
338
+ variant: "tertiary",
339
+ size: "md",
340
+ disabled: !i.value,
341
+ onClick: t[1] || (t[1] = (l) => ae())
342
+ }, null, 8, ["disabled"])) : I("", !0)
343
+ ]),
344
+ i.value ? r.value.length ? I("", !0) : (m(), w("div", Me, " No items yet. Add items from your catalog to map them. ")) : (m(), w("div", Ae, " Select a business first, then add the items you want to map. ")),
345
+ (m(!0), w(de, null, me(r.value, (l, E) => (m(), w("div", {
346
+ key: l.internalSku._id,
347
+ class: "border fm-corner-radius-md overflow-hidden"
348
+ }, [
349
+ u("div", Ne, [
350
+ u("div", Pe, [
351
+ u("div", $e, C(l.internalSku.name), 1),
352
+ u("div", ze, C(l.internalSku.code), 1)
353
+ ]),
354
+ k(f, {
355
+ name: "arrow_forward",
356
+ size: "sm",
357
+ color: "neutral-gray-400"
358
+ }),
359
+ u("div", Re, [
360
+ l.externalSku ? (m(), w("div", De, [
361
+ u("div", Ue, C(l.externalSku.name), 1),
362
+ u("div", qe, C(l.externalSku.code), 1)
363
+ ])) : e.editable ? (m(), V(d, {
364
+ key: 1,
365
+ label: "Link item",
366
+ "prepend-icon": "link",
367
+ variant: "secondary",
368
+ size: "md",
369
+ onClick: (N) => le(l)
370
+ }, null, 8, ["onClick"])) : (m(), w("span", Le, "Not linked"))
371
+ ]),
372
+ e.editable && l.externalSku ? (m(), V(d, {
373
+ key: 0,
374
+ icon: "link_off",
375
+ variant: "destructive",
376
+ size: "md",
377
+ onClick: (N) => Y(l, null)
378
+ }, null, 8, ["onClick"])) : I("", !0),
379
+ e.editable ? (m(), V(d, {
380
+ key: 1,
381
+ icon: "delete",
382
+ variant: "tertiary",
383
+ size: "md",
384
+ onClick: (N) => se(E)
385
+ }, null, 8, ["onClick"])) : I("", !0)
386
+ ]),
387
+ l.externalSku ? (m(), w("div", Qe, [
388
+ u("div", Ee, [
389
+ k(K, {
390
+ class: "w-[100px]",
391
+ disabled: !e.editable,
392
+ precision: 2,
393
+ "text-field-rules": [Q(Z)(0)],
394
+ modelValue: l.quantity,
395
+ "onUpdate:modelValue": (N) => l.quantity = N
396
+ }, null, 8, ["disabled", "text-field-rules", "modelValue", "onUpdate:modelValue"]),
397
+ u("span", Te, C(l.internalSku.unit.name), 1),
398
+ t[6] || (t[6] = u("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, "=", -1)),
399
+ k(K, {
400
+ class: "w-[100px]",
401
+ disabled: !e.editable,
402
+ precision: 2,
403
+ "text-field-rules": [Q(Z)(0)],
404
+ modelValue: l.externalQuantity,
405
+ "onUpdate:modelValue": (N) => l.externalQuantity = N
406
+ }, null, 8, ["disabled", "text-field-rules", "modelValue", "onUpdate:modelValue"]),
407
+ u("span", He, C(l.externalSku.unit.name), 1)
408
+ ])
409
+ ])) : I("", !0)
410
+ ]))), 128))
411
+ ])
412
+ ]),
413
+ _: 1
414
+ }, 8, ["modelValue", "header"]);
415
+ };
416
+ }
417
+ }), Ye = { class: "p-16" }, lt = /* @__PURE__ */ j({
418
+ __name: "ConnectedBusinessView",
419
+ setup($) {
420
+ const y = te(), h = ne(), { t: c } = ve(), B = S([]), x = S(!0), v = S(!1), p = S(null), b = A(() => {
421
+ var o, s;
422
+ return !!((s = (o = h.sessionUser.value) == null ? void 0 : o.role) != null && s.isAdmin);
423
+ });
424
+ function z(o) {
425
+ var F;
426
+ return ((F = (h.businesses.value ?? []).find((_) => _._id === o || _.id === o)) == null ? void 0 : F.name) ?? o;
427
+ }
428
+ function i(o) {
429
+ return o.targetBusinessName ?? z(o.targetBusinessId);
430
+ }
431
+ const r = [
432
+ {
433
+ id: "business",
434
+ header: "Partner business",
435
+ cell: (o) => {
436
+ const s = i(o.row.original);
437
+ return T("div", { class: "flex items-center gap-8" }, [
438
+ T(ee.FmAvatar, { name: s, size: "sm", rounded: "md" }),
439
+ T("span", { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, s)
440
+ ]);
441
+ }
442
+ },
443
+ {
444
+ id: "pairs",
445
+ header: "Items",
446
+ cell: (o) => {
447
+ const s = o.row.original.skuPairs.length;
448
+ return `${s} configured item${s === 1 ? "" : "s"}`;
449
+ }
450
+ },
451
+ {
452
+ id: "updatedAt",
453
+ header: "Updated",
454
+ cell: (o) => {
455
+ const s = o.row.original.updatedAt;
456
+ return s ? ye(s) : "—";
457
+ }
458
+ }
459
+ ];
460
+ async function g() {
461
+ x.value = !0;
462
+ try {
463
+ B.value = await y.browse();
464
+ } catch (o) {
465
+ console.error("Failed to load connected business mappings", o);
466
+ } finally {
467
+ x.value = !1;
468
+ }
469
+ }
470
+ ce(g);
471
+ function R() {
472
+ p.value = null, v.value = !0;
473
+ }
474
+ function D(o) {
475
+ p.value = o, v.value = !0;
476
+ }
477
+ function q() {
478
+ g();
479
+ }
480
+ const L = A(
481
+ () => [
482
+ // isAdminOnly wraps the button in FmAdminBadge, which itself only renders
483
+ // for role.isAdmin — the same boundary as canManage.
484
+ {
485
+ label: "New mapping",
486
+ value: "create",
487
+ isPrimary: !0,
488
+ prependIcon: "add",
489
+ isAdminOnly: !0
490
+ },
491
+ {
492
+ label: "Refresh",
493
+ value: "refresh",
494
+ prependIcon: "refresh"
495
+ }
496
+ ]
497
+ );
498
+ function U(o) {
499
+ if (o === "create") return R();
500
+ if (o === "refresh") return g();
501
+ }
502
+ return (o, s) => {
503
+ const F = M("FmTable");
504
+ return m(), V(be, {
505
+ title: Q(c)("inventory.connectedBusiness.title"),
506
+ actions: L.value,
507
+ "onClick:action": U
508
+ }, {
509
+ default: P(() => [
510
+ u("div", Ye, [
511
+ k(F, {
512
+ "column-defs": r,
513
+ "row-data": B.value,
514
+ loading: x.value,
515
+ onRowClick: s[0] || (s[0] = (_) => D(_.original))
516
+ }, null, 8, ["row-data", "loading"])
517
+ ]),
518
+ k(Oe, {
519
+ modelValue: v.value,
520
+ "onUpdate:modelValue": s[1] || (s[1] = (_) => v.value = _),
521
+ mapping: p.value,
522
+ editable: b.value,
523
+ onSaved: s[2] || (s[2] = (_) => q())
524
+ }, null, 8, ["modelValue", "mapping", "editable"])
525
+ ]),
526
+ _: 1
527
+ }, 8, ["title", "actions"]);
528
+ };
529
+ }
530
+ });
531
+ export {
532
+ lt as default
533
+ };
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as p, computed as f, watchEffect as d, resolveComponent as n, createElementBlock as _, openBlock as v, createVNode as o, createElementVNode as c } from "vue";
2
2
  import { useRouter as g } from "vue-router";
3
3
  import { useCoreStore as x } from "@feedmepos/mf-common";
4
- import { u as S } from "./useNavigationMenu-D2onvhoK.js";
5
- import { u as y } from "./feature-_v_0Btg8.js";
4
+ import { u as S } from "./useNavigationMenu-CeN7TEwe.js";
5
+ import { u as y } from "./feature-B4BoCy_k.js";
6
6
  const C = { class: "flex flex-col items-center w-full h-full gap-24" }, V = /* @__PURE__ */ p({
7
7
  __name: "DefaultView",
8
8
  setup(F) {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as x, computed as g, ref as h, onMounted as _, createElementBlock as i, openBlock as u, createElementVNode as t, createCommentVNode as d, createTextVNode as n, toDisplayString as l, Fragment as o, renderList as p, normalizeClass as c } from "vue";
2
2
  import { useRoute as w } from "vue-router";
3
- import { T as b } from "./app-VqA3hs6t.js";
4
- import { L as k } from "./lz-string-DaTOnDE7.js";
3
+ import { T as b } from "./app-37NZKFUI.js";
4
+ import { L as k } from "./lz-string-CItFpr5-.js";
5
5
  import { _ as N } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
6
  const P = { class: "purchase-box" }, A = { valign: "bottom" }, E = { class: "sub-header" }, C = ["src"], D = { style: { "padding-left": "10px" } }, O = { class: "address" }, R = { class: "text-right" }, S = {
7
7
  key: 0,