@appcorp/stellar-solutions-modules 0.1.54 → 0.1.56
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.d.ts +7 -1
- package/global-modules/bank/bank.js +8 -22
- package/global-modules/bank/constants.js +5 -5
- package/global-modules/bank/context.js +40 -42
- package/global-modules/bank/drawer.d.ts +0 -4
- package/global-modules/bank/drawer.js +10 -8
- package/global-modules/bank/form.d.ts +0 -3
- package/global-modules/bank/form.js +18 -15
- package/global-modules/bank/types.d.ts +1 -1
- package/global-modules/bank/validate.js +2 -2
- package/global-modules/branch/branch.d.ts +7 -1
- package/global-modules/branch/branch.js +8 -22
- package/global-modules/branch/constants.js +1 -1
- package/global-modules/branch/context.js +36 -22
- package/global-modules/branch/drawer.d.ts +0 -4
- package/global-modules/branch/drawer.js +10 -8
- package/global-modules/branch/form.d.ts +0 -3
- package/global-modules/branch/form.js +13 -14
- package/global-modules/branch/types.d.ts +1 -1
- package/global-modules/branch/validate.js +6 -6
- package/global-modules/payment-mode/constants.js +1 -1
- package/global-modules/payment-mode/context.js +8 -10
- package/global-modules/payment-mode/drawer.d.ts +0 -4
- package/global-modules/payment-mode/drawer.js +10 -8
- package/global-modules/payment-mode/form.d.ts +0 -3
- package/global-modules/payment-mode/form.js +8 -9
- package/global-modules/payment-mode/payment-mode.d.ts +1 -1
- package/global-modules/payment-mode/payment-mode.js +40 -44
- package/global-modules/payment-mode/types.d.ts +1 -1
- package/global-modules/payment-mode/validate.js +2 -2
- package/global-modules/preferences/constants.d.ts +0 -4
- package/global-modules/preferences/constants.js +14 -17
- package/global-modules/preferences/currency.js +2 -2
- package/global-modules/preferences/preferences.js +2 -6
- package/global-modules/tax/constants.js +1 -1
- package/global-modules/tax/context.js +6 -3
- package/global-modules/tax/drawer.d.ts +0 -4
- package/global-modules/tax/drawer.js +10 -8
- package/global-modules/tax/form.d.ts +0 -4
- package/global-modules/tax/form.js +8 -9
- package/global-modules/tax/tax.d.ts +1 -1
- package/global-modules/tax/tax.js +39 -43
- 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 -35
- package/components/ui/enhanced-table-footer-action.js +0 -110
- package/components/ui/enhanced-table-footer-page.d.ts +0 -34
- package/components/ui/enhanced-table-footer-page.js +0 -132
- package/components/ui/enhanced-table-footer-pagination.d.ts +0 -38
- package/components/ui/enhanced-table-footer-pagination.js +0 -116
- 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 -87
- package/components/ui/enhanced-table.js +0 -221
- 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
|
@@ -4,14 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.PaymentModePage = void 0;
|
|
8
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");
|
|
@@ -32,47 +31,47 @@ var drawer_1 = require("./drawer");
|
|
|
32
31
|
*
|
|
33
32
|
* @param params - Route parameters containing locale information
|
|
34
33
|
*/
|
|
35
|
-
var
|
|
34
|
+
var PaymentModePage = 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
36
|
var t = (0, next_intl_1.useTranslations)("paymentMode");
|
|
38
37
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
39
38
|
// ============================================================================
|
|
40
39
|
// TRANSLATION MAPPING
|
|
41
40
|
// ============================================================================
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
};
|
|
41
|
+
// const translationMap = {
|
|
42
|
+
// // Form Labels
|
|
43
|
+
// formLabelLabel: t("formLabelLabel"),
|
|
44
|
+
// // Drawer
|
|
45
|
+
// drawerTitleCreate: t("drawerTitleCreate"),
|
|
46
|
+
// headingFormCreate: t("headingFormCreate"),
|
|
47
|
+
// srCloseDrawer: t("srCloseDrawer"),
|
|
48
|
+
// cancelBtn: t("cancelBtn"),
|
|
49
|
+
// saveBtn: t("saveBtn"),
|
|
50
|
+
// // Actions
|
|
51
|
+
// addItem: t("addItem"),
|
|
52
|
+
// edit: t("edit"),
|
|
53
|
+
// delete: t("delete"),
|
|
54
|
+
// // Form Settings
|
|
55
|
+
// settings: t("settings"),
|
|
56
|
+
// enabled: t("enabled"),
|
|
57
|
+
// isDefault: t("isDefault"),
|
|
58
|
+
// setAsDefault: t("setAsDefault"),
|
|
59
|
+
// enableDescription: t("enableDescription"),
|
|
60
|
+
// defaultDescription: t("defaultDescription"),
|
|
61
|
+
// // Messages
|
|
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"),
|
|
70
|
+
// // Validation
|
|
71
|
+
// validationLabelRequired: t("validationLabelRequired"),
|
|
72
|
+
// validationPreferenceIdRequired: t("validationPreferenceIdRequired"),
|
|
73
|
+
// validationFormGeneralError: t("validationFormGeneralError"),
|
|
74
|
+
// };
|
|
76
75
|
// ============================================================================
|
|
77
76
|
// TABLE CONFIGURATION
|
|
78
77
|
// ============================================================================
|
|
@@ -110,11 +109,8 @@ 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("div", { className: "flex items-center justify-between ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
114
|
-
react_1.default.createElement("div", null),
|
|
115
|
-
react_1.default.createElement(theme_switcher_1.ThemeSwitcher, null)),
|
|
116
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
|
-
react_1.default.createElement(drawer_1.PaymentModeDrawer, { isRTL: isRTL
|
|
113
|
+
react_1.default.createElement(drawer_1.PaymentModeDrawer, { isRTL: isRTL }),
|
|
118
114
|
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
119
115
|
};
|
|
120
|
-
exports.
|
|
116
|
+
exports.PaymentModePage = PaymentModePage;
|
|
@@ -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
|
|
@@ -4,8 +4,8 @@ exports.formValidation = void 0;
|
|
|
4
4
|
var zod_1 = require("zod");
|
|
5
5
|
// Validation error keys for i18n translation
|
|
6
6
|
var VALIDATION_KEYS = {
|
|
7
|
-
labelRequired: "
|
|
8
|
-
preferenceIdRequired: "
|
|
7
|
+
labelRequired: "validationLabelRequired",
|
|
8
|
+
preferenceIdRequired: "validationPreferenceIdRequired",
|
|
9
9
|
};
|
|
10
10
|
exports.formValidation = zod_1.z.object({
|
|
11
11
|
label: zod_1.z.string().nonempty(VALIDATION_KEYS.labelRequired),
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Naming Convention: Descriptive names with clear purpose
|
|
14
14
|
*/
|
|
15
|
-
import { ReactNode } from "react";
|
|
16
15
|
/**
|
|
17
16
|
* Default page limit for pagination
|
|
18
17
|
*/
|
|
@@ -51,6 +50,3 @@ export declare const initialMenuItems: {
|
|
|
51
50
|
* Mapping of dashboard tab names to their corresponding React components
|
|
52
51
|
* Used for dynamic rendering of preference management sections
|
|
53
52
|
*/
|
|
54
|
-
export declare const dashboardTabsMap: {
|
|
55
|
-
[key: string]: ReactNode;
|
|
56
|
-
};
|
|
@@ -13,17 +13,14 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Naming Convention: Descriptive names with clear purpose
|
|
15
15
|
*/
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
exports.initialMenuItems = exports.PREFERENCE_API_ROUTES = exports.pageLimit = void 0;
|
|
18
|
+
// import React, { ReactNode } from "react";
|
|
19
|
+
// import { Currency } from "./currency";
|
|
20
|
+
// import { PaymentModePage } from "../payment-mode/payment-mode";
|
|
21
|
+
// import { BranchPage } from "../branch/branch";
|
|
22
|
+
// import { TaxPage } from "../tax/tax";
|
|
23
|
+
// import { BankPage } from "../bank/bank";
|
|
27
24
|
// ============================================================================
|
|
28
25
|
// PAGE CONFIGURATION
|
|
29
26
|
// ============================================================================
|
|
@@ -117,13 +114,13 @@ exports.initialMenuItems = [
|
|
|
117
114
|
* Mapping of dashboard tab names to their corresponding React components
|
|
118
115
|
* Used for dynamic rendering of preference management sections
|
|
119
116
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
117
|
+
// export const dashboardTabsMap: { [key: string]: ReactNode } = {
|
|
118
|
+
// Currency: <Currency />,
|
|
119
|
+
// "Payment Mode": <PaymentModePage />,
|
|
120
|
+
// Branch: <BranchPage params={{}} />,
|
|
121
|
+
// Tax: <TaxPage params={{}} />,
|
|
122
|
+
// Bank: <BankPage params={{}} />,
|
|
123
|
+
// };
|
|
127
124
|
// ============================================================================
|
|
128
125
|
// OPTIMIZATION SUMMARY
|
|
129
126
|
// ============================================================================
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Currency = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
9
|
-
var checkbox_1 = require("
|
|
10
|
-
var button_1 = require("
|
|
9
|
+
var checkbox_1 = require("@appcorp/shadcn/components/checkbox");
|
|
10
|
+
var button_1 = require("@appcorp/shadcn/components/button");
|
|
11
11
|
var context_1 = require("./context");
|
|
12
12
|
var outline_1 = require("@heroicons/react/24/outline");
|
|
13
13
|
var Currency = function () {
|
|
@@ -6,15 +6,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.PreferencesPage = void 0;
|
|
8
8
|
var react_1 = __importDefault(require("react"));
|
|
9
|
-
|
|
9
|
+
// import { usePreferenceStateContext } from "./context";
|
|
10
10
|
var generate_toast_1 = require("@appcorp/app-corp-vista/utils/generate-toast");
|
|
11
|
-
var vista_dashboard_tabs_v1_1 = require("@appcorp/app-corp-vista/molecules/vista-dashboard-tabs-v1/vista-dashboard-tabs-v1");
|
|
12
|
-
var constants_1 = require("./constants");
|
|
13
11
|
var PreferencesPage = function () {
|
|
14
|
-
|
|
12
|
+
// const { headerTabs, activeTab } = usePreferenceStateContext();
|
|
15
13
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
16
|
-
react_1.default.createElement(vista_dashboard_tabs_v1_1.VistaDashboardTabsV1, { headerTabs: headerTabs, heading: "Heading" },
|
|
17
|
-
react_1.default.createElement("div", { className: "pt-4" }, constants_1.dashboardTabsMap[activeTab])),
|
|
18
14
|
react_1.default.createElement(generate_toast_1.VistaToaster, null)));
|
|
19
15
|
};
|
|
20
16
|
exports.PreferencesPage = PreferencesPage;
|
|
@@ -85,7 +85,7 @@ var actions_1 = require("./actions");
|
|
|
85
85
|
var constants_1 = require("./constants");
|
|
86
86
|
var reducer_1 = require("./reducer");
|
|
87
87
|
var types_1 = require("./types");
|
|
88
|
-
var toast_utils_1 = require("
|
|
88
|
+
var toast_utils_1 = require("@appcorp/shadcn/lib/toast-utils");
|
|
89
89
|
var validate_1 = require("./validate");
|
|
90
90
|
var context_1 = require("../preferences/context");
|
|
91
91
|
// ============================================================================
|
|
@@ -149,6 +149,7 @@ var useTaxState = function () {
|
|
|
149
149
|
var data = _a.data, error = _a.error;
|
|
150
150
|
if (error) {
|
|
151
151
|
showErrorToast(tCommon("messagesNetworkError"));
|
|
152
|
+
return;
|
|
152
153
|
}
|
|
153
154
|
if (data === null || data === void 0 ? void 0 : data.items) {
|
|
154
155
|
dispatch({
|
|
@@ -184,6 +185,7 @@ var useTaxState = function () {
|
|
|
184
185
|
var data = _a.data, error = _a.error;
|
|
185
186
|
if (error) {
|
|
186
187
|
showErrorToast(tCommon("messagesNetworkError"));
|
|
188
|
+
return;
|
|
187
189
|
}
|
|
188
190
|
if (data) {
|
|
189
191
|
dispatch({
|
|
@@ -200,6 +202,7 @@ var useTaxState = function () {
|
|
|
200
202
|
var data = _a.data, error = _a.error;
|
|
201
203
|
if (error) {
|
|
202
204
|
showErrorToast(tCommon("messagesNetworkError"));
|
|
205
|
+
return;
|
|
203
206
|
}
|
|
204
207
|
if (data) {
|
|
205
208
|
showSuccessToast(t("messagesTaxDeleted"));
|
|
@@ -219,7 +222,7 @@ var useTaxState = function () {
|
|
|
219
222
|
listCallback: listCallback,
|
|
220
223
|
listParams: listParams,
|
|
221
224
|
listUrl: constants_1.TAX_API_ROUTES.TAXES,
|
|
222
|
-
searchQuery:
|
|
225
|
+
searchQuery: debouncedQuery,
|
|
223
226
|
unitByIdUrl: constants_1.TAX_API_ROUTES.TAX_BY_ID,
|
|
224
227
|
unitUrl: constants_1.TAX_API_ROUTES.TAX,
|
|
225
228
|
updateCallback: updateCallback,
|
|
@@ -231,7 +234,7 @@ var useTaxState = function () {
|
|
|
231
234
|
// ---------------------------------------------------------------------------
|
|
232
235
|
(0, react_1.useEffect)(function () {
|
|
233
236
|
listFetchNow();
|
|
234
|
-
// eslint-disable-next-line
|
|
237
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
235
238
|
}, [debouncedQuery, state.currentPage, state.pageLimit]);
|
|
236
239
|
// ---------------------------------------------------------------------------
|
|
237
240
|
// DRAWER & MODAL HANDLERS
|
|
@@ -22,10 +22,6 @@ import { FC } from "react";
|
|
|
22
22
|
interface TaxDrawerProps {
|
|
23
23
|
/** Whether the interface is in RTL (Right-to-Left) mode */
|
|
24
24
|
isRTL: boolean;
|
|
25
|
-
/** Translation map for internationalization */
|
|
26
|
-
translationMap: {
|
|
27
|
-
[key: string]: string;
|
|
28
|
-
};
|
|
29
25
|
}
|
|
30
26
|
export declare const TaxDrawer: FC<TaxDrawerProps>;
|
|
31
27
|
export {};
|
|
@@ -26,10 +26,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.TaxDrawer = 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
|
+
var next_intl_1 = require("next-intl");
|
|
33
34
|
// ============================================================================
|
|
34
35
|
// CONSTANTS
|
|
35
36
|
// ============================================================================
|
|
@@ -43,10 +44,11 @@ var getDrawerDirection = function (isRTL) {
|
|
|
43
44
|
// COMPONENT
|
|
44
45
|
// ============================================================================
|
|
45
46
|
var TaxDrawer = function (_a) {
|
|
47
|
+
var isRTL = _a.isRTL;
|
|
48
|
+
var t = (0, next_intl_1.useTranslations)("tax");
|
|
46
49
|
// ============================================================================
|
|
47
50
|
// HOOKS & STATE
|
|
48
51
|
// ============================================================================
|
|
49
|
-
var isRTL = _a.isRTL, translationMap = _a.translationMap;
|
|
50
52
|
var _b = (0, context_1.useTaxStateContext)(), closeDrawer = _b.closeDrawer, disableSaveButton = _b.disableSaveButton, drawer = _b.drawer, handleSubmit = _b.handleSubmit;
|
|
51
53
|
// ============================================================================
|
|
52
54
|
// COMPUTED VALUES
|
|
@@ -59,17 +61,17 @@ var TaxDrawer = function (_a) {
|
|
|
59
61
|
return (react_1.default.createElement(drawer_1.Drawer, { open: isDrawerOpen, onOpenChange: function (open) { return !open && closeDrawer(); }, direction: drawerDirection },
|
|
60
62
|
react_1.default.createElement(drawer_1.DrawerContent, { className: "h-full ".concat(DRAWER_WIDTH, " ").concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
61
63
|
react_1.default.createElement(drawer_1.DrawerHeader, { className: "flex-row items-center justify-between border-b pb-4 ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
62
|
-
react_1.default.createElement(drawer_1.DrawerTitle, { className: "text-xl font-semibold flex items-center ".concat(isRTL ? "flex-row-reverse gap-2" : "gap-2") }, (
|
|
64
|
+
react_1.default.createElement(drawer_1.DrawerTitle, { className: "text-xl font-semibold flex items-center ".concat(isRTL ? "flex-row-reverse gap-2" : "gap-2") }, t("drawerTitleTax")),
|
|
63
65
|
react_1.default.createElement(drawer_1.DrawerClose, { asChild: true },
|
|
64
66
|
react_1.default.createElement(button_1.Button, { variant: "ghost", size: "icon", className: "h-8 w-8" },
|
|
65
67
|
react_1.default.createElement(lucide_react_1.X, { className: "h-4 w-4" }),
|
|
66
|
-
react_1.default.createElement("span", { className: "sr-only" }, (
|
|
68
|
+
react_1.default.createElement("span", { className: "sr-only" }, t("drawerButtonCancel"))))),
|
|
67
69
|
react_1.default.createElement("div", { className: "flex-1 overflow-y-auto px-4 py-6 ".concat(isRTL ? "text-right" : "text-left") },
|
|
68
|
-
react_1.default.createElement(form_1.TaxForm, {
|
|
70
|
+
react_1.default.createElement(form_1.TaxForm, { isRTL: isRTL })),
|
|
69
71
|
react_1.default.createElement(drawer_1.DrawerFooter, { className: "border-t pt-4" },
|
|
70
72
|
react_1.default.createElement("div", { className: "flex gap-2 ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
71
|
-
react_1.default.createElement(button_1.Button, { variant: "outline", onClick: closeDrawer, className: "flex-1", type: "button" }, (
|
|
72
|
-
react_1.default.createElement(button_1.Button, { onClick: handleSubmit, disabled: disableSaveButton, className: "flex-1", type: "button" }, (
|
|
73
|
+
react_1.default.createElement(button_1.Button, { variant: "outline", onClick: closeDrawer, className: "flex-1", type: "button" }, t("drawerButtonCancel")),
|
|
74
|
+
react_1.default.createElement(button_1.Button, { onClick: handleSubmit, disabled: disableSaveButton, className: "flex-1", type: "button" }, t("drawerButtonSave")))))));
|
|
73
75
|
};
|
|
74
76
|
exports.TaxDrawer = TaxDrawer;
|
|
75
77
|
// ============================================================================
|
|
@@ -16,10 +16,6 @@ import { FC } from "react";
|
|
|
16
16
|
interface TaxFormProps {
|
|
17
17
|
/** Whether the interface is in RTL (Right-to-Left) mode */
|
|
18
18
|
isRTL: boolean;
|
|
19
|
-
/** Translation map for internationalization */
|
|
20
|
-
translationMap: {
|
|
21
|
-
[key: string]: string;
|
|
22
|
-
};
|
|
23
19
|
}
|
|
24
20
|
export declare const TaxForm: FC<TaxFormProps>;
|
|
25
21
|
export {};
|
|
@@ -20,19 +20,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.TaxForm = void 0;
|
|
21
21
|
var react_1 = __importDefault(require("react"));
|
|
22
22
|
var next_intl_1 = require("next-intl");
|
|
23
|
-
var input_1 = require("
|
|
24
|
-
var switch_1 = require("
|
|
23
|
+
var input_1 = require("@appcorp/shadcn/components/input");
|
|
24
|
+
var switch_1 = require("@appcorp/shadcn/components/switch");
|
|
25
25
|
var context_1 = require("./context");
|
|
26
26
|
// ============================================================================
|
|
27
27
|
// COMPONENT
|
|
28
28
|
// ============================================================================
|
|
29
29
|
var TaxForm = function (_a) {
|
|
30
|
+
var isRTL = _a.isRTL;
|
|
31
|
+
var t = (0, next_intl_1.useTranslations)("tax");
|
|
30
32
|
// ============================================================================
|
|
31
33
|
// HOOKS & STATE
|
|
32
34
|
// ============================================================================
|
|
33
|
-
var isRTL = _a.isRTL, translationMap = _a.translationMap;
|
|
34
|
-
var t = (0, next_intl_1.useTranslations)("taxPage");
|
|
35
|
-
var ui = (0, next_intl_1.useTranslations)("ui");
|
|
36
35
|
var _b = (0, context_1.useTaxStateContext)(), taxName = _b.taxName, taxRate = _b.taxRate, enabled = _b.enabled, description = _b.description, errors = _b.errors, handleInputChange = _b.handleInputChange;
|
|
37
36
|
// ============================================================================
|
|
38
37
|
// HELPER FUNCTIONS
|
|
@@ -53,13 +52,13 @@ var TaxForm = function (_a) {
|
|
|
53
52
|
return (react_1.default.createElement("div", { className: "space-y-6 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
54
53
|
react_1.default.createElement("div", { className: "space-y-4" },
|
|
55
54
|
react_1.default.createElement("div", { className: "space-y-2" },
|
|
56
|
-
react_1.default.createElement(input_1.Input, { id: "taxName", type: "text", label:
|
|
55
|
+
react_1.default.createElement(input_1.Input, { id: "taxName", type: "text", label: t("formLabelTaxName"), value: taxName || "", onChange: function (e) { return handleInputChange("taxName", e.target.value); }, placeholder: t("formPlaceholderTaxName"), info: t("formInfoTaxName"), error: getTranslatedError("taxName"), required: true })),
|
|
57
56
|
react_1.default.createElement("div", { className: "space-y-2" },
|
|
58
|
-
react_1.default.createElement(input_1.Input, { id: "taxRate", type: "number", label:
|
|
57
|
+
react_1.default.createElement(input_1.Input, { id: "taxRate", type: "number", label: t("formLabelTaxRate"), value: taxRate || "", onChange: function (e) { return handleInputChange("taxRate", e.target.value); }, placeholder: t("formPlaceholderTaxRate"), info: t("formInfoTaxRate"), error: getTranslatedError("taxRate"), required: true })),
|
|
59
58
|
react_1.default.createElement("div", { className: "space-y-2" },
|
|
60
|
-
react_1.default.createElement(input_1.Input, { id: "description", type: "text", label:
|
|
59
|
+
react_1.default.createElement(input_1.Input, { id: "description", type: "text", label: t("formLabelDescription"), value: description || "", onChange: function (e) { return handleInputChange("description", e.target.value); }, placeholder: t("formPlaceholderDescription"), info: t("formInfoDescription") })),
|
|
61
60
|
react_1.default.createElement("div", { className: "space-y-4" },
|
|
62
|
-
react_1.default.createElement(switch_1.Switch, { id: "enabled", label:
|
|
61
|
+
react_1.default.createElement(switch_1.Switch, { id: "enabled", label: t("formLabelEnabled"), checked: enabled || false, onCheckedChange: function (checked) { return handleInputChange("enabled", checked); }, info: t("formInfoEnabled"), error: getTranslatedError("enabled") })))));
|
|
63
62
|
};
|
|
64
63
|
exports.TaxForm = TaxForm;
|
|
65
64
|
// ============================================================================
|
|
@@ -4,14 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.TaxPage = void 0;
|
|
8
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");
|
|
@@ -32,46 +31,46 @@ var drawer_1 = require("./drawer");
|
|
|
32
31
|
*
|
|
33
32
|
* @param params - Route parameters containing locale information
|
|
34
33
|
*/
|
|
35
|
-
var
|
|
34
|
+
var TaxPage = function () {
|
|
36
35
|
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
36
|
var t = (0, next_intl_1.useTranslations)("tax");
|
|
38
37
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
39
38
|
// ============================================================================
|
|
40
39
|
// TRANSLATION MAPPING
|
|
41
40
|
// ============================================================================
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
41
|
+
// const translationMap = {
|
|
42
|
+
// // Form Labels
|
|
43
|
+
// formLabelTaxName: t("formLabelTaxName"),
|
|
44
|
+
// formLabelTaxRate: t("formLabelTaxRate"),
|
|
45
|
+
// formLabelDescription: t("formLabelDescription"),
|
|
46
|
+
// // Drawer
|
|
47
|
+
// drawerTitleTax: t("headingFormEdit"),
|
|
48
|
+
// headingFormCreate: t("headingFormCreate"),
|
|
49
|
+
// srCloseDrawer: t("srCloseDrawer"),
|
|
50
|
+
// cancelBtn: t("cancelBtn"),
|
|
51
|
+
// saveBtn: t("saveBtn"),
|
|
52
|
+
// // Actions
|
|
53
|
+
// addItem: t("addItem"),
|
|
54
|
+
// edit: t("edit"),
|
|
55
|
+
// delete: t("delete"),
|
|
56
|
+
// // Form Settings
|
|
57
|
+
// settings: t("settings"),
|
|
58
|
+
// enabled: t("enabled"),
|
|
59
|
+
// enableDescription: t("enableDescription"),
|
|
60
|
+
// // Messages
|
|
61
|
+
// messageTaxCreated: t("messages.taxCreated"),
|
|
62
|
+
// messageTaxUpdated: t("messages.taxUpdated"),
|
|
63
|
+
// messageTaxDeleted: t("messages.taxDeleted"),
|
|
64
|
+
// messageSavingTax: t("messages.savingTax"),
|
|
65
|
+
// messageDeletingTax: t("messages.deletingTax"),
|
|
66
|
+
// messageLoadingTaxes: t("messages.loadingTaxes"),
|
|
67
|
+
// messageSuccess: t("messages.success"),
|
|
68
|
+
// messageError: t("messages.error"),
|
|
69
|
+
// // Validation
|
|
70
|
+
// validationTaxNameRequired: t("validation.taxNameRequired"),
|
|
71
|
+
// validationTaxRateRequired: t("validation.taxRateRequired"),
|
|
72
|
+
// validationFormGeneralError: t("validation.formGeneralError"),
|
|
73
|
+
// };
|
|
75
74
|
// ============================================================================
|
|
76
75
|
// TABLE CONFIGURATION
|
|
77
76
|
// ============================================================================
|
|
@@ -117,11 +116,8 @@ var Tax = function () {
|
|
|
117
116
|
// RENDER
|
|
118
117
|
// ============================================================================
|
|
119
118
|
return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
120
|
-
react_1.default.createElement("div", { className: "flex items-center justify-between ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
121
|
-
react_1.default.createElement("div", null),
|
|
122
|
-
react_1.default.createElement(theme_switcher_1.ThemeSwitcher, null)),
|
|
123
119
|
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
|
-
react_1.default.createElement(drawer_1.TaxDrawer, {
|
|
120
|
+
react_1.default.createElement(drawer_1.TaxDrawer, { isRTL: isRTL }),
|
|
125
121
|
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
126
122
|
};
|
|
127
|
-
exports.
|
|
123
|
+
exports.TaxPage = TaxPage;
|
|
@@ -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 { TaxActions } from "./actions";
|
|
28
28
|
/**
|
|
29
29
|
* Tax Context Interface
|
package/index.d.ts
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export * from "./components/theme-provider";
|
|
2
|
-
export * from "./components/theme-switcher";
|
|
3
|
-
export * from "./components/ui/badge";
|
|
4
|
-
export * from "./components/ui/button";
|
|
5
|
-
export * from "./components/ui/card";
|
|
6
|
-
export * from "./components/ui/carousel";
|
|
7
|
-
export * from "./components/ui/checkbox";
|
|
8
|
-
export * from "./components/ui/combobox";
|
|
9
|
-
export * from "./components/ui/command";
|
|
10
|
-
export * from "./components/ui/dialog";
|
|
11
|
-
export * from "./components/ui/drawer";
|
|
12
|
-
export * from "./components/ui/dropdown-menu";
|
|
13
|
-
export * from "./components/ui/enhanced-dropzone";
|
|
14
|
-
export * from "./components/ui/enhanced-table-footer-action";
|
|
15
|
-
export * from "./components/ui/enhanced-table-footer-page";
|
|
16
|
-
export * from "./components/ui/enhanced-table-footer-pagination";
|
|
17
|
-
export * from "./components/ui/enhanced-table-header-action";
|
|
18
|
-
export * from "./components/ui/enhanced-table-header-search";
|
|
19
|
-
export * from "./components/ui/enhanced-table";
|
|
20
|
-
export * from "./components/ui/form";
|
|
21
|
-
export * from "./components/ui/input";
|
|
22
|
-
export * from "./components/ui/label";
|
|
23
|
-
export * from "./components/ui/popover";
|
|
24
|
-
export * from "./components/ui/select";
|
|
25
|
-
export * from "./components/ui/separator";
|
|
26
|
-
export * from "./components/ui/shadcn-io/color-picker";
|
|
27
|
-
export * from "./components/ui/shadcn-io/dropzone";
|
|
28
|
-
export * from "./components/ui/sonner";
|
|
29
|
-
export * from "./components/ui/switch";
|
|
30
|
-
export * from "./components/ui/textarea";
|