@appcorp/stellar-solutions-modules 0.1.53 → 0.1.55
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/global-modules/bank/bank.js +4 -8
- package/global-modules/bank/context.js +15 -14
- package/global-modules/bank/drawer.js +2 -2
- package/global-modules/bank/form.js +2 -2
- package/global-modules/bank/types.d.ts +1 -1
- package/global-modules/branch/branch.js +3 -7
- package/global-modules/branch/constants.d.ts +0 -11
- package/global-modules/branch/constants.js +1 -15
- package/global-modules/branch/context.js +16 -15
- package/global-modules/branch/drawer.js +2 -2
- package/global-modules/branch/form.js +2 -2
- package/global-modules/branch/types.d.ts +1 -1
- package/global-modules/payment-mode/context.js +16 -15
- package/global-modules/payment-mode/drawer.js +2 -2
- package/global-modules/payment-mode/form.js +2 -2
- package/global-modules/payment-mode/payment-mode.js +16 -20
- package/global-modules/payment-mode/types.d.ts +1 -1
- package/global-modules/preferences/context.js +14 -13
- package/global-modules/preferences/currency.js +2 -2
- package/global-modules/tax/context.js +16 -15
- package/global-modules/tax/drawer.js +2 -2
- package/global-modules/tax/form.js +2 -2
- package/global-modules/tax/tax.js +4 -8
- package/global-modules/tax/types.d.ts +1 -1
- package/index.d.ts +0 -30
- package/index.js +0 -46
- package/lib/toast-utils.d.ts +0 -44
- package/lib/toast-utils.js +240 -212
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +5 -12
- package/package.json +6 -7
- package/components/theme-provider.d.ts +0 -9
- package/components/theme-provider.js +0 -122
- package/components/theme-switcher.d.ts +0 -4
- package/components/theme-switcher.js +0 -60
- package/components/ui/badge.d.ts +0 -9
- package/components/ui/badge.js +0 -82
- package/components/ui/button.d.ts +0 -10
- package/components/ui/button.js +0 -91
- package/components/ui/card.d.ts +0 -9
- package/components/ui/card.js +0 -94
- package/components/ui/carousel.d.ts +0 -19
- package/components/ui/carousel.js +0 -168
- package/components/ui/checkbox.d.ts +0 -9
- package/components/ui/checkbox.js +0 -87
- package/components/ui/combobox.d.ts +0 -70
- package/components/ui/combobox.js +0 -315
- package/components/ui/command.d.ts +0 -18
- package/components/ui/command.js +0 -115
- package/components/ui/dialog.d.ts +0 -15
- package/components/ui/dialog.js +0 -118
- package/components/ui/drawer.d.ts +0 -13
- package/components/ui/drawer.js +0 -115
- package/components/ui/dropdown-menu.d.ts +0 -25
- package/components/ui/dropdown-menu.js +0 -148
- package/components/ui/enhanced-dropzone.d.ts +0 -21
- package/components/ui/enhanced-dropzone.js +0 -187
- package/components/ui/enhanced-table-footer-action.d.ts +0 -34
- package/components/ui/enhanced-table-footer-action.js +0 -117
- package/components/ui/enhanced-table-footer-page.d.ts +0 -32
- package/components/ui/enhanced-table-footer-page.js +0 -140
- package/components/ui/enhanced-table-footer-pagination.d.ts +0 -36
- package/components/ui/enhanced-table-footer-pagination.js +0 -122
- package/components/ui/enhanced-table-header-action.d.ts +0 -7
- package/components/ui/enhanced-table-header-action.js +0 -21
- package/components/ui/enhanced-table-header-search.d.ts +0 -12
- package/components/ui/enhanced-table-header-search.js +0 -17
- package/components/ui/enhanced-table.d.ts +0 -75
- package/components/ui/enhanced-table.js +0 -196
- package/components/ui/form.d.ts +0 -24
- package/components/ui/form.js +0 -125
- package/components/ui/input.d.ts +0 -8
- package/components/ui/input.js +0 -86
- package/components/ui/label.d.ts +0 -7
- package/components/ui/label.js +0 -68
- package/components/ui/popover.d.ts +0 -7
- package/components/ui/popover.js +0 -82
- package/components/ui/select.d.ts +0 -15
- package/components/ui/select.js +0 -127
- package/components/ui/separator.d.ts +0 -4
- package/components/ui/separator.js +0 -66
- package/components/ui/shadcn-io/color-picker/index.d.ts +0 -43
- package/components/ui/shadcn-io/color-picker/index.js +0 -304
- package/components/ui/shadcn-io/dropzone/index.d.ts +0 -19
- package/components/ui/shadcn-io/dropzone/index.js +0 -131
- package/components/ui/sonner.d.ts +0 -4
- package/components/ui/sonner.js +0 -54
- package/components/ui/switch.d.ts +0 -9
- package/components/ui/switch.js +0 -89
- package/components/ui/table.d.ts +0 -10
- package/components/ui/table.js +0 -101
- package/components/ui/textarea.d.ts +0 -8
- package/components/ui/textarea.js +0 -86
|
@@ -8,15 +8,14 @@ var react_1 = __importDefault(require("react"));
|
|
|
8
8
|
var next_intl_1 = require("next-intl");
|
|
9
9
|
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
10
10
|
var use_rtl_1 = require("../../hooks/use-rtl");
|
|
11
|
-
var enhanced_table_1 = require("
|
|
12
|
-
var sonner_1 = require("
|
|
13
|
-
var theme_switcher_1 = require("../../components/theme-switcher");
|
|
11
|
+
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
12
|
+
var sonner_1 = require("@appcorp/shadcn/components/sonner");
|
|
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 () {
|
|
17
|
+
var t = (0, next_intl_1.useTranslations)("bank");
|
|
18
18
|
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)("bankPage");
|
|
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
|
};
|
|
@@ -84,7 +84,7 @@ var util_functions_1 = require("@react-pakistan/util-functions");
|
|
|
84
84
|
var actions_1 = require("./actions");
|
|
85
85
|
var constants_1 = require("./constants");
|
|
86
86
|
var reducer_1 = require("./reducer");
|
|
87
|
-
var toast_utils_1 = require("
|
|
87
|
+
var toast_utils_1 = require("@appcorp/shadcn/lib/toast-utils");
|
|
88
88
|
var types_1 = require("./types");
|
|
89
89
|
var validate_1 = require("./validate");
|
|
90
90
|
var context_1 = require("../preferences/context");
|
|
@@ -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]);
|
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.BankDrawer = void 0;
|
|
27
27
|
var react_1 = __importDefault(require("react"));
|
|
28
28
|
var lucide_react_1 = require("lucide-react");
|
|
29
|
-
var button_1 = require("
|
|
30
|
-
var drawer_1 = require("
|
|
29
|
+
var button_1 = require("@appcorp/shadcn/components/button");
|
|
30
|
+
var drawer_1 = require("@appcorp/shadcn/components/drawer");
|
|
31
31
|
var context_1 = require("./context");
|
|
32
32
|
var form_1 = require("./form");
|
|
33
33
|
// ============================================================================
|
|
@@ -19,8 +19,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.Form = void 0;
|
|
20
20
|
var react_1 = __importDefault(require("react"));
|
|
21
21
|
var next_intl_1 = require("next-intl");
|
|
22
|
-
var input_1 = require("
|
|
23
|
-
var switch_1 = require("
|
|
22
|
+
var input_1 = require("@appcorp/shadcn/components/input");
|
|
23
|
+
var switch_1 = require("@appcorp/shadcn/components/switch");
|
|
24
24
|
var context_1 = require("./context");
|
|
25
25
|
var Form = function (_a) {
|
|
26
26
|
var isRTL = _a.isRTL, translationMap = _a.translationMap;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* - Types: PascalCase following interface conventions
|
|
24
24
|
*/
|
|
25
25
|
import { Dispatch } from "react";
|
|
26
|
-
import { RowAction, HeaderAction } from "
|
|
26
|
+
import { RowAction, HeaderAction } from "@appcorp/shadcn/components/enhanced-table";
|
|
27
27
|
import { BankActions } from "./actions";
|
|
28
28
|
import { PreferenceBE as PreferenceTypeBE } from "@react-pakistan/util-functions/api/stellar-solutions/type";
|
|
29
29
|
/**
|
|
@@ -8,15 +8,14 @@ var react_1 = __importDefault(require("react"));
|
|
|
8
8
|
var next_intl_1 = require("next-intl");
|
|
9
9
|
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
10
10
|
var use_rtl_1 = require("../../hooks/use-rtl");
|
|
11
|
-
var enhanced_table_1 = require("
|
|
12
|
-
var sonner_1 = require("
|
|
13
|
-
var theme_switcher_1 = require("../../components/theme-switcher");
|
|
11
|
+
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
12
|
+
var sonner_1 = require("@appcorp/shadcn/components/sonner");
|
|
14
13
|
var constants_1 = require("./constants");
|
|
15
14
|
var context_1 = require("./context");
|
|
16
15
|
var drawer_1 = require("./drawer");
|
|
17
16
|
var Branch = function () {
|
|
18
17
|
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)("
|
|
18
|
+
var t = (0, next_intl_1.useTranslations)("branch");
|
|
20
19
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
21
20
|
var translationMap = {
|
|
22
21
|
formLabelBranchName: t("formLabelBranchName"),
|
|
@@ -73,9 +72,6 @@ var Branch = function () {
|
|
|
73
72
|
];
|
|
74
73
|
var totalPages = (0, util_functions_1.calculatePages)(count, pageLimit);
|
|
75
74
|
return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
76
|
-
react_1.default.createElement("div", { className: "flex items-center justify-between ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
77
|
-
react_1.default.createElement("div", null),
|
|
78
|
-
react_1.default.createElement(theme_switcher_1.ThemeSwitcher, null)),
|
|
79
75
|
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: "branch-search", searchPlaceholder: t("tableHeaderSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: branches, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: Number(totalPages) }),
|
|
80
76
|
react_1.default.createElement(drawer_1.BranchDrawer, { isRTL: isRTL, translationMap: translationMap }),
|
|
81
77
|
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
@@ -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
|
/*
|
|
@@ -84,7 +84,7 @@ var util_functions_1 = require("@react-pakistan/util-functions");
|
|
|
84
84
|
var actions_1 = require("./actions");
|
|
85
85
|
var constants_1 = require("./constants");
|
|
86
86
|
var reducer_1 = require("./reducer");
|
|
87
|
-
var toast_utils_1 = require("
|
|
87
|
+
var toast_utils_1 = require("@appcorp/shadcn/lib/toast-utils");
|
|
88
88
|
var types_1 = require("./types");
|
|
89
89
|
var validate_1 = require("./validate");
|
|
90
90
|
var context_1 = require("../preferences/context");
|
|
@@ -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]);
|
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.BranchDrawer = void 0;
|
|
27
27
|
var react_1 = __importDefault(require("react"));
|
|
28
28
|
var lucide_react_1 = require("lucide-react");
|
|
29
|
-
var button_1 = require("
|
|
30
|
-
var drawer_1 = require("
|
|
29
|
+
var button_1 = require("@appcorp/shadcn/components/button");
|
|
30
|
+
var drawer_1 = require("@appcorp/shadcn/components/drawer");
|
|
31
31
|
var context_1 = require("./context");
|
|
32
32
|
var form_1 = require("./form");
|
|
33
33
|
// ============================================================================
|
|
@@ -19,8 +19,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.Form = void 0;
|
|
20
20
|
var react_1 = __importDefault(require("react"));
|
|
21
21
|
var next_intl_1 = require("next-intl");
|
|
22
|
-
var input_1 = require("
|
|
23
|
-
var switch_1 = require("
|
|
22
|
+
var input_1 = require("@appcorp/shadcn/components/input");
|
|
23
|
+
var switch_1 = require("@appcorp/shadcn/components/switch");
|
|
24
24
|
var context_1 = require("./context");
|
|
25
25
|
var Form = function (_a) {
|
|
26
26
|
var isRTL = _a.isRTL, translationMap = _a.translationMap;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* - Types: PascalCase following interface conventions
|
|
24
24
|
*/
|
|
25
25
|
import { Dispatch } from "react";
|
|
26
|
-
import { RowAction, HeaderAction } from "
|
|
26
|
+
import { RowAction, HeaderAction } from "@appcorp/shadcn/components/enhanced-table";
|
|
27
27
|
import { BranchActions } from "./actions";
|
|
28
28
|
/**
|
|
29
29
|
* Branch Context Interface
|
|
@@ -84,7 +84,7 @@ var util_functions_1 = require("@react-pakistan/util-functions");
|
|
|
84
84
|
var actions_1 = require("./actions");
|
|
85
85
|
var constants_1 = require("./constants");
|
|
86
86
|
var reducer_1 = require("./reducer");
|
|
87
|
-
var toast_utils_1 = require("
|
|
87
|
+
var toast_utils_1 = require("@appcorp/shadcn/lib/toast-utils");
|
|
88
88
|
var types_1 = require("./types");
|
|
89
89
|
var validate_1 = require("./validate");
|
|
90
90
|
var context_1 = require("../preferences/context");
|
|
@@ -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]);
|
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.PaymentModeDrawer = void 0;
|
|
27
27
|
var react_1 = __importDefault(require("react"));
|
|
28
28
|
var lucide_react_1 = require("lucide-react");
|
|
29
|
-
var button_1 = require("
|
|
30
|
-
var drawer_1 = require("
|
|
29
|
+
var button_1 = require("@appcorp/shadcn/components/button");
|
|
30
|
+
var drawer_1 = require("@appcorp/shadcn/components/drawer");
|
|
31
31
|
var context_1 = require("./context");
|
|
32
32
|
var form_1 = require("./form");
|
|
33
33
|
// ============================================================================
|
|
@@ -19,8 +19,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.PaymentModeForm = void 0;
|
|
20
20
|
var react_1 = __importDefault(require("react"));
|
|
21
21
|
var next_intl_1 = require("next-intl");
|
|
22
|
-
var input_1 = require("
|
|
23
|
-
var switch_1 = require("
|
|
22
|
+
var input_1 = require("@appcorp/shadcn/components/input");
|
|
23
|
+
var switch_1 = require("@appcorp/shadcn/components/switch");
|
|
24
24
|
var context_1 = require("./context");
|
|
25
25
|
var PaymentModeForm = function (_a) {
|
|
26
26
|
var isRTL = _a.isRTL, translationMap = _a.translationMap;
|
|
@@ -9,9 +9,8 @@ var react_1 = __importDefault(require("react"));
|
|
|
9
9
|
var next_intl_1 = require("next-intl");
|
|
10
10
|
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
11
11
|
var use_rtl_1 = require("../../hooks/use-rtl");
|
|
12
|
-
var enhanced_table_1 = require("
|
|
13
|
-
var sonner_1 = require("
|
|
14
|
-
var theme_switcher_1 = require("../../components/theme-switcher");
|
|
12
|
+
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
13
|
+
var sonner_1 = require("@appcorp/shadcn/components/sonner");
|
|
15
14
|
var constants_1 = require("./constants");
|
|
16
15
|
var context_1 = require("./context");
|
|
17
16
|
var drawer_1 = require("./drawer");
|
|
@@ -34,7 +33,7 @@ var drawer_1 = require("./drawer");
|
|
|
34
33
|
*/
|
|
35
34
|
var PaymentMode = function () {
|
|
36
35
|
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)("
|
|
36
|
+
var t = (0, next_intl_1.useTranslations)("paymentMode");
|
|
38
37
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
39
38
|
// ============================================================================
|
|
40
39
|
// TRANSLATION MAPPING
|
|
@@ -43,7 +42,7 @@ var PaymentMode = function () {
|
|
|
43
42
|
// Form Labels
|
|
44
43
|
formLabelLabel: t("formLabelLabel"),
|
|
45
44
|
// Drawer
|
|
46
|
-
|
|
45
|
+
drawerTitleCreate: t("drawerTitleCreate"),
|
|
47
46
|
headingFormCreate: t("headingFormCreate"),
|
|
48
47
|
srCloseDrawer: t("srCloseDrawer"),
|
|
49
48
|
cancelBtn: t("cancelBtn"),
|
|
@@ -60,18 +59,18 @@ var PaymentMode = function () {
|
|
|
60
59
|
enableDescription: t("enableDescription"),
|
|
61
60
|
defaultDescription: t("defaultDescription"),
|
|
62
61
|
// Messages
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
messagePaymentModeDeleted: t("
|
|
66
|
-
|
|
67
|
-
messageDeletingPaymentMode: t("
|
|
68
|
-
messageLoadingPaymentModes: t("
|
|
69
|
-
messageSuccess: t("
|
|
70
|
-
messageError: t("
|
|
62
|
+
messagesRecordCreated: t("messagesRecordCreated"),
|
|
63
|
+
messagesRecordUpdated: t("messagesRecordUpdated"),
|
|
64
|
+
messagePaymentModeDeleted: t("messagesPaymentModeDeleted"),
|
|
65
|
+
messagesRecordDeleted: t("messagesRecordDeleted"),
|
|
66
|
+
messageDeletingPaymentMode: t("messagesDeletingPaymentMode"),
|
|
67
|
+
messageLoadingPaymentModes: t("messagesLoadingPaymentModes"),
|
|
68
|
+
messageSuccess: t("messagesSuccess"),
|
|
69
|
+
messageError: t("messagesError"),
|
|
71
70
|
// Validation
|
|
72
|
-
validationLabelRequired: t("
|
|
73
|
-
validationPreferenceIdRequired: t("
|
|
74
|
-
validationFormGeneralError: t("
|
|
71
|
+
validationLabelRequired: t("validationLabelRequired"),
|
|
72
|
+
validationPreferenceIdRequired: t("validationPreferenceIdRequired"),
|
|
73
|
+
validationFormGeneralError: t("validationFormGeneralError"),
|
|
75
74
|
};
|
|
76
75
|
// ============================================================================
|
|
77
76
|
// TABLE CONFIGURATION
|
|
@@ -110,10 +109,7 @@ var PaymentMode = function () {
|
|
|
110
109
|
// RENDER
|
|
111
110
|
// ============================================================================
|
|
112
111
|
return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
113
|
-
react_1.default.createElement(
|
|
114
|
-
react_1.default.createElement("div", null),
|
|
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("tableHeaderSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: paymentModes, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: Number(totalPages) }),
|
|
112
|
+
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
113
|
react_1.default.createElement(drawer_1.PaymentModeDrawer, { isRTL: isRTL, translationMap: translationMap }),
|
|
118
114
|
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
119
115
|
};
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* - Types: PascalCase following interface conventions
|
|
24
24
|
*/
|
|
25
25
|
import { Dispatch } from "react";
|
|
26
|
-
import { RowAction, HeaderAction } from "
|
|
26
|
+
import { RowAction, HeaderAction } from "@appcorp/shadcn/components/enhanced-table";
|
|
27
27
|
import { PaymentModeActions } from "./actions";
|
|
28
28
|
/**
|
|
29
29
|
* Payment Mode Context Interface
|