@appcorp/stellar-solutions-modules 0.1.53 → 0.1.54
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/components/ui/enhanced-table-footer-action.d.ts +6 -5
- package/components/ui/enhanced-table-footer-action.js +3 -10
- package/components/ui/enhanced-table-footer-page.d.ts +8 -6
- package/components/ui/enhanced-table-footer-page.js +1 -9
- package/components/ui/enhanced-table-footer-pagination.d.ts +4 -2
- package/components/ui/enhanced-table-footer-pagination.js +1 -7
- package/components/ui/enhanced-table.d.ts +12 -0
- package/components/ui/enhanced-table.js +31 -6
- package/global-modules/bank/bank.js +2 -6
- package/global-modules/bank/context.js +14 -13
- package/global-modules/branch/branch.js +1 -1
- package/global-modules/branch/constants.d.ts +0 -11
- package/global-modules/branch/constants.js +1 -15
- package/global-modules/branch/context.js +15 -14
- package/global-modules/payment-mode/context.js +15 -14
- package/global-modules/payment-mode/payment-mode.js +14 -14
- package/global-modules/preferences/context.js +14 -13
- package/global-modules/tax/context.js +15 -14
- package/global-modules/tax/tax.js +2 -2
- package/package.json +1 -1
|
@@ -24,11 +24,12 @@ interface EnhancedTableFooterActionProps {
|
|
|
24
24
|
isPreviousDisabled?: boolean;
|
|
25
25
|
/** Loading state indicator */
|
|
26
26
|
loading?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
/** RTL layout flag */
|
|
28
|
+
isRTL?: boolean;
|
|
29
|
+
/** Label for previous page button */
|
|
30
|
+
previousPageLabel?: string;
|
|
31
|
+
/** Label for next page button */
|
|
32
|
+
nextPageLabel?: string;
|
|
32
33
|
}
|
|
33
34
|
export declare const EnhancedTableFooterAction: FC<EnhancedTableFooterActionProps>;
|
|
34
35
|
export {};
|
|
@@ -20,25 +20,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.EnhancedTableFooterAction = void 0;
|
|
21
21
|
var react_1 = __importDefault(require("react"));
|
|
22
22
|
var lucide_react_1 = require("lucide-react");
|
|
23
|
-
var next_intl_1 = require("next-intl");
|
|
24
23
|
var button_1 = require("./button");
|
|
25
|
-
var use_rtl_1 = require("../../hooks/use-rtl");
|
|
26
24
|
var EnhancedTableFooterAction = function (_a) {
|
|
27
|
-
var handleNextOnClick = _a.handleNextOnClick, handlePreviousOnClick = _a.handlePreviousOnClick, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, loading = _a.loading,
|
|
28
|
-
var t = (0, next_intl_1.useTranslations)();
|
|
29
|
-
var isRTL = (0, use_rtl_1.useRTL)();
|
|
30
|
-
// Get translated aria labels with fallbacks
|
|
31
|
-
var previousLabel = (ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.previous) || t("common.previousPage") || "Previous page";
|
|
32
|
-
var nextLabel = (ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.next) || t("common.nextPage") || "Next page";
|
|
25
|
+
var handleNextOnClick = _a.handleNextOnClick, handlePreviousOnClick = _a.handlePreviousOnClick, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, _b = _a.isRTL, isRTL = _b === void 0 ? false : _b, loading = _a.loading, _c = _a.nextPageLabel, nextPageLabel = _c === void 0 ? "Next page" : _c, _d = _a.previousPageLabel, previousPageLabel = _d === void 0 ? "Previous page" : _d;
|
|
33
26
|
// In RTL, arrows should be swapped:
|
|
34
27
|
// Previous should show → (ChevronRight) as it goes to the right in RTL reading order
|
|
35
28
|
// Next should show ← (ChevronLeft) as it goes to the left in RTL reading order
|
|
36
29
|
var PreviousIcon = isRTL ? lucide_react_1.ChevronRight : lucide_react_1.ChevronLeft;
|
|
37
30
|
var NextIcon = isRTL ? lucide_react_1.ChevronLeft : lucide_react_1.ChevronRight;
|
|
38
31
|
return (react_1.default.createElement("div", { className: "flex gap-1 ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
39
|
-
react_1.default.createElement(button_1.Button, { variant: "outline", size: "icon", onClick: handlePreviousOnClick, disabled: isPreviousDisabled || loading, "aria-label":
|
|
32
|
+
react_1.default.createElement(button_1.Button, { variant: "outline", size: "icon", onClick: handlePreviousOnClick, disabled: isPreviousDisabled || loading, "aria-label": previousPageLabel, title: previousPageLabel, className: "".concat(isRTL ? "rotate-180" : "") },
|
|
40
33
|
react_1.default.createElement(PreviousIcon, { className: "h-4 w-4" })),
|
|
41
|
-
react_1.default.createElement(button_1.Button, { variant: "outline", size: "icon", onClick: handleNextOnClick, disabled: isNextDisabled || loading, "aria-label":
|
|
34
|
+
react_1.default.createElement(button_1.Button, { variant: "outline", size: "icon", onClick: handleNextOnClick, disabled: isNextDisabled || loading, "aria-label": nextPageLabel, title: nextPageLabel, className: "".concat(isRTL ? "rotate-180" : "") },
|
|
42
35
|
react_1.default.createElement(NextIcon, { className: "h-4 w-4" }))));
|
|
43
36
|
};
|
|
44
37
|
exports.EnhancedTableFooterAction = EnhancedTableFooterAction;
|
|
@@ -19,12 +19,14 @@ interface EnhancedTableFooterPageProps {
|
|
|
19
19
|
loading: boolean;
|
|
20
20
|
/** Total number of pages available */
|
|
21
21
|
totalPages: number;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
/** RTL layout flag */
|
|
23
|
+
isRTL?: boolean;
|
|
24
|
+
/** Label for "Page" text */
|
|
25
|
+
pageLabel?: string;
|
|
26
|
+
/** Label for "of" text */
|
|
27
|
+
ofLabel?: string;
|
|
28
|
+
/** Label for loading state */
|
|
29
|
+
loadingLabel?: string;
|
|
28
30
|
/** Optional CSS classes for custom styling */
|
|
29
31
|
className?: string;
|
|
30
32
|
}
|
|
@@ -18,16 +18,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.EnhancedTableFooterPage = void 0;
|
|
20
20
|
var react_1 = __importDefault(require("react"));
|
|
21
|
-
var next_intl_1 = require("next-intl");
|
|
22
|
-
var use_rtl_1 = require("../../hooks/use-rtl");
|
|
23
21
|
var EnhancedTableFooterPage = function (_a) {
|
|
24
|
-
var currentPage = _a.currentPage, loading = _a.loading,
|
|
25
|
-
var t = (0, next_intl_1.useTranslations)();
|
|
26
|
-
var isRTL = (0, use_rtl_1.useRTL)();
|
|
27
|
-
// Get translated text with fallbacks
|
|
28
|
-
var pageLabel = (translationMap === null || translationMap === void 0 ? void 0 : translationMap.pageLabel) || t("common.page") || "Page";
|
|
29
|
-
var ofLabel = (translationMap === null || translationMap === void 0 ? void 0 : translationMap.ofLabel) || t("common.of") || "of";
|
|
30
|
-
var loadingLabel = (translationMap === null || translationMap === void 0 ? void 0 : translationMap.loadingLabel) || t("common.loading") || "Loading";
|
|
22
|
+
var currentPage = _a.currentPage, _b = _a.isRTL, isRTL = _b === void 0 ? false : _b, loading = _a.loading, _c = _a.loadingLabel, loadingLabel = _c === void 0 ? "Loading" : _c, _d = _a.ofLabel, ofLabel = _d === void 0 ? "of" : _d, _e = _a.pageLabel, pageLabel = _e === void 0 ? "Page" : _e, totalPages = _a.totalPages, _f = _a.className, className = _f === void 0 ? "" : _f;
|
|
31
23
|
return (react_1.default.createElement("div", { className: "flex items-center gap-2 ".concat(isRTL ? "rtl" : "ltr", " ").concat(className), dir: isRTL ? "rtl" : "ltr", role: "status", "aria-live": "polite", "aria-label": "".concat(pageLabel, " ").concat(currentPage, " ").concat(ofLabel, " ").concat(totalPages) },
|
|
32
24
|
react_1.default.createElement("span", { className: "text-sm text-muted-foreground" }, isRTL ? (
|
|
33
25
|
// RTL layout: Numbers read right-to-left but maintain logical order
|
|
@@ -27,8 +27,10 @@ interface EnhancedTableFooterPageProps {
|
|
|
27
27
|
pageLimit: number;
|
|
28
28
|
/** Total number of pages (unused but kept for compatibility) */
|
|
29
29
|
totalPages: number;
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/** RTL layout flag */
|
|
31
|
+
isRTL?: boolean;
|
|
32
|
+
/** Label for rows per page selector */
|
|
33
|
+
rowsPerPageLabel?: string;
|
|
32
34
|
/** Optional CSS classes for custom styling */
|
|
33
35
|
className?: string;
|
|
34
36
|
}
|
|
@@ -20,14 +20,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.EnhancedTableFooterPagination = void 0;
|
|
21
21
|
var select_1 = require("./select");
|
|
22
22
|
var react_1 = __importDefault(require("react"));
|
|
23
|
-
var next_intl_1 = require("next-intl");
|
|
24
|
-
var use_rtl_1 = require("../../hooks/use-rtl");
|
|
25
23
|
var EnhancedTableFooterPagination = function (_a) {
|
|
26
|
-
var handleOnSelect = _a.handleOnSelect, listOptions = _a.listOptions, loading = _a.loading, nodeSelectKey = _a.nodeSelectKey, pageLimit = _a.pageLimit,
|
|
27
|
-
var t = (0, next_intl_1.useTranslations)();
|
|
28
|
-
var isRTL = (0, use_rtl_1.useRTL)();
|
|
29
|
-
// Get translated label text with fallback
|
|
30
|
-
var rowsPerPageLabel = labelText || t("common.rowsPerPage") || "Rows per page:";
|
|
24
|
+
var handleOnSelect = _a.handleOnSelect, _b = _a.isRTL, isRTL = _b === void 0 ? false : _b, listOptions = _a.listOptions, loading = _a.loading, nodeSelectKey = _a.nodeSelectKey, pageLimit = _a.pageLimit, _c = _a.rowsPerPageLabel, rowsPerPageLabel = _c === void 0 ? "Rows per page:" : _c, _d = _a.className, className = _d === void 0 ? "" : _d;
|
|
31
25
|
return (react_1.default.createElement("div", { className: "flex items-center gap-2 ".concat(className), dir: isRTL ? "rtl" : "ltr" },
|
|
32
26
|
react_1.default.createElement("label", { htmlFor: "page-limit-select-".concat(nodeSelectKey), className: "text-sm text-muted-foreground whitespace-nowrap" }, rowsPerPageLabel),
|
|
33
27
|
react_1.default.createElement(select_1.Select, { value: String(pageLimit), onValueChange: function (value) {
|
|
@@ -70,6 +70,18 @@ export interface EnhancedTableProps {
|
|
|
70
70
|
headerActions: HeaderAction[];
|
|
71
71
|
rowActions: RowAction[];
|
|
72
72
|
loading: boolean;
|
|
73
|
+
isRTL?: boolean;
|
|
74
|
+
translationLabels?: {
|
|
75
|
+
booleanYes?: string;
|
|
76
|
+
booleanNo?: string;
|
|
77
|
+
noResultsFound?: string;
|
|
78
|
+
previousPage?: string;
|
|
79
|
+
nextPage?: string;
|
|
80
|
+
page?: string;
|
|
81
|
+
of?: string;
|
|
82
|
+
loading?: string;
|
|
83
|
+
rowsPerPage?: string;
|
|
84
|
+
};
|
|
73
85
|
nodeSelectKey?: string;
|
|
74
86
|
}
|
|
75
87
|
export declare const EnhancedTable: React.FC<EnhancedTableProps>;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
3
14
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
16
|
};
|
|
@@ -31,7 +42,21 @@ var COMPONENT_TYPE;
|
|
|
31
42
|
COMPONENT_TYPE["BOOLEAN"] = "BOOLEAN";
|
|
32
43
|
})(COMPONENT_TYPE || (exports.COMPONENT_TYPE = COMPONENT_TYPE = {}));
|
|
33
44
|
var EnhancedTable = function (_a) {
|
|
34
|
-
var currentPage = _a.currentPage, handleNextOnClick = _a.handleNextOnClick, handleOnSelect = _a.handleOnSelect, handlePreviousOnClick = _a.handlePreviousOnClick, handleSearchInput = _a.handleSearchInput, headerActions = _a.headerActions, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, listOptions = _a.listOptions, loading = _a.loading,
|
|
45
|
+
var currentPage = _a.currentPage, handleNextOnClick = _a.handleNextOnClick, handleOnSelect = _a.handleOnSelect, handlePreviousOnClick = _a.handlePreviousOnClick, handleSearchInput = _a.handleSearchInput, headerActions = _a.headerActions, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, _b = _a.isRTL, isRTL = _b === void 0 ? false : _b, listOptions = _a.listOptions, loading = _a.loading, _c = _a.nodeSelectKey, nodeSelectKey = _c === void 0 ? "pageLimit" : _c, pageLimit = _a.pageLimit, rowActions = _a.rowActions, _d = _a.searchDisabled, searchDisabled = _d === void 0 ? false : _d, _e = _a.searchEnabled, searchEnabled = _e === void 0 ? true : _e, _f = _a.searchId, searchId = _f === void 0 ? "table-search" : _f, _g = _a.searchPlaceholder, searchPlaceholder = _g === void 0 ? "Search..." : _g, searchValue = _a.searchValue, tableBodyCols = _a.tableBodyCols, tableBodyRows = _a.tableBodyRows, tableDescription = _a.tableDescription, tableHeading = _a.tableHeading, tableHeadItems = _a.tableHeadItems, totalPages = _a.totalPages, _h = _a.translationLabels, translationLabels = _h === void 0 ? {} : _h;
|
|
46
|
+
// Default translation values
|
|
47
|
+
var defaultLabels = {
|
|
48
|
+
booleanYes: "Yes",
|
|
49
|
+
booleanNo: "No",
|
|
50
|
+
noResultsFound: "No results found.",
|
|
51
|
+
previousPage: "Previous page",
|
|
52
|
+
nextPage: "Next page",
|
|
53
|
+
page: "Page",
|
|
54
|
+
of: "of",
|
|
55
|
+
loading: "Loading",
|
|
56
|
+
rowsPerPage: "Rows per page:",
|
|
57
|
+
};
|
|
58
|
+
// Merge provided labels with defaults
|
|
59
|
+
var labels = __assign(__assign({}, defaultLabels), translationLabels);
|
|
35
60
|
var renderCellContent = function (row, col) {
|
|
36
61
|
var _a, _b;
|
|
37
62
|
// Helper to safely resolve nested keys (max depth 3)
|
|
@@ -120,7 +145,7 @@ var EnhancedTable = function (_a) {
|
|
|
120
145
|
var isTrue = Boolean(value);
|
|
121
146
|
return (react_1.default.createElement(badge_1.Badge, { variant: "secondary", className: (0, utils_1.cn)("text-white font-medium", isTrue
|
|
122
147
|
? "bg-green-500 hover:bg-green-600"
|
|
123
|
-
: "bg-red-500 hover:bg-red-600") }, isTrue ?
|
|
148
|
+
: "bg-red-500 hover:bg-red-600") }, isTrue ? labels.booleanYes : labels.booleanNo));
|
|
124
149
|
}
|
|
125
150
|
// OBJECT => nested property path supplied as array of strings (max length 3)
|
|
126
151
|
if (normalizedType === COMPONENT_TYPE.OBJECT) {
|
|
@@ -186,11 +211,11 @@ var EnhancedTable = function (_a) {
|
|
|
186
211
|
react_1.default.createElement(table_1.TableHeader, null,
|
|
187
212
|
react_1.default.createElement(table_1.TableRow, null, tableHeadItems.map(function (header, index) { return (react_1.default.createElement(table_1.TableHead, { key: index, style: { width: header.width }, className: (0, utils_1.cn)("font-medium", index === 0 && "rounded-tl-md", index === tableHeadItems.length - 1 && "rounded-tr-md") }, header.label)); }))),
|
|
188
213
|
react_1.default.createElement(table_1.TableBody, null, loading ? (renderLoadingRows()) : tableBodyRows.length === 0 ? (react_1.default.createElement(table_1.TableRow, null,
|
|
189
|
-
react_1.default.createElement(table_1.TableCell, { colSpan: tableHeadItems.length, className: "h-24 text-center text-muted-foreground" },
|
|
214
|
+
react_1.default.createElement(table_1.TableCell, { colSpan: tableHeadItems.length, className: "h-24 text-center text-muted-foreground" }, labels.noResultsFound))) : (tableBodyRows.map(function (row, rowIndex) { return (react_1.default.createElement(table_1.TableRow, { key: rowIndex, className: "hover:bg-muted/50" }, tableBodyCols.map(function (col, colIndex) { return (react_1.default.createElement(table_1.TableCell, { key: colIndex, className: "py-4" }, renderCellContent(row, col))); }))); }))))),
|
|
190
215
|
react_1.default.createElement("div", { className: "flex items-center justify-between" },
|
|
191
|
-
react_1.default.createElement(enhanced_table_footer_pagination_1.EnhancedTableFooterPagination, { handleOnSelect: handleOnSelect, listOptions: listOptions, loading: loading, nodeSelectKey: nodeSelectKey, pageLimit: pageLimit, totalPages: totalPages }),
|
|
216
|
+
react_1.default.createElement(enhanced_table_footer_pagination_1.EnhancedTableFooterPagination, { handleOnSelect: handleOnSelect, isRTL: isRTL, listOptions: listOptions, loading: loading, nodeSelectKey: nodeSelectKey, pageLimit: pageLimit, rowsPerPageLabel: labels.rowsPerPage, totalPages: totalPages }),
|
|
192
217
|
react_1.default.createElement("div", { className: "flex items-center gap-4" },
|
|
193
|
-
react_1.default.createElement(enhanced_table_footer_page_1.EnhancedTableFooterPage, { currentPage: currentPage, loading: loading, totalPages: totalPages }),
|
|
194
|
-
react_1.default.createElement(enhanced_table_footer_action_1.EnhancedTableFooterAction, { handleNextOnClick: handleNextOnClick, handlePreviousOnClick: handlePreviousOnClick, isNextDisabled: isNextDisabled, isPreviousDisabled: isPreviousDisabled, loading: loading })))));
|
|
218
|
+
react_1.default.createElement(enhanced_table_footer_page_1.EnhancedTableFooterPage, { currentPage: currentPage, isRTL: isRTL, loading: loading, loadingLabel: labels.loading, ofLabel: labels.of, pageLabel: labels.page, totalPages: totalPages }),
|
|
219
|
+
react_1.default.createElement(enhanced_table_footer_action_1.EnhancedTableFooterAction, { handleNextOnClick: handleNextOnClick, handlePreviousOnClick: handlePreviousOnClick, isNextDisabled: isNextDisabled, isPreviousDisabled: isPreviousDisabled, isRTL: isRTL, loading: loading, nextPageLabel: labels.nextPage, previousPageLabel: labels.previousPage })))));
|
|
195
220
|
};
|
|
196
221
|
exports.EnhancedTable = EnhancedTable;
|
|
@@ -10,13 +10,12 @@ var util_functions_1 = require("@react-pakistan/util-functions");
|
|
|
10
10
|
var use_rtl_1 = require("../../hooks/use-rtl");
|
|
11
11
|
var enhanced_table_1 = require("../../components/ui/enhanced-table");
|
|
12
12
|
var sonner_1 = require("../../components/ui/sonner");
|
|
13
|
-
var theme_switcher_1 = require("../../components/theme-switcher");
|
|
14
13
|
var constants_1 = require("./constants");
|
|
15
14
|
var context_1 = require("./context");
|
|
16
15
|
var drawer_1 = require("./drawer");
|
|
17
16
|
var Bank = function () {
|
|
18
17
|
var _a = (0, context_1.useBankStateContext)(), banks = _a.banks, count = _a.count, currentPage = _a.currentPage, handleNextClick = _a.handleNextClick, handlePageLimit = _a.handlePageLimit, handlePreviousClick = _a.handlePreviousClick, headerActions = _a.headerActions, listLoading = _a.listLoading, pageLimit = _a.pageLimit, rowActions = _a.rowActions, searchOnChange = _a.searchOnChange, searchQuery = _a.searchQuery;
|
|
19
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
18
|
+
var t = (0, next_intl_1.useTranslations)("bank");
|
|
20
19
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
21
20
|
var translationMap = {
|
|
22
21
|
formLabelBankName: t("formLabelBankName"),
|
|
@@ -77,10 +76,7 @@ var Bank = function () {
|
|
|
77
76
|
];
|
|
78
77
|
var totalPages = (0, util_functions_1.calculatePages)(count, pageLimit);
|
|
79
78
|
return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
80
|
-
react_1.default.createElement(
|
|
81
|
-
react_1.default.createElement("div", null),
|
|
82
|
-
react_1.default.createElement(theme_switcher_1.ThemeSwitcher, null)),
|
|
83
|
-
react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "bank-search", searchPlaceholder: t("tableHeaderSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: banks, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: Number(totalPages) }),
|
|
79
|
+
react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "bank-search", searchPlaceholder: t("tableSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: banks, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: Number(totalPages) }),
|
|
84
80
|
react_1.default.createElement(drawer_1.BankDrawer, { isRTL: isRTL, translationMap: translationMap }),
|
|
85
81
|
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
86
82
|
};
|
|
@@ -98,7 +98,8 @@ var useBankState = function () {
|
|
|
98
98
|
var _a = (0, react_1.useReducer)(reducer_1.bankReducer, reducer_1.initialBankState), state = _a[0], dispatch = _a[1];
|
|
99
99
|
var activeTab = (0, context_1.usePreferenceStateContext)().activeTab;
|
|
100
100
|
var theme = (0, next_themes_1.useTheme)().theme;
|
|
101
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
101
|
+
var t = (0, next_intl_1.useTranslations)("bank");
|
|
102
|
+
var tCommon = (0, next_intl_1.useTranslations)("common");
|
|
102
103
|
// ---------------------------------------------------------------------------
|
|
103
104
|
// DEBOUNCED VALUES
|
|
104
105
|
// ---------------------------------------------------------------------------
|
|
@@ -157,7 +158,7 @@ var useBankState = function () {
|
|
|
157
158
|
var listCallback = (0, react_1.useCallback)(function (_a) {
|
|
158
159
|
var data = _a.data, error = _a.error;
|
|
159
160
|
if (error) {
|
|
160
|
-
showErrorToast(
|
|
161
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
161
162
|
return;
|
|
162
163
|
}
|
|
163
164
|
if (data) {
|
|
@@ -171,11 +172,11 @@ var useBankState = function () {
|
|
|
171
172
|
payload: { count: count || 0 },
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
|
-
}, [showErrorToast]);
|
|
175
|
+
}, [showErrorToast, tCommon]);
|
|
175
176
|
var updateCallback = (0, react_1.useCallback)(function (_a) {
|
|
176
177
|
var data = _a.data, error = _a.error;
|
|
177
178
|
if (error) {
|
|
178
|
-
showErrorToast(
|
|
179
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
181
182
|
if (data) {
|
|
@@ -191,11 +192,11 @@ var useBankState = function () {
|
|
|
191
192
|
payload: { drawer: null },
|
|
192
193
|
});
|
|
193
194
|
}
|
|
194
|
-
}, [showErrorToast, showSuccessToast, t]);
|
|
195
|
+
}, [showErrorToast, showSuccessToast, t, tCommon]);
|
|
195
196
|
var deleteCallback = (0, react_1.useCallback)(function (_a) {
|
|
196
197
|
var data = _a.data, error = _a.error;
|
|
197
198
|
if (error) {
|
|
198
|
-
showErrorToast(
|
|
199
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
199
200
|
return;
|
|
200
201
|
}
|
|
201
202
|
if (data) {
|
|
@@ -204,11 +205,11 @@ var useBankState = function () {
|
|
|
204
205
|
type: actions_1.BANK_ACTION_TYPES.RESET_FORM,
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
|
-
}, [showErrorToast, showSuccessToast, t]);
|
|
208
|
+
}, [showErrorToast, showSuccessToast, t, tCommon]);
|
|
208
209
|
var byIdCallback = (0, react_1.useCallback)(function (_a) {
|
|
209
210
|
var data = _a.data, error = _a.error;
|
|
210
211
|
if (error) {
|
|
211
|
-
showErrorToast(
|
|
212
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
212
213
|
return;
|
|
213
214
|
}
|
|
214
215
|
if (data) {
|
|
@@ -217,7 +218,7 @@ var useBankState = function () {
|
|
|
217
218
|
payload: { form: data },
|
|
218
219
|
});
|
|
219
220
|
}
|
|
220
|
-
}, [showErrorToast]);
|
|
221
|
+
}, [showErrorToast, tCommon]);
|
|
221
222
|
// ---------------------------------------------------------------------------
|
|
222
223
|
// MODULE ENTITY HOOK
|
|
223
224
|
// ---------------------------------------------------------------------------
|
|
@@ -311,11 +312,11 @@ var useBankState = function () {
|
|
|
311
312
|
dispatch({ type: actions_1.BANK_ACTION_TYPES.SET_ERRORS, payload: { errors: errors } });
|
|
312
313
|
(0, toast_utils_1.generateThemeToast)({
|
|
313
314
|
variant: toast_utils_1.TOAST_VARIANT.ERROR,
|
|
314
|
-
description:
|
|
315
|
+
description: tCommon("messagesValidationError"),
|
|
315
316
|
});
|
|
316
317
|
},
|
|
317
318
|
});
|
|
318
|
-
}, [updateParams, updateFetchNow]);
|
|
319
|
+
}, [updateParams, updateFetchNow, tCommon]);
|
|
319
320
|
// ---------------------------------------------------------------------------
|
|
320
321
|
// PAGINATION HANDLERS
|
|
321
322
|
// ---------------------------------------------------------------------------
|
|
@@ -373,13 +374,13 @@ var useBankState = function () {
|
|
|
373
374
|
{
|
|
374
375
|
enabled: true,
|
|
375
376
|
handleAction: handleEdit,
|
|
376
|
-
label: t("
|
|
377
|
+
label: t("actionsButtonEdit"),
|
|
377
378
|
order: 1,
|
|
378
379
|
},
|
|
379
380
|
{
|
|
380
381
|
enabled: true,
|
|
381
382
|
handleAction: handleDelete,
|
|
382
|
-
label: t("
|
|
383
|
+
label: t("actionsButtonDelete"),
|
|
383
384
|
order: 2,
|
|
384
385
|
},
|
|
385
386
|
]; }, [handleEdit, handleDelete, t]);
|
|
@@ -16,7 +16,7 @@ var context_1 = require("./context");
|
|
|
16
16
|
var drawer_1 = require("./drawer");
|
|
17
17
|
var Branch = function () {
|
|
18
18
|
var _a = (0, context_1.useBranchStateContext)(), branches = _a.branches, count = _a.count, currentPage = _a.currentPage, handleNextClick = _a.handleNextClick, handlePageLimit = _a.handlePageLimit, handlePreviousClick = _a.handlePreviousClick, headerActions = _a.headerActions, listLoading = _a.listLoading, pageLimit = _a.pageLimit, rowActions = _a.rowActions, searchOnChange = _a.searchOnChange, searchQuery = _a.searchQuery;
|
|
19
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
19
|
+
var t = (0, next_intl_1.useTranslations)("branch");
|
|
20
20
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
21
21
|
var translationMap = {
|
|
22
22
|
formLabelBranchName: t("formLabelBranchName"),
|
|
@@ -32,14 +32,3 @@ export declare const tableBodyCols: {
|
|
|
32
32
|
componentType: VISTA_TABLE_CELL_TYPE;
|
|
33
33
|
key: string;
|
|
34
34
|
}[];
|
|
35
|
-
/**
|
|
36
|
-
* Toast error messages for user feedback
|
|
37
|
-
*/
|
|
38
|
-
export declare const toastErrors: {
|
|
39
|
-
fetchInvoiceError: string;
|
|
40
|
-
formSubmittedSuccess: string;
|
|
41
|
-
genericError: string;
|
|
42
|
-
networkError: string;
|
|
43
|
-
submitFormError: string;
|
|
44
|
-
validationError: string;
|
|
45
|
-
};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Naming Convention: Descriptive names with clear purpose
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.tableBodyCols = exports.BRANCH_API_ROUTES = exports.pageLimit = void 0;
|
|
18
18
|
var vista_table_type_1 = require("@appcorp/app-corp-vista/type/vista-table-type");
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// PAGE CONFIGURATION
|
|
@@ -83,20 +83,6 @@ exports.tableBodyCols = [
|
|
|
83
83
|
},
|
|
84
84
|
];
|
|
85
85
|
// ============================================================================
|
|
86
|
-
// TOAST MESSAGES
|
|
87
|
-
// ============================================================================
|
|
88
|
-
/**
|
|
89
|
-
* Toast error messages for user feedback
|
|
90
|
-
*/
|
|
91
|
-
exports.toastErrors = {
|
|
92
|
-
fetchInvoiceError: "Error Fetching Invoice",
|
|
93
|
-
formSubmittedSuccess: "Form Submitted Successfully",
|
|
94
|
-
genericError: "Something Went Wrong",
|
|
95
|
-
networkError: "Network Error Occurred",
|
|
96
|
-
submitFormError: "Error Submitting Form",
|
|
97
|
-
validationError: "Validation Failed",
|
|
98
|
-
};
|
|
99
|
-
// ============================================================================
|
|
100
86
|
// OPTIMIZATION SUMMARY
|
|
101
87
|
// ============================================================================
|
|
102
88
|
/*
|
|
@@ -98,7 +98,8 @@ var useBranchState = function () {
|
|
|
98
98
|
var _a = (0, react_1.useReducer)(reducer_1.branchReducer, reducer_1.initialBranchState), state = _a[0], dispatch = _a[1];
|
|
99
99
|
var _b = (0, context_1.usePreferenceStateContext)(), preferences = _b.preferences, activeTab = _b.activeTab;
|
|
100
100
|
var theme = (0, next_themes_1.useTheme)().theme;
|
|
101
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
101
|
+
var t = (0, next_intl_1.useTranslations)("branch");
|
|
102
|
+
var tCommon = (0, next_intl_1.useTranslations)("common");
|
|
102
103
|
// ---------------------------------------------------------------------------
|
|
103
104
|
// DEBOUNCED VALUES
|
|
104
105
|
// ---------------------------------------------------------------------------
|
|
@@ -157,7 +158,7 @@ var useBranchState = function () {
|
|
|
157
158
|
var listCallback = (0, react_1.useCallback)(function (_a) {
|
|
158
159
|
var data = _a.data, error = _a.error;
|
|
159
160
|
if (error) {
|
|
160
|
-
showErrorToast(
|
|
161
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
161
162
|
}
|
|
162
163
|
if (data === null || data === void 0 ? void 0 : data.items) {
|
|
163
164
|
dispatch({
|
|
@@ -169,14 +170,14 @@ var useBranchState = function () {
|
|
|
169
170
|
payload: { count: data === null || data === void 0 ? void 0 : data.count },
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
|
-
}, [showErrorToast]);
|
|
173
|
+
}, [showErrorToast, tCommon]);
|
|
173
174
|
var updateCallback = (0, react_1.useCallback)(function (_a) {
|
|
174
175
|
var data = _a.data, error = _a.error;
|
|
175
176
|
if (error) {
|
|
176
|
-
showErrorToast(
|
|
177
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
177
178
|
}
|
|
178
179
|
if (data) {
|
|
179
|
-
showSuccessToast(t("
|
|
180
|
+
showSuccessToast(t("messagesBranchUpdated"));
|
|
180
181
|
dispatch({
|
|
181
182
|
type: actions_1.BRANCH_ACTION_TYPES.RESET_FORM,
|
|
182
183
|
});
|
|
@@ -188,11 +189,11 @@ var useBranchState = function () {
|
|
|
188
189
|
payload: { drawer: null },
|
|
189
190
|
});
|
|
190
191
|
}
|
|
191
|
-
}, [showErrorToast, showSuccessToast, t]);
|
|
192
|
+
}, [showErrorToast, showSuccessToast, t, tCommon]);
|
|
192
193
|
var byIdCallback = (0, react_1.useCallback)(function (_a) {
|
|
193
194
|
var data = _a.data, error = _a.error;
|
|
194
195
|
if (error) {
|
|
195
|
-
showErrorToast(
|
|
196
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
196
197
|
}
|
|
197
198
|
if (data) {
|
|
198
199
|
dispatch({
|
|
@@ -204,19 +205,19 @@ var useBranchState = function () {
|
|
|
204
205
|
payload: { drawer: types_1.BRANCH_DRAWER.FORM_DRAWER },
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
|
-
}, [showErrorToast]);
|
|
208
|
+
}, [showErrorToast, tCommon]);
|
|
208
209
|
var deleteCallback = (0, react_1.useCallback)(function (_a) {
|
|
209
210
|
var data = _a.data, error = _a.error;
|
|
210
211
|
if (error) {
|
|
211
|
-
showErrorToast(
|
|
212
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
212
213
|
}
|
|
213
214
|
if (data) {
|
|
214
|
-
showSuccessToast(t("
|
|
215
|
+
showSuccessToast(t("messagesBranchDeleted"));
|
|
215
216
|
dispatch({
|
|
216
217
|
type: actions_1.BRANCH_ACTION_TYPES.RESET_FORM,
|
|
217
218
|
});
|
|
218
219
|
}
|
|
219
|
-
}, [showErrorToast, showSuccessToast, t]);
|
|
220
|
+
}, [showErrorToast, showSuccessToast, t, tCommon]);
|
|
220
221
|
// ---------------------------------------------------------------------------
|
|
221
222
|
// MODULE ENTITY HOOK
|
|
222
223
|
// ---------------------------------------------------------------------------
|
|
@@ -352,7 +353,7 @@ var useBranchState = function () {
|
|
|
352
353
|
{
|
|
353
354
|
enabled: true,
|
|
354
355
|
handleOnClick: handleCreate,
|
|
355
|
-
label: t("
|
|
356
|
+
label: t("actionsButtonAddItem"),
|
|
356
357
|
order: 1,
|
|
357
358
|
},
|
|
358
359
|
]; }, [handleCreate, t]);
|
|
@@ -360,13 +361,13 @@ var useBranchState = function () {
|
|
|
360
361
|
{
|
|
361
362
|
enabled: true,
|
|
362
363
|
handleAction: handleEdit,
|
|
363
|
-
label: t("
|
|
364
|
+
label: t("actionsButtonEdit"),
|
|
364
365
|
order: 1,
|
|
365
366
|
},
|
|
366
367
|
{
|
|
367
368
|
enabled: true,
|
|
368
369
|
handleAction: handleDelete,
|
|
369
|
-
label: t("
|
|
370
|
+
label: t("actionsButtonDelete"),
|
|
370
371
|
order: 2,
|
|
371
372
|
},
|
|
372
373
|
]; }, [handleEdit, handleDelete, t]);
|
|
@@ -98,7 +98,8 @@ var usePaymentModeState = function () {
|
|
|
98
98
|
var _a = (0, react_1.useReducer)(reducer_1.paymentModeReducer, reducer_1.initialPaymentModeState), state = _a[0], dispatch = _a[1];
|
|
99
99
|
var _b = (0, context_1.usePreferenceStateContext)(), preferences = _b.preferences, activeTab = _b.activeTab;
|
|
100
100
|
var theme = (0, next_themes_1.useTheme)().theme;
|
|
101
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
101
|
+
var t = (0, next_intl_1.useTranslations)("paymentMode");
|
|
102
|
+
var tCommon = (0, next_intl_1.useTranslations)("common");
|
|
102
103
|
// ---------------------------------------------------------------------------
|
|
103
104
|
// DEBOUNCED VALUES
|
|
104
105
|
// ---------------------------------------------------------------------------
|
|
@@ -143,7 +144,7 @@ var usePaymentModeState = function () {
|
|
|
143
144
|
var listCallback = (0, react_1.useCallback)(function (_a) {
|
|
144
145
|
var data = _a.data, error = _a.error;
|
|
145
146
|
if (error) {
|
|
146
|
-
showErrorToast(
|
|
147
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
147
148
|
}
|
|
148
149
|
if (data === null || data === void 0 ? void 0 : data.items) {
|
|
149
150
|
dispatch({
|
|
@@ -155,14 +156,14 @@ var usePaymentModeState = function () {
|
|
|
155
156
|
payload: { count: data === null || data === void 0 ? void 0 : data.count },
|
|
156
157
|
});
|
|
157
158
|
}
|
|
158
|
-
}, [showErrorToast]);
|
|
159
|
+
}, [showErrorToast, tCommon]);
|
|
159
160
|
var updateCallback = (0, react_1.useCallback)(function (_a) {
|
|
160
161
|
var data = _a.data, error = _a.error;
|
|
161
162
|
if (error) {
|
|
162
|
-
showErrorToast(
|
|
163
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
163
164
|
}
|
|
164
165
|
if (data) {
|
|
165
|
-
showSuccessToast(t("
|
|
166
|
+
showSuccessToast(t("messagesPaymentModeUpdated"));
|
|
166
167
|
dispatch({
|
|
167
168
|
type: actions_1.PAYMENT_MODE_ACTION_TYPES.RESET_FORM,
|
|
168
169
|
});
|
|
@@ -174,11 +175,11 @@ var usePaymentModeState = function () {
|
|
|
174
175
|
payload: { drawer: null },
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
|
-
}, [showErrorToast, showSuccessToast, t]);
|
|
178
|
+
}, [showErrorToast, showSuccessToast, t, tCommon]);
|
|
178
179
|
var byIdCallback = (0, react_1.useCallback)(function (_a) {
|
|
179
180
|
var data = _a.data, error = _a.error;
|
|
180
181
|
if (error) {
|
|
181
|
-
showErrorToast(
|
|
182
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
182
183
|
}
|
|
183
184
|
if (data) {
|
|
184
185
|
dispatch({
|
|
@@ -190,19 +191,19 @@ var usePaymentModeState = function () {
|
|
|
190
191
|
payload: { drawer: types_1.PAYMENT_MODE_DRAWER.FORM_DRAWER },
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
|
-
}, [showErrorToast]);
|
|
194
|
+
}, [showErrorToast, tCommon]);
|
|
194
195
|
var deleteCallback = (0, react_1.useCallback)(function (_a) {
|
|
195
196
|
var data = _a.data, error = _a.error;
|
|
196
197
|
if (error) {
|
|
197
|
-
showErrorToast(
|
|
198
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
198
199
|
}
|
|
199
200
|
if (data) {
|
|
200
|
-
showSuccessToast(t("
|
|
201
|
+
showSuccessToast(t("messagesPaymentModeDeleted"));
|
|
201
202
|
dispatch({
|
|
202
203
|
type: actions_1.PAYMENT_MODE_ACTION_TYPES.RESET_FORM,
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
|
-
}, [showErrorToast, showSuccessToast, t]);
|
|
206
|
+
}, [showErrorToast, showSuccessToast, t, tCommon]);
|
|
206
207
|
// ---------------------------------------------------------------------------
|
|
207
208
|
// MODULE ENTITY HOOK
|
|
208
209
|
// ---------------------------------------------------------------------------
|
|
@@ -339,7 +340,7 @@ var usePaymentModeState = function () {
|
|
|
339
340
|
{
|
|
340
341
|
enabled: true,
|
|
341
342
|
handleOnClick: handleCreate,
|
|
342
|
-
label: t("
|
|
343
|
+
label: t("actionsButtonAddItem"),
|
|
343
344
|
order: 1,
|
|
344
345
|
},
|
|
345
346
|
]; }, [handleCreate, t]);
|
|
@@ -347,13 +348,13 @@ var usePaymentModeState = function () {
|
|
|
347
348
|
{
|
|
348
349
|
enabled: true,
|
|
349
350
|
handleAction: handleEdit,
|
|
350
|
-
label: t("
|
|
351
|
+
label: t("actionsButtonEdit"),
|
|
351
352
|
order: 1,
|
|
352
353
|
},
|
|
353
354
|
{
|
|
354
355
|
enabled: true,
|
|
355
356
|
handleAction: handleDelete,
|
|
356
|
-
label: t("
|
|
357
|
+
label: t("actionsButtonDelete"),
|
|
357
358
|
order: 2,
|
|
358
359
|
},
|
|
359
360
|
]; }, [handleEdit, handleDelete, t]);
|
|
@@ -34,7 +34,7 @@ var drawer_1 = require("./drawer");
|
|
|
34
34
|
*/
|
|
35
35
|
var PaymentMode = function () {
|
|
36
36
|
var _a = (0, context_1.usePaymentModeStateContext)(), count = _a.count, currentPage = _a.currentPage, handleNextClick = _a.handleNextClick, handlePageLimit = _a.handlePageLimit, handlePreviousClick = _a.handlePreviousClick, headerActions = _a.headerActions, listLoading = _a.listLoading, pageLimit = _a.pageLimit, paymentModes = _a.paymentModes, rowActions = _a.rowActions, searchOnChange = _a.searchOnChange, searchQuery = _a.searchQuery;
|
|
37
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
37
|
+
var t = (0, next_intl_1.useTranslations)("paymentMode");
|
|
38
38
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
39
39
|
// ============================================================================
|
|
40
40
|
// TRANSLATION MAPPING
|
|
@@ -43,7 +43,7 @@ var PaymentMode = function () {
|
|
|
43
43
|
// Form Labels
|
|
44
44
|
formLabelLabel: t("formLabelLabel"),
|
|
45
45
|
// Drawer
|
|
46
|
-
|
|
46
|
+
drawerTitleCreate: t("drawerTitleCreate"),
|
|
47
47
|
headingFormCreate: t("headingFormCreate"),
|
|
48
48
|
srCloseDrawer: t("srCloseDrawer"),
|
|
49
49
|
cancelBtn: t("cancelBtn"),
|
|
@@ -60,18 +60,18 @@ var PaymentMode = function () {
|
|
|
60
60
|
enableDescription: t("enableDescription"),
|
|
61
61
|
defaultDescription: t("defaultDescription"),
|
|
62
62
|
// Messages
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
messagePaymentModeDeleted: t("
|
|
66
|
-
|
|
67
|
-
messageDeletingPaymentMode: t("
|
|
68
|
-
messageLoadingPaymentModes: t("
|
|
69
|
-
messageSuccess: t("
|
|
70
|
-
messageError: t("
|
|
63
|
+
messagesRecordCreated: t("messagesRecordCreated"),
|
|
64
|
+
messagesRecordUpdated: t("messagesRecordUpdated"),
|
|
65
|
+
messagePaymentModeDeleted: t("messagesPaymentModeDeleted"),
|
|
66
|
+
messagesRecordDeleted: t("messagesRecordDeleted"),
|
|
67
|
+
messageDeletingPaymentMode: t("messagesDeletingPaymentMode"),
|
|
68
|
+
messageLoadingPaymentModes: t("messagesLoadingPaymentModes"),
|
|
69
|
+
messageSuccess: t("messagesSuccess"),
|
|
70
|
+
messageError: t("messagesError"),
|
|
71
71
|
// Validation
|
|
72
|
-
validationLabelRequired: t("
|
|
73
|
-
validationPreferenceIdRequired: t("
|
|
74
|
-
validationFormGeneralError: t("
|
|
72
|
+
validationLabelRequired: t("validationLabelRequired"),
|
|
73
|
+
validationPreferenceIdRequired: t("validationPreferenceIdRequired"),
|
|
74
|
+
validationFormGeneralError: t("validationFormGeneralError"),
|
|
75
75
|
};
|
|
76
76
|
// ============================================================================
|
|
77
77
|
// TABLE CONFIGURATION
|
|
@@ -113,7 +113,7 @@ var PaymentMode = function () {
|
|
|
113
113
|
react_1.default.createElement("div", { className: "flex items-center justify-between ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
114
114
|
react_1.default.createElement("div", null),
|
|
115
115
|
react_1.default.createElement(theme_switcher_1.ThemeSwitcher, null)),
|
|
116
|
-
react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "payment-mode-search", searchPlaceholder: t("
|
|
116
|
+
react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "payment-mode-search", searchPlaceholder: t("tableSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: paymentModes, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: Number(totalPages) }),
|
|
117
117
|
react_1.default.createElement(drawer_1.PaymentModeDrawer, { isRTL: isRTL, translationMap: translationMap }),
|
|
118
118
|
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
119
119
|
};
|
|
@@ -56,7 +56,8 @@ var reducer_1 = require("./reducer");
|
|
|
56
56
|
var generate_toast_1 = require("@appcorp/app-corp-vista/utils/generate-toast");
|
|
57
57
|
var usePreferenceState = function () {
|
|
58
58
|
var _a = (0, react_1.useReducer)(reducer_1.preferenceReducer, reducer_1.initialPreferenceState), state = _a[0], dispatch = _a[1];
|
|
59
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
59
|
+
var t = (0, next_intl_1.useTranslations)("preferences");
|
|
60
|
+
var tCommon = (0, next_intl_1.useTranslations)("common");
|
|
60
61
|
// const { products } = useProductStateContext();
|
|
61
62
|
// const { companies } = useCompanyStateContext();
|
|
62
63
|
// const debouncedQuery = useDebounce(state.searchQuery, 800);
|
|
@@ -66,7 +67,7 @@ var usePreferenceState = function () {
|
|
|
66
67
|
if (error) {
|
|
67
68
|
(0, generate_toast_1.generateToast)({
|
|
68
69
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
|
|
69
|
-
description:
|
|
70
|
+
description: tCommon("messagesNetworkError"),
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
if (data === null || data === void 0 ? void 0 : data.items) {
|
|
@@ -94,13 +95,13 @@ var usePreferenceState = function () {
|
|
|
94
95
|
var data = _a.data, error = _a.error;
|
|
95
96
|
if (error) {
|
|
96
97
|
(0, generate_toast_1.generateToast)({
|
|
97
|
-
description:
|
|
98
|
+
description: tCommon("messagesNetworkError"),
|
|
98
99
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
if (data) {
|
|
102
103
|
(0, generate_toast_1.generateToast)({
|
|
103
|
-
description: t("
|
|
104
|
+
description: t("messagesPreferenceUpdated"),
|
|
104
105
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS,
|
|
105
106
|
});
|
|
106
107
|
dispatch({
|
|
@@ -123,7 +124,7 @@ var usePreferenceState = function () {
|
|
|
123
124
|
var data = _a.data, error = _a.error;
|
|
124
125
|
if (error) {
|
|
125
126
|
(0, generate_toast_1.generateToast)({
|
|
126
|
-
description:
|
|
127
|
+
description: tCommon("messagesNetworkError"),
|
|
127
128
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
|
|
128
129
|
});
|
|
129
130
|
}
|
|
@@ -145,13 +146,13 @@ var usePreferenceState = function () {
|
|
|
145
146
|
var data = _a.data, error = _a.error;
|
|
146
147
|
if (error) {
|
|
147
148
|
(0, generate_toast_1.generateToast)({
|
|
148
|
-
description:
|
|
149
|
+
description: tCommon("messagesNetworkError"),
|
|
149
150
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
153
|
if (data) {
|
|
153
154
|
(0, generate_toast_1.generateToast)({
|
|
154
|
-
description: t("
|
|
155
|
+
description: t("messagesPreferenceDeleted"),
|
|
155
156
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS,
|
|
156
157
|
});
|
|
157
158
|
dispatch({
|
|
@@ -187,7 +188,7 @@ var usePreferenceState = function () {
|
|
|
187
188
|
if (error) {
|
|
188
189
|
(0, generate_toast_1.generateToast)({
|
|
189
190
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
|
|
190
|
-
description:
|
|
191
|
+
description: tCommon("messagesNetworkError"),
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
194
|
if (data === null || data === void 0 ? void 0 : data.items) {
|
|
@@ -213,13 +214,13 @@ var usePreferenceState = function () {
|
|
|
213
214
|
var data = _a.data, error = _a.error;
|
|
214
215
|
if (error) {
|
|
215
216
|
(0, generate_toast_1.generateToast)({
|
|
216
|
-
description:
|
|
217
|
+
description: tCommon("messagesNetworkError"),
|
|
217
218
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
|
|
218
219
|
});
|
|
219
220
|
}
|
|
220
221
|
if (data) {
|
|
221
222
|
(0, generate_toast_1.generateToast)({
|
|
222
|
-
description: t("
|
|
223
|
+
description: t("messagesPreferenceUpdated"),
|
|
223
224
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS,
|
|
224
225
|
});
|
|
225
226
|
dispatch({
|
|
@@ -239,7 +240,7 @@ var usePreferenceState = function () {
|
|
|
239
240
|
var data = _a.data, error = _a.error;
|
|
240
241
|
if (error) {
|
|
241
242
|
(0, generate_toast_1.generateToast)({
|
|
242
|
-
description:
|
|
243
|
+
description: tCommon("messagesNetworkError"),
|
|
243
244
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
|
|
244
245
|
});
|
|
245
246
|
}
|
|
@@ -261,13 +262,13 @@ var usePreferenceState = function () {
|
|
|
261
262
|
var data = _a.data, error = _a.error;
|
|
262
263
|
if (error) {
|
|
263
264
|
(0, generate_toast_1.generateToast)({
|
|
264
|
-
description:
|
|
265
|
+
description: tCommon("messagesNetworkError"),
|
|
265
266
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
|
|
266
267
|
});
|
|
267
268
|
}
|
|
268
269
|
if (data) {
|
|
269
270
|
(0, generate_toast_1.generateToast)({
|
|
270
|
-
description: t("
|
|
271
|
+
description: t("messagesPreferenceDeleted"),
|
|
271
272
|
variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS,
|
|
272
273
|
});
|
|
273
274
|
dispatch({
|
|
@@ -98,7 +98,8 @@ var useTaxState = function () {
|
|
|
98
98
|
var _a = (0, react_1.useReducer)(reducer_1.taxReducer, reducer_1.initialTaxState), state = _a[0], dispatch = _a[1];
|
|
99
99
|
var preferences = (0, context_1.usePreferenceStateContext)().preferences;
|
|
100
100
|
var theme = (0, next_themes_1.useTheme)().theme;
|
|
101
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
101
|
+
var t = (0, next_intl_1.useTranslations)("tax");
|
|
102
|
+
var tCommon = (0, next_intl_1.useTranslations)("common");
|
|
102
103
|
// ---------------------------------------------------------------------------
|
|
103
104
|
// DEBOUNCED VALUES
|
|
104
105
|
// ---------------------------------------------------------------------------
|
|
@@ -147,7 +148,7 @@ var useTaxState = function () {
|
|
|
147
148
|
var listCallback = (0, react_1.useCallback)(function (_a) {
|
|
148
149
|
var data = _a.data, error = _a.error;
|
|
149
150
|
if (error) {
|
|
150
|
-
showErrorToast(
|
|
151
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
151
152
|
}
|
|
152
153
|
if (data === null || data === void 0 ? void 0 : data.items) {
|
|
153
154
|
dispatch({
|
|
@@ -159,14 +160,14 @@ var useTaxState = function () {
|
|
|
159
160
|
payload: { count: data === null || data === void 0 ? void 0 : data.count },
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
|
-
}, [showErrorToast,
|
|
163
|
+
}, [showErrorToast, tCommon]);
|
|
163
164
|
var updateCallback = (0, react_1.useCallback)(function (_a) {
|
|
164
165
|
var data = _a.data, error = _a.error;
|
|
165
166
|
if (error) {
|
|
166
|
-
showErrorToast(
|
|
167
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
167
168
|
}
|
|
168
169
|
if (data) {
|
|
169
|
-
showSuccessToast(t("
|
|
170
|
+
showSuccessToast(t("messagesTaxUpdated"));
|
|
170
171
|
dispatch({
|
|
171
172
|
type: actions_1.TAX_ACTION_TYPES.RESET_FORM,
|
|
172
173
|
});
|
|
@@ -178,11 +179,11 @@ var useTaxState = function () {
|
|
|
178
179
|
payload: { drawer: null },
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
|
-
}, [showErrorToast, showSuccessToast, t]);
|
|
182
|
+
}, [showErrorToast, showSuccessToast, t, tCommon]);
|
|
182
183
|
var byIdCallback = (0, react_1.useCallback)(function (_a) {
|
|
183
184
|
var data = _a.data, error = _a.error;
|
|
184
185
|
if (error) {
|
|
185
|
-
showErrorToast(
|
|
186
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
186
187
|
}
|
|
187
188
|
if (data) {
|
|
188
189
|
dispatch({
|
|
@@ -194,19 +195,19 @@ var useTaxState = function () {
|
|
|
194
195
|
payload: { drawer: types_1.TAX_DRAWER.FORM_DRAWER },
|
|
195
196
|
});
|
|
196
197
|
}
|
|
197
|
-
}, [showErrorToast,
|
|
198
|
+
}, [showErrorToast, tCommon]);
|
|
198
199
|
var deleteCallback = (0, react_1.useCallback)(function (_a) {
|
|
199
200
|
var data = _a.data, error = _a.error;
|
|
200
201
|
if (error) {
|
|
201
|
-
showErrorToast(
|
|
202
|
+
showErrorToast(tCommon("messagesNetworkError"));
|
|
202
203
|
}
|
|
203
204
|
if (data) {
|
|
204
|
-
showSuccessToast(t("
|
|
205
|
+
showSuccessToast(t("messagesTaxDeleted"));
|
|
205
206
|
dispatch({
|
|
206
207
|
type: actions_1.TAX_ACTION_TYPES.RESET_FORM,
|
|
207
208
|
});
|
|
208
209
|
}
|
|
209
|
-
}, [showErrorToast, showSuccessToast, t]);
|
|
210
|
+
}, [showErrorToast, showSuccessToast, t, tCommon]);
|
|
210
211
|
// ---------------------------------------------------------------------------
|
|
211
212
|
// MODULE ENTITY HOOK
|
|
212
213
|
// ---------------------------------------------------------------------------
|
|
@@ -334,7 +335,7 @@ var useTaxState = function () {
|
|
|
334
335
|
{
|
|
335
336
|
enabled: true,
|
|
336
337
|
handleOnClick: handleCreate,
|
|
337
|
-
label: "
|
|
338
|
+
label: t("actionsButtonAddItem"),
|
|
338
339
|
order: 1,
|
|
339
340
|
},
|
|
340
341
|
];
|
|
@@ -352,13 +353,13 @@ var useTaxState = function () {
|
|
|
352
353
|
{
|
|
353
354
|
enabled: true,
|
|
354
355
|
handleAction: handleEdit,
|
|
355
|
-
label: "
|
|
356
|
+
label: t("actionsButtonEdit"),
|
|
356
357
|
order: 1,
|
|
357
358
|
},
|
|
358
359
|
{
|
|
359
360
|
enabled: true,
|
|
360
361
|
handleAction: handleDelete,
|
|
361
|
-
label: "
|
|
362
|
+
label: t("actionsButtonDelete"),
|
|
362
363
|
order: 2,
|
|
363
364
|
},
|
|
364
365
|
];
|
|
@@ -34,7 +34,7 @@ var drawer_1 = require("./drawer");
|
|
|
34
34
|
*/
|
|
35
35
|
var Tax = function () {
|
|
36
36
|
var _a = (0, context_1.useTaxStateContext)(), count = _a.count, currentPage = _a.currentPage, handleNextClick = _a.handleNextClick, handlePageLimit = _a.handlePageLimit, handlePreviousClick = _a.handlePreviousClick, headerActions = _a.headerActions, listLoading = _a.listLoading, pageLimit = _a.pageLimit, rowActions = _a.rowActions, searchQuery = _a.searchQuery, taxes = _a.taxes, searchOnChange = _a.searchOnChange;
|
|
37
|
-
var t = (0, next_intl_1.useTranslations)("
|
|
37
|
+
var t = (0, next_intl_1.useTranslations)("tax");
|
|
38
38
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
39
39
|
// ============================================================================
|
|
40
40
|
// TRANSLATION MAPPING
|
|
@@ -120,7 +120,7 @@ var Tax = function () {
|
|
|
120
120
|
react_1.default.createElement("div", { className: "flex items-center justify-between ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
121
121
|
react_1.default.createElement("div", null),
|
|
122
122
|
react_1.default.createElement(theme_switcher_1.ThemeSwitcher, null)),
|
|
123
|
-
react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "tax-search", searchPlaceholder: t("
|
|
123
|
+
react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "tax-search", searchPlaceholder: t("tableSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: taxes, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: Number(totalPages) }),
|
|
124
124
|
react_1.default.createElement(drawer_1.TaxDrawer, { translationMap: translationMap, isRTL: isRTL }),
|
|
125
125
|
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
126
126
|
};
|
package/package.json
CHANGED