@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,83 @@
1
+ import { BranchTypeBE, BRANCH_DRAWER } from './types';
2
+ export declare enum BRANCH_ACTION_TYPES {
3
+ CLEAR_ERRORS = "CLEAR_ERRORS",
4
+ RESET_FORM = "RESET_FORM",
5
+ SET_BRANCHES = "SET_BRANCHES",
6
+ SET_COUNT = "SET_COUNT",
7
+ SET_CURRENT_PAGE = "SET_CURRENT_PAGE",
8
+ SET_DISABLE_SAVE_BUTTON = "SET_DISABLE_SAVE_BUTTON",
9
+ SET_DRAWER = "SET_DRAWER",
10
+ SET_ERRORS = "SET_ERRORS",
11
+ SET_FORM = "SET_FORM",
12
+ SET_INPUT_FIELD = "SET_INPUT_FIELD",
13
+ SET_PAGE_LIMIT = "SET_PAGE_LIMIT",
14
+ SET_SEARCH_QUERY = "SET_SEARCH_QUERY"
15
+ }
16
+ export type BranchSetErrorsAction = {
17
+ type: BRANCH_ACTION_TYPES.SET_ERRORS;
18
+ payload: {
19
+ errors: Record<string, string>;
20
+ };
21
+ };
22
+ export type BranchSetSearchQueryAction = {
23
+ type: BRANCH_ACTION_TYPES.SET_SEARCH_QUERY;
24
+ payload: {
25
+ searchQuery: string;
26
+ };
27
+ };
28
+ export type BranchResetFormAction = {
29
+ type: BRANCH_ACTION_TYPES.RESET_FORM;
30
+ };
31
+ export type BranchSetCountAction = {
32
+ type: BRANCH_ACTION_TYPES.SET_COUNT;
33
+ payload: {
34
+ count: number;
35
+ };
36
+ };
37
+ export type BranchSetBranchesAction = {
38
+ type: BRANCH_ACTION_TYPES.SET_BRANCHES;
39
+ payload: {
40
+ branches: BranchTypeBE[];
41
+ };
42
+ };
43
+ export type BranchSetFormAction = {
44
+ type: BRANCH_ACTION_TYPES.SET_FORM;
45
+ payload: {
46
+ form: BranchTypeBE;
47
+ };
48
+ };
49
+ export type BranchSetDrawerAction = {
50
+ type: BRANCH_ACTION_TYPES.SET_DRAWER;
51
+ payload: {
52
+ drawer: null | BRANCH_DRAWER;
53
+ };
54
+ };
55
+ export type BranchSetInputFieldAction = {
56
+ type: BRANCH_ACTION_TYPES.SET_INPUT_FIELD;
57
+ payload: {
58
+ key: keyof BranchTypeBE;
59
+ value: string | string[] | boolean | number | number[];
60
+ };
61
+ };
62
+ export type BranchSetDisableSaveButtonAction = {
63
+ type: BRANCH_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON;
64
+ payload: {
65
+ disableSaveButton: boolean;
66
+ };
67
+ };
68
+ export type BranchClearErrorsAction = {
69
+ type: BRANCH_ACTION_TYPES.CLEAR_ERRORS;
70
+ };
71
+ export type BranchSetCurrentPageAction = {
72
+ type: BRANCH_ACTION_TYPES.SET_CURRENT_PAGE;
73
+ payload: {
74
+ currentPage: number;
75
+ };
76
+ };
77
+ export type BranchSetPageLimitAction = {
78
+ type: BRANCH_ACTION_TYPES.SET_PAGE_LIMIT;
79
+ payload: {
80
+ pageLimit: number;
81
+ };
82
+ };
83
+ export type BranchActions = BranchSetErrorsAction | BranchSetCountAction | BranchSetBranchesAction | BranchSetFormAction | BranchSetDrawerAction | BranchSetInputFieldAction | BranchSetDisableSaveButtonAction | BranchClearErrorsAction | BranchSetCurrentPageAction | BranchSetPageLimitAction | BranchResetFormAction | BranchSetSearchQueryAction;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BRANCH_ACTION_TYPES = void 0;
4
+ var BRANCH_ACTION_TYPES;
5
+ (function (BRANCH_ACTION_TYPES) {
6
+ BRANCH_ACTION_TYPES["CLEAR_ERRORS"] = "CLEAR_ERRORS";
7
+ BRANCH_ACTION_TYPES["RESET_FORM"] = "RESET_FORM";
8
+ BRANCH_ACTION_TYPES["SET_BRANCHES"] = "SET_BRANCHES";
9
+ BRANCH_ACTION_TYPES["SET_COUNT"] = "SET_COUNT";
10
+ BRANCH_ACTION_TYPES["SET_CURRENT_PAGE"] = "SET_CURRENT_PAGE";
11
+ BRANCH_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
12
+ BRANCH_ACTION_TYPES["SET_DRAWER"] = "SET_DRAWER";
13
+ BRANCH_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
14
+ BRANCH_ACTION_TYPES["SET_FORM"] = "SET_FORM";
15
+ BRANCH_ACTION_TYPES["SET_INPUT_FIELD"] = "SET_INPUT_FIELD";
16
+ BRANCH_ACTION_TYPES["SET_PAGE_LIMIT"] = "SET_PAGE_LIMIT";
17
+ BRANCH_ACTION_TYPES["SET_SEARCH_QUERY"] = "SET_SEARCH_QUERY";
18
+ })(BRANCH_ACTION_TYPES || (exports.BRANCH_ACTION_TYPES = BRANCH_ACTION_TYPES = {}));
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const Branch: () => React.JSX.Element;
@@ -0,0 +1,69 @@
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 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 Branch = function () {
16
+ var _a = (0, context_1.useBranchStateContext)(), branches = _a.branches, 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, searchOnChange = _a.searchOnChange, searchQuery = _a.searchQuery;
17
+ var t = (0, next_intl_1.useTranslations)('branchPage');
18
+ var translationMap = {
19
+ formLabelBranchName: t('formLabelBranchName'),
20
+ formLabelBranchAddress: t('formLabelBranchAddress'),
21
+ formLabelPersonName: t('formLabelPersonName'),
22
+ formLabelPersonPhone: t('formLabelPersonPhone'),
23
+ formLabelPersonEmail: t('formLabelPersonEmail'),
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: '20%',
37
+ },
38
+ {
39
+ label: t('tableColumnHeaderPersonName'),
40
+ width: '10%',
41
+ },
42
+ {
43
+ label: t('tableColumnHeaderEmailPhone'),
44
+ width: '10%',
45
+ },
46
+ {
47
+ label: t('tableColumnHeaderEnabled'),
48
+ width: '10%',
49
+ },
50
+ {
51
+ label: t('tableColumnHeaderIsDefault'),
52
+ width: '10%',
53
+ },
54
+ {
55
+ label: t('tableColumnHeaderActivity'),
56
+ width: '15%',
57
+ },
58
+ {
59
+ label: t('tableColumnHeaderActions'),
60
+ width: '5%',
61
+ },
62
+ ];
63
+ var totalPages = (0, util_functions_1.calculatePages)(count, pageLimit);
64
+ return (react_1.default.createElement(react_1.default.Fragment, null,
65
+ 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: "branch-search", searchPlaceholder: t('tableHeaderSearchPlaceholder'), searchValue: searchQuery, selectKey1: "option", selectedItem: { option: String(pageLimit) }, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: branches, tableDescription: t('tableDescription'), tableHeadItems: tableHeadItems, tableHeading: t('tableTitle'), totalPages: totalPages }),
66
+ react_1.default.createElement(drawer_1.BranchDrawer, { translationMap: translationMap }),
67
+ react_1.default.createElement(generate_toast_1.VistaToaster, null)));
68
+ };
69
+ exports.Branch = Branch;
@@ -0,0 +1,35 @@
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: string[];
11
+ } | {
12
+ componentType: VISTA_TABLE_CELL_TYPE;
13
+ key?: undefined;
14
+ })[];
15
+ export declare const BRANCH_API_ROUTES: {
16
+ BRANCH: string;
17
+ BRANCHES: string;
18
+ BRANCH_BY_ID: string;
19
+ };
20
+ export declare const toastErrors: {
21
+ fetchInvoiceError: string;
22
+ formSubmittedSuccess: string;
23
+ genericError: string;
24
+ networkError: string;
25
+ submitFormError: string;
26
+ validationError: string;
27
+ };
28
+ export declare const validationError: {
29
+ branchAddress: string;
30
+ branchName: string;
31
+ personName: string;
32
+ personEmail: string;
33
+ personPhone: string;
34
+ preferenceId: string;
35
+ };
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.validationError = exports.toastErrors = exports.BRANCH_API_ROUTES = exports.tableBodyCols = exports.staticFormElements = exports.pageLimit = void 0;
5
+ var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
6
+ var vista_table_type_1 = require("@appcorp/app-corp-vista/type/vista-table-type");
7
+ exports.pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT);
8
+ exports.staticFormElements = (_a = {},
9
+ _a[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
10
+ {
11
+ enabled: true,
12
+ error: '',
13
+ handleOnChange: function () { return void 0; },
14
+ id: 'branchName',
15
+ label: 'formLabelBranchName',
16
+ order: 1,
17
+ placeholder: 'Branch Name...',
18
+ required: true,
19
+ type: 'text',
20
+ value: '',
21
+ },
22
+ {
23
+ enabled: true,
24
+ error: '',
25
+ handleOnChange: function () { return void 0; },
26
+ id: 'branchAddress',
27
+ label: 'formLabelBranchAddress',
28
+ order: 2,
29
+ placeholder: 'Branch Address...',
30
+ required: true,
31
+ type: 'text',
32
+ value: '',
33
+ },
34
+ {
35
+ enabled: true,
36
+ error: '',
37
+ handleOnChange: function () { return void 0; },
38
+ id: 'personName',
39
+ label: 'formLabelPersonName',
40
+ order: 3,
41
+ placeholder: 'Person Name...',
42
+ required: true,
43
+ type: 'text',
44
+ value: '',
45
+ },
46
+ {
47
+ enabled: true,
48
+ error: '',
49
+ handleOnChange: function () { return void 0; },
50
+ id: 'personPhone',
51
+ label: 'formLabelPersonPhone',
52
+ order: 4,
53
+ placeholder: 'Person Phone...',
54
+ required: true,
55
+ type: 'text',
56
+ value: '',
57
+ },
58
+ {
59
+ enabled: true,
60
+ error: '',
61
+ handleOnChange: function () { return void 0; },
62
+ id: 'personEmail',
63
+ label: 'formLabelPersonEmail',
64
+ order: 5,
65
+ placeholder: 'Person Email...',
66
+ required: true,
67
+ type: 'text',
68
+ value: '',
69
+ },
70
+ ],
71
+ _a[form_schema_1.VISTA_FORM_ELEMENTS.TOGGLE_V1] = [
72
+ {
73
+ id: 'enabled',
74
+ enabled: true,
75
+ value: false,
76
+ order: 6,
77
+ handleOnChange: function () { return void 0; },
78
+ label: 'Enabled',
79
+ required: true,
80
+ },
81
+ {
82
+ id: 'isDefault',
83
+ enabled: true,
84
+ value: false,
85
+ order: 7,
86
+ handleOnChange: function () { return void 0; },
87
+ label: 'IsDefault',
88
+ required: true,
89
+ },
90
+ ],
91
+ _a);
92
+ exports.tableBodyCols = [
93
+ {
94
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ID,
95
+ key: 'id',
96
+ },
97
+ {
98
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOLD_TEXT,
99
+ key: 'branchName',
100
+ },
101
+ {
102
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
103
+ key: 'branchAddress',
104
+ },
105
+ {
106
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
107
+ key: 'personName',
108
+ },
109
+ {
110
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.MULTIPLE_TEXT_LINES,
111
+ key: ['personPhone', 'personEmail'],
112
+ },
113
+ {
114
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
115
+ key: 'enabled',
116
+ },
117
+ {
118
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
119
+ key: 'isDefault',
120
+ },
121
+ {
122
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.CREATED_UPDATED_AT,
123
+ },
124
+ {
125
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ACTIONS,
126
+ },
127
+ ];
128
+ exports.BRANCH_API_ROUTES = {
129
+ BRANCH: '/api/branch',
130
+ BRANCHES: '/api/branches',
131
+ BRANCH_BY_ID: '/api/branch/branch-by-id',
132
+ };
133
+ exports.toastErrors = {
134
+ fetchInvoiceError: 'Error Fetching Invoice',
135
+ formSubmittedSuccess: 'Form Submitted Successfully',
136
+ genericError: 'Something Went Wrong',
137
+ networkError: 'Network Error Occurred',
138
+ submitFormError: 'Error Submitting Form',
139
+ validationError: 'Validation Failed',
140
+ };
141
+ // export const dashboardTabsMap: { [key: string]: ReactNode } = {
142
+ // 'Currency': <Currency />,
143
+ // 'Payment Mode': <PaymentMode />,
144
+ // 'Branch': <Branch />,
145
+ // 'Tax': <Tax />,
146
+ // 'Bank': <Bank />,
147
+ // };
148
+ exports.validationError = {
149
+ branchAddress: 'Branch Address is required',
150
+ branchName: 'Branch Name is required',
151
+ personName: 'Person Name is required',
152
+ personEmail: 'Person Email is required',
153
+ personPhone: 'Person Phone is required',
154
+ preferenceId: 'Preference Id is also required',
155
+ };
@@ -0,0 +1,10 @@
1
+ import React, { FC, ReactNode } from 'react';
2
+ import { BranchContextType, BranchState } from './types';
3
+ type State = BranchContextType & BranchState;
4
+ interface StateProviderProps {
5
+ children: ReactNode;
6
+ }
7
+ export declare const BranchStateContext: React.Context<State>;
8
+ export declare const BranchStateContextProvider: FC<StateProviderProps>;
9
+ export declare const useBranchStateContext: () => State;
10
+ export {};