@appcorp/stellar-solutions-modules 0.1.15 → 0.1.17

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 (32) hide show
  1. package/global-modules/branch/context.js +7 -7
  2. package/global-modules/branch/validate.d.ts +1 -1
  3. package/global-modules/payment-mode/context.js +7 -7
  4. package/global-modules/payment-mode/validate.d.ts +1 -1
  5. package/global-modules/preferences/actions.d.ts +2 -141
  6. package/global-modules/preferences/actions.js +0 -22
  7. package/global-modules/preferences/branch-drawer.d.ts +0 -8
  8. package/global-modules/preferences/branch-drawer.js +36 -19
  9. package/global-modules/preferences/branch-form-elements.d.ts +0 -3
  10. package/global-modules/preferences/branch-form-elements.js +30 -41
  11. package/global-modules/preferences/branch-form.d.ts +0 -8
  12. package/global-modules/preferences/branch-form.js +33 -81
  13. package/global-modules/preferences/branch.d.ts +0 -2
  14. package/global-modules/preferences/branch.js +106 -69
  15. package/global-modules/preferences/constants.d.ts +0 -29
  16. package/global-modules/preferences/constants.js +1 -302
  17. package/global-modules/preferences/context.js +5 -582
  18. package/global-modules/preferences/payment-mode-drawer.d.ts +0 -8
  19. package/global-modules/preferences/payment-mode-drawer.js +36 -19
  20. package/global-modules/preferences/payment-mode-form-elements.d.ts +0 -3
  21. package/global-modules/preferences/payment-mode-form-elements.js +30 -41
  22. package/global-modules/preferences/payment-mode-form.d.ts +0 -8
  23. package/global-modules/preferences/payment-mode-form.js +33 -81
  24. package/global-modules/preferences/payment-mode.d.ts +0 -2
  25. package/global-modules/preferences/payment-mode.js +94 -57
  26. package/global-modules/preferences/preferences.js +2 -1
  27. package/global-modules/preferences/reducer.js +6 -162
  28. package/global-modules/preferences/types.d.ts +0 -46
  29. package/global-modules/preferences/validate.d.ts +1 -1
  30. package/global-modules/tax/context.js +7 -11
  31. package/global-modules/tax/validate.d.ts +1 -1
  32. package/package.json +2 -2
@@ -1,69 +1,106 @@
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.Branch = 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 payment_mode_drawer_1 = require("./payment-mode-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 Branch = function () {
16
- var _a = (0, context_1.usePreferenceStateContext)(), branchCount = _a.branchCount, branchPageLimit = _a.branchPageLimit, branchSearchQuery = _a.branchSearchQuery, branches = _a.branches, branchListLoading = _a.branchListLoading, branchHeaderActions = _a.branchHeaderActions, branchRowActions = _a.branchRowActions, branchCurrentPage = _a.branchCurrentPage;
17
- var t = (0, next_intl_1.useTranslations)('branchPage');
18
- var translationMap = {
19
- formLabelName: t('formLabelName'),
20
- formLabelCountry: t('formLabelCountry'),
21
- formLabelPhone: t('formLabelPhone'),
22
- formLabelWebsite: t('formLabelWebsite'),
23
- formLabelEmail: t('formLabelEmail'),
24
- };
25
- var tableHeadItems = [
26
- {
27
- label: t('tableColumnHeaderId'),
28
- width: '5%',
29
- },
30
- {
31
- label: t('tableColumnHeaderBranchName'),
32
- width: '15%',
33
- },
34
- {
35
- label: t('tableColumnHeaderBranchAddress'),
36
- width: '15%',
37
- },
38
- {
39
- label: t('tableColumnHeaderEnabled'),
40
- width: '10%',
41
- },
42
- {
43
- label: t('tableColumnHeaderIsDefault'),
44
- width: '10%',
45
- },
46
- {
47
- label: t('tableColumnHeaderPersonName'),
48
- width: '20%',
49
- },
50
- {
51
- label: t('tableColumnHeaderEmailPhone'),
52
- width: '10%',
53
- },
54
- {
55
- label: t('tableColumnHeaderActivity'),
56
- width: '10%',
57
- },
58
- {
59
- label: t('tableColumnHeaderActions'),
60
- width: '5%',
61
- },
62
- ];
63
- var totalPages = (0, util_functions_1.calculatePages)(branchCount, branchPageLimit);
64
- return (react_1.default.createElement(react_1.default.Fragment, null,
65
- react_1.default.createElement(vista_table_v1_1.VistaTableV1, { currentPage: branchCount, handleNextOnClick: function () { return void 0; }, handleOnSelect: function () { return void 0; }, handlePreviousOnClick: function () { return void 0; }, handleSearchInput: function () { return void 0; }, headerActions: branchHeaderActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(branchCurrentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(branchCurrentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(branchCount), loading: branchListLoading, nodeSelectKey: "branchPageLimit", pageLimit: branchPageLimit, rowActions: branchRowActions, searchDisabled: false, searchEnabled: true, searchId: "branch-search", searchPlaceholder: t('tableHeaderSearchPlaceholder'), searchValue: branchSearchQuery, selectKey1: "option", selectedItem: { option: String(branchPageLimit) }, tableBodyCols: constants_1.branchTableBodyCols, tableBodyRows: branches, tableDescription: t('tableDescription'), tableHeadItems: tableHeadItems, tableHeading: t('tableTitle'), totalPages: totalPages }),
66
- react_1.default.createElement(payment_mode_drawer_1.PaymentModeDrawer, { translationMap: translationMap }),
67
- react_1.default.createElement(generate_toast_1.VistaToaster, null)));
68
- };
69
- exports.Branch = Branch;
1
+ // import React from "react";
2
+ // import { VistaTableV1 } from "@appcorp/app-corp-vista/organisms/vista-table-v1/vista-table-v1";
3
+ // import { PaymentModeDrawer } from "./payment-mode-drawer";
4
+ // import { VistaToaster } from "@appcorp/app-corp-vista/utils/generate-toast";
5
+ // import { useTranslations } from "next-intl";
6
+ // import { usePreferenceStateContext } from "./context";
7
+ // import {
8
+ // calculatePages,
9
+ // getAvailablePageLimits,
10
+ // isNextButtonDisabled,
11
+ // isPreviousButtonDisabled,
12
+ // } from "@react-pakistan/util-functions";
13
+ // import { branchTableBodyCols } from "./constants";
14
+ // export const Branch = () => {
15
+ // const {
16
+ // branchCount,
17
+ // branchPageLimit,
18
+ // branchSearchQuery,
19
+ // branches,
20
+ // branchListLoading,
21
+ // branchHeaderActions,
22
+ // branchRowActions,
23
+ // branchCurrentPage,
24
+ // } = usePreferenceStateContext();
25
+ // const t = useTranslations('branchPage');
26
+ // const translationMap = {
27
+ // formLabelName: t('formLabelName'),
28
+ // formLabelCountry: t('formLabelCountry'),
29
+ // formLabelPhone: t('formLabelPhone'),
30
+ // formLabelWebsite: t('formLabelWebsite'),
31
+ // formLabelEmail: t('formLabelEmail'),
32
+ // };
33
+ // const tableHeadItems = [
34
+ // {
35
+ // label: t('tableColumnHeaderId'),
36
+ // width: '5%',
37
+ // },
38
+ // {
39
+ // label: t('tableColumnHeaderBranchName'),
40
+ // width: '15%',
41
+ // },
42
+ // {
43
+ // label: t('tableColumnHeaderBranchAddress'),
44
+ // width: '15%',
45
+ // },
46
+ // {
47
+ // label: t('tableColumnHeaderEnabled'),
48
+ // width: '10%',
49
+ // },
50
+ // {
51
+ // label: t('tableColumnHeaderIsDefault'),
52
+ // width: '10%',
53
+ // },
54
+ // {
55
+ // label: t('tableColumnHeaderPersonName'),
56
+ // width: '20%',
57
+ // },
58
+ // {
59
+ // label: t('tableColumnHeaderEmailPhone'),
60
+ // width: '10%',
61
+ // },
62
+ // {
63
+ // label: t('tableColumnHeaderActivity'),
64
+ // width: '10%',
65
+ // },
66
+ // {
67
+ // label: t('tableColumnHeaderActions'),
68
+ // width: '5%',
69
+ // },
70
+ // ];
71
+ // const totalPages = calculatePages(branchCount, branchPageLimit);
72
+ // return (
73
+ // <>
74
+ // <VistaTableV1
75
+ // currentPage={branchCount}
76
+ // handleNextOnClick={() => void 0}
77
+ // handleOnSelect={() => void 0}
78
+ // handlePreviousOnClick={() => void 0}
79
+ // handleSearchInput={() => void 0}
80
+ // headerActions={branchHeaderActions}
81
+ // isNextDisabled={isNextButtonDisabled(branchCurrentPage, totalPages)}
82
+ // isPreviousDisabled={isPreviousButtonDisabled(branchCurrentPage)}
83
+ // listOptions={getAvailablePageLimits(branchCount)}
84
+ // loading={branchListLoading}
85
+ // nodeSelectKey="branchPageLimit"
86
+ // pageLimit={branchPageLimit}
87
+ // rowActions={branchRowActions}
88
+ // searchDisabled={false}
89
+ // searchEnabled
90
+ // searchId="branch-search"
91
+ // searchPlaceholder={t('tableHeaderSearchPlaceholder')}
92
+ // searchValue={branchSearchQuery}
93
+ // selectKey1="option"
94
+ // selectedItem={{ option: String(branchPageLimit) }}
95
+ // tableBodyCols={branchTableBodyCols}
96
+ // tableBodyRows={branches}
97
+ // tableDescription={t('tableDescription')}
98
+ // tableHeadItems={tableHeadItems}
99
+ // tableHeading={t('tableTitle')}
100
+ // totalPages={totalPages}
101
+ // />
102
+ // <PaymentModeDrawer translationMap={translationMap} />
103
+ // <VistaToaster />
104
+ // </>
105
+ // );
106
+ // };
@@ -1,6 +1,4 @@
1
- import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
2
1
  import { ReactNode } from 'react';
3
- import { VISTA_TABLE_CELL_TYPE } from '@appcorp/app-corp-vista/type/vista-table-type';
4
2
  export declare const pageLimit: number;
5
3
  export declare const initialMenuItems: {
6
4
  id: string;
@@ -8,33 +6,6 @@ export declare const initialMenuItems: {
8
6
  order: number;
9
7
  preferenceId: string;
10
8
  }[];
11
- export declare const staticBankDetailsFormElements: VistaFormElements;
12
- export declare const paymentModeStaticFormElements: VistaFormElements;
13
- export declare const taxStaticFormElements: VistaFormElements;
14
- export declare const paymentModeTableBodyCols: ({
15
- componentType: VISTA_TABLE_CELL_TYPE;
16
- key: string;
17
- } | {
18
- componentType: VISTA_TABLE_CELL_TYPE;
19
- key?: undefined;
20
- })[];
21
- export declare const branchTableBodyCols: ({
22
- componentType: VISTA_TABLE_CELL_TYPE;
23
- key: string;
24
- } | {
25
- componentType: VISTA_TABLE_CELL_TYPE;
26
- key: string[];
27
- } | {
28
- componentType: VISTA_TABLE_CELL_TYPE;
29
- key?: undefined;
30
- })[];
31
- export declare const taxTableBodyCols: ({
32
- componentType: VISTA_TABLE_CELL_TYPE;
33
- key: string;
34
- } | {
35
- componentType: VISTA_TABLE_CELL_TYPE;
36
- key?: undefined;
37
- })[];
38
9
  export declare const PREFERENCE_API_ROUTES: {
39
10
  BRANCH: string;
40
11
  BRANCHES: string;
@@ -2,17 +2,14 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- var _a, _b, _c;
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.taxValidationError = exports.dashboardTabsMap = exports.toastErrors = exports.PREFERENCE_API_ROUTES = exports.taxTableBodyCols = exports.branchTableBodyCols = exports.paymentModeTableBodyCols = exports.taxStaticFormElements = exports.paymentModeStaticFormElements = exports.staticBankDetailsFormElements = exports.initialMenuItems = exports.pageLimit = void 0;
6
+ exports.taxValidationError = exports.dashboardTabsMap = exports.toastErrors = exports.PREFERENCE_API_ROUTES = exports.initialMenuItems = exports.pageLimit = void 0;
8
7
  var react_1 = __importDefault(require("react"));
9
- var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
10
8
  var currency_1 = require("./currency");
11
9
  var payment_mode_1 = require("../payment-mode/payment-mode");
12
10
  var branch_1 = require("../branch/branch");
13
11
  var tax_1 = require("../tax/tax");
14
12
  var bank_1 = require("./bank");
15
- var vista_table_type_1 = require("@appcorp/app-corp-vista/type/vista-table-type");
16
13
  exports.pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT);
17
14
  exports.initialMenuItems = [
18
15
  { id: 'item-1', label: 'Dashboard', order: 1, preferenceId: 'preference-1' },
@@ -63,304 +60,6 @@ exports.initialMenuItems = [
63
60
  },
64
61
  { id: 'item-17', label: 'Log out', order: 17, preferenceId: 'preference-1' },
65
62
  ];
66
- exports.staticBankDetailsFormElements = (_a = {},
67
- _a[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
68
- {
69
- enabled: true,
70
- order: 1,
71
- id: 'accountTitle',
72
- type: 'text',
73
- placeholder: '',
74
- label: '',
75
- value: '',
76
- handleOnChange: function () { return void 0; },
77
- required: true,
78
- disabled: false,
79
- },
80
- {
81
- enabled: true,
82
- order: 2,
83
- id: 'accountNumber',
84
- type: 'text',
85
- placeholder: '',
86
- label: '',
87
- value: '',
88
- handleOnChange: function () { return void 0; },
89
- required: true,
90
- disabled: false,
91
- },
92
- {
93
- enabled: true,
94
- order: 3,
95
- id: 'iban',
96
- type: 'text',
97
- placeholder: '',
98
- label: '',
99
- value: '',
100
- handleOnChange: function () { return void 0; },
101
- required: true,
102
- disabled: false,
103
- },
104
- {
105
- enabled: true,
106
- order: 4,
107
- id: 'swiftCode',
108
- type: 'text',
109
- placeholder: '',
110
- label: '',
111
- value: '',
112
- handleOnChange: function () { return void 0; },
113
- required: true,
114
- disabled: false,
115
- },
116
- {
117
- enabled: true,
118
- order: 5,
119
- id: 'bankName',
120
- type: 'text',
121
- placeholder: '',
122
- label: '',
123
- value: '',
124
- handleOnChange: function () { return void 0; },
125
- required: true,
126
- disabled: false,
127
- },
128
- ],
129
- _a[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_AREA_V1] = [
130
- {
131
- enabled: true,
132
- order: 6,
133
- id: 'bankAddress',
134
- placeholder: '',
135
- label: '',
136
- value: '',
137
- handleOnChange: function () { return void 0; },
138
- disabled: false,
139
- },
140
- ],
141
- _a);
142
- exports.paymentModeStaticFormElements = (_b = {},
143
- _b[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
144
- {
145
- enabled: true,
146
- error: '',
147
- handleOnChange: function () { return void 0; },
148
- id: 'name',
149
- label: 'formLabelName',
150
- order: 1,
151
- placeholder: 'Company Name goes here...',
152
- required: true,
153
- type: 'text',
154
- value: '',
155
- },
156
- {
157
- enabled: true,
158
- error: '',
159
- handleOnChange: function () { return void 0; },
160
- id: 'phone',
161
- label: 'formLabelPhone',
162
- order: 2,
163
- placeholder: 'Phone goes here...',
164
- required: true,
165
- type: 'text',
166
- value: '',
167
- },
168
- {
169
- enabled: true,
170
- error: '',
171
- handleOnChange: function () { return void 0; },
172
- id: 'email',
173
- label: 'formLabelEmail',
174
- order: 3,
175
- placeholder: 'Email goes here...',
176
- required: true,
177
- type: 'email',
178
- value: '',
179
- },
180
- {
181
- enabled: true,
182
- error: '',
183
- handleOnChange: function () { return void 0; },
184
- id: 'website',
185
- label: 'formLabelWebsite',
186
- order: 4,
187
- placeholder: 'Website goes here...',
188
- required: true,
189
- type: 'text',
190
- value: '',
191
- },
192
- ],
193
- _b[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1] = [
194
- {
195
- disabled: false,
196
- enabled: true,
197
- handleInputOnChange: function () { return void 0; },
198
- handleOnBlur: function () { return void 0; },
199
- handleOnChange: function () { return void 0; },
200
- label: 'formLabelCountry',
201
- listItems: [{ id: 'country-1', name: 'Country1' }, { id: 'country-2', name: 'Country2' }],
202
- nodeQueryKey: 'countryQuery',
203
- nodeSelectKey: 'country',
204
- order: 5,
205
- query: '',
206
- required: true,
207
- selectKey1: 'name',
208
- selectedItem: { id: 'country-2' },
209
- },
210
- ],
211
- _b);
212
- exports.taxStaticFormElements = (_c = {},
213
- _c[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
214
- {
215
- enabled: true,
216
- error: '',
217
- handleOnChange: function () { return void 0; },
218
- id: 'taxName',
219
- label: 'formLabelTaxName',
220
- order: 1,
221
- placeholder: 'Tax Name...',
222
- required: true,
223
- type: 'text',
224
- value: '',
225
- },
226
- {
227
- enabled: true,
228
- error: '',
229
- handleOnChange: function () { return void 0; },
230
- id: 'taxRate',
231
- label: 'formLabelTaxRate',
232
- order: 2,
233
- placeholder: 'Tax Rate...',
234
- required: true,
235
- type: 'number',
236
- value: '',
237
- },
238
- ],
239
- _c[form_schema_1.VISTA_FORM_ELEMENTS.TOGGLE_V1] = [
240
- {
241
- id: 'enabled',
242
- enabled: true,
243
- value: false,
244
- order: 3,
245
- handleOnChange: function () { return void 0; },
246
- label: 'Enabled',
247
- required: true,
248
- },
249
- {
250
- id: 'isDefault',
251
- enabled: true,
252
- value: false,
253
- order: 4,
254
- handleOnChange: function () { return void 0; },
255
- label: 'IsDefault',
256
- required: true,
257
- },
258
- ],
259
- _c[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_AREA_V1] = [
260
- {
261
- enabled: true,
262
- handleOnChange: function () { return void 0; },
263
- id: 'description',
264
- label: 'formLabelDescription',
265
- order: 5,
266
- placeholder: 'Tax Description...',
267
- required: false,
268
- value: '',
269
- },
270
- ],
271
- _c);
272
- exports.paymentModeTableBodyCols = [
273
- {
274
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ID,
275
- key: 'id',
276
- },
277
- {
278
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOLD_TEXT,
279
- key: 'label',
280
- },
281
- {
282
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
283
- key: 'enabled',
284
- },
285
- {
286
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
287
- key: 'isDefault',
288
- },
289
- {
290
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.CREATED_UPDATED_AT,
291
- },
292
- {
293
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ACTIONS,
294
- },
295
- ];
296
- exports.branchTableBodyCols = [
297
- {
298
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ID,
299
- key: 'id',
300
- },
301
- {
302
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOLD_TEXT,
303
- key: 'branchName',
304
- },
305
- {
306
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
307
- key: 'branchAddress',
308
- },
309
- {
310
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
311
- key: 'enabled',
312
- },
313
- {
314
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
315
- key: 'isDefault',
316
- },
317
- {
318
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
319
- key: 'personName',
320
- },
321
- {
322
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.MULTIPLE_TEXT_LINES,
323
- key: ['personPhone', 'personEmail'],
324
- },
325
- {
326
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.CREATED_UPDATED_AT,
327
- },
328
- {
329
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ACTIONS,
330
- },
331
- ];
332
- exports.taxTableBodyCols = [
333
- {
334
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ID,
335
- key: 'id',
336
- },
337
- {
338
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOLD_TEXT,
339
- key: 'taxName',
340
- },
341
- {
342
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
343
- key: 'taxRate',
344
- },
345
- {
346
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
347
- key: 'description',
348
- },
349
- {
350
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
351
- key: 'enabled',
352
- },
353
- {
354
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
355
- key: 'isDefault',
356
- },
357
- {
358
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.CREATED_UPDATED_AT,
359
- },
360
- {
361
- componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ACTIONS,
362
- },
363
- ];
364
63
  exports.PREFERENCE_API_ROUTES = {
365
64
  BRANCH: '/api/branch',
366
65
  BRANCHES: '/api/branches',