@feedmepos/mf-inventory-portal 0.0.19-dev.1 → 0.0.19-dev.11

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 (117) hide show
  1. package/dist/ApprovalView-BtgtZgDY.js +121 -0
  2. package/dist/{BindingsDialog-DpC48bqK.js → BindingsDialog-DDqu7p2z.js} +9 -10
  3. package/dist/{BindingsPicker-BU52g6zk.js → BindingsPicker-BDhn5Do7.js} +7 -8
  4. package/dist/{BindingsTable-aIuFdScv.js → BindingsTable-C5R7orsB.js} +4 -6
  5. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0sbKAX9.js +272 -0
  6. package/dist/IngredientsView-Ac52Wd12.js +1751 -0
  7. package/dist/IntegrationView-6mJtJK-d.js +1172 -0
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BuyM580N.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C2BFaTg-.js} +1 -1
  9. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-CL0RBLOF.js +88 -0
  10. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js +29 -0
  11. package/dist/{PurchaseOrderPrintPreview-EeKhENYH.js → PurchaseOrderPrintPreview-UzrsJ0AN.js} +12 -12
  12. package/dist/ReceiveRequestView-DW9u9TJZ.js +208 -0
  13. package/dist/RecipeView-W15pCZKU.js +573 -0
  14. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
  15. package/dist/StockView-BqEe-OIX.js +1877 -0
  16. package/dist/SupplierView-CGr2N-e7.js +801 -0
  17. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DupNA58V.js +739 -0
  18. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-COVncBoC.js +1676 -0
  19. package/dist/TransferTemplateView-HgaSR8L8.js +1101 -0
  20. package/dist/UnitView-C07Yrynl.js +638 -0
  21. package/dist/WarehouseView-DL-8j9vX.js +1050 -0
  22. package/dist/api/bill.d.ts +2 -2
  23. package/dist/api/purchase-order-template.d.ts +7 -0
  24. package/dist/app-B1MZZxUg.js +67134 -0
  25. package/dist/app.d.ts +1185 -0
  26. package/dist/app.js +7 -3
  27. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  28. package/dist/components/FmMultiselectDialogProps.d.ts +7 -0
  29. package/dist/components/FmUnitInputProps.d.ts +2 -0
  30. package/dist/components/FmUnitInputRules.d.ts +1 -0
  31. package/dist/components/row-action.enum.d.ts +5 -1
  32. package/dist/composable/defineDeepModel.d.ts +2 -0
  33. package/dist/{decimal-BAZuuTcd.js → decimal-BXf_WdLk.js} +1 -1
  34. package/dist/helper/country.d.ts +2 -0
  35. package/dist/id-to-date-Dlovyec6.js +30 -0
  36. package/dist/layout-BJjS48J5.js +151 -0
  37. package/dist/purchase-order-transaction-type-CMIu0jrP.js +299 -0
  38. package/dist/router/name.d.ts +2 -1
  39. package/dist/row-action.enum-PMKMRrZR.js +50 -0
  40. package/dist/stores/supplier.d.ts +90 -7
  41. package/dist/style.css +1 -1
  42. package/dist/supplier-IDQmZ4VM.js +54 -0
  43. package/dist/tsconfig.app.tsbuildinfo +1 -1
  44. package/dist/views/dev/components/FmMultiselectDialogGrouped.vue.d.ts +2 -0
  45. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +2 -0
  46. package/dist/views/ingredients/components/inventory-binding/InventoryBindingSummary.vue.d.ts +26 -0
  47. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +14 -2
  48. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -2
  49. package/dist/views/ingredients/helper/calculate-default-cost.d.ts +9 -0
  50. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -0
  51. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  52. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +4 -0
  53. package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +22 -0
  54. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -1
  55. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +187 -0
  56. package/dist/views/receive-request/components/transfer-form/components/TransferItem.vue.d.ts +23 -0
  57. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +21 -0
  58. package/dist/views/receive-request/components/transfer-form/composables/use-backdate-po.d.ts +9 -0
  59. package/dist/views/receive-request/components/transfer-form/composables/use-compare-price.d.ts +6 -0
  60. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +112 -0
  61. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +3 -1
  62. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +18 -12
  63. package/dist/views/receive-request/helper/get-transfer-type.d.ts +2 -0
  64. package/dist/views/recipe/composables/use-recipe-form.d.ts +14 -2
  65. package/dist/views/recipe/composables/use-recipe-table.d.ts +1 -2
  66. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  67. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
  68. package/dist/views/stock/composables/use-stock-action.d.ts +26 -0
  69. package/dist/views/stock/composables/use-stock-table.d.ts +1 -8
  70. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  71. package/dist/views/stock/helper/stock-row-action.d.ts +2 -2
  72. package/dist/views/transfer-template/TransferTemplateView.vue.d.ts +2 -0
  73. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +20 -0
  74. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +9 -0
  75. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +22 -0
  76. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialogProps.d.ts +10 -0
  77. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +16 -0
  78. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateFormProps.d.ts +7 -0
  79. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +18 -0
  80. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +116 -0
  81. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +113 -0
  82. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +914 -0
  83. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +290 -0
  84. package/dist/views/unit/composables/use-unit-form.d.ts +14 -2
  85. package/dist/views/unit/composables/use-unit-table.d.ts +1 -2
  86. package/dist/{xlsx-vUzm_udV.js → xlsx-CfdXcS72.js} +1 -1
  87. package/dist/xlsx.util-C5Wx4IUs.js +109 -0
  88. package/package.json +6 -5
  89. package/dist/ApprovalView-BTZwnKLf.js +0 -118
  90. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js +0 -268
  91. package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js +0 -143
  92. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js +0 -236
  93. package/dist/IngredientsView-DMyEGdik.js +0 -1767
  94. package/dist/IntegrationView-Dn_qL_vC.js +0 -1166
  95. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DGTLUrb9.js +0 -276
  96. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js +0 -35
  97. package/dist/ReceiveRequestView-BOdgbFFM.js +0 -1394
  98. package/dist/RecipeView-B1aNLDIK.js +0 -573
  99. package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
  100. package/dist/StockView-C_Ur_jTg.js +0 -1862
  101. package/dist/SupplierView-CXfOoHTr.js +0 -796
  102. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kjV5Eazv.js +0 -1028
  103. package/dist/UnitView-DHXfAsnq.js +0 -635
  104. package/dist/WarehouseView-DMwbxs1q.js +0 -1043
  105. package/dist/app-BkcO8oNJ.js +0 -66113
  106. package/dist/date2-Cvp5iJkI.js +0 -95
  107. package/dist/dayjs.min-D1_pOsO7.js +0 -282
  108. package/dist/fuzzy-0roCBvgC.js +0 -41
  109. package/dist/index-B_aEOJsR.js +0 -21515
  110. package/dist/layout-BnTfCS_X.js +0 -151
  111. package/dist/number-DLj3W3RW.js +0 -97
  112. package/dist/row-action.enum-BwQbURNh.js +0 -28
  113. package/dist/rules-CCmXA0Yi.js +0 -85
  114. package/dist/stock-estimate-CL4HShG8.js +0 -122
  115. package/dist/supplier-CjAH8O1y.js +0 -65
  116. package/dist/use-inventory-binding-dialog-GkJOzE6V.js +0 -93
  117. package/dist/xlsx.util-B_bqymTM.js +0 -107
package/dist/app.js CHANGED
@@ -1,5 +1,9 @@
1
- import { E as p, D as s } from "./app-BkcO8oNJ.js";
1
+ import { am as s, _ as r, an as e, ak as o, al as m, u as t } from "./app-B1MZZxUg.js";
2
2
  export {
3
- p as FmApp,
4
- s 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
5
9
  };
@@ -45,9 +45,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
45
45
  reason: string[];
46
46
  }[]) => any) | undefined;
47
47
  }, {
48
+ accept: string;
48
49
  label: string;
49
50
  disabled: boolean;
50
- accept: string;
51
51
  maxFileSize: number;
52
52
  }, {}>, Readonly<FmDroppableFieldSlots> & FmDroppableFieldSlots>;
53
53
  export default _default;
@@ -1,10 +1,17 @@
1
1
  import type { ISelectItem } from 'node_modules/@feedmepos/ui-library/dist/components/form/select/FmSelect.vue';
2
2
  export interface ISelectItemSublabel extends ISelectItem {
3
+ groupId?: string;
4
+ }
5
+ export interface ISelectItemGroup {
6
+ id: string;
7
+ label: string;
3
8
  sublabel?: string;
9
+ collapse?: boolean;
4
10
  }
5
11
  export interface FmMultiselectDialogProps {
6
12
  modelValue: any;
7
13
  items: ISelectItemSublabel[];
14
+ groups?: ISelectItemGroup[];
8
15
  multiselect?: boolean;
9
16
  placeholder?: string;
10
17
  showValidBorder?: boolean;
@@ -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;
@@ -1,9 +1,13 @@
1
1
  export type RowActionProps = {
2
- label: string;
2
+ /** @deprecated use translation key instead */
3
+ label?: string;
4
+ translationKey: string;
3
5
  color: string;
4
6
  value?: string;
5
7
  };
6
8
  export declare enum RowActionEnum {
9
+ Add = "Add",
10
+ Create = "Create",
7
11
  Print = "Print",
8
12
  Update = "Update",
9
13
  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 "./index-B_aEOJsR.js";
1
+ import "./app-B1MZZxUg.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-CfdXcS72.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,151 @@
1
+ import { useI18n as R } from "@feedmepos/mf-common";
2
+ import { components as I, useBreakpoints as B } from "@feedmepos/ui-library";
3
+ import { h as s, defineComponent as F, computed as M, openBlock as a, createBlock as V, resolveDynamicComponent as x, unref as p, normalizeClass as z, withCtx as D, createElementVNode as c, renderSlot as L, normalizeProps as N, guardReactiveProps as P, createElementBlock as m, Fragment as k, renderList as _, createVNode as b, createCommentVNode as w } from "vue";
4
+ import { af as E } from "./app-B1MZZxUg.js";
5
+ const { FmMenu: S, FmButton: $, FmMenuItem: j } = I;
6
+ function U(o, r) {
7
+ return s(
8
+ S,
9
+ {
10
+ trigger: "click",
11
+ stopClickPropagation: !0
12
+ },
13
+ {
14
+ "menu-button": () => s($, {
15
+ type: "button",
16
+ variant: "tertiary",
17
+ icon: "more_vert",
18
+ iconColor: "#000000",
19
+ size: "md"
20
+ }),
21
+ default: () => s(
22
+ "div",
23
+ {
24
+ style: {
25
+ backgroundColor: "white",
26
+ padding: "4px",
27
+ width: "160px"
28
+ }
29
+ },
30
+ o.map(({ translationKey: l, color: e, value: t }) => {
31
+ const { t: u } = R(), n = u(l);
32
+ return s(
33
+ j,
34
+ {
35
+ onClick() {
36
+ r(t ?? n);
37
+ }
38
+ },
39
+ {
40
+ label: () => s(
41
+ "span",
42
+ {
43
+ class: e
44
+ },
45
+ n
46
+ )
47
+ }
48
+ );
49
+ })
50
+ )
51
+ }
52
+ );
53
+ }
54
+ /**
55
+ * vue-table
56
+ *
57
+ * Copyright (c) TanStack
58
+ *
59
+ * This source code is licensed under the MIT license found in the
60
+ * LICENSE.md file in the root directory of this source tree.
61
+ *
62
+ * @license MIT
63
+ */
64
+ const y = F({
65
+ props: ["render", "props"],
66
+ setup: (o) => () => typeof o.render == "function" || typeof o.render == "object" ? s(o.render, o.props) : o.render
67
+ }), A = { class: "flex gap-4 w-full" }, H = { class: "flex-1" }, T = { class: "flex flex-col" }, q = { key: 0 }, G = { key: 0 }, W = /* @__PURE__ */ F({
68
+ __name: "TableActionableRow",
69
+ props: {
70
+ row: {},
71
+ onRowClick: {},
72
+ actionColumnId: { default: "action" }
73
+ },
74
+ setup(o) {
75
+ const r = o, l = M(
76
+ () => r.row.getVisibleCells().reduce(
77
+ (e, t) => (e[t.column.id] = t, e),
78
+ {}
79
+ )
80
+ );
81
+ return (e, t) => (a(), V(x(e.onRowClick ? p(I).FmListItem : "div"), {
82
+ class: z([
83
+ "w-full border-b border-fm-color-neutral-gray-100",
84
+ {
85
+ "bg-fm-color-neutral-gray-100": e.row.getIsSelected(),
86
+ "cursor-pointer": typeof e.onRowClick == "function"
87
+ }
88
+ ]),
89
+ onClick: t[0] || (t[0] = (u) => {
90
+ var n;
91
+ return (n = e.onRowClick) == null ? void 0 : n.call(e, e.row.original);
92
+ })
93
+ }, {
94
+ default: D(() => {
95
+ var u, n, f, d, C;
96
+ return [
97
+ c("div", A, [
98
+ c("div", H, [
99
+ L(e.$slots, "default", N(P(l.value)), () => [
100
+ c("div", T, [
101
+ (a(!0), m(k, null, _(r.row.getVisibleCells(), (i) => {
102
+ var g, v, h;
103
+ return a(), m(k, {
104
+ key: i.id
105
+ }, [
106
+ i.column.id !== e.actionColumnId ? (a(), m("div", q, [
107
+ b(p(y), {
108
+ render: (v = (g = i.column) == null ? void 0 : g.columnDef) == null ? void 0 : v.cell,
109
+ props: (h = i.getContext) == null ? void 0 : h.call(i)
110
+ }, null, 8, ["render", "props"])
111
+ ])) : w("", !0)
112
+ ], 64);
113
+ }), 128))
114
+ ])
115
+ ])
116
+ ]),
117
+ l.value[e.actionColumnId ?? ""] ? (a(), m("div", G, [
118
+ c("div", null, [
119
+ b(p(y), {
120
+ render: (f = (n = (u = l.value[e.actionColumnId ?? ""]) == null ? void 0 : u.column) == null ? void 0 : n.columnDef) == null ? void 0 : f.cell,
121
+ props: (C = (d = l.value[e.actionColumnId ?? ""]) == null ? void 0 : d.getContext) == null ? void 0 : C.call(d)
122
+ }, null, 8, ["render", "props"])
123
+ ])
124
+ ])) : w("", !0)
125
+ ])
126
+ ];
127
+ }),
128
+ _: 3
129
+ }, 8, ["class"]));
130
+ }
131
+ });
132
+ function X() {
133
+ return {
134
+ get tableHeight() {
135
+ const o = E(), { breakpoints: r } = B();
136
+ return o.isIframeMode ? r.value.xs || r.value.sm ? {
137
+ height: "calc(100dvh - 180px)"
138
+ } : {
139
+ height: "calc(100dvh - 124px)"
140
+ } : {
141
+ height: "calc(100dvh - 180px)"
142
+ };
143
+ }
144
+ };
145
+ }
146
+ export {
147
+ y as F,
148
+ W as _,
149
+ U as c,
150
+ X as u
151
+ };
@@ -0,0 +1,299 @@
1
+ import { n as j, j as $, ad as l, a4 as x, J as H, K as q, ae as Y, c as V, aa as W, w as G, b as J, a as K } from "./app-B1MZZxUg.js";
2
+ import { ref as h, computed as Q } from "vue";
3
+ import { i as Z } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0sbKAX9.js";
4
+ import { F as C } from "./row-action.enum-PMKMRrZR.js";
5
+ import { useDialog as z, useSnackbar as X } from "@feedmepos/ui-library";
6
+ const ee = j((a, t) => {
7
+ const n = $();
8
+ return {
9
+ async readRequests(o) {
10
+ const c = o ?? n.currentLocationDBName, s = `${a.inventoryBackendUrl}/${c}/purchase-request`;
11
+ return await t.get(s);
12
+ },
13
+ async getPurchaseOrders({
14
+ start: o,
15
+ end: c
16
+ }) {
17
+ const s = n.currentLocationDBName, d = `${a.inventoryBackendUrl}/${s}/purchase-order`;
18
+ return await t.get(`${d}?start=${o}&end=${c}`);
19
+ },
20
+ async getPurchaseOrderById(o) {
21
+ const c = n.currentLocationDBName, s = `${a.inventoryBackendUrl}/${c}/purchase-order`;
22
+ return await t.get(`${s}/${o}`);
23
+ },
24
+ async processPurchaseOrder(o, c) {
25
+ const s = n.currentLocationDBName, d = c || s, p = `${a.inventoryBackendUrl}/${d}/purchase-order/run-operation`;
26
+ return await t.put(p, o);
27
+ },
28
+ async createPurchaseOrder(o) {
29
+ const c = n.currentLocationDBName, s = `${a.inventoryBackendUrl}/${c}/purchase-order`;
30
+ return await t.post(s, o);
31
+ },
32
+ async updatePurchaseOrder(o) {
33
+ const c = n.currentLocationDBName, s = `${a.inventoryBackendUrl}/${c}/purchase-order`;
34
+ return await t.put(s, o);
35
+ }
36
+ };
37
+ }), re = {
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 ue(a) {
96
+ const t = O(a);
97
+ return t === null ? "" : x(t);
98
+ }
99
+ function O(a) {
100
+ const t = a.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 n = /* @__PURE__ */ new Date(`${t[1]}`);
103
+ return isNaN(n.getTime()) ? null : n;
104
+ }
105
+ function ie(a, t) {
106
+ const n = z(), o = $(), c = J(), s = h(!1), d = X(), p = ee(), y = h(new Array()), P = h(
107
+ t != null && t.startDate && (t != null && t.endDate) ? t : Z()
108
+ ), E = Q(() => {
109
+ const r = new Date(P.value.startDate), e = new Date(P.value.endDate);
110
+ return {
111
+ start: H(r).toISOString(),
112
+ end: q(e).toISOString()
113
+ };
114
+ }), D = h(new Array()), T = Y(), S = h(null), g = h();
115
+ function U(r) {
116
+ const e = {
117
+ mode: C.CREATE,
118
+ modelValue: r || void 0,
119
+ show: !0,
120
+ "onUpdate:show"(u) {
121
+ g.value.show = u;
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"(u) {
133
+ g.value.show = u;
134
+ },
135
+ lastClosingDate: S.value
136
+ };
137
+ g.value = e;
138
+ }
139
+ async function B() {
140
+ y.value = [], s.value = !0;
141
+ try {
142
+ y.value = await p.getPurchaseOrders(E.value).then((u) => u.sort((i, m) => m._id.localeCompare(i._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
+ s.value = !1;
153
+ }
154
+ }
155
+ async function _() {
156
+ D.value = [], s.value = !0;
157
+ try {
158
+ D.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
+ s.value = !1;
167
+ }
168
+ }
169
+ function w() {
170
+ switch (a) {
171
+ case "receive/request":
172
+ return B();
173
+ case "approval":
174
+ return _();
175
+ }
176
+ }
177
+ function k(r, e) {
178
+ P.value = {
179
+ startDate: r,
180
+ endDate: e
181
+ }, w();
182
+ }
183
+ o.watchLocation(async (r) => {
184
+ if (!r) {
185
+ y.value = [];
186
+ return;
187
+ }
188
+ await w();
189
+ });
190
+ const v = h(), N = h(Math.random().toString());
191
+ async function F(r, e) {
192
+ var f, b;
193
+ const u = Math.random().toString();
194
+ N.value = u;
195
+ const i = a === "receive/request" ? o.currentLocation : e == null ? void 0 : e.to, m = {
196
+ purchaseOrder: r,
197
+ transferTo: i == null ? void 0 : i.name,
198
+ transferToDbName: i == null ? void 0 : i.dbName,
199
+ show: !0,
200
+ canResubmit: !1,
201
+ canApprove: a === "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
+ u === N.value && (v.value.canResubmit = !e, v.value.transferTo = (f = e == null ? void 0 : e.to) == null ? void 0 : f.name, v.value.transferToDbName = (b = e == null ? void 0 : e.to) == null ? void 0 : b.dbName);
215
+ }
216
+ }
217
+ async function L(r, e, u, i) {
218
+ s.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) && c.autoReceiveWarehouse ? {
228
+ autoReceive: !0
229
+ } : void 0
230
+ )
231
+ },
232
+ i
233
+ ), await new Promise((b) => setTimeout(b, 1e3));
234
+ const f = $().currentLocationDBName.startsWith("restaurant_");
235
+ e === l.enum.confirmDraft && r.effectiveAt && f ? d.open({
236
+ title: "Success",
237
+ message: `${u}. The backdate will be reflected once your POS has received this change.`,
238
+ type: "success"
239
+ }) : d.open({
240
+ title: "Success",
241
+ message: u,
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
+ s.value = !1, w();
252
+ }
253
+ }
254
+ async function I(r, e, u) {
255
+ const i = re[e];
256
+ if (!i) {
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 } = i;
265
+ n.open({
266
+ title: f.title,
267
+ message: f.message,
268
+ primaryActions: f.primaryActions
269
+ }).onPrimary(() => {
270
+ L(r, e, m, u);
271
+ });
272
+ }
273
+ return {
274
+ purchaseOrders: y,
275
+ purchaseRequests: D,
276
+ updateDateRange: k,
277
+ fetchData: w,
278
+ loading: s,
279
+ transferDialogProps: g,
280
+ promptCreateTransferDialog: U,
281
+ promptUpdateTransferDialog: M,
282
+ transferDetailsProps: v,
283
+ promptShowTransferDetails: F,
284
+ submitAction: I
285
+ };
286
+ }
287
+ function de(a, t, n) {
288
+ const o = (n == null ? void 0 : n.abbrev) ?? t.abbrev;
289
+ return `${K(a, !1)} ${o}`;
290
+ }
291
+ var te = /* @__PURE__ */ ((a) => (a.PURCHASE = "PURCHASE", a.TRANSFER = "TRANSFER", a))(te || {});
292
+ export {
293
+ te as P,
294
+ de as a,
295
+ ee as b,
296
+ re as d,
297
+ ue as f,
298
+ ie as u
299
+ };
@@ -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",
@@ -14,4 +15,4 @@ export declare enum RouteName {
14
15
  IFRAME_INVENTORY_BINDINGS_DIALOG = "IFRAME_INVENTORY_BINDINGS_DIALOG",
15
16
  IFRAME_INVENTORY_BINDINGS_PICKER = "IFRAME_INVENTORY_BINDINGS_PICKER"
16
17
  }
17
- export declare function getReadableRouteName(route: RouteName): "Ingredient" | "Recipe" | "Unit" | "Stock" | "Warehouse" | "Receive/Request" | "Print preview" | "Approval" | "Supplier" | "Integration" | "Dev" | "Inventory bindings table" | "Inventory bindings dialog" | "Inventory bindings picker";
18
+ export declare function getReadableRouteName(route: RouteName, t: Translator): string;
@@ -0,0 +1,50 @@
1
+ var e = /* @__PURE__ */ ((t) => (t.READ = "READ", t.UPDATE = "UPDATE", t.CREATE = "CREATE", t))(e || {}), r = /* @__PURE__ */ ((t) => (t.Add = "Add", t.Create = "Create", t.Print = "Print", t.Update = "Update", t.Details = "Details", t.Edit = "Edit", t.Delete = "Delete", t))(r || {});
2
+ const a = {
3
+ Add: {
4
+ translationKey: "common.add",
5
+ color: "text-fm-color-typo-primary",
6
+ value: "Add"
7
+ /* Add */
8
+ },
9
+ Create: {
10
+ translationKey: "common.create",
11
+ color: "text-fm-color-typo-primary",
12
+ value: "Create"
13
+ /* Create */
14
+ },
15
+ Update: {
16
+ translationKey: "common.update",
17
+ color: "text-fm-color-typo-primary",
18
+ value: "Update"
19
+ /* Update */
20
+ },
21
+ Details: {
22
+ translationKey: "inventory.common.details",
23
+ color: "text-fm-color-typo-primary",
24
+ value: "Details"
25
+ /* Details */
26
+ },
27
+ Print: {
28
+ translationKey: "inventory.common.print",
29
+ color: "text-fm-color-typo-primary",
30
+ value: "Print"
31
+ /* Print */
32
+ },
33
+ Edit: {
34
+ translationKey: "common.edit",
35
+ color: "text-fm-color-typo-primary",
36
+ value: "Edit"
37
+ /* Edit */
38
+ },
39
+ Delete: {
40
+ translationKey: "common.delete",
41
+ color: "text-fm-color-typo-error",
42
+ value: "Delete"
43
+ /* Delete */
44
+ }
45
+ };
46
+ export {
47
+ a as D,
48
+ e as F,
49
+ r as R
50
+ };