@appcorp/stellar-solutions-modules 0.1.10 → 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,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Tax = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var vista_table_v1_1 = require("@appcorp/app-corp-vista/organisms/vista-table-v1/vista-table-v1");
9
+ var drawer_1 = require("./drawer");
10
+ var generate_toast_1 = require("@appcorp/app-corp-vista/utils/generate-toast");
11
+ var next_intl_1 = require("next-intl");
12
+ var context_1 = require("./context");
13
+ var util_functions_1 = require("@react-pakistan/util-functions");
14
+ var constants_1 = require("./constants");
15
+ var Tax = function () {
16
+ 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;
17
+ var t = (0, next_intl_1.useTranslations)('taxPage');
18
+ var translationMap = {
19
+ formLabelTaxName: t('formLabelTaxName'),
20
+ formLabelTaxRate: t('formLabelTaxRate'),
21
+ formLabelDescription: t('formLabelDescription'),
22
+ };
23
+ var tableHeadItems = [
24
+ {
25
+ label: t('tableColumnHeaderId'),
26
+ width: '5%',
27
+ },
28
+ {
29
+ label: t('tableColumnHeaderTaxName'),
30
+ width: '20%',
31
+ },
32
+ {
33
+ label: t('tableColumnHeaderTaxRate'),
34
+ width: '10%',
35
+ },
36
+ {
37
+ label: t('tableColumnHeaderDescription'),
38
+ width: '20%',
39
+ },
40
+ {
41
+ label: t('tableColumnHeaderEnabled'),
42
+ width: '10%',
43
+ },
44
+ {
45
+ label: t('tableColumnHeaderIsDefault'),
46
+ width: '10%',
47
+ },
48
+ {
49
+ label: t('tableColumnHeaderActivity'),
50
+ width: '20%',
51
+ },
52
+ {
53
+ label: t('tableColumnHeaderActions'),
54
+ width: '5%',
55
+ },
56
+ ];
57
+ var totalPages = (0, util_functions_1.calculatePages)(count, pageLimit);
58
+ return (react_1.default.createElement(react_1.default.Fragment, null,
59
+ react_1.default.createElement(vista_table_v1_1.VistaTableV1, { currentPage: 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('tableHeaderSearchPlaceholder'), searchValue: searchQuery, selectKey1: "option", selectedItem: { option: String(pageLimit) }, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: taxes, tableDescription: t('tableDescription'), tableHeadItems: tableHeadItems, tableHeading: t('tableTitle'), totalPages: totalPages }),
60
+ react_1.default.createElement(drawer_1.TaxDrawer, { translationMap: translationMap }),
61
+ react_1.default.createElement(generate_toast_1.VistaToaster, null)));
62
+ };
63
+ exports.Tax = Tax;
@@ -0,0 +1,253 @@
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 { TaxActions } from './actions';
4
+ import { Dispatch } from 'react';
5
+ import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
6
+ export interface MenuItem {
7
+ preferenceId: string;
8
+ label: string;
9
+ order: number;
10
+ id: string;
11
+ }
12
+ export interface Tax {
13
+ taxName: string;
14
+ taxValue: string;
15
+ id: string;
16
+ description: string;
17
+ preferenceId: string;
18
+ enabled: boolean;
19
+ errors: {
20
+ [key: string]: string;
21
+ };
22
+ createdAt?: string;
23
+ updatedAt?: string;
24
+ loading: boolean;
25
+ isDefault: boolean;
26
+ btnDisableTax: boolean;
27
+ }
28
+ export type TaxForm = Omit<TaxTypeBE, 'createdAt' | 'updatedAt' | 'preference'>;
29
+ export interface TaxState {
30
+ count: number;
31
+ currentPage: number;
32
+ description: string;
33
+ disableSaveButton: boolean;
34
+ drawer: null | TAX_DRAWER;
35
+ enabled: boolean;
36
+ errors: {
37
+ [key: string]: string;
38
+ };
39
+ id: string;
40
+ isDefault: boolean;
41
+ pageLimit: number;
42
+ preferenceId: string;
43
+ searchQuery: string;
44
+ taxName: string;
45
+ taxRate: string;
46
+ taxes: TaxTypeBE[];
47
+ }
48
+ export interface BankingDetailTypeBE {
49
+ accountNumber: string;
50
+ accountTitle: string;
51
+ bankAddress?: string;
52
+ bankName: string;
53
+ createdAt: string;
54
+ enabled: boolean;
55
+ iban?: string;
56
+ id: string;
57
+ isDefault: boolean;
58
+ preference: PreferenceTypeBE;
59
+ preferenceId: string;
60
+ swiftCode?: string;
61
+ updatedAt: string;
62
+ }
63
+ export interface BranchTypeBE {
64
+ branchAddress: string;
65
+ branchName: string;
66
+ createdAt: string;
67
+ enabled: boolean;
68
+ id: string;
69
+ isDefault: boolean;
70
+ personEmail: string;
71
+ personName: string;
72
+ personPhone: string;
73
+ preference: PreferenceTypeBE;
74
+ preferenceId: string;
75
+ updatedAt: string;
76
+ }
77
+ export interface CurrencyTypeBE {
78
+ code: string;
79
+ createdAt: string;
80
+ enabled: boolean;
81
+ id: string;
82
+ isDefault: boolean;
83
+ label: string;
84
+ preference?: PreferenceTypeBE;
85
+ preferenceId: string;
86
+ updatedAt: string;
87
+ }
88
+ export interface MenuOrderTypeBE {
89
+ createdAt: string;
90
+ id: string;
91
+ label: string;
92
+ order: number;
93
+ preference: PreferenceTypeBE;
94
+ preferenceId: string;
95
+ updatedAt: string;
96
+ }
97
+ export declare enum PAYMENT_TYPE {
98
+ FULL_PAYMENT = "FULL_PAYMENT",
99
+ PARTIAL_PAYMENT = "PARTIAL_PAYMENT"
100
+ }
101
+ export interface PaymentTypeBE {
102
+ amount: string;
103
+ attachment?: string;
104
+ balance: string;
105
+ createdAt: string;
106
+ currency: string;
107
+ date: string;
108
+ description?: string;
109
+ id: string;
110
+ paymentMode?: PaymentModeTypeBE;
111
+ paymentModeId: string;
112
+ paymentType: PAYMENT_TYPE;
113
+ quoteInvoice?: undefined;
114
+ quoteInvoiceId: string;
115
+ ref: string;
116
+ updatedAt: string;
117
+ }
118
+ export interface PaymentModeTypeBE {
119
+ createdAt: string;
120
+ enabled: boolean;
121
+ id: string;
122
+ isDefault: boolean;
123
+ label: string;
124
+ payments?: PaymentTypeBE[];
125
+ preference?: PreferenceTypeBE;
126
+ preferenceId: string;
127
+ updatedAt: string;
128
+ }
129
+ export interface TaxTypeBE {
130
+ createdAt: string;
131
+ description?: string;
132
+ enabled: boolean;
133
+ id: string;
134
+ isDefault: boolean;
135
+ preference: PreferenceTypeBE;
136
+ preferenceId: string;
137
+ taxName: string;
138
+ taxRate: string;
139
+ updatedAt: string;
140
+ }
141
+ export interface PreferenceTypeBE {
142
+ bankingDetails: BankingDetailTypeBE[];
143
+ branches: BranchTypeBE[];
144
+ createdAt: string;
145
+ currencies: CurrencyTypeBE[];
146
+ id: string;
147
+ menuOrder: MenuOrderTypeBE[];
148
+ onboarding: boolean;
149
+ paymentModes: PaymentModeTypeBE[];
150
+ taxes: TaxTypeBE[];
151
+ updatedAt: string;
152
+ }
153
+ export interface TaxContextType {
154
+ byIdError?: Error;
155
+ byIdLoading: boolean;
156
+ clearSearch: () => void;
157
+ closeDrawer: () => void;
158
+ deleteError?: Error;
159
+ deleteLoading: boolean;
160
+ dispatch: Dispatch<TaxActions>;
161
+ dynamicFormElements: VistaFormElements;
162
+ handleNextClick: () => void;
163
+ handlePageLimit: (k: string, v: object) => void;
164
+ handlePreviousClick: () => void;
165
+ handleSubmit: () => void;
166
+ headerActions: VistaTableHeaderActionItem[];
167
+ listError?: Error;
168
+ listLoading: boolean;
169
+ rowActions: RowActionItem[];
170
+ searchOnChange: (k: string, v: string) => void;
171
+ updateError?: Error;
172
+ updateLoading: boolean;
173
+ }
174
+ export interface CreateBankDetailArg {
175
+ id: string;
176
+ accountNumber: string;
177
+ accountTitle: string;
178
+ bankAddress: string;
179
+ bankName: string;
180
+ enabled: boolean;
181
+ iban: string;
182
+ swiftCode: string;
183
+ preferenceId: string;
184
+ errors: {
185
+ [key: string]: string;
186
+ };
187
+ loading: boolean;
188
+ isDefault: boolean;
189
+ }
190
+ export interface createBranchesArgs {
191
+ personName: string;
192
+ personEmail: string;
193
+ id: string;
194
+ personPhone: string;
195
+ branchAddress: string;
196
+ branchName: string;
197
+ preferenceId: string;
198
+ enabled: boolean;
199
+ errors: {
200
+ [key: string]: string;
201
+ };
202
+ createdAt?: string;
203
+ updatedAt?: string;
204
+ loading: boolean;
205
+ isDefault: boolean;
206
+ }
207
+ export interface createTaxesArgs {
208
+ taxName: string;
209
+ taxValue: string;
210
+ id: string;
211
+ description: string;
212
+ preferenceId: string;
213
+ enabled: boolean;
214
+ errors: {
215
+ [key: string]: string;
216
+ };
217
+ createdAt?: string;
218
+ updatedAt?: string;
219
+ loading: boolean;
220
+ isDefault: boolean;
221
+ }
222
+ export interface updatePaymentModeArgs {
223
+ id: string;
224
+ enabled: boolean;
225
+ }
226
+ export interface MenuItem {
227
+ preferenceId: string;
228
+ label: string;
229
+ order: number;
230
+ id: string;
231
+ }
232
+ export type CurrencyArgs = {
233
+ id: string;
234
+ label: string;
235
+ enabled: boolean;
236
+ code: string;
237
+ isDefault: boolean;
238
+ preferenceId: string;
239
+ };
240
+ export interface updateCurrencyArgs {
241
+ id: string;
242
+ label: string;
243
+ enabled: boolean;
244
+ code: string;
245
+ isDefault: boolean;
246
+ preferenceId: string;
247
+ }
248
+ export declare enum TAX_DRAWER {
249
+ FORM_DRAWER = "FORM_DRAWER"
250
+ }
251
+ export declare enum PREFERENCE_MODAL {
252
+ DUMMY = "DUMMY"
253
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PREFERENCE_MODAL = exports.TAX_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 TAX_DRAWER;
16
+ (function (TAX_DRAWER) {
17
+ TAX_DRAWER["FORM_DRAWER"] = "FORM_DRAWER";
18
+ })(TAX_DRAWER || (exports.TAX_DRAWER = TAX_DRAWER = {}));
19
+ var PREFERENCE_MODAL;
20
+ (function (PREFERENCE_MODAL) {
21
+ PREFERENCE_MODAL["DUMMY"] = "DUMMY";
22
+ })(PREFERENCE_MODAL || (exports.PREFERENCE_MODAL = PREFERENCE_MODAL = {}));
@@ -0,0 +1,24 @@
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
+ preferenceId: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ enabled: boolean;
11
+ isDefault: boolean;
12
+ preferenceId: string;
13
+ taxName: string;
14
+ taxRate: string;
15
+ description?: string | undefined;
16
+ }, {
17
+ enabled: boolean;
18
+ isDefault: boolean;
19
+ preferenceId: string;
20
+ taxName: string;
21
+ taxRate: string;
22
+ description?: string | undefined;
23
+ }>;
24
+ export type TaxFormValidate = z.infer<typeof formValidation>;
@@ -0,0 +1,17 @@
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.validationError.taxName),
10
+ taxRate: zod_1.z
11
+ .string()
12
+ .nonempty(constants_1.validationError.taxRate),
13
+ enabled: zod_1.z.boolean(),
14
+ isDefault: zod_1.z.boolean(),
15
+ description: zod_1.z.string().optional(),
16
+ preferenceId: zod_1.z.string().nonempty(constants_1.validationError.preferenceId),
17
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/stellar-solutions-modules",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "scripts": {
5
5
  "build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib",
6
6
  "build:next": "next build",