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
93fc9979
Commit
93fc9979
authored
Sep 03, 2023
by
janithgamage1.ed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update
Desc : update project
parent
a6b843b5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
44 deletions
+134
-44
Project/Frontend/SignConnectPlus/src/data/tutorials.ts
Project/Frontend/SignConnectPlus/src/data/tutorials.ts
+21
-2
Project/Frontend/SignConnectPlus/src/pages/parameter/tutorial-management/list/list.tsx
...lus/src/pages/parameter/tutorial-management/list/list.tsx
+4
-4
Project/Frontend/SignConnectPlus/src/sections/parameters/tutorial-management/AddEditTutorial.tsx
...ctions/parameters/tutorial-management/AddEditTutorial.tsx
+106
-35
Project/Frontend/SignConnectPlus/src/types/tutorial.ts
Project/Frontend/SignConnectPlus/src/types/tutorial.ts
+3
-3
No files found.
Project/Frontend/SignConnectPlus/src/data/tutorials.ts
View file @
93fc9979
import
{
tutorialType
}
from
"
types/tutorial
"
;
import
{
Tutorial
,
tutorialType
}
from
"
types/tutorial
"
;
export
const
tutorials
:
tutorialType
[]
=
[
export
const
tutorials
:
tutorialType
[]
=
[
{
{
...
@@ -181,3 +181,22 @@ export const tutorials: tutorialType[] = [
...
@@ -181,3 +181,22 @@ export const tutorials: tutorialType[] = [
"
tutorialMark
"
:
0
,
"
tutorialMark
"
:
0
,
}
}
]
]
export
const
tutorialReqOb
:
Tutorial
=
{
"
tutorialCode
"
:
"
Tutorial Code -12312
"
,
"
tutorialTitle
"
:
"
Tutorial Title
"
,
"
tutorialImage
"
:
"
Tutorial Image
"
,
"
tutorialDescription
"
:
"
Tutorial Description
"
,
"
taskItems
"
:
[
{
"
title
"
:
"
Task Title -213123
"
,
"
description
"
:
"
Task Reference Image
"
,
//@ts-ignore
"
howToDo
"
:
"
Task How To Do
"
,
"
referenceImage
"
:
"
Task Reference Image
"
,
"
referenceVideo
"
:
"
Task Reference Image
"
,
"
taskItemMark
"
:
10
}
],
"
createdBy
"
:
"
Nuwan Gamage
"
}
\ No newline at end of file
Project/Frontend/SignConnectPlus/src/pages/parameter/tutorial-management/list/list.tsx
View file @
93fc9979
...
@@ -40,8 +40,8 @@ import AlertTutorialDelete from 'sections/parameters/tutorial-management/AlertTu
...
@@ -40,8 +40,8 @@ import AlertTutorialDelete from 'sections/parameters/tutorial-management/AlertTu
import
{
useDispatch
,
useSelector
}
from
'
store
'
;
import
{
useDispatch
,
useSelector
}
from
'
store
'
;
import
{
openSnackbar
}
from
'
store/reducers/snackbar
'
;
import
{
openSnackbar
}
from
'
store/reducers/snackbar
'
;
import
{
fetchTutorials
,
toInitialState
}
from
'
store/reducers/tutorial
'
;
import
{
fetchTutorials
,
toInitialState
}
from
'
store/reducers/tutorial
'
;
import
{
Tutorials
}
from
'
types/tutorial
'
;
import
{
Tutorial
,
Tutorial
s
}
from
'
types/tutorial
'
;
import
{
ReactTableProps
,
tutorialProps
}
from
'
./types/types
'
;
import
{
ReactTableProps
}
from
'
./types/types
'
;
// ==============================|| REACT TABLE ||============================== //
// ==============================|| REACT TABLE ||============================== //
...
@@ -396,7 +396,7 @@ const List = () => {
...
@@ -396,7 +396,7 @@ const List = () => {
//dialog model
//dialog model
const
[
addEdit
,
setAddEdit
]
=
useState
<
boolean
>
(
false
);
const
[
addEdit
,
setAddEdit
]
=
useState
<
boolean
>
(
false
);
const
[
tutorial
,
setTutorial
]
=
useState
<
tutorialProps
>
();
const
[
tutorial
,
setTutorial
]
=
useState
<
Tutorial
>
();
const
handleAddEdit
=
()
=>
{
const
handleAddEdit
=
()
=>
{
setAddEdit
(
!
addEdit
);
setAddEdit
(
!
addEdit
);
...
@@ -481,7 +481,7 @@ const List = () => {
...
@@ -481,7 +481,7 @@ 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"
>
>
<
AddEditTutorial
tutorial=
{
tutorial
}
onCancel=
{
handleAddEdit
}
/>
<
AddEditTutorial
tutorial=
{
tutorial
!
}
onCancel=
{
handleAddEdit
}
/>
</
Dialog
>
</
Dialog
>
{
/* alert model */
}
{
/* alert model */
}
{
!
tutorial
&&
<
AlertTutorialDelete
title=
{
""
}
open=
{
openAlert
}
handleClose=
{
handleAlertClose
}
deleteId=
{
tutorialId
}
/>
}
{
!
tutorial
&&
<
AlertTutorialDelete
title=
{
""
}
open=
{
openAlert
}
handleClose=
{
handleAlertClose
}
deleteId=
{
tutorialId
}
/>
}
...
...
Project/Frontend/SignConnectPlus/src/sections/parameters/tutorial-management/AddEditTutorial.tsx
View file @
93fc9979
...
@@ -32,6 +32,10 @@ import IconButton from 'components/@extended/IconButton';
...
@@ -32,6 +32,10 @@ import IconButton from 'components/@extended/IconButton';
import
{
DeleteFilled
}
from
'
@ant-design/icons
'
;
import
{
DeleteFilled
}
from
'
@ant-design/icons
'
;
import
{
AccordionSummary
,
InputLabel
,
TextField
}
from
'
@mui/material
'
;
import
{
AccordionSummary
,
InputLabel
,
TextField
}
from
'
@mui/material
'
;
import
MainCard
from
'
components/MainCard
'
;
import
MainCard
from
'
components/MainCard
'
;
import
{
tutorialReqOb
}
from
'
data/tutorials
'
;
import
{
dispatch
}
from
'
store
'
;
import
{
addTutorial
}
from
'
store/reducers/tutorial
'
;
import
{
Tutorial
}
from
'
types/tutorial
'
;
import
AlertTutorialDelete
from
'
./AlertTutorialDelete
'
;
import
AlertTutorialDelete
from
'
./AlertTutorialDelete
'
;
// types
// types
...
@@ -53,6 +57,7 @@ const getInitialValues = (tutorial: FormikValues | null) => {
...
@@ -53,6 +57,7 @@ const getInitialValues = (tutorial: FormikValues | null) => {
howToDo
:
""
,
howToDo
:
""
,
referenceImage
:
""
,
referenceImage
:
""
,
referenceVideo
:
""
,
referenceVideo
:
""
,
taskItemMark
:
0
,
}
}
]
]
}
}
...
@@ -67,37 +72,36 @@ const getInitialValues = (tutorial: FormikValues | null) => {
...
@@ -67,37 +72,36 @@ const getInitialValues = (tutorial: FormikValues | null) => {
// ==============================|| CUSTOMER ADD / EDIT ||============================== //
// ==============================|| CUSTOMER ADD / EDIT ||============================== //
export
interface
Props
{
export
interface
Props
{
tutorial
?:
{
tutorial
?:
Tutorial
_id
:
number
|
string
|
undefined
tutorialCode
:
string
;
tutorialTitle
:
string
;
tutorialDescription
:
string
;
tutorialImage
:
string
;
status
:
number
;
createdBy
:
string
;
updatedBy
:
string
;
createdAt
:
Date
;
updatedAt
:
Date
;
taskItems
:
taskItemProps
[]
};
onCancel
:
()
=>
void
;
onCancel
:
()
=>
void
;
}
}
export
interface
taskItemProps
{
_id
:
number
|
string
|
undefined
;
title
:
string
;
description
:
string
;
howToDo
:
string
;
referenceImage
:
string
;
referenceVideo
:
string
;
}
const
AddEditTutorial
=
({
tutorial
,
onCancel
}:
Props
)
=>
{
const
AddEditTutorial
=
({
tutorial
,
onCancel
}:
Props
)
=>
{
const
theme
=
useTheme
();
const
theme
=
useTheme
();
const
isCreating
=
!
tutorial
;
const
isCreating
=
!
tutorial
;
const
TutorialSchema
=
Yup
.
object
().
shape
({});
const
TutorialSchema
=
Yup
.
object
().
shape
({
// tutorialCode: Yup.string().required(`Tutorial Code is required`),
// tutorialTitle: Yup.string().required(`Tutorial Title is required`),
// tutorialDescription: Yup.string().required(`Tutorial Description is required`),
// tutorialImage: Yup.string().required(`Tutorial Image Ref is required`),
// taskItems: Yup.array().of(
// Yup.object().shape({
// title: Yup.string().required(`Task Title is required`),
// description: Yup.string().required(`Task Description is required`),
// howToDo: Yup.string().required(`Task How To Do is required`),
// referenceImage: Yup.string().required(`Task Reference Image is required`),
// referenceVideo: Yup.string(),
// taskItemMark: Yup.number().required(`Task Mark is required`).min(1, 'Task Mark must be greater than 0'),
// })
// ).required(`Tutorial Task Item is required`),
// status: Yup.number(),
// createdBy: Yup.string(),
// createdAt: Yup.date(),
// updatedBy: Yup.string(),
// updatedAt: Yup.date(),
});
const
[
openAlert
,
setOpenAlert
]
=
useState
(
false
);
const
[
openAlert
,
setOpenAlert
]
=
useState
(
false
);
...
@@ -116,6 +120,12 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
...
@@ -116,6 +120,12 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
// PUT API
// PUT API
}
else
{
}
else
{
// POST API
// POST API
//@ts-ignore
// const req: Tutorial = { ...values }
const
sampleReq
:
Tutorial
=
tutorialReqOb
//@ts-ignore
dispatch
(
addTutorial
(
sampleReq
))
}
}
resetForm
()
resetForm
()
setSubmitting
(
false
);
setSubmitting
(
false
);
...
@@ -266,7 +276,7 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
...
@@ -266,7 +276,7 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
</
AccordionSummary
>
</
AccordionSummary
>
<
AccordionDetails
>
<
AccordionDetails
>
<
Grid
container
spacing=
{
2
}
>
<
Grid
container
spacing=
{
2
}
>
<
Grid
item
xs=
{
12
}
>
<
Grid
item
xs=
{
6
}
>
<
Stack
spacing=
{
1.25
}
>
<
Stack
spacing=
{
1.25
}
>
<
InputLabel
htmlFor=
{
`taskItems.${index}.title`
}
>
Task Title
</
InputLabel
>
<
InputLabel
htmlFor=
{
`taskItems.${index}.title`
}
>
Task Title
</
InputLabel
>
<
TextField
<
TextField
...
@@ -274,8 +284,37 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
...
@@ -274,8 +284,37 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.title`
}
id=
{
`taskItems.${index}.title`
}
placeholder=
"Enter Task Title"
placeholder=
"Enter Task Title"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
title
`)}
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
title
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
error=
{
Boolean
(
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
title
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
title
)
}
helperText=
{
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
title
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
title
}
/>
</
Stack
>
</
Grid
>
<
Grid
item
xs=
{
6
}
>
<
Stack
spacing=
{
1.25
}
>
<
InputLabel
htmlFor=
{
`taskItems.${index}.taskItemMark`
}
>
Task Mark
</
InputLabel
>
<
TextField
fullWidth
id=
{
`taskItems.${index}.taskItemMark`
}
placeholder=
"Enter Task Mark"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
taskItemMark
`)}
error=
{
Boolean
(
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
taskItemMark
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
taskItemMark
)
}
helperText=
{
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
taskItemMark
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
taskItemMark
}
/>
/>
</
Stack
>
</
Stack
>
</
Grid
>
</
Grid
>
...
@@ -287,8 +326,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
...
@@ -287,8 +326,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.referenceImage`
}
id=
{
`taskItems.${index}.referenceImage`
}
placeholder=
"Enter Task Reference Image"
placeholder=
"Enter Task Reference Image"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
referenceImage
`)}
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
referenceImage
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
error=
{
Boolean
(
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
referenceImage
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
referenceImage
)
}
helperText=
{
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
referenceImage
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
referenceImage
}
/>
/>
</
Stack
>
</
Stack
>
</
Grid
>
</
Grid
>
...
@@ -300,8 +347,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
...
@@ -300,8 +347,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.referenceVideo`
}
id=
{
`taskItems.${index}.referenceVideo`
}
placeholder=
"Enter Task Reference Video"
placeholder=
"Enter Task Reference Video"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
referenceVideo
`)}
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
referenceVideo
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
error=
{
Boolean
(
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
referenceVideo
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
referenceVideo
)
}
helperText=
{
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
referenceVideo
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
referenceVideo
}
/>
/>
</
Stack
>
</
Stack
>
</
Grid
>
</
Grid
>
...
@@ -313,8 +368,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
...
@@ -313,8 +368,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.description`
}
id=
{
`taskItems.${index}.description`
}
placeholder=
"Enter Task Description"
placeholder=
"Enter Task Description"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
description
`)}
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
description
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
error=
{
Boolean
(
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
description
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
description
)
}
helperText=
{
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
description
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
description
}
/>
/>
</
Stack
>
</
Stack
>
</
Grid
>
</
Grid
>
...
@@ -326,8 +389,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
...
@@ -326,8 +389,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.howToDo`
}
id=
{
`taskItems.${index}.howToDo`
}
placeholder=
"Enter Task How To Do"
placeholder=
"Enter Task How To Do"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
howToDo
`)}
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
howToDo
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
error=
{
Boolean
(
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
howToDo
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
howToDo
)
}
helperText=
{
touched
.
taskItems
&&
touched
.
taskItems
[
index
].
howToDo
&&
//@ts-ignore
errors
.
taskItems
&&
errors
.
taskItems
[
index
]
&&
errors
.
taskItems
[
index
].
howToDo
}
/>
/>
</
Stack
>
</
Stack
>
</
Grid
>
</
Grid
>
...
...
Project/Frontend/SignConnectPlus/src/types/tutorial.ts
View file @
93fc9979
...
@@ -21,11 +21,11 @@ export type Tutorial = {
...
@@ -21,11 +21,11 @@ export type Tutorial = {
tutorialTitle
?:
string
tutorialTitle
?:
string
tutorialDescription
?:
string
tutorialDescription
?:
string
tutorialImage
?:
string
tutorialImage
?:
string
tutorialMark
:
number
tutorialMark
?
:
number
taskItems
:
taskItemType
[]
taskItems
:
taskItemType
[]
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