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
Hide 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
[]
=
[
{
...
...
@@ -180,4 +180,23 @@ export const tutorials: tutorialType[] = [
"
createdAt
"
:
new
Date
(
"
2023-08-30T12:00:00Z
"
),
"
tutorialMark
"
:
0
,
}
]
\ No newline at end of file
]
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
import
{
useDispatch
,
useSelector
}
from
'
store
'
;
import
{
openSnackbar
}
from
'
store/reducers/snackbar
'
;
import
{
fetchTutorials
,
toInitialState
}
from
'
store/reducers/tutorial
'
;
import
{
Tutorials
}
from
'
types/tutorial
'
;
import
{
ReactTableProps
,
tutorialProps
}
from
'
./types/types
'
;
import
{
Tutorial
,
Tutorial
s
}
from
'
types/tutorial
'
;
import
{
ReactTableProps
}
from
'
./types/types
'
;
// ==============================|| REACT TABLE ||============================== //
...
...
@@ -396,7 +396,7 @@ const List = () => {
//dialog model
const
[
addEdit
,
setAddEdit
]
=
useState
<
boolean
>
(
false
);
const
[
tutorial
,
setTutorial
]
=
useState
<
tutorialProps
>
();
const
[
tutorial
,
setTutorial
]
=
useState
<
Tutorial
>
();
const
handleAddEdit
=
()
=>
{
setAddEdit
(
!
addEdit
);
...
...
@@ -481,7 +481,7 @@ const List = () => {
sx=
{
{
'
& .MuiDialog-paper
'
:
{
p
:
0
},
transition
:
'
transform 225ms
'
}
}
aria
-
describedby=
"alert-dialog-slide-description"
>
<
AddEditTutorial
tutorial=
{
tutorial
}
onCancel=
{
handleAddEdit
}
/>
<
AddEditTutorial
tutorial=
{
tutorial
!
}
onCancel=
{
handleAddEdit
}
/>
</
Dialog
>
{
/* alert model */
}
{
!
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';
import
{
DeleteFilled
}
from
'
@ant-design/icons
'
;
import
{
AccordionSummary
,
InputLabel
,
TextField
}
from
'
@mui/material
'
;
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
'
;
// types
...
...
@@ -53,6 +57,7 @@ const getInitialValues = (tutorial: FormikValues | null) => {
howToDo
:
""
,
referenceImage
:
""
,
referenceVideo
:
""
,
taskItemMark
:
0
,
}
]
}
...
...
@@ -67,37 +72,36 @@ const getInitialValues = (tutorial: FormikValues | null) => {
// ==============================|| CUSTOMER ADD / EDIT ||============================== //
export
interface
Props
{
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
[]
};
tutorial
?:
Tutorial
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
theme
=
useTheme
();
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
);
...
...
@@ -115,7 +119,13 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
if
(
tutorial
)
{
// PUT API
}
else
{
// POST API
// POST API
//@ts-ignore
// const req: Tutorial = { ...values }
const
sampleReq
:
Tutorial
=
tutorialReqOb
//@ts-ignore
dispatch
(
addTutorial
(
sampleReq
))
}
resetForm
()
setSubmitting
(
false
);
...
...
@@ -266,7 +276,7 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
</
AccordionSummary
>
<
AccordionDetails
>
<
Grid
container
spacing=
{
2
}
>
<
Grid
item
xs=
{
12
}
>
<
Grid
item
xs=
{
6
}
>
<
Stack
spacing=
{
1.25
}
>
<
InputLabel
htmlFor=
{
`taskItems.${index}.title`
}
>
Task Title
</
InputLabel
>
<
TextField
...
...
@@ -274,8 +284,37 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.title`
}
placeholder=
"Enter Task Title"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
title
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
error=
{
Boolean
(
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
>
</
Grid
>
...
...
@@ -287,8 +326,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.referenceImage`
}
placeholder=
"Enter Task Reference Image"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
referenceImage
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
error=
{
Boolean
(
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
>
</
Grid
>
...
...
@@ -300,8 +347,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.referenceVideo`
}
placeholder=
"Enter Task Reference Video"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
referenceVideo
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
error=
{
Boolean
(
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
>
</
Grid
>
...
...
@@ -313,8 +368,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.description`
}
placeholder=
"Enter Task Description"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
description
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
error=
{
Boolean
(
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
>
</
Grid
>
...
...
@@ -326,8 +389,16 @@ const AddEditTutorial = ({ tutorial, onCancel }: Props) => {
id=
{
`taskItems.${index}.howToDo`
}
placeholder=
"Enter Task How To Do"
{
...
getFieldProps
(`
taskItems
.
$
{
index
}
.
howToDo
`)}
// error=
{
Boolean
(
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
)}
// helperText=
{
touched
.
ingredientNutritions
![
index
]
.
nutritionCategory
&&
errors
.
ingredientNutritions
![
index
]
.
nutritionCategory
}
error=
{
Boolean
(
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
>
</
Grid
>
...
...
Project/Frontend/SignConnectPlus/src/types/tutorial.ts
View file @
93fc9979
...
...
@@ -21,11 +21,11 @@ export type Tutorial = {
tutorialTitle
?:
string
tutorialDescription
?:
string
tutorialImage
?:
string
tutorialMark
:
number
tutorialMark
?
:
number
taskItems
:
taskItemType
[]
status
:
number
status
?
:
number
createdBy
:
string
createdAt
:
Date
createdAt
?
:
Date
updatedBy
?:
string
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