@feedmepos/mf-inventory-portal 1.7.1-dev.0 → 1.7.2-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 (136) hide show
  1. package/dist/{App-B_ja37tB.js → App-GsVnjJ5M.js} +5 -5
  2. package/dist/ApprovalView-DSPu2Gk5.js +242 -0
  3. package/dist/{BindingsDialog-0IRWCLTc.js → BindingsDialog-B9_lCD9R.js} +2 -2
  4. package/dist/{BindingsPicker-DCISa6Fx.js → BindingsPicker-ZKl53ZBk.js} +2 -2
  5. package/dist/{BindingsTable-B3CmHp97.js → BindingsTable-CLtS3u8f.js} +3 -3
  6. package/dist/BulkReceiveRequestView-BbHwEPzW.js +2011 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-D4Nd89xp.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-KgqYNGrB.js} +1 -1
  8. package/dist/ClosingDraftView-Ctc6-1-J.js +4496 -0
  9. package/dist/{ClosingHistoryView-KdmhszIO.js → ClosingHistoryView-CX9xtMvI.js} +7 -7
  10. package/dist/{ClosingTemplateView-CQRujMB9.js → ClosingTemplateView-BuoQegZF.js} +17 -17
  11. package/dist/{DefaultView-QAEDG6pS.js → DefaultView-BltV37jK.js} +2 -2
  12. package/dist/{DeliveryOrderPrintPreview-B08SSOCX.js → DeliveryOrderPrintPreview-CxzgxTJk.js} +2 -2
  13. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-DdzV_fzq.js → EmailDialog.vue_vue_type_script_setup_true_lang-5Hhoj-yj.js} +10225 -10398
  14. package/dist/{FmAdminBadge-DH_2w13D.js → FmAdminBadge-DlplQOHb.js} +8 -8
  15. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CmH3uhTZ.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-jTZNZIrW.js} +1 -1
  16. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BYTn-hpQ.js +76 -0
  17. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Df-yCfRe.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DLYrZfPo.js} +4 -4
  18. package/dist/{FmMultiselectDialog-QEs0yct_.js → FmMultiselectDialog-BxAfKkDh.js} +2 -2
  19. package/dist/{FmMultiselectDialog-DpPyNOpJ.js → FmMultiselectDialog-DF_inpi2.js} +1 -1
  20. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D8-IQUtA.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BYhQBazV.js} +119 -121
  21. package/dist/{ImportView-8qlgZSTO.js → ImportView-C76r6and.js} +8 -8
  22. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CGWRbAF2.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-By-9uV57.js} +1 -1
  23. package/dist/{IngredientGroupView-BI9SlKfz.js → IngredientGroupView-vRbMzHBS.js} +6 -6
  24. package/dist/{IngredientsView-1naUkKAi.js → IngredientsView-GMSV1cL0.js} +17 -17
  25. package/dist/{IntegrationExplorerView-C6kyLz3y.js → IntegrationExplorerView-ClhCRTC-.js} +5 -5
  26. package/dist/{IntegrationView-DrmxLdlk.js → IntegrationView-DM-TvYjd.js} +15 -15
  27. package/dist/{InventoryBindingForm-CPNAgZkD.js → InventoryBindingForm-CpY3n5Ug.js} +1 -1
  28. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-sz_VtHRr.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CEF1D6bJ.js} +5 -5
  29. package/dist/{InventoryBindingSummary-Cu98L10w.js → InventoryBindingSummary-CYOt-E-3.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-g2PDNQx-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-jZHUuEoU.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BZEa61go.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Bw1xCASs.js} +1 -1
  32. package/dist/{ProductionView-D8dxypqA.js → ProductionView-D6UC_XqI.js} +8 -8
  33. package/dist/{PublishView-C82UwIoz.js → PublishView-CuDaby-H.js} +4 -4
  34. package/dist/{PurchaseOrderPrintPreview-CP40tEma.js → PurchaseOrderPrintPreview-DcSuomzT.js} +2 -2
  35. package/dist/ReceiveRequestView-CMywjm4H.js +345 -0
  36. package/dist/{RecipeView-DB1DJQp7.js → RecipeView-BAcLGUEw.js} +18 -18
  37. package/dist/{SettingsView-DsS62lxW.js → SettingsView-Dy3VaVP2.js} +6 -6
  38. package/dist/{SingleColumnLayout.vue_vue_type_script_setup_true_lang-DWsPvPE1.js → SingleColumnLayout.vue_vue_type_script_setup_true_lang-DwrLsWX_.js} +1 -1
  39. package/dist/{StockView-gcf7RCZz.js → StockView-BFSFWXEY.js} +23 -23
  40. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-nXqFCKic.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B5qk8k2h.js} +1 -1
  41. package/dist/{SupplierView-BIANlKLE.js → SupplierView-BvZ4bdjb.js} +13 -13
  42. package/dist/{SurchargeView-kRzaixM5.js → SurchargeView-DEx1ncN0.js} +7 -7
  43. package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-DvjxSkiV.js +178 -0
  44. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BceIOuBq.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-raGPvWWz.js} +2 -2
  45. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dqn_ArEw.js +4660 -0
  46. package/dist/{TransferTemplateView-Bq68Vh7t.js → TransferTemplateView-DqwLSixK.js} +21 -21
  47. package/dist/{UnitCostHistoryView-d0oLssyZ.js → UnitCostHistoryView-BwuW604u.js} +6 -6
  48. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CLOotG6K.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DI4MfA6h.js} +4 -4
  49. package/dist/{UnitView-BHfm2IE4.js → UnitView-DBSX7myc.js} +8 -8
  50. package/dist/{WarehouseView-CorSYwm6.js → WarehouseView-D9BLSUaw.js} +6 -6
  51. package/dist/{WastageTemplateView-CtYZwiRW.js → WastageTemplateView-BV98TGlI.js} +15 -15
  52. package/dist/api/closing-draft.d.ts +5 -1
  53. package/dist/api/purchase-order.d.ts +1 -35
  54. package/dist/{app-37NZKFUI.js → app-D_Ym25tG.js} +5262 -5566
  55. package/dist/app.d.ts +24 -88
  56. package/dist/app.js +1 -1
  57. package/dist/{closing-template-C0dl45x2.js → closing-template-CgZ_4k-K.js} +1 -1
  58. package/dist/components/FmFilterableMenuOptions.vue.d.ts +2 -11
  59. package/dist/{date2-r4KgBCs9.js → date2-BJDb1yuY.js} +1 -1
  60. package/dist/{dayjs.min-BKUldDi9.js → dayjs.min-DaQY5dXC.js} +1 -1
  61. package/dist/{decimal-Cgmw6HIY.js → decimal-D7kHeIBp.js} +2 -2
  62. package/dist/{defineDeepModel-DXLwZWst.js → defineDeepModel-C6b9BBLr.js} +1 -1
  63. package/dist/{duplicate-template-DDA4QWPl.js → duplicate-template-B3efBcsm.js} +1 -1
  64. package/dist/feature-8uw1BmnH.js +1136 -0
  65. package/dist/{format-time-from-id-Dhjn5QgH.js → format-time-from-id-DLNUrReR.js} +1 -1
  66. package/dist/{format-unit-display-g95-VuYJ.js → format-unit-display-dedOq7Rd.js} +12 -12
  67. package/dist/{import-export.helper-DsZFPPqj.js → import-export.helper-CLJoNMDx.js} +6 -6
  68. package/dist/{index-B9WjF3Ox.js → index-BzcCCKB7.js} +1 -1
  69. package/dist/{index-C207KsUh.js → index-D0IvVK8C.js} +3 -3
  70. package/dist/{index-D3Bmmx66.js → index-K8Z-b9IK.js} +1 -1
  71. package/dist/{inventory-core-dart.default-NpD15h63.js → inventory-core-dart.default-DD-U6dYG.js} +5550 -7099
  72. package/dist/{jszip.min-B52cHzHI.js → jszip.min-D6DuQ9eP.js} +2 -2
  73. package/dist/{lz-string-CItFpr5-.js → lz-string-DPtdOdTM.js} +1 -1
  74. package/dist/{netsuite-R_NkLn5t.js → netsuite-6tmjDviW.js} +2 -2
  75. package/dist/{number-BkC_lelq.js → number-CMVOg7m3.js} +3 -3
  76. package/dist/{predefined-templates-CVT54o4V.js → predefined-templates-DfSWTcww.js} +1 -1
  77. package/dist/{purchase-order-template-DvqAncB2.js → purchase-order-template-GCzUtb6y.js} +1 -1
  78. package/dist/{recalculationUtils-Cak1mo4o.js → recalculationUtils-CSBScoyF.js} +1 -1
  79. package/dist/router/name.d.ts +0 -1
  80. package/dist/{rules--cnFg-PI.js → rules-pC-W9ghI.js} +2 -2
  81. package/dist/{stock-BLYAJxMj.js → stock-C0lKfZnz.js} +1 -1
  82. package/dist/{stock-DvquSog3.js → stock-CIpjxe6A.js} +3 -3
  83. package/dist/stores/feature.d.ts +0 -2
  84. package/dist/style.css +1 -1
  85. package/dist/{supplier-C5X8p_vd.js → supplier-eYlqSO4X.js} +2 -2
  86. package/dist/{surcharge-CLkpleoW.js → surcharge-CX5M8xDS.js} +1 -1
  87. package/dist/tsconfig.app.tsbuildinfo +1 -1
  88. package/dist/{uom-rules-CykFo_pB.js → uom-rules-CfUOdeZ4.js} +1 -1
  89. package/dist/{use-ingredient-select-dialog-DlxWMkAI.js → use-ingredient-select-dialog-DYRHuZLi.js} +2 -2
  90. package/dist/{use-inventory-binding-dialog-DnWDyziu.js → use-inventory-binding-dialog-CQahb9Rn.js} +2 -2
  91. package/dist/{use-template-enabled-locations-SRgcWLO4.js → use-template-enabled-locations-BOO-eQch.js} +2 -2
  92. package/dist/{use-transfer-locations-D4f4Ib1r.js → use-transfer-locations-Ffdy6Z9C.js} +2 -2
  93. package/dist/{useHrmPermission-lAc6ZHVZ.js → useHrmPermission-CXSUDdlQ.js} +1 -1
  94. package/dist/{useNavigationMenu-CeN7TEwe.js → useNavigationMenu-DfW5RBKu.js} +49 -59
  95. package/dist/{useSseClient-C6ndlLpA.js → useSseClient-Bl-WWwFk.js} +1 -1
  96. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +6 -2
  97. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +4 -4
  98. package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupAction.vue.d.ts +2 -2
  99. package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +2 -2
  100. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +6 -6
  101. package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +1 -1
  102. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +12 -12
  103. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +0 -1
  104. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +0 -1
  105. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +2 -102
  106. package/dist/views/receive-request/composables/fn.d.ts +1 -2
  107. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +3 -119
  108. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +14 -643
  109. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +15 -721
  110. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +10 -524
  111. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +2 -102
  112. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +0 -4
  113. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +0 -8
  114. package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +0 -12
  115. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +0 -24
  116. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +0 -24
  117. package/dist/{vue-i18n-DDqVG60p.js → vue-i18n-BAu5G_RB.js} +152 -152
  118. package/dist/{xlsx.util-BzQcPwvM.js → xlsx.util-BgM338n0.js} +2 -2
  119. package/package.json +5 -5
  120. package/dist/ApprovalView-_wG6KeZl.js +0 -249
  121. package/dist/BulkReceiveRequestView-Dmqm65c9.js +0 -2025
  122. package/dist/ClosingDraftView-DDWU93p0.js +0 -4398
  123. package/dist/ConnectedBusinessView-Cu2QnRN9.js +0 -533
  124. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dzqh8pM9.js +0 -84
  125. package/dist/ReceiveRequestView-DDo0Pb0J.js +0 -514
  126. package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-QMUVuthC.js +0 -211
  127. package/dist/TransferDetailsV3.vue_vue_type_script_setup_true_lang-DYAzxoHE.js +0 -5991
  128. package/dist/api/connected-business-mapping.d.ts +0 -25
  129. package/dist/connected-business-mapping-ywgqqyMr.js +0 -37
  130. package/dist/feature-B4BoCy_k.js +0 -1548
  131. package/dist/views/connected-business/ConnectedBusinessMappingPanel.vue.d.ts +0 -25
  132. package/dist/views/connected-business/ConnectedBusinessView.vue.d.ts +0 -2
  133. package/dist/views/receive-request/components/CreateTransferChoice.vue.d.ts +0 -27
  134. package/dist/views/receive-request/components/transfer-details/TransferDetailsV3.vue.d.ts +0 -18
  135. package/dist/views/receive-request/helper/po-version.d.ts +0 -6
  136. /package/dist/views/{receive-request/composables/fn.spec.d.ts → closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.spec.d.ts} +0 -0
@@ -1,533 +0,0 @@
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,84 +0,0 @@
1
- import { defineComponent as I, mergeModels as z, useModel as B, computed as b, ref as S, resolveComponent as n, createElementBlock as h, openBlock as o, normalizeStyle as _, createElementVNode as f, createVNode as N, withCtx as k, createBlock as s, createCommentVNode as F, Fragment as E, renderList as $, unref as r, createSlots as R, renderSlot as T } from "vue";
2
- import { z as i } from "./app-37NZKFUI.js";
3
- import { F as q } from "./FmMultiselectDialog-QEs0yct_.js";
4
- const x = { class: "overflow-y-auto h-full pb-8" }, O = /* @__PURE__ */ I({
5
- __name: "FmFilterableMenuOptions",
6
- props: /* @__PURE__ */ z({
7
- modelValue: {},
8
- maxHeight: {},
9
- width: {},
10
- handleItemChange: { type: Function },
11
- items: {},
12
- options: {}
13
- }, {
14
- search: {},
15
- searchModifiers: {}
16
- }),
17
- emits: ["update:search"],
18
- setup(m) {
19
- const y = m, t = B(m, "search"), V = b(
20
- () => new q(y.items, ["label", "sublabel"], {
21
- caseSensitive: !1,
22
- sort: !0
23
- })
24
- ), u = b(() => V.value.search(t.value)), w = S();
25
- return (l, a) => {
26
- const C = n("FmButton"), M = n("FmTextField"), d = n("FmMenuItem");
27
- return o(), h("div", {
28
- class: "relative",
29
- style: _({ width: l.width })
30
- }, [
31
- f("div", {
32
- class: "sticky top-0 bg-white mb-8",
33
- ref_key: "stickyRef",
34
- ref: w
35
- }, [
36
- N(M, {
37
- modelValue: t.value,
38
- "onUpdate:modelValue": a[1] || (a[1] = (e) => t.value = e),
39
- placeholder: "Filter options"
40
- }, {
41
- append: k(() => [
42
- t.value ? (o(), s(C, {
43
- key: 0,
44
- variant: "tertiary",
45
- "prepend-icon": "close",
46
- onClick: a[0] || (a[0] = (e) => t.value = "")
47
- })) : F("", !0)
48
- ]),
49
- _: 1
50
- }, 8, ["modelValue"])
51
- ], 512),
52
- f("div", x, [
53
- (o(!0), h(E, null, $(u.value, (e, g) => (o(), s(d, {
54
- key: g,
55
- label: e.label,
56
- sublabel: e.sublabel,
57
- "model-value": r(i)(l.modelValue, e.value),
58
- onClick: () => l.handleItemChange(r(i)(l.modelValue, e.value), e),
59
- onVnodeMounted: (c) => {
60
- var p, v;
61
- return r(i)(l.modelValue, e.value) && ((p = c.el) == null || p.scrollIntoView({ behavior: "instant", block: "end" }), (v = c.el) == null || v.scrollIntoView({ behavior: "smooth", block: "center" })), void 0;
62
- }
63
- }, R({ _: 2 }, [
64
- l.$slots["item-prefix"] ? {
65
- name: "prepend",
66
- fn: k(() => [
67
- T(l.$slots, "item-prefix", { option: e })
68
- ]),
69
- key: "0"
70
- } : void 0
71
- ]), 1032, ["label", "sublabel", "model-value", "onClick", "onVnodeMounted"]))), 128)),
72
- u.value.length ? F("", !0) : (o(), s(d, {
73
- key: 0,
74
- disabled: "",
75
- label: "No options available"
76
- }))
77
- ])
78
- ], 4);
79
- };
80
- }
81
- });
82
- export {
83
- O as _
84
- };