@appcorp/stellar-solutions-modules 0.1.11 → 0.1.12

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.
Files changed (95) hide show
  1. package/global-modules/branch/actions.d.ts +83 -0
  2. package/global-modules/branch/actions.js +18 -0
  3. package/global-modules/branch/branch.d.ts +2 -0
  4. package/global-modules/branch/branch.js +69 -0
  5. package/global-modules/branch/constants.d.ts +35 -0
  6. package/global-modules/branch/constants.js +155 -0
  7. package/global-modules/branch/context.d.ts +10 -0
  8. package/global-modules/branch/context.js +422 -0
  9. package/global-modules/branch/drawer.d.ts +8 -0
  10. package/global-modules/branch/drawer.js +19 -0
  11. package/global-modules/branch/form-elements.d.ts +3 -0
  12. package/global-modules/branch/form-elements.js +41 -0
  13. package/global-modules/branch/form.d.ts +8 -0
  14. package/global-modules/branch/form.js +80 -0
  15. package/global-modules/branch/reducer.d.ts +4 -0
  16. package/global-modules/branch/reducer.js +167 -0
  17. package/global-modules/branch/types.d.ts +255 -0
  18. package/global-modules/branch/types.js +22 -0
  19. package/global-modules/branch/validate.d.ts +30 -0
  20. package/global-modules/branch/validate.js +19 -0
  21. package/global-modules/payment-mode/actions.d.ts +83 -0
  22. package/global-modules/payment-mode/actions.js +18 -0
  23. package/global-modules/payment-mode/constants.d.ts +28 -0
  24. package/global-modules/payment-mode/constants.js +91 -0
  25. package/global-modules/payment-mode/context.d.ts +10 -0
  26. package/global-modules/payment-mode/context.js +418 -0
  27. package/global-modules/payment-mode/drawer.d.ts +8 -0
  28. package/global-modules/payment-mode/drawer.js +19 -0
  29. package/global-modules/payment-mode/form-elements.d.ts +3 -0
  30. package/global-modules/payment-mode/form-elements.js +41 -0
  31. package/global-modules/payment-mode/form.d.ts +8 -0
  32. package/global-modules/payment-mode/form.js +80 -0
  33. package/global-modules/payment-mode/payment-mode.d.ts +2 -0
  34. package/global-modules/payment-mode/payment-mode.js +53 -0
  35. package/global-modules/payment-mode/reducer.d.ts +4 -0
  36. package/global-modules/payment-mode/reducer.js +163 -0
  37. package/global-modules/payment-mode/types.d.ts +251 -0
  38. package/global-modules/payment-mode/types.js +22 -0
  39. package/global-modules/payment-mode/validate.d.ts +18 -0
  40. package/global-modules/payment-mode/validate.js +13 -0
  41. package/global-modules/preferences/actions.d.ts +200 -0
  42. package/global-modules/preferences/actions.js +37 -0
  43. package/global-modules/preferences/bank.d.ts +2 -0
  44. package/global-modules/preferences/bank.js +11 -0
  45. package/global-modules/preferences/branch-drawer.d.ts +8 -0
  46. package/global-modules/preferences/branch-drawer.js +19 -0
  47. package/global-modules/preferences/branch-form-elements.d.ts +3 -0
  48. package/global-modules/preferences/branch-form-elements.js +41 -0
  49. package/global-modules/preferences/branch-form.d.ts +8 -0
  50. package/global-modules/preferences/branch-form.js +81 -0
  51. package/global-modules/preferences/branch.d.ts +2 -0
  52. package/global-modules/preferences/branch.js +69 -0
  53. package/global-modules/preferences/constants.d.ts +70 -0
  54. package/global-modules/preferences/constants.js +400 -0
  55. package/global-modules/preferences/context.d.ts +10 -0
  56. package/global-modules/preferences/context.js +1011 -0
  57. package/global-modules/preferences/currency.d.ts +2 -0
  58. package/global-modules/preferences/currency.js +49 -0
  59. package/global-modules/preferences/payment-mode-drawer.d.ts +8 -0
  60. package/global-modules/preferences/payment-mode-drawer.js +19 -0
  61. package/global-modules/preferences/payment-mode-form-elements.d.ts +3 -0
  62. package/global-modules/preferences/payment-mode-form-elements.js +41 -0
  63. package/global-modules/preferences/payment-mode-form.d.ts +8 -0
  64. package/global-modules/preferences/payment-mode-form.js +81 -0
  65. package/global-modules/preferences/payment-mode.d.ts +2 -0
  66. package/global-modules/preferences/payment-mode.js +57 -0
  67. package/global-modules/preferences/preferences.d.ts +10 -0
  68. package/global-modules/preferences/preferences.js +108 -0
  69. package/global-modules/preferences/reducer.d.ts +4 -0
  70. package/global-modules/preferences/reducer.js +219 -0
  71. package/global-modules/preferences/types.d.ts +333 -0
  72. package/global-modules/preferences/types.js +23 -0
  73. package/global-modules/preferences/validate.d.ts +21 -0
  74. package/global-modules/preferences/validate.js +16 -0
  75. package/global-modules/tax/actions.d.ts +83 -0
  76. package/global-modules/tax/actions.js +18 -0
  77. package/global-modules/tax/constants.d.ts +42 -0
  78. package/global-modules/tax/constants.js +143 -0
  79. package/global-modules/tax/context.d.ts +10 -0
  80. package/global-modules/tax/context.js +420 -0
  81. package/global-modules/tax/drawer.d.ts +8 -0
  82. package/global-modules/tax/drawer.js +19 -0
  83. package/global-modules/tax/form-elements.d.ts +3 -0
  84. package/global-modules/tax/form-elements.js +41 -0
  85. package/global-modules/tax/form.d.ts +8 -0
  86. package/global-modules/tax/form.js +80 -0
  87. package/global-modules/tax/reducer.d.ts +4 -0
  88. package/global-modules/tax/reducer.js +74 -0
  89. package/global-modules/tax/tax.d.ts +2 -0
  90. package/global-modules/tax/tax.js +63 -0
  91. package/global-modules/tax/types.d.ts +253 -0
  92. package/global-modules/tax/types.js +22 -0
  93. package/global-modules/tax/validate.d.ts +24 -0
  94. package/global-modules/tax/validate.js +17 -0
  95. package/package.json +1 -1
@@ -0,0 +1,333 @@
1
+ import { VistaTableHeaderActionItem } from '@appcorp/app-corp-vista/type/vista-table-type';
2
+ import { RowActionItem } from '@appcorp/app-corp-vista/type/vista-dropdown-menu-type';
3
+ import { PreferenceActions } from './actions';
4
+ import { Dispatch } from 'react';
5
+ import { VistaDashboardTabNavigatorListItem } from '@appcorp/app-corp-vista/type/vista-dashboard-tab-navigator-type';
6
+ import { Currency } from '@react-pakistan/util-functions';
7
+ import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
8
+ export interface MenuItem {
9
+ preferenceId: string;
10
+ label: string;
11
+ order: number;
12
+ id: string;
13
+ }
14
+ export interface BankDetails {
15
+ accountTitle: string;
16
+ accountNumber: string;
17
+ iban: string;
18
+ id: string;
19
+ swiftCode: string;
20
+ bankAddress: string;
21
+ bankName: string;
22
+ preferenceId: string;
23
+ enabled: boolean;
24
+ errors: {
25
+ [key: string]: string;
26
+ };
27
+ createdAt?: string;
28
+ updatedAt?: string;
29
+ loading: boolean;
30
+ isDefault: boolean;
31
+ btnDisableBankDetail: boolean;
32
+ }
33
+ export interface Branches {
34
+ personName: string;
35
+ personEmail: string;
36
+ id: string;
37
+ personPhone: string;
38
+ branchAddress: string;
39
+ branchName: string;
40
+ preferenceId: string;
41
+ enabled: boolean;
42
+ errors: {
43
+ [key: string]: string;
44
+ };
45
+ createdAt?: string;
46
+ updatedAt?: string;
47
+ loading: boolean;
48
+ isDefault: boolean;
49
+ btnDisableBranches: boolean;
50
+ }
51
+ export interface Tax {
52
+ taxName: string;
53
+ taxValue: string;
54
+ id: string;
55
+ description: string;
56
+ preferenceId: string;
57
+ enabled: boolean;
58
+ errors: {
59
+ [key: string]: string;
60
+ };
61
+ createdAt?: string;
62
+ updatedAt?: string;
63
+ loading: boolean;
64
+ isDefault: boolean;
65
+ btnDisableTax: boolean;
66
+ }
67
+ export type TaxForm = Omit<TaxTypeBE, 'createdAt' | 'updatedAt' | 'preference'>;
68
+ export interface PreferenceState {
69
+ activeTab: string;
70
+ bankDetails: BankDetails;
71
+ bankDetailsData: BankDetails[];
72
+ branchCount: number;
73
+ branchCurrentPage: number;
74
+ branchDisableSaveButton: boolean;
75
+ branchDrawer: null | PREFERENCE_DRAWER;
76
+ branchPageLimit: number;
77
+ branchSearchQuery: string;
78
+ branches: BranchTypeBE[];
79
+ currencies: CurrencyTypeBE[];
80
+ currencyUpdateId: string;
81
+ id: string;
82
+ count: number;
83
+ isMenuOrderData: boolean;
84
+ localMenuItems: MenuItem[];
85
+ onboarding: boolean;
86
+ paymentModeCount: number;
87
+ paymentModeCurrentPage: number;
88
+ paymentModeDisableSaveButton: boolean;
89
+ paymentModeDrawer: null | PREFERENCE_DRAWER;
90
+ paymentModePageLimit: number;
91
+ paymentModeSearchQuery: string;
92
+ paymentModes: PaymentModeTypeBE[];
93
+ errors: {
94
+ [key: string]: string;
95
+ };
96
+ preferences: PreferenceTypeBE[];
97
+ }
98
+ export interface BankingDetailTypeBE {
99
+ accountNumber: string;
100
+ accountTitle: string;
101
+ bankAddress?: string;
102
+ bankName: string;
103
+ createdAt: string;
104
+ enabled: boolean;
105
+ iban?: string;
106
+ id: string;
107
+ isDefault: boolean;
108
+ preference: PreferenceTypeBE;
109
+ preferenceId: string;
110
+ swiftCode?: string;
111
+ updatedAt: string;
112
+ }
113
+ export interface BranchTypeBE {
114
+ branchAddress: string;
115
+ branchName: string;
116
+ createdAt: string;
117
+ enabled: boolean;
118
+ id: string;
119
+ isDefault: boolean;
120
+ personEmail: string;
121
+ personName: string;
122
+ personPhone: string;
123
+ preference: PreferenceTypeBE;
124
+ preferenceId: string;
125
+ updatedAt: string;
126
+ }
127
+ export interface CurrencyTypeBE {
128
+ code: string;
129
+ createdAt: string;
130
+ enabled: boolean;
131
+ id: string;
132
+ isDefault: boolean;
133
+ label: string;
134
+ preference?: PreferenceTypeBE;
135
+ preferenceId: string;
136
+ updatedAt: string;
137
+ }
138
+ export interface MenuOrderTypeBE {
139
+ createdAt: string;
140
+ id: string;
141
+ label: string;
142
+ order: number;
143
+ preference: PreferenceTypeBE;
144
+ preferenceId: string;
145
+ updatedAt: string;
146
+ }
147
+ export declare enum PAYMENT_TYPE {
148
+ FULL_PAYMENT = "FULL_PAYMENT",
149
+ PARTIAL_PAYMENT = "PARTIAL_PAYMENT"
150
+ }
151
+ export interface PaymentTypeBE {
152
+ amount: string;
153
+ attachment?: string;
154
+ balance: string;
155
+ createdAt: string;
156
+ currency: string;
157
+ date: string;
158
+ description?: string;
159
+ id: string;
160
+ paymentMode?: PaymentModeTypeBE;
161
+ paymentModeId: string;
162
+ paymentType: PAYMENT_TYPE;
163
+ quoteInvoice?: undefined;
164
+ quoteInvoiceId: string;
165
+ ref: string;
166
+ updatedAt: string;
167
+ }
168
+ export interface PaymentModeTypeBE {
169
+ createdAt: string;
170
+ enabled: boolean;
171
+ id: string;
172
+ isDefault: boolean;
173
+ label: string;
174
+ payments?: PaymentTypeBE[];
175
+ preference?: PreferenceTypeBE;
176
+ preferenceId: string;
177
+ updatedAt: string;
178
+ }
179
+ export interface TaxTypeBE {
180
+ createdAt: string;
181
+ description?: string;
182
+ enabled: boolean;
183
+ id: string;
184
+ isDefault: boolean;
185
+ preference: PreferenceTypeBE;
186
+ preferenceId: string;
187
+ taxName: string;
188
+ taxRate: string;
189
+ updatedAt: string;
190
+ }
191
+ export interface PreferenceTypeBE {
192
+ bankingDetails: BankingDetailTypeBE[];
193
+ branches: BranchTypeBE[];
194
+ createdAt: string;
195
+ currencies: CurrencyTypeBE[];
196
+ id: string;
197
+ menuOrder: MenuOrderTypeBE[];
198
+ onboarding: boolean;
199
+ paymentModes: PaymentModeTypeBE[];
200
+ taxes: TaxTypeBE[];
201
+ updatedAt: string;
202
+ }
203
+ export interface PreferenceContextType {
204
+ byIdError?: Error;
205
+ byIdLoading: boolean;
206
+ clearSearch: () => void;
207
+ closeDrawer: () => void;
208
+ deleteError?: Error;
209
+ deleteLoading: boolean;
210
+ dispatch: Dispatch<PreferenceActions>;
211
+ paymentModeHeaderActions: VistaTableHeaderActionItem[];
212
+ listError?: Error;
213
+ listFetchNow: () => void;
214
+ listLoading: boolean;
215
+ paymentModeRowActions: RowActionItem[];
216
+ searchOnChange: (k: string, v: string) => void;
217
+ updateError?: Error;
218
+ updateLoading: boolean;
219
+ headerTabs: VistaDashboardTabNavigatorListItem[];
220
+ currencyByIdError?: Error;
221
+ currencyByIdLoading: boolean;
222
+ currencyDeleteError?: Error;
223
+ currencyDeleteLoading: boolean;
224
+ currencyListError?: Error;
225
+ currencyListLoading: boolean;
226
+ currencyUpdateError?: Error;
227
+ currencyUpdateLoading: boolean;
228
+ paymentModeByIdError?: Error;
229
+ paymentModeByIdLoading: boolean;
230
+ paymentModeDeleteError?: Error;
231
+ paymentModeDeleteLoading: boolean;
232
+ paymentModeListError?: Error;
233
+ paymentModeListLoading: boolean;
234
+ paymentModeUpdateError?: Error;
235
+ paymentModeUpdateLoading: boolean;
236
+ branchByIdError?: Error;
237
+ branchByIdLoading: boolean;
238
+ branchDeleteError?: Error;
239
+ branchDeleteLoading: boolean;
240
+ branchListError?: Error;
241
+ branchListLoading: boolean;
242
+ branchUpdateError?: Error;
243
+ branchUpdateLoading: boolean;
244
+ handleUpdateCurrency: (id: string, route: 'enabled' | 'isDefault') => void;
245
+ handleCreateCurrency: (currency: Currency) => void;
246
+ handlePaymentModeSubmit: () => void;
247
+ paymentModeDynamicFormElements: VistaFormElements;
248
+ branchDynamicFormElements: VistaFormElements;
249
+ handleBranchSubmit: () => void;
250
+ branchHeaderActions: VistaTableHeaderActionItem[];
251
+ branchRowActions: RowActionItem[];
252
+ }
253
+ export interface CreateBankDetailArg {
254
+ id: string;
255
+ accountNumber: string;
256
+ accountTitle: string;
257
+ bankAddress: string;
258
+ bankName: string;
259
+ enabled: boolean;
260
+ iban: string;
261
+ swiftCode: string;
262
+ preferenceId: string;
263
+ errors: {
264
+ [key: string]: string;
265
+ };
266
+ loading: boolean;
267
+ isDefault: boolean;
268
+ }
269
+ export interface createBranchesArgs {
270
+ personName: string;
271
+ personEmail: string;
272
+ id: string;
273
+ personPhone: string;
274
+ branchAddress: string;
275
+ branchName: string;
276
+ preferenceId: string;
277
+ enabled: boolean;
278
+ errors: {
279
+ [key: string]: string;
280
+ };
281
+ createdAt?: string;
282
+ updatedAt?: string;
283
+ loading: boolean;
284
+ isDefault: boolean;
285
+ }
286
+ export interface createTaxesArgs {
287
+ taxName: string;
288
+ taxValue: string;
289
+ id: string;
290
+ description: string;
291
+ preferenceId: string;
292
+ enabled: boolean;
293
+ errors: {
294
+ [key: string]: string;
295
+ };
296
+ createdAt?: string;
297
+ updatedAt?: string;
298
+ loading: boolean;
299
+ isDefault: boolean;
300
+ }
301
+ export interface updatePaymentModeArgs {
302
+ id: string;
303
+ enabled: boolean;
304
+ }
305
+ export interface MenuItem {
306
+ preferenceId: string;
307
+ label: string;
308
+ order: number;
309
+ id: string;
310
+ }
311
+ export type CurrencyArgs = {
312
+ id: string;
313
+ label: string;
314
+ enabled: boolean;
315
+ code: string;
316
+ isDefault: boolean;
317
+ preferenceId: string;
318
+ };
319
+ export interface updateCurrencyArgs {
320
+ id: string;
321
+ label: string;
322
+ enabled: boolean;
323
+ code: string;
324
+ isDefault: boolean;
325
+ preferenceId: string;
326
+ }
327
+ export declare enum PREFERENCE_DRAWER {
328
+ PAYMENT_MODE_FORM_DRAWER = "PAYMENT_MODE_FORM_DRAWER",
329
+ TAX_MODE_FORM_DRAWER = "TAX_MODE_FORM_DRAWER"
330
+ }
331
+ export declare enum PREFERENCE_MODAL {
332
+ DUMMY = "DUMMY"
333
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PREFERENCE_MODAL = exports.PREFERENCE_DRAWER = exports.PAYMENT_TYPE = void 0;
4
+ // export enum PAYMENT_MODE {
5
+ // BANK_TRANSFER = 'BANK_TRANSFER',
6
+ // CASH = 'CASH',
7
+ // CHEQUE = 'CHEQUE',
8
+ // OTHER = 'OTHER',
9
+ // }
10
+ var PAYMENT_TYPE;
11
+ (function (PAYMENT_TYPE) {
12
+ PAYMENT_TYPE["FULL_PAYMENT"] = "FULL_PAYMENT";
13
+ PAYMENT_TYPE["PARTIAL_PAYMENT"] = "PARTIAL_PAYMENT";
14
+ })(PAYMENT_TYPE || (exports.PAYMENT_TYPE = PAYMENT_TYPE = {}));
15
+ var PREFERENCE_DRAWER;
16
+ (function (PREFERENCE_DRAWER) {
17
+ PREFERENCE_DRAWER["PAYMENT_MODE_FORM_DRAWER"] = "PAYMENT_MODE_FORM_DRAWER";
18
+ PREFERENCE_DRAWER["TAX_MODE_FORM_DRAWER"] = "TAX_MODE_FORM_DRAWER";
19
+ })(PREFERENCE_DRAWER || (exports.PREFERENCE_DRAWER = PREFERENCE_DRAWER = {}));
20
+ var PREFERENCE_MODAL;
21
+ (function (PREFERENCE_MODAL) {
22
+ PREFERENCE_MODAL["DUMMY"] = "DUMMY";
23
+ })(PREFERENCE_MODAL || (exports.PREFERENCE_MODAL = PREFERENCE_MODAL = {}));
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ export declare const formValidation: z.ZodObject<{
3
+ taxName: z.ZodString;
4
+ taxRate: z.ZodString;
5
+ enabled: z.ZodBoolean;
6
+ isDefault: z.ZodBoolean;
7
+ description: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ enabled: boolean;
10
+ isDefault: boolean;
11
+ taxName: string;
12
+ taxRate: string;
13
+ description?: string | undefined;
14
+ }, {
15
+ enabled: boolean;
16
+ isDefault: boolean;
17
+ taxName: string;
18
+ taxRate: string;
19
+ description?: string | undefined;
20
+ }>;
21
+ export type TaxFormValidate = z.infer<typeof formValidation>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formValidation = void 0;
4
+ var zod_1 = require("zod");
5
+ var constants_1 = require("./constants");
6
+ exports.formValidation = zod_1.z.object({
7
+ taxName: zod_1.z
8
+ .string()
9
+ .nonempty(constants_1.taxValidationError.taxName),
10
+ taxRate: zod_1.z
11
+ .string()
12
+ .nonempty(constants_1.taxValidationError.taxRate),
13
+ enabled: zod_1.z.boolean(),
14
+ isDefault: zod_1.z.boolean(),
15
+ description: zod_1.z.string().optional(),
16
+ });
@@ -0,0 +1,83 @@
1
+ import { TaxTypeBE, TAX_DRAWER } from './types';
2
+ export declare enum TAX_ACTION_TYPES {
3
+ CLEAR_ERRORS = "CLEAR_ERRORS",
4
+ RESET_FORM = "RESET_FORM",
5
+ SET_COUNT = "SET_COUNT",
6
+ SET_CURRENT_PAGE = "SET_CURRENT_PAGE",
7
+ SET_DISABLE_SAVE_BUTTON = "SET_DISABLE_SAVE_BUTTON",
8
+ SET_DRAWER = "SET_DRAWER",
9
+ SET_ERRORS = "SET_ERRORS",
10
+ SET_FORM = "SET_FORM",
11
+ SET_INPUT_FIELD = "SET_INPUT_FIELD",
12
+ SET_PAGE_LIMIT = "SET_PAGE_LIMIT",
13
+ SET_SEARCH_QUERY = "SET_SEARCH_QUERY",
14
+ SET_TAXES = "SET_TAXES"
15
+ }
16
+ export type TaxSetErrorsAction = {
17
+ type: TAX_ACTION_TYPES.SET_ERRORS;
18
+ payload: {
19
+ errors: Record<string, string>;
20
+ };
21
+ };
22
+ export type TaxSetCountAction = {
23
+ type: TAX_ACTION_TYPES.SET_COUNT;
24
+ payload: {
25
+ count: number;
26
+ };
27
+ };
28
+ export type TaxSetSearchQuery = {
29
+ type: TAX_ACTION_TYPES.SET_SEARCH_QUERY;
30
+ payload: {
31
+ searchQuery: string;
32
+ };
33
+ };
34
+ export type TaxSetTaxesAction = {
35
+ type: TAX_ACTION_TYPES.SET_TAXES;
36
+ payload: {
37
+ taxes: TaxTypeBE[];
38
+ };
39
+ };
40
+ export type TaxSetFormAction = {
41
+ type: TAX_ACTION_TYPES.SET_FORM;
42
+ payload: {
43
+ form: TaxTypeBE;
44
+ };
45
+ };
46
+ export type TaxSetDrawerAction = {
47
+ type: TAX_ACTION_TYPES.SET_DRAWER;
48
+ payload: {
49
+ drawer: null | TAX_DRAWER;
50
+ };
51
+ };
52
+ export type TaxSetInputFieldAction = {
53
+ type: TAX_ACTION_TYPES.SET_INPUT_FIELD;
54
+ payload: {
55
+ key: keyof TaxTypeBE;
56
+ value: string | string[] | boolean | number | number[];
57
+ };
58
+ };
59
+ export type TaxSetDisableSaveButtonAction = {
60
+ type: TAX_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON;
61
+ payload: {
62
+ disableSaveButton: boolean;
63
+ };
64
+ };
65
+ export type TaxClearErrorsAction = {
66
+ type: TAX_ACTION_TYPES.CLEAR_ERRORS;
67
+ };
68
+ export type TaxSetCurrentPageAction = {
69
+ type: TAX_ACTION_TYPES.SET_CURRENT_PAGE;
70
+ payload: {
71
+ currentPage: number;
72
+ };
73
+ };
74
+ export type TaxSetPageLimitAction = {
75
+ type: TAX_ACTION_TYPES.SET_PAGE_LIMIT;
76
+ payload: {
77
+ pageLimit: number;
78
+ };
79
+ };
80
+ export type TaxResetFormAction = {
81
+ type: TAX_ACTION_TYPES.RESET_FORM;
82
+ };
83
+ export type TaxActions = TaxSetErrorsAction | TaxSetCountAction | TaxSetTaxesAction | TaxSetFormAction | TaxSetDrawerAction | TaxSetInputFieldAction | TaxSetDisableSaveButtonAction | TaxClearErrorsAction | TaxSetCurrentPageAction | TaxSetPageLimitAction | TaxResetFormAction | TaxSetSearchQuery;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TAX_ACTION_TYPES = void 0;
4
+ var TAX_ACTION_TYPES;
5
+ (function (TAX_ACTION_TYPES) {
6
+ TAX_ACTION_TYPES["CLEAR_ERRORS"] = "CLEAR_ERRORS";
7
+ TAX_ACTION_TYPES["RESET_FORM"] = "RESET_FORM";
8
+ TAX_ACTION_TYPES["SET_COUNT"] = "SET_COUNT";
9
+ TAX_ACTION_TYPES["SET_CURRENT_PAGE"] = "SET_CURRENT_PAGE";
10
+ TAX_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
11
+ TAX_ACTION_TYPES["SET_DRAWER"] = "SET_DRAWER";
12
+ TAX_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
13
+ TAX_ACTION_TYPES["SET_FORM"] = "SET_FORM";
14
+ TAX_ACTION_TYPES["SET_INPUT_FIELD"] = "SET_INPUT_FIELD";
15
+ TAX_ACTION_TYPES["SET_PAGE_LIMIT"] = "SET_PAGE_LIMIT";
16
+ TAX_ACTION_TYPES["SET_SEARCH_QUERY"] = "SET_SEARCH_QUERY";
17
+ TAX_ACTION_TYPES["SET_TAXES"] = "SET_TAXES";
18
+ })(TAX_ACTION_TYPES || (exports.TAX_ACTION_TYPES = TAX_ACTION_TYPES = {}));
@@ -0,0 +1,42 @@
1
+ import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
2
+ import { VISTA_TABLE_CELL_TYPE } from '@appcorp/app-corp-vista/type/vista-table-type';
3
+ export declare const pageLimit: number;
4
+ export declare const staticFormElements: VistaFormElements;
5
+ export declare const tableBodyCols: ({
6
+ componentType: VISTA_TABLE_CELL_TYPE;
7
+ key: string;
8
+ } | {
9
+ componentType: VISTA_TABLE_CELL_TYPE;
10
+ key?: undefined;
11
+ })[];
12
+ export declare const PREFERENCE_API_ROUTES: {
13
+ BRANCH: string;
14
+ BRANCHES: string;
15
+ BRANCH_BY_ID: string;
16
+ CURRENCIES: string;
17
+ CURRENCY: string;
18
+ CURRENCY_BY_ID: string;
19
+ PAYMENT_MODE: string;
20
+ PAYMENT_MODES: string;
21
+ PAYMENT_MODE_BY_ID: string;
22
+ PREFERENCE: string;
23
+ PREFERENCES: string;
24
+ PREFERENCE_BY_ID: string;
25
+ TAX: string;
26
+ TAXES: string;
27
+ TAX_BY_ID: string;
28
+ };
29
+ export declare const toastErrors: {
30
+ fetchInvoiceError: string;
31
+ formSubmittedSuccess: string;
32
+ genericError: string;
33
+ networkError: string;
34
+ submitFormError: string;
35
+ validationError: string;
36
+ };
37
+ export declare const validationError: {
38
+ taxName: string;
39
+ taxRate: string;
40
+ description: string;
41
+ preferenceId: string;
42
+ };
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.validationError = exports.toastErrors = exports.PREFERENCE_API_ROUTES = exports.tableBodyCols = exports.staticFormElements = exports.pageLimit = void 0;
5
+ var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
6
+ // import { Currency } from './currency';
7
+ // import { PaymentMode } from './payment-mode';
8
+ // import { Branch } from './branch';
9
+ // import { Tax } from '../tax/tax';
10
+ // import { Bank } from './bank';
11
+ // import { ReactNode } from 'react';
12
+ var vista_table_type_1 = require("@appcorp/app-corp-vista/type/vista-table-type");
13
+ exports.pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT);
14
+ exports.staticFormElements = (_a = {},
15
+ _a[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
16
+ {
17
+ enabled: true,
18
+ error: '',
19
+ handleOnChange: function () { return void 0; },
20
+ id: 'taxName',
21
+ label: 'formLabelTaxName',
22
+ order: 1,
23
+ placeholder: 'Tax Name...',
24
+ required: true,
25
+ type: 'text',
26
+ value: '',
27
+ },
28
+ {
29
+ enabled: true,
30
+ error: '',
31
+ handleOnChange: function () { return void 0; },
32
+ id: 'taxRate',
33
+ label: 'formLabelTaxRate',
34
+ order: 2,
35
+ placeholder: 'Tax Rate...',
36
+ required: true,
37
+ type: 'number',
38
+ value: '',
39
+ },
40
+ ],
41
+ _a[form_schema_1.VISTA_FORM_ELEMENTS.TOGGLE_V1] = [
42
+ {
43
+ id: 'enabled',
44
+ enabled: true,
45
+ value: false,
46
+ order: 3,
47
+ handleOnChange: function () { return void 0; },
48
+ label: 'Enabled',
49
+ required: true,
50
+ },
51
+ {
52
+ id: 'isDefault',
53
+ enabled: true,
54
+ value: false,
55
+ order: 4,
56
+ handleOnChange: function () { return void 0; },
57
+ label: 'IsDefault',
58
+ required: true,
59
+ },
60
+ ],
61
+ _a[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_AREA_V1] = [
62
+ {
63
+ enabled: true,
64
+ handleOnChange: function () { return void 0; },
65
+ id: 'description',
66
+ label: 'formLabelDescription',
67
+ order: 5,
68
+ placeholder: 'Tax Description...',
69
+ required: false,
70
+ value: '',
71
+ },
72
+ ],
73
+ _a);
74
+ exports.tableBodyCols = [
75
+ {
76
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ID,
77
+ key: 'id',
78
+ },
79
+ {
80
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOLD_TEXT,
81
+ key: 'taxName',
82
+ },
83
+ {
84
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
85
+ key: 'taxRate',
86
+ },
87
+ {
88
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
89
+ key: 'description',
90
+ },
91
+ {
92
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
93
+ key: 'enabled',
94
+ },
95
+ {
96
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
97
+ key: 'isDefault',
98
+ },
99
+ {
100
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.CREATED_UPDATED_AT,
101
+ },
102
+ {
103
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ACTIONS,
104
+ },
105
+ ];
106
+ exports.PREFERENCE_API_ROUTES = {
107
+ BRANCH: '/api/branch',
108
+ BRANCHES: '/api/branches',
109
+ BRANCH_BY_ID: '/api/branch/branch-by-id',
110
+ CURRENCIES: '/api/currencies',
111
+ CURRENCY: '/api/currency',
112
+ CURRENCY_BY_ID: '/api/currency/currency-by-id',
113
+ PAYMENT_MODE: '/api/payment-mode',
114
+ PAYMENT_MODES: '/api/payment-modes',
115
+ PAYMENT_MODE_BY_ID: '/api/payment-mode/payment-mode-by-id',
116
+ PREFERENCE: '/api/preference',
117
+ PREFERENCES: '/api/preferences',
118
+ PREFERENCE_BY_ID: '/api/preference/preference-by-id',
119
+ TAX: '/api/tax',
120
+ TAXES: '/api/taxes',
121
+ TAX_BY_ID: '/api/tax/tax-by-id',
122
+ };
123
+ exports.toastErrors = {
124
+ fetchInvoiceError: 'Error Fetching Invoice',
125
+ formSubmittedSuccess: 'Form Submitted Successfully',
126
+ genericError: 'Something Went Wrong',
127
+ networkError: 'Network Error Occurred',
128
+ submitFormError: 'Error Submitting Form',
129
+ validationError: 'Validation Failed',
130
+ };
131
+ // export const dashboardTabsMap: { [key: string]: ReactNode } = {
132
+ // 'Currency': <Currency />,
133
+ // 'Payment Mode': <PaymentMode />,
134
+ // 'Branch': <Branch />,
135
+ // 'Tax': <Tax />,
136
+ // 'Bank': <Bank />,
137
+ // };
138
+ exports.validationError = {
139
+ taxName: 'Tax Name is required',
140
+ taxRate: 'Tax Rate is required',
141
+ description: '',
142
+ preferenceId: 'Preference id is required',
143
+ };
@@ -0,0 +1,10 @@
1
+ import React, { FC, ReactNode } from 'react';
2
+ import { TaxContextType, TaxState } from './types';
3
+ type State = TaxContextType & TaxState;
4
+ interface StateProviderProps {
5
+ children: ReactNode;
6
+ }
7
+ export declare const TaxStateContext: React.Context<State>;
8
+ export declare const TaxStateContextProvider: FC<StateProviderProps>;
9
+ export declare const useTaxStateContext: () => State;
10
+ export {};