@feedmepos/mf-inventory-portal 0.0.19-dev.12 → 0.0.19-dev.14

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 (178) hide show
  1. package/dist/App.vue.d.ts +1 -1
  2. package/dist/{ApprovalView-CuTAFiWC.js → ApprovalView-BY13XuOu.js} +5 -5
  3. package/dist/{BindingsDialog-C_ndNZ8f.js → BindingsDialog-B3PP-XkE.js} +22 -22
  4. package/dist/{BindingsPicker-CcAod_ha.js → BindingsPicker-DL17pRty.js} +17 -17
  5. package/dist/{BindingsTable-Bm4-kj_a.js → BindingsTable-CjKOv7Yw.js} +29 -29
  6. package/dist/Entry.vue.d.ts +1 -1
  7. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DoF7wwNT.js +306 -0
  8. package/dist/{IngredientsView-CyD65_rv.js → IngredientsView-C-rsKAsF.js} +294 -294
  9. package/dist/{IntegrationView-Bh1BWAq-.js → IntegrationView-BkhfPSjM.js} +278 -278
  10. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-cw3SEkW_.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Buc21sEN.js} +1 -1
  11. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-B_kVFkxk.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BRijSilS.js} +1 -1
  12. package/dist/PurchaseOrderPrintPreview-CGMMozPA.js +152 -0
  13. package/dist/{ReceiveRequestView-C0r1FIwM.js → ReceiveRequestView-Bk0pUeEm.js} +7 -7
  14. package/dist/{RecipeView-CYE6gi__.js → RecipeView-kzA9kIg8.js} +181 -181
  15. package/dist/Standalone.vue.d.ts +1 -1
  16. package/dist/{StockView-CKyhKuGi.js → StockView-DF-ucES_.js} +23 -23
  17. package/dist/SupplierView-XlzsU00G.js +813 -0
  18. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-8L6lwGpu.js → TransferDetails.vue_vue_type_script_setup_true_lang-Bp7AJiJ-.js} +106 -106
  19. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-D1NAkXMT.js +1690 -0
  20. package/dist/TransferTemplateView-CsA2SzQY.js +1279 -0
  21. package/dist/{UnitView-DXnLq5nR.js → UnitView-9VMIlEZ_.js} +242 -242
  22. package/dist/{WarehouseView-BCnvqHHp.js → WarehouseView-JTYLFBsu.js} +360 -362
  23. package/dist/api/bill.d.ts +238 -84
  24. package/dist/api/supplier.d.ts +4 -4
  25. package/dist/app-kYGuBDV8.js +68549 -0
  26. package/dist/app.d.ts +24 -0
  27. package/dist/app.js +3 -3
  28. package/dist/components/ChangeLocationComponent.vue.d.ts +11 -1
  29. package/dist/components/DeferableLoading.vue.d.ts +1 -1
  30. package/dist/components/DeleteDialog.vue.d.ts +1 -1
  31. package/dist/components/FmCoordinateInput.vue.d.ts +3 -3
  32. package/dist/components/FmDroppableField.vue.d.ts +6 -6
  33. package/dist/components/FmFilterableSelect.vue.d.ts +3 -3
  34. package/dist/components/FmInventoryTableToolbar.vue.d.ts +21 -10
  35. package/dist/components/FmMinMaxInput.vue.d.ts +20 -0
  36. package/dist/components/FmMinMaxInputProps.d.ts +16 -0
  37. package/dist/components/FmMinMaxInputRules.d.ts +4 -0
  38. package/dist/components/FmMultiselectDialog.vue.d.ts +5 -5
  39. package/dist/components/FmMultiselectDialogProps.d.ts +3 -0
  40. package/dist/components/FmUnitInputRules.d.ts +1 -0
  41. package/dist/components/MultiSelectDialog.vue.d.ts +1 -1
  42. package/dist/components/NavigationTab.vue.d.ts +1 -1
  43. package/dist/components/NumberPrecisionInput.vue.d.ts +3 -3
  44. package/dist/components/PremiumBadge.vue.d.ts +3 -3
  45. package/dist/components/PreviewBadge.vue.d.ts +3 -3
  46. package/dist/components/StockForecast.vue.d.ts +1 -1
  47. package/dist/components/TableActionableRow.vue.d.ts +4 -4
  48. package/dist/components/UnitDisplayControl.vue.d.ts +1 -1
  49. package/dist/components/icons/IconCommunity.vue.d.ts +1 -1
  50. package/dist/components/icons/IconDocumentation.vue.d.ts +1 -1
  51. package/dist/components/icons/IconEcosystem.vue.d.ts +1 -1
  52. package/dist/components/icons/IconSupport.vue.d.ts +1 -1
  53. package/dist/components/icons/IconTooling.vue.d.ts +1 -1
  54. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
  55. package/dist/components/map/CoordinateDialog.vue.d.ts +4 -4
  56. package/dist/components/map/GoogleMap.vue.d.ts +6 -6
  57. package/dist/components/nested-multiselect/FmNestedMultiselectDialog.vue.d.ts +3 -3
  58. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +3 -3
  59. package/dist/components/shell/inventory/binding-ui.vue.d.ts +5 -5
  60. package/dist/components/ui-library/FmDateRangePickerChip.vue.d.ts +5 -5
  61. package/dist/composable/useIframe.d.ts +1 -1
  62. package/dist/composable/useSearch.d.ts +1 -1
  63. package/dist/{decimal-DN0h6619.js → decimal-E3w4eGHF.js} +1 -1
  64. package/dist/helper/number.d.ts +2 -0
  65. package/dist/{id-to-date-D1fU6Y7T.js → id-to-date-gyR82hWy.js} +1 -1
  66. package/dist/is-linked-ingredient-error-fJ2TJb3z.js +37 -0
  67. package/dist/layout/InventoryLayout.vue.d.ts +1 -1
  68. package/dist/layout/SingleColumnLayout.vue.d.ts +5 -5
  69. package/dist/layout/components/NavigationButton.vue.d.ts +4 -4
  70. package/dist/{layout-DcSLry7F.js → layout-BTYR4n3X.js} +1 -1
  71. package/dist/{purchase-order-transaction-type-D0c31GiL.js → purchase-order-transaction-type-CUtdDhYo.js} +2 -2
  72. package/dist/stores/feature.d.ts +2 -1
  73. package/dist/stores/location.d.ts +108 -148
  74. package/dist/stores/supplier.d.ts +672 -18
  75. package/dist/stores/warehouse.d.ts +9 -5
  76. package/dist/supplier-Ed-Bva_-.js +60 -0
  77. package/dist/tsconfig.app.tsbuildinfo +1 -1
  78. package/dist/views/InventoryView.vue.d.ts +1 -1
  79. package/dist/views/SelectBussinessDialog.vue.d.ts +1 -1
  80. package/dist/views/approval/ApprovalView.vue.d.ts +1 -1
  81. package/dist/views/dev/ComponentPreview.vue.d.ts +1 -1
  82. package/dist/views/dev/components/CoordinateTest.vue.d.ts +1 -1
  83. package/dist/views/dev/components/DateRange.vue.d.ts +1 -1
  84. package/dist/views/dev/components/FmDecimalInputTest.vue.d.ts +1 -1
  85. package/dist/views/dev/components/FmMultiselectDialogGrouped.vue.d.ts +1 -1
  86. package/dist/views/dev/components/FmSelectTest.vue.d.ts +1 -1
  87. package/dist/views/dev/components/InventoryIframe.vue.d.ts +1 -1
  88. package/dist/views/dev/components/LayoutDev.vue.d.ts +1 -1
  89. package/dist/views/dev/components/MfCommontTest.vue.d.ts +1 -1
  90. package/dist/views/dev/components/NestedSelection.vue.d.ts +1 -1
  91. package/dist/views/dev/components/NumberStepper.vue.d.ts +1 -1
  92. package/dist/views/dev/components/TabStorageTest.vue.d.ts +1 -1
  93. package/dist/views/dev/components/UnitInput.vue.d.ts +1 -1
  94. package/dist/views/dev/helpers/pinia-test.d.ts +1 -1
  95. package/dist/views/home/HomeView.vue.d.ts +1 -1
  96. package/dist/views/iframe/inventory-bindings/bindings-dialog/BindingsDialog.vue.d.ts +1 -1
  97. package/dist/views/iframe/inventory-bindings/bindings-picker/BindingsPicker.vue.d.ts +1 -1
  98. package/dist/views/iframe/inventory-bindings/bindings-table/BindingsTable.vue.d.ts +1 -1
  99. package/dist/views/ingredients/IngredientsView.vue.d.ts +1 -1
  100. package/dist/views/ingredients/components/cannot-delete/CannotDelete.vue.d.ts +4 -4
  101. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +3 -3
  102. package/dist/views/ingredients/components/import-ingredients/ImportIngredientItem.vue.d.ts +1 -1
  103. package/dist/views/ingredients/components/import-ingredients/ImportIngredients.vue.d.ts +1 -1
  104. package/dist/views/ingredients/components/ingredient-binded-item/IngredientBindedItem.vue.d.ts +1 -1
  105. package/dist/views/ingredients/components/ingredient-dialog/IngredientDialog.vue.d.ts +5 -5
  106. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -4
  107. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
  108. package/dist/views/ingredients/components/inventory-binding/InventoryBindingSummary.vue.d.ts +3 -3
  109. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +8 -8
  110. package/dist/views/integration/IntegrationView.vue.d.ts +1 -1
  111. package/dist/views/integration/components/ApplyAddon.vue.d.ts +5 -5
  112. package/dist/views/integration/components/ApplyProduct.vue.d.ts +5 -5
  113. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +5 -5
  114. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +5 -5
  115. package/dist/views/receive-request/ReceiveRequestView.vue.d.ts +1 -1
  116. package/dist/views/receive-request/components/supplier-price-history/SupplierPriceHistory.vue.d.ts +1 -1
  117. package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +3 -3
  118. package/dist/views/receive-request/components/transfer-dialog/TransferDialog.vue.d.ts +4 -4
  119. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +4 -4
  120. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +27 -27
  121. package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +4 -4
  122. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -4
  123. package/dist/views/receive-request/components/transfer-form/components/TransferItem.vue.d.ts +3 -3
  124. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +3 -3
  125. package/dist/views/receive-request/components/transfer-form/composables/use-backdate-po.d.ts +4 -4
  126. package/dist/views/receive-request/components/transfer-form/composables/use-compare-price.d.ts +3 -3
  127. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +0 -8
  128. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1012 -66
  129. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +24 -24
  130. package/dist/views/receive-request/print-preview/PurchaseOrderPrintPreview.vue.d.ts +1 -1
  131. package/dist/views/recipe/RecipeView.vue.d.ts +1 -1
  132. package/dist/views/recipe/components/recipe-dialog/RecipeDialog.vue.d.ts +5 -5
  133. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +4 -4
  134. package/dist/views/recipe/composables/use-recipe-form.d.ts +8 -8
  135. package/dist/views/stock/StockView.vue.d.ts +1 -1
  136. package/dist/views/stock/components/StockHeaderPreview.vue.d.ts +1 -1
  137. package/dist/views/stock/components/StockHistory.vue.d.ts +3 -3
  138. package/dist/views/stock/components/StockRecalculateDialog.vue.d.ts +2 -2
  139. package/dist/views/stock/components/StockRecordCard.vue.d.ts +123 -46
  140. package/dist/views/stock/components/dialog/AdjustSkuDialog.vue.d.ts +4 -4
  141. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +3 -3
  142. package/dist/views/stock/components/dialog/ConvertSkuDialog.vue.d.ts +4 -4
  143. package/dist/views/stock/composables/use-stock-action.d.ts +11 -11
  144. package/dist/views/supplier/SupplierView.vue.d.ts +1 -1
  145. package/dist/views/supplier/components/SupplierDialog.vue.d.ts +4 -4
  146. package/dist/views/supplier/components/SupplierDialogProps.d.ts +1 -0
  147. package/dist/views/supplier/components/SupplierForm.vue.d.ts +10 -10
  148. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -3
  149. package/dist/views/supplier/composables/use-supplier-table.d.ts +3 -3
  150. package/dist/views/transfer-template/TransferTemplateView.vue.d.ts +1 -1
  151. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +3 -3
  152. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +4 -4
  153. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +2 -2
  154. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +3 -3
  155. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +7 -7
  156. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +13 -8
  157. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1020 -79
  158. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +309 -11
  159. package/dist/views/unit/UnitView.vue.d.ts +1 -1
  160. package/dist/views/unit/components/unit-dialog/UnitDialog.vue.d.ts +5 -5
  161. package/dist/views/unit/components/unit-form/UnitForm.vue.d.ts +4 -4
  162. package/dist/views/unit/components/unit-summary/UnitSummary.vue.d.ts +3 -3
  163. package/dist/views/unit/components/unit-used-by/UnitUsedBy.vue.d.ts +1 -1
  164. package/dist/views/unit/composables/use-unit-form.d.ts +8 -8
  165. package/dist/views/warehouse/WarehouseView.vue.d.ts +1 -1
  166. package/dist/views/warehouse/components/WarehouseDialog.vue.d.ts +4 -4
  167. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +22 -14
  168. package/dist/{xlsx-yV2SoDMC.js → xlsx-q6Ctgevr.js} +2759 -2759
  169. package/dist/{xlsx.util-CTIDgqw2.js → xlsx.util-Cvqg56mI.js} +2 -2
  170. package/package.json +4 -3
  171. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-rDMoAXyd.js +0 -272
  172. package/dist/PurchaseOrderPrintPreview-Uf0aO8n1.js +0 -152
  173. package/dist/SupplierView-BSJoZFMr.js +0 -801
  174. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-Bdby-n4P.js +0 -1676
  175. package/dist/TransferTemplateView-B23JFk-I.js +0 -1101
  176. package/dist/app-DDxzU9iC.js +0 -67196
  177. package/dist/is-linked-ingredient-error-C6AghEwR.js +0 -37
  178. package/dist/supplier-CQXRbSC3.js +0 -54
@@ -1,1101 +0,0 @@
1
- import { reactive as Le, onMounted as Be, computed as E, h as D, defineComponent as ne, resolveComponent as O, openBlock as F, createElementBlock as z, createElementVNode as s, toDisplayString as k, createVNode as m, unref as e, withCtx as I, watch as Fe, ref as Q, createBlock as H, normalizeClass as Ne, isRef as Ae, createCommentVNode as oe, Fragment as De, renderList as ze, normalizeStyle as He, Teleport as je, mergeProps as ge, normalizeProps as Qe, guardReactiveProps as Ye } from "vue";
2
- import { _ as Ke, a as Ge } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-rDMoAXyd.js";
3
- import { useI18n as Y } from "@feedmepos/mf-common";
4
- import { c as le, d as Je, u as We, a as Xe, b as xe, e as Ze, _ as et } from "./TransferDialog.vue_vue_type_script_setup_true_lang-Bdby-n4P.js";
5
- import { F as ae, R as Ce } from "./row-action.enum-PMKMRrZR.js";
6
- import { D as ke, R as de, $ as Te, a0 as tt, a as ue, r as we, a1 as st, l as Se, A as me, M as $e, G as Oe, a2 as ot, a3 as Re, b as Ve, u as at, j as Ie, y as lt, a4 as nt, a5 as rt } from "./app-DDxzU9iC.js";
7
- import { F as U, _ as Me, u as it } from "./layout-DcSLry7F.js";
8
- import { useBreakpoints as Pe, components as j, FmButtonVariant as ut, useDialog as dt, useSnackbar as mt, useProxiedModel as Ue } from "@feedmepos/ui-library";
9
- import { storeToRefs as ct } from "pinia";
10
- import { P as V, f as pt, a as ft } from "./purchase-order-transaction-type-D0c31GiL.js";
11
- import { _ as Ee } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-B_kVFkxk.js";
12
- import { useRouter as yt } from "vue-router";
13
- import { u as vt } from "./supplier-CQXRbSC3.js";
14
- var $ = /* @__PURE__ */ ((u) => (u.Code = "Code", u.Name = "Name", u.DefaultAmount = "DefaultAmount", u.MinimumAmount = "MinimumAmount", u.Step = "Step", u.Cost = "Cost", u.Delete = "Delete", u))($ || {});
15
- const _t = () => {
16
- const { t: u } = Y();
17
- return D(
18
- Ee,
19
- {
20
- zIndex: 50,
21
- class: "whitespace-nowrap"
22
- },
23
- u("inventory.transfer.form.items.table.Cost", [Re()])
24
- );
25
- };
26
- function bt(u) {
27
- const { t: T } = Y(), p = Le({}), { breakpoints: i } = Pe();
28
- Be(() => {
29
- for (const n of u.items) {
30
- if (!n.totalCost)
31
- continue;
32
- const t = le(n.sku, n.quantity, n.measurement, {
33
- supplier: u.supplier
34
- }), d = n.totalCost ?? ke.reset();
35
- t ? p[n.sku._id] = t.amount !== d.amount || t.precision !== d.precision : p[n.sku._id] = !0;
36
- }
37
- });
38
- function c(n) {
39
- var d, f, h, x, w, S, R;
40
- return !!(((f = (d = n.defaultCost) == null ? void 0 : d.costPerUnit) == null ? void 0 : f.amount) ?? ((R = (S = (w = (x = (h = u.supplier) == null ? void 0 : h.supplyItems) == null ? void 0 : x.find((M) => M.skuId === n._id)) == null ? void 0 : w.defaultCost) == null ? void 0 : S.costPerUnit) == null ? void 0 : R.amount));
41
- }
42
- const v = [
43
- {
44
- id: "Code",
45
- header: () => T("inventory.transfer.form.items.table.Code"),
46
- accessorKey: "code",
47
- size: 96,
48
- cell(n) {
49
- const t = n.row.original;
50
- return D(j.FmTextField, {
51
- modelValue: t.code,
52
- "onUpdate:modelValue": (d) => {
53
- u.updateItem({
54
- ...t,
55
- code: d
56
- });
57
- },
58
- key: t.sku._id,
59
- rules: [de()],
60
- labelMark: "required"
61
- });
62
- },
63
- enableSorting: !1
64
- },
65
- {
66
- id: "Name",
67
- header: () => T("inventory.transfer.form.items.table.Name"),
68
- minSize: 300,
69
- cell(n) {
70
- const t = n.row.original;
71
- return D(j.FmTextField, {
72
- modelValue: t.name,
73
- "onUpdate:modelValue": (d) => {
74
- u.updateItem({
75
- ...t,
76
- name: d
77
- });
78
- },
79
- key: t.sku._id,
80
- rules: [de()],
81
- labelMark: "required"
82
- });
83
- },
84
- enableSorting: !1
85
- },
86
- {
87
- id: "DefaultAmount",
88
- header: () => T("inventory.transfer.form.items.table.DefaultAmount2"),
89
- minSize: 150,
90
- cell(n) {
91
- const t = n.row.original;
92
- return D(Te, {
93
- style: {
94
- flex: "1 1 0%"
95
- },
96
- modelValue: {
97
- amount: t.quantity ?? { amount: 1, precision: 0 },
98
- measurement: t.measurement ?? null
99
- },
100
- disabled: u.disabled,
101
- key: t.sku._id,
102
- unit: t.sku.unit,
103
- "onUpdate:modelValue": (d) => {
104
- u.updateItem({
105
- ...t,
106
- quantity: d.amount,
107
- measurement: d.measurement
108
- });
109
- },
110
- rules: [
111
- tt(
112
- +ue(
113
- t.minimumQuantity ?? {
114
- amount: 1,
115
- precision: we(t.sku.unit, t.measurement)
116
- }
117
- )
118
- )
119
- ],
120
- applyDefaultRules: !0
121
- });
122
- },
123
- enableSorting: !1
124
- },
125
- {
126
- id: "MinimumAmount",
127
- header: () => T("inventory.transfer.form.items.table.MinimumAmount2"),
128
- minSize: 124,
129
- cell(n) {
130
- const t = n.row.original;
131
- return D(Te, {
132
- style: {
133
- flex: "1 1 0%"
134
- },
135
- modelValue: {
136
- amount: t.minimumQuantity ?? {
137
- amount: 1,
138
- precision: we(t.sku.unit, t.measurement)
139
- },
140
- measurement: t.measurement ?? null
141
- },
142
- disabled: u.disabled,
143
- key: t.sku._id,
144
- unit: t.sku.unit,
145
- "onUpdate:modelValue": (d) => {
146
- u.updateItem({
147
- ...t,
148
- minimumQuantity: d.amount
149
- });
150
- },
151
- rules: [st(0)],
152
- disableUnit: !0,
153
- applyDefaultRules: !0
154
- });
155
- },
156
- enableSorting: !1
157
- },
158
- {
159
- id: "Step",
160
- header: () => T("inventory.transfer.form.items.table.Step"),
161
- minSize: 100,
162
- cell(n) {
163
- const t = n.row.original;
164
- return D(j.FmTextField, {
165
- modelValue: ue(t.quantityStep ?? ke.reset(), !1),
166
- key: t.sku._id,
167
- "onUpdate:modelValue": (d) => {
168
- u.updateItem({
169
- ...t,
170
- quantityStep: Se(+d)
171
- });
172
- },
173
- rules: [me(0), $e(t.sku.unit, t.measurement)]
174
- });
175
- },
176
- enableSorting: !1
177
- },
178
- {
179
- id: "Cost",
180
- header: _t,
181
- size: 180,
182
- cell(n) {
183
- const t = n.row.original, d = c(t.sku), f = i.value.xs || i.value.sm;
184
- return !p[t.sku._id] && d ? D(
185
- "div",
186
- {
187
- class: "flex gap-4 fm-typo-en-body-md-400 items-center",
188
- key: t.sku._id
189
- },
190
- [
191
- D(j.FmButton, {
192
- prependIcon: "edit",
193
- variant: ut.Tertiary,
194
- onClick() {
195
- u.updateItem({
196
- ...t,
197
- totalCost: le(t.sku, t.quantity, t.measurement, {
198
- supplier: u.supplier
199
- })
200
- }), p[t.sku._id] = !0;
201
- },
202
- disabled: u.disabled
203
- }),
204
- D(
205
- "div",
206
- {
207
- class: "flex flex-col"
208
- },
209
- [
210
- D(
211
- "span",
212
- {
213
- class: [u.disabled ? "text-fm-color-typo-disabled" : ""]
214
- },
215
- f ? Oe(
216
- le(t.sku, t.quantity, t.measurement, {
217
- supplier: u.supplier
218
- })
219
- ) : ue(
220
- le(t.sku, t.quantity, t.measurement, {
221
- supplier: u.supplier
222
- })
223
- )
224
- ),
225
- D(
226
- "span",
227
- {
228
- class: [
229
- "fm-typo-en-body-sm-400",
230
- u.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
231
- ]
232
- },
233
- T("inventory.transfer.form.items.autoCalculated")
234
- )
235
- ]
236
- )
237
- ]
238
- ) : D(
239
- j.FmTextField,
240
- {
241
- modelValue: ue(t.totalCost ?? { amount: 0, precision: 0 }),
242
- key: t.sku._id,
243
- "onUpdate:modelValue": (h) => {
244
- u.updateItem({
245
- ...t,
246
- totalCost: {
247
- ...Se(+h),
248
- currency: ot()
249
- }
250
- });
251
- },
252
- rules: [me(0), $e(2)]
253
- },
254
- {
255
- prepend() {
256
- return f ? D(
257
- "div",
258
- {
259
- class: [
260
- "text-fm-typo-en-body-lg-400",
261
- u.disabled ? "text-fm-color-typo-disabled" : ""
262
- ]
263
- },
264
- Re()
265
- ) : null;
266
- },
267
- append() {
268
- return d ? D(j.FmButton, {
269
- prependIcon: "close",
270
- variant: "tertiary",
271
- onClick() {
272
- u.updateItem({
273
- ...t,
274
- totalCost: null
275
- }), p[t.sku._id] = !1;
276
- },
277
- disabled: u.disabled
278
- }) : null;
279
- }
280
- }
281
- );
282
- },
283
- enableSorting: !1
284
- },
285
- {
286
- id: "Delete",
287
- header: "",
288
- cell(n) {
289
- const t = n.row.original;
290
- return D(j.FmButton, {
291
- class: "delete-button",
292
- key: t.sku._id,
293
- type: "button",
294
- icon: "delete",
295
- variant: "tertiary",
296
- size: "md",
297
- disabled: u.disabled,
298
- onClick: () => {
299
- u.deleteItem(t);
300
- }
301
- });
302
- },
303
- enableSorting: !1,
304
- size: 40,
305
- meta: {
306
- cellClass: "",
307
- headerClass: ""
308
- }
309
- }
310
- ];
311
- return {
312
- columnDefs: E(() => Ve().enableTotalCost && u.transferType === V.PURCHASE ? v : v.filter((t) => t.id !== "Cost"))
313
- };
314
- }
315
- const ht = { class: "flex flex-col gap-8 py-16" }, gt = { class: "flex items-center" }, xt = { class: "flex-1 flex gap-1 items-center" }, Ct = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, kt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Tt = { class: "flex gap-8 w-full" }, wt = { class: "flex-1 flex flex-col gap-4" }, St = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), $t = { class: "flex-1 flex flex-col gap-4" }, Ft = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), At = { class: "flex gap-8 w-full" }, Dt = { class: "flex-1 flex flex-col gap-4" }, Ot = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Rt = { class: "flex-1 flex flex-col gap-4" }, Vt = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), It = { class: "flex gap-8 w-full" }, Mt = { class: "flex-1 flex flex-col gap-4" }, Pt = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Ut = { class: "flex-1 flex flex-col gap-4" }, Et = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), qt = /* @__PURE__ */ ne({
316
- __name: "TransferTemplateItem",
317
- props: {
318
- cellByColId: {},
319
- row: {}
320
- },
321
- setup(u) {
322
- const { t: T } = Y();
323
- return (p, i) => {
324
- var v, g, n, t, d, f, h, x, w, S, R, M, q, a, l, o, r, C, _, y, A, b, P, L, K, G, J, W, B, X, Z, ee, te, N, se;
325
- const c = O("FmLabel");
326
- return F(), z("div", ht, [
327
- s("div", gt, [
328
- s("div", xt, [
329
- s("span", Ct, " (" + k(p.row.original.sku.code) + ") ", 1),
330
- s("span", kt, k(p.row.original.sku.name), 1)
331
- ]),
332
- s("div", null, [
333
- m(e(U), {
334
- render: (n = (g = (v = p.cellByColId.Delete) == null ? void 0 : v.column) == null ? void 0 : g.columnDef) == null ? void 0 : n.cell,
335
- props: (d = (t = p.cellByColId.Delete) == null ? void 0 : t.getContext) == null ? void 0 : d.call(t)
336
- }, null, 8, ["render", "props"])
337
- ])
338
- ]),
339
- s("div", Tt, [
340
- s("div", wt, [
341
- m(c, {
342
- label: e(T)(`inventory.transfer.form.items.table.${e($).Code}`)
343
- }, null, 8, ["label"]),
344
- m(e(U), {
345
- render: (x = (h = (f = p.cellByColId[e($).Code]) == null ? void 0 : f.column) == null ? void 0 : h.columnDef) == null ? void 0 : x.cell,
346
- props: (S = (w = p.cellByColId[e($).Code]) == null ? void 0 : w.getContext) == null ? void 0 : S.call(w)
347
- }, null, 8, ["render", "props"]),
348
- St
349
- ]),
350
- s("div", $t, [
351
- m(c, {
352
- label: e(T)(`inventory.transfer.form.items.table.${e($).Name}`)
353
- }, null, 8, ["label"]),
354
- m(e(U), {
355
- render: (q = (M = (R = p.cellByColId[e($).Name]) == null ? void 0 : R.column) == null ? void 0 : M.columnDef) == null ? void 0 : q.cell,
356
- props: (l = (a = p.cellByColId[e($).Name]) == null ? void 0 : a.getContext) == null ? void 0 : l.call(a)
357
- }, null, 8, ["render", "props"]),
358
- Ft
359
- ])
360
- ]),
361
- s("div", At, [
362
- s("div", Dt, [
363
- m(c, {
364
- label: e(T)(`inventory.transfer.form.items.table.${e($).MinimumAmount}`)
365
- }, null, 8, ["label"]),
366
- m(e(U), {
367
- render: (C = (r = (o = p.cellByColId[e($).MinimumAmount]) == null ? void 0 : o.column) == null ? void 0 : r.columnDef) == null ? void 0 : C.cell,
368
- props: (y = (_ = p.cellByColId[e($).MinimumAmount]) == null ? void 0 : _.getContext) == null ? void 0 : y.call(_)
369
- }, null, 8, ["render", "props"]),
370
- Ot
371
- ]),
372
- s("div", Rt, [
373
- m(c, {
374
- label: e(T)(`inventory.transfer.form.items.table.${e($).Step}`)
375
- }, null, 8, ["label"]),
376
- m(e(U), {
377
- render: (P = (b = (A = p.cellByColId[e($).Step]) == null ? void 0 : A.column) == null ? void 0 : b.columnDef) == null ? void 0 : P.cell,
378
- props: (K = (L = p.cellByColId[e($).Step]) == null ? void 0 : L.getContext) == null ? void 0 : K.call(L)
379
- }, null, 8, ["render", "props"]),
380
- Vt
381
- ])
382
- ]),
383
- s("div", It, [
384
- s("div", Mt, [
385
- m(c, {
386
- label: e(T)(`inventory.transfer.form.items.table.${e($).DefaultAmount}`)
387
- }, null, 8, ["label"]),
388
- m(e(U), {
389
- render: (W = (J = (G = p.cellByColId[e($).DefaultAmount]) == null ? void 0 : G.column) == null ? void 0 : J.columnDef) == null ? void 0 : W.cell,
390
- props: (X = (B = p.cellByColId[e($).DefaultAmount]) == null ? void 0 : B.getContext) == null ? void 0 : X.call(B)
391
- }, null, 8, ["render", "props"]),
392
- Pt
393
- ]),
394
- s("div", Ut, [
395
- m(Ee, { "z-index": 50 }, {
396
- default: I(() => [
397
- m(c, {
398
- label: e(T)(`inventory.transfer.form.items.table.${e($).Cost}2`)
399
- }, null, 8, ["label"])
400
- ]),
401
- _: 1
402
- }),
403
- m(e(U), {
404
- render: (te = (ee = (Z = p.cellByColId[e($).Cost]) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
405
- props: (se = (N = p.cellByColId[e($).Cost]) == null ? void 0 : N.getContext) == null ? void 0 : se.call(N)
406
- }, null, 8, ["render", "props"]),
407
- Et
408
- ])
409
- ])
410
- ]);
411
- };
412
- }
413
- }), Lt = { class: "flex flex-col gap-16" }, Bt = { class: "flex flex-col gap-24" }, Nt = { class: "flex flex-col gap-16" }, zt = { class: "flex" }, Ht = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, jt = /* @__PURE__ */ ne({
414
- __name: "TransferTemplateForm",
415
- props: {
416
- modelValue: {},
417
- disabled: { type: Boolean }
418
- },
419
- setup(u, { expose: T }) {
420
- const p = u, i = Je(), { t: c } = Y(), v = Ie(), g = at(), n = vt();
421
- Fe(
422
- () => p.modelValue,
423
- (a) => {
424
- console.log("TransferTemplateForm.model", a);
425
- }
426
- ), v.watchLocation(async () => {
427
- location && (i.purchaseOrder.supplier || (i.purchaseOrder.supplier = n.suppliers.find((a) => a) ?? i.purchaseOrder.supplier));
428
- });
429
- const t = dt(), d = We(
430
- () => i.purchaseOrder,
431
- (a) => {
432
- i.purchaseOrder = {
433
- ...i.purchaseOrder,
434
- ...a
435
- };
436
- }
437
- ), f = E({
438
- get() {
439
- var a, l;
440
- return typeof ((l = (a = i.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : l.internal) == "string" ? V.TRANSFER : V.PURCHASE;
441
- },
442
- set(a) {
443
- var o, r;
444
- const l = typeof ((r = (o = i.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : r.internal) == "string" ? V.TRANSFER : V.PURCHASE;
445
- a !== l && (i.purchaseOrder.supplier = a === V.PURCHASE ? d.locationOptionsTypePurchase.value[0] : d.locationOptionsTypeTransfer.value[0]);
446
- }
447
- }), h = E(() => d.transferLocationOptions.value), x = E({
448
- get() {
449
- return i.purchaseOrder.supplier._id;
450
- },
451
- set(a) {
452
- d.transferLocationModel.value = a;
453
- }
454
- }), w = E({
455
- get() {
456
- return i.purchaseOrder.remark ?? void 0;
457
- },
458
- set(a) {
459
- i.purchaseOrder.remark = a;
460
- }
461
- }), S = Q();
462
- T({
463
- validateInputs: () => {
464
- var a, l;
465
- (l = (a = S.value) == null ? void 0 : a.validateInputs) == null || l.call(a);
466
- },
467
- resetInputsValidation: () => {
468
- var a, l;
469
- (l = (a = S.value) == null ? void 0 : a.resetInputsValidation) == null || l.call(a);
470
- },
471
- resetInputs: () => {
472
- var a, l;
473
- (l = (a = S.value) == null ? void 0 : a.resetInputs) == null || l.call(a);
474
- }
475
- });
476
- const R = bt({
477
- updateItem: (a) => {
478
- i.purchaseOrder.items = i.purchaseOrder.items.map((l) => l.sku._id !== a.sku._id ? l : a);
479
- },
480
- deleteItem: (a) => {
481
- i.purchaseOrder.items = i.purchaseOrder.items.filter(
482
- (l) => l.sku._id !== a.sku._id
483
- );
484
- },
485
- get supplier() {
486
- return i.purchaseOrder.supplier;
487
- },
488
- get items() {
489
- return i.purchaseOrder.items;
490
- },
491
- get transferType() {
492
- return f.value;
493
- },
494
- get disabled() {
495
- return p.disabled;
496
- }
497
- }), M = E(() => R.columnDefs.value);
498
- function q() {
499
- const a = g.skus.map((o) => ({
500
- label: o.name,
501
- sublabel: o.code,
502
- value: o
503
- })), l = a.filter((o) => {
504
- var r;
505
- return (r = i.purchaseOrder.items) == null ? void 0 : r.find((C) => C.sku._id === o.value._id);
506
- }).map((o) => o.value);
507
- t.open({
508
- title: c("inventory.transfer.form.items.selectItem"),
509
- closeButton: !0,
510
- contentComponent: lt,
511
- contentComponentProps: {
512
- modelValue: l,
513
- items: a
514
- },
515
- primaryActions: {
516
- text: c("common.confirm"),
517
- close: !0
518
- },
519
- secondaryActions: {
520
- text: c("common.close"),
521
- close: !0,
522
- variant: "tertiary"
523
- }
524
- }).onPrimary((o) => {
525
- const r = i.purchaseOrder.items ?? [], C = o.map((_) => {
526
- const y = r.find((b) => b.sku._id === _._id);
527
- if (y)
528
- return y;
529
- const A = {
530
- sku: _,
531
- code: _.code,
532
- name: _.name,
533
- quantity: {
534
- amount: 1,
535
- precision: 0
536
- }
537
- };
538
- return f.value == V.PURCHASE && (A.totalCost = le(
539
- A.sku,
540
- A.quantity,
541
- A.measurement,
542
- {
543
- supplier: i.purchaseOrder.supplier
544
- }
545
- )), A;
546
- });
547
- C.sort((_, y) => _.sku.code.localeCompare(y.sku.code)), i.purchaseOrder.items = C;
548
- });
549
- }
550
- return (a, l) => {
551
- const o = O("FmTextField"), r = O("FmSelect"), C = O("FmTextarea"), _ = O("FmButton"), y = O("FmTable"), A = O("FmForm");
552
- return F(), H(A, {
553
- ref_key: "formRef",
554
- ref: S,
555
- class: "flex flex-col gap-32",
556
- disabled: a.disabled
557
- }, {
558
- default: I(() => [
559
- s("div", Lt, [
560
- s("div", Bt, [
561
- m(o, {
562
- label: e(c)("inventory.transfer.form.name"),
563
- "label-mark": "required",
564
- modelValue: e(i).name,
565
- "onUpdate:modelValue": l[0] || (l[0] = (b) => e(i).name = b),
566
- rules: [e(de)()]
567
- }, null, 8, ["label", "modelValue", "rules"]),
568
- m(r, {
569
- label: e(c)("inventory.transfer.form.type.title"),
570
- "model-value": f.value,
571
- "onUpdate:modelValue": l[1] || (l[1] = (b) => f.value = b),
572
- items: [
573
- {
574
- label: e(c)(
575
- `inventory.transfer.form.type.${e(V).PURCHASE.toLocaleLowerCase()}`
576
- ),
577
- value: e(V).PURCHASE,
578
- disabled: !e(d).locationOptionsTypePurchase.value.length,
579
- sublabel: e(d).locationOptionsTypePurchase.value.length ? void 0 : e(c)("inventory.transfer.form.noSupplierAvailable")
580
- },
581
- {
582
- label: e(c)(
583
- `inventory.transfer.form.type.${e(V).TRANSFER.toLocaleLowerCase()}`
584
- ),
585
- value: e(V).TRANSFER,
586
- disabled: !e(d).locationOptionsTypeTransfer.value.length,
587
- sublabel: e(d).locationOptionsTypeTransfer.value.length ? void 0 : e(c)("inventory.transfer.form.noLocationAvailable")
588
- }
589
- ],
590
- rules: [e(me)(1)(h.value)]
591
- }, null, 8, ["label", "model-value", "items", "rules"]),
592
- m(r, {
593
- label: f.value === e(V).PURCHASE ? e(c)("inventory.transfer.form.purchaseFrom") : e(c)("inventory.transfer.form.transferFrom"),
594
- modelValue: x.value,
595
- "onUpdate:modelValue": l[2] || (l[2] = (b) => x.value = b),
596
- items: h.value
597
- }, null, 8, ["label", "modelValue", "items"]),
598
- m(o, {
599
- label: e(c)("inventory.transfer.form.reference"),
600
- "label-mark": "optional",
601
- modelValue: e(i).purchaseOrder.ref,
602
- "onUpdate:modelValue": l[3] || (l[3] = (b) => e(i).purchaseOrder.ref = b)
603
- }, null, 8, ["label", "modelValue"]),
604
- m(C, {
605
- label: e(c)("inventory.transfer.form.remark"),
606
- "label-mark": "optional",
607
- "max-length": 240,
608
- modelValue: w.value,
609
- "onUpdate:modelValue": l[4] || (l[4] = (b) => w.value = b),
610
- class: Ne({ "text-fm-color-typo-disabled": a.disabled })
611
- }, null, 8, ["label", "modelValue", "class"])
612
- ])
613
- ]),
614
- s("div", Nt, [
615
- s("div", zt, [
616
- s("div", Ht, k(e(c)("inventory.transfer.form.items.title")), 1),
617
- m(_, {
618
- disabled: a.disabled,
619
- label: e(c)("inventory.transfer.form.items.addItem"),
620
- "prepend-icon": "add",
621
- variant: "plain",
622
- class: "border-2 rounded-lg border-fm-color-primary",
623
- onClick: l[5] || (l[5] = (b) => q()),
624
- size: "md"
625
- }, null, 8, ["disabled", "label"])
626
- ]),
627
- (F(), H(y, {
628
- "column-defs": M.value,
629
- "row-data": e(i).purchaseOrder.items,
630
- key: e(i).purchaseOrder.items.map((b) => b.sku._id).join("."),
631
- "hide-footer": ""
632
- }, {
633
- "list-row": I((b) => [
634
- (F(), H(Me, {
635
- row: b,
636
- key: e(i).purchaseOrder.items.map((P) => P.sku._id).join(".")
637
- }, {
638
- default: I((P) => [
639
- m(qt, {
640
- row: b,
641
- "cell-by-col-id": P
642
- }, null, 8, ["row", "cell-by-col-id"])
643
- ]),
644
- _: 2
645
- }, 1032, ["row"]))
646
- ]),
647
- _: 1
648
- }, 8, ["column-defs", "row-data"]))
649
- ])
650
- ]),
651
- _: 1
652
- }, 8, ["disabled"]);
653
- };
654
- }
655
- }), Qt = { class: "flex items-center" }, Yt = { class: "fm-typo-en-title-md-800" }, Kt = { class: "flex gap-4" }, Gt = /* @__PURE__ */ ne({
656
- __name: "TransferTemplateDialog",
657
- props: {
658
- mode: {},
659
- modelValue: {},
660
- show: { type: Boolean }
661
- },
662
- emits: ["update:show", "submitted"],
663
- setup(u, { expose: T, emit: p }) {
664
- var l;
665
- const i = u, c = p, v = Xe(), g = mt(), { t: n } = Y(), t = Ue(i, "show");
666
- function d() {
667
- return {
668
- _id: "",
669
- name: "",
670
- purchaseOrder: {
671
- remark: void 0,
672
- ref: void 0,
673
- stockSnapshotId: void 0,
674
- effectiveAt: void 0,
675
- items: [],
676
- supplier: {
677
- _rev: void 0,
678
- email: void 0,
679
- internal: void 0,
680
- contactName: void 0,
681
- phoneNumber: void 0,
682
- registrationNumber: void 0,
683
- supplyItems: void 0,
684
- _id: "",
685
- name: "",
686
- address: {
687
- line2: void 0,
688
- line1: "",
689
- state: "",
690
- city: "",
691
- postcode: "",
692
- country: ""
693
- }
694
- }
695
- }
696
- };
697
- }
698
- const f = Q(i.modelValue ?? d()), h = Q(((l = i.modelValue) == null ? void 0 : l._id) ?? `${Math.random()}`);
699
- Fe(
700
- () => i.show,
701
- (o) => {
702
- var r;
703
- o && (f.value = i.modelValue ?? d(), h.value = ((r = i.modelValue) == null ? void 0 : r._id) ?? `${Math.random()}`);
704
- }
705
- );
706
- const x = Q(!1), w = E(() => {
707
- switch (i.mode) {
708
- case ae.READ:
709
- return "";
710
- case ae.CREATE:
711
- return n("inventory.transfer.template.create.title");
712
- case ae.UPDATE:
713
- return n("inventory.transfer.template.update.title");
714
- }
715
- return "";
716
- }), S = Q();
717
- T({
718
- validateInputs: () => {
719
- var o, r;
720
- (r = (o = S.value) == null ? void 0 : o.validateInputs) == null || r.call(o);
721
- },
722
- resetInputsValidation: () => {
723
- var o, r;
724
- (r = (o = S.value) == null ? void 0 : o.resetInputsValidation) == null || r.call(o);
725
- },
726
- resetInputs: () => {
727
- var o, r;
728
- (r = (o = S.value) == null ? void 0 : o.resetInputs) == null || r.call(o);
729
- }
730
- });
731
- async function R() {
732
- const o = f.value;
733
- if (o) {
734
- x.value = !0, (o.purchaseOrder.supplier.internal === "warehouse" || o.purchaseOrder.supplier.internal === "restaurant") && (o.purchaseOrder.items = o.purchaseOrder.items.map(
735
- ({ totalCost: r, ...C }) => C
736
- ));
737
- try {
738
- await v.createTemplate(o), await new Promise((r) => setTimeout(r, 1e3)), g.open({
739
- title: n("inventory.transfer.template.create.success"),
740
- message: n("inventory.transfer.template.create.successMessage"),
741
- type: "success"
742
- }), c("update:show", !1), c("submitted");
743
- } catch (r) {
744
- g.open({
745
- title: n("inventory.transfer.template.create.error"),
746
- message: n("inventory.transfer.template.create.errorMessage"),
747
- type: "error"
748
- }), console.error("Error in creating transfer template", r);
749
- } finally {
750
- x.value = !1;
751
- }
752
- }
753
- }
754
- async function M() {
755
- const o = f.value;
756
- if (o) {
757
- x.value = !0, (o.purchaseOrder.supplier.internal === "warehouse" || o.purchaseOrder.supplier.internal === "restaurant") && (o.purchaseOrder.items = o.purchaseOrder.items.map(
758
- ({ totalCost: r, ...C }) => C
759
- ));
760
- try {
761
- await v.updateTemplate(o), await new Promise((r) => setTimeout(r, 1e3)), g.open({
762
- title: n("inventory.transfer.template.update.success"),
763
- message: n("inventory.transfer.template.update.successMessage"),
764
- type: "success"
765
- }), c("update:show", !1), c("submitted");
766
- } catch (r) {
767
- g.open({
768
- title: n("inventory.transfer.template.update.error"),
769
- message: n("inventory.transfer.template.update.errorMessage"),
770
- type: "error"
771
- }), console.error("Error in updating transfer template", r);
772
- } finally {
773
- x.value = !1;
774
- }
775
- }
776
- }
777
- function q() {
778
- switch (i.mode) {
779
- case ae.CREATE:
780
- return R();
781
- case ae.UPDATE:
782
- return M();
783
- }
784
- }
785
- function a() {
786
- var o, r;
787
- (r = (o = S.value) == null ? void 0 : o.validateInputs) == null || r.call(o);
788
- }
789
- return (o, r) => {
790
- const C = O("FmButton"), _ = O("FmSideSheet");
791
- return F(), H(_, {
792
- modelValue: e(t),
793
- "onUpdate:modelValue": r[2] || (r[2] = (y) => Ae(t) ? t.value = y : null),
794
- "dismiss-away": "",
795
- "close-button": "",
796
- "max-width": 900
797
- }, {
798
- "side-sheet-header": I(() => [
799
- s("div", Qt, [
800
- s("div", Yt, k(w.value), 1)
801
- ])
802
- ]),
803
- default: I(() => [
804
- (F(), H(jt, {
805
- class: "w-full",
806
- ref_key: "formRef",
807
- ref: S,
808
- onValidationSuccess: q,
809
- "model-value": f.value,
810
- "onUpdate:modelValue": r[0] || (r[0] = (y) => f.value = y),
811
- disabled: x.value,
812
- key: h.value
813
- }, null, 8, ["model-value", "disabled"]))
814
- ]),
815
- "side-sheet-footer": I(() => [
816
- s("div", Kt, [
817
- m(C, {
818
- loading: x.value,
819
- label: e(n)("common.save"),
820
- onClick: a
821
- }, null, 8, ["loading", "label"]),
822
- m(C, {
823
- disabled: x.value,
824
- variant: "tertiary",
825
- label: e(n)("common.close"),
826
- onClick: r[1] || (r[1] = (y) => c("update:show", !1))
827
- }, null, 8, ["disabled", "label"])
828
- ])
829
- ]),
830
- _: 1
831
- }, 8, ["modelValue"]);
832
- };
833
- }
834
- }), Jt = { class: "flex flex-col gap-16 w-full h-full" }, Wt = { class: "flex justify-between" }, Xt = { class: "fm-typo-en-body-lg-600" }, Zt = { class: "flex flex-col gap-8" }, es = { class: "flex flex-col gap-4" }, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ss = { class: "flex gap-1" }, os = { class: "fm-typo-en-body-lg-600" }, as = {
835
- key: 0,
836
- class: "flex flex-col gap-4"
837
- }, ls = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "fm-typo-en-body-lg-600" }, rs = { class: "flex flex-col gap-4" }, is = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, us = { class: "fm-typo-en-body-lg-600" }, ds = {
838
- key: 1,
839
- class: "flex flex-col gap-4"
840
- }, ms = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, cs = { class: "fm-typo-en-body-lg-600" }, ps = {
841
- key: 2,
842
- class: "flex flex-col gap-4"
843
- }, fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ys = { class: "fm-typo-en-body-lg-600" }, vs = {
844
- key: 3,
845
- class: "flex flex-col gap-4"
846
- }, _s = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bs = { class: "fm-typo-en-body-lg-600" }, hs = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, gs = { class: "flex flex-col gap-8" }, xs = { class: "fm-typo-en-body-lg-600" }, Cs = { class: "flex w-full gap-4" }, ks = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Ts = /* @__PURE__ */ s("div", { class: "flex-1 min-w-32" }, null, -1), ws = { class: "fm-typo-en-body-lg-600 shrink-0" }, Ss = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, $s = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Fs = {
847
- key: 0,
848
- class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
849
- }, As = { class: "flex gap-8 xs:flex-col" }, Ds = /* @__PURE__ */ ne({
850
- __name: "TransferTemplateDetails",
851
- props: {
852
- template: {},
853
- show: { type: Boolean }
854
- },
855
- emits: ["update:show", "action:use", "action:edit"],
856
- setup(u, { emit: T }) {
857
- const p = u, i = T, c = Ve(), { t: v } = Y(), g = E(() => {
858
- var f;
859
- return (f = p.template) == null ? void 0 : f.purchaseOrder;
860
- }), n = E(
861
- () => {
862
- var f, h, x, w;
863
- return ((h = (f = g.value) == null ? void 0 : f.supplier) == null ? void 0 : h.internal) === "restaurant" || ((w = (x = g.value) == null ? void 0 : x.supplier) == null ? void 0 : w.internal) === "warehouse" ? V.TRANSFER : V.PURCHASE;
864
- }
865
- ), t = Q(!0), d = Ue(p, "show");
866
- return (f, h) => {
867
- var q;
868
- const x = O("FmChip"), w = O("FmMenuDivider"), S = O("FmCard"), R = O("FmButton"), M = O("FmSideSheet");
869
- return F(), H(M, {
870
- header: e(v)("inventory.transfer.template.details.view", { template: (q = f.template) == null ? void 0 : q.name }),
871
- modelValue: e(d),
872
- "onUpdate:modelValue": h[2] || (h[2] = (a) => Ae(d) ? d.value = a : null),
873
- "dismiss-away": t.value,
874
- "close-button": "",
875
- "max-width": 500
876
- }, {
877
- default: I(() => {
878
- var a;
879
- return [
880
- s("div", Jt, [
881
- m(S, {
882
- variant: "outlined",
883
- class: "flex flex-col gap-8 px-12 py-16"
884
- }, {
885
- default: I(() => {
886
- var l, o, r, C, _, y, A, b, P;
887
- return [
888
- s("div", Wt, [
889
- s("div", Xt, k(e(v)("inventory.transfer.template.details.templateSummary")), 1),
890
- s("div", null, [
891
- m(x, {
892
- label: e(v)(
893
- `inventory.transfer.receiveRequest.details.type.${n.value.toLocaleLowerCase()}`
894
- ),
895
- class: "fm-chip-transfer-info",
896
- compact: ""
897
- }, null, 8, ["label"])
898
- ])
899
- ]),
900
- m(w),
901
- s("div", Zt, [
902
- s("div", es, [
903
- s("div", ts, [
904
- s("div", ss, k(e(v)("inventory.transfer.receiveRequest.details.createdAt")), 1)
905
- ]),
906
- s("div", os, k(e(pt)(((l = f.template) == null ? void 0 : l._id) ?? "")), 1)
907
- ]),
908
- (o = g.value) != null && o.effectiveAt ? (F(), z("div", as, [
909
- s("div", ls, k(e(v)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
910
- s("div", ns, k(e(nt)(new Date((r = g.value) == null ? void 0 : r.effectiveAt))), 1)
911
- ])) : oe("", !0),
912
- s("div", rs, [
913
- s("div", is, k(e(v)("inventory.transfer.receiveRequest.details.type.title")), 1),
914
- s("div", us, k(e(v)(
915
- `inventory.transfer.receiveRequest.details.type.${n.value.toLocaleLowerCase("en-US")}`
916
- )), 1)
917
- ]),
918
- (_ = (C = g.value) == null ? void 0 : C.supplier) != null && _.name ? (F(), z("div", ds, [
919
- s("div", ms, k(e(v)("inventory.transfer.receiveRequest.details.from")), 1),
920
- s("div", cs, k((A = (y = g.value) == null ? void 0 : y.supplier) == null ? void 0 : A.name), 1)
921
- ])) : oe("", !0),
922
- (b = g.value) != null && b.ref ? (F(), z("div", ps, [
923
- s("div", fs, k(e(v)("inventory.transfer.receiveRequest.details.reference")), 1),
924
- s("div", ys, k(g.value.ref), 1)
925
- ])) : oe("", !0),
926
- (P = g.value) != null && P.remark ? (F(), z("div", vs, [
927
- s("div", _s, k(e(v)("inventory.transfer.receiveRequest.details.remark")), 1),
928
- s("div", bs, k(g.value.remark), 1)
929
- ])) : oe("", !0)
930
- ])
931
- ];
932
- }),
933
- _: 1
934
- }),
935
- s("div", hs, [
936
- s("div", gs, [
937
- s("div", xs, k(e(v)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
938
- (F(!0), z(De, null, ze(((a = g.value) == null ? void 0 : a.items) ?? [], (l) => (F(), z("div", {
939
- key: l.code,
940
- class: "flex flex-col"
941
- }, [
942
- s("div", Cs, [
943
- s("div", ks, k(l.name), 1),
944
- Ts,
945
- s("div", ws, k(e(ft)(l.quantity, l.sku.unit, l.measurement)), 1)
946
- ]),
947
- s("div", Ss, [
948
- s("div", $s, k(l.code), 1),
949
- l.totalCost && e(c).enableTotalCost ? (F(), z("div", Fs, " (" + k(e(Oe)(l.totalCost)) + ") ", 1)) : oe("", !0)
950
- ])
951
- ]))), 128))
952
- ])
953
- ])
954
- ])
955
- ];
956
- }),
957
- "side-sheet-footer": I(() => [
958
- s("div", As, [
959
- m(R, {
960
- label: e(v)("inventory.transfer.template.use"),
961
- onClick: h[0] || (h[0] = (a) => i("action:use"))
962
- }, null, 8, ["label"]),
963
- m(R, {
964
- label: e(v)("common.edit"),
965
- onClick: h[1] || (h[1] = (a) => i("action:edit")),
966
- variant: "tertiary"
967
- }, null, 8, ["label"])
968
- ])
969
- ]),
970
- _: 1
971
- }, 8, ["header", "modelValue", "dismiss-away"]);
972
- };
973
- }
974
- }), Os = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Rs = { class: "flex-1 flex flex-col gap-8" }, Vs = { class: "flex flex-col" }, Is = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ms = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ps = { class: "fm-typo-en-body-lg-400" }, Us = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, Es = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Xs = /* @__PURE__ */ ne({
975
- __name: "TransferTemplateView",
976
- setup(u) {
977
- const { t: T } = Y(), { createTemplate: p, viewTemplate: i } = xe(), { templateDialogProps: c, transferFormDialogProps: v, templateDetailsProps: g } = ct(
978
- xe()
979
- ), n = Ze(), t = it(), d = Ie(), { breakpoints: f } = Pe();
980
- d.watchLocation(n.fetchTemplates);
981
- const h = E(
982
- () => n.loading.value || !d._currentLocation
983
- ), x = E(() => n.templates.value), w = Q(""), S = E(() => f.value.xs || f.value.sm ? 10 : 20);
984
- function R(l) {
985
- switch (l) {
986
- case Ce.Add:
987
- return p();
988
- }
989
- }
990
- const M = yt();
991
- function q() {
992
- M.push({ name: rt.RECEIVE_REQUEST });
993
- }
994
- function a(l) {
995
- return l;
996
- }
997
- return (l, o) => {
998
- const r = O("FmTable");
999
- return F(), z(De, null, [
1000
- m(Ke, {
1001
- title: e(T)("inventory.transfer.template.title2"),
1002
- actions: [
1003
- {
1004
- label: e(T)("inventory.transfer.template.create.title"),
1005
- value: e(Ce).Add,
1006
- isPrimary: !0,
1007
- prependIcon: "add"
1008
- }
1009
- ],
1010
- "onClick:action": R
1011
- }, {
1012
- default: I(() => {
1013
- var C;
1014
- return [
1015
- s("div", Os, [
1016
- m(Ge, {
1017
- searchable: "",
1018
- "change-location": "",
1019
- search: w.value,
1020
- "onUpdate:search": o[0] || (o[0] = (_) => w.value = _),
1021
- actions: [{ icon: "refresh", onClick: e(n).fetchTemplates }]
1022
- }, null, 8, ["search", "actions"]),
1023
- (F(), H(r, {
1024
- style: He(e(t).tableHeight),
1025
- "column-defs": e(n).columnDefs,
1026
- "row-data": x.value,
1027
- "search-value": w.value,
1028
- loading: h.value,
1029
- key: (C = e(d)._currentLocation) == null ? void 0 : C.dbName,
1030
- onRowClick: o[1] || (o[1] = (_) => e(i)(_.original)),
1031
- "page-size": S.value
1032
- }, {
1033
- "list-row": I((_) => [
1034
- m(Me, {
1035
- row: _,
1036
- onRowClick: (y) => e(i)(y)
1037
- }, {
1038
- default: I((y) => {
1039
- var A, b, P, L, K, G, J, W, B, X, Z, ee, te, N, se, ce, pe, fe, re, ye, ve, _e, be, ie, he;
1040
- return [
1041
- s("div", Rs, [
1042
- s("div", Vs, [
1043
- s("div", Is, [
1044
- m(e(U), {
1045
- render: (P = (b = (A = y._id) == null ? void 0 : A.column) == null ? void 0 : b.columnDef) == null ? void 0 : P.cell,
1046
- props: (K = (L = y._id) == null ? void 0 : L.getContext) == null ? void 0 : K.call(L)
1047
- }, null, 8, ["render", "props"])
1048
- ]),
1049
- s("div", Ms, [
1050
- m(e(U), {
1051
- render: (W = (J = (G = y.name) == null ? void 0 : G.column) == null ? void 0 : J.columnDef) == null ? void 0 : W.cell,
1052
- props: (X = (B = y.name) == null ? void 0 : B.getContext) == null ? void 0 : X.call(B)
1053
- }, null, 8, ["render", "props"])
1054
- ]),
1055
- s("div", Ps, [
1056
- m(e(U), {
1057
- render: (te = (ee = (Z = y.supplier) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
1058
- props: (se = (N = y.supplier) == null ? void 0 : N.getContext) == null ? void 0 : se.call(N)
1059
- }, null, 8, ["render", "props"])
1060
- ]),
1061
- s("div", Us, k(_.original.purchaseOrder.items.length ? _.original.purchaseOrder.items.map((qe) => qe.name).join(", ") : "No items"), 1),
1062
- s("div", Es, [
1063
- m(e(U), {
1064
- render: (fe = (pe = (ce = y.ref) == null ? void 0 : ce.column) == null ? void 0 : pe.columnDef) == null ? void 0 : fe.cell,
1065
- props: (ye = (re = y.ref) == null ? void 0 : re.getContext) == null ? void 0 : ye.call(re)
1066
- }, null, 8, ["render", "props"])
1067
- ])
1068
- ]),
1069
- s("div", null, [
1070
- m(e(U), {
1071
- render: (be = (_e = (ve = y.type) == null ? void 0 : ve.column) == null ? void 0 : _e.columnDef) == null ? void 0 : be.cell,
1072
- props: (he = (ie = y.type) == null ? void 0 : ie.getContext) == null ? void 0 : he.call(ie)
1073
- }, null, 8, ["render", "props"])
1074
- ])
1075
- ])
1076
- ];
1077
- }),
1078
- _: 2
1079
- }, 1032, ["row", "onRowClick"])
1080
- ]),
1081
- _: 1
1082
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1083
- ])
1084
- ];
1085
- }),
1086
- _: 1
1087
- }, 8, ["title", "actions"]),
1088
- (F(), H(je, { to: "body" }, [
1089
- m(et, ge(e(v), { onSubmitted: q }), null, 16),
1090
- m(Ds, Qe(Ye(e(g))), null, 16),
1091
- m(Gt, ge(e(c), {
1092
- onSubmitted: o[2] || (o[2] = (C) => e(n).fetchTemplates())
1093
- }), null, 16)
1094
- ]))
1095
- ], 64);
1096
- };
1097
- }
1098
- });
1099
- export {
1100
- Xs as default
1101
- };