Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-029
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-029
2023-029
Commits
480f6aa8
Commit
480f6aa8
authored
Sep 03, 2023
by
janithgamage1.ed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update
Desc : update project
parent
826cba1c
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
372 additions
and
157 deletions
+372
-157
Project/Frontend/SignConnectPlus/src/pages/parameter/curriculum-management/list/list.tsx
...s/src/pages/parameter/curriculum-management/list/list.tsx
+130
-13
Project/Frontend/SignConnectPlus/src/pages/parameter/curriculum-management/list/types/types.tsx
...ages/parameter/curriculum-management/list/types/types.tsx
+2
-1
Project/Frontend/SignConnectPlus/src/pages/parameter/tutorial-management/list/list.tsx
...lus/src/pages/parameter/tutorial-management/list/list.tsx
+232
-141
Project/Frontend/SignConnectPlus/src/pages/parameter/tutorial-management/list/types/types.tsx
.../pages/parameter/tutorial-management/list/types/types.tsx
+2
-1
Project/Frontend/SignConnectPlus/src/store/reducers/index.ts
Project/Frontend/SignConnectPlus/src/store/reducers/index.ts
+6
-1
No files found.
Project/Frontend/SignConnectPlus/src/pages/parameter/curriculum-management/list/list.tsx
View file @
480f6aa8
import
{
MouseEvent
,
useMemo
,
useState
}
from
'
react
'
;
import
{
MouseEvent
,
use
Effect
,
use
Memo
,
useState
}
from
'
react
'
;
// material-ui
import
{
...
...
@@ -34,9 +34,15 @@ import { DeleteTwoTone, EditTwoTone, EyeTwoTone, PlusOutlined } from '@ant-desig
//types
import
{
PopupTransition
}
from
'
components/@extended/Transitions
'
;
import
status
from
'
data/status
'
;
import
AddEditCurriculum
from
'
sections/parameters/curriculum-management/AddEditCurriculum
'
;
import
AlertCurriculumDelete
from
'
sections/parameters/curriculum-management/AlertCurriculumDelete
'
;
import
{
ReactTableProps
,
curriculumProps
,
dataProps
}
from
'
./types/types
'
;
import
{
useDispatch
,
useSelector
}
from
'
store
'
;
import
{
fetchCurriculums
,
toInitialState
}
from
'
store/reducers/curriculum
'
;
import
{
openSnackbar
}
from
'
store/reducers/snackbar
'
;
import
{
Curriculums
}
from
'
types/curriculum
'
;
import
{
ReactTableProps
,
curriculumProps
}
from
'
./types/types
'
;
import
curriculumLevels
from
'
data/curriculumLevels
'
;
// ==============================|| REACT TABLE ||============================== //
...
...
@@ -122,9 +128,14 @@ function ReactTable({ columns, data, handleAddEdit }: ReactTableProps) {
// ==============================|| List ||============================== //
const
List
=
()
=>
{
const
theme
=
useTheme
();
const
dispatch
=
useDispatch
();
const
{
curriculums
,
error
,
success
,
isLoading
}
=
useSelector
(
state
=>
state
.
curriculum
);
// table
const
data
:
dataProps
[]
=
[]
// const data: dataProps[] = []
// table
const
[
data
,
setData
]
=
useState
<
Curriculums
[]
>
([])
const
columns
=
useMemo
(
()
=>
...
...
@@ -153,19 +164,72 @@ const List = () => {
},
{
Header
:
'
Curriculum LVL
'
,
accessor
:
'
curriculumLevel
'
accessor
:
'
curriculumLevel
'
,
Cell
:
({
row
}:
{
row
:
Row
})
=>
{
if
(
row
.
values
.
curriculumLevel
===
undefined
||
row
.
values
.
curriculumLevel
===
null
||
row
.
values
.
curriculumLevel
===
''
)
{
return
<>
-
</>
}
if
(
typeof
row
.
values
.
curriculumLevel
===
'
string
'
)
{
return
<>
{
row
.
values
.
curriculumLevel
}
</>;
}
if
(
typeof
row
.
values
.
curriculumLevel
===
'
number
'
)
{
return
<>
{
curriculumLevels
.
find
(
curriculumLevel
=>
curriculumLevel
.
id
===
row
.
values
.
curriculumLevel
)?.
description
||
"
-
"
}
</>;
}
// Handle any other data types if necessary
return
<>
-
</>;
}
},
{
Header
:
'
Curriculum Name
'
,
accessor
:
'
curriculumTitle
'
accessor
:
'
curriculumTitle
'
,
Cell
:
({
row
}:
{
row
:
Row
})
=>
{
if
(
row
.
values
.
curriculumTitle
===
undefined
||
row
.
values
.
curriculumTitle
===
null
||
row
.
values
.
curriculumTitle
===
''
)
{
return
<>
-
</>
}
if
(
typeof
row
.
values
.
curriculumTitle
===
'
string
'
)
{
return
<>
{
row
.
values
.
curriculumTitle
}
</>;
}
if
(
typeof
row
.
values
.
curriculumTitle
===
'
number
'
)
{
return
<>
{
row
.
values
.
curriculumTitle
||
"
-
"
}
</>;
}
// Handle any other data types if necessary
return
<>
-
</>;
}
},
{
Header
:
'
Status
'
,
accessor
:
'
status
'
accessor
:
'
status
'
,
className
:
'
cell-center
'
,
Cell
:
({
row
}:
{
row
:
Row
})
=>
{
if
(
row
.
values
.
status
===
undefined
||
row
.
values
.
status
===
null
||
row
.
values
.
status
===
''
)
{
return
<>
-
</>
}
if
(
typeof
row
.
values
.
status
===
'
string
'
)
{
return
<>
{
row
.
values
.
status
}
</>;
}
if
(
typeof
row
.
values
.
status
===
'
number
'
)
{
return
<>
{
status
.
find
(
status
=>
status
.
id
===
row
.
values
.
status
)?.
description
||
"
-
"
}
</>;
}
// Handle any other data types if necessary
return
<>
-
</>;
}
},
{
Header
:
'
Created By
'
,
accessor
:
'
createdBy
'
accessor
:
'
createdBy
'
,
Cell
:
({
row
}:
{
row
:
Row
})
=>
{
if
(
row
.
values
.
createdBy
===
undefined
||
row
.
values
.
createdBy
===
null
||
row
.
values
.
createdBy
===
''
)
{
return
<>
-
</>
}
if
(
typeof
row
.
values
.
createdBy
===
'
string
'
)
{
return
<>
{
row
.
values
.
createdBy
}
</>;
}
if
(
typeof
row
.
values
.
createdBy
===
'
number
'
)
{
return
<>
{
row
.
values
.
createdBy
}
</>;
}
// Handle any other data types if necessary
return
<>
-
</>;
}
},
{
id
:
"
actions
"
,
...
...
@@ -241,6 +305,59 @@ const List = () => {
setOpenAlert
(
!
openAlert
);
};
/**
* API Config
* Tutorial API
*/
useEffect
(()
=>
{
dispatch
(
fetchCurriculums
());
},
[
dispatch
]);
useEffect
(()
=>
{
setData
(
curriculums
);
},
[
curriculums
])
// handel error
useEffect
(()
=>
{
if
(
error
!=
null
)
{
dispatch
(
openSnackbar
({
open
:
true
,
//@ts-ignore
message
:
error
?
error
.
Message
:
"
Something went wrong ...
"
,
variant
:
'
alert
'
,
alert
:
{
color
:
'
error
'
},
close
:
true
})
);
dispatch
(
toInitialState
())
}
},
[
error
])
// handel success
useEffect
(()
=>
{
if
(
success
!=
null
)
{
dispatch
(
openSnackbar
({
open
:
true
,
message
:
success
,
variant
:
'
alert
'
,
alert
:
{
color
:
'
success
'
},
close
:
true
})
);
dispatch
(
toInitialState
())
}
},
[
success
])
if
(
isLoading
)
{
return
<
div
>
Loading...
</
div
>;
}
return
(
<>
<
MainCard
content=
{
false
}
>
...
...
Project/Frontend/SignConnectPlus/src/pages/parameter/curriculum-management/list/types/types.tsx
View file @
480f6aa8
import
{
Column
}
from
'
react-table
'
;
import
{
Curriculums
}
from
'
types/curriculum
'
;
export
interface
dataProps
{
_id
:
number
|
string
|
undefined
;
...
...
@@ -17,7 +18,7 @@ export interface dataProps {
export
interface
ReactTableProps
{
columns
:
Column
[]
data
:
dataProp
s
[]
data
:
Curriculum
s
[]
handleAddEdit
:
()
=>
void
}
...
...
Project/Frontend/SignConnectPlus/src/pages/parameter/tutorial-management/list/list.tsx
View file @
480f6aa8
This diff is collapsed.
Click to expand it.
Project/Frontend/SignConnectPlus/src/pages/parameter/tutorial-management/list/types/types.tsx
View file @
480f6aa8
import
{
Column
}
from
'
react-table
'
;
import
{
Tutorials
}
from
'
types/tutorial
'
;
export
interface
dataProps
{
_id
:
number
|
string
|
undefined
;
...
...
@@ -16,7 +17,7 @@ export interface dataProps {
export
interface
ReactTableProps
{
columns
:
Column
[]
data
:
dataProp
s
[]
data
:
Tutorial
s
[]
handleAddEdit
:
()
=>
void
}
...
...
Project/Frontend/SignConnectPlus/src/store/reducers/index.ts
View file @
480f6aa8
...
...
@@ -7,6 +7,7 @@ import storage from 'redux-persist/lib/storage';
import
calendar
from
'
./calendar
'
;
import
cartReducer
from
'
./cart
'
;
import
chat
from
'
./chat
'
;
import
curriculum
from
'
./curriculum
'
;
import
ingredient
from
'
./ingredient
'
;
import
invoice
from
'
./invoice
'
;
import
kanban
from
'
./kanban
'
;
...
...
@@ -16,6 +17,8 @@ import nutrition from './nutrition';
import
productReducer
from
'
./product
'
;
import
snackbar
from
'
./snackbar
'
;
import
subscription
from
'
./subscription
'
;
import
tutorial
from
'
./tutorial
'
;
// ==============================|| COMBINE REDUCERS ||============================== //
...
...
@@ -39,7 +42,9 @@ const reducers = combineReducers({
nutrition
,
ingredient
,
subscription
,
marksCalculator
marksCalculator
,
tutorial
,
curriculum
});
export
default
reducers
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment