@campxdev/shared 1.11.3 → 1.11.5
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/package.json +1 -1
- package/src/components/Tables/BasicTable/Table.tsx +22 -0
- package/src/components/Tables/BasicTable/interface.ts +1 -1
- package/src/components/Tables/ReactTable/ReactTable.tsx +3 -0
- package/src/components/Tables/ReactTable/RenderTableBody.tsx +4 -2
- package/src/components/Tables/common/types.ts +1 -0
- package/src/shared-state/PermissionsStore.ts +9 -6
package/package.json
CHANGED
|
@@ -34,6 +34,7 @@ export interface TableColumn {
|
|
|
34
34
|
dataType?: DataType
|
|
35
35
|
}
|
|
36
36
|
interface TableProps {
|
|
37
|
+
showSerialNumber?: boolean
|
|
37
38
|
columns: Array<TableColumn>
|
|
38
39
|
rowKey?: string
|
|
39
40
|
dataSource?: any[]
|
|
@@ -54,6 +55,7 @@ interface TableProps {
|
|
|
54
55
|
showTotalInFirstCellOfTotalRow?: boolean
|
|
55
56
|
}
|
|
56
57
|
export default function Table({
|
|
58
|
+
showSerialNumber = false,
|
|
57
59
|
columns,
|
|
58
60
|
dataSource,
|
|
59
61
|
onRowClick,
|
|
@@ -135,6 +137,16 @@ export default function Table({
|
|
|
135
137
|
<StyledMuiTable sx={sx}>
|
|
136
138
|
<TableHead>
|
|
137
139
|
<TableRow>
|
|
140
|
+
{showSerialNumber && (
|
|
141
|
+
<StyledTableCell
|
|
142
|
+
sx={sx}
|
|
143
|
+
columnIndex={0}
|
|
144
|
+
rowIndex={0}
|
|
145
|
+
columnsLength={1}
|
|
146
|
+
>
|
|
147
|
+
S. No.
|
|
148
|
+
</StyledTableCell>
|
|
149
|
+
)}
|
|
138
150
|
{columns.map((col, columnIndex) => (
|
|
139
151
|
<StyledTableCell
|
|
140
152
|
key={columnIndex}
|
|
@@ -177,6 +189,16 @@ export default function Table({
|
|
|
177
189
|
return onRowClick && onRowClick(row)
|
|
178
190
|
}}
|
|
179
191
|
>
|
|
192
|
+
{showSerialNumber && (
|
|
193
|
+
<StyledTableCell
|
|
194
|
+
sx={sx}
|
|
195
|
+
columnIndex={0}
|
|
196
|
+
rowIndex={rowIndex + 1}
|
|
197
|
+
columnsLength={1}
|
|
198
|
+
>
|
|
199
|
+
{rowIndex + 1}
|
|
200
|
+
</StyledTableCell>
|
|
201
|
+
)}
|
|
180
202
|
<> {showTotal && calculateTotal(row)}</>
|
|
181
203
|
{columns.map((col, colIndex) => (
|
|
182
204
|
<StyledTableCell
|
|
@@ -74,6 +74,7 @@ const getTableCol = (headerItem: ColumnProps) => {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export default function ReactTable({
|
|
77
|
+
showSerialNumber = false,
|
|
77
78
|
columns,
|
|
78
79
|
rowKey = 'id',
|
|
79
80
|
dataSource,
|
|
@@ -197,6 +198,7 @@ export default function ReactTable({
|
|
|
197
198
|
<TableHead>
|
|
198
199
|
{headerGroups.map((headerGroup, index) => (
|
|
199
200
|
<TableRow key={index} {...headerGroup.getHeaderGroupProps()}>
|
|
201
|
+
{showSerialNumber && <TableCell>S. No.</TableCell>}
|
|
200
202
|
{headerGroup.headers.map((column: any, index) => (
|
|
201
203
|
<TableCell key={index} {...column.getHeaderProps()}>
|
|
202
204
|
{column.render('Header')}
|
|
@@ -219,6 +221,7 @@ export default function ReactTable({
|
|
|
219
221
|
))}
|
|
220
222
|
</TableHead>
|
|
221
223
|
<RenderTableBody
|
|
224
|
+
showSerialNumber={showSerialNumber}
|
|
222
225
|
onRowClick={onRowClick}
|
|
223
226
|
colLength={columns?.length}
|
|
224
227
|
loading={loading || refetching}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableBody, TableCell } from '@mui/material'
|
|
2
2
|
import Spinner from '../../Spinner'
|
|
3
|
-
import { StyledTableRow } from '../common/styles'
|
|
4
3
|
import NoRecordsFound from '../common/NoRecordsFound'
|
|
4
|
+
import { StyledTableRow } from '../common/styles'
|
|
5
5
|
|
|
6
6
|
export const RenderTableBody = ({
|
|
7
|
+
showSerialNumber,
|
|
7
8
|
getTableBodyProps,
|
|
8
9
|
prepareRow,
|
|
9
10
|
rows,
|
|
@@ -34,6 +35,7 @@ export const RenderTableBody = ({
|
|
|
34
35
|
{...row.getRowProps()}
|
|
35
36
|
isSelected={row?.isSelected}
|
|
36
37
|
>
|
|
38
|
+
{showSerialNumber && <TableCell>{index + 1}</TableCell>}
|
|
37
39
|
{row.cells?.map((cell, index) => {
|
|
38
40
|
return (
|
|
39
41
|
<TableCell key={index} {...cell.getCellProps()}>
|
|
@@ -8,9 +8,9 @@ export enum PaymentsPermission {
|
|
|
8
8
|
CAN_MANAGE_PAYMENTS_PROFILE_PERMISSIONS_EDIT = 'can_manage_payments_profile_permissions_edit',
|
|
9
9
|
CAN_MANAGE_PAYMENTS_PROFILE_PERMISSIONS_DELETE = 'can_manage_payments_profile_permissions_delete',
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
//Payments imports
|
|
12
|
+
CAN_IMPORT_RECEIPTS = 'can_import_receipts_view',
|
|
13
|
+
CAN_IMPORT_CREDITS = 'can_import_credits_view',
|
|
14
14
|
|
|
15
15
|
// Fee Counter
|
|
16
16
|
CAN_FEE_COUNTER_ACADEMIC_FEE = 'can_fee_counter_academic_fee',
|
|
@@ -218,6 +218,9 @@ export enum SquarePermissions {
|
|
|
218
218
|
CAN_CLASSROOM_SUBJECTS_VIEW = 'can_classroom_subjects_view',
|
|
219
219
|
CAN_CLASSROOM_SUBJECT_ATTENDANCE_EDIT = 'can_classroom_subject_attendance_edit',
|
|
220
220
|
|
|
221
|
+
//my subjects
|
|
222
|
+
CAN_VIEW_MY_SUBJECTS = 'can_view_my_subjects',
|
|
223
|
+
|
|
221
224
|
// Feed
|
|
222
225
|
CAN_ADD_FEED = 'can_feed_add',
|
|
223
226
|
|
|
@@ -563,9 +566,9 @@ export enum Permission {
|
|
|
563
566
|
CAN_FEE_COUNTER_ACADEMIC_FEE = 'can_fee_counter_academic_fee',
|
|
564
567
|
CAN_FEE_COUNTER_EXAM_FEE = 'can_fee_counter_exam_fee',
|
|
565
568
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
+
//Payments imports
|
|
570
|
+
CAN_IMPORT_RECEIPTS = 'can_import_receipts_view',
|
|
571
|
+
CAN_IMPORT_CREDITS = 'can_import_credits_view',
|
|
569
572
|
|
|
570
573
|
// Fee Groups
|
|
571
574
|
CAN_FEE_GROUP_VIEW = 'can_fee_groups_view',
|