@feedmepos/mf-inventory-portal 0.0.19-dev.3 → 0.0.19-dev.5

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 (66) hide show
  1. package/dist/{ApprovalView-CS7NtcBA.js → ApprovalView-DY_a4R25.js} +16 -15
  2. package/dist/{BindingsDialog-BA2w-qkY.js → BindingsDialog-GITQp9DQ.js} +1 -1
  3. package/dist/{BindingsPicker-wf7b30Bk.js → BindingsPicker-CmS01WWD.js} +5 -5
  4. package/dist/{BindingsTable-mqqSPDbO.js → BindingsTable-CsMAutCO.js} +1 -1
  5. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CViUEhuw.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BstbCK2r.js} +1 -1
  6. package/dist/{IngredientsView-BVX31o67.js → IngredientsView-BM218iE0.js} +26 -25
  7. package/dist/{IntegrationView-DFdl_238.js → IntegrationView-DrPzZ7YF.js} +2 -2
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BENFVQkL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BtY633D-.js} +1 -1
  9. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-DBPQovO2.js +88 -0
  10. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js +29 -0
  11. package/dist/{PurchaseOrderPrintPreview-06PokYt4.js → PurchaseOrderPrintPreview-s_pZiI6a.js} +11 -11
  12. package/dist/ReceiveRequestView-De2UMTFi.js +208 -0
  13. package/dist/{RecipeView-CiOb2lvU.js → RecipeView-CXH_9Jbb.js} +117 -116
  14. package/dist/{StockView-5LkTxYI2.js → StockView-Cld0Ss_r.js} +17 -16
  15. package/dist/{SupplierView-BAfC5Wcw.js → SupplierView-DtaCFERj.js} +6 -6
  16. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kgcXwT9t.js +745 -0
  17. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-C1YU60Mq.js +1269 -0
  18. package/dist/TransferTemplateView-BSmhw7Vl.js +1130 -0
  19. package/dist/{UnitView-wsbXOcbf.js → UnitView-BS9sJznU.js} +33 -33
  20. package/dist/{WarehouseView-DHhDNAk8.js → WarehouseView-D0xCjihu.js} +4 -4
  21. package/dist/api/purchase-order-template.d.ts +7 -0
  22. package/dist/{app-DNCC20Aq.js → app-Bq5a4Oca.js} +6097 -5889
  23. package/dist/app.d.ts +39 -0
  24. package/dist/app.js +7 -5
  25. package/dist/components/FmUnitInputProps.d.ts +2 -0
  26. package/dist/components/FmUnitInputRules.d.ts +1 -0
  27. package/dist/components/row-action.enum.d.ts +2 -0
  28. package/dist/composable/defineDeepModel.d.ts +2 -0
  29. package/dist/{decimal-DaXHxukU.js → decimal-Bk4WDsfO.js} +1 -1
  30. package/dist/helper/country.d.ts +2 -0
  31. package/dist/id-to-date-DOITPfk-.js +30 -0
  32. package/dist/layout-Dkdyeqv8.js +147 -0
  33. package/dist/purchase-order-transaction-type-std52lFO.js +295 -0
  34. package/dist/router/name.d.ts +1 -0
  35. package/dist/row-action.enum-7jVyol1k.js +36 -0
  36. package/dist/stores/supplier.d.ts +90 -7
  37. package/dist/style.css +1 -1
  38. package/dist/supplier-B1qyquXV.js +54 -0
  39. package/dist/tsconfig.app.tsbuildinfo +1 -1
  40. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +2 -0
  41. package/dist/views/ingredients/components/inventory-binding/InventoryBindingSummary.vue.d.ts +26 -0
  42. package/dist/views/ingredients/helper/calculate-default-cost.d.ts +9 -0
  43. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -0
  44. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +2 -0
  45. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +3 -1
  46. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +6 -0
  47. package/dist/views/transfer-template/TransferTemplateView.vue.d.ts +2 -0
  48. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +22 -0
  49. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialogProps.d.ts +10 -0
  50. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +16 -0
  51. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateFormProps.d.ts +7 -0
  52. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +18 -0
  53. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +116 -0
  54. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +112 -0
  55. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +470 -0
  56. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +289 -0
  57. package/dist/{xlsx-DaxqUL1h.js → xlsx-Bx1vSwYW.js} +1 -1
  58. package/dist/{xlsx.util-Dwiw0sTo.js → xlsx.util-DsOslDqG.js} +2 -2
  59. package/package.json +3 -3
  60. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js +0 -35
  61. package/dist/ReceiveRequestView-ck-05Ly7.js +0 -1394
  62. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-qZDMkkIZ.js +0 -1031
  63. package/dist/id-to-date-XiomI6dP.js +0 -121
  64. package/dist/layout-DvgFrTEG.js +0 -151
  65. package/dist/row-action.enum-BwQbURNh.js +0 -28
  66. package/dist/supplier-BepZrUgL.js +0 -65
package/dist/app.d.ts CHANGED
@@ -34,7 +34,9 @@ export declare const i18nMessages: {
34
34
  inventoryBindings: {
35
35
  linkRecipe: string;
36
36
  linkIngredient: string;
37
+ name: string;
37
38
  amount: string;
39
+ itemsLinked: string;
38
40
  recipe: string;
39
41
  ingredient: string;
40
42
  invalidWarning: string;
@@ -322,6 +324,7 @@ export declare const i18nMessages: {
322
324
  };
323
325
  table: {
324
326
  seqNo: string;
327
+ name: string;
325
328
  createdAt: string;
326
329
  transferFrom: string;
327
330
  transferTo: string;
@@ -329,6 +332,32 @@ export declare const i18nMessages: {
329
332
  reference: string;
330
333
  status: string;
331
334
  };
335
+ form: {
336
+ name: string;
337
+ type: {
338
+ title: string;
339
+ purchase: string;
340
+ transfer: string;
341
+ };
342
+ purchaseFrom: string;
343
+ transferFrom: string;
344
+ reference: string;
345
+ remark: string;
346
+ items: {
347
+ title: string;
348
+ table: {
349
+ Code: string;
350
+ Name: string;
351
+ Amount: string;
352
+ Amount2: string;
353
+ MinimumAmount: string;
354
+ MinimumAmount2: string;
355
+ Step: string;
356
+ Cost: string;
357
+ Delete: string;
358
+ };
359
+ };
360
+ };
332
361
  receiveRequest: {
333
362
  title: string;
334
363
  title2: string;
@@ -382,6 +411,14 @@ export declare const i18nMessages: {
382
411
  rejectRequest: string;
383
412
  };
384
413
  };
414
+ template: {
415
+ title: string;
416
+ title2: string;
417
+ create: {
418
+ title: string;
419
+ };
420
+ use: string;
421
+ };
385
422
  };
386
423
  supplier: {
387
424
  title: string;
@@ -1031,3 +1068,5 @@ export declare const i18nMessages: {
1031
1068
  export { routers } from './router/shared';
1032
1069
  export { default as FmApp } from './App.vue';
1033
1070
  export { default as InventoryBindingForm } from './views/ingredients/components/inventory-binding/InventoryBindingForm.vue';
1071
+ export { default as InventoryBindingSummary } from './views/ingredients/components/inventory-binding/InventoryBindingSummary.vue';
1072
+ export { useInventoryStore } from './stores/inventory';
package/dist/app.js CHANGED
@@ -1,7 +1,9 @@
1
- import { ah as r, _ as e, af as n, ag as o } from "./app-DNCC20Aq.js";
1
+ import { an as s, _ as r, ao as e, al as o, am as m, u as t } from "./app-Bq5a4Oca.js";
2
2
  export {
3
- r as FmApp,
4
- e as InventoryBindingForm,
5
- n as i18nMessages,
6
- o as routers
3
+ s as FmApp,
4
+ r as InventoryBindingForm,
5
+ e as InventoryBindingSummary,
6
+ o as i18nMessages,
7
+ m as routers,
8
+ t as useInventoryStore
7
9
  };
@@ -12,6 +12,8 @@ export interface FmUnitInputProps extends FmTextFieldWithoutModelValue {
12
12
  precision?: number;
13
13
  convertAmountOnChangeUnit?: boolean;
14
14
  formatMinimumPrecision?: number;
15
+ disableUnit?: boolean;
16
+ stepper?: FdoDecimal | null;
15
17
  }
16
18
  export interface FmUnitInputEvents {
17
19
  (event: 'update:amount', amount: string): void;
@@ -1,6 +1,7 @@
1
1
  import type { FmGroupModelValue } from './FmUnitInputProps';
2
2
  import type { ValidationResult } from '@feedmepos/ui-library';
3
3
  export declare function FmUnitInputAmountIsNumberRule(): (value: FmGroupModelValue) => true | "Must be a number";
4
+ export declare function FmUnitInputAmountAtLeastRule(minimum: number): (value: FmGroupModelValue) => string | true;
4
5
  export declare function FmUnitInputAmountMoreThanRule(minimum: number): (value: FmGroupModelValue) => string | true;
5
6
  export declare function FmUnitInputMaxPrecisionRule(unit: FdoInventoryUnit, applyAmountRule?: boolean): (value: any) => ValidationResult;
6
7
  export declare function FmUnitInputMaxPrecisionRule(precision: number, applyAmountRule?: boolean): (value: any) => ValidationResult;
@@ -4,6 +4,8 @@ export type RowActionProps = {
4
4
  value?: string;
5
5
  };
6
6
  export declare enum RowActionEnum {
7
+ Add = "Add",
8
+ Create = "Create",
7
9
  Print = "Print",
8
10
  Update = "Update",
9
11
  Details = "Details",
@@ -0,0 +1,2 @@
1
+ /** Use in <script setup> only! */
2
+ export declare function defineDeepModel<T>(name?: string): T;
@@ -1,4 +1,4 @@
1
- import "./app-DNCC20Aq.js";
1
+ import "./app-Bq5a4Oca.js";
2
2
  function m(a) {
3
3
  function t(o, n = !0) {
4
4
  const e = Math.round(Math.log10(o));
@@ -258,3 +258,5 @@ export declare const supportedCountries: {
258
258
  };
259
259
  export declare function getCountryByCode(code?: CountryCode): Country;
260
260
  export declare const defaultCountry = CountryCode.MY;
261
+ export declare function getCurrency(): "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XAG" | "XAU" | "XBA" | "XBB" | "XBC" | "XBD" | "XCD" | "XDR" | "XOF" | "XPD" | "XPF" | "XPT" | "XSU" | "XTS" | "XUA" | "XXX" | "YER" | "ZAR" | "ZMW" | "ZWL";
262
+ export declare function getFormattedCurrency(): "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XAG" | "XAU" | "XBA" | "XBB" | "XBC" | "XBD" | "XCD" | "XDR" | "XOF" | "XPD" | "XPF" | "XPT" | "XSU" | "XTS" | "XUA" | "XXX" | "YER" | "ZAR" | "ZMW" | "ZWL" | "RM";
@@ -0,0 +1,30 @@
1
+ import { u as s, a as i } from "./xlsx-Bx1vSwYW.js";
2
+ function c(t, e) {
3
+ return e.map((n) => typeof n.selector == "function" ? n.selector(t) : t[n.selector]);
4
+ }
5
+ function u(t, e) {
6
+ const n = e.map((r) => r.name), a = t.map((r) => c(r, e));
7
+ return s.aoa_to_sheet([n, ...a]);
8
+ }
9
+ async function l(t, e) {
10
+ const n = s.book_new();
11
+ for (const a of t) {
12
+ const r = u(
13
+ a.data,
14
+ a.columns.map((o) => typeof o == "string" ? {
15
+ name: o,
16
+ selector: o
17
+ } : o)
18
+ );
19
+ s.book_append_sheet(n, r, a.name);
20
+ }
21
+ await i(n, e);
22
+ }
23
+ function p(t) {
24
+ let e = t.substring(t.indexOf("_") + 1);
25
+ return e.includes("_") && (e = e.substring(0, e.lastIndexOf("_"))), Number.isNaN(Date.parse(e)) ? null : new Date(e).toISOString();
26
+ }
27
+ export {
28
+ l as e,
29
+ p as i
30
+ };
@@ -0,0 +1,147 @@
1
+ import { components as I, useBreakpoints as R } from "@feedmepos/ui-library";
2
+ import { h as i, defineComponent as F, computed as B, openBlock as u, createBlock as M, resolveDynamicComponent as V, unref as p, normalizeClass as x, withCtx as z, createElementVNode as d, renderSlot as D, normalizeProps as L, guardReactiveProps as N, createElementBlock as c, Fragment as k, renderList as P, createVNode as w, createCommentVNode as y } from "vue";
3
+ import { ag as _ } from "./app-Bq5a4Oca.js";
4
+ const { FmMenu: E, FmButton: S, FmMenuItem: $ } = I;
5
+ function O(o, n) {
6
+ return i(
7
+ E,
8
+ {
9
+ trigger: "click",
10
+ stopClickPropagation: !0
11
+ },
12
+ {
13
+ "menu-button": () => i(S, {
14
+ type: "button",
15
+ variant: "tertiary",
16
+ icon: "more_vert",
17
+ iconColor: "#000000",
18
+ size: "md"
19
+ }),
20
+ default: () => i(
21
+ "div",
22
+ {
23
+ style: {
24
+ backgroundColor: "white",
25
+ padding: "4px",
26
+ width: "160px"
27
+ }
28
+ },
29
+ o.map(({ label: r, color: e, value: t }) => i(
30
+ $,
31
+ {
32
+ onClick() {
33
+ n(t ?? r);
34
+ }
35
+ },
36
+ {
37
+ label: () => i(
38
+ "span",
39
+ {
40
+ class: e
41
+ },
42
+ r
43
+ )
44
+ }
45
+ ))
46
+ )
47
+ }
48
+ );
49
+ }
50
+ /**
51
+ * vue-table
52
+ *
53
+ * Copyright (c) TanStack
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE.md file in the root directory of this source tree.
57
+ *
58
+ * @license MIT
59
+ */
60
+ const b = F({
61
+ props: ["render", "props"],
62
+ setup: (o) => () => typeof o.render == "function" || typeof o.render == "object" ? i(o.render, o.props) : o.render
63
+ }), j = { class: "flex gap-4 w-full" }, A = { class: "flex-1" }, H = { class: "flex flex-col" }, T = { key: 0 }, q = { key: 0 }, Q = /* @__PURE__ */ F({
64
+ __name: "TableActionableRow",
65
+ props: {
66
+ row: {},
67
+ onRowClick: {},
68
+ actionColumnId: { default: "action" }
69
+ },
70
+ setup(o) {
71
+ const n = o, r = B(
72
+ () => n.row.getVisibleCells().reduce(
73
+ (e, t) => (e[t.column.id] = t, e),
74
+ {}
75
+ )
76
+ );
77
+ return (e, t) => (u(), M(V(e.onRowClick ? p(I).FmListItem : "div"), {
78
+ class: x([
79
+ "w-full border-b border-fm-color-neutral-gray-100",
80
+ {
81
+ "bg-fm-color-neutral-gray-100": e.row.getIsSelected(),
82
+ "cursor-pointer": typeof e.onRowClick == "function"
83
+ }
84
+ ]),
85
+ onClick: t[0] || (t[0] = (m) => {
86
+ var s;
87
+ return (s = e.onRowClick) == null ? void 0 : s.call(e, e.row.original);
88
+ })
89
+ }, {
90
+ default: z(() => {
91
+ var m, s, f, a, C;
92
+ return [
93
+ d("div", j, [
94
+ d("div", A, [
95
+ D(e.$slots, "default", L(N(r.value)), () => [
96
+ d("div", H, [
97
+ (u(!0), c(k, null, P(n.row.getVisibleCells(), (l) => {
98
+ var g, v, h;
99
+ return u(), c(k, {
100
+ key: l.id
101
+ }, [
102
+ l.column.id !== e.actionColumnId ? (u(), c("div", T, [
103
+ w(p(b), {
104
+ render: (v = (g = l.column) == null ? void 0 : g.columnDef) == null ? void 0 : v.cell,
105
+ props: (h = l.getContext) == null ? void 0 : h.call(l)
106
+ }, null, 8, ["render", "props"])
107
+ ])) : y("", !0)
108
+ ], 64);
109
+ }), 128))
110
+ ])
111
+ ])
112
+ ]),
113
+ r.value[e.actionColumnId ?? ""] ? (u(), c("div", q, [
114
+ d("div", null, [
115
+ w(p(b), {
116
+ render: (f = (s = (m = r.value[e.actionColumnId ?? ""]) == null ? void 0 : m.column) == null ? void 0 : s.columnDef) == null ? void 0 : f.cell,
117
+ props: (C = (a = r.value[e.actionColumnId ?? ""]) == null ? void 0 : a.getContext) == null ? void 0 : C.call(a)
118
+ }, null, 8, ["render", "props"])
119
+ ])
120
+ ])) : y("", !0)
121
+ ])
122
+ ];
123
+ }),
124
+ _: 3
125
+ }, 8, ["class"]));
126
+ }
127
+ });
128
+ function U() {
129
+ return {
130
+ get tableHeight() {
131
+ const o = _(), { breakpoints: n } = R();
132
+ return o.isIframeMode ? n.value.xs || n.value.sm ? {
133
+ height: "calc(100dvh - 180px)"
134
+ } : {
135
+ height: "calc(100dvh - 124px)"
136
+ } : {
137
+ height: "calc(100dvh - 180px)"
138
+ };
139
+ }
140
+ };
141
+ }
142
+ export {
143
+ b as F,
144
+ Q as _,
145
+ O as c,
146
+ U as u
147
+ };
@@ -0,0 +1,295 @@
1
+ import { n as x, j as N, ae as l, ad as j, J as H, K as q, af as Y, c as V, a9 as W, w as G, b as J } from "./app-Bq5a4Oca.js";
2
+ import { ref as h, computed as K } from "vue";
3
+ import { i as Q } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BstbCK2r.js";
4
+ import { F as C } from "./row-action.enum-7jVyol1k.js";
5
+ import { useDialog as Z, useSnackbar as z } from "@feedmepos/ui-library";
6
+ const X = x((s, t) => {
7
+ const i = N();
8
+ return {
9
+ async readRequests(n) {
10
+ const o = n ?? i.currentLocationDBName, a = `${s.inventoryBackendUrl}/${o}/purchase-request`;
11
+ return await t.get(a);
12
+ },
13
+ async getPurchaseOrders({
14
+ start: n,
15
+ end: o
16
+ }) {
17
+ const a = i.currentLocationDBName, d = `${s.inventoryBackendUrl}/${a}/purchase-order`;
18
+ return await t.get(`${d}?start=${n}&end=${o}`);
19
+ },
20
+ async getPurchaseOrderById(n) {
21
+ const o = i.currentLocationDBName, a = `${s.inventoryBackendUrl}/${o}/purchase-order`;
22
+ return await t.get(`${a}/${n}`);
23
+ },
24
+ async processPurchaseOrder(n, o) {
25
+ const a = i.currentLocationDBName, d = o || a, p = `${s.inventoryBackendUrl}/${d}/purchase-order/run-operation`;
26
+ return await t.put(p, n);
27
+ },
28
+ async createPurchaseOrder(n) {
29
+ const o = i.currentLocationDBName, a = `${s.inventoryBackendUrl}/${o}/purchase-order`;
30
+ return await t.post(a, n);
31
+ },
32
+ async updatePurchaseOrder(n) {
33
+ const o = i.currentLocationDBName, a = `${s.inventoryBackendUrl}/${o}/purchase-order`;
34
+ return await t.put(a, n);
35
+ }
36
+ };
37
+ }), ee = {
38
+ [l.enum.confirmDraft]: {
39
+ primaryActions: {
40
+ text: "Confirm draft",
41
+ close: !0
42
+ },
43
+ title: "Confirm draft?",
44
+ message: "Purchase order cannot be changed after confirm draft.",
45
+ successMessage: "Purchase order draft has been confirmed"
46
+ },
47
+ [l.enum.cancelDraft]: {
48
+ primaryActions: {
49
+ text: "Cancel draft",
50
+ close: !0,
51
+ variant: "destructive"
52
+ },
53
+ title: "Cancel draft?",
54
+ message: "Purchase order cannot be changed after cancelled draft.",
55
+ successMessage: "Purchase order draft has been cancelled"
56
+ },
57
+ [l.enum.submitRequest]: {
58
+ primaryActions: {
59
+ text: "Submit request",
60
+ close: !0
61
+ },
62
+ title: "Confirm draft?",
63
+ message: "Purchase order cannot be changed after confirm draft.",
64
+ successMessage: "Purchase order draft has been submitted"
65
+ },
66
+ [l.enum.completeReceive]: {
67
+ primaryActions: {
68
+ text: "Mark received",
69
+ close: !0
70
+ },
71
+ title: "Mark as received",
72
+ message: "Purchase order cannot be changed after it has complete receiving.",
73
+ successMessage: "Purchase order has been marked as received"
74
+ },
75
+ [l.enum.approveRequest]: {
76
+ primaryActions: {
77
+ text: "Approve request",
78
+ close: !0
79
+ },
80
+ title: "Approve request?",
81
+ message: "Purchase order will be approved.",
82
+ successMessage: "Purchase order has been approved"
83
+ },
84
+ [l.enum.rejectRequest]: {
85
+ primaryActions: {
86
+ text: "Reject request",
87
+ close: !0,
88
+ variant: "destructive"
89
+ },
90
+ title: "Reject request?",
91
+ message: "Purchase order will be rejected.",
92
+ successMessage: "Purchase order has been rejected"
93
+ }
94
+ };
95
+ function ce(s) {
96
+ const t = O(s);
97
+ return t === null ? "" : j(t);
98
+ }
99
+ function O(s) {
100
+ const t = s.match(/\w+_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z).*/);
101
+ if (!t) return null;
102
+ const i = /* @__PURE__ */ new Date(`${t[1]}`);
103
+ return isNaN(i.getTime()) ? null : i;
104
+ }
105
+ function ue(s, t) {
106
+ const i = Z(), n = N(), o = J(), a = h(!1), d = z(), p = X(), y = h(new Array()), D = h(
107
+ t != null && t.startDate && (t != null && t.endDate) ? t : Q()
108
+ ), E = K(() => {
109
+ const r = new Date(D.value.startDate), e = new Date(D.value.endDate);
110
+ return {
111
+ start: H(r).toISOString(),
112
+ end: q(e).toISOString()
113
+ };
114
+ }), b = h(new Array()), T = Y(), S = h(null), g = h();
115
+ function U(r) {
116
+ const e = {
117
+ mode: C.CREATE,
118
+ modelValue: r ?? {},
119
+ show: !0,
120
+ "onUpdate:show"(c) {
121
+ g.value.show = c;
122
+ },
123
+ lastClosingDate: S.value
124
+ };
125
+ g.value = e;
126
+ }
127
+ function M(r) {
128
+ const e = {
129
+ mode: C.UPDATE,
130
+ modelValue: V(r),
131
+ show: !0,
132
+ "onUpdate:show"(c) {
133
+ g.value.show = c;
134
+ },
135
+ lastClosingDate: S.value
136
+ };
137
+ g.value = e;
138
+ }
139
+ async function B() {
140
+ y.value = [], a.value = !0;
141
+ try {
142
+ y.value = await p.getPurchaseOrders(E.value).then((c) => c.sort((u, m) => m._id.localeCompare(u._id)));
143
+ const r = await T.readLastClosing(!0), e = r == null ? void 0 : r._id;
144
+ e && (S.value = O(e));
145
+ } catch {
146
+ d.open({
147
+ title: "Something went wrong",
148
+ message: "Error at fetching purchase orders",
149
+ type: "error"
150
+ });
151
+ } finally {
152
+ a.value = !1;
153
+ }
154
+ }
155
+ async function _() {
156
+ b.value = [], a.value = !0;
157
+ try {
158
+ b.value = await p.readRequests();
159
+ } catch {
160
+ d.open({
161
+ title: "Something went wrong",
162
+ message: "Error at fetching purchase requests",
163
+ type: "error"
164
+ });
165
+ } finally {
166
+ a.value = !1;
167
+ }
168
+ }
169
+ function w() {
170
+ switch (s) {
171
+ case "receive/request":
172
+ return B();
173
+ case "approval":
174
+ return _();
175
+ }
176
+ }
177
+ function k(r, e) {
178
+ D.value = {
179
+ startDate: r,
180
+ endDate: e
181
+ }, w();
182
+ }
183
+ n.watchLocation(async (r) => {
184
+ if (!r) {
185
+ y.value = [];
186
+ return;
187
+ }
188
+ await w();
189
+ });
190
+ const v = h(), $ = h(Math.random().toString());
191
+ async function L(r, e) {
192
+ var f, P;
193
+ const c = Math.random().toString();
194
+ $.value = c;
195
+ const u = s === "receive/request" ? n.currentLocation : e == null ? void 0 : e.to, m = {
196
+ purchaseOrder: r,
197
+ transferTo: u == null ? void 0 : u.name,
198
+ transferToDbName: u == null ? void 0 : u.dbName,
199
+ show: !0,
200
+ canResubmit: !1,
201
+ canApprove: s === "approval",
202
+ "onUpdate:show"(A) {
203
+ v.value.show = A;
204
+ }
205
+ };
206
+ if (v.value = m, !(e || r.status !== W.enum.REQUESTING)) {
207
+ try {
208
+ e = (await p.readRequests(
209
+ `${r.supplier.internal}_${r.supplier._id}`
210
+ )).find((R) => R.purchaseOrderId === r._id);
211
+ } catch {
212
+ console.error("Error at fetching po request to check");
213
+ }
214
+ c === $.value && (v.value.canResubmit = !e, v.value.transferTo = (f = e == null ? void 0 : e.to) == null ? void 0 : f.name, v.value.transferToDbName = (P = e == null ? void 0 : e.to) == null ? void 0 : P.dbName);
215
+ }
216
+ }
217
+ async function F(r, e, c, u) {
218
+ a.value = !0;
219
+ try {
220
+ await p.processPurchaseOrder(
221
+ {
222
+ operation: e,
223
+ doc: r,
224
+ options: (
225
+ // auto receive for supplier to warehouse
226
+ (e === l.enum.confirmDraft || // auto receive for warehouse to warehouse
227
+ e === l.enum.completeReceive) && o.autoReceiveWarehouse ? {
228
+ autoReceive: !0
229
+ } : void 0
230
+ )
231
+ },
232
+ u
233
+ ), await new Promise((P) => setTimeout(P, 1e3));
234
+ const f = N().currentLocationDBName.startsWith("restaurant_");
235
+ e === l.enum.confirmDraft && r.effectiveAt && f ? d.open({
236
+ title: "Success",
237
+ message: `${c}. The backdate will be reflected once your POS has received this change.`,
238
+ type: "success"
239
+ }) : d.open({
240
+ title: "Success",
241
+ message: c,
242
+ type: "success"
243
+ });
244
+ } catch (m) {
245
+ d.open({
246
+ title: "Something went wrong",
247
+ message: "Please try again.",
248
+ type: "error"
249
+ }), console.error("Error when submitting PO operation", e, r, m);
250
+ } finally {
251
+ a.value = !1, w();
252
+ }
253
+ }
254
+ async function I(r, e, c) {
255
+ const u = ee[e];
256
+ if (!u) {
257
+ d.open({
258
+ title: "Something went wrong",
259
+ message: `Cannot process order: ${G(e)}`,
260
+ type: "error"
261
+ });
262
+ return;
263
+ }
264
+ const { successMessage: m, ...f } = u;
265
+ i.open({
266
+ title: f.title,
267
+ message: f.message,
268
+ primaryActions: f.primaryActions
269
+ }).onPrimary(() => {
270
+ F(r, e, m, c);
271
+ });
272
+ }
273
+ return {
274
+ purchaseOrders: y,
275
+ purchaseRequests: b,
276
+ updateDateRange: k,
277
+ fetchData: w,
278
+ loading: a,
279
+ transferDialogProps: g,
280
+ promptCreateTransferDialog: U,
281
+ promptUpdateTransferDialog: M,
282
+ transferDetailsProps: v,
283
+ promptShowTransferDetails: L,
284
+ submitAction: I
285
+ };
286
+ }
287
+ var re = /* @__PURE__ */ ((s) => (s.PURCHASE = "PURCHASE", s.TRANSFER = "TRANSFER", s))(re || {});
288
+ export {
289
+ re as P,
290
+ X as a,
291
+ ee as d,
292
+ ce as f,
293
+ O as p,
294
+ ue as u
295
+ };
@@ -5,6 +5,7 @@ export declare enum RouteName {
5
5
  STOCK = "STOCK",
6
6
  WAREHOUSE = "WAREHOUSE",
7
7
  RECEIVE_REQUEST = "RECEIVE_REQUEST",
8
+ TRANSFER_TEMPLATE = "TRANSFER_TEMPLATE",
8
9
  RECEIVE_REQUEST_PRINT_PREVIEW = "RECEIVE_REQUEST_PRINT_PREVIEW",
9
10
  APPROVAL = "APPROVAL",
10
11
  SUPPLIER = "SUPPLIER",
@@ -0,0 +1,36 @@
1
+ var t = /* @__PURE__ */ ((e) => (e.READ = "READ", e.UPDATE = "UPDATE", e.CREATE = "CREATE", e))(t || {}), r = /* @__PURE__ */ ((e) => (e.Add = "Add", e.Create = "Create", e.Print = "Print", e.Update = "Update", e.Details = "Details", e.Edit = "Edit", e.Delete = "Delete", e))(r || {});
2
+ const l = {
3
+ Add: {
4
+ label: "Add",
5
+ color: "text-fm-color-typo-primary"
6
+ },
7
+ Create: {
8
+ label: "Create",
9
+ color: "text-fm-color-typo-primary"
10
+ },
11
+ Update: {
12
+ label: "Update",
13
+ color: "text-fm-color-typo-primary"
14
+ },
15
+ Details: {
16
+ label: "Details",
17
+ color: "text-fm-color-typo-primary"
18
+ },
19
+ Print: {
20
+ label: "Print",
21
+ color: "text-fm-color-typo-primary"
22
+ },
23
+ Edit: {
24
+ label: "Edit",
25
+ color: "text-fm-color-typo-primary"
26
+ },
27
+ Delete: {
28
+ label: "Delete",
29
+ color: "text-fm-color-typo-error"
30
+ }
31
+ };
32
+ export {
33
+ l as D,
34
+ t as F,
35
+ r as R
36
+ };