@feedmepos/mf-inventory-portal 0.0.22-dev.34 → 0.0.22-dev.37

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 (70) hide show
  1. package/dist/{ApprovalView-2pX2IV1F.js → ApprovalView-Dco0PkEf.js} +8 -8
  2. package/dist/{BindingsDialog-EyImpE9g.js → BindingsDialog-DrCU_kIA.js} +9 -9
  3. package/dist/{BindingsPicker-CbBNBcWW.js → BindingsPicker-BMIIrlG6.js} +17 -17
  4. package/dist/{BindingsTable-CJeV7Dd2.js → BindingsTable-BHRmkL1P.js} +1 -1
  5. package/dist/{ClosingTemplateView-BDEooji1.js → ClosingTemplateView-kiej8Nah.js} +15 -15
  6. package/dist/FmDroppableField-Bl7A98it.js +152 -0
  7. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DZtc5R4Z.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DQw4pBwH.js} +25 -25
  8. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-z-BBBTkh.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DBh79EM_.js} +20 -20
  9. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-3OkJNtvH.js +51 -0
  10. package/dist/IngredientsView-m44wAwSR.js +1611 -0
  11. package/dist/{IntegrationView-1lXCciJp.js → IntegrationView-B4gCx21K.js} +71 -71
  12. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bgd922-L.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-D1frNXtV.js} +1 -1
  13. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Bexig132.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Dbs29jm_.js} +16 -16
  14. package/dist/{PurchaseOrderPrintPreview-036mLqRD.js → PurchaseOrderPrintPreview-lKu0y_xw.js} +7 -7
  15. package/dist/ReceiveRequestView-DflWKxgq.js +4053 -0
  16. package/dist/{RecipeView-BuiA-2uY.js → RecipeView-DfsXdlPn.js} +30 -29
  17. package/dist/StockView-BSeSpxkV.js +7762 -0
  18. package/dist/{SupplierView-Ck5hH5gT.js → SupplierView-DPWh1si_.js} +11 -11
  19. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DFDc3P3S.js → TransferDetails.vue_vue_type_script_setup_true_lang-Dt1lRW3W.js} +260 -262
  20. package/dist/TransferTemplateView-DGOT4oZN.js +2054 -0
  21. package/dist/{UnitView-DB2hQFMC.js → UnitView-X9bCqAWe.js} +16 -16
  22. package/dist/{WarehouseView-CFJiuhpx.js → WarehouseView-BphA-Peq.js} +20 -20
  23. package/dist/api/bill.d.ts +84 -238
  24. package/dist/api/purchase-order-template.d.ts +4 -2
  25. package/dist/{app-Z9P39kGh.js → app-DZiCiBV7.js} +18175 -18188
  26. package/dist/app.js +2 -2
  27. package/dist/{decimal-DIe_fFDH.js → decimal-Bx1Y3uW1.js} +1 -1
  28. package/dist/defineDeepModel-4XZbatJF.js +13 -0
  29. package/dist/format-time-from-id-CFJvgP70.js +15 -0
  30. package/dist/helper/xlsx.util.d.ts +7 -0
  31. package/dist/purchase-order-transaction-type-Ds7YRAAp.js +348 -0
  32. package/dist/stores/inventory.d.ts +63 -0
  33. package/dist/stores/location.d.ts +89 -0
  34. package/dist/stores/netsuite.d.ts +1 -0
  35. package/dist/stores/supplier.d.ts +120 -3
  36. package/dist/stores/warehouse.d.ts +7 -4
  37. package/dist/supplier-BhJT8KOX.js +70 -0
  38. package/dist/tsconfig.app.tsbuildinfo +1 -1
  39. package/dist/{use-template-enabled-locations-2-CeSeHnX0.js → use-template-enabled-locations-2-BrEPVOpT.js} +1 -1
  40. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +2 -2
  41. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +2 -2
  42. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  43. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +44 -0
  44. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +42 -34
  45. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +75 -51
  46. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +75 -51
  47. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  48. package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
  49. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  50. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  51. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  52. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  53. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +10 -6
  54. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1850 -5
  55. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  56. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -230
  57. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  58. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +14 -8
  59. package/dist/{xlsx-DrDljHnF.js → xlsx-B9lpxKgq.js} +651 -651
  60. package/dist/xlsx.util-DP5wVnRT.js +78 -0
  61. package/package.json +1 -1
  62. package/dist/IngredientsView-BvKaI0nb.js +0 -1755
  63. package/dist/ReceiveRequestView-BGlxEJkh.js +0 -1626
  64. package/dist/StockView-BKX6NX-g.js +0 -1909
  65. package/dist/TransferTemplateView-ByYEje9E.js +0 -1237
  66. package/dist/defineDeepModel-DH8vhBpR.js +0 -13
  67. package/dist/format-time-from-id-CAjL4U2X.js +0 -15
  68. package/dist/purchase-order-transaction-type-BJDnbhdk.js +0 -338
  69. package/dist/supplier-wJJ7ATk2.js +0 -69
  70. package/dist/xlsx.util-BwF0vRjF.js +0 -109
@@ -1,1626 +0,0 @@
1
- import { reactive as nt, onMounted as Je, computed as M, h as Z, defineComponent as ie, openBlock as h, createElementBlock as I, Fragment as fe, renderList as Ae, createElementVNode as o, toDisplayString as q, unref as e, resolveComponent as $, createVNode as r, withCtx as T, createCommentVNode as X, ref as L, createBlock as J, watch as Se, normalizeClass as G, normalizeStyle as We, mergeProps as Me, isRef as Ce, Teleport as lt } from "vue";
2
- import { E as rt, b as qe, R as je, $ as it, a0 as ut, a as pe, s as dt, a1 as Ye, a2 as ct, H as Oe, m as mt, a3 as pt, A as Te, M as ft, a4 as Xe, P as Ue, a5 as vt, u as Ee, a6 as yt, a7 as bt, a8 as gt, Q as _t, G as kt, a9 as ht, j as Be, aa as Ct, z as xt, ab as Pe, q as Ke, ac as wt } from "./app-Z9P39kGh.js";
3
- import { i as Qe, u as St, _ as Dt, a as Ft } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-z-BBBTkh.js";
4
- import { u as et, a as $t, b as Pt, _ as Tt, g as It } from "./TransferDetails.vue_vue_type_script_setup_true_lang-DFDc3P3S.js";
5
- import { _ as tt, u as Rt, i as Vt, e as At } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-Bexig132.js";
6
- import { useBreakpoints as Ne, components as he, FmButtonVariant as Mt, useSnackbar as Ie, useDialog as qt, useProxiedModel as Ot } from "@feedmepos/ui-library";
7
- import { F as we } from "./row-action.enum-PMKMRrZR.js";
8
- import { P as Y, u as st } from "./purchase-order-transaction-type-BJDnbhdk.js";
9
- import { c as me, u as Ut, _ as Et } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DZtc5R4Z.js";
10
- import { useI18n as ve } from "@feedmepos/mf-common";
11
- import "vue-router";
12
- import { u as He } from "./supplier-wJJ7ATk2.js";
13
- import { d as Bt } from "./defineDeepModel-DH8vhBpR.js";
14
- import { F as ae, _ as at } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
15
- import { _ as Nt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
16
- var K = /* @__PURE__ */ ((d) => (d.Code = "Code", d.Name = "Name", d.Amount = "Amount", d.Cost = "Cost", d.Delete = "Delete", d))(K || {});
17
- const Ht = () => {
18
- const { t: d } = ve();
19
- return Z(
20
- tt,
21
- {
22
- zIndex: 50,
23
- class: "whitespace-nowrap"
24
- },
25
- d("inventory.transfer.form.items.table.Cost", [Xe()])
26
- );
27
- };
28
- function Lt(d) {
29
- const { t: y } = ve(), i = nt({}), { breakpoints: v } = Ne(), b = qe();
30
- Je(() => {
31
- for (const n of d.items) {
32
- if (!n.totalCost)
33
- continue;
34
- const a = me(n.sku, n.quantity, n.measurement, {
35
- supplier: d.supplier
36
- }), u = n.totalCost ?? rt.reset();
37
- a ? i[n.sku._id] = a.amount !== u.amount || a.precision !== u.precision : i[n.sku._id] = !0;
38
- }
39
- });
40
- function t(n) {
41
- var u, c, g, w, C, x, D;
42
- return !!(((c = (u = n.defaultCost) == null ? void 0 : u.costPerUnit) == null ? void 0 : c.amount) ?? ((D = (x = (C = (w = (g = d.supplier) == null ? void 0 : g.supplyItems) == null ? void 0 : w.find((V) => V.skuId === n._id)) == null ? void 0 : C.defaultCost) == null ? void 0 : x.costPerUnit) == null ? void 0 : D.amount));
43
- }
44
- const l = [
45
- {
46
- id: "Code",
47
- header: () => y("inventory.transfer.form.items.table.Code"),
48
- accessorKey: "code",
49
- size: 96,
50
- cell(n) {
51
- const a = n.row.original;
52
- return Z(he.FmTextField, {
53
- modelValue: a.code,
54
- "onUpdate:modelValue": (u) => {
55
- d.updateItem({
56
- ...a,
57
- code: u
58
- });
59
- },
60
- key: a.sku._id,
61
- rules: [je()],
62
- labelMark: "required"
63
- });
64
- },
65
- enableSorting: !1
66
- },
67
- {
68
- id: "Name",
69
- header: () => y("inventory.transfer.form.items.table.Name"),
70
- minSize: 300,
71
- cell(n) {
72
- const a = n.row.original;
73
- return Z(he.FmTextField, {
74
- modelValue: a.name,
75
- "onUpdate:modelValue": (u) => {
76
- d.updateItem({
77
- ...a,
78
- name: u
79
- });
80
- },
81
- key: a.sku._id,
82
- rules: [je()],
83
- labelMark: "required"
84
- });
85
- },
86
- enableSorting: !1
87
- },
88
- {
89
- id: "Amount",
90
- header: () => y("inventory.transfer.form.items.table.Amount"),
91
- minSize: 200,
92
- cell(n) {
93
- var c, g, w;
94
- const a = n.row.original, u = (w = (g = (c = d.template) == null ? void 0 : c.purchaseOrder) == null ? void 0 : g.items) == null ? void 0 : w.find(
95
- (C) => C.sku._id === a.sku._id
96
- );
97
- return Z(it, {
98
- style: {
99
- flex: "1 1 0%"
100
- },
101
- modelValue: {
102
- amount: a.quantity ?? { amount: 1, precision: 0 },
103
- measurement: a.measurement ?? null
104
- },
105
- key: a.sku._id,
106
- unit: a.sku.unit,
107
- "onUpdate:modelValue": (C) => {
108
- const x = {
109
- ...a,
110
- quantity: C.amount,
111
- measurement: C.measurement
112
- };
113
- b.enableTotalCost && (x.totalCost = me(a.sku, a.quantity, a.measurement, {
114
- supplier: d.supplier,
115
- // NOTE: set undefined here if `manualTotalCost[row.sku._id] = false`, so that the function
116
- // will return the auto calculated default cost instead of the manual total cost
117
- manualTotalCost: i[a.sku._id] ? x.totalCost : void 0
118
- })), d.updateItem(x);
119
- },
120
- stepper: u == null ? void 0 : u.quantityStep,
121
- disableUnit: !!u,
122
- disabled: d.disabled,
123
- rules: [
124
- ut(
125
- +pe(
126
- (u == null ? void 0 : u.minimumQuantity) ?? {
127
- amount: 1,
128
- precision: dt(a.sku.unit, a.measurement)
129
- }
130
- )
131
- ),
132
- u != null && u.maximumQuantity ? Ye(
133
- +pe(u == null ? void 0 : u.maximumQuantity)
134
- ) : Ye(1 / 0),
135
- ...u != null && u.quantityStep ? [ct(u.quantityStep)] : []
136
- ],
137
- applyDefaultRules: !0
138
- });
139
- },
140
- enableSorting: !1
141
- },
142
- {
143
- id: "Cost",
144
- header: Ht,
145
- size: 180,
146
- cell(n) {
147
- const a = n.row.original, u = t(a.sku), c = v.value.xs || v.value.sm;
148
- return !i[a.sku._id] && u ? Z(
149
- "div",
150
- {
151
- class: [
152
- "flex gap-4 fm-typo-en-body-md-400 items-center",
153
- d.disabled ? "text-fm-color-typo-disabled" : ""
154
- ],
155
- key: a.sku._id
156
- },
157
- [
158
- Z(he.FmButton, {
159
- prependIcon: "edit",
160
- variant: Mt.Tertiary,
161
- disabled: d.disabled,
162
- onClick() {
163
- d.updateItem({
164
- ...a,
165
- totalCost: me(a.sku, a.quantity, a.measurement, {
166
- supplier: d.supplier
167
- })
168
- }), i[a.sku._id] = !0;
169
- }
170
- }),
171
- Z(
172
- "div",
173
- {
174
- class: "flex flex-col"
175
- },
176
- [
177
- Z(
178
- "span",
179
- c ? Oe(
180
- me(a.sku, a.quantity, a.measurement, {
181
- supplier: d.supplier
182
- })
183
- ) : pe(
184
- me(a.sku, a.quantity, a.measurement, {
185
- supplier: d.supplier
186
- })
187
- )
188
- ),
189
- Z(
190
- "span",
191
- {
192
- class: [
193
- "fm-typo-en-body-sm-400",
194
- d.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
195
- ]
196
- },
197
- y("inventory.transfer.form.items.autoCalculated")
198
- )
199
- ]
200
- )
201
- ]
202
- ) : Z(
203
- he.FmTextField,
204
- {
205
- modelValue: pe(a.totalCost ?? { amount: 0, precision: 0 }),
206
- key: a.sku._id,
207
- "onUpdate:modelValue": (g) => {
208
- d.updateItem({
209
- ...a,
210
- totalCost: {
211
- ...mt(+g),
212
- currency: pt()
213
- }
214
- });
215
- },
216
- rules: [Te(0), ft(2)]
217
- },
218
- {
219
- prepend() {
220
- return c ? Z(
221
- "div",
222
- {
223
- class: [
224
- "text-fm-typo-en-body-lg-400",
225
- d.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
226
- ]
227
- },
228
- Xe()
229
- ) : null;
230
- },
231
- append() {
232
- return u ? Z(he.FmButton, {
233
- prependIcon: "close",
234
- variant: "tertiary",
235
- disabled: d.disabled,
236
- onClick() {
237
- d.updateItem({
238
- ...a,
239
- // NOTE: different from PO template, if a default cost is reenabled,
240
- // the total cost will automatically assigned
241
- totalCost: me(a.sku, a.quantity, a.measurement, {
242
- supplier: d.supplier
243
- })
244
- }), i[a.sku._id] = !1;
245
- }
246
- }) : null;
247
- }
248
- }
249
- );
250
- },
251
- enableSorting: !1
252
- },
253
- {
254
- id: "Delete",
255
- header: "",
256
- cell(n) {
257
- const a = n.row.original;
258
- return Z(he.FmButton, {
259
- key: a.sku._id,
260
- class: "delete-button",
261
- type: "button",
262
- icon: "delete",
263
- variant: "tertiary",
264
- size: "md",
265
- disabled: d.disabled,
266
- onClick: () => {
267
- d.deleteItem(a);
268
- }
269
- });
270
- },
271
- enableSorting: !1,
272
- size: 40,
273
- meta: {
274
- cellClass: "",
275
- headerClass: ""
276
- }
277
- }
278
- ];
279
- return {
280
- columnDefs: M(() => b.enableTotalCost && d.transferType === Y.PURCHASE ? l : l.filter(
281
- (n) => n.id !== "Cost"
282
- /* Cost */
283
- ))
284
- };
285
- }
286
- const zt = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, jt = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, Yt = { class: "w-[450px] xs:w-full flex" }, Kt = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Qt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ot = /* @__PURE__ */ ie({
287
- __name: "SupplierPriceHistory",
288
- props: {
289
- prices: {}
290
- },
291
- setup(d) {
292
- const y = He();
293
- function i(v) {
294
- return y.suppliers.find((b) => b._id === v);
295
- }
296
- return (v, b) => (h(), I("div", zt, [
297
- (h(!0), I(fe, null, Ae(Object.keys(v.prices), (t) => {
298
- var l;
299
- return h(), I("div", {
300
- key: t,
301
- class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
302
- }, [
303
- o("div", jt, q((l = i(t)) == null ? void 0 : l.name), 1),
304
- o("div", Yt, [
305
- (h(!0), I(fe, null, Ae(v.prices[t].slice(0, 3), (_) => {
306
- var n;
307
- return h(), I("div", {
308
- key: _.date,
309
- class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
310
- }, [
311
- o("div", Kt, [
312
- o("span", null, q(_.totalCost ? e(Oe)(_.totalCost) : "No data"), 1),
313
- b[0] || (b[0] = o("span", { class: "text-fm-color-typo-secondary" }, "/", -1)),
314
- o("span", null, q(e(pe)(_.totalUnit, !1)), 1),
315
- o("span", null, q(((n = _.measurement) == null ? void 0 : n.abbrev) ?? _.unit.abbrev), 1)
316
- ]),
317
- o("div", Qt, [
318
- o("span", null, "(#" + q(_.seqNumber) + ")", 1),
319
- b[1] || (b[1] = o("span", null, q(" "), -1)),
320
- o("span", null, q(e(Ue)(new Date(_.date))), 1)
321
- ])
322
- ]);
323
- }), 128))
324
- ])
325
- ]);
326
- }), 128))
327
- ]));
328
- }
329
- }), Zt = { class: "flex flex-col gap-8 py-16" }, Gt = { class: "flex items-center" }, Jt = { class: "flex-1 flex gap-1 items-center" }, Wt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, es = { class: "flex gap-8 w-full" }, ts = { class: "flex-1 flex flex-col gap-4" }, ss = { class: "flex-1 flex flex-col gap-4" }, as = { class: "flex gap-8 w-full" }, os = { class: "flex-1 flex flex-col gap-4" }, ns = {
330
- key: 0,
331
- class: "flex-1 flex flex-col gap-4"
332
- }, ls = /* @__PURE__ */ ie({
333
- __name: "TransferItem",
334
- props: {
335
- cellByColId: {},
336
- comparePriceBySku: {},
337
- showComparePrice: { type: Boolean },
338
- row: {}
339
- },
340
- setup(d) {
341
- const { t: y } = ve();
342
- return (i, v) => {
343
- var l, _, n, a, u, c, g, w, C, x, D, V, W, E, S, R, O, U, F, A, z, j, f, m, N, te, H;
344
- const b = $("FmLabel"), t = $("FmSpacer");
345
- return h(), I("div", Zt, [
346
- o("div", Gt, [
347
- o("div", Jt, [
348
- o("span", Wt, " (" + q(i.row.original.sku.code) + ") ", 1),
349
- o("span", Xt, q(i.row.original.sku.name), 1)
350
- ]),
351
- o("div", null, [
352
- r(e(ae), {
353
- render: (n = (_ = (l = i.cellByColId.Delete) == null ? void 0 : l.column) == null ? void 0 : _.columnDef) == null ? void 0 : n.cell,
354
- props: (u = (a = i.cellByColId.Delete) == null ? void 0 : a.getContext) == null ? void 0 : u.call(a)
355
- }, null, 8, ["render", "props"])
356
- ])
357
- ]),
358
- o("div", es, [
359
- o("div", ts, [
360
- r(b, {
361
- label: e(y)(`inventory.transfer.form.items.table.${e(K).Code}`)
362
- }, null, 8, ["label"]),
363
- r(e(ae), {
364
- render: (w = (g = (c = i.cellByColId[e(K).Code]) == null ? void 0 : c.column) == null ? void 0 : g.columnDef) == null ? void 0 : w.cell,
365
- props: (x = (C = i.cellByColId[e(K).Code]) == null ? void 0 : C.getContext) == null ? void 0 : x.call(C)
366
- }, null, 8, ["render", "props"]),
367
- v[0] || (v[0] = o("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
368
- ]),
369
- o("div", ss, [
370
- r(b, {
371
- label: e(y)(`inventory.transfer.form.items.table.${e(K).Name}`)
372
- }, null, 8, ["label"]),
373
- r(e(ae), {
374
- render: (W = (V = (D = i.cellByColId[e(K).Name]) == null ? void 0 : D.column) == null ? void 0 : V.columnDef) == null ? void 0 : W.cell,
375
- props: (S = (E = i.cellByColId[e(K).Name]) == null ? void 0 : E.getContext) == null ? void 0 : S.call(E)
376
- }, null, 8, ["render", "props"]),
377
- v[1] || (v[1] = o("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
378
- ])
379
- ]),
380
- o("div", as, [
381
- o("div", os, [
382
- r(b, {
383
- label: e(y)(`inventory.transfer.form.items.table.${e(K).Amount}`)
384
- }, null, 8, ["label"]),
385
- r(e(ae), {
386
- render: (U = (O = (R = i.cellByColId[e(K).Amount]) == null ? void 0 : R.column) == null ? void 0 : O.columnDef) == null ? void 0 : U.cell,
387
- props: (A = (F = i.cellByColId[e(K).Amount]) == null ? void 0 : F.getContext) == null ? void 0 : A.call(F)
388
- }, null, 8, ["render", "props"]),
389
- v[2] || (v[2] = o("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
390
- ]),
391
- i.cellByColId[e(K).Cost] ? (h(), I("div", ns, [
392
- r(tt, { "z-index": 50 }, {
393
- default: T(() => [
394
- r(b, {
395
- label: e(y)(`inventory.transfer.form.items.table.${e(K).Cost}2`)
396
- }, null, 8, ["label"])
397
- ]),
398
- _: 1
399
- }),
400
- r(e(ae), {
401
- render: (f = (j = (z = i.cellByColId[e(K).Cost]) == null ? void 0 : z.column) == null ? void 0 : j.columnDef) == null ? void 0 : f.cell,
402
- props: (N = (m = i.cellByColId[e(K).Cost]) == null ? void 0 : m.getContext) == null ? void 0 : N.call(m)
403
- }, null, 8, ["render", "props"]),
404
- v[3] || (v[3] = o("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
405
- ])) : X("", !0)
406
- ]),
407
- i.showComparePrice && Object.keys(i.comparePriceBySku[(te = i.row.original.sku) == null ? void 0 : te._id] ?? {}).length > 0 ? (h(), I(fe, { key: 0 }, [
408
- r(t, { class: "h-8" }),
409
- r(ot, {
410
- prices: i.comparePriceBySku[(H = i.row.original.sku) == null ? void 0 : H._id]
411
- }, null, 8, ["prices"])
412
- ], 64)) : X("", !0)
413
- ]);
414
- };
415
- }
416
- });
417
- function rs(d) {
418
- const y = M({
419
- get() {
420
- const t = d.getEffectiveAt();
421
- return t ? new Date(t) : null;
422
- },
423
- set(t) {
424
- d.setEffectiveAt((t == null ? void 0 : t.toISOString()) ?? null);
425
- }
426
- }), i = M({
427
- get() {
428
- return !!y.value;
429
- },
430
- set(t) {
431
- t ? y.value = /* @__PURE__ */ new Date() : y.value = null;
432
- }
433
- }), v = M({
434
- get() {
435
- return y.value === null ? "" : Ue(y.value);
436
- },
437
- set(t) {
438
- t ? y.value = /* @__PURE__ */ new Date(`${t} ${b.value}`) : y.value = null;
439
- }
440
- }), b = M({
441
- get() {
442
- return y.value === null ? "" : vt(y.value);
443
- },
444
- set(t) {
445
- t ? y.value = /* @__PURE__ */ new Date(`${v.value} ${t}`) : y.value = null;
446
- }
447
- });
448
- return {
449
- backdatePo: y,
450
- backdateSwitch: i,
451
- backdateModel: v,
452
- backdateTimeModel: b
453
- };
454
- }
455
- const is = {
456
- width: "24",
457
- height: "24",
458
- viewBox: "0 0 24 24",
459
- fill: "none",
460
- xmlns: "http://www.w3.org/2000/svg"
461
- }, us = ["fill"], ds = ["fill"], cs = ["stroke"], ms = ["stroke"], ps = /* @__PURE__ */ ie({
462
- __name: "SparkIcon",
463
- props: {
464
- size: {
465
- type: Number,
466
- default: 24
467
- },
468
- color: {
469
- type: String,
470
- default: "#c7c7cc"
471
- }
472
- },
473
- setup(d) {
474
- return (y, i) => (h(), I("svg", is, [
475
- o("path", {
476
- d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
477
- fill: d.color
478
- }, null, 8, us),
479
- o("path", {
480
- d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
481
- fill: d.color
482
- }, null, 8, ds),
483
- o("path", {
484
- d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
485
- stroke: d.color,
486
- "stroke-width": "1.5",
487
- "stroke-linecap": "round",
488
- "stroke-linejoin": "round"
489
- }, null, 8, cs),
490
- o("path", {
491
- d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
492
- stroke: d.color,
493
- "stroke-width": "1.5",
494
- "stroke-linecap": "round",
495
- "stroke-linejoin": "round"
496
- }, null, 8, ms)
497
- ]));
498
- }
499
- }), fs = { class: "flex gap-8 items-center" }, vs = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, ys = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, bs = { class: "flex items-center w-full" }, gs = { class: "flex-1" }, _s = { class: "fm-typo-en-title-sm-800" }, ks = { class: "flex items-start gap-8" }, hs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Cs = { class: "flex gap-1" }, Ze = /* @__PURE__ */ ie({
500
- __name: "ForecastStock",
501
- props: {
502
- disabled: { type: Boolean }
503
- },
504
- emits: ["update:poItems"],
505
- setup(d, { emit: y }) {
506
- const i = y, v = L(!1), b = L(7), t = Rt(), l = Ie(), _ = Ee(), { t: n } = ve();
507
- async function a() {
508
- if (b.value < 1)
509
- return;
510
- v.value = !1, await t.readPurchaseOrder(b.value);
511
- const u = [];
512
- if (t.purchaseOrderForecast.skus.length <= 0) {
513
- l.open({
514
- message: n("inventory.transfer.form.items.forecastStock.notAvailable"),
515
- type: "info"
516
- });
517
- return;
518
- }
519
- const c = t.purchaseOrderForecast.skus.reduce((g, w) => {
520
- const C = _.skus.find((V) => V._id === w.id);
521
- if (g.find((V) => V.sku._id === w.id) || !C)
522
- return g;
523
- const D = {
524
- sku: C,
525
- code: C.code,
526
- name: C.name,
527
- quantity: {
528
- amount: w.amount,
529
- precision: 0
530
- }
531
- };
532
- return g.push(D), g;
533
- }, u);
534
- i("update:poItems", c);
535
- }
536
- return (u, c) => {
537
- const g = $("FmButton"), w = $("FmIcon"), C = $("FmStepperField"), x = $("FmPopover");
538
- return h(), J(x, {
539
- disabled: u.disabled,
540
- class: "flex",
541
- "show-popover": v.value,
542
- onPopoverChanged: c[3] || (c[3] = (D) => v.value = D)
543
- }, {
544
- "popover-button": T(() => [
545
- r(g, {
546
- label: "unused",
547
- variant: "secondary",
548
- "text-color": u.disabled ? "disabled" : "primary",
549
- "bg-color": "transparent",
550
- "border-color": u.disabled ? "disabled" : "primary",
551
- disabled: u.disabled
552
- }, {
553
- default: T(() => [
554
- o("div", fs, [
555
- r(ps, {
556
- size: 24,
557
- color: u.disabled ? "#c7c7cc" : "#ff7823"
558
- }, null, 8, ["color"]),
559
- o("div", vs, q(e(n)("inventory.transfer.form.items.forecastStock.title")), 1)
560
- ])
561
- ]),
562
- _: 1
563
- }, 8, ["text-color", "border-color", "disabled"])
564
- ]),
565
- default: T(() => [
566
- o("div", ys, [
567
- o("div", bs, [
568
- o("div", gs, [
569
- r(Nt, { "z-index": 99 }, {
570
- default: T(() => [
571
- o("p", _s, q(e(n)("inventory.transfer.form.items.forecastStock.title")), 1)
572
- ]),
573
- _: 1
574
- })
575
- ]),
576
- r(g, {
577
- icon: "close",
578
- size: "md",
579
- variant: "tertiary",
580
- onClick: c[0] || (c[0] = (D) => v.value = !1)
581
- })
582
- ]),
583
- r(C, {
584
- modelValue: b.value,
585
- "onUpdate:modelValue": c[1] || (c[1] = (D) => b.value = D),
586
- label: e(n)("inventory.transfer.form.items.forecastStock.days"),
587
- rules: [e(Te)(1)]
588
- }, {
589
- "helper-text": T(() => [
590
- o("div", ks, [
591
- r(w, {
592
- name: "warning",
593
- size: "sm",
594
- class: "text-fm-color-system-warning-300"
595
- }),
596
- o("div", hs, q(e(n)("inventory.transfer.form.items.forecastStock.replace")), 1)
597
- ])
598
- ]),
599
- _: 1
600
- }, 8, ["modelValue", "label", "rules"]),
601
- o("div", Cs, [
602
- c[4] || (c[4] = o("div", { class: "grow" }, null, -1)),
603
- r(g, {
604
- label: e(n)("common.cancel"),
605
- variant: "tertiary",
606
- onClick: c[2] || (c[2] = (D) => v.value = !1)
607
- }, null, 8, ["label"]),
608
- r(g, {
609
- label: e(n)("inventory.transfer.form.items.forecastStock.generate"),
610
- onClick: a
611
- }, null, 8, ["label"])
612
- ])
613
- ])
614
- ]),
615
- _: 1
616
- }, 8, ["disabled", "show-popover"]);
617
- };
618
- }
619
- });
620
- function xs() {
621
- const d = Ie(), y = et(), i = L(!1);
622
- Se(i, (l) => {
623
- l && (b.value = !0, v().finally(() => {
624
- b.value = !1;
625
- }));
626
- });
627
- async function v() {
628
- try {
629
- const { startDate: l, endDate: _ } = yt(6), u = (await y.getPurchaseOrders({ start: l, end: _ })).filter(
630
- (c) => {
631
- var g, w;
632
- return c.status === bt.enum.COMPLETE && ((g = c.supplier) == null ? void 0 : g.internal) !== "warehouse" && ((w = c.supplier) == null ? void 0 : w.internal) !== "restaurant";
633
- }
634
- ).reduce((c, g) => {
635
- const w = new Date(gt(g._id)), C = g.supplier._id;
636
- for (const x of g.items) {
637
- if (!x.totalCost) continue;
638
- const D = c[x.sku._id] ?? {}, V = D[C] ?? [];
639
- V.push({
640
- date: w.toISOString(),
641
- totalUnit: x.quantity,
642
- totalCost: x.totalCost,
643
- unit: x.sku.unit,
644
- measurement: x.measurement,
645
- seqNumber: g.seqNumber
646
- }), D[C] = V, c[x.sku._id] = D;
647
- }
648
- return c;
649
- }, {});
650
- t.value = u;
651
- } catch {
652
- d.open({
653
- title: "Something went wrong",
654
- message: "Cannot retrieve supplier purchase history. Please try again."
655
- }), i.value = !1;
656
- }
657
- }
658
- const b = L(!1), t = L({});
659
- return {
660
- comparePricesToggle: i,
661
- comparePriceFetching: b,
662
- comparePriceBySku: t
663
- };
664
- }
665
- const ws = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, Ss = { key: 0 }, Ds = ["colspan"], Fs = /* @__PURE__ */ ie({
666
- __name: "TransferItemTable",
667
- props: {
668
- row: {},
669
- comparePriceBySku: {},
670
- showComparePrice: { type: Boolean }
671
- },
672
- setup(d) {
673
- function y(i) {
674
- return i.column.columnDef.meta;
675
- }
676
- return (i, v) => {
677
- var b, t;
678
- return h(), I(fe, null, [
679
- o("tr", {
680
- class: G(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
681
- "bg-fm-color-neutral-gray-100": i.row.getIsSelected()
682
- }])
683
- }, [
684
- (h(!0), I(fe, null, Ae(i.row.getVisibleCells(), (l) => {
685
- var _, n, a, u;
686
- return h(), I("td", {
687
- key: l.id,
688
- class: G([
689
- "h-[52px] px-16 text-fm-color-typo-primary",
690
- ((_ = y(l)) == null ? void 0 : _.cellClass) ?? "px-16"
691
- ]),
692
- style: We({
693
- width: (n = y(l)) == null ? void 0 : n.width,
694
- maxWidth: (a = y(l)) == null ? void 0 : a.maxWidth,
695
- textAlign: ((u = y(l)) == null ? void 0 : u.textAlign) ?? "left"
696
- })
697
- }, [
698
- o("span", ws, [
699
- r(e(ae), {
700
- render: l.column.columnDef.cell,
701
- props: l.getContext()
702
- }, null, 8, ["render", "props"])
703
- ])
704
- ], 6);
705
- }), 128))
706
- ], 2),
707
- i.showComparePrice && Object.keys(i.comparePriceBySku[(b = i.row.original.sku) == null ? void 0 : b._id] ?? {}).length > 0 ? (h(), I("tr", Ss, [
708
- o("td", {
709
- colspan: i.row.getVisibleCells().length
710
- }, [
711
- r(ot, {
712
- prices: i.comparePriceBySku[(t = i.row.original.sku) == null ? void 0 : t._id]
713
- }, null, 8, ["prices"])
714
- ], 8, Ds)
715
- ])) : X("", !0)
716
- ], 64);
717
- };
718
- }
719
- }), $s = { class: "flex flex-col gap-4" }, Ps = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, Ts = { class: "flex flex-col gap-16" }, Is = { class: "flex flex-col gap-24" }, Rs = { class: "flex flex-col gap-8" }, Vs = { class: "flex flex-col gap-4" }, As = { class: "flex flex-col gap-8" }, Ms = { class: "flex flex-col gap-4" }, qs = {
720
- key: 2,
721
- class: "flex flex-col gap-8"
722
- }, Os = { class: "flex flex-col gap-4" }, Us = {
723
- key: 3,
724
- class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
725
- }, Es = {
726
- key: 0,
727
- class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
728
- }, Bs = { class: "flex-1" }, Ns = { class: "flex-1" }, Hs = {
729
- key: 1,
730
- class: "flex items-center gap-4"
731
- }, Ls = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, zs = { class: "flex flex-col gap-16" }, js = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, Ys = { class: "flex gap-8" }, Ks = { key: 0 }, Qs = /* @__PURE__ */ ie({
732
- __name: "TransferForm2",
733
- props: {
734
- modelValue: {},
735
- request: {},
736
- disabled: { type: Boolean },
737
- suppliers: {},
738
- skus: {},
739
- lastClosingDate: {}
740
- },
741
- emits: ["validation-success", "form:ready"],
742
- setup(d, { expose: y, emit: i }) {
743
- const v = d, b = i, t = Bt(), { t: l } = ve(), _ = Be(), n = Ee(), a = Ct(), u = He(), c = qe(), g = st(), { breakpoints: w } = Ne(), C = M(() => w.value.xs || w.value.sm), x = M(
744
- () => {
745
- var s;
746
- return ((s = v.modelValue) == null ? void 0 : s.templateDoc) ?? g.templates.value.find((p) => p._id === t.template);
747
- }
748
- ), D = M(() => t.status === "DRAFT" || !t._rev);
749
- Se(x, (s) => {
750
- s && D.value && (t.supplier = (s == null ? void 0 : s.purchaseOrder.supplier) ?? t.supplier);
751
- }), Je(() => {
752
- var s, p;
753
- try {
754
- if (!t.template) return;
755
- if (!t.items.length) {
756
- if (t.items = ((s = x.value) == null ? void 0 : s.purchaseOrder.items) ?? [], !a.isEnabled) return;
757
- const B = a.currentLocationSubsidiary();
758
- t.netSuite = {
759
- ...t.netSuite,
760
- subsidiary: {
761
- id: B.id,
762
- name: B.name
763
- }
764
- };
765
- const se = a.getAvailableItems((p = t.netSuite) == null ? void 0 : p.subsidiary.id), ee = t.items.map((Q) => Q.sku._id).filter((Q) => se.includes(Q));
766
- t.items = t.items.filter((Q) => ee.includes(Q.sku._id));
767
- }
768
- } finally {
769
- b("form:ready");
770
- }
771
- });
772
- const V = M(
773
- () => _.currentLocation.type === _t.restaurant
774
- );
775
- _.watchLocation(async () => {
776
- location && (t.supplier || (t.supplier = u.suppliers.find((s) => s) ?? t.supplier));
777
- });
778
- const W = qt(), E = Ut(
779
- () => t,
780
- (s) => {
781
- Object.assign(t, s);
782
- },
783
- !0,
784
- !0
785
- ), S = M({
786
- get() {
787
- var s;
788
- return typeof ((s = t == null ? void 0 : t.supplier) == null ? void 0 : s.internal) == "string" ? Y.TRANSFER : Y.PURCHASE;
789
- },
790
- set(s) {
791
- var B;
792
- const p = typeof ((B = t == null ? void 0 : t.supplier) == null ? void 0 : B.internal) == "string" ? Y.TRANSFER : Y.PURCHASE;
793
- s !== p && (t.supplier = s === Y.PURCHASE ? E.locationOptionsTypePurchase.value[0] : E.locationOptionsTypeTransfer.value[0]);
794
- }
795
- }), R = M(() => E.transferLocationOptions.value), O = M({
796
- get() {
797
- return t.supplier._id;
798
- },
799
- set(s) {
800
- E.transferLocationModel.value = s;
801
- }
802
- }), U = M({
803
- get() {
804
- return t.remark ?? void 0;
805
- },
806
- set(s) {
807
- t.remark = s;
808
- }
809
- }), F = M(() => a.currentLocationSubsidiary()), { backdatePo: A, backdateSwitch: z, backdateModel: j, backdateTimeModel: f } = rs({
810
- getEffectiveAt() {
811
- return t.effectiveAt;
812
- },
813
- setEffectiveAt(s) {
814
- t.effectiveAt = s;
815
- }
816
- }), { comparePricesToggle: m, comparePriceFetching: N, comparePriceBySku: te } = xs(), H = L();
817
- y({
818
- validateInputs: () => {
819
- var s, p;
820
- (p = (s = H.value) == null ? void 0 : s.validateInputs) == null || p.call(s);
821
- },
822
- resetInputsValidation: () => {
823
- var s, p;
824
- (p = (s = H.value) == null ? void 0 : s.resetInputsValidation) == null || p.call(s);
825
- },
826
- resetInputs: () => {
827
- var s, p;
828
- (p = (s = H.value) == null ? void 0 : s.resetInputs) == null || p.call(s);
829
- }
830
- });
831
- const De = Lt({
832
- updateItem: (s) => {
833
- t.items = t.items.map((p) => p.sku._id !== s.sku._id ? p : s);
834
- },
835
- deleteItem: (s) => {
836
- t.items = t.items.filter((p) => p.sku._id !== s.sku._id);
837
- },
838
- get supplier() {
839
- return t.supplier;
840
- },
841
- get items() {
842
- return t.items;
843
- },
844
- get transferType() {
845
- return S.value;
846
- },
847
- get template() {
848
- return x.value;
849
- },
850
- get disabled() {
851
- return v.disabled;
852
- }
853
- }), ye = M(() => De.columnDefs.value);
854
- function Fe() {
855
- var ue, oe, le, be;
856
- const s = new Set((le = (oe = (ue = x.value) == null ? void 0 : ue.purchaseOrder) == null ? void 0 : oe.items) == null ? void 0 : le.map((P) => P.sku._id)), p = a.isEnabled ? a.getAvailableItems((be = t.netSuite) == null ? void 0 : be.subsidiary.id) : [], B = s.size ? n.skus.filter((P) => s.has(P._id)) : n.skus, se = a.isEnabled ? B.map((P) => P._id).filter((P) => p.includes(P)) : B.map((P) => P._id), ee = B.map(
857
- (P) => ({
858
- label: P.name,
859
- sublabel: P.code,
860
- value: P,
861
- disabled: !se.includes(P._id)
862
- })
863
- ), Q = ee.filter((P) => {
864
- var de;
865
- return (de = t.items) == null ? void 0 : de.find((ge) => ge.sku._id === P.value._id);
866
- }).map((P) => P.value);
867
- W.open({
868
- title: l("inventory.transfer.form.items.selectItem"),
869
- closeButton: !0,
870
- contentComponent: xt,
871
- contentComponentProps: {
872
- modelValue: Q,
873
- items: ee,
874
- virtualScroll: !0
875
- },
876
- primaryActions: {
877
- text: l("common.confirm"),
878
- close: !0
879
- },
880
- secondaryActions: {
881
- text: l("common.close"),
882
- close: !0,
883
- variant: "tertiary"
884
- }
885
- }).onPrimary((P) => {
886
- const de = t.items ?? [], ge = P.map((ne) => {
887
- var $e, xe;
888
- const _e = de.find((ke) => ke.sku._id === ne._id);
889
- if (_e)
890
- return _e;
891
- const ce = ((xe = ($e = x.value) == null ? void 0 : $e.purchaseOrder.items) == null ? void 0 : xe.find(
892
- (ke) => ke.sku._id === ne._id
893
- )) ?? {
894
- sku: ne,
895
- code: ne.code,
896
- name: ne.name,
897
- quantity: {
898
- amount: 1,
899
- precision: 0
900
- }
901
- };
902
- return S.value == Y.PURCHASE && (ce.totalCost = me(
903
- ce.sku,
904
- ce.quantity,
905
- ce.measurement,
906
- {
907
- supplier: t.supplier
908
- }
909
- )), ce;
910
- });
911
- ge.sort((ne, _e) => ne.sku.code.localeCompare(_e.sku.code)), t.items = ge;
912
- });
913
- }
914
- function Re(s) {
915
- return s;
916
- }
917
- return (s, p) => {
918
- var xe, ke;
919
- const B = $("FmChip"), se = $("FmLabel"), ee = $("FmField"), Q = $("FmSelect"), ue = $("FmTextField"), oe = $("FmTextarea"), le = $("FmSwitch"), be = $("FmDatePicker"), P = $("FmTimePicker"), de = $("FmFormGroup"), ge = $("FmIcon"), ne = $("FmButton"), _e = $("FmTooltip"), ce = $("FmTable"), $e = $("FmForm");
920
- return h(), I("div", $s, [
921
- o("div", Ps, [
922
- (xe = v.modelValue) != null && xe.template ? (h(), J(B, {
923
- key: 0,
924
- variant: s.disabled ? "warning" : void 0,
925
- label: `${e(l)("inventory.transfer.template.title")}: ${((ke = x.value) == null ? void 0 : ke.name) ?? e(l)("inventory.transfer.form.loading")}`,
926
- icon: "summarize",
927
- compact: ""
928
- }, null, 8, ["variant", "label"])) : X("", !0),
929
- r(B, {
930
- label: e(_).currentLocation.name,
931
- icon: "storefront",
932
- compact: ""
933
- }, null, 8, ["label"]),
934
- s.lastClosingDate ? (h(), J(B, {
935
- key: 1,
936
- label: `${e(l)("inventory.transfer.form.lastClosing")}: ${e(Ue)(s.lastClosingDate)} ${e(kt)(s.lastClosingDate)}`,
937
- icon: "calendar_month",
938
- compact: ""
939
- }, null, 8, ["label"])) : X("", !0)
940
- ]),
941
- r($e, {
942
- ref_key: "formRef",
943
- ref: H,
944
- class: "flex flex-col gap-32",
945
- disabled: s.disabled,
946
- onValidationFailed: console.log,
947
- onValidationSuccess: p[12] || (p[12] = (Ve) => b("validation-success"))
948
- }, {
949
- default: T(() => {
950
- var Ve, Le;
951
- return [
952
- o("div", Ts, [
953
- o("div", Is, [
954
- (Ve = v.modelValue) != null && Ve.template ? (h(), I(fe, { key: 0 }, [
955
- o("div", Rs, [
956
- r(se, {
957
- label: e(l)("inventory.transfer.form.type.title")
958
- }, null, 8, ["label"]),
959
- o("div", Vs, [
960
- r(ee, null, {
961
- default: T(() => [
962
- o("span", {
963
- class: G({ "text-fm-color-typo-disabled": s.disabled })
964
- }, q(e(l)(`inventory.transfer.form.type.${S.value.toLocaleLowerCase("en-us")}`)), 3)
965
- ]),
966
- _: 1
967
- }),
968
- o("div", {
969
- class: G([
970
- "fm-typo-en-body-sm-400",
971
- s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
972
- ])
973
- }, " This field is locked from template. ", 2)
974
- ])
975
- ]),
976
- o("div", As, [
977
- r(se, {
978
- label: S.value === e(Y).PURCHASE ? e(l)("inventory.transfer.form.purchaseFrom") : e(l)("inventory.transfer.form.transferFrom")
979
- }, null, 8, ["label"]),
980
- o("div", Ms, [
981
- r(ee, null, {
982
- default: T(() => {
983
- var k;
984
- return [
985
- o("span", {
986
- class: G({ "text-fm-color-typo-disabled": s.disabled })
987
- }, q((k = R.value.find((re) => re.value === O.value)) == null ? void 0 : k.label), 3)
988
- ];
989
- }),
990
- _: 1
991
- }),
992
- o("div", {
993
- class: G([
994
- "fm-typo-en-body-sm-400",
995
- s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
996
- ])
997
- }, " This field is locked from template. ", 2)
998
- ])
999
- ])
1000
- ], 64)) : (h(), I(fe, { key: 1 }, [
1001
- r(Q, {
1002
- label: e(l)("inventory.transfer.form.type.title"),
1003
- "model-value": S.value,
1004
- "onUpdate:modelValue": p[0] || (p[0] = (k) => S.value = k),
1005
- items: [
1006
- {
1007
- label: e(l)("inventory.transfer.form.type.purchase"),
1008
- value: e(Y).PURCHASE,
1009
- disabled: !e(E).locationOptionsTypePurchase.value.length,
1010
- sublabel: e(E).locationOptionsTypePurchase.value.length ? void 0 : e(l)("inventory.transfer.form.noSupplierAvailable")
1011
- },
1012
- {
1013
- label: e(l)("inventory.transfer.form.type.transfer"),
1014
- value: e(Y).TRANSFER,
1015
- disabled: !e(E).locationOptionsTypeTransfer.value.length,
1016
- sublabel: e(E).locationOptionsTypeTransfer.value.length ? void 0 : e(l)("inventory.transfer.form.noLocationAvailable")
1017
- }
1018
- ],
1019
- rules: [e(Te)(1)(R.value)]
1020
- }, null, 8, ["label", "model-value", "items", "rules"]),
1021
- r(Q, {
1022
- label: S.value === e(Y).PURCHASE ? e(l)("inventory.transfer.form.purchaseFrom") : e(l)("inventory.transfer.form.transferFrom"),
1023
- modelValue: O.value,
1024
- "onUpdate:modelValue": p[1] || (p[1] = (k) => O.value = k),
1025
- items: R.value
1026
- }, {
1027
- "menu-wrapper": T((k) => {
1028
- var re, ze;
1029
- return [
1030
- r(Et, Me(k, {
1031
- items: R.value,
1032
- "model-value": (ze = (re = s.modelValue) == null ? void 0 : re.supplier) == null ? void 0 : ze._id
1033
- }), null, 16, ["items", "model-value"])
1034
- ];
1035
- }),
1036
- _: 1
1037
- }, 8, ["label", "modelValue", "items"])
1038
- ], 64)),
1039
- r(ue, {
1040
- label: e(l)("inventory.transfer.form.reference"),
1041
- "label-mark": "optional",
1042
- modelValue: e(t).ref,
1043
- "onUpdate:modelValue": p[2] || (p[2] = (k) => e(t).ref = k)
1044
- }, null, 8, ["label", "modelValue"]),
1045
- r(oe, {
1046
- label: e(l)("inventory.transfer.form.remark"),
1047
- "label-mark": "optional",
1048
- "max-length": 240,
1049
- modelValue: U.value,
1050
- "onUpdate:modelValue": p[3] || (p[3] = (k) => U.value = k),
1051
- class: G([s.disabled ? "text-fm-color-typo-disabled " : ""])
1052
- }, null, 8, ["label", "modelValue", "class"]),
1053
- e(a).isEnabled ? (h(), I("div", qs, [
1054
- r(se, {
1055
- label: `NetSuite ${e(l)("inventory.transfer.form.netsuite.subsidiary")}`
1056
- }, null, 8, ["label"]),
1057
- o("div", Os, [
1058
- r(ee, null, {
1059
- default: T(() => {
1060
- var k;
1061
- return [
1062
- o("span", {
1063
- class: G({ "text-fm-color-typo-disabled": s.disabled })
1064
- }, q((k = F.value) == null ? void 0 : k.fullName), 3)
1065
- ];
1066
- }),
1067
- _: 1
1068
- }),
1069
- o("div", {
1070
- class: G([
1071
- "fm-typo-en-body-sm-400",
1072
- s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
1073
- ])
1074
- }, " This field is based on selected location. ", 2)
1075
- ])
1076
- ])) : X("", !0),
1077
- e(c).enableBackdatePo ? (h(), I("div", Us, [
1078
- o("div", {
1079
- class: G([
1080
- "flex",
1081
- {
1082
- "flex-col": C.value
1083
- }
1084
- ])
1085
- }, [
1086
- r(le, {
1087
- modelValue: e(z),
1088
- "onUpdate:modelValue": p[4] || (p[4] = (k) => Ce(z) ? z.value = k : null),
1089
- label: e(l)("inventory.transfer.form.backdate.title"),
1090
- sublabel: e(l)("inventory.transfer.form.backdate.subtitle"),
1091
- "label-placement": "right",
1092
- disabled: V.value && !s.lastClosingDate || s.disabled
1093
- }, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
1094
- o("div", {
1095
- class: G({ hidden: C.value, "w-16": !C.value })
1096
- }, null, 2),
1097
- e(z) ? (h(), I("div", Es, [
1098
- o("div", Bs, [
1099
- r(be, {
1100
- modelValue: e(j),
1101
- "onUpdate:modelValue": p[5] || (p[5] = (k) => Ce(j) ? j.value = k : null)
1102
- }, null, 8, ["modelValue"])
1103
- ]),
1104
- o("div", Ns, [
1105
- r(P, {
1106
- modelValue: e(f),
1107
- "onUpdate:modelValue": p[6] || (p[6] = (k) => Ce(f) ? f.value = k : null)
1108
- }, null, 8, ["modelValue"])
1109
- ])
1110
- ])) : X("", !0)
1111
- ], 2),
1112
- e(A) ? (h(), J(de, {
1113
- key: 0,
1114
- modelValue: e(A),
1115
- "onUpdate:modelValue": p[7] || (p[7] = (k) => Ce(A) ? A.value = k : null),
1116
- rules: [e(ht)(new Date(s.lastClosingDate), /* @__PURE__ */ new Date())]
1117
- }, null, 8, ["modelValue", "rules"])) : X("", !0),
1118
- V.value && !s.lastClosingDate ? (h(), I("div", Hs, [
1119
- r(ge, {
1120
- name: "error",
1121
- size: "sm",
1122
- class: "text-fm-color-typo-warning"
1123
- }),
1124
- o("span", Ls, q(e(l)("inventory.transfer.form.backdate.error")), 1)
1125
- ])) : X("", !0)
1126
- ])) : X("", !0)
1127
- ])
1128
- ]),
1129
- o("div", zs, [
1130
- r(de, {
1131
- "model-value": e(t).items,
1132
- rules: [e(Te)(1)]
1133
- }, null, 8, ["model-value", "rules"]),
1134
- o("div", {
1135
- class: G([
1136
- "flex gap-16",
1137
- {
1138
- "flex-col items-start": C.value,
1139
- "items-center": !C.value
1140
- }
1141
- ])
1142
- }, [
1143
- o("div", js, q(e(l)("inventory.transfer.form.items.title")), 1),
1144
- o("div", Ys, [
1145
- r(ne, {
1146
- disabled: s.disabled,
1147
- label: e(l)("inventory.transfer.form.items.addItem"),
1148
- "prepend-icon": "add",
1149
- variant: "secondary",
1150
- "text-color": "primary",
1151
- "bg-color": "transparent",
1152
- "border-color": "primary",
1153
- onClick: p[8] || (p[8] = (k) => Fe()),
1154
- size: "md"
1155
- }, null, 8, ["disabled", "label"]),
1156
- e(t).template ? (h(), J(_e, {
1157
- key: 0,
1158
- "z-index": 50
1159
- }, {
1160
- content: T(() => [
1161
- o("div", null, q(e(l)("inventory.transfer.form.items.forecastStock.notAvailable")), 1)
1162
- ]),
1163
- default: T(() => [
1164
- r(Ze, {
1165
- "onUpdate:poItems": p[9] || (p[9] = (k) => e(t).items = k),
1166
- disabled: ""
1167
- })
1168
- ]),
1169
- _: 1
1170
- })) : (h(), J(Ze, {
1171
- key: 1,
1172
- "onUpdate:poItems": p[10] || (p[10] = (k) => e(t).items = k),
1173
- disabled: s.disabled || !!e(t).template
1174
- }, null, 8, ["disabled"]))
1175
- ])
1176
- ], 2),
1177
- S.value === e(Y).PURCHASE && D.value && e(c).enableTotalCost && ((Le = s.modelValue) != null && Le.items.length) ? (h(), I("div", Ks, [
1178
- r(le, {
1179
- label: e(N) ? e(l)("inventory.transfer.form.items.fetchingData") : e(l)("inventory.transfer.form.items.comparePriceHistory"),
1180
- "prepend-icon": "compare_arrows",
1181
- "label-placement": "right",
1182
- "model-value": e(m),
1183
- "onUpdate:modelValue": p[11] || (p[11] = (k) => Ce(m) ? m.value = k : null),
1184
- disabled: e(N) || s.disabled
1185
- }, null, 8, ["label", "model-value", "disabled"])
1186
- ])) : X("", !0),
1187
- (h(), J(ce, {
1188
- "column-defs": ye.value,
1189
- "row-data": e(t).items,
1190
- key: e(t).items.map((k) => k.sku._id).join("."),
1191
- "hide-footer": "",
1192
- "page-size": e(t).items.length
1193
- }, {
1194
- "table-row": T((k) => [
1195
- r(Fs, {
1196
- "compare-price-by-sku": e(te),
1197
- "show-compare-price": S.value === e(Y).PURCHASE && e(m),
1198
- row: k
1199
- }, null, 8, ["compare-price-by-sku", "show-compare-price", "row"])
1200
- ]),
1201
- "list-row": T((k) => [
1202
- (h(), J(at, {
1203
- row: k,
1204
- key: e(t).items.map((re) => re.sku._id).join(".")
1205
- }, {
1206
- default: T((re) => [
1207
- r(ls, {
1208
- "compare-price-by-sku": e(te),
1209
- "show-compare-price": S.value === e(Y).PURCHASE && e(m),
1210
- row: k,
1211
- "cell-by-col-id": re
1212
- }, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
1213
- ]),
1214
- _: 2
1215
- }, 1032, ["row"]))
1216
- ]),
1217
- _: 1
1218
- }, 8, ["column-defs", "row-data", "page-size"]))
1219
- ])
1220
- ];
1221
- }),
1222
- _: 1
1223
- }, 8, ["disabled", "onValidationFailed"])
1224
- ]);
1225
- };
1226
- }
1227
- }), Zs = { class: "flex items-center" }, Gs = { class: "fm-typo-en-title-md-800" }, Js = { class: "flex gap-4" }, Ws = /* @__PURE__ */ ie({
1228
- __name: "TransferDialog",
1229
- props: {
1230
- mode: {},
1231
- modelValue: {},
1232
- templateId: {},
1233
- show: { type: Boolean },
1234
- lastClosingDate: {}
1235
- },
1236
- emits: ["update:show", "submitted"],
1237
- setup(d, { expose: y, emit: i }) {
1238
- var j;
1239
- const v = d, b = i, t = et(), l = st(), _ = Ie(), n = He(), a = Ee(), u = Be(), { t: c } = ve(), g = L(!1), w = L(!1), C = L(!1);
1240
- async function x(f) {
1241
- if (f) {
1242
- w.value = !1;
1243
- try {
1244
- await n.readSuppliers(), w.value = !0;
1245
- } catch {
1246
- _.open({
1247
- title: c("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
1248
- message: c("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
1249
- type: "error"
1250
- });
1251
- }
1252
- }
1253
- }
1254
- u.watchLocation(x);
1255
- function D() {
1256
- return {
1257
- remark: void 0,
1258
- ref: void 0,
1259
- stockSnapshotId: void 0,
1260
- effectiveAt: void 0,
1261
- items: [],
1262
- supplier: {
1263
- _rev: void 0,
1264
- email: void 0,
1265
- internal: void 0,
1266
- contactName: void 0,
1267
- phoneNumber: void 0,
1268
- registrationNumber: void 0,
1269
- supplyItems: void 0,
1270
- _id: "",
1271
- name: "",
1272
- address: {
1273
- line2: void 0,
1274
- line1: "",
1275
- state: "",
1276
- city: "",
1277
- postcode: "",
1278
- country: ""
1279
- }
1280
- },
1281
- status: "DRAFT",
1282
- _id: "",
1283
- seqNumber: 0,
1284
- deliveryOrder: [],
1285
- template: v.templateId,
1286
- templateDoc: l.templates.value.find((m) => m._id === v.templateId)
1287
- };
1288
- }
1289
- const V = Ot(v, "show"), W = L(v.modelValue ?? D()), E = L(((j = v.modelValue) == null ? void 0 : j._id) ?? `${Math.random()}`);
1290
- Se(
1291
- () => v.show,
1292
- (f) => {
1293
- var m;
1294
- f && (C.value = !1, W.value = v.modelValue ?? D(), E.value = ((m = v.modelValue) == null ? void 0 : m._id) ?? `${Math.random()}`);
1295
- }
1296
- );
1297
- const S = M(() => !w.value || !C.value), R = M(() => {
1298
- switch (v.mode) {
1299
- case we.READ:
1300
- return "View transfer";
1301
- case we.CREATE:
1302
- return c("inventory.transfer.receiveRequest.create.title");
1303
- case we.UPDATE:
1304
- return c("inventory.transfer.receiveRequest.update.title");
1305
- }
1306
- return "";
1307
- }), O = L();
1308
- y({
1309
- validateInputs: () => {
1310
- var f, m;
1311
- (m = (f = O.value) == null ? void 0 : f.validateInputs) == null || m.call(f);
1312
- },
1313
- resetInputsValidation: () => {
1314
- var f, m;
1315
- (m = (f = O.value) == null ? void 0 : f.resetInputsValidation) == null || m.call(f);
1316
- },
1317
- resetInputs: () => {
1318
- var f, m;
1319
- (m = (f = O.value) == null ? void 0 : f.resetInputs) == null || m.call(f);
1320
- }
1321
- });
1322
- async function U() {
1323
- const f = W.value;
1324
- g.value = !0, (f.supplier.internal === "warehouse" || f.supplier.internal === "restaurant") && (f.items = f.items.map(({ totalCost: m, ...N }) => N));
1325
- try {
1326
- await t.createPurchaseOrder(f), await new Promise((m) => setTimeout(m, 1e3)), _.open({
1327
- title: c("inventory.transfer.receiveRequest.create.success"),
1328
- message: c("inventory.transfer.receiveRequest.create.successMessage"),
1329
- type: "success"
1330
- }), b("update:show", !1), b("submitted");
1331
- } catch (m) {
1332
- _.open({
1333
- title: c("inventory.transfer.receiveRequest.create.error.title"),
1334
- message: c("inventory.transfer.receiveRequest.create.error.message"),
1335
- type: "error"
1336
- }), console.error("Error in creating purchase order", m);
1337
- } finally {
1338
- g.value = !1;
1339
- }
1340
- }
1341
- async function F() {
1342
- const f = W.value;
1343
- g.value = !0, (f.supplier.internal === "warehouse" || f.supplier.internal === "restaurant") && (f.items = f.items.map(({ totalCost: m, ...N }) => N));
1344
- try {
1345
- await t.updatePurchaseOrder(f), await new Promise((m) => setTimeout(m, 1e3)), _.open({
1346
- title: c("inventory.transfer.receiveRequest.update.success"),
1347
- message: c("inventory.transfer.receiveRequest.update.successMessage"),
1348
- type: "success"
1349
- }), b("update:show", !1), b("submitted");
1350
- } catch (m) {
1351
- _.open({
1352
- title: c("inventory.transfer.receiveRequest.update.error.title"),
1353
- message: c("inventory.transfer.receiveRequest.update.error.message"),
1354
- type: "error"
1355
- }), console.error("Error in updating purchase order", m);
1356
- } finally {
1357
- g.value = !1;
1358
- }
1359
- }
1360
- function A() {
1361
- switch (v.mode) {
1362
- case we.CREATE:
1363
- return U();
1364
- case we.UPDATE:
1365
- return F();
1366
- }
1367
- }
1368
- function z() {
1369
- var f, m;
1370
- (m = (f = O.value) == null ? void 0 : f.validateInputs) == null || m.call(f);
1371
- }
1372
- return (f, m) => {
1373
- const N = $("FmButton"), te = $("FmSideSheet");
1374
- return h(), J(te, {
1375
- modelValue: e(V),
1376
- "onUpdate:modelValue": m[3] || (m[3] = (H) => Ce(V) ? V.value = H : null),
1377
- "dismiss-away": "",
1378
- "close-button": "",
1379
- "max-width": 900
1380
- }, {
1381
- "side-sheet-header": T(() => [
1382
- o("div", Zs, [
1383
- o("div", Gs, q(R.value), 1)
1384
- ])
1385
- ]),
1386
- default: T(() => [
1387
- (h(), J(Qs, {
1388
- class: "w-full",
1389
- ref_key: "formRef",
1390
- ref: O,
1391
- "onForm:ready": m[0] || (m[0] = () => C.value = !0),
1392
- onValidationSuccess: A,
1393
- modelValue: W.value,
1394
- "onUpdate:modelValue": m[1] || (m[1] = (H) => W.value = H),
1395
- disabled: g.value || S.value,
1396
- suppliers: e(n).suppliers,
1397
- skus: e(a).skus,
1398
- key: E.value,
1399
- "last-closing-date": f.lastClosingDate
1400
- }, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
1401
- ]),
1402
- "side-sheet-footer": T(() => [
1403
- o("div", Js, [
1404
- r(N, {
1405
- loading: g.value,
1406
- disabled: S.value,
1407
- label: e(c)("common.save"),
1408
- onClick: z
1409
- }, null, 8, ["loading", "disabled", "label"]),
1410
- r(N, {
1411
- disabled: S.value,
1412
- variant: "tertiary",
1413
- label: e(c)("common.close"),
1414
- onClick: m[2] || (m[2] = (H) => b("update:show", !1))
1415
- }, null, 8, ["disabled", "label"])
1416
- ])
1417
- ]),
1418
- _: 1
1419
- }, 8, ["modelValue"]);
1420
- };
1421
- }
1422
- }), Xs = { class: "flex flex-col py-8" }, ea = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ta = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, sa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1" }, aa = {
1423
- key: 0,
1424
- class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
1425
- }, oa = { class: "pt-8" }, Ge = "ReceiveRequestViewSearchCriteria", ka = /* @__PURE__ */ ie({
1426
- __name: "ReceiveRequestView",
1427
- setup(d) {
1428
- const { t: y } = ve(), i = Ie();
1429
- Pe.object({
1430
- name: Pe.string().optional().nullable(),
1431
- startDate: Pe.string().optional().nullable(),
1432
- endDate: Pe.string().optional().nullable()
1433
- });
1434
- const v = wt(), b = qe();
1435
- function t() {
1436
- const S = {
1437
- name: "",
1438
- ...Qe()
1439
- }, R = v.getItem(Ge);
1440
- if (!R)
1441
- return S;
1442
- try {
1443
- return JSON.parse(R);
1444
- } catch {
1445
- return S;
1446
- }
1447
- }
1448
- function l() {
1449
- v.setItem(Ge, JSON.stringify(_.value));
1450
- }
1451
- const _ = L(t()), n = $t("receive/request", _.value), { columnDefs: a } = Pt("receive/request", n), u = Be();
1452
- async function c() {
1453
- const S = `inventory-record_${Ke(_.value.startDate).format("DD-MM-YYYY_HH-mm")}-${Ke(_.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`, R = n.purchaseOrders.value.flatMap(
1454
- (U) => U.items.map((F) => {
1455
- const A = new Date(Vt(U._id) ?? ""), z = U.effectiveAt ? new Date(U.effectiveAt) : void 0, j = pe(
1456
- It(F.sku, U.deliveryOrder || [])
1457
- ), f = pe(F.quantity);
1458
- return {
1459
- "SKU code": F.code,
1460
- "SKU name": F.name,
1461
- "PO #": U.seqNumber,
1462
- "Effective at": z,
1463
- Date: A,
1464
- Status: U.status,
1465
- Reference: U.ref ?? "",
1466
- "Received quantity": j,
1467
- "Ordered quantity": f,
1468
- Unit: F.sku.unit.abbrev,
1469
- "Total cost": F.totalCost ? Oe(F.totalCost) : null
1470
- };
1471
- })
1472
- ), O = [
1473
- "SKU code",
1474
- "SKU name",
1475
- "PO #",
1476
- "Date",
1477
- "Status",
1478
- "Reference",
1479
- "Received quantity",
1480
- "Ordered quantity",
1481
- "Unit"
1482
- ];
1483
- b.enableBackdatePo && O.insert("Effective at", 4), b.enableTotalCost && O.push("Total cost"), await At(
1484
- [
1485
- {
1486
- name: "purchases",
1487
- data: R,
1488
- columns: O
1489
- }
1490
- ],
1491
- S
1492
- ), i.open({
1493
- title: y("inventory.transfer.receiveRequest.export.success"),
1494
- message: y("inventory.transfer.receiveRequest.export.message", [S]),
1495
- type: "success"
1496
- });
1497
- }
1498
- const g = L(Qe()), w = L("");
1499
- Se([() => g.value], ([S]) => {
1500
- !S.startDate || !S.endDate || (_.value.startDate = S.startDate, _.value.endDate = S.endDate, n.updateDateRange(
1501
- _.value.startDate,
1502
- _.value.endDate
1503
- ), l());
1504
- }), Se([() => w.value], () => {
1505
- l();
1506
- });
1507
- function C(S) {
1508
- S === "create" && n.promptCreateTransferDialog();
1509
- }
1510
- const { breakpoints: x } = Ne(), D = M(() => x.value.xs || x.value.sm), V = M(() => D.value ? 10 : 20), W = St(), E = M(() => [
1511
- {
1512
- icon: "refresh",
1513
- onClick: n.fetchData
1514
- },
1515
- {
1516
- icon: "ios_share",
1517
- onClick: c
1518
- }
1519
- ]);
1520
- return (S, R) => {
1521
- const O = $("FmTable");
1522
- return h(), J(Dt, {
1523
- title: e(y)("inventory.transfer.receiveRequest.title2"),
1524
- actions: [
1525
- {
1526
- label: e(y)("inventory.transfer.receiveRequest.actions.create"),
1527
- value: "create",
1528
- isPrimary: !0,
1529
- prependIcon: "add"
1530
- }
1531
- ],
1532
- "onClick:action": C
1533
- }, {
1534
- default: T(() => {
1535
- var U;
1536
- return [
1537
- o("div", {
1538
- class: G([
1539
- "flex flex-col gap-8 max-h-full",
1540
- {
1541
- "p-0": D.value,
1542
- "px-24 ": !D.value
1543
- }
1544
- ])
1545
- }, [
1546
- r(Ft, {
1547
- "date-range-query": "",
1548
- "date-range": g.value,
1549
- "onUpdate:dateRange": R[0] || (R[0] = (F) => g.value = F),
1550
- searchable: "",
1551
- "change-location": "",
1552
- search: w.value,
1553
- "onUpdate:search": R[1] || (R[1] = (F) => w.value = F),
1554
- actions: E.value
1555
- }, null, 8, ["date-range", "search", "actions"]),
1556
- (h(), J(O, {
1557
- style: We(e(W).tableHeight),
1558
- "column-defs": e(a),
1559
- "row-data": e(n).purchaseOrders.value,
1560
- "search-value": w.value,
1561
- loading: !e(u)._currentLocation || e(n).loading.value,
1562
- onRowClick: R[2] || (R[2] = (F) => e(n).promptShowTransferDetails(F.original)),
1563
- key: (U = e(u)._currentLocation) == null ? void 0 : U.dbName,
1564
- "page-size": V.value
1565
- }, {
1566
- "list-row": T((F) => [
1567
- r(at, {
1568
- row: F,
1569
- onRowClick: e(n).promptShowTransferDetails
1570
- }, {
1571
- default: T((A) => {
1572
- var z, j, f, m, N, te, H, De, ye, Fe, Re, s, p, B, se, ee, Q, ue, oe, le;
1573
- return [
1574
- o("div", Xs, [
1575
- o("div", ea, [
1576
- r(e(ae), {
1577
- render: (f = (j = (z = A._id) == null ? void 0 : z.column) == null ? void 0 : j.columnDef) == null ? void 0 : f.cell,
1578
- props: (N = (m = A._id) == null ? void 0 : m.getContext) == null ? void 0 : N.call(m)
1579
- }, null, 8, ["render", "props"])
1580
- ]),
1581
- o("div", ta, [
1582
- r(e(ae), {
1583
- render: (De = (H = (te = A.supplier_name) == null ? void 0 : te.column) == null ? void 0 : H.columnDef) == null ? void 0 : De.cell,
1584
- props: (Fe = (ye = A.supplier_name) == null ? void 0 : ye.getContext) == null ? void 0 : Fe.call(ye)
1585
- }, null, 8, ["render", "props"])
1586
- ]),
1587
- o("div", sa, q(F.original.items.map((be) => `${be.name}`).join(", ")), 1),
1588
- F.original.ref ? (h(), I("div", aa, [
1589
- r(e(ae), {
1590
- render: (p = (s = (Re = A.ref) == null ? void 0 : Re.column) == null ? void 0 : s.columnDef) == null ? void 0 : p.cell,
1591
- props: (se = (B = A.ref) == null ? void 0 : B.getContext) == null ? void 0 : se.call(B)
1592
- }, null, 8, ["render", "props"])
1593
- ])) : X("", !0),
1594
- o("div", oa, [
1595
- r(e(ae), {
1596
- render: (ue = (Q = (ee = A.status) == null ? void 0 : ee.column) == null ? void 0 : Q.columnDef) == null ? void 0 : ue.cell,
1597
- props: (le = (oe = A.status) == null ? void 0 : oe.getContext) == null ? void 0 : le.call(oe)
1598
- }, null, 8, ["render", "props"])
1599
- ])
1600
- ])
1601
- ];
1602
- }),
1603
- _: 2
1604
- }, 1032, ["row", "onRowClick"])
1605
- ]),
1606
- _: 1
1607
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1608
- ], 2),
1609
- (h(), J(lt, { to: "body" }, [
1610
- r(Ws, Me(e(n).transferDialogProps.value, {
1611
- onSubmitted: e(n).fetchData
1612
- }), null, 16, ["onSubmitted"]),
1613
- r(Tt, Me(e(n).transferDetailsProps.value, {
1614
- onSubmitted: e(n).fetchData
1615
- }), null, 16, ["onSubmitted"])
1616
- ]))
1617
- ];
1618
- }),
1619
- _: 1
1620
- }, 8, ["title", "actions"]);
1621
- };
1622
- }
1623
- });
1624
- export {
1625
- ka as default
1626
- };