@feedmepos/mf-inventory-portal 0.0.25-dev.18 → 0.0.25-dev.19

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 (57) hide show
  1. package/dist/{App-Bt4a-mva.js → App-Hgn8IBaK.js} +2 -2
  2. package/dist/{ApprovalView-B92jKfUe.js → ApprovalView-BSk9kEGm.js} +15 -9
  3. package/dist/{BindingsDialog-BROfongo.js → BindingsDialog-SxUwbW5x.js} +2 -2
  4. package/dist/{BindingsPicker-DkbAky8B.js → BindingsPicker-_zOGJ17i.js} +5 -5
  5. package/dist/{BindingsTable-JtlhgbpE.js → BindingsTable-I8MLwuIR.js} +5 -5
  6. package/dist/{ClosingDraftView-CBhkErO4.js → ClosingDraftView-D80vDRO7.js} +2 -2
  7. package/dist/{ClosingTemplateView-BG06FAc2.js → ClosingTemplateView-BCE-SHm9.js} +2 -2
  8. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BmLxDo6V.js +215 -0
  9. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DDSGEX3H.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D21lpws0.js} +1 -1
  10. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-UFpoor3r.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-WTlNX0f8.js} +1 -1
  11. package/dist/{IngredientGroupView-B8sPrwGE.js → IngredientGroupView-DDD_-og5.js} +1 -1
  12. package/dist/{IngredientsView-C_de5liQ.js → IngredientsView-CJ4F7BwZ.js} +4 -4
  13. package/dist/{IntegrationView-B20JKMAz.js → IntegrationView-B0TjX4yz.js} +1 -1
  14. package/dist/{InventoryBindingForm-AelrQIZJ.js → InventoryBindingForm-DGXN2PXz.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DvOWqJi9.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-gQNCKIfa.js} +3 -3
  16. package/dist/{InventoryBindingSummary-Eai9AyAo.js → InventoryBindingSummary-CDAivJA8.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cr20uHVb.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CfaZ1GtI.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D8GQ9lbV.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DmhP_O3l.js} +1 -1
  19. package/dist/{PublishView-CYsWjINX.js → PublishView-DvriUy_9.js} +13 -13
  20. package/dist/{PurchaseOrderPrintPreview-DOiuHYql.js → PurchaseOrderPrintPreview-Dr-I6VKI.js} +1 -1
  21. package/dist/ReceiveRequestView-FcC0nStC.js +2318 -0
  22. package/dist/{RecipeView-DUBuigDM.js → RecipeView-BMYzOsb2.js} +3 -3
  23. package/dist/{StockView-CvoWMjr0.js → StockView-gTmg4gih.js} +7 -7
  24. package/dist/{SupplierView-BbXF9J8I.js → SupplierView-CrixDjq3.js} +4 -4
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-15cqyqCC.js +1567 -0
  26. package/dist/{TransferTemplateView-QBK2pXLR.js → TransferTemplateView-DhgyCwnD.js} +7 -7
  27. package/dist/{UnitView-k6d61zdw.js → UnitView-Bll1VTnD.js} +3 -3
  28. package/dist/{WarehouseView-DyZNsx5P.js → WarehouseView-KstzwWxq.js} +1 -1
  29. package/dist/{app-upG2BtzF.js → app-qyqp2u_f.js} +7576 -7525
  30. package/dist/app.js +1 -1
  31. package/dist/components/FmMultiselectDialog.d.ts +24 -1
  32. package/dist/components/MountListener.vue.d.ts +15 -0
  33. package/dist/{decimal-BjTWscOj.js → decimal-BQ6Hkwom.js} +1 -1
  34. package/dist/{feature-CzM4yA1n.js → feature-C6Z6N_iv.js} +52 -63
  35. package/dist/{format-unit-display-Bj_ZIAEo.js → format-unit-display-T-fT7FAg.js} +13 -13
  36. package/dist/{index-rLpwrCyF.js → index-B6HIaHJq.js} +2 -2
  37. package/dist/{stock-QJjIlTf0.js → stock-Cd6rXnhv.js} +1 -1
  38. package/dist/stores/feature.d.ts +0 -4
  39. package/dist/{supplier-B7YGuumI.js → supplier-b6qWYeQu.js} +1 -1
  40. package/dist/tsconfig.app.tsbuildinfo +1 -1
  41. package/dist/{use-ingredient-select-dialog-C_oFS1rx.js → use-ingredient-select-dialog-C8sylcwR.js} +1 -1
  42. package/dist/{use-inventory-binding-dialog-ZDHCZp_m.js → use-inventory-binding-dialog-D7wI4_lU.js} +1 -1
  43. package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +1387 -0
  44. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +3 -1
  45. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +3 -0
  46. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -2
  47. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +0 -1
  48. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +27 -9
  49. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +22 -9
  50. package/dist/views/receive-request/helper/po-to-po-template.util.d.ts +1 -0
  51. package/dist/views/transfer-template/helpers/location-to-po-supplier.util.d.ts +75 -0
  52. package/dist/{vue-i18n-odzbuPVZ.js → vue-i18n-BmWUvN1e.js} +261 -261
  53. package/package.json +1 -1
  54. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B6Op4HEq.js +0 -211
  55. package/dist/ReceiveRequestView-CJxu7o-R.js +0 -2239
  56. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-cp-jr0I-.js +0 -1501
  57. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +0 -3006
@@ -1,2239 +0,0 @@
1
- import { reactive as bt, onMounted as Ye, h as R, computed as O, defineComponent as me, openBlock as C, createElementBlock as V, Fragment as be, renderList as $e, createElementVNode as r, toDisplayString as E, unref as t, resolveComponent as P, createVNode as p, withCtx as T, createCommentVNode as Q, ref as j, createBlock as Y, watch as ge, normalizeClass as ee, createTextVNode as Ee, normalizeStyle as gt, nextTick as Vt, mergeProps as He, isRef as xe, Teleport as Rt } from "vue";
2
- import { H as je, J as At, Y as qt, Z as _t, b as Ke, l as mt, i as le, O as Ze, a0 as Ge, K as kt, as as Et, A as Ue, M as Ut, m as ht, ab as Je, E as de, at as Mt, a as We, au as Ot, av as Nt, aw as Bt, G as Ct, u as Xe, ax as zt, $ as Lt, T as Ht, ay as jt, B as St, d as Fe, az as qe, a5 as ct, y as Qt, _ as Yt, z as Kt, N as pt } from "./app-upG2BtzF.js";
3
- import { u as xt, a as Zt, P as Le, b as Gt, _ as Jt, g as Wt } from "./TransferDetails.vue_vue_type_script_setup_true_lang-cp-jr0I-.js";
4
- import { _ as wt, u as Xt, i as es, e as ts } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-D8GQ9lbV.js";
5
- import { u as ss } from "./useTabStorage-BkIVScW_.js";
6
- import { useDialog as It, useBreakpoints as et, components as ue, FmButtonVariant as os, useSnackbar as Oe, useProxiedModel as as } from "@feedmepos/ui-library";
7
- import { P as G, u as Dt } from "./format-unit-display-Bj_ZIAEo.js";
8
- import { _ as Ft, F as $t, a as Qe, b as Tt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DDSGEX3H.js";
9
- import { u as Ne } from "./feature-CzM4yA1n.js";
10
- import { c as ne, u as ns, _ as ls } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B6Op4HEq.js";
11
- import { useI18n as _e } from "@feedmepos/mf-common";
12
- import { defineStore as rs } from "pinia";
13
- import { u as tt } from "./supplier-B7YGuumI.js";
14
- import { _ as is } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
15
- import { u as us } from "./vue-i18n-odzbuPVZ.js";
16
- import "./array-hChJVZLE.js";
17
- const ds = rs("inventoryMultiSelectDialog", () => {
18
- const c = It(), { t: g } = _e();
19
- return { multiSelect: async (_, s, y) => {
20
- const S = y ?? ((n) => n), { promise: m, resolve: h } = Promise.withResolvers();
21
- return c.open({
22
- title: "Select items",
23
- closeButton: !0,
24
- contentComponent: je,
25
- contentComponentProps: {
26
- modelValue: s ?? [],
27
- items: _,
28
- virtualScroll: !0,
29
- onClose: () => h(null)
30
- },
31
- primaryActions: {
32
- text: g("common.confirm"),
33
- close: !0
34
- },
35
- secondaryActions: {
36
- text: g("common.close"),
37
- close: !0,
38
- variant: "tertiary"
39
- }
40
- }).onPrimary((n) => {
41
- const e = n.map((a) => S(a));
42
- h(e);
43
- }), m;
44
- }, singleSelect: async (_, s, y) => {
45
- const S = y ?? ((n) => n), { promise: m, resolve: h } = Promise.withResolvers();
46
- return c.open({
47
- title: "Select items",
48
- closeButton: !0,
49
- contentComponent: je,
50
- contentComponentProps: {
51
- modelValue: s ? [s] : [],
52
- items: _,
53
- virtualScroll: !0,
54
- onClose: () => h(void 0),
55
- singleSelect: !0
56
- },
57
- primaryActions: {
58
- text: g("common.confirm"),
59
- close: !0
60
- },
61
- secondaryActions: {
62
- text: g("common.close"),
63
- close: !0,
64
- variant: "tertiary"
65
- }
66
- }).onPrimary((n) => {
67
- if (!n.length)
68
- return h(null);
69
- const e = S(n[0]);
70
- h(e);
71
- }), m;
72
- } };
73
- });
74
- function Me(c) {
75
- return c.reduce((g, l) => {
76
- const u = l.measurement ? At(l.quantity, l.measurement.conversion) : l.quantity;
77
- return qt(g, u);
78
- }, _t.reset());
79
- }
80
- var L = /* @__PURE__ */ ((c) => (c.Code = "Code", c.Name = "Name", c.TemplateName = "TemplateName", c.Amount = "Amount", c.Cost = "Cost", c.TotalCost = "TotalCost", c.Delete = "Delete", c))(L || {});
81
- const ft = () => (_e(), R(
82
- wt,
83
- {
84
- zIndex: 50,
85
- class: "whitespace-nowrap"
86
- },
87
- `Total (${ht()})`
88
- ));
89
- function ms(c) {
90
- const { t: g } = _e(), l = bt({}), { breakpoints: u } = et(), _ = Ne(), s = Ke(), y = ds();
91
- Ye(() => {
92
- for (const n of c.items) {
93
- if (!n.totalCost)
94
- continue;
95
- const e = ne(n.sku, n.quantity, n.measurement, {
96
- supplier: c.supplier
97
- }), a = n.totalCost ?? _t.reset();
98
- e ? l[n.sku._id] = e.amount !== a.amount || e.precision !== a.precision : l[n.sku._id] = !0;
99
- }
100
- });
101
- function S(n) {
102
- var a, b, k, v, x, w, $;
103
- return !!(((b = (a = n.defaultCost) == null ? void 0 : a.costPerUnit) == null ? void 0 : b.amount) ?? (($ = (w = (x = (v = (k = c.supplier) == null ? void 0 : k.supplyItems) == null ? void 0 : v.find((q) => q.skuId === n._id)) == null ? void 0 : x.defaultCost) == null ? void 0 : w.costPerUnit) == null ? void 0 : $.amount));
104
- }
105
- const m = [
106
- {
107
- id: "Code",
108
- header: () => g("inventory.transfer.form.items.table.Code"),
109
- accessorKey: "code",
110
- size: 200,
111
- cell(n) {
112
- var a;
113
- const e = n.row.original;
114
- return (a = e.subItems) != null && a.length ? R(
115
- "span",
116
- { class: "text-fm-color-typo-primary fm-typo-en-body-md-600 line-clamp-1" },
117
- e.sku.code
118
- ) : s.isEnabled ? R(
119
- ue.FmTooltip,
120
- {
121
- content: e.code,
122
- placement: "top",
123
- variant: "plain",
124
- zIndex: 50
125
- },
126
- R(
127
- "span",
128
- {
129
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
130
- },
131
- e.code
132
- )
133
- ) : R(ue.FmTextField, {
134
- modelValue: e.code,
135
- "onUpdate:modelValue": (b) => {
136
- c.updateItem({
137
- ...e,
138
- code: b
139
- });
140
- },
141
- key: e.sku._id,
142
- rules: [mt()],
143
- labelMark: "required"
144
- });
145
- },
146
- enableSorting: !1
147
- },
148
- {
149
- id: "Name",
150
- header: () => g("inventory.transfer.form.items.table.Name"),
151
- minSize: 300,
152
- cell(n) {
153
- var a;
154
- const e = n.row.original;
155
- return (a = e.subItems) != null && a.length ? R(
156
- "span",
157
- { class: "text-fm-color-typo-primary fm-typo-en-body-md-600 line-clamp-1" },
158
- e.sku.name
159
- ) : s.isEnabled ? R(
160
- ue.FmTooltip,
161
- {
162
- content: e.name,
163
- placement: "top",
164
- variant: "plain",
165
- zIndex: 50
166
- },
167
- R(
168
- "span",
169
- {
170
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
171
- },
172
- e.name
173
- )
174
- ) : R(ue.FmTextField, {
175
- modelValue: e.name,
176
- "onUpdate:modelValue": (b) => {
177
- c.updateItem({
178
- ...e,
179
- name: b
180
- });
181
- },
182
- key: e.sku._id,
183
- rules: [mt()],
184
- labelMark: "required"
185
- });
186
- },
187
- enableSorting: !1
188
- },
189
- {
190
- id: "TemplateName",
191
- header: () => g("inventory.transfer.form.items.table.Name"),
192
- minSize: 300,
193
- enableSorting: !1,
194
- cell(n) {
195
- var k, v;
196
- const e = n.row.original, a = (k = e.subItems) != null && k.length ? e.sku.code : e.code, b = (v = e.subItems) != null && v.length ? e.sku.name : e.name;
197
- return R(
198
- ue.FmTooltip,
199
- { zIndex: 50 },
200
- {
201
- default() {
202
- return R("div", { class: "flex flex-col w-full" }, [
203
- R(
204
- "div",
205
- { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
206
- b
207
- ),
208
- R(
209
- "div",
210
- {
211
- class: "line-clamp-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary"
212
- },
213
- a
214
- )
215
- ]);
216
- },
217
- content() {
218
- return b;
219
- }
220
- }
221
- );
222
- }
223
- },
224
- {
225
- id: "Amount",
226
- header: () => g("inventory.transfer.form.items.table.Amount"),
227
- minSize: 200,
228
- cell(n) {
229
- var b, k, v, x;
230
- const e = n.row.original;
231
- if ((b = e.subItems) != null && b.length) {
232
- const w = Me(e.subItems);
233
- return R(
234
- "span",
235
- {
236
- class: "text-fm-color-typo-primary line-clamp-1 text-fm-color-typo-primary line-clamp-1 text-right"
237
- },
238
- [
239
- R("span", { class: " fm-typo-en-body-md-400" }, "Total: "),
240
- R(
241
- "span",
242
- { class: " fm-typo-en-body-md-600" },
243
- `${le(w)} ${e.sku.unit.abbrev}`
244
- )
245
- ]
246
- );
247
- }
248
- const a = (x = (v = (k = c.template) == null ? void 0 : k.purchaseOrder) == null ? void 0 : v.items) == null ? void 0 : x.find(
249
- (w) => w.sku._id === e.sku._id
250
- );
251
- return R(Ft, {
252
- style: {
253
- flex: "1 1 0%"
254
- },
255
- modelValue: {
256
- amount: e.quantity ?? { amount: 1, precision: 0 },
257
- measurement: e.measurement ?? null
258
- },
259
- key: e.sku._id,
260
- unit: e.sku.unit,
261
- "onUpdate:modelValue": (w) => {
262
- const $ = {
263
- ...e,
264
- quantity: w.amount,
265
- measurement: w.measurement
266
- };
267
- _.enableTotalCost && ($.totalCost = ne(e.sku, e.quantity, e.measurement, {
268
- supplier: c.supplier,
269
- // NOTE: set undefined here if `manualTotalCost[row.sku._id] = false`, so that the function
270
- // will return the auto calculated default cost instead of the manual total cost
271
- manualTotalCost: l[e.sku._id] ? $.totalCost : void 0
272
- })), c.updateItem($);
273
- },
274
- stepper: a == null ? void 0 : a.quantityStep,
275
- disableUnit: !!a,
276
- disabled: c.disabled,
277
- rules: [
278
- $t(
279
- +le(
280
- (a != null && a.minimumQuantity && (a == null ? void 0 : a.minimumQuantity.amount) > 0 ? a == null ? void 0 : a.minimumQuantity : void 0) ?? {
281
- amount: 1,
282
- precision: Ze(e.sku.unit, e.measurement)
283
- }
284
- )
285
- ),
286
- a != null && a.maximumQuantity ? Qe(
287
- +le(a == null ? void 0 : a.maximumQuantity)
288
- ) : Qe(1 / 0),
289
- ...a != null && a.quantityStep ? [Tt(a.quantityStep)] : []
290
- ],
291
- applyDefaultRules: !0
292
- });
293
- },
294
- enableSorting: !1
295
- },
296
- _.mustUseDefaultCost ? {
297
- id: "TotalCost",
298
- header: ft,
299
- size: 180,
300
- accessorFn: (n) => {
301
- var b;
302
- const e = (b = n.subItems) != null && b.length ? {
303
- amount: Me(n.subItems),
304
- measurement: null
305
- } : {
306
- amount: n.quantity,
307
- measurement: n.measurement
308
- }, a = ne(
309
- n.sku,
310
- e.amount,
311
- e.measurement,
312
- {
313
- supplier: c.supplier
314
- }
315
- );
316
- return le(a);
317
- }
318
- } : {
319
- id: "Cost",
320
- header: ft,
321
- size: 180,
322
- cell(n) {
323
- var k;
324
- const e = n.row.original;
325
- if ((k = e.subItems) != null && k.length)
326
- return R(
327
- "span",
328
- { class: "text-fm-color-typo-primary fm-typo-en-body-md-600 line-clamp-1" },
329
- ""
330
- );
331
- const a = S(e.sku), b = u.value.xs || u.value.sm;
332
- return !l[e.sku._id] && a ? R(
333
- "div",
334
- {
335
- class: [
336
- "flex gap-4 fm-typo-en-body-md-400 items-center",
337
- c.disabled ? "text-fm-color-typo-disabled" : ""
338
- ],
339
- key: e.sku._id
340
- },
341
- [
342
- R(ue.FmButton, {
343
- prependIcon: "edit",
344
- variant: os.Tertiary,
345
- disabled: c.disabled,
346
- onClick() {
347
- c.updateItem({
348
- ...e,
349
- totalCost: ne(e.sku, e.quantity, e.measurement, {
350
- supplier: c.supplier
351
- })
352
- }), l[e.sku._id] = !0;
353
- }
354
- }),
355
- R(
356
- "div",
357
- {
358
- class: "flex flex-col"
359
- },
360
- [
361
- R(
362
- "span",
363
- b ? Ge(
364
- ne(e.sku, e.quantity, e.measurement, {
365
- supplier: c.supplier
366
- })
367
- ) : le(
368
- ne(e.sku, e.quantity, e.measurement, {
369
- supplier: c.supplier
370
- })
371
- )
372
- ),
373
- R(
374
- "span",
375
- {
376
- class: [
377
- "fm-typo-en-body-sm-400",
378
- c.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
379
- ]
380
- },
381
- g("inventory.transfer.form.items.autoCalculated")
382
- )
383
- ]
384
- )
385
- ]
386
- ) : R(
387
- ue.FmTextField,
388
- {
389
- modelValue: le(e.totalCost ?? { amount: 0, precision: 0 }),
390
- key: e.sku._id,
391
- "onUpdate:modelValue": (v) => {
392
- c.updateItem({
393
- ...e,
394
- totalCost: {
395
- ...kt(+v),
396
- currency: Et()
397
- }
398
- });
399
- },
400
- rules: [Ue(0), Ut(2)]
401
- },
402
- {
403
- prepend() {
404
- return b ? R(
405
- "div",
406
- {
407
- class: [
408
- "text-fm-typo-en-body-lg-400",
409
- c.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
410
- ]
411
- },
412
- ht()
413
- ) : null;
414
- },
415
- append() {
416
- return a ? R(ue.FmButton, {
417
- prependIcon: "close",
418
- variant: "tertiary",
419
- disabled: c.disabled,
420
- onClick() {
421
- c.updateItem({
422
- ...e,
423
- // NOTE: different from PO template, if a default cost is reenabled,
424
- // the total cost will automatically assigned
425
- totalCost: ne(e.sku, e.quantity, e.measurement, {
426
- supplier: c.supplier
427
- })
428
- }), l[e.sku._id] = !1;
429
- }
430
- }) : null;
431
- }
432
- }
433
- );
434
- },
435
- enableSorting: !1
436
- },
437
- {
438
- id: "Delete",
439
- header: "",
440
- cell(n) {
441
- var k, v, x;
442
- const e = n.row.original, a = (x = (v = (k = c.template) == null ? void 0 : k.purchaseOrder) == null ? void 0 : v.items) == null ? void 0 : x.find(
443
- (w) => w.sku._id === e.sku._id
444
- ), b = (a == null ? void 0 : a.subItems) ?? [];
445
- return R("div", { class: "flex justify-end" }, [
446
- ...b.length ? [
447
- R(ue.FmButton, {
448
- key: e.sku._id,
449
- type: "button",
450
- icon: "add_circle",
451
- variant: "tertiary",
452
- size: "md",
453
- disabled: c.disabled,
454
- onClick: async () => {
455
- var te;
456
- const w = ((te = e.subItems) == null ? void 0 : te.map((I) => I.id)) ?? [], $ = b.map(
457
- (I) => ({
458
- label: I.name,
459
- sublabel: I.code,
460
- value: I.id
461
- })
462
- ), q = await y.multiSelect($, w, (I) => {
463
- var F;
464
- return ((F = e.subItems) == null ? void 0 : F.find((U) => U.id === I)) ?? b.find((U) => U.id === I);
465
- }).then((I) => I == null ? void 0 : I.filter((F) => F).map((F) => F));
466
- q && c.updateItem({
467
- ...e,
468
- subItems: q.length ? q : null
469
- });
470
- }
471
- })
472
- ] : [],
473
- R(ue.FmButton, {
474
- key: e.sku._id,
475
- class: "delete-button",
476
- type: "button",
477
- icon: "delete",
478
- variant: "tertiary",
479
- size: "md",
480
- disabled: c.disabled,
481
- onClick: () => {
482
- c.deleteItem(e);
483
- }
484
- })
485
- ]);
486
- },
487
- enableSorting: !1,
488
- size: 40,
489
- meta: {
490
- cellClass: "",
491
- headerClass: ""
492
- }
493
- }
494
- ];
495
- return {
496
- columnDefs: O(() => _.enableTotalCost && (_.mustUseDefaultCost || c.transferType === G.PURCHASE) ? m : m.filter(
497
- (n) => n.id !== "Cost"
498
- /* Cost */
499
- ))
500
- };
501
- }
502
- const cs = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, ps = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, fs = { class: "w-[450px] xs:w-full flex" }, ys = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, vs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Pt = /* @__PURE__ */ me({
503
- __name: "SupplierPriceHistory",
504
- props: {
505
- prices: {}
506
- },
507
- setup(c) {
508
- const g = tt();
509
- function l(u) {
510
- return g.suppliers.find((_) => _._id === u);
511
- }
512
- return (u, _) => (C(), V("div", cs, [
513
- (C(!0), V(be, null, $e(Object.keys(u.prices), (s) => {
514
- var y;
515
- return C(), V("div", {
516
- key: s,
517
- class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
518
- }, [
519
- r("div", ps, E((y = l(s)) == null ? void 0 : y.name), 1),
520
- r("div", fs, [
521
- (C(!0), V(be, null, $e(u.prices[s].slice(0, 3), (S) => {
522
- var m;
523
- return C(), V("div", {
524
- key: S.date,
525
- class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
526
- }, [
527
- r("div", ys, [
528
- r("span", null, E(S.totalCost ? t(Ge)(S.totalCost) : "No data"), 1),
529
- _[0] || (_[0] = r("span", { class: "text-fm-color-typo-secondary" }, "/", -1)),
530
- r("span", null, E(t(le)(S.totalUnit, !1)), 1),
531
- r("span", null, E(((m = S.measurement) == null ? void 0 : m.abbrev) ?? S.unit.abbrev), 1)
532
- ]),
533
- r("div", vs, [
534
- r("span", null, "(#" + E(S.seqNumber) + ")", 1),
535
- _[1] || (_[1] = r("span", null, E(" "), -1)),
536
- r("span", null, E(t(Je)(new Date(S.date))), 1)
537
- ])
538
- ]);
539
- }), 128))
540
- ])
541
- ]);
542
- }), 128))
543
- ]));
544
- }
545
- }), bs = { class: "flex flex-col gap-8 py-16" }, gs = { class: "flex items-center" }, _s = { class: "flex-1 flex gap-1 items-center" }, ks = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, hs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Cs = { class: "flex gap-8 w-full" }, Ss = { class: "flex-1 flex flex-col gap-4" }, xs = { class: "flex-1 flex flex-col gap-4" }, ws = { class: "flex gap-8 w-full" }, Is = { class: "flex-1 flex flex-col gap-4" }, Ds = {
546
- key: 0,
547
- class: "flex-1 flex flex-col gap-4"
548
- }, Fs = /* @__PURE__ */ me({
549
- __name: "TransferItem",
550
- props: {
551
- cellByColId: {},
552
- comparePriceBySku: {},
553
- showComparePrice: { type: Boolean },
554
- row: {}
555
- },
556
- setup(c) {
557
- const { t: g } = _e();
558
- return (l, u) => {
559
- var y, S, m, h, n, e, a, b, k, v, x, w, $, q, te, I, F, U, N, M, H, J, W, f, i, A, K;
560
- const _ = P("FmLabel"), s = P("FmSpacer");
561
- return C(), V("div", bs, [
562
- r("div", gs, [
563
- r("div", _s, [
564
- r("span", ks, " (" + E(l.row.original.sku.code) + ") ", 1),
565
- r("span", hs, E(l.row.original.sku.name), 1)
566
- ]),
567
- r("div", null, [
568
- p(t(de), {
569
- render: (m = (S = (y = l.cellByColId.Delete) == null ? void 0 : y.column) == null ? void 0 : S.columnDef) == null ? void 0 : m.cell,
570
- props: (n = (h = l.cellByColId.Delete) == null ? void 0 : h.getContext) == null ? void 0 : n.call(h)
571
- }, null, 8, ["render", "props"])
572
- ])
573
- ]),
574
- r("div", Cs, [
575
- r("div", Ss, [
576
- p(_, {
577
- label: t(g)(`inventory.transfer.form.items.table.${t(L).Code}`)
578
- }, null, 8, ["label"]),
579
- p(t(de), {
580
- render: (b = (a = (e = l.cellByColId[t(L).Code]) == null ? void 0 : e.column) == null ? void 0 : a.columnDef) == null ? void 0 : b.cell,
581
- props: (v = (k = l.cellByColId[t(L).Code]) == null ? void 0 : k.getContext) == null ? void 0 : v.call(k)
582
- }, null, 8, ["render", "props"]),
583
- u[0] || (u[0] = r("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
584
- ]),
585
- r("div", xs, [
586
- p(_, {
587
- label: t(g)(`inventory.transfer.form.items.table.${t(L).Name}`)
588
- }, null, 8, ["label"]),
589
- p(t(de), {
590
- render: ($ = (w = (x = l.cellByColId[t(L).Name]) == null ? void 0 : x.column) == null ? void 0 : w.columnDef) == null ? void 0 : $.cell,
591
- props: (te = (q = l.cellByColId[t(L).Name]) == null ? void 0 : q.getContext) == null ? void 0 : te.call(q)
592
- }, null, 8, ["render", "props"]),
593
- u[1] || (u[1] = r("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
594
- ])
595
- ]),
596
- r("div", ws, [
597
- r("div", Is, [
598
- p(_, {
599
- label: t(g)(`inventory.transfer.form.items.table.${t(L).Amount}`)
600
- }, null, 8, ["label"]),
601
- p(t(de), {
602
- render: (U = (F = (I = l.cellByColId[t(L).Amount]) == null ? void 0 : I.column) == null ? void 0 : F.columnDef) == null ? void 0 : U.cell,
603
- props: (M = (N = l.cellByColId[t(L).Amount]) == null ? void 0 : N.getContext) == null ? void 0 : M.call(N)
604
- }, null, 8, ["render", "props"]),
605
- u[2] || (u[2] = r("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
606
- ]),
607
- l.cellByColId[t(L).Cost] ? (C(), V("div", Ds, [
608
- p(wt, { "z-index": 50 }, {
609
- default: T(() => [
610
- p(_, {
611
- label: t(g)(`inventory.transfer.form.items.table.${t(L).Cost}2`)
612
- }, null, 8, ["label"])
613
- ]),
614
- _: 1
615
- }),
616
- p(t(de), {
617
- render: (W = (J = (H = l.cellByColId[t(L).Cost]) == null ? void 0 : H.column) == null ? void 0 : J.columnDef) == null ? void 0 : W.cell,
618
- props: (i = (f = l.cellByColId[t(L).Cost]) == null ? void 0 : f.getContext) == null ? void 0 : i.call(f)
619
- }, null, 8, ["render", "props"]),
620
- u[3] || (u[3] = r("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
621
- ])) : Q("", !0)
622
- ]),
623
- l.showComparePrice && Object.keys(l.comparePriceBySku[(A = l.row.original.sku) == null ? void 0 : A._id] ?? {}).length > 0 ? (C(), V(be, { key: 0 }, [
624
- p(s, { class: "h-8" }),
625
- p(Pt, {
626
- prices: l.comparePriceBySku[(K = l.row.original.sku) == null ? void 0 : K._id]
627
- }, null, 8, ["prices"])
628
- ], 64)) : Q("", !0)
629
- ]);
630
- };
631
- }
632
- });
633
- function $s(c) {
634
- const g = O({
635
- get() {
636
- const s = c.getEffectiveAt();
637
- return s ? new Date(s) : null;
638
- },
639
- set(s) {
640
- c.setEffectiveAt((s == null ? void 0 : s.toISOString()) ?? null);
641
- }
642
- }), l = O({
643
- get() {
644
- return !!g.value;
645
- },
646
- set(s) {
647
- s ? g.value = /* @__PURE__ */ new Date() : g.value = null;
648
- }
649
- }), u = O({
650
- get() {
651
- return g.value === null ? "" : Je(g.value);
652
- },
653
- set(s) {
654
- s ? g.value = /* @__PURE__ */ new Date(`${s} ${_.value}`) : g.value = null;
655
- }
656
- }), _ = O({
657
- get() {
658
- return g.value === null ? "" : Mt(g.value);
659
- },
660
- set(s) {
661
- s ? g.value = /* @__PURE__ */ new Date(`${u.value} ${s}`) : g.value = null;
662
- }
663
- });
664
- return {
665
- backdatePo: g,
666
- backdateSwitch: l,
667
- backdateModel: u,
668
- backdateTimeModel: _
669
- };
670
- }
671
- const Ts = {
672
- width: "24",
673
- height: "24",
674
- viewBox: "0 0 24 24",
675
- fill: "none",
676
- xmlns: "http://www.w3.org/2000/svg"
677
- }, Ps = ["fill"], Vs = ["fill"], Rs = ["stroke"], As = ["stroke"], qs = /* @__PURE__ */ me({
678
- __name: "SparkIcon",
679
- props: {
680
- size: {
681
- type: Number,
682
- default: 24
683
- },
684
- color: {
685
- type: String,
686
- default: "#c7c7cc"
687
- }
688
- },
689
- setup(c) {
690
- return (g, l) => (C(), V("svg", Ts, [
691
- r("path", {
692
- 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",
693
- fill: c.color
694
- }, null, 8, Ps),
695
- r("path", {
696
- 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",
697
- fill: c.color
698
- }, null, 8, Vs),
699
- r("path", {
700
- 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",
701
- stroke: c.color,
702
- "stroke-width": "1.5",
703
- "stroke-linecap": "round",
704
- "stroke-linejoin": "round"
705
- }, null, 8, Rs),
706
- r("path", {
707
- 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",
708
- stroke: c.color,
709
- "stroke-width": "1.5",
710
- "stroke-linecap": "round",
711
- "stroke-linejoin": "round"
712
- }, null, 8, As)
713
- ]));
714
- }
715
- }), Es = { class: "flex gap-8 items-center" }, Us = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, Ms = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, Os = { class: "flex items-center w-full" }, Ns = { class: "flex-1" }, Bs = { class: "fm-typo-en-title-sm-800" }, zs = { class: "flex items-start gap-8" }, Ls = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Hs = { class: "flex gap-1" }, yt = /* @__PURE__ */ me({
716
- __name: "ForecastStock",
717
- props: {
718
- disabled: { type: Boolean }
719
- },
720
- emits: ["update:poItems"],
721
- setup(c, { emit: g }) {
722
- const l = g, u = j(!1), _ = j(7), s = Xt(), y = Oe(), S = We(), { t: m } = _e();
723
- async function h() {
724
- if (_.value < 1)
725
- return;
726
- u.value = !1, await s.readPurchaseOrder(_.value);
727
- const n = [];
728
- if (s.purchaseOrderForecast.skus.length <= 0) {
729
- y.open({
730
- message: m("inventory.transfer.form.items.forecastStock.notAvailable"),
731
- type: "info"
732
- });
733
- return;
734
- }
735
- const e = s.purchaseOrderForecast.skus.reduce((a, b) => {
736
- const k = S.skus.find((w) => w._id === b.id);
737
- if (a.find((w) => w.sku._id === b.id) || !k)
738
- return a;
739
- const x = {
740
- sku: k,
741
- code: k.code,
742
- name: k.name,
743
- quantity: {
744
- amount: b.amount,
745
- precision: 0
746
- }
747
- };
748
- return a.push(x), a;
749
- }, n);
750
- l("update:poItems", e);
751
- }
752
- return (n, e) => {
753
- const a = P("FmButton"), b = P("FmIcon"), k = P("FmStepperField"), v = P("FmPopover");
754
- return C(), Y(v, {
755
- disabled: n.disabled,
756
- class: "flex",
757
- "show-popover": u.value,
758
- onPopoverChanged: e[3] || (e[3] = (x) => u.value = x)
759
- }, {
760
- "popover-button": T(() => [
761
- p(a, {
762
- label: "unused",
763
- variant: "secondary",
764
- "text-color": n.disabled ? "disabled" : "primary",
765
- "bg-color": "transparent",
766
- "border-color": n.disabled ? "disabled" : "primary",
767
- disabled: n.disabled
768
- }, {
769
- default: T(() => [
770
- r("div", Es, [
771
- p(qs, {
772
- size: 24,
773
- color: n.disabled ? "#c7c7cc" : "#ff7823"
774
- }, null, 8, ["color"]),
775
- r("div", Us, E(t(m)("inventory.transfer.form.items.forecastStock.title")), 1)
776
- ])
777
- ]),
778
- _: 1
779
- }, 8, ["text-color", "border-color", "disabled"])
780
- ]),
781
- default: T(() => [
782
- r("div", Ms, [
783
- r("div", Os, [
784
- r("div", Ns, [
785
- p(is, { "z-index": 99 }, {
786
- default: T(() => [
787
- r("p", Bs, E(t(m)("inventory.transfer.form.items.forecastStock.title")), 1)
788
- ]),
789
- _: 1
790
- })
791
- ]),
792
- p(a, {
793
- icon: "close",
794
- size: "md",
795
- variant: "tertiary",
796
- onClick: e[0] || (e[0] = (x) => u.value = !1)
797
- })
798
- ]),
799
- p(k, {
800
- modelValue: _.value,
801
- "onUpdate:modelValue": e[1] || (e[1] = (x) => _.value = x),
802
- label: t(m)("inventory.transfer.form.items.forecastStock.days"),
803
- rules: [t(Ue)(1)]
804
- }, {
805
- "helper-text": T(() => [
806
- r("div", zs, [
807
- p(b, {
808
- name: "warning",
809
- size: "sm",
810
- class: "text-fm-color-system-warning-300"
811
- }),
812
- r("div", Ls, E(t(m)("inventory.transfer.form.items.forecastStock.replace")), 1)
813
- ])
814
- ]),
815
- _: 1
816
- }, 8, ["modelValue", "label", "rules"]),
817
- r("div", Hs, [
818
- e[4] || (e[4] = r("div", { class: "grow" }, null, -1)),
819
- p(a, {
820
- label: t(m)("common.cancel"),
821
- variant: "tertiary",
822
- onClick: e[2] || (e[2] = (x) => u.value = !1)
823
- }, null, 8, ["label"]),
824
- p(a, {
825
- label: t(m)("inventory.transfer.form.items.forecastStock.generate"),
826
- onClick: h
827
- }, null, 8, ["label"])
828
- ])
829
- ])
830
- ]),
831
- _: 1
832
- }, 8, ["disabled", "show-popover"]);
833
- };
834
- }
835
- });
836
- function js() {
837
- const c = Oe(), g = xt(), l = j(!1);
838
- ge(l, (y) => {
839
- y && (_.value = !0, u().finally(() => {
840
- _.value = !1;
841
- }));
842
- });
843
- async function u() {
844
- try {
845
- const { startDate: y, endDate: S } = Ot(6), n = (await g.getPurchaseOrders({ start: y, end: S })).filter(
846
- (e) => {
847
- var a, b;
848
- return e.status === Nt.enum.COMPLETE && ((a = e.supplier) == null ? void 0 : a.internal) !== "warehouse" && ((b = e.supplier) == null ? void 0 : b.internal) !== "restaurant";
849
- }
850
- ).reduce((e, a) => {
851
- const b = new Date(Bt(a._id)), k = a.supplier._id;
852
- for (const v of a.items) {
853
- if (!v.totalCost) continue;
854
- const x = e[v.sku._id] ?? {}, w = x[k] ?? [];
855
- w.push({
856
- date: b.toISOString(),
857
- totalUnit: v.quantity,
858
- totalCost: v.totalCost,
859
- unit: v.sku.unit,
860
- measurement: v.measurement,
861
- seqNumber: a.seqNumber
862
- }), x[k] = w, e[v.sku._id] = x;
863
- }
864
- return e;
865
- }, {});
866
- s.value = n;
867
- } catch {
868
- c.open({
869
- title: "Something went wrong",
870
- message: "Cannot retrieve supplier purchase history. Please try again."
871
- }), l.value = !1;
872
- }
873
- }
874
- const _ = j(!1), s = j({});
875
- return {
876
- comparePricesToggle: l,
877
- comparePriceFetching: _,
878
- comparePriceBySku: s
879
- };
880
- }
881
- const Qs = { class: "hover:bg-fm-color-opacity-sm" }, Ys = { class: "flex items-center" }, Ks = {
882
- key: 0,
883
- class: "flex h-full w-24"
884
- }, Zs = { class: "flex flex-col flex-1 line-clamp-1" }, Gs = { class: "text-fm-color-typo-primary fm-typo-en-body-md-400" }, Js = { class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400" }, Ws = {
885
- key: 2,
886
- class: "flex-1"
887
- }, Xs = {
888
- key: 3,
889
- class: "flex w-full justify-end"
890
- }, eo = /* @__PURE__ */ me({
891
- __name: "TransferSubItemTable",
892
- props: {
893
- templateSubItem: {},
894
- row: {},
895
- modelValue: {},
896
- disabled: { type: Boolean },
897
- subItemIndex: {}
898
- },
899
- emits: ["delete:model-value"],
900
- setup(c, { emit: g }) {
901
- const l = Ct(), u = g, _ = j(le(l.quantity));
902
- return ge(_, (s) => {
903
- if (!`${s}`) return;
904
- const y = +s;
905
- Number.isNaN(y) || (l.quantity = kt(y));
906
- }), (s, y) => {
907
- const S = P("FmIcon"), m = P("FmTooltip"), h = P("FmButton");
908
- return C(), V("tr", Qs, [
909
- (C(!0), V(be, null, $e(s.row.getVisibleCells(), (n, e) => (C(), V("td", {
910
- key: n.id,
911
- class: ee([e === 0 ? "px-16" : n.column.id === t(L).Delete ? "" : "px-16"])
912
- }, [
913
- r("div", Ys, [
914
- e === 0 ? (C(), V("div", Ks, [
915
- s.subItemIndex === 0 ? (C(), Y(S, {
916
- key: 0,
917
- name: "subdirectory_arrow_right",
918
- size: "sm"
919
- })) : Q("", !0)
920
- ])) : Q("", !0),
921
- n.column.id === t(L).TemplateName ? (C(), Y(m, {
922
- key: 1,
923
- "z-index": 50
924
- }, {
925
- content: T(() => [
926
- Ee(E(t(l).name), 1)
927
- ]),
928
- default: T(() => [
929
- r("div", Zs, [
930
- r("div", Gs, E(t(l).name), 1),
931
- r("div", Js, E(t(l).code), 1)
932
- ])
933
- ]),
934
- _: 1
935
- })) : n.column.id === t(L).Amount ? (C(), V("div", Ws, [
936
- p(Ft, {
937
- "model-value": {
938
- amount: t(l).quantity,
939
- measurement: t(l).measurement
940
- },
941
- "onUpdate:modelValue": y[0] || (y[0] = (a) => t(l).quantity = a.amount),
942
- unit: s.row.original.sku.unit,
943
- rules: [
944
- t($t)(
945
- +t(le)(
946
- s.templateSubItem.minimumQuantity ?? {
947
- amount: 1,
948
- precision: t(Ze)(s.row.original.sku.unit, t(l).measurement)
949
- }
950
- )
951
- ),
952
- t(Qe)(
953
- s.templateSubItem.maximumQuantity ? +t(le)(s.templateSubItem.maximumQuantity) : 1 / 0
954
- ),
955
- t(Tt)(s.templateSubItem.quantityStep)
956
- ],
957
- stepper: s.templateSubItem.quantityStep,
958
- disabled: s.disabled,
959
- "disable-unit": ""
960
- }, null, 8, ["model-value", "unit", "rules", "stepper", "disabled"])
961
- ])) : n.column.id === t(L).Delete ? (C(), V("div", Xs, [
962
- p(h, {
963
- key: "row.sku._id",
964
- type: "button",
965
- icon: "delete",
966
- variant: "tertiary",
967
- size: "md",
968
- onClick: y[1] || (y[1] = (a) => u("delete:model-value", s.modelValue)),
969
- disabled: s.disabled
970
- }, null, 8, ["disabled"])
971
- ])) : Q("", !0)
972
- ])
973
- ], 2))), 128))
974
- ]);
975
- };
976
- }
977
- }), to = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, so = { key: 1 }, oo = ["colspan"], ao = /* @__PURE__ */ me({
978
- __name: "TransferItemTable",
979
- props: {
980
- templateItem: {},
981
- row: {},
982
- comparePriceBySku: {},
983
- showComparePrice: { type: Boolean },
984
- disabled: { type: Boolean }
985
- },
986
- emits: ["update:item"],
987
- setup(c, { emit: g }) {
988
- const l = c, u = g;
989
- function _(m) {
990
- return m.column.columnDef.meta;
991
- }
992
- function s(m) {
993
- var h, n;
994
- return ((n = (h = l.templateItem) == null ? void 0 : h.subItems) == null ? void 0 : n.find((e) => e.id === m.id)) ?? {
995
- id: m.id,
996
- code: m.code,
997
- name: m.name,
998
- quantity: m.quantity,
999
- quantityStep: {
1000
- amount: 1,
1001
- precision: Ze(l.row.original.sku.unit, m.measurement)
1002
- }
1003
- };
1004
- }
1005
- function y(m) {
1006
- const n = (l.row.original.subItems ?? []).map((e) => e.id !== m.id ? e : m);
1007
- u("update:item", {
1008
- ...l.row.original,
1009
- subItems: n
1010
- });
1011
- }
1012
- function S(m) {
1013
- const n = (l.row.original.subItems ?? []).filter((e) => e.id !== m.id);
1014
- u("update:item", {
1015
- ...l.row.original,
1016
- subItems: n.length ? n : null
1017
- });
1018
- }
1019
- return (m, h) => {
1020
- var n, e, a, b, k;
1021
- return C(), V(be, null, [
1022
- r("tr", {
1023
- class: ee(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
1024
- "bg-fm-color-neutral-gray-100": m.row.getIsSelected()
1025
- }])
1026
- }, [
1027
- (C(!0), V(be, null, $e(m.row.getVisibleCells(), (v) => {
1028
- var x, w, $, q;
1029
- return C(), V("td", {
1030
- key: v.id,
1031
- class: ee(["h-[56px] text-fm-color-typo-primary", ((x = _(v)) == null ? void 0 : x.cellClass) ?? "px-16"]),
1032
- style: gt({
1033
- width: (w = _(v)) == null ? void 0 : w.width,
1034
- maxWidth: ($ = _(v)) == null ? void 0 : $.maxWidth,
1035
- textAlign: ((q = _(v)) == null ? void 0 : q.textAlign) ?? "left"
1036
- })
1037
- }, [
1038
- r("span", to, [
1039
- p(t(de), {
1040
- render: v.column.columnDef.cell,
1041
- props: v.getContext()
1042
- }, null, 8, ["render", "props"])
1043
- ])
1044
- ], 6);
1045
- }), 128))
1046
- ], 2),
1047
- (e = (n = m.row.original) == null ? void 0 : n.subItems) != null && e.length ? (C(!0), V(be, { key: 0 }, $e((a = m.row.original) == null ? void 0 : a.subItems, (v, x) => (C(), Y(eo, {
1048
- key: v.id,
1049
- row: m.row,
1050
- "model-value": v,
1051
- "onUpdate:modelValue": y,
1052
- "onDelete:modelValue": S,
1053
- "template-sub-item": s(v),
1054
- "sub-item-index": x,
1055
- disabled: m.disabled
1056
- }, null, 8, ["row", "model-value", "template-sub-item", "sub-item-index", "disabled"]))), 128)) : Q("", !0),
1057
- m.showComparePrice && Object.keys(m.comparePriceBySku[(b = m.row.original.sku) == null ? void 0 : b._id] ?? {}).length > 0 ? (C(), V("tr", so, [
1058
- r("td", {
1059
- colspan: m.row.getVisibleCells().length
1060
- }, [
1061
- p(Pt, {
1062
- prices: m.comparePriceBySku[(k = m.row.original.sku) == null ? void 0 : k._id]
1063
- }, null, 8, ["prices"])
1064
- ], 8, oo)
1065
- ])) : Q("", !0)
1066
- ], 64);
1067
- };
1068
- }
1069
- }), no = {
1070
- key: 0,
1071
- class: "flex flex-col gap-8"
1072
- }, lo = { class: "flex flex-col gap-4" }, ro = { class: "flex items-center gap-4" }, io = {
1073
- key: 0,
1074
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-error"
1075
- }, uo = /* @__PURE__ */ me({
1076
- __name: "NetSuiteField",
1077
- props: {
1078
- required: { type: Boolean },
1079
- disabled: { type: Boolean },
1080
- supplier: {},
1081
- setting: {},
1082
- items: {},
1083
- onChange: { type: Function }
1084
- },
1085
- emits: ["netsuite:ready"],
1086
- setup(c, { emit: g }) {
1087
- const l = Ke(), u = c, _ = g, { t: s } = us(), y = j(!1), S = j();
1088
- Ye(() => {
1089
- var e, a, b, k;
1090
- let n = {
1091
- id: "",
1092
- subsidiary: { id: "", name: "" },
1093
- errors: []
1094
- };
1095
- if (!l.isEnabled || !u.required) {
1096
- _("netsuite:ready", n);
1097
- return;
1098
- }
1099
- try {
1100
- const v = l.currentLocationSubsidiary();
1101
- u.setting ? n = {
1102
- ...u.setting,
1103
- subsidiary: {
1104
- id: v.id || "",
1105
- name: v.name
1106
- }
1107
- } : n = {
1108
- ...n,
1109
- subsidiary: {
1110
- id: v.id || "",
1111
- name: v.name
1112
- }
1113
- };
1114
- const x = l.getAvailableItems(v.id), w = u.items.filter(($) => {
1115
- if ($.measurement != null) {
1116
- const q = l.getAvailableMeasurements(
1117
- $.sku._id,
1118
- v.id
1119
- );
1120
- return x.includes($.sku._id) && q.includes($.measurement.id);
1121
- }
1122
- return x.includes($.sku._id);
1123
- }).map(($) => $.sku._id);
1124
- u.onChange(
1125
- u.items.filter(($) => w.includes($.sku._id)),
1126
- n
1127
- );
1128
- } finally {
1129
- u.supplier.internal ? S.value = l.getNetSuiteLocation(
1130
- `${u.supplier.internal}_${u.supplier._id}`
1131
- ) : S.value = l.getNetSuiteVendor(u.supplier._id);
1132
- const v = u.supplier.internal ? l.getLocationSubsidiary((e = S.value) == null ? void 0 : e.netSuiteId).id : (a = S.value) == null ? void 0 : a.subsidiaryId, x = u.supplier.internal ? (b = l.currentLocationSubsidiary()) == null ? void 0 : b.id : (k = l.currentVendorSubsidiary(u.supplier._id)) == null ? void 0 : k.id;
1133
- !l.isEnabled || v && l.isEnabled && v == x ? _("netsuite:ready", n) : y.value = !0;
1134
- }
1135
- });
1136
- const m = O(
1137
- () => u.supplier.internal ? l.currentLocationSubsidiary() : l.currentVendorSubsidiary(u.supplier._id)
1138
- ), h = O(() => {
1139
- var n, e;
1140
- return S.value == null ? `Cannot find the NetSuite location for "${u.supplier.name}"` : `The subsidiary of the request
1141
- location is ${(e = l.getLocationSubsidiary((n = S.value) == null ? void 0 : n.netSuiteId)) == null ? void 0 : e.fullName}`;
1142
- });
1143
- return (n, e) => {
1144
- const a = P("FmLabel"), b = P("FmIcon"), k = P("FmField"), v = P("FmTooltip");
1145
- return t(l).isEnabled && u.required ? (C(), V("div", no, [
1146
- p(a, {
1147
- label: `NetSuite ${t(s)("inventory.transfer.form.netsuite.subsidiary")}`
1148
- }, null, 8, ["label"]),
1149
- r("div", lo, [
1150
- p(v, {
1151
- "z-index": 51,
1152
- placement: "left",
1153
- disabled: n.disabled
1154
- }, {
1155
- content: T(() => e[0] || (e[0] = [
1156
- Ee("This field is locked and based on the location of the request.")
1157
- ])),
1158
- default: T(() => [
1159
- p(k, null, {
1160
- default: T(() => {
1161
- var x;
1162
- return [
1163
- r("div", ro, [
1164
- p(b, {
1165
- name: "lock_outline",
1166
- size: "sm",
1167
- color: n.disabled ? "neutral-gray-200" : "neutral-gray-400"
1168
- }, null, 8, ["color"]),
1169
- r("div", {
1170
- class: ee([n.disabled ? "text-fm-color-typo-disabled" : ""])
1171
- }, E((x = m.value) == null ? void 0 : x.fullName), 3)
1172
- ])
1173
- ];
1174
- }),
1175
- _: 1
1176
- })
1177
- ]),
1178
- _: 1
1179
- }, 8, ["disabled"]),
1180
- y.value ? (C(), V("div", io, E(h.value), 1)) : Q("", !0)
1181
- ])
1182
- ])) : Q("", !0);
1183
- };
1184
- }
1185
- }), mo = { class: "flex flex-col gap-4" }, co = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, po = { class: "flex flex-col gap-16" }, fo = { class: "flex flex-col gap-24" }, yo = { class: "flex flex-col gap-8" }, vo = { class: "flex flex-col gap-4" }, bo = { class: "flex items-center gap-4" }, go = { class: "flex flex-col gap-8" }, _o = { class: "flex flex-col gap-4" }, ko = { class: "flex items-center gap-4" }, ho = {
1186
- key: 3,
1187
- class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
1188
- }, Co = {
1189
- key: 0,
1190
- class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
1191
- }, So = { class: "flex-1" }, xo = { class: "flex-1" }, wo = {
1192
- key: 1,
1193
- class: "flex items-center gap-4"
1194
- }, Io = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, Do = { class: "flex flex-col gap-16" }, Fo = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, $o = { class: "flex gap-8" }, To = { key: 0 }, Po = /* @__PURE__ */ me({
1195
- __name: "TransferForm2",
1196
- props: {
1197
- modelValue: {},
1198
- request: {},
1199
- disabled: { type: Boolean },
1200
- suppliers: {},
1201
- skus: {},
1202
- lastClosingDate: {}
1203
- },
1204
- emits: ["validation-success", "form:ready"],
1205
- setup(c, { expose: g, emit: l }) {
1206
- const u = c, _ = l, s = Ct(), { t: y } = _e(), S = Xe(), m = We(), h = Ke(), n = tt(), e = Ne(), a = Dt(), { breakpoints: b } = et(), k = O(() => b.value.xs || b.value.sm), v = bt({
1207
- value: !1
1208
- }), x = j(!1), w = O(
1209
- () => {
1210
- var o;
1211
- return ((o = u.modelValue) == null ? void 0 : o.templateDoc) ?? a.templates.find((d) => d._id === s.template);
1212
- }
1213
- ), $ = O(() => s.status === "DRAFT" || !s._rev);
1214
- ge(w, (o) => {
1215
- o && $.value && (s.supplier = (o == null ? void 0 : o.purchaseOrder.supplier) ?? s.supplier);
1216
- }), Ye(() => {
1217
- var o;
1218
- try {
1219
- if (!s.template) return;
1220
- if (!s.items.length) {
1221
- let d = [];
1222
- (o = w.value) != null && o.purchaseOrder.items && (d = w.value.purchaseOrder.items.filter((z) => {
1223
- var X;
1224
- return ((X = z.quantity) == null ? void 0 : X.amount) != 0;
1225
- })), s.items = d;
1226
- }
1227
- } finally {
1228
- x.value = !0;
1229
- }
1230
- }), ge([x, v], ([o, d], [z, X]) => {
1231
- d.value && X.value && _("form:ready");
1232
- });
1233
- const q = O(
1234
- () => S.currentLocation.type === zt.restaurant
1235
- );
1236
- S.watchLocation(async () => {
1237
- location && (s.supplier || (s.supplier = n.suppliers.find((o) => o) ?? s.supplier));
1238
- });
1239
- const te = It(), I = ns(
1240
- () => s,
1241
- (o) => {
1242
- Object.assign(s, o);
1243
- },
1244
- !0,
1245
- !0
1246
- ), F = O({
1247
- get() {
1248
- var o;
1249
- return typeof ((o = s == null ? void 0 : s.supplier) == null ? void 0 : o.internal) == "string" ? G.TRANSFER : G.PURCHASE;
1250
- },
1251
- set(o) {
1252
- var z;
1253
- const d = typeof ((z = s == null ? void 0 : s.supplier) == null ? void 0 : z.internal) == "string" ? G.TRANSFER : G.PURCHASE;
1254
- o !== d && (s.supplier = o === G.PURCHASE ? I.locationOptionsTypePurchase.value[0] : I.locationOptionsTypeTransfer.value[0]);
1255
- }
1256
- });
1257
- ge(
1258
- () => {
1259
- var o;
1260
- return (o = u.modelValue) == null ? void 0 : o.template;
1261
- },
1262
- (o) => {
1263
- e.mustUsePoTemplate && !o && Vt(() => {
1264
- var d, z;
1265
- s.supplier = ((z = (d = I.locationOptionsTypeTransfer.value) == null ? void 0 : d.filter(
1266
- (X) => X.internal === "restaurant"
1267
- )) == null ? void 0 : z[0]) ?? s.supplier;
1268
- });
1269
- },
1270
- { immediate: !0 }
1271
- );
1272
- const U = O(() => {
1273
- let o = I.transferLocationOptions.value;
1274
- return e.mustUsePoTemplate && !s.template && (o = o.filter((d) => {
1275
- var z;
1276
- return (z = d.sublabel) == null ? void 0 : z.startsWith("restaurant");
1277
- })), o;
1278
- }), N = O({
1279
- get() {
1280
- return s.supplier._id;
1281
- },
1282
- set(o) {
1283
- I.transferLocationModel.value = o;
1284
- }
1285
- }), M = O({
1286
- get() {
1287
- return s.remark ?? void 0;
1288
- },
1289
- set(o) {
1290
- s.remark = o;
1291
- }
1292
- }), { backdatePo: H, backdateSwitch: J, backdateModel: W, backdateTimeModel: f } = $s({
1293
- getEffectiveAt() {
1294
- return s.effectiveAt;
1295
- },
1296
- setEffectiveAt(o) {
1297
- s.effectiveAt = o;
1298
- }
1299
- }), { comparePricesToggle: i, comparePriceFetching: A, comparePriceBySku: K } = js(), se = j();
1300
- g({
1301
- validateInputs: () => {
1302
- var o, d;
1303
- (d = (o = se.value) == null ? void 0 : o.validateInputs) == null || d.call(o);
1304
- },
1305
- resetInputsValidation: () => {
1306
- var o, d;
1307
- (d = (o = se.value) == null ? void 0 : o.resetInputsValidation) == null || d.call(o);
1308
- },
1309
- resetInputs: () => {
1310
- var o, d;
1311
- (d = (o = se.value) == null ? void 0 : o.resetInputs) == null || d.call(o);
1312
- }
1313
- });
1314
- const Ce = O(() => ({
1315
- updateItem: (o) => {
1316
- s.items = s.items.map((d) => d.sku._id !== o.sku._id ? d : o);
1317
- },
1318
- deleteItem: (o) => {
1319
- s.items = s.items.filter((d) => d.sku._id !== o.sku._id);
1320
- }
1321
- })), Se = ms({
1322
- updateItem: (o) => Ce.value.updateItem(o),
1323
- deleteItem: (o) => Ce.value.deleteItem(o),
1324
- get supplier() {
1325
- return s.supplier;
1326
- },
1327
- get items() {
1328
- return s.items;
1329
- },
1330
- get transferType() {
1331
- return F.value;
1332
- },
1333
- get template() {
1334
- return w.value;
1335
- },
1336
- get disabled() {
1337
- return u.disabled;
1338
- }
1339
- }), Te = O(() => {
1340
- let o = Se.columnDefs.value;
1341
- return h.isEnabled && F.value === G.TRANSFER && (o = o.filter((d) => d.id !== L.TotalCost)), o;
1342
- });
1343
- function Pe() {
1344
- var fe, ke, Re, Ae, we;
1345
- const o = new Set((Re = (ke = (fe = w.value) == null ? void 0 : fe.purchaseOrder) == null ? void 0 : ke.items) == null ? void 0 : Re.map((B) => B.sku._id)), d = h.isEnabled ? h.getAvailableItems((we = (Ae = s.netSuite) == null ? void 0 : Ae.subsidiary) == null ? void 0 : we.id) : [], z = o.size ? m.skus.filter((B) => o.has(B._id)) : m.skus, X = h.isEnabled ? z.filter((B) => {
1346
- var re, ae, ye, ie;
1347
- const oe = (ae = (re = w.value) == null ? void 0 : re.purchaseOrder) == null ? void 0 : ae.items.find(
1348
- (ve) => ve.sku._id === B._id
1349
- );
1350
- if (oe != null && oe.measurement != null) {
1351
- const ve = h.getAvailableMeasurements(
1352
- oe.sku._id,
1353
- (ie = (ye = s.netSuite) == null ? void 0 : ye.subsidiary) == null ? void 0 : ie.id
1354
- );
1355
- return d.includes(oe.sku._id) && ve.includes(oe.measurement.id);
1356
- }
1357
- return d.includes(B._id);
1358
- }).map((B) => B._id) : z.map((B) => B._id), ce = z.map(
1359
- (B) => ({
1360
- label: B.name,
1361
- sublabel: B.code,
1362
- value: B,
1363
- disabled: !X.includes(B._id)
1364
- })
1365
- ), pe = ce.filter((B) => {
1366
- var oe;
1367
- return (oe = s.items) == null ? void 0 : oe.find((re) => re.sku._id === B.value._id);
1368
- }).map((B) => B.value);
1369
- te.open({
1370
- title: y("inventory.transfer.form.items.selectItem"),
1371
- closeButton: !0,
1372
- contentComponent: je,
1373
- contentComponentProps: {
1374
- modelValue: pe,
1375
- items: ce,
1376
- virtualScroll: !0
1377
- },
1378
- primaryActions: {
1379
- text: y("common.confirm"),
1380
- close: !0
1381
- },
1382
- secondaryActions: {
1383
- text: y("common.close"),
1384
- close: !0,
1385
- variant: "tertiary"
1386
- }
1387
- }).onPrimary((B) => {
1388
- const oe = s.items ?? [], re = B.map((ae) => {
1389
- var ve, Ie;
1390
- const ye = oe.find((he) => he.sku._id === ae._id);
1391
- if (ye)
1392
- return ye;
1393
- const ie = ((Ie = (ve = w.value) == null ? void 0 : ve.purchaseOrder.items) == null ? void 0 : Ie.find(
1394
- (he) => he.sku._id === ae._id
1395
- )) ?? {
1396
- sku: ae,
1397
- code: ae.code,
1398
- name: ae.name,
1399
- quantity: {
1400
- amount: 1,
1401
- precision: 0
1402
- }
1403
- };
1404
- return F.value == G.PURCHASE && (ie.totalCost = ne(
1405
- ie.sku,
1406
- ie.quantity,
1407
- ie.measurement,
1408
- {
1409
- supplier: s.supplier
1410
- }
1411
- )), ie;
1412
- });
1413
- re.sort((ae, ye) => ae.sku.code.localeCompare(ye.sku.code)), s.items = re;
1414
- });
1415
- }
1416
- function Be(o) {
1417
- return o;
1418
- }
1419
- const Ve = O(() => {
1420
- const o = [];
1421
- return (!e.mustUsePoTemplate || e.mustUsePoTemplate && s.template) && o.push({
1422
- label: y("inventory.transfer.form.type.purchase"),
1423
- value: G.PURCHASE
1424
- }), o.push({
1425
- label: y("inventory.transfer.form.type.transfer"),
1426
- value: G.TRANSFER
1427
- }), o;
1428
- });
1429
- return (o, d) => {
1430
- var ve, Ie;
1431
- const z = P("FmChip"), X = P("FmLabel"), ce = P("FmIcon"), pe = P("FmField"), fe = P("FmTooltip"), ke = P("FmSelect"), Re = P("FmTextField"), Ae = P("FmTextarea"), we = P("FmSwitch"), B = P("FmDatePicker"), oe = P("FmTimePicker"), re = P("FmFormGroup"), ae = P("FmButton"), ye = P("FmTable"), ie = P("FmForm");
1432
- return C(), V("div", mo, [
1433
- r("div", co, [
1434
- (ve = u.modelValue) != null && ve.template ? (C(), Y(z, {
1435
- key: 0,
1436
- variant: o.disabled ? "warning" : void 0,
1437
- label: `${t(y)("inventory.transfer.template.title")}: ${((Ie = w.value) == null ? void 0 : Ie.name) ?? t(y)("inventory.transfer.form.loading")}`,
1438
- icon: "summarize",
1439
- compact: ""
1440
- }, null, 8, ["variant", "label"])) : Q("", !0),
1441
- p(z, {
1442
- label: t(S).currentLocation.name,
1443
- icon: "storefront",
1444
- compact: ""
1445
- }, null, 8, ["label"]),
1446
- o.lastClosingDate ? (C(), Y(z, {
1447
- key: 1,
1448
- label: `${t(y)("inventory.transfer.form.lastClosing")}: ${t(Je)(o.lastClosingDate)} ${t(Lt)(o.lastClosingDate)}`,
1449
- icon: "calendar_month",
1450
- compact: ""
1451
- }, null, 8, ["label"])) : Q("", !0)
1452
- ]),
1453
- p(ie, {
1454
- ref_key: "formRef",
1455
- ref: se,
1456
- class: "flex flex-col gap-32",
1457
- disabled: o.disabled,
1458
- onValidationFailed: console.log,
1459
- onValidationSuccess: d[14] || (d[14] = (he) => _("validation-success"))
1460
- }, {
1461
- default: T(() => {
1462
- var he, st, ot, at, nt, lt, rt, it;
1463
- return [
1464
- r("div", po, [
1465
- r("div", fo, [
1466
- (he = u.modelValue) != null && he.template ? (C(), V(be, { key: 0 }, [
1467
- r("div", yo, [
1468
- p(X, {
1469
- label: t(y)("inventory.transfer.form.type.title")
1470
- }, null, 8, ["label"]),
1471
- r("div", vo, [
1472
- p(fe, {
1473
- "z-index": 51,
1474
- placement: "left",
1475
- disabled: o.disabled
1476
- }, {
1477
- content: T(() => d[15] || (d[15] = [
1478
- Ee("This field is locked from template.")
1479
- ])),
1480
- default: T(() => [
1481
- p(pe, null, {
1482
- default: T(() => [
1483
- r("div", bo, [
1484
- p(ce, {
1485
- name: "lock_outline",
1486
- size: "sm",
1487
- color: o.disabled ? "neutral-gray-200" : "neutral-gray-400"
1488
- }, null, 8, ["color"]),
1489
- r("div", {
1490
- class: ee({ "text-fm-color-typo-disabled": o.disabled })
1491
- }, E(t(y)(`inventory.transfer.form.type.${F.value.toLocaleLowerCase("en-us")}`)), 3)
1492
- ])
1493
- ]),
1494
- _: 1
1495
- })
1496
- ]),
1497
- _: 1
1498
- }, 8, ["disabled"]),
1499
- r("div", {
1500
- class: ee([
1501
- "fm-typo-en-body-sm-400",
1502
- o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
1503
- ])
1504
- }, null, 2)
1505
- ])
1506
- ]),
1507
- r("div", go, [
1508
- p(X, {
1509
- label: F.value === t(G).PURCHASE ? t(y)("inventory.transfer.form.purchaseFrom") : t(y)("inventory.transfer.form.transferFrom")
1510
- }, null, 8, ["label"]),
1511
- r("div", _o, [
1512
- p(fe, {
1513
- "z-index": 51,
1514
- placement: "left",
1515
- disabled: o.disabled
1516
- }, {
1517
- content: T(() => d[16] || (d[16] = [
1518
- Ee("This field is locked from template.")
1519
- ])),
1520
- default: T(() => [
1521
- p(pe, null, {
1522
- default: T(() => {
1523
- var D;
1524
- return [
1525
- r("div", ko, [
1526
- p(ce, {
1527
- name: "lock_outline",
1528
- size: "sm",
1529
- color: o.disabled ? "neutral-gray-200" : "neutral-gray-400"
1530
- }, null, 8, ["color"]),
1531
- r("div", {
1532
- class: ee({ "text-fm-color-typo-disabled": o.disabled })
1533
- }, E((D = U.value.find((Z) => Z.value === N.value)) == null ? void 0 : D.label), 3)
1534
- ])
1535
- ];
1536
- }),
1537
- _: 1
1538
- })
1539
- ]),
1540
- _: 1
1541
- }, 8, ["disabled"])
1542
- ])
1543
- ])
1544
- ], 64)) : (C(), V(be, { key: 1 }, [
1545
- p(ke, {
1546
- label: t(y)("inventory.transfer.form.type.title"),
1547
- "label-mark": "required",
1548
- modelValue: F.value,
1549
- "onUpdate:modelValue": d[0] || (d[0] = (D) => F.value = D),
1550
- items: Ve.value,
1551
- rules: [t(Ue)(1)(U.value)]
1552
- }, {
1553
- default: T(() => [
1554
- r("span", {
1555
- class: ee([
1556
- "line-clamp-1 fm-typo-en-body-lg-400",
1557
- o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
1558
- ])
1559
- }, E(t(Ht)(F.value)), 3)
1560
- ]),
1561
- _: 1
1562
- }, 8, ["label", "modelValue", "items", "rules"]),
1563
- p(ke, {
1564
- label: F.value === t(G).PURCHASE ? t(y)("inventory.transfer.form.purchaseFrom") : t(y)("inventory.transfer.form.transferFrom"),
1565
- "label-mark": "required",
1566
- modelValue: N.value,
1567
- "onUpdate:modelValue": d[1] || (d[1] = (D) => N.value = D),
1568
- items: U.value
1569
- }, {
1570
- "menu-wrapper": T((D) => {
1571
- var Z, De;
1572
- return [
1573
- p(ls, He(D, {
1574
- items: U.value,
1575
- "model-value": (De = (Z = o.modelValue) == null ? void 0 : Z.supplier) == null ? void 0 : De._id
1576
- }), null, 16, ["items", "model-value"])
1577
- ];
1578
- }),
1579
- default: T(() => {
1580
- var D;
1581
- return [
1582
- r("span", {
1583
- class: ee([
1584
- "line-clamp-1 fm-typo-en-body-lg-400",
1585
- o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
1586
- ])
1587
- }, E((D = U.value.find((Z) => Z.value === N.value)) == null ? void 0 : D.label), 3)
1588
- ];
1589
- }),
1590
- _: 1
1591
- }, 8, ["label", "modelValue", "items"])
1592
- ], 64)),
1593
- p(Re, {
1594
- label: t(y)("inventory.transfer.form.reference"),
1595
- "label-mark": "optional",
1596
- modelValue: t(s).ref,
1597
- "onUpdate:modelValue": d[2] || (d[2] = (D) => t(s).ref = D)
1598
- }, null, 8, ["label", "modelValue"]),
1599
- p(Ae, {
1600
- label: t(y)("inventory.transfer.form.remark"),
1601
- "label-mark": "optional",
1602
- "max-length": 240,
1603
- modelValue: M.value,
1604
- "onUpdate:modelValue": d[3] || (d[3] = (D) => M.value = D),
1605
- class: ee([o.disabled ? "text-fm-color-typo-disabled " : ""])
1606
- }, null, 8, ["label", "modelValue", "class"]),
1607
- x.value ? (C(), Y(uo, {
1608
- key: 2,
1609
- required: t(s).template != null,
1610
- disabled: o.disabled,
1611
- supplier: t(s).supplier,
1612
- setting: t(s).netSuite,
1613
- items: t(s).items,
1614
- onChange: (D, Z) => {
1615
- t(s).items = D, t(s).netSuite = Z;
1616
- },
1617
- "onNetsuite:ready": d[4] || (d[4] = (D) => {
1618
- v.value = !0;
1619
- })
1620
- }, null, 8, ["required", "disabled", "supplier", "setting", "items", "onChange"])) : Q("", !0),
1621
- t(e).enableBackdatePo ? (C(), V("div", ho, [
1622
- r("div", {
1623
- class: ee([
1624
- "flex",
1625
- {
1626
- "flex-col": k.value
1627
- }
1628
- ])
1629
- }, [
1630
- p(we, {
1631
- modelValue: t(J),
1632
- "onUpdate:modelValue": d[5] || (d[5] = (D) => xe(J) ? J.value = D : null),
1633
- label: t(y)("inventory.transfer.form.backdate.title"),
1634
- sublabel: t(y)("inventory.transfer.form.backdate.subtitle"),
1635
- "label-placement": "right",
1636
- disabled: q.value && !o.lastClosingDate || o.disabled
1637
- }, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
1638
- r("div", {
1639
- class: ee({ hidden: k.value, "w-16": !k.value })
1640
- }, null, 2),
1641
- t(J) ? (C(), V("div", Co, [
1642
- r("div", So, [
1643
- p(B, {
1644
- modelValue: t(W),
1645
- "onUpdate:modelValue": d[6] || (d[6] = (D) => xe(W) ? W.value = D : null)
1646
- }, null, 8, ["modelValue"])
1647
- ]),
1648
- r("div", xo, [
1649
- p(oe, {
1650
- modelValue: t(f),
1651
- "onUpdate:modelValue": d[7] || (d[7] = (D) => xe(f) ? f.value = D : null)
1652
- }, null, 8, ["modelValue"])
1653
- ])
1654
- ])) : Q("", !0)
1655
- ], 2),
1656
- t(H) ? (C(), Y(re, {
1657
- key: 0,
1658
- modelValue: t(H),
1659
- "onUpdate:modelValue": d[8] || (d[8] = (D) => xe(H) ? H.value = D : null),
1660
- rules: [t(jt)(new Date(o.lastClosingDate), /* @__PURE__ */ new Date())]
1661
- }, null, 8, ["modelValue", "rules"])) : Q("", !0),
1662
- q.value && !o.lastClosingDate ? (C(), V("div", wo, [
1663
- p(ce, {
1664
- name: "error",
1665
- size: "sm",
1666
- class: "text-fm-color-typo-warning"
1667
- }),
1668
- r("span", Io, E(t(y)("inventory.transfer.form.backdate.error")), 1)
1669
- ])) : Q("", !0)
1670
- ])) : Q("", !0)
1671
- ])
1672
- ]),
1673
- r("div", Do, [
1674
- p(re, {
1675
- "model-value": t(s).items,
1676
- rules: [t(Ue)(1)]
1677
- }, null, 8, ["model-value", "rules"]),
1678
- r("div", {
1679
- class: ee([
1680
- "flex gap-16",
1681
- {
1682
- "flex-col items-start": k.value,
1683
- "items-center": !k.value
1684
- }
1685
- ])
1686
- }, [
1687
- r("div", Fo, E(t(y)("inventory.transfer.form.items.title")), 1),
1688
- r("div", $o, [
1689
- p(ae, {
1690
- disabled: o.disabled,
1691
- label: t(y)("inventory.transfer.form.items.addItem"),
1692
- "prepend-icon": "add",
1693
- variant: "secondary",
1694
- "text-color": "primary",
1695
- "bg-color": "transparent",
1696
- "border-color": "primary",
1697
- onClick: d[9] || (d[9] = (D) => Pe()),
1698
- size: "md"
1699
- }, null, 8, ["disabled", "label"]),
1700
- t(s).template ? (C(), Y(fe, {
1701
- key: 0,
1702
- "z-index": 50
1703
- }, {
1704
- content: T(() => [
1705
- r("div", null, E(t(y)("inventory.transfer.form.items.forecastStock.notAvailable")), 1)
1706
- ]),
1707
- default: T(() => [
1708
- p(yt, {
1709
- "onUpdate:poItems": d[10] || (d[10] = (D) => t(s).items = D),
1710
- disabled: ""
1711
- })
1712
- ]),
1713
- _: 1
1714
- })) : (C(), Y(yt, {
1715
- key: 1,
1716
- "onUpdate:poItems": d[11] || (d[11] = (D) => t(s).items = D),
1717
- disabled: o.disabled || !!t(s).template
1718
- }, null, 8, ["disabled"]))
1719
- ])
1720
- ], 2),
1721
- F.value === t(G).PURCHASE && $.value && t(e).enableTotalCost && ((st = o.modelValue) != null && st.items.length) ? (C(), V("div", To, [
1722
- p(we, {
1723
- label: t(A) ? t(y)("inventory.transfer.form.items.fetchingData") : t(y)("inventory.transfer.form.items.comparePriceHistory"),
1724
- "prepend-icon": "compare_arrows",
1725
- "label-placement": "right",
1726
- "model-value": t(i),
1727
- "onUpdate:modelValue": d[12] || (d[12] = (D) => xe(i) ? i.value = D : null),
1728
- disabled: t(A) || o.disabled
1729
- }, null, 8, ["label", "model-value", "disabled"])
1730
- ])) : Q("", !0),
1731
- (C(), Y(ye, {
1732
- "column-defs": Te.value,
1733
- "column-visibility": {
1734
- [t(L).Code]: !(((ot = o.modelValue) == null ? void 0 : ot.template) ?? ((at = o.modelValue) == null ? void 0 : at.templateDoc)),
1735
- [t(L).Name]: !(((nt = o.modelValue) == null ? void 0 : nt.template) ?? ((lt = o.modelValue) == null ? void 0 : lt.templateDoc)),
1736
- [t(L).TemplateName]: !!(((rt = o.modelValue) == null ? void 0 : rt.template) ?? ((it = o.modelValue) == null ? void 0 : it.templateDoc))
1737
- },
1738
- "row-data": t(s).items,
1739
- key: t(s).items.map((D) => D.sku._id).join("."),
1740
- "hide-footer": "",
1741
- "page-size": t(s).items.length
1742
- }, {
1743
- "table-row": T((D) => {
1744
- var Z, De, ut, dt;
1745
- return [
1746
- p(ao, {
1747
- "compare-price-by-sku": t(K),
1748
- "show-compare-price": F.value === t(G).PURCHASE && t(i),
1749
- row: D,
1750
- "template-item": (dt = (ut = (De = (Z = o.modelValue) == null ? void 0 : Z.templateDoc) == null ? void 0 : De.purchaseOrder) == null ? void 0 : ut.items) == null ? void 0 : dt.find(
1751
- (ze) => ze.sku._id === D.original.sku._id
1752
- ),
1753
- "onUpdate:item": d[13] || (d[13] = (ze) => Ce.value.updateItem(ze)),
1754
- disabled: o.disabled
1755
- }, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "template-item", "disabled"])
1756
- ];
1757
- }),
1758
- "list-row": T((D) => [
1759
- (C(), Y(St, {
1760
- row: D,
1761
- key: t(s).items.map((Z) => Z.sku._id).join(".")
1762
- }, {
1763
- default: T((Z) => [
1764
- p(Fs, {
1765
- "compare-price-by-sku": t(K),
1766
- "show-compare-price": F.value === t(G).PURCHASE && t(i),
1767
- row: D,
1768
- "cell-by-col-id": Z
1769
- }, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
1770
- ]),
1771
- _: 2
1772
- }, 1032, ["row"]))
1773
- ]),
1774
- _: 1
1775
- }, 8, ["column-defs", "column-visibility", "row-data", "page-size"]))
1776
- ])
1777
- ];
1778
- }),
1779
- _: 1
1780
- }, 8, ["disabled", "onValidationFailed"])
1781
- ]);
1782
- };
1783
- }
1784
- }), Vo = { class: "flex items-center" }, Ro = { class: "fm-typo-en-title-md-800" }, Ao = { class: "flex gap-4" }, qo = /* @__PURE__ */ me({
1785
- __name: "TransferDialog",
1786
- props: {
1787
- mode: {},
1788
- modelValue: {},
1789
- templateId: {},
1790
- show: { type: Boolean },
1791
- lastClosingDate: {}
1792
- },
1793
- emits: ["update:show", "submitted"],
1794
- setup(c, { expose: g, emit: l }) {
1795
- var W;
1796
- const u = c, _ = l, s = xt(), y = Dt(), S = Oe(), m = tt(), h = We(), n = Xe(), e = Ne(), { t: a } = _e(), b = j(!1), k = j(!1), v = j(!1);
1797
- async function x(f) {
1798
- if (f) {
1799
- k.value = !1;
1800
- try {
1801
- await m.readSuppliers(), k.value = !0;
1802
- } catch {
1803
- S.open({
1804
- title: a("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
1805
- message: a("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
1806
- type: "error"
1807
- });
1808
- }
1809
- }
1810
- }
1811
- n.watchLocation(x);
1812
- function w() {
1813
- return {
1814
- remark: void 0,
1815
- ref: void 0,
1816
- stockSnapshotId: void 0,
1817
- effectiveAt: void 0,
1818
- items: [],
1819
- supplier: {
1820
- _rev: void 0,
1821
- email: void 0,
1822
- internal: void 0,
1823
- contactName: void 0,
1824
- phoneNumber: void 0,
1825
- registrationNumber: void 0,
1826
- supplyItems: void 0,
1827
- _id: "",
1828
- name: "",
1829
- address: {
1830
- line2: void 0,
1831
- line1: "",
1832
- state: "",
1833
- city: "",
1834
- postcode: "",
1835
- country: ""
1836
- }
1837
- },
1838
- status: "DRAFT",
1839
- _id: "",
1840
- seqNumber: 0,
1841
- deliveryOrder: [],
1842
- template: u.templateId,
1843
- templateDoc: y.templates.find((i) => i._id === u.templateId)
1844
- };
1845
- }
1846
- const $ = as(u, "show"), q = j(u.modelValue ?? w()), te = j(((W = u.modelValue) == null ? void 0 : W._id) ?? `${Math.random()}`);
1847
- ge(
1848
- () => u.show,
1849
- (f) => {
1850
- var i;
1851
- f && (v.value = !1, q.value = u.modelValue ?? w(), te.value = ((i = u.modelValue) == null ? void 0 : i._id) ?? `${Math.random()}`);
1852
- }
1853
- );
1854
- const I = O(() => !k.value || !v.value), F = O(() => {
1855
- switch (u.mode) {
1856
- case Fe.READ:
1857
- return "View transfer";
1858
- case Fe.CREATE:
1859
- return a("inventory.transfer.receiveRequest.create.title");
1860
- case Fe.UPDATE:
1861
- return a("inventory.transfer.receiveRequest.update.title");
1862
- }
1863
- return "";
1864
- }), U = j();
1865
- g({
1866
- validateInputs: () => {
1867
- var f, i;
1868
- (i = (f = U.value) == null ? void 0 : f.validateInputs) == null || i.call(f);
1869
- },
1870
- resetInputsValidation: () => {
1871
- var f, i;
1872
- (i = (f = U.value) == null ? void 0 : f.resetInputsValidation) == null || i.call(f);
1873
- },
1874
- resetInputs: () => {
1875
- var f, i;
1876
- (i = (f = U.value) == null ? void 0 : f.resetInputs) == null || i.call(f);
1877
- }
1878
- });
1879
- async function N() {
1880
- const f = q.value;
1881
- b.value = !0, f.items.some((i) => {
1882
- var A;
1883
- return (A = i.subItems) == null ? void 0 : A.length;
1884
- }) && (f.items = f.items.map((i) => {
1885
- var K;
1886
- if (!((K = i.subItems) != null && K.length)) return i;
1887
- const A = Me(i.subItems);
1888
- return {
1889
- ...i,
1890
- quantity: A,
1891
- // note: no measurement, total is calculate in base unit
1892
- measurement: null,
1893
- totalCost: ne(i.sku, A)
1894
- };
1895
- })), (f.supplier.internal === "warehouse" || f.supplier.internal === "restaurant") && (f.items = f.items.map(({ totalCost: i, ...A }) => A)), e.mustUseDefaultCost && (f.items = f.items.map((i) => ({
1896
- ...i,
1897
- totalCost: ne(i.sku, i.quantity, i.measurement)
1898
- })));
1899
- try {
1900
- await s.createPurchaseOrder(f), await new Promise((i) => setTimeout(i, 1e3)), S.open({
1901
- title: a("inventory.transfer.receiveRequest.create.success"),
1902
- message: a("inventory.transfer.receiveRequest.create.successMessage"),
1903
- type: "success"
1904
- }), _("update:show", !1), _("submitted");
1905
- } catch (i) {
1906
- S.open({
1907
- title: a("inventory.transfer.receiveRequest.create.error.title"),
1908
- message: a("inventory.transfer.receiveRequest.create.error.message"),
1909
- type: "error"
1910
- }), console.error("Error in creating purchase order", i);
1911
- } finally {
1912
- b.value = !1;
1913
- }
1914
- }
1915
- async function M() {
1916
- const f = q.value;
1917
- b.value = !0, f.items.some((i) => {
1918
- var A;
1919
- return (A = i.subItems) == null ? void 0 : A.length;
1920
- }) && (f.items = f.items.map((i) => {
1921
- var K;
1922
- if (!((K = i.subItems) != null && K.length)) return i;
1923
- const A = Me(i.subItems);
1924
- return {
1925
- ...i,
1926
- quantity: A,
1927
- // note: no measurement, total is calculate in base unit
1928
- measurement: null,
1929
- totalCost: ne(i.sku, A)
1930
- };
1931
- })), (f.supplier.internal === "warehouse" || f.supplier.internal === "restaurant") && (f.items = f.items.map(({ totalCost: i, ...A }) => A)), e.mustUseDefaultCost && (f.items = f.items.map((i) => ({
1932
- ...i,
1933
- totalCost: ne(i.sku, i.quantity, i.measurement)
1934
- })));
1935
- try {
1936
- await s.updatePurchaseOrder(f), await new Promise((i) => setTimeout(i, 1e3)), S.open({
1937
- title: a("inventory.transfer.receiveRequest.update.success"),
1938
- message: a("inventory.transfer.receiveRequest.update.successMessage"),
1939
- type: "success"
1940
- }), _("update:show", !1), _("submitted");
1941
- } catch (i) {
1942
- S.open({
1943
- title: a("inventory.transfer.receiveRequest.update.error.title"),
1944
- message: a("inventory.transfer.receiveRequest.update.error.message"),
1945
- type: "error"
1946
- }), console.error("Error in updating purchase order", i);
1947
- } finally {
1948
- b.value = !1;
1949
- }
1950
- }
1951
- function H() {
1952
- switch (u.mode) {
1953
- case Fe.CREATE:
1954
- return N();
1955
- case Fe.UPDATE:
1956
- return M();
1957
- }
1958
- }
1959
- function J() {
1960
- var f, i;
1961
- (i = (f = U.value) == null ? void 0 : f.validateInputs) == null || i.call(f);
1962
- }
1963
- return (f, i) => {
1964
- const A = P("FmButton"), K = P("FmSideSheet");
1965
- return C(), Y(K, {
1966
- modelValue: t($),
1967
- "onUpdate:modelValue": i[3] || (i[3] = (se) => xe($) ? $.value = se : null),
1968
- "dismiss-away": "",
1969
- "close-button": "",
1970
- "max-width": 900
1971
- }, {
1972
- "side-sheet-header": T(() => [
1973
- r("div", Vo, [
1974
- r("div", Ro, E(F.value), 1)
1975
- ])
1976
- ]),
1977
- default: T(() => [
1978
- (C(), Y(Po, {
1979
- class: "w-full",
1980
- ref_key: "formRef",
1981
- ref: U,
1982
- "onForm:ready": i[0] || (i[0] = () => v.value = !0),
1983
- onValidationSuccess: H,
1984
- modelValue: q.value,
1985
- "onUpdate:modelValue": i[1] || (i[1] = (se) => q.value = se),
1986
- disabled: b.value || I.value,
1987
- suppliers: t(m).suppliers,
1988
- skus: t(h).skus,
1989
- key: te.value,
1990
- "last-closing-date": f.lastClosingDate
1991
- }, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
1992
- ]),
1993
- "side-sheet-footer": T(() => [
1994
- r("div", Ao, [
1995
- p(A, {
1996
- loading: b.value,
1997
- disabled: I.value,
1998
- label: t(a)("common.save"),
1999
- onClick: J
2000
- }, null, 8, ["loading", "disabled", "label"]),
2001
- p(A, {
2002
- disabled: I.value,
2003
- variant: "tertiary",
2004
- label: t(a)("common.close"),
2005
- onClick: i[2] || (i[2] = (se) => _("update:show", !1))
2006
- }, null, 8, ["disabled", "label"])
2007
- ])
2008
- ]),
2009
- _: 1
2010
- }, 8, ["modelValue"]);
2011
- };
2012
- }
2013
- }), Eo = { class: "flex flex-col py-8" }, Uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Oo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1" }, No = {
2014
- key: 0,
2015
- class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
2016
- }, Bo = { class: "pt-8" }, vt = "ReceiveRequestViewSearchCriteria", aa = /* @__PURE__ */ me({
2017
- __name: "ReceiveRequestView",
2018
- setup(c) {
2019
- const { t: g } = _e(), l = Oe();
2020
- qe.object({
2021
- name: qe.string().optional().nullable(),
2022
- startDate: qe.string().optional().nullable(),
2023
- endDate: qe.string().optional().nullable()
2024
- });
2025
- const u = O(
2026
- () => !e._currentLocation || h.loading.value
2027
- ), _ = ss(), s = Ne();
2028
- function y() {
2029
- const I = {
2030
- name: "",
2031
- ...ct()
2032
- }, F = _.getItem(vt);
2033
- if (!F)
2034
- return I;
2035
- try {
2036
- return JSON.parse(F);
2037
- } catch {
2038
- return I;
2039
- }
2040
- }
2041
- function S() {
2042
- _.setItem(vt, JSON.stringify(m.value));
2043
- }
2044
- const m = j(y()), h = Zt(
2045
- Le.RECEIVE_REQUEST,
2046
- m.value
2047
- ), { columnDefs: n } = Gt(
2048
- Le.RECEIVE_REQUEST,
2049
- h
2050
- ), e = Xe();
2051
- async function a() {
2052
- const I = `inventory-record_${pt(m.value.startDate).format("DD-MM-YYYY_HH-mm")}-${pt(m.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`, F = h.purchaseOrders.value.flatMap(
2053
- (N) => N.items.map((M) => {
2054
- const H = new Date(es(N._id) ?? ""), J = N.effectiveAt ? new Date(N.effectiveAt) : void 0, W = le(
2055
- Wt(M.sku, N.deliveryOrder || [])
2056
- ), f = le(M.quantity);
2057
- return {
2058
- "SKU code": M.code,
2059
- "SKU name": M.name,
2060
- "PO #": N.seqNumber,
2061
- "Effective at": J,
2062
- Date: H,
2063
- Status: N.status,
2064
- Reference: N.ref ?? "",
2065
- "Received quantity": W,
2066
- "Ordered quantity": f,
2067
- Unit: M.sku.unit.abbrev,
2068
- "Total cost": M.totalCost ? Ge(M.totalCost) : null
2069
- };
2070
- })
2071
- ), U = [
2072
- "SKU code",
2073
- "SKU name",
2074
- "PO #",
2075
- "Date",
2076
- "Status",
2077
- "Reference",
2078
- "Received quantity",
2079
- "Ordered quantity",
2080
- "Unit"
2081
- ];
2082
- s.enableBackdatePo && U.insert("Effective at", 4), s.enableTotalCost && U.push("Total cost"), await ts(
2083
- [
2084
- {
2085
- name: "purchases",
2086
- data: F,
2087
- columns: U
2088
- }
2089
- ],
2090
- I
2091
- ), l.open({
2092
- title: g("inventory.transfer.receiveRequest.export.success"),
2093
- message: g("inventory.transfer.receiveRequest.export.message", [I]),
2094
- type: "success"
2095
- });
2096
- }
2097
- const b = j(ct()), k = j("");
2098
- ge([() => b.value], ([I]) => {
2099
- !I.startDate || !I.endDate || (m.value.startDate = I.startDate, m.value.endDate = I.endDate, h.updateDateRange(
2100
- m.value.startDate,
2101
- m.value.endDate
2102
- ), S());
2103
- }), ge([() => k.value], () => {
2104
- S();
2105
- });
2106
- function v(I) {
2107
- if (I === "create") {
2108
- if (u.value) {
2109
- l.open({
2110
- title: "Loading data...",
2111
- message: "Please wait.",
2112
- type: "info"
2113
- });
2114
- return;
2115
- }
2116
- return h.promptCreateTransferDialog();
2117
- }
2118
- if (I === "refresh")
2119
- return h.fetchData();
2120
- if (I === "export")
2121
- return a();
2122
- }
2123
- const { breakpoints: x } = et(), w = O(() => x.value.xs || x.value.sm), $ = O(() => w.value ? 10 : 20), q = Qt(), te = O(() => [
2124
- {
2125
- label: g("inventory.transfer.receiveRequest.actions.create"),
2126
- value: "create",
2127
- isPrimary: !0,
2128
- prependIcon: "add"
2129
- },
2130
- {
2131
- label: g("common.refresh"),
2132
- value: "refresh"
2133
- },
2134
- {
2135
- label: g("common.export"),
2136
- value: "export"
2137
- }
2138
- ]);
2139
- return (I, F) => {
2140
- const U = P("FmTable");
2141
- return C(), Y(Yt, {
2142
- title: t(g)("inventory.transfer.receiveRequest.title2"),
2143
- actions: te.value,
2144
- "onClick:action": v
2145
- }, {
2146
- default: T(() => {
2147
- var N;
2148
- return [
2149
- r("div", {
2150
- class: ee([
2151
- "flex flex-col gap-8 max-h-full",
2152
- {
2153
- "p-0": w.value,
2154
- "px-24 ": !w.value
2155
- }
2156
- ])
2157
- }, [
2158
- p(Kt, {
2159
- "date-range-query": "",
2160
- "date-range": b.value,
2161
- "onUpdate:dateRange": F[0] || (F[0] = (M) => b.value = M),
2162
- searchable: "",
2163
- "change-location": "",
2164
- search: k.value,
2165
- "onUpdate:search": F[1] || (F[1] = (M) => k.value = M)
2166
- }, null, 8, ["date-range", "search"]),
2167
- (C(), Y(U, {
2168
- style: gt(t(q).tableHeight),
2169
- "column-defs": t(n),
2170
- "row-data": t(h).purchaseOrders.value,
2171
- "search-value": k.value,
2172
- loading: u.value,
2173
- onRowClick: F[2] || (F[2] = (M) => t(h).promptShowTransferDetails(M.original)),
2174
- key: (N = t(e)._currentLocation) == null ? void 0 : N.dbName,
2175
- "page-size": $.value
2176
- }, {
2177
- "list-row": T((M) => [
2178
- p(St, {
2179
- row: M,
2180
- onRowClick: t(h).promptShowTransferDetails
2181
- }, {
2182
- default: T((H) => {
2183
- var J, W, f, i, A, K, se, Ce, Se, Te, Pe, Be, Ve, o, d, z, X, ce, pe, fe;
2184
- return [
2185
- r("div", Eo, [
2186
- r("div", Uo, [
2187
- p(t(de), {
2188
- render: (f = (W = (J = H._id) == null ? void 0 : J.column) == null ? void 0 : W.columnDef) == null ? void 0 : f.cell,
2189
- props: (A = (i = H._id) == null ? void 0 : i.getContext) == null ? void 0 : A.call(i)
2190
- }, null, 8, ["render", "props"])
2191
- ]),
2192
- r("div", Mo, [
2193
- p(t(de), {
2194
- render: (Ce = (se = (K = H.supplier_name) == null ? void 0 : K.column) == null ? void 0 : se.columnDef) == null ? void 0 : Ce.cell,
2195
- props: (Te = (Se = H.supplier_name) == null ? void 0 : Se.getContext) == null ? void 0 : Te.call(Se)
2196
- }, null, 8, ["render", "props"])
2197
- ]),
2198
- r("div", Oo, E(M.original.items.map((ke) => `${ke.name}`).join(", ")), 1),
2199
- M.original.ref ? (C(), V("div", No, [
2200
- p(t(de), {
2201
- render: (Ve = (Be = (Pe = H.ref) == null ? void 0 : Pe.column) == null ? void 0 : Be.columnDef) == null ? void 0 : Ve.cell,
2202
- props: (d = (o = H.ref) == null ? void 0 : o.getContext) == null ? void 0 : d.call(o)
2203
- }, null, 8, ["render", "props"])
2204
- ])) : Q("", !0),
2205
- r("div", Bo, [
2206
- p(t(de), {
2207
- render: (ce = (X = (z = H.status) == null ? void 0 : z.column) == null ? void 0 : X.columnDef) == null ? void 0 : ce.cell,
2208
- props: (fe = (pe = H.status) == null ? void 0 : pe.getContext) == null ? void 0 : fe.call(pe)
2209
- }, null, 8, ["render", "props"])
2210
- ])
2211
- ])
2212
- ];
2213
- }),
2214
- _: 2
2215
- }, 1032, ["row", "onRowClick"])
2216
- ]),
2217
- _: 1
2218
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2219
- ], 2),
2220
- (C(), Y(Rt, { to: "body" }, [
2221
- p(qo, He(t(h).transferDialogProps.value, {
2222
- onSubmitted: t(h).fetchData
2223
- }), null, 16, ["onSubmitted"]),
2224
- p(Jt, He({
2225
- scope: t(Le).RECEIVE_REQUEST
2226
- }, t(h).transferDetailsProps.value, {
2227
- onSubmitted: t(h).fetchData
2228
- }), null, 16, ["scope", "onSubmitted"])
2229
- ]))
2230
- ];
2231
- }),
2232
- _: 1
2233
- }, 8, ["title", "actions"]);
2234
- };
2235
- }
2236
- });
2237
- export {
2238
- aa as default
2239
- };