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
6d4db559
Commit
6d4db559
authored
Sep 03, 2023
by
janithgamage1.ed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update
Desc : update project
parent
1e0eff13
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
39 deletions
+71
-39
Project/Frontend/SignConnectPlus/src/pages/parameter/curriculum-management/list/list.tsx
...s/src/pages/parameter/curriculum-management/list/list.tsx
+10
-8
Project/Frontend/SignConnectPlus/src/sections/parameters/curriculum-management/AddEditCurriculum.tsx
...ns/parameters/curriculum-management/AddEditCurriculum.tsx
+42
-22
Project/Frontend/SignConnectPlus/src/sections/parameters/curriculum-management/AlertCurriculumDelete.tsx
...arameters/curriculum-management/AlertCurriculumDelete.tsx
+13
-3
Project/Frontend/SignConnectPlus/src/store/reducers/curriculum.ts
...Frontend/SignConnectPlus/src/store/reducers/curriculum.ts
+2
-2
Project/Frontend/SignConnectPlus/src/types/curriculum.ts
Project/Frontend/SignConnectPlus/src/types/curriculum.ts
+4
-4
No files found.
Project/Frontend/SignConnectPlus/src/pages/parameter/curriculum-management/list/list.tsx
View file @
6d4db559
...
@@ -34,15 +34,15 @@ import { DeleteTwoTone, EditTwoTone, EyeTwoTone, PlusOutlined } from '@ant-desig
...
@@ -34,15 +34,15 @@ import { DeleteTwoTone, EditTwoTone, EyeTwoTone, PlusOutlined } from '@ant-desig
//types
//types
import
{
PopupTransition
}
from
'
components/@extended/Transitions
'
;
import
{
PopupTransition
}
from
'
components/@extended/Transitions
'
;
import
curriculumLevels
from
'
data/curriculumLevels
'
;
import
status
from
'
data/status
'
;
import
status
from
'
data/status
'
;
import
AddEditCurriculum
from
'
sections/parameters/curriculum-management/AddEditCurriculum
'
;
import
AddEditCurriculum
from
'
sections/parameters/curriculum-management/AddEditCurriculum
'
;
import
AlertCurriculumDelete
from
'
sections/parameters/curriculum-management/AlertCurriculumDelete
'
;
import
AlertCurriculumDelete
from
'
sections/parameters/curriculum-management/AlertCurriculumDelete
'
;
import
{
useDispatch
,
useSelector
}
from
'
store
'
;
import
{
useDispatch
,
useSelector
}
from
'
store
'
;
import
{
fetchCurriculums
,
toInitialState
}
from
'
store/reducers/curriculum
'
;
import
{
fetchCurriculums
,
toInitialState
}
from
'
store/reducers/curriculum
'
;
import
{
openSnackbar
}
from
'
store/reducers/snackbar
'
;
import
{
openSnackbar
}
from
'
store/reducers/snackbar
'
;
import
{
Curriculums
}
from
'
types/curriculum
'
;
import
{
Curriculum
,
Curriculums
}
from
'
types/curriculum
'
;
import
{
ReactTableProps
,
curriculumProps
}
from
'
./types/types
'
;
import
{
ReactTableProps
}
from
'
./types/types
'
;
import
curriculumLevels
from
'
data/curriculumLevels
'
;
// ==============================|| REACT TABLE ||============================== //
// ==============================|| REACT TABLE ||============================== //
...
@@ -142,7 +142,7 @@ const List = () => {
...
@@ -142,7 +142,7 @@ const List = () => {
[
[
{
{
Header
:
'
#
'
,
Header
:
'
#
'
,
accessor
:
'
id
'
,
accessor
:
'
_
id
'
,
className
:
'
cell-center
'
,
className
:
'
cell-center
'
,
Cell
:
({
row
}:
{
row
:
Row
})
=>
{
Cell
:
({
row
}:
{
row
:
Row
})
=>
{
if
(
row
.
id
===
undefined
||
row
.
id
===
null
||
row
.
id
===
''
)
{
if
(
row
.
id
===
undefined
||
row
.
id
===
null
||
row
.
id
===
''
)
{
...
@@ -273,6 +273,7 @@ const List = () => {
...
@@ -273,6 +273,7 @@ const List = () => {
onClick=
{
(
e
:
MouseEvent
<
HTMLButtonElement
>
)
=>
{
onClick=
{
(
e
:
MouseEvent
<
HTMLButtonElement
>
)
=>
{
e
.
stopPropagation
();
e
.
stopPropagation
();
setCurriculumId
(
row
.
values
.
_id
)
setCurriculumId
(
row
.
values
.
_id
)
setCurriculumTitle
(
row
.
values
.
curriculumTitle
)
setOpenAlert
(
true
)
setOpenAlert
(
true
)
}
}
}
}
>
>
...
@@ -290,7 +291,7 @@ const List = () => {
...
@@ -290,7 +291,7 @@ const List = () => {
//dialog model
//dialog model
const
[
addEdit
,
setAddEdit
]
=
useState
<
boolean
>
(
false
);
const
[
addEdit
,
setAddEdit
]
=
useState
<
boolean
>
(
false
);
const
[
curriculum
,
setCurriculum
]
=
useState
<
curriculumProps
>
();
const
[
curriculum
,
setCurriculum
]
=
useState
<
Curriculum
>
();
const
handleAddEdit
=
()
=>
{
const
handleAddEdit
=
()
=>
{
setAddEdit
(
!
addEdit
);
setAddEdit
(
!
addEdit
);
...
@@ -299,7 +300,8 @@ const List = () => {
...
@@ -299,7 +300,8 @@ const List = () => {
//alert model
//alert model
const
[
openAlert
,
setOpenAlert
]
=
useState
(
false
);
const
[
openAlert
,
setOpenAlert
]
=
useState
(
false
);
const
[
curriculumId
,
setCurriculumId
]
=
useState
<
number
|
string
|
undefined
>
(
undefined
)
const
[
curriculumId
,
setCurriculumId
]
=
useState
<
string
|
undefined
>
(
undefined
)
const
[
curriculumTitle
,
setCurriculumTitle
]
=
useState
<
string
|
undefined
>
(
undefined
)
const
handleAlertClose
=
()
=>
{
const
handleAlertClose
=
()
=>
{
setOpenAlert
(
!
openAlert
);
setOpenAlert
(
!
openAlert
);
...
@@ -375,10 +377,10 @@ const List = () => {
...
@@ -375,10 +377,10 @@ const List = () => {
sx=
{
{
'
& .MuiDialog-paper
'
:
{
p
:
0
},
transition
:
'
transform 225ms
'
}
}
sx=
{
{
'
& .MuiDialog-paper
'
:
{
p
:
0
},
transition
:
'
transform 225ms
'
}
}
aria
-
describedby=
"alert-dialog-slide-description"
aria
-
describedby=
"alert-dialog-slide-description"
>
>
<
AddEditCurriculum
curriculum=
{
curriculum
}
onCancel=
{
handleAddEdit
}
/>
<
AddEditCurriculum
curriculum=
{
curriculum
!
}
onCancel=
{
handleAddEdit
}
/>
</
Dialog
>
</
Dialog
>
{
/* alert model */
}
{
/* alert model */
}
{
!
curriculum
&&
<
AlertCurriculumDelete
title=
{
""
}
open=
{
openAlert
}
handleClose=
{
handleAlertClose
}
deleteId=
{
curriculumId
}
/>
}
{
!
curriculum
&&
<
AlertCurriculumDelete
title=
{
curriculumTitle
!
}
open=
{
openAlert
}
handleClose=
{
handleAlertClose
}
deleteId=
{
curriculumId
}
/>
}
</
MainCard
>
</
MainCard
>
</>
</>
)
)
...
...
Project/Frontend/SignConnectPlus/src/sections/parameters/curriculum-management/AddEditCurriculum.tsx
View file @
6d4db559
import
{
useState
}
from
'
react
'
;
import
{
use
Effect
,
use
State
}
from
'
react
'
;
// material-ui
// material-ui
import
{
import
{
...
@@ -33,6 +33,12 @@ import IconButton from 'components/@extended/IconButton';
...
@@ -33,6 +33,12 @@ import IconButton from 'components/@extended/IconButton';
import
{
DeleteFilled
}
from
'
@ant-design/icons
'
;
import
{
DeleteFilled
}
from
'
@ant-design/icons
'
;
import
MainCard
from
'
components/MainCard
'
;
import
MainCard
from
'
components/MainCard
'
;
import
curriculumLevels
,
{
CurriculumLevelsType
}
from
'
data/curriculumLevels
'
;
import
curriculumLevels
,
{
CurriculumLevelsType
}
from
'
data/curriculumLevels
'
;
import
useAuth
from
'
hooks/useAuth
'
;
import
{
dispatch
,
useSelector
}
from
'
store
'
;
import
{
addCurriculum
}
from
'
store/reducers/curriculum
'
;
import
{
fetchTutorials
}
from
'
store/reducers/tutorial
'
;
import
{
Curriculum
}
from
'
types/curriculum
'
;
import
{
Tutorial
}
from
'
types/tutorial
'
;
import
AlertCurriculumDelete
from
'
./AlertCurriculumDelete
'
;
import
AlertCurriculumDelete
from
'
./AlertCurriculumDelete
'
;
// types
// types
...
@@ -60,25 +66,13 @@ const getInitialValues = (curriculum: FormikValues | null) => {
...
@@ -60,25 +66,13 @@ const getInitialValues = (curriculum: FormikValues | null) => {
// ==============================|| CUSTOMER ADD / EDIT ||============================== //
// ==============================|| CUSTOMER ADD / EDIT ||============================== //
export
interface
Props
{
export
interface
Props
{
curriculum
?:
{
curriculum
:
Curriculum
;
_id
:
number
|
string
|
undefined
;
curriculumCode
:
string
;
curriculumLevel
:
number
;
curriculumTitle
:
string
;
curriculumDescription
:
string
;
curriculumImage
:
string
;
tutorials
:
string
[];
status
:
number
;
createdBy
:
string
;
updatedBy
:
string
;
createdAt
:
Date
;
updatedAt
:
Date
;
};
onCancel
:
()
=>
void
;
onCancel
:
()
=>
void
;
}
}
const
AddEditCurriculum
=
({
curriculum
,
onCancel
}:
Props
)
=>
{
const
AddEditCurriculum
=
({
curriculum
,
onCancel
}:
Props
)
=>
{
const
theme
=
useTheme
();
const
theme
=
useTheme
();
const
{
user
}
=
useAuth
();
const
isCreating
=
!
curriculum
;
const
isCreating
=
!
curriculum
;
...
@@ -96,11 +90,27 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
...
@@ -96,11 +90,27 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
validationSchema
:
CurriculumSchema
,
validationSchema
:
CurriculumSchema
,
enableReinitialize
:
true
,
enableReinitialize
:
true
,
onSubmit
:
(
values
,
{
setSubmitting
,
resetForm
})
=>
{
onSubmit
:
(
values
,
{
setSubmitting
,
resetForm
})
=>
{
console
.
log
(
values
);
try
{
try
{
if
(
curriculum
)
{
if
(
curriculum
)
{
// PUT API
// PUT API
}
else
{
}
else
{
// POST API
// POST API
// const dummyObject: Curriculum = curriculumReqOb
// dispatch(addCurriculum(dummyObject))
const
req
:
Curriculum
=
{
curriculumCode
:
values
.
curriculumCode
,
curriculumLevel
:
values
.
curriculumLevel
!
,
curriculumTitle
:
values
.
curriculumTitle
,
curriculumDescription
:
values
.
curriculumDescription
,
curriculumImage
:
values
.
curriculumImage
,
tutorials
:
values
.
tutorials
!
,
createdBy
:
user
?.
name
!
,
};
dispatch
(
addCurriculum
(
req
))
}
}
resetForm
()
resetForm
()
setSubmitting
(
false
);
setSubmitting
(
false
);
...
@@ -114,6 +124,16 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
...
@@ -114,6 +124,16 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
const
{
errors
,
touched
,
handleSubmit
,
isSubmitting
,
getFieldProps
,
values
}
=
formik
;
const
{
errors
,
touched
,
handleSubmit
,
isSubmitting
,
getFieldProps
,
values
}
=
formik
;
// const { handleSubmit, isSubmitting } = formik;
// const { handleSubmit, isSubmitting } = formik;
const
{
tutorials
}
=
useSelector
(
state
=>
state
.
tutorial
);
/**
* API Config
* Tutorial API
*/
useEffect
(()
=>
{
dispatch
(
fetchTutorials
());
},
[
dispatch
])
return
(
return
(
<>
<>
<
FormikProvider
value=
{
formik
}
>
<
FormikProvider
value=
{
formik
}
>
...
@@ -232,18 +252,18 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
...
@@ -232,18 +252,18 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
values
.
tutorials
.
map
((
item
,
index
)
=>
{
values
.
tutorials
.
map
((
item
,
index
)
=>
{
return
(
return
(
<>
<>
<
Grid
item
xs=
{
11
}
>
<
Grid
item
xs=
{
11
}
>
<
Stack
spacing=
{
1.25
}
>
<
Stack
spacing=
{
1.25
}
>
<
InputLabel
htmlFor=
{
`tutorials.${index}`
}
>
Tutorial
</
InputLabel
>
<
InputLabel
htmlFor=
{
`tutorials.${index}`
}
>
Tutorial
</
InputLabel
>
<
Autocomplete
<
Autocomplete
fullWidth
fullWidth
id=
{
`tutorials.${index}`
}
id=
{
`tutorials.${index}`
}
// value=
{
tutorials
.
find
((
option
)
=
>
option.id === formik.values.curriculumLevel
) || null}
value=
{
tutorials
.
find
((
option
)
=>
option
.
_id
===
formik
.
values
.
tutorials
[
index
]
)
||
null
}
// onChange=
{
(
event
:
any
,
newValue
:
CurriculumLevelsType
|
null
)
=>
{
onChange=
{
(
event
:
any
,
newValue
:
Tutorial
|
null
)
=>
{
// formik.setFieldValue(`tutorials.$
{
index
}
`, newValue?.
id);
formik
.
setFieldValue
(
`tutorials.${index}`
,
newValue
?.
_
id
);
//
}
}
}
}
options=
{
[]
}
options=
{
tutorials
}
// getOptionLabel=
{
(
item
)
=>
`${item.description
}`
}
getOptionLabel=
{
(
item
)
=>
`${item.tutorialTitle
}`
}
renderInput=
{
(
params
)
=>
{
renderInput=
{
(
params
)
=>
{
return
(
return
(
<
TextField
<
TextField
...
...
Project/Frontend/SignConnectPlus/src/sections/parameters/curriculum-management/AlertCurriculumDelete.tsx
View file @
6d4db559
...
@@ -7,20 +7,22 @@ import { PopupTransition } from 'components/@extended/Transitions';
...
@@ -7,20 +7,22 @@ import { PopupTransition } from 'components/@extended/Transitions';
// assets
// assets
import
{
DeleteFilled
}
from
'
@ant-design/icons
'
;
import
{
DeleteFilled
}
from
'
@ant-design/icons
'
;
import
{
useDispatch
}
from
'
store
'
;
import
{
deleteCurriculum
}
from
'
store/reducers/curriculum
'
;
// types
// types
interface
Props
{
interface
Props
{
title
:
string
;
title
:
string
;
open
:
boolean
;
open
:
boolean
;
handleClose
:
(
status
:
boolean
)
=>
void
;
handleClose
:
(
status
:
boolean
)
=>
void
;
deleteId
:
number
|
string
|
undefined
;
deleteId
:
string
|
undefined
;
}
}
// ==============================|| Curriculum - DELETE ||============================== //
// ==============================|| Curriculum - DELETE ||============================== //
export
default
function
AlertCurriculumDelete
({
title
,
open
,
handleClose
,
deleteId
}:
Props
)
{
export
default
function
AlertCurriculumDelete
({
title
,
open
,
handleClose
,
deleteId
}:
Props
)
{
//
const dispatch = useDispatch();
const
dispatch
=
useDispatch
();
return
(
return
(
<
Dialog
<
Dialog
...
@@ -41,6 +43,14 @@ export default function AlertCurriculumDelete({ title, open, handleClose, delete
...
@@ -41,6 +43,14 @@ export default function AlertCurriculumDelete({ title, open, handleClose, delete
<
Typography
variant=
"h4"
align=
"center"
>
<
Typography
variant=
"h4"
align=
"center"
>
Are you sure you want to delete?
Are you sure you want to delete?
</
Typography
>
</
Typography
>
<
Typography
align=
"center"
>
By deleting
<
Typography
variant=
"subtitle1"
component=
"span"
>
{
'
'
}
"
{
title
}
"
{
'
'
}
</
Typography
>
Curriculum, Its details
&
tasks will also be deleted.
</
Typography
>
</
Stack
>
</
Stack
>
<
Stack
direction=
"row"
spacing=
{
2
}
sx=
{
{
width
:
1
}
}
>
<
Stack
direction=
"row"
spacing=
{
2
}
sx=
{
{
width
:
1
}
}
>
...
@@ -48,7 +58,7 @@ export default function AlertCurriculumDelete({ title, open, handleClose, delete
...
@@ -48,7 +58,7 @@ export default function AlertCurriculumDelete({ title, open, handleClose, delete
Cancel
Cancel
</
Button
>
</
Button
>
<
Button
fullWidth
color=
"error"
variant=
"contained"
onClick=
{
()
=>
{
<
Button
fullWidth
color=
"error"
variant=
"contained"
onClick=
{
()
=>
{
// dispatch(deleteNutrition
(deleteId!))
dispatch
(
deleteCurriculum
(
deleteId
!
))
handleClose
(
true
)
handleClose
(
true
)
}
}
autoFocus
>
}
}
autoFocus
>
Delete
Delete
...
...
Project/Frontend/SignConnectPlus/src/store/reducers/curriculum.ts
View file @
6d4db559
...
@@ -71,7 +71,7 @@ const slice = createSlice({
...
@@ -71,7 +71,7 @@ const slice = createSlice({
// DELETE CURRICULUM
// DELETE CURRICULUM
deleteCurriculumSuccess
(
state
,
action
)
{
deleteCurriculumSuccess
(
state
,
action
)
{
state
.
curriculums
=
state
.
curriculums
.
filter
(
curriculum
=>
curriculum
.
_id
!==
action
.
payload
.
_id
);
state
.
curriculums
=
state
.
curriculums
.
filter
(
curriculum
=>
curriculum
.
_id
!==
action
.
payload
);
state
.
success
=
"
Curriculum deleted successfully.
"
state
.
success
=
"
Curriculum deleted successfully.
"
},
},
...
@@ -177,7 +177,7 @@ export function updateCurriculum(updatedCurriculum: Curriculum) {
...
@@ -177,7 +177,7 @@ export function updateCurriculum(updatedCurriculum: Curriculum) {
* @param curriculumId
* @param curriculumId
* @returns
* @returns
*/
*/
export
function
deleteCurriculum
(
curriculumId
:
number
)
{
export
function
deleteCurriculum
(
curriculumId
:
string
)
{
return
async
()
=>
{
return
async
()
=>
{
dispatch
(
slice
.
actions
.
startLoading
());
dispatch
(
slice
.
actions
.
startLoading
());
...
...
Project/Frontend/SignConnectPlus/src/types/curriculum.ts
View file @
6d4db559
...
@@ -23,11 +23,11 @@ export type Curriculum = {
...
@@ -23,11 +23,11 @@ export type Curriculum = {
curriculumTitle
:
string
curriculumTitle
:
string
curriculumDescription
:
string
curriculumDescription
:
string
curriculumImage
:
string
curriculumImage
:
string
curriculumMark
:
number
curriculumMark
?
:
number
tutorials
:
tutorialType
[],
tutorials
:
string
[],
status
:
number
status
?
:
number
createdBy
:
string
createdBy
:
string
createdAt
:
Date
createdAt
?
:
Date
updatedBy
?:
string
updatedBy
?:
string
updatedAt
?:
Date
updatedAt
?:
Date
};
};
...
...
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