@appcorp/stellar-solutions-modules 0.1.34 → 0.1.35
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/README.md +128 -19
- package/components/theme-switcher.d.ts +4 -0
- package/components/theme-switcher.js +60 -0
- package/components/ui/badge.d.ts +9 -0
- package/components/ui/badge.js +82 -0
- package/components/ui/button.d.ts +10 -0
- package/components/ui/button.js +91 -0
- package/components/ui/checkbox.d.ts +9 -0
- package/components/ui/checkbox.js +87 -0
- package/components/ui/drawer.d.ts +13 -0
- package/components/ui/drawer.js +115 -0
- package/components/ui/dropdown-menu.d.ts +25 -0
- package/components/ui/dropdown-menu.js +148 -0
- package/components/ui/enhanced-table-footer-action.d.ts +34 -0
- package/components/ui/enhanced-table-footer-action.js +117 -0
- package/components/ui/enhanced-table-footer-page.d.ts +32 -0
- package/components/ui/enhanced-table-footer-page.js +140 -0
- package/components/ui/enhanced-table-footer-pagination.d.ts +38 -0
- package/components/ui/enhanced-table-footer-pagination.js +122 -0
- package/components/ui/enhanced-table-header-action.d.ts +7 -0
- package/components/ui/enhanced-table-header-action.js +21 -0
- package/components/ui/enhanced-table-header-search.d.ts +12 -0
- package/components/ui/enhanced-table-header-search.js +17 -0
- package/components/ui/enhanced-table.d.ts +65 -0
- package/components/ui/enhanced-table.js +87 -0
- package/components/ui/input.d.ts +8 -0
- package/components/ui/input.js +86 -0
- package/components/ui/label.d.ts +7 -0
- package/components/ui/label.js +68 -0
- package/components/ui/popover.d.ts +7 -0
- package/components/ui/popover.js +82 -0
- package/components/ui/select.d.ts +15 -0
- package/components/ui/select.js +127 -0
- package/components/ui/sonner.d.ts +4 -0
- package/components/ui/sonner.js +54 -0
- package/components/ui/switch.d.ts +9 -0
- package/components/ui/switch.js +89 -0
- package/components/ui/table.d.ts +10 -0
- package/components/ui/table.js +101 -0
- package/global-modules/bank/actions.d.ts +200 -0
- package/global-modules/bank/actions.js +124 -0
- package/global-modules/bank/bank.d.ts +2 -0
- package/global-modules/bank/bank.js +87 -0
- package/global-modules/bank/constants.d.ts +45 -0
- package/global-modules/bank/constants.js +98 -0
- package/global-modules/bank/context.d.ts +41 -0
- package/global-modules/bank/context.js +419 -0
- package/global-modules/bank/drawer.d.ts +31 -0
- package/global-modules/bank/drawer.js +114 -0
- package/global-modules/bank/form.d.ts +22 -0
- package/global-modules/bank/form.js +68 -0
- package/global-modules/bank/reducer.d.ts +25 -0
- package/global-modules/bank/reducer.js +161 -0
- package/global-modules/bank/types.d.ts +217 -0
- package/global-modules/bank/types.js +81 -0
- package/global-modules/bank/validate.d.ts +13 -0
- package/global-modules/bank/validate.js +22 -0
- package/global-modules/branch/actions.d.ts +154 -37
- package/global-modules/branch/actions.js +148 -6
- package/global-modules/branch/branch.d.ts +2 -2
- package/global-modules/branch/branch.js +46 -32
- package/global-modules/branch/constants.d.ts +34 -24
- package/global-modules/branch/constants.js +101 -122
- package/global-modules/branch/context.d.ts +33 -2
- package/global-modules/branch/context.js +195 -164
- package/global-modules/branch/drawer.d.ts +26 -3
- package/global-modules/branch/drawer.js +101 -6
- package/global-modules/branch/form.d.ts +15 -1
- package/global-modules/branch/form.js +54 -71
- package/global-modules/branch/reducer.d.ts +23 -2
- package/global-modules/branch/reducer.js +148 -118
- package/global-modules/branch/types.d.ts +196 -69
- package/global-modules/branch/types.js +66 -7
- package/global-modules/branch/validate.d.ts +1 -1
- package/global-modules/branch/validate.js +15 -11
- package/global-modules/payment-mode/actions.d.ts +154 -37
- package/global-modules/payment-mode/actions.js +148 -6
- package/global-modules/payment-mode/constants.d.ts +34 -17
- package/global-modules/payment-mode/constants.js +90 -66
- package/global-modules/payment-mode/context.d.ts +33 -2
- package/global-modules/payment-mode/context.js +185 -163
- package/global-modules/payment-mode/drawer.d.ts +26 -3
- package/global-modules/payment-mode/drawer.js +104 -9
- package/global-modules/payment-mode/form.d.ts +16 -2
- package/global-modules/payment-mode/form.js +45 -74
- package/global-modules/payment-mode/payment-mode.d.ts +25 -2
- package/global-modules/payment-mode/payment-mode.js +90 -23
- package/global-modules/payment-mode/reducer.d.ts +23 -2
- package/global-modules/payment-mode/reducer.js +140 -114
- package/global-modules/payment-mode/types.d.ts +327 -112
- package/global-modules/payment-mode/types.js +162 -11
- package/global-modules/payment-mode/validate.d.ts +1 -1
- package/global-modules/payment-mode/validate.js +7 -5
- package/global-modules/preferences/actions.d.ts +126 -27
- package/global-modules/preferences/actions.js +128 -4
- package/global-modules/preferences/constants.d.ts +46 -31
- package/global-modules/preferences/constants.js +129 -66
- package/global-modules/preferences/context.d.ts +2 -2
- package/global-modules/preferences/context.js +43 -43
- package/global-modules/preferences/currency.js +15 -10
- package/global-modules/preferences/preferences.d.ts +2 -2
- package/global-modules/preferences/preferences.js +3 -5
- package/global-modules/preferences/validate.d.ts +1 -1
- package/global-modules/preferences/validate.js +7 -7
- package/global-modules/tax/actions.d.ts +155 -38
- package/global-modules/tax/actions.js +149 -7
- package/global-modules/tax/constants.d.ts +31 -39
- package/global-modules/tax/constants.js +83 -114
- package/global-modules/tax/context.d.ts +33 -2
- package/global-modules/tax/context.js +146 -132
- package/global-modules/tax/drawer.d.ts +26 -3
- package/global-modules/tax/drawer.js +101 -6
- package/global-modules/tax/form.d.ts +20 -3
- package/global-modules/tax/form.js +101 -74
- package/global-modules/tax/reducer.d.ts +23 -2
- package/global-modules/tax/reducer.js +143 -24
- package/global-modules/tax/tax.d.ts +25 -2
- package/global-modules/tax/tax.js +92 -28
- package/global-modules/tax/types.d.ts +332 -102
- package/global-modules/tax/types.js +179 -11
- package/global-modules/tax/validate.d.ts +1 -1
- package/global-modules/tax/validate.js +9 -8
- package/hooks/use-rtl.d.ts +44 -0
- package/hooks/use-rtl.js +75 -0
- package/lib/themes.d.ts +147 -0
- package/lib/themes.js +150 -0
- package/lib/toast-utils.d.ts +44 -0
- package/lib/toast-utils.js +212 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +12 -0
- package/package.json +21 -4
- package/supabase/supabase.d.ts +80 -1
- package/supabase/supabase.js +281 -6
- package/global-modules/branch/form-elements.d.ts +0 -3
- package/global-modules/branch/form-elements.js +0 -41
- package/global-modules/payment-mode/form-elements.d.ts +0 -3
- package/global-modules/payment-mode/form-elements.js +0 -41
- package/global-modules/preferences/bank.d.ts +0 -2
- package/global-modules/preferences/bank.js +0 -11
- package/global-modules/preferences/branch-drawer.js +0 -36
- package/global-modules/preferences/branch-form-elements.js +0 -30
- package/global-modules/preferences/branch-form.d.ts +0 -0
- package/global-modules/preferences/branch-form.js +0 -33
- package/global-modules/preferences/branch.d.ts +0 -0
- package/global-modules/preferences/branch.js +0 -106
- package/global-modules/preferences/payment-mode-drawer.d.ts +0 -0
- package/global-modules/preferences/payment-mode-drawer.js +0 -36
- package/global-modules/preferences/payment-mode-form-elements.d.ts +0 -0
- package/global-modules/preferences/payment-mode-form-elements.js +0 -30
- package/global-modules/preferences/payment-mode-form.d.ts +0 -0
- package/global-modules/preferences/payment-mode-form.js +0 -33
- package/global-modules/preferences/payment-mode.d.ts +0 -0
- package/global-modules/preferences/payment-mode.js +0 -94
- package/global-modules/tax/form-elements.d.ts +0 -3
- package/global-modules/tax/form-elements.js +0 -41
- /package/{global-modules/preferences/branch-drawer.d.ts → constants.d.ts} +0 -0
- /package/{global-modules/preferences/branch-form-elements.d.ts → constants.js} +0 -0
|
@@ -1,18 +1,160 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Payment Mode Actions
|
|
4
|
+
*
|
|
5
|
+
* This module defines all action types and interfaces for the Payment Mode state management.
|
|
6
|
+
* Actions are organized by functionality and follow consistent naming patterns.
|
|
7
|
+
*
|
|
8
|
+
* Organization:
|
|
9
|
+
* - Action Types Enum (grouped by functionality)
|
|
10
|
+
* - Reset Actions (form/error reset)
|
|
11
|
+
* - Form Data Actions (input fields, form state)
|
|
12
|
+
* - UI State Actions (drawers, buttons)
|
|
13
|
+
* - List Management Actions (payment modes, pagination)
|
|
14
|
+
* - Search Actions (queries)
|
|
15
|
+
* - Union Type Export
|
|
16
|
+
* - Action Creators (helper functions)
|
|
17
|
+
* - Type Utilities (guards and helpers)
|
|
18
|
+
*
|
|
19
|
+
* Naming Convention: PaymentMode{Operation}{Target}Action
|
|
20
|
+
* Examples: PaymentModeSetInputFieldAction, PaymentModeResetFormAction
|
|
21
|
+
*/
|
|
2
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PAYMENT_MODE_ACTION_TYPES = void 0;
|
|
23
|
+
exports.isResetAction = exports.isPaymentModeAction = exports.paymentModeActionCreators = exports.PAYMENT_MODE_ACTION_TYPES = void 0;
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// ACTION TYPES ENUM
|
|
26
|
+
// ============================================================================
|
|
4
27
|
var PAYMENT_MODE_ACTION_TYPES;
|
|
5
28
|
(function (PAYMENT_MODE_ACTION_TYPES) {
|
|
29
|
+
// Reset Actions
|
|
6
30
|
PAYMENT_MODE_ACTION_TYPES["RESET_ERRORS"] = "RESET_ERRORS";
|
|
7
31
|
PAYMENT_MODE_ACTION_TYPES["RESET_FORM"] = "RESET_FORM";
|
|
32
|
+
// Form Data Actions
|
|
33
|
+
PAYMENT_MODE_ACTION_TYPES["SET_INPUT_FIELD"] = "SET_INPUT_FIELD";
|
|
34
|
+
PAYMENT_MODE_ACTION_TYPES["SET_FORM"] = "SET_FORM";
|
|
35
|
+
PAYMENT_MODE_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
|
|
36
|
+
// UI State Actions
|
|
37
|
+
PAYMENT_MODE_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
|
|
38
|
+
PAYMENT_MODE_ACTION_TYPES["SET_DRAWER"] = "SET_DRAWER";
|
|
39
|
+
// List Management Actions
|
|
8
40
|
PAYMENT_MODE_ACTION_TYPES["SET_PAYMENT_MODES"] = "SET_PAYMENT_MODES";
|
|
9
41
|
PAYMENT_MODE_ACTION_TYPES["SET_COUNT"] = "SET_COUNT";
|
|
10
42
|
PAYMENT_MODE_ACTION_TYPES["SET_CURRENT_PAGE"] = "SET_CURRENT_PAGE";
|
|
11
|
-
PAYMENT_MODE_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
|
|
12
|
-
PAYMENT_MODE_ACTION_TYPES["SET_DRAWER"] = "SET_DRAWER";
|
|
13
|
-
PAYMENT_MODE_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
|
|
14
|
-
PAYMENT_MODE_ACTION_TYPES["SET_FORM"] = "SET_FORM";
|
|
15
|
-
PAYMENT_MODE_ACTION_TYPES["SET_INPUT_FIELD"] = "SET_INPUT_FIELD";
|
|
16
43
|
PAYMENT_MODE_ACTION_TYPES["SET_PAGE_LIMIT"] = "SET_PAGE_LIMIT";
|
|
44
|
+
// Search Actions
|
|
17
45
|
PAYMENT_MODE_ACTION_TYPES["SET_SEARCH_QUERY"] = "SET_SEARCH_QUERY";
|
|
18
46
|
})(PAYMENT_MODE_ACTION_TYPES || (exports.PAYMENT_MODE_ACTION_TYPES = PAYMENT_MODE_ACTION_TYPES = {}));
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// ACTION CREATORS (Optional Helper Functions)
|
|
49
|
+
// ============================================================================
|
|
50
|
+
/**
|
|
51
|
+
* Action creators for common payment mode operations
|
|
52
|
+
* These provide type-safe action creation with better developer experience
|
|
53
|
+
*/
|
|
54
|
+
exports.paymentModeActionCreators = {
|
|
55
|
+
// Reset Actions
|
|
56
|
+
resetErrors: function () { return ({
|
|
57
|
+
type: PAYMENT_MODE_ACTION_TYPES.RESET_ERRORS,
|
|
58
|
+
}); },
|
|
59
|
+
resetForm: function () { return ({
|
|
60
|
+
type: PAYMENT_MODE_ACTION_TYPES.RESET_FORM,
|
|
61
|
+
}); },
|
|
62
|
+
// Form Actions
|
|
63
|
+
setInputField: function (key, value) { return ({
|
|
64
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
65
|
+
payload: { key: key, value: value },
|
|
66
|
+
}); },
|
|
67
|
+
setForm: function (form) { return ({
|
|
68
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_FORM,
|
|
69
|
+
payload: { form: form },
|
|
70
|
+
}); },
|
|
71
|
+
setErrors: function (errors) { return ({
|
|
72
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_ERRORS,
|
|
73
|
+
payload: { errors: errors },
|
|
74
|
+
}); },
|
|
75
|
+
// UI Actions
|
|
76
|
+
setDisableSaveButton: function (disableSaveButton) { return ({
|
|
77
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
78
|
+
payload: { disableSaveButton: disableSaveButton },
|
|
79
|
+
}); },
|
|
80
|
+
setDrawer: function (drawer) { return ({
|
|
81
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_DRAWER,
|
|
82
|
+
payload: { drawer: drawer },
|
|
83
|
+
}); },
|
|
84
|
+
// List Actions
|
|
85
|
+
setPaymentModes: function (paymentModes) { return ({
|
|
86
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_PAYMENT_MODES,
|
|
87
|
+
payload: { paymentModes: paymentModes },
|
|
88
|
+
}); },
|
|
89
|
+
setCount: function (count) { return ({
|
|
90
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_COUNT,
|
|
91
|
+
payload: { count: count },
|
|
92
|
+
}); },
|
|
93
|
+
setCurrentPage: function (currentPage) { return ({
|
|
94
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
95
|
+
payload: { currentPage: currentPage },
|
|
96
|
+
}); },
|
|
97
|
+
setPageLimit: function (pageLimit) { return ({
|
|
98
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_PAGE_LIMIT,
|
|
99
|
+
payload: { pageLimit: pageLimit },
|
|
100
|
+
}); },
|
|
101
|
+
// Search Actions
|
|
102
|
+
setSearchQuery: function (searchQuery) { return ({
|
|
103
|
+
type: PAYMENT_MODE_ACTION_TYPES.SET_SEARCH_QUERY,
|
|
104
|
+
payload: { searchQuery: searchQuery },
|
|
105
|
+
}); },
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Runtime type guards for action validation
|
|
109
|
+
*/
|
|
110
|
+
var isPaymentModeAction = function (action) {
|
|
111
|
+
return (typeof action === "object" &&
|
|
112
|
+
action !== null &&
|
|
113
|
+
"type" in action &&
|
|
114
|
+
Object.values(PAYMENT_MODE_ACTION_TYPES).includes(action.type));
|
|
115
|
+
};
|
|
116
|
+
exports.isPaymentModeAction = isPaymentModeAction;
|
|
117
|
+
/**
|
|
118
|
+
* Type guard for reset actions
|
|
119
|
+
*/
|
|
120
|
+
var isResetAction = function (action) {
|
|
121
|
+
return (action.type === PAYMENT_MODE_ACTION_TYPES.RESET_ERRORS ||
|
|
122
|
+
action.type === PAYMENT_MODE_ACTION_TYPES.RESET_FORM);
|
|
123
|
+
};
|
|
124
|
+
exports.isResetAction = isResetAction;
|
|
125
|
+
// ============================================================================
|
|
126
|
+
// OPTIMIZATION SUMMARY
|
|
127
|
+
// ============================================================================
|
|
128
|
+
/*
|
|
129
|
+
* Actions File Optimizations Applied:
|
|
130
|
+
*
|
|
131
|
+
* 1. **Structural Organization**
|
|
132
|
+
* - Grouped action types by functionality in enum
|
|
133
|
+
* - Organized action interfaces into logical sections with clear headers
|
|
134
|
+
* - Added comprehensive JSDoc documentation for each action
|
|
135
|
+
*
|
|
136
|
+
* 2. **Type Safety Improvements**
|
|
137
|
+
* - Used Record<string, string> instead of generic object for errors
|
|
138
|
+
* - Added helper type guards for different action categories
|
|
139
|
+
* - Improved union type organization with comments
|
|
140
|
+
*
|
|
141
|
+
* 3. **Developer Experience**
|
|
142
|
+
* - Added action creator functions for type-safe action creation
|
|
143
|
+
* - Comprehensive JSDoc comments for all actions and sections
|
|
144
|
+
* - Clear naming conventions following PaymentMode{Operation}{Target}Action pattern
|
|
145
|
+
*
|
|
146
|
+
* 4. **Code Quality**
|
|
147
|
+
* - Logical grouping of related actions by functionality
|
|
148
|
+
* - Consistent formatting and structure
|
|
149
|
+
* - Self-documenting code with clear purpose and organization
|
|
150
|
+
*
|
|
151
|
+
* 5. **Maintainability**
|
|
152
|
+
* - Easy to locate specific action types by section
|
|
153
|
+
* - Clear relationship between actions and their purposes
|
|
154
|
+
* - Modular structure for future extensions
|
|
155
|
+
*
|
|
156
|
+
* 6. **Performance Benefits**
|
|
157
|
+
* - Enum-based action types for better bundling
|
|
158
|
+
* - Type-safe action creators prevent runtime errors
|
|
159
|
+
* - Clear type relationships for better IDE support and intellisense
|
|
160
|
+
*/
|
|
@@ -1,19 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Payment Mode Constants
|
|
3
|
+
*
|
|
4
|
+
* This module defines all constants used throughout the Payment Mode module.
|
|
5
|
+
* Constants are organized by functionality and follow consistent naming patterns.
|
|
6
|
+
*
|
|
7
|
+
* Organization:
|
|
8
|
+
* - Page Configuration (pagination, limits)
|
|
9
|
+
* - API Routes (backend endpoints)
|
|
10
|
+
* - Table Configuration (column definitions)
|
|
11
|
+
* - Form Configuration (form elements and schema)
|
|
12
|
+
*
|
|
13
|
+
* Naming Convention: Descriptive names with clear purpose
|
|
14
|
+
*/
|
|
15
|
+
import { VISTA_TABLE_CELL_TYPE } from "@appcorp/app-corp-vista/type/vista-table-type";
|
|
16
|
+
/**
|
|
17
|
+
* Default page limit for pagination
|
|
18
|
+
*/
|
|
3
19
|
export declare const pageLimit: number;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
key: string;
|
|
8
|
-
} | {
|
|
9
|
-
componentType: VISTA_TABLE_CELL_TYPE;
|
|
10
|
-
key?: undefined;
|
|
11
|
-
})[];
|
|
20
|
+
/**
|
|
21
|
+
* API endpoints for payment mode operations
|
|
22
|
+
*/
|
|
12
23
|
export declare const PAYMENT_MODE_API_ROUTES: {
|
|
13
|
-
PAYMENT_MODE:
|
|
14
|
-
PAYMENT_MODES:
|
|
15
|
-
PAYMENT_MODE_BY_ID:
|
|
24
|
+
readonly PAYMENT_MODE: "/api/payment-mode";
|
|
25
|
+
readonly PAYMENT_MODES: "/api/payment-modes";
|
|
26
|
+
readonly PAYMENT_MODE_BY_ID: "/api/payment-mode/payment-mode-by-id";
|
|
16
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Table column definitions for payment mode listing
|
|
30
|
+
*/
|
|
31
|
+
export declare const tableBodyCols: {
|
|
32
|
+
componentType: VISTA_TABLE_CELL_TYPE;
|
|
33
|
+
key: string;
|
|
34
|
+
}[];
|
|
35
|
+
/**
|
|
36
|
+
* Toast error messages for user feedback
|
|
37
|
+
*/
|
|
17
38
|
export declare const toastErrors: {
|
|
18
39
|
fetchInvoiceError: string;
|
|
19
40
|
formSubmittedSuccess: string;
|
|
@@ -22,7 +43,3 @@ export declare const toastErrors: {
|
|
|
22
43
|
submitFormError: string;
|
|
23
44
|
validationError: string;
|
|
24
45
|
};
|
|
25
|
-
export declare const validationError: {
|
|
26
|
-
label: string;
|
|
27
|
-
preferenceId: string;
|
|
28
|
-
};
|
|
@@ -1,91 +1,115 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Payment Mode Constants
|
|
4
|
+
*
|
|
5
|
+
* This module defines all constants used throughout the Payment Mode module.
|
|
6
|
+
* Constants are organized by functionality and follow consistent naming patterns.
|
|
7
|
+
*
|
|
8
|
+
* Organization:
|
|
9
|
+
* - Page Configuration (pagination, limits)
|
|
10
|
+
* - API Routes (backend endpoints)
|
|
11
|
+
* - Table Configuration (column definitions)
|
|
12
|
+
* - Form Configuration (form elements and schema)
|
|
13
|
+
*
|
|
14
|
+
* Naming Convention: Descriptive names with clear purpose
|
|
15
|
+
*/
|
|
3
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
|
|
17
|
+
exports.toastErrors = exports.tableBodyCols = exports.PAYMENT_MODE_API_ROUTES = exports.pageLimit = void 0;
|
|
6
18
|
var vista_table_type_1 = require("@appcorp/app-corp-vista/type/vista-table-type");
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// PAGE CONFIGURATION
|
|
21
|
+
// ============================================================================
|
|
22
|
+
/**
|
|
23
|
+
* Default page limit for pagination
|
|
24
|
+
*/
|
|
7
25
|
exports.pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
id: 'enabled',
|
|
26
|
-
enabled: true,
|
|
27
|
-
value: false,
|
|
28
|
-
order: 6,
|
|
29
|
-
handleOnChange: function () { return void 0; },
|
|
30
|
-
label: 'Enabled',
|
|
31
|
-
required: true,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 'isDefault',
|
|
35
|
-
enabled: true,
|
|
36
|
-
value: false,
|
|
37
|
-
order: 7,
|
|
38
|
-
handleOnChange: function () { return void 0; },
|
|
39
|
-
label: 'IsDefault',
|
|
40
|
-
required: true,
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
_a);
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// API ROUTES
|
|
28
|
+
// ============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* API endpoints for payment mode operations
|
|
31
|
+
*/
|
|
32
|
+
exports.PAYMENT_MODE_API_ROUTES = {
|
|
33
|
+
PAYMENT_MODE: "/api/payment-mode",
|
|
34
|
+
PAYMENT_MODES: "/api/payment-modes",
|
|
35
|
+
PAYMENT_MODE_BY_ID: "/api/payment-mode/payment-mode-by-id",
|
|
36
|
+
};
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// TABLE CONFIGURATION
|
|
39
|
+
// ============================================================================
|
|
40
|
+
/**
|
|
41
|
+
* Table column definitions for payment mode listing
|
|
42
|
+
*/
|
|
44
43
|
exports.tableBodyCols = [
|
|
45
44
|
{
|
|
46
45
|
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ID,
|
|
47
|
-
key:
|
|
46
|
+
key: "id",
|
|
48
47
|
},
|
|
49
48
|
{
|
|
50
49
|
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOLD_TEXT,
|
|
51
|
-
key:
|
|
50
|
+
key: "label",
|
|
52
51
|
},
|
|
53
52
|
{
|
|
54
53
|
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
|
|
55
|
-
key:
|
|
54
|
+
key: "enabled",
|
|
56
55
|
},
|
|
57
56
|
{
|
|
58
57
|
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
|
|
59
|
-
key:
|
|
58
|
+
key: "isDefault",
|
|
60
59
|
},
|
|
61
60
|
{
|
|
62
|
-
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.
|
|
61
|
+
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
|
|
62
|
+
key: "createdAt",
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ACTIONS,
|
|
66
|
+
key: "action",
|
|
66
67
|
},
|
|
67
68
|
];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
PAYMENT_MODE_BY_ID: '/api/payment-mode/payment-mode-by-id',
|
|
72
|
-
};
|
|
69
|
+
/**
|
|
70
|
+
* Toast error messages for user feedback
|
|
71
|
+
*/
|
|
73
72
|
exports.toastErrors = {
|
|
74
|
-
fetchInvoiceError:
|
|
75
|
-
formSubmittedSuccess:
|
|
76
|
-
genericError:
|
|
77
|
-
networkError:
|
|
78
|
-
submitFormError:
|
|
79
|
-
validationError:
|
|
80
|
-
};
|
|
81
|
-
// export const dashboardTabsMap: { [key: string]: ReactNode } = {
|
|
82
|
-
// 'Currency': <Currency />,
|
|
83
|
-
// 'Payment Mode': <PaymentMode />,
|
|
84
|
-
// 'Branch': <Branch />,
|
|
85
|
-
// 'Tax': <Tax />,
|
|
86
|
-
// 'Bank': <Bank />,
|
|
87
|
-
// };
|
|
88
|
-
exports.validationError = {
|
|
89
|
-
label: 'Label is required',
|
|
90
|
-
preferenceId: 'Preference Id is also required',
|
|
73
|
+
fetchInvoiceError: "Error Fetching Invoice",
|
|
74
|
+
formSubmittedSuccess: "Form Submitted Successfully",
|
|
75
|
+
genericError: "Something Went Wrong",
|
|
76
|
+
networkError: "Network Error Occurred",
|
|
77
|
+
submitFormError: "Error Submitting Form",
|
|
78
|
+
validationError: "Validation Failed",
|
|
91
79
|
};
|
|
80
|
+
// ============================================================================
|
|
81
|
+
// OPTIMIZATION SUMMARY
|
|
82
|
+
// ============================================================================
|
|
83
|
+
/*
|
|
84
|
+
* Constants File Optimizations Applied:
|
|
85
|
+
*
|
|
86
|
+
* 1. **Structural Organization**
|
|
87
|
+
* - Grouped constants by functionality with clear section headers
|
|
88
|
+
* - Added comprehensive JSDoc documentation for each section
|
|
89
|
+
* - Organized imports alphabetically and logically
|
|
90
|
+
*
|
|
91
|
+
* 2. **Internationalization**
|
|
92
|
+
* - Moved validation error messages to messages/en.json for i18n support
|
|
93
|
+
* - Moved toast messages to messages/en.json for i18n support
|
|
94
|
+
* - Kept only technical constants in this file
|
|
95
|
+
*
|
|
96
|
+
* 3. **Type Safety Improvements**
|
|
97
|
+
* - Added 'as const' assertion to API routes for better type inference
|
|
98
|
+
* - Used descriptive naming conventions
|
|
99
|
+
* - Maintained type safety for all exported constants
|
|
100
|
+
*
|
|
101
|
+
* 4. **Code Quality**
|
|
102
|
+
* - Logical grouping of related constants
|
|
103
|
+
* - Consistent formatting and structure
|
|
104
|
+
* - Self-documenting code with clear purpose
|
|
105
|
+
*
|
|
106
|
+
* 5. **Maintainability**
|
|
107
|
+
* - Easy to locate specific constants by section
|
|
108
|
+
* - Clear relationship between constants and their purposes
|
|
109
|
+
* - Modular structure for future extensions
|
|
110
|
+
*
|
|
111
|
+
* 6. **Performance Benefits**
|
|
112
|
+
* - Constants are evaluated once at module load time
|
|
113
|
+
* - No runtime overhead for constant access
|
|
114
|
+
* - Better tree-shaking potential with organized exports
|
|
115
|
+
*/
|
|
@@ -1,5 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Payment Mode State Context
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive state management for the Payment Mode feature including:
|
|
5
|
+
* - CRUD operations (create, read, update, delete)
|
|
6
|
+
* - Form validation and error handling
|
|
7
|
+
* - Search and filtering functionality
|
|
8
|
+
* - Pagination controls
|
|
9
|
+
* - Internationalization support
|
|
10
|
+
* - Theme-aware toast notifications
|
|
11
|
+
*
|
|
12
|
+
* Organization:
|
|
13
|
+
* - Types & Interfaces
|
|
14
|
+
* - Main Hook (usePaymentModeState)
|
|
15
|
+
* - State & Core Hooks
|
|
16
|
+
* - Debounced Values
|
|
17
|
+
* - API Parameters (memoized)
|
|
18
|
+
* - API Callbacks (with error handling)
|
|
19
|
+
* - Module Entity Hook
|
|
20
|
+
* - Effects (list refresh)
|
|
21
|
+
* - Drawer & Modal Handlers
|
|
22
|
+
* - CRUD Operation Handlers
|
|
23
|
+
* - Form Handlers
|
|
24
|
+
* - Pagination Handlers
|
|
25
|
+
* - Search Handlers
|
|
26
|
+
* - Table Actions (memoized)
|
|
27
|
+
* - Return State
|
|
28
|
+
* - Context Setup
|
|
29
|
+
* - Provider Component
|
|
30
|
+
* - Custom Hook
|
|
31
|
+
*/
|
|
32
|
+
import React, { FC, ReactNode } from "react";
|
|
33
|
+
import { PaymentModeContextType, PaymentModeState } from "./types";
|
|
3
34
|
type State = PaymentModeContextType & PaymentModeState;
|
|
4
35
|
interface StateProviderProps {
|
|
5
36
|
children: ReactNode;
|