@feedmepos/mf-inventory-portal 0.0.22-dev.4 → 0.0.22-dev.40
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.
- package/dist/{ApprovalView-xF73Z1jN.js → ApprovalView-JOsQBu1z.js} +25 -26
- package/dist/{BindingsDialog-CCSAxGT4.js → BindingsDialog-DG2ZolH1.js} +9 -9
- package/dist/{BindingsPicker-ErFH0uEQ.js → BindingsPicker-B7h_iST8.js} +22 -22
- package/dist/{BindingsTable-D8ffJgIJ.js → BindingsTable-BToh6gcG.js} +1 -1
- package/dist/ClosingTemplateView-BwMJAxuz.js +1688 -0
- package/dist/FmDroppableField-CJNAT3h2.js +152 -0
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-4NHQdjz7.js +266 -0
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Cc_P0kss.js +364 -0
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-DMOalXUS.js +51 -0
- package/dist/IngredientsView-ChnCqdWi.js +1611 -0
- package/dist/{IntegrationView-54yz2EqS.js → IntegrationView-NWkc9PLW.js} +71 -71
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CKvKlCk-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BQW6HYyD.js} +1 -1
- package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BQqcpZIJ.js +116 -0
- package/dist/{PurchaseOrderPrintPreview-pcpWSfl4.js → PurchaseOrderPrintPreview-BvED8ZbQ.js} +7 -7
- package/dist/ReceiveRequestView-DdxBaqmU.js +4069 -0
- package/dist/RecipeView-YdSRy_yP.js +591 -0
- package/dist/Standalone.vue.d.ts +2 -0
- package/dist/StockView-WF5z4dTF.js +7762 -0
- package/dist/{SupplierView-TYCkPXan.js → SupplierView-H2Vi5lSs.js} +111 -111
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-D48gSqHW.js +1137 -0
- package/dist/TransferTemplateView-DeT32cat.js +2054 -0
- package/dist/{UnitView-B9yE4-rc.js → UnitView-qD9JSdHT.js} +18 -18
- package/dist/{WarehouseView-DUtVLTjb.js → WarehouseView-C19Dd53y.js} +176 -177
- package/dist/api/bill.d.ts +84 -238
- package/dist/api/closing-template.d.ts +6 -4
- package/dist/api/inventory.d.ts +72 -85
- package/dist/api/netsuite.d.ts +47 -0
- package/dist/api/purchase-order-template.d.ts +4 -6
- package/dist/{app-w8TOQVZc.js → app-DKE_n9Mo.js} +24520 -23671
- package/dist/app.d.ts +7 -0
- package/dist/app.js +3 -3
- package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
- package/dist/components/FmMinMaxInputRules.d.ts +2 -0
- package/dist/components/FmUnitInputRules.d.ts +2 -0
- package/dist/components/map/GoogleMap.vue.d.ts +4 -4
- package/dist/{decimal-C4q7UMfr.js → decimal-veoPLYim.js} +1 -1
- package/dist/defineDeepModel-u6t3hXU9.js +13 -0
- package/dist/format-time-from-id-8gjg5B98.js +15 -0
- package/dist/helper/rules.d.ts +7 -0
- package/dist/helper/rules.spec.d.ts +1 -0
- package/dist/helper/xlsx.util.d.ts +7 -0
- package/dist/purchase-order-transaction-type-CIDEpjJB.js +348 -0
- package/dist/stores/api.d.ts +1 -0
- package/dist/stores/feature.d.ts +0 -1
- package/dist/stores/helper/core-store-proxy.d.ts +3 -0
- package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
- package/dist/stores/inventory.d.ts +85 -0
- package/dist/stores/location.d.ts +508 -503
- package/dist/stores/netsuite.d.ts +69 -0
- package/dist/stores/route.d.ts +0 -5
- package/dist/stores/supplier.d.ts +120 -3
- package/dist/style.css +1 -1
- package/dist/supplier-DLcmVScz.js +70 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/use-template-enabled-locations-2-CdJVJikY.js +85 -0
- package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
- package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +1093 -1026
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +1098 -1037
- package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
- package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +45 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1944 -82
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2351 -284
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2300 -233
- package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
- package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
- package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
- package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
- package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1263 -1466
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1688 -897
- package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
- package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -0
- package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
- package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
- package/dist/{xlsx-BggStaH1.js → xlsx-CrKrCGZz.js} +1525 -1525
- package/dist/xlsx.util-Bcpkvw1Z.js +78 -0
- package/package.json +5 -5
- package/dist/ClosingTemplateView-DdZlX1ug.js +0 -1030
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ZYtBNoaE.js +0 -372
- package/dist/IngredientsView-DnwwQJTN.js +0 -1758
- package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-Bom_KvXW.js +0 -88
- package/dist/ReceiveRequestView-D5HXMY4Z.js +0 -215
- package/dist/RecipeView-BHkTgm5H.js +0 -581
- package/dist/StockView-iczCFYxn.js +0 -1892
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-EN3JgHKF.js +0 -740
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DC0Ss5hi.js +0 -1409
- package/dist/TransferTemplateView-Bbvpuys7.js +0 -1230
- package/dist/defineDeepModel-BOApqV24.js +0 -13
- package/dist/format-time-from-id-Cafjo8fn.js +0 -15
- package/dist/id-to-date-CtSHSVJF.js +0 -30
- package/dist/layout/layout-routes.d.ts +0 -6
- package/dist/purchase-order-transaction-type-CIC5h-6x.js +0 -712
- package/dist/supplier-CM-vZ4bQ.js +0 -69
- package/dist/use-template-enabled-locations-Bm00vEzC.js +0 -57
- package/dist/xlsx.util-CqlYZLKW.js +0 -109
- /package/dist/{layout/InventoryLayout.vue.d.ts → views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts} +0 -0
package/dist/app.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const i18nMessages: {
|
|
|
4
4
|
'en-US': {
|
|
5
5
|
inventory: {
|
|
6
6
|
common: {
|
|
7
|
+
success: string;
|
|
7
8
|
proPlan: {
|
|
8
9
|
title: string;
|
|
9
10
|
subtitle: string;
|
|
@@ -405,6 +406,9 @@ export declare const i18nMessages: {
|
|
|
405
406
|
subtitle: string;
|
|
406
407
|
error: string;
|
|
407
408
|
};
|
|
409
|
+
netsuite: {
|
|
410
|
+
subsidiary: string;
|
|
411
|
+
};
|
|
408
412
|
items: {
|
|
409
413
|
title: string;
|
|
410
414
|
addItem: string;
|
|
@@ -1108,6 +1112,9 @@ export declare const i18nMessages: {
|
|
|
1108
1112
|
subtitle: string;
|
|
1109
1113
|
error: string;
|
|
1110
1114
|
};
|
|
1115
|
+
netsuite: {
|
|
1116
|
+
subsidiary: string;
|
|
1117
|
+
};
|
|
1111
1118
|
items: {
|
|
1112
1119
|
title: string;
|
|
1113
1120
|
addItem: string;
|
package/dist/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ay as s, _ as r, az as e, aw as o, ax as t, u as i } from "./app-DKE_n9Mo.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
s as FmApp,
|
|
4
|
+
r as InventoryBindingForm,
|
|
5
5
|
e as InventoryBindingSummary,
|
|
6
6
|
o as i18nMessages,
|
|
7
7
|
t as routers,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ISelectItem } from '@feedmepos/ui-library';
|
|
2
|
+
import FuzzySearch from 'fuzzy-search';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
search: import("vue").PropType<string>;
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: import("vue").PropType<any>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
maxHeight: {
|
|
10
|
+
type: import("vue").PropType<number>;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
width: {
|
|
14
|
+
type: import("vue").PropType<string>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
handleItemChange: {
|
|
18
|
+
type: import("vue").PropType<(isSelected: boolean, item: ISelectItem) => void>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
items: {
|
|
22
|
+
type: import("vue").PropType<ISelectItem[]>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
options: {
|
|
26
|
+
type: import("vue").PropType<FuzzySearch.Options>;
|
|
27
|
+
};
|
|
28
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
|
+
search: import("vue").PropType<string>;
|
|
30
|
+
modelValue: {
|
|
31
|
+
type: import("vue").PropType<any>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
maxHeight: {
|
|
35
|
+
type: import("vue").PropType<number>;
|
|
36
|
+
required: true;
|
|
37
|
+
};
|
|
38
|
+
width: {
|
|
39
|
+
type: import("vue").PropType<string>;
|
|
40
|
+
required: true;
|
|
41
|
+
};
|
|
42
|
+
handleItemChange: {
|
|
43
|
+
type: import("vue").PropType<(isSelected: boolean, item: ISelectItem) => void>;
|
|
44
|
+
required: true;
|
|
45
|
+
};
|
|
46
|
+
items: {
|
|
47
|
+
type: import("vue").PropType<ISelectItem[]>;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
options: {
|
|
51
|
+
type: import("vue").PropType<FuzzySearch.Options>;
|
|
52
|
+
};
|
|
53
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
|
+
export default _default;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { FmMinMaxInputModel } from './FmMinMaxInputProps';
|
|
2
|
+
import type { FdoDecimal } from '@feedmepos/core/entity';
|
|
2
3
|
export declare function FmMinMaxRequired(): (model?: FmMinMaxInputModel) => true | "Required";
|
|
3
4
|
/** Both `min` and `max` are inclusive */
|
|
4
5
|
export declare function FmMinMaxBoundary(min: number, max: number): (model?: FmMinMaxInputModel) => string | true;
|
|
6
|
+
export declare function FmMinMaxMultipleOf(decimal: FdoDecimal): (model?: FmMinMaxInputModel) => string | true;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { FmGroupModelValue } from './FmUnitInputProps';
|
|
2
2
|
import type { ValidationResult } from '@feedmepos/ui-library';
|
|
3
|
+
import type { FdoDecimal } from '@feedmepos/core/entity';
|
|
3
4
|
export declare function FmUnitInputAmountIsNumberRule(): (value: FmGroupModelValue) => true | "Must be a number";
|
|
4
5
|
export declare function FmUnitInputAmountAtLeastRule(minimum: number): (value: FmGroupModelValue) => string | true;
|
|
5
6
|
export declare function FmUnitInputAmountMoreThanRule(minimum: number): (value: FmGroupModelValue) => string | true;
|
|
6
7
|
export declare function FmUnitInputAmountAtMostRule(maximum: number): (value: FmGroupModelValue) => string | true;
|
|
7
8
|
export declare function FmUnitInputMaxPrecisionRule(unit: FdoInventoryUnit, applyAmountRule?: boolean): (value: any) => ValidationResult;
|
|
8
9
|
export declare function FmUnitInputMaxPrecisionRule(precision: number, applyAmountRule?: boolean): (value: any) => ValidationResult;
|
|
10
|
+
export declare function FmUnitInputAmountMultipleOf(decimal: FdoDecimal): (value: FmGroupModelValue) => ValidationResult;
|
|
@@ -67,13 +67,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
67
|
"onPolygon-change"?: ((ev: PolygonChangeEvent) => any) | undefined;
|
|
68
68
|
"onPolygon-right-click"?: ((ev: number) => any) | undefined;
|
|
69
69
|
}>, {
|
|
70
|
-
markers: MapCoordinate[];
|
|
71
|
-
polygons: MapPolygon[];
|
|
72
|
-
zoom: number;
|
|
73
|
-
editable: boolean;
|
|
74
70
|
center: {
|
|
75
71
|
lat: number;
|
|
76
72
|
lng: number;
|
|
77
73
|
};
|
|
74
|
+
markers: MapCoordinate[];
|
|
75
|
+
polygons: MapPolygon[];
|
|
76
|
+
zoom: number;
|
|
77
|
+
editable: boolean;
|
|
78
78
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
79
|
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { c as i, ao as d } from "./app-DKE_n9Mo.js";
|
|
2
|
+
import { getCurrentInstance as n, reactive as m, watch as l } from "vue";
|
|
3
|
+
function b(e = "modelValue") {
|
|
4
|
+
var t, r;
|
|
5
|
+
const s = ((t = n()) == null ? void 0 : t.props) ?? {}, a = ((r = n()) == null ? void 0 : r.emit) ?? (() => {
|
|
6
|
+
}), o = m(i(s[e] ?? {})), c = `update:${d(e)}`;
|
|
7
|
+
return l(o, (p) => {
|
|
8
|
+
a(c, p);
|
|
9
|
+
}), o;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
b as d
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ar as n } from "./app-DKE_n9Mo.js";
|
|
2
|
+
function d(t) {
|
|
3
|
+
const r = a(t);
|
|
4
|
+
return r === null ? "" : n(r);
|
|
5
|
+
}
|
|
6
|
+
function a(t) {
|
|
7
|
+
const r = t.match(/\w+_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z).*/);
|
|
8
|
+
if (!r) return null;
|
|
9
|
+
const e = /* @__PURE__ */ new Date(`${r[1]}`);
|
|
10
|
+
return isNaN(e.getTime()) ? null : e;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
d as f,
|
|
14
|
+
a as p
|
|
15
|
+
};
|
package/dist/helper/rules.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ValidationResult } from 'node_modules/@feedmepos/ui-library/dist/composables/useValidation';
|
|
2
2
|
import { type AdjustmentAmount } from './number';
|
|
3
3
|
import type { ISelectItem } from '@feedmepos/ui-library';
|
|
4
|
+
import type { FdoDecimal } from '@feedmepos/core/entity';
|
|
4
5
|
export declare function Required(): (val: string) => true | "Required";
|
|
5
6
|
export declare function isAdjustmentAmount(val: any): val is AdjustmentAmount;
|
|
6
7
|
export declare function AtLeast(amount: number | AdjustmentAmount, message?: string | ((current: number) => string)): (val: any) => string | true;
|
|
@@ -20,3 +21,9 @@ export declare function MaximumPrecision(unit: FdoInventoryUnit, measurement?: F
|
|
|
20
21
|
};
|
|
21
22
|
export declare function MaximumPrecisionLiteral(precision: number, message?: string | ((precision: number) => string)): (val: string) => string | true;
|
|
22
23
|
export declare function Unique(pool: ISelectItem[], current?: string, message?: (item: ISelectItem) => string): (value: any) => string | true;
|
|
24
|
+
export declare function MultipleOf(n: number): {
|
|
25
|
+
(val: any): ValidationResult;
|
|
26
|
+
};
|
|
27
|
+
export declare function MultipleOf(n: FdoDecimal): {
|
|
28
|
+
(val: any): ValidationResult;
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,13 @@ export declare function rowGenerator(range: string): Generator<number, void, unk
|
|
|
4
4
|
export declare function columnGenerator(range: string): Generator<string, void, unknown>;
|
|
5
5
|
export declare function sheetToRowArray(sheet: WorkSheet): string[][];
|
|
6
6
|
export declare function cellArrayToMapByHeaderRow<T = Record<string, string>>(items: string[][], usingHeader: string[]): T[];
|
|
7
|
+
/** @returns workbook instead, use toWorkSheet instead */
|
|
7
8
|
export declare function toSheet(data: any[][], header: string[], sheetName?: string): XLSX.WorkBook;
|
|
9
|
+
/** @returns workbook instead, use toWorkSheet instead */
|
|
10
|
+
export declare function toWorkSheet(data: any[][], header: string[]): XLSX.WorkSheet;
|
|
11
|
+
/** @returns workbook instead, use toWorkSheet instead */
|
|
12
|
+
export declare function toWorkBook<T extends {
|
|
13
|
+
[key: string]: XLSX.WorkSheet;
|
|
14
|
+
}>(workSheets: T, sheetNames?: (keyof T)[]): XLSX.WorkBook;
|
|
8
15
|
export declare function downloadExcel(workbook: WorkBook, filename: string): void;
|
|
9
16
|
export declare function readExcel(file: File): Promise<XLSX.WorkBook>;
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { F as C, D as A, R as h } from "./row-action.enum-PMKMRrZR.js";
|
|
2
|
+
import { c as O } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
3
|
+
import { n as x, u as D, i as B, c as $, as as P, y as M, a as L } from "./app-DKE_n9Mo.js";
|
|
4
|
+
import { f as K } from "./format-time-from-id-8gjg5B98.js";
|
|
5
|
+
import { useCoreStore as z, useI18n as V } from "@feedmepos/mf-common";
|
|
6
|
+
import { useDialog as j, useSnackbar as H, FmButtonVariant as U, components as R } from "@feedmepos/ui-library";
|
|
7
|
+
import { defineStore as N } from "pinia";
|
|
8
|
+
import { ref as g, h as S } from "vue";
|
|
9
|
+
import { useRouter as q } from "vue-router";
|
|
10
|
+
const F = x((r, o) => {
|
|
11
|
+
function a() {
|
|
12
|
+
var n;
|
|
13
|
+
return `business_${((n = z().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
async getTemplate(t) {
|
|
17
|
+
const s = a(), n = `${r.inventoryBackendUrl}/${s}/purchase-order-template/${t}`;
|
|
18
|
+
return o.get(n);
|
|
19
|
+
},
|
|
20
|
+
async readTemplates() {
|
|
21
|
+
const t = a(), s = `${r.inventoryBackendUrl}/${t}/purchase-order-template`;
|
|
22
|
+
return o.get(s);
|
|
23
|
+
},
|
|
24
|
+
async createTemplate(t) {
|
|
25
|
+
const s = a(), n = `${r.inventoryBackendUrl}/${s}/purchase-order-template`;
|
|
26
|
+
return o.post(n, t);
|
|
27
|
+
},
|
|
28
|
+
async updateTemplate(t) {
|
|
29
|
+
const s = a(), n = `${r.inventoryBackendUrl}/${s}/purchase-order-template`;
|
|
30
|
+
return o.put(n, t);
|
|
31
|
+
},
|
|
32
|
+
async deleteTemplate(t) {
|
|
33
|
+
const s = a(), n = `${r.inventoryBackendUrl}/${s}/purchase-order-template`;
|
|
34
|
+
return o.delete(n, { _id: t._id, _rev: t._rev });
|
|
35
|
+
},
|
|
36
|
+
async importTemplates(t) {
|
|
37
|
+
const s = a(), n = `${r.inventoryBackendUrl}/${s}/purchase-order-template/import`;
|
|
38
|
+
return o.post(n, t);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
function I(r) {
|
|
43
|
+
const o = D(), a = r.sku, t = o.skuById[a._id];
|
|
44
|
+
if (t.unit._id !== a.unit._id) return !0;
|
|
45
|
+
const s = r.measurement;
|
|
46
|
+
return s ? !o.unitById[t.unit._id].measurements.find((p) => p.id === s.id) : !1;
|
|
47
|
+
}
|
|
48
|
+
const G = N("transferTemplateActions", () => {
|
|
49
|
+
const r = j(), o = H(), a = B(), t = J(), s = F(), n = q(), u = g({});
|
|
50
|
+
function p() {
|
|
51
|
+
u.value = {
|
|
52
|
+
mode: C.CREATE,
|
|
53
|
+
show: !0,
|
|
54
|
+
"onUpdate:show"(e) {
|
|
55
|
+
u.value.show = e;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function y(e) {
|
|
60
|
+
u.value = {
|
|
61
|
+
mode: C.UPDATE,
|
|
62
|
+
modelValue: e,
|
|
63
|
+
show: !0,
|
|
64
|
+
"onUpdate:show"(l) {
|
|
65
|
+
u.value.show = l;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function T(e, l, m) {
|
|
70
|
+
r.open({
|
|
71
|
+
title: `Confirm deleting template ${e.name}?`,
|
|
72
|
+
message: "Deleted template can no longer be retrieved",
|
|
73
|
+
primaryActions: {
|
|
74
|
+
text: "Delete",
|
|
75
|
+
variant: U.Destructive,
|
|
76
|
+
close: !0
|
|
77
|
+
},
|
|
78
|
+
secondaryActions: {
|
|
79
|
+
text: "Cancel",
|
|
80
|
+
variant: U.Plain,
|
|
81
|
+
close: !0
|
|
82
|
+
}
|
|
83
|
+
}).onPrimary(async () => {
|
|
84
|
+
o.open({
|
|
85
|
+
title: `Deleting ${e.name}`,
|
|
86
|
+
type: "info"
|
|
87
|
+
});
|
|
88
|
+
try {
|
|
89
|
+
l.value = !0;
|
|
90
|
+
const [d] = await Promise.allSettled([
|
|
91
|
+
s.deleteTemplate(e),
|
|
92
|
+
new Promise((w) => setTimeout(w, 1e3))
|
|
93
|
+
]);
|
|
94
|
+
if (d.status === "rejected") throw d.reason;
|
|
95
|
+
o.open({
|
|
96
|
+
title: `Deleted ${e.name}`,
|
|
97
|
+
type: "success"
|
|
98
|
+
});
|
|
99
|
+
} catch (d) {
|
|
100
|
+
o.open({
|
|
101
|
+
title: `Unable to delete ${e.name}`,
|
|
102
|
+
message: `See error from server: ${d}`,
|
|
103
|
+
type: "error"
|
|
104
|
+
}), console.error("error on deleting purchase order template", d);
|
|
105
|
+
} finally {
|
|
106
|
+
l.value = !1, m();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
const f = g({});
|
|
111
|
+
function b(e) {
|
|
112
|
+
f.value = {
|
|
113
|
+
template: e,
|
|
114
|
+
show: !0,
|
|
115
|
+
"onUpdate:show"(l) {
|
|
116
|
+
f.value.show = l;
|
|
117
|
+
},
|
|
118
|
+
"onAction:edit"() {
|
|
119
|
+
f.value.show = !1, y($(e));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function _() {
|
|
124
|
+
const { promise: e, resolve: l } = Promise.withResolvers(), m = (c) => {
|
|
125
|
+
l(c);
|
|
126
|
+
}, d = t.templates.filter(
|
|
127
|
+
(c) => {
|
|
128
|
+
var v;
|
|
129
|
+
return (!c.locations || c.locations.find((E) => E.doc._id === a.currentLocation.doc._id)) && ((v = c.purchaseOrder.supplier) == null ? void 0 : v._id) !== a.currentLocation.doc._id;
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
if (!d.length)
|
|
133
|
+
return r.open({
|
|
134
|
+
title: "Select one template",
|
|
135
|
+
message: "There is no available template in your business. Configure a new template?",
|
|
136
|
+
primaryActions: {
|
|
137
|
+
text: "Close",
|
|
138
|
+
close: !0
|
|
139
|
+
},
|
|
140
|
+
secondaryActions: {
|
|
141
|
+
text: "Close",
|
|
142
|
+
close: !0
|
|
143
|
+
}
|
|
144
|
+
}).onPrimary(() => {
|
|
145
|
+
n.push({ name: P.TRANSFER_TEMPLATE }), m(void 0);
|
|
146
|
+
}).onSecondary(() => m(void 0)).onClose(() => m(void 0)), e;
|
|
147
|
+
const w = d.map((c) => {
|
|
148
|
+
const v = !c.purchaseOrder.items.length || c.purchaseOrder.items.some(I);
|
|
149
|
+
return {
|
|
150
|
+
label: c.name,
|
|
151
|
+
value: c._id,
|
|
152
|
+
disabled: v,
|
|
153
|
+
sublabel: v ? "This template is invalid. Update this template." : void 0
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
return r.open({
|
|
157
|
+
title: "Select one template",
|
|
158
|
+
contentComponent: M,
|
|
159
|
+
contentComponentProps: {
|
|
160
|
+
items: w,
|
|
161
|
+
singleSelect: !0
|
|
162
|
+
},
|
|
163
|
+
primaryActions: {
|
|
164
|
+
text: "Confirm",
|
|
165
|
+
close: !0
|
|
166
|
+
},
|
|
167
|
+
secondaryActions: {
|
|
168
|
+
text: "Close",
|
|
169
|
+
close: !0
|
|
170
|
+
},
|
|
171
|
+
tertiaryActions: {
|
|
172
|
+
text: "Templates",
|
|
173
|
+
close: !0
|
|
174
|
+
}
|
|
175
|
+
}).onPrimary((c) => Array.isArray(c) ? m(c[0]) : null).onSecondary(() => m(void 0)).onTertiary(() => {
|
|
176
|
+
n.push({ name: P.TRANSFER_TEMPLATE }), m(void 0);
|
|
177
|
+
}).onClose(() => m(void 0)), e;
|
|
178
|
+
}
|
|
179
|
+
async function i(e) {
|
|
180
|
+
await s.importTemplates(e);
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
createTemplate: p,
|
|
184
|
+
viewTemplate: b,
|
|
185
|
+
updateTemplate: y,
|
|
186
|
+
deleteTemplate: T,
|
|
187
|
+
getTemplateId: _,
|
|
188
|
+
importTemplates: i,
|
|
189
|
+
templateDialogProps: u,
|
|
190
|
+
templateDetailsProps: f
|
|
191
|
+
};
|
|
192
|
+
});
|
|
193
|
+
function k(r) {
|
|
194
|
+
const { skuById: o } = D(), a = $(r);
|
|
195
|
+
return a.purchaseOrder.items = r.purchaseOrder.items.filter((t) => o[t.sku._id]), a;
|
|
196
|
+
}
|
|
197
|
+
const J = N(
|
|
198
|
+
"transferTemplateTable",
|
|
199
|
+
function() {
|
|
200
|
+
const { t: o } = V(), { viewTemplate: a, updateTemplate: t, deleteTemplate: s } = G(), n = g(!1), u = g(new Array()), p = F(), y = D();
|
|
201
|
+
async function T() {
|
|
202
|
+
u.value = [], n.value = !0;
|
|
203
|
+
try {
|
|
204
|
+
const [i] = await Promise.all([
|
|
205
|
+
p.readTemplates(),
|
|
206
|
+
y.readInventory()
|
|
207
|
+
]).delayed(1e3);
|
|
208
|
+
u.value = i.map(k);
|
|
209
|
+
} catch (i) {
|
|
210
|
+
console.log("Something went wrong when fetching templates:", i);
|
|
211
|
+
} finally {
|
|
212
|
+
n.value = !1;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async function f(i) {
|
|
216
|
+
if (!u.value.find((e) => e._id)) {
|
|
217
|
+
n.value = !0;
|
|
218
|
+
try {
|
|
219
|
+
u.value = [
|
|
220
|
+
await p.getTemplate(i).then(k).delayed(1e3)
|
|
221
|
+
];
|
|
222
|
+
} catch (e) {
|
|
223
|
+
console.log("Something went wrong when fetching templates:", e);
|
|
224
|
+
} finally {
|
|
225
|
+
n.value = !1;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function b(i, e) {
|
|
230
|
+
switch (e = $(e), i) {
|
|
231
|
+
case h.Details:
|
|
232
|
+
return a(e);
|
|
233
|
+
case h.Edit:
|
|
234
|
+
return t(e);
|
|
235
|
+
case h.Delete:
|
|
236
|
+
return s(e, n, T);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
columnDefs: [
|
|
241
|
+
{
|
|
242
|
+
id: "_id",
|
|
243
|
+
accessorKey: "_id",
|
|
244
|
+
header: () => o("inventory.transfer.table.createdAt"),
|
|
245
|
+
cell(i) {
|
|
246
|
+
return K(`${i.getValue()}`);
|
|
247
|
+
},
|
|
248
|
+
enableSorting: !0
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
id: "name",
|
|
252
|
+
accessorKey: "name",
|
|
253
|
+
header: () => o("inventory.transfer.table.name"),
|
|
254
|
+
enableSorting: !0,
|
|
255
|
+
size: 200
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: "noOfItems",
|
|
259
|
+
accessorKey: "purchaseOrder.items.length",
|
|
260
|
+
header: () => o("inventory.transfer.table.noOfItems"),
|
|
261
|
+
enableSorting: !1,
|
|
262
|
+
meta: {
|
|
263
|
+
width: "10rem",
|
|
264
|
+
textAlign: "right"
|
|
265
|
+
},
|
|
266
|
+
cell(i) {
|
|
267
|
+
const e = Number(i.getValue()) || 0, l = i.row.original.purchaseOrder.items.some(I);
|
|
268
|
+
return e === 0 || l ? S("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
269
|
+
S(
|
|
270
|
+
R.FmTooltip,
|
|
271
|
+
{},
|
|
272
|
+
{
|
|
273
|
+
content() {
|
|
274
|
+
return l ? "The template is invalid due to invalid unit on some of the items. Please update this template." : "The template is invalid due to deleted ingredients. Please update this template.";
|
|
275
|
+
},
|
|
276
|
+
default() {
|
|
277
|
+
return S(R.FmIcon, {
|
|
278
|
+
name: "error",
|
|
279
|
+
color: "system-error-300",
|
|
280
|
+
size: "sm"
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
e
|
|
286
|
+
]) : e;
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: "enabledLocations",
|
|
291
|
+
accessorKey: "purchaseOrder.locations.length",
|
|
292
|
+
header: () => "Enabled outlets",
|
|
293
|
+
cell(i) {
|
|
294
|
+
var l;
|
|
295
|
+
const e = (l = i.row.original.locations) == null ? void 0 : l.length;
|
|
296
|
+
return e ? `${e}` : "All";
|
|
297
|
+
},
|
|
298
|
+
enableSorting: !1,
|
|
299
|
+
meta: {
|
|
300
|
+
width: "10rem",
|
|
301
|
+
textAlign: "right"
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
id: "ref",
|
|
306
|
+
accessorKey: "purchaseOrder.ref",
|
|
307
|
+
header: () => o("inventory.transfer.table.reference"),
|
|
308
|
+
enableSorting: !1,
|
|
309
|
+
size: "auto"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: "action",
|
|
313
|
+
cell(i) {
|
|
314
|
+
const e = i.row.original, l = [
|
|
315
|
+
A[h.Details],
|
|
316
|
+
A[h.Edit],
|
|
317
|
+
A[h.Delete]
|
|
318
|
+
];
|
|
319
|
+
return O(l, (m) => b(m, e));
|
|
320
|
+
},
|
|
321
|
+
enableSorting: !1,
|
|
322
|
+
size: 40,
|
|
323
|
+
meta: {
|
|
324
|
+
cellClass: "",
|
|
325
|
+
headerClass: ""
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
templates: u,
|
|
330
|
+
loading: n,
|
|
331
|
+
fetchTemplates: T,
|
|
332
|
+
loadTemplate: f
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
function ae(r, o, a) {
|
|
337
|
+
const t = (a == null ? void 0 : a.abbrev) ?? o.abbrev;
|
|
338
|
+
return `${L(r, !1)} ${t}`;
|
|
339
|
+
}
|
|
340
|
+
var Q = /* @__PURE__ */ ((r) => (r.PURCHASE = "PURCHASE", r.TRANSFER = "TRANSFER", r))(Q || {});
|
|
341
|
+
export {
|
|
342
|
+
Q as P,
|
|
343
|
+
F as a,
|
|
344
|
+
G as b,
|
|
345
|
+
ae as f,
|
|
346
|
+
I as t,
|
|
347
|
+
J as u
|
|
348
|
+
};
|
package/dist/stores/api.d.ts
CHANGED
package/dist/stores/feature.d.ts
CHANGED