@appcorp/stellar-solutions-modules 0.1.55 → 0.1.58
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 +5 -19
- package/global-modules/bank/constants.js +5 -5
- package/global-modules/bank/context.js +39 -41
- package/global-modules/bank/drawer.d.ts +0 -4
- package/global-modules/bank/drawer.js +8 -6
- package/global-modules/bank/form.d.ts +0 -3
- package/global-modules/bank/form.js +16 -13
- package/global-modules/bank/types.d.ts +2 -22
- package/global-modules/bank/validate.js +2 -2
- package/global-modules/branch/branch.d.ts +7 -1
- package/global-modules/branch/branch.js +6 -16
- package/global-modules/branch/constants.js +1 -1
- package/global-modules/branch/context.js +35 -21
- package/global-modules/branch/drawer.d.ts +0 -4
- package/global-modules/branch/drawer.js +8 -6
- package/global-modules/branch/form.d.ts +0 -3
- package/global-modules/branch/form.js +11 -12
- package/global-modules/branch/types.d.ts +9 -106
- package/global-modules/branch/validate.js +6 -6
- package/global-modules/currency/actions.d.ts +203 -0
- package/global-modules/currency/actions.js +153 -0
- package/global-modules/currency/constants.d.ts +33 -0
- package/global-modules/currency/constants.js +71 -0
- package/global-modules/currency/context.d.ts +41 -0
- package/global-modules/currency/context.js +422 -0
- package/global-modules/currency/currency.d.ts +8 -0
- package/global-modules/currency/currency.js +57 -0
- package/global-modules/currency/drawer.d.ts +27 -0
- package/global-modules/currency/drawer.js +76 -0
- package/global-modules/currency/form.d.ts +19 -0
- package/global-modules/currency/form.js +52 -0
- package/global-modules/currency/reducer.d.ts +25 -0
- package/global-modules/currency/reducer.js +153 -0
- package/global-modules/currency/types.d.ts +163 -0
- package/global-modules/currency/types.js +44 -0
- package/global-modules/currency/validate.d.ts +9 -0
- package/global-modules/currency/validate.js +18 -0
- package/global-modules/payment-mode/constants.js +1 -1
- package/global-modules/payment-mode/context.js +7 -9
- package/global-modules/payment-mode/drawer.d.ts +0 -4
- package/global-modules/payment-mode/drawer.js +8 -6
- package/global-modules/payment-mode/form.d.ts +0 -3
- package/global-modules/payment-mode/form.js +6 -7
- package/global-modules/payment-mode/payment-mode.d.ts +1 -1
- package/global-modules/payment-mode/payment-mode.js +38 -38
- package/global-modules/payment-mode/types.d.ts +12 -223
- package/global-modules/payment-mode/types.js +1 -9
- 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/context.js +2 -1
- package/global-modules/preferences/preferences.js +2 -6
- package/global-modules/preferences/types.d.ts +14 -240
- package/global-modules/preferences/types.js +3 -6
- package/global-modules/tax/constants.js +1 -1
- package/global-modules/tax/context.js +8 -4
- package/global-modules/tax/drawer.d.ts +0 -4
- package/global-modules/tax/drawer.js +8 -6
- package/global-modules/tax/form.d.ts +0 -4
- package/global-modules/tax/form.js +6 -7
- package/global-modules/tax/tax.d.ts +1 -1
- package/global-modules/tax/tax.js +37 -37
- package/global-modules/tax/types.d.ts +9 -254
- package/global-modules/tax/types.js +1 -9
- package/i18n/routing.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,67 +1,8 @@
|
|
|
1
|
-
import { PreferenceActions } from
|
|
2
|
-
import { Dispatch } from
|
|
3
|
-
import { VistaDashboardTabNavigatorListItem } from
|
|
4
|
-
import { Currency } from
|
|
5
|
-
|
|
6
|
-
preferenceId: string;
|
|
7
|
-
label: string;
|
|
8
|
-
order: number;
|
|
9
|
-
id: string;
|
|
10
|
-
}
|
|
11
|
-
export interface BankDetails {
|
|
12
|
-
accountTitle: string;
|
|
13
|
-
accountNumber: string;
|
|
14
|
-
iban: string;
|
|
15
|
-
id: string;
|
|
16
|
-
swiftCode: string;
|
|
17
|
-
bankAddress: string;
|
|
18
|
-
bankName: string;
|
|
19
|
-
preferenceId: string;
|
|
20
|
-
enabled: boolean;
|
|
21
|
-
errors: {
|
|
22
|
-
[key: string]: string;
|
|
23
|
-
};
|
|
24
|
-
createdAt?: string;
|
|
25
|
-
updatedAt?: string;
|
|
26
|
-
loading: boolean;
|
|
27
|
-
isDefault: boolean;
|
|
28
|
-
btnDisableBankDetail: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface Branches {
|
|
31
|
-
personName: string;
|
|
32
|
-
personEmail: string;
|
|
33
|
-
id: string;
|
|
34
|
-
personPhone: string;
|
|
35
|
-
branchAddress: string;
|
|
36
|
-
branchName: string;
|
|
37
|
-
preferenceId: string;
|
|
38
|
-
enabled: boolean;
|
|
39
|
-
errors: {
|
|
40
|
-
[key: string]: string;
|
|
41
|
-
};
|
|
42
|
-
createdAt?: string;
|
|
43
|
-
updatedAt?: string;
|
|
44
|
-
loading: boolean;
|
|
45
|
-
isDefault: boolean;
|
|
46
|
-
btnDisableBranches: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface Tax {
|
|
49
|
-
taxName: string;
|
|
50
|
-
taxValue: string;
|
|
51
|
-
id: string;
|
|
52
|
-
description: string;
|
|
53
|
-
preferenceId: string;
|
|
54
|
-
enabled: boolean;
|
|
55
|
-
errors: {
|
|
56
|
-
[key: string]: string;
|
|
57
|
-
};
|
|
58
|
-
createdAt?: string;
|
|
59
|
-
updatedAt?: string;
|
|
60
|
-
loading: boolean;
|
|
61
|
-
isDefault: boolean;
|
|
62
|
-
btnDisableTax: boolean;
|
|
63
|
-
}
|
|
64
|
-
export type TaxForm = Omit<TaxTypeBE, 'createdAt' | 'updatedAt' | 'preference'>;
|
|
1
|
+
import { PreferenceActions } from "./actions";
|
|
2
|
+
import { Dispatch } from "react";
|
|
3
|
+
import { VistaDashboardTabNavigatorListItem } from "@appcorp/app-corp-vista/type/vista-dashboard-tab-navigator-type";
|
|
4
|
+
import { Currency } from "@react-pakistan/util-functions";
|
|
5
|
+
import { BankBE as BankTypeBE, BranchBE as BranchTypeBE, CurrencyBE as CurrencyTypeBE, MenuOrderBE as MenuOrderTypeBE, PaymentBE as PaymentTypeBE, PaymentModeBE as PaymentModeTypeBE, PreferenceBE as PreferenceTypeBE, TaxBE as TaxTypeBE } from "@react-pakistan/util-functions/api/stellar-solutions/type";
|
|
65
6
|
export interface PreferenceState {
|
|
66
7
|
activeTab: string;
|
|
67
8
|
currencies: CurrencyTypeBE[];
|
|
@@ -73,111 +14,18 @@ export interface PreferenceState {
|
|
|
73
14
|
};
|
|
74
15
|
preferences: PreferenceTypeBE[];
|
|
75
16
|
}
|
|
76
|
-
export
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
id: string;
|
|
85
|
-
isDefault: boolean;
|
|
86
|
-
preference: PreferenceTypeBE;
|
|
87
|
-
preferenceId: string;
|
|
88
|
-
swiftCode?: string;
|
|
89
|
-
updatedAt: string;
|
|
90
|
-
}
|
|
91
|
-
export interface BranchTypeBE {
|
|
92
|
-
branchAddress: string;
|
|
93
|
-
branchName: string;
|
|
94
|
-
createdAt: string;
|
|
95
|
-
enabled: boolean;
|
|
96
|
-
id: string;
|
|
97
|
-
isDefault: boolean;
|
|
98
|
-
personEmail: string;
|
|
99
|
-
personName: string;
|
|
100
|
-
personPhone: string;
|
|
101
|
-
preference: PreferenceTypeBE;
|
|
102
|
-
preferenceId: string;
|
|
103
|
-
updatedAt: string;
|
|
104
|
-
}
|
|
105
|
-
export interface CurrencyTypeBE {
|
|
106
|
-
code: string;
|
|
107
|
-
createdAt: string;
|
|
108
|
-
enabled: boolean;
|
|
109
|
-
id: string;
|
|
110
|
-
isDefault: boolean;
|
|
111
|
-
label: string;
|
|
112
|
-
preference?: PreferenceTypeBE;
|
|
113
|
-
preferenceId: string;
|
|
114
|
-
updatedAt: string;
|
|
115
|
-
}
|
|
116
|
-
export interface MenuOrderTypeBE {
|
|
117
|
-
createdAt: string;
|
|
118
|
-
id: string;
|
|
119
|
-
label: string;
|
|
120
|
-
order: number;
|
|
121
|
-
preference: PreferenceTypeBE;
|
|
122
|
-
preferenceId: string;
|
|
123
|
-
updatedAt: string;
|
|
124
|
-
}
|
|
17
|
+
export type { BankTypeBE };
|
|
18
|
+
export type { BranchTypeBE };
|
|
19
|
+
export type { CurrencyTypeBE };
|
|
20
|
+
export type { MenuOrderTypeBE };
|
|
21
|
+
export type { PaymentTypeBE };
|
|
22
|
+
export type { PaymentModeTypeBE };
|
|
23
|
+
export type { TaxTypeBE };
|
|
24
|
+
export type { PreferenceTypeBE };
|
|
125
25
|
export declare enum PAYMENT_TYPE {
|
|
126
26
|
FULL_PAYMENT = "FULL_PAYMENT",
|
|
127
27
|
PARTIAL_PAYMENT = "PARTIAL_PAYMENT"
|
|
128
28
|
}
|
|
129
|
-
export interface PaymentTypeBE {
|
|
130
|
-
amount: string;
|
|
131
|
-
attachment?: string;
|
|
132
|
-
balance: string;
|
|
133
|
-
createdAt: string;
|
|
134
|
-
currency: string;
|
|
135
|
-
date: string;
|
|
136
|
-
description?: string;
|
|
137
|
-
id: string;
|
|
138
|
-
paymentMode?: PaymentModeTypeBE;
|
|
139
|
-
paymentModeId: string;
|
|
140
|
-
paymentType: PAYMENT_TYPE;
|
|
141
|
-
quoteInvoice?: undefined;
|
|
142
|
-
quoteInvoiceId: string;
|
|
143
|
-
ref: string;
|
|
144
|
-
updatedAt: string;
|
|
145
|
-
}
|
|
146
|
-
export interface PaymentModeTypeBE {
|
|
147
|
-
createdAt: string;
|
|
148
|
-
enabled: boolean;
|
|
149
|
-
id: string;
|
|
150
|
-
isDefault: boolean;
|
|
151
|
-
label: string;
|
|
152
|
-
payments?: PaymentTypeBE[];
|
|
153
|
-
preference?: PreferenceTypeBE;
|
|
154
|
-
preferenceId: string;
|
|
155
|
-
updatedAt: string;
|
|
156
|
-
}
|
|
157
|
-
export interface TaxTypeBE {
|
|
158
|
-
createdAt: string;
|
|
159
|
-
description?: string;
|
|
160
|
-
enabled: boolean;
|
|
161
|
-
id: string;
|
|
162
|
-
isDefault: boolean;
|
|
163
|
-
preference: PreferenceTypeBE;
|
|
164
|
-
preferenceId: string;
|
|
165
|
-
taxName: string;
|
|
166
|
-
taxRate: string;
|
|
167
|
-
updatedAt: string;
|
|
168
|
-
}
|
|
169
|
-
export interface PreferenceTypeBE {
|
|
170
|
-
bankingDetails: BankingDetailTypeBE[];
|
|
171
|
-
branches: BranchTypeBE[];
|
|
172
|
-
createdAt: string;
|
|
173
|
-
currencies: CurrencyTypeBE[];
|
|
174
|
-
id: string;
|
|
175
|
-
menuOrder: MenuOrderTypeBE[];
|
|
176
|
-
onboarding: boolean;
|
|
177
|
-
paymentModes: PaymentModeTypeBE[];
|
|
178
|
-
taxes: TaxTypeBE[];
|
|
179
|
-
updatedAt: string;
|
|
180
|
-
}
|
|
181
29
|
export interface PreferenceContextType {
|
|
182
30
|
byIdError?: Error;
|
|
183
31
|
byIdLoading: boolean;
|
|
@@ -201,83 +49,9 @@ export interface PreferenceContextType {
|
|
|
201
49
|
currencyListLoading: boolean;
|
|
202
50
|
currencyUpdateError?: Error;
|
|
203
51
|
currencyUpdateLoading: boolean;
|
|
204
|
-
handleUpdateCurrency: (id: string, route:
|
|
52
|
+
handleUpdateCurrency: (id: string, route: "enabled" | "isDefault") => void;
|
|
205
53
|
handleCreateCurrency: (currency: Currency) => void;
|
|
206
54
|
}
|
|
207
|
-
export interface CreateBankDetailArg {
|
|
208
|
-
id: string;
|
|
209
|
-
accountNumber: string;
|
|
210
|
-
accountTitle: string;
|
|
211
|
-
bankAddress: string;
|
|
212
|
-
bankName: string;
|
|
213
|
-
enabled: boolean;
|
|
214
|
-
iban: string;
|
|
215
|
-
swiftCode: string;
|
|
216
|
-
preferenceId: string;
|
|
217
|
-
errors: {
|
|
218
|
-
[key: string]: string;
|
|
219
|
-
};
|
|
220
|
-
loading: boolean;
|
|
221
|
-
isDefault: boolean;
|
|
222
|
-
}
|
|
223
|
-
export interface createBranchesArgs {
|
|
224
|
-
personName: string;
|
|
225
|
-
personEmail: string;
|
|
226
|
-
id: string;
|
|
227
|
-
personPhone: string;
|
|
228
|
-
branchAddress: string;
|
|
229
|
-
branchName: string;
|
|
230
|
-
preferenceId: string;
|
|
231
|
-
enabled: boolean;
|
|
232
|
-
errors: {
|
|
233
|
-
[key: string]: string;
|
|
234
|
-
};
|
|
235
|
-
createdAt?: string;
|
|
236
|
-
updatedAt?: string;
|
|
237
|
-
loading: boolean;
|
|
238
|
-
isDefault: boolean;
|
|
239
|
-
}
|
|
240
|
-
export interface createTaxesArgs {
|
|
241
|
-
taxName: string;
|
|
242
|
-
taxValue: string;
|
|
243
|
-
id: string;
|
|
244
|
-
description: string;
|
|
245
|
-
preferenceId: string;
|
|
246
|
-
enabled: boolean;
|
|
247
|
-
errors: {
|
|
248
|
-
[key: string]: string;
|
|
249
|
-
};
|
|
250
|
-
createdAt?: string;
|
|
251
|
-
updatedAt?: string;
|
|
252
|
-
loading: boolean;
|
|
253
|
-
isDefault: boolean;
|
|
254
|
-
}
|
|
255
|
-
export interface updatePaymentModeArgs {
|
|
256
|
-
id: string;
|
|
257
|
-
enabled: boolean;
|
|
258
|
-
}
|
|
259
|
-
export interface MenuItem {
|
|
260
|
-
preferenceId: string;
|
|
261
|
-
label: string;
|
|
262
|
-
order: number;
|
|
263
|
-
id: string;
|
|
264
|
-
}
|
|
265
|
-
export type CurrencyArgs = {
|
|
266
|
-
id: string;
|
|
267
|
-
label: string;
|
|
268
|
-
enabled: boolean;
|
|
269
|
-
code: string;
|
|
270
|
-
isDefault: boolean;
|
|
271
|
-
preferenceId: string;
|
|
272
|
-
};
|
|
273
|
-
export interface updateCurrencyArgs {
|
|
274
|
-
id: string;
|
|
275
|
-
label: string;
|
|
276
|
-
enabled: boolean;
|
|
277
|
-
code: string;
|
|
278
|
-
isDefault: boolean;
|
|
279
|
-
preferenceId: string;
|
|
280
|
-
}
|
|
281
55
|
export declare enum PREFERENCE_DRAWER {
|
|
282
56
|
PAYMENT_MODE_FORM_DRAWER = "PAYMENT_MODE_FORM_DRAWER",
|
|
283
57
|
TAX_MODE_FORM_DRAWER = "TAX_MODE_FORM_DRAWER"
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PREFERENCE_MODAL = exports.PREFERENCE_DRAWER = exports.PAYMENT_TYPE = void 0;
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// CHEQUE = 'CHEQUE',
|
|
8
|
-
// OTHER = 'OTHER',
|
|
9
|
-
// }
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// MODULE-SPECIFIC ENUMS
|
|
6
|
+
// ============================================================================
|
|
10
7
|
var PAYMENT_TYPE;
|
|
11
8
|
(function (PAYMENT_TYPE) {
|
|
12
9
|
PAYMENT_TYPE["FULL_PAYMENT"] = "FULL_PAYMENT";
|
|
@@ -130,12 +130,13 @@ var useTaxState = function () {
|
|
|
130
130
|
searchQuery: state.searchQuery,
|
|
131
131
|
}); }, [state.currentPage, state.pageLimit, state.searchQuery]);
|
|
132
132
|
var updateParams = (0, react_1.useMemo)(function () {
|
|
133
|
-
var _a;
|
|
133
|
+
var _a, _b;
|
|
134
134
|
return ({
|
|
135
|
+
description: ((_a = state.description) === null || _a === void 0 ? void 0 : _a.trim()) || "",
|
|
135
136
|
enabled: state.enabled,
|
|
136
137
|
id: state.id,
|
|
137
138
|
isDefault: state.isDefault,
|
|
138
|
-
preferenceId: (
|
|
139
|
+
preferenceId: (_b = preferences[0]) === null || _b === void 0 ? void 0 : _b.id,
|
|
139
140
|
taxName: state.taxName.trim(),
|
|
140
141
|
taxRate: state.taxRate.trim(),
|
|
141
142
|
});
|
|
@@ -149,6 +150,7 @@ var useTaxState = function () {
|
|
|
149
150
|
var data = _a.data, error = _a.error;
|
|
150
151
|
if (error) {
|
|
151
152
|
showErrorToast(tCommon("messagesNetworkError"));
|
|
153
|
+
return;
|
|
152
154
|
}
|
|
153
155
|
if (data === null || data === void 0 ? void 0 : data.items) {
|
|
154
156
|
dispatch({
|
|
@@ -184,6 +186,7 @@ var useTaxState = function () {
|
|
|
184
186
|
var data = _a.data, error = _a.error;
|
|
185
187
|
if (error) {
|
|
186
188
|
showErrorToast(tCommon("messagesNetworkError"));
|
|
189
|
+
return;
|
|
187
190
|
}
|
|
188
191
|
if (data) {
|
|
189
192
|
dispatch({
|
|
@@ -200,6 +203,7 @@ var useTaxState = function () {
|
|
|
200
203
|
var data = _a.data, error = _a.error;
|
|
201
204
|
if (error) {
|
|
202
205
|
showErrorToast(tCommon("messagesNetworkError"));
|
|
206
|
+
return;
|
|
203
207
|
}
|
|
204
208
|
if (data) {
|
|
205
209
|
showSuccessToast(t("messagesTaxDeleted"));
|
|
@@ -219,7 +223,7 @@ var useTaxState = function () {
|
|
|
219
223
|
listCallback: listCallback,
|
|
220
224
|
listParams: listParams,
|
|
221
225
|
listUrl: constants_1.TAX_API_ROUTES.TAXES,
|
|
222
|
-
searchQuery:
|
|
226
|
+
searchQuery: debouncedQuery,
|
|
223
227
|
unitByIdUrl: constants_1.TAX_API_ROUTES.TAX_BY_ID,
|
|
224
228
|
unitUrl: constants_1.TAX_API_ROUTES.TAX,
|
|
225
229
|
updateCallback: updateCallback,
|
|
@@ -231,7 +235,7 @@ var useTaxState = function () {
|
|
|
231
235
|
// ---------------------------------------------------------------------------
|
|
232
236
|
(0, react_1.useEffect)(function () {
|
|
233
237
|
listFetchNow();
|
|
234
|
-
// eslint-disable-next-line
|
|
238
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
235
239
|
}, [debouncedQuery, state.currentPage, state.pageLimit]);
|
|
236
240
|
// ---------------------------------------------------------------------------
|
|
237
241
|
// 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 {};
|
|
@@ -30,6 +30,7 @@ var button_1 = require("@appcorp/shadcn/components/button");
|
|
|
30
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 {};
|
|
@@ -27,12 +27,11 @@ var context_1 = require("./context");
|
|
|
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,7 +4,7 @@ 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");
|
|
@@ -31,46 +31,46 @@ var drawer_1 = require("./drawer");
|
|
|
31
31
|
*
|
|
32
32
|
* @param params - Route parameters containing locale information
|
|
33
33
|
*/
|
|
34
|
-
var
|
|
34
|
+
var TaxPage = function () {
|
|
35
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;
|
|
36
36
|
var t = (0, next_intl_1.useTranslations)("tax");
|
|
37
37
|
var isRTL = (0, use_rtl_1.useRTL)();
|
|
38
38
|
// ============================================================================
|
|
39
39
|
// TRANSLATION MAPPING
|
|
40
40
|
// ============================================================================
|
|
41
|
-
|
|
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
|
-
};
|
|
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
|
+
// };
|
|
74
74
|
// ============================================================================
|
|
75
75
|
// TABLE CONFIGURATION
|
|
76
76
|
// ============================================================================
|
|
@@ -117,7 +117,7 @@ var Tax = function () {
|
|
|
117
117
|
// ============================================================================
|
|
118
118
|
return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
119
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) }),
|
|
120
|
-
react_1.default.createElement(drawer_1.TaxDrawer, {
|
|
120
|
+
react_1.default.createElement(drawer_1.TaxDrawer, { isRTL: isRTL }),
|
|
121
121
|
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
122
122
|
};
|
|
123
|
-
exports.
|
|
123
|
+
exports.TaxPage = TaxPage;
|