Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-049
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
2021-049
2021-049
Commits
799ef536
Commit
799ef536
authored
Oct 02, 2021
by
Hasitha Samarasekara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add New Classses and Add students to classes
parent
10fcdd4e
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1585 additions
and
372 deletions
+1585
-372
BackEnd/WebBackEnd/models/ClassStudentList.model.js
BackEnd/WebBackEnd/models/ClassStudentList.model.js
+16
-0
BackEnd/WebBackEnd/models/createClass.model.js
BackEnd/WebBackEnd/models/createClass.model.js
+7
-0
BackEnd/WebBackEnd/models/tutor.user.model.js
BackEnd/WebBackEnd/models/tutor.user.model.js
+1
-1
BackEnd/WebBackEnd/routes/createClass.route.js
BackEnd/WebBackEnd/routes/createClass.route.js
+87
-4
BackEnd/WebBackEnd/routes/filteredListNew.route.js
BackEnd/WebBackEnd/routes/filteredListNew.route.js
+2
-1
BackEnd/WebBackEnd/routes/student.route.js
BackEnd/WebBackEnd/routes/student.route.js
+62
-62
WebFrontEnd/smartcoach-frontend/package-lock.json
WebFrontEnd/smartcoach-frontend/package-lock.json
+10
-0
WebFrontEnd/smartcoach-frontend/package.json
WebFrontEnd/smartcoach-frontend/package.json
+2
-0
WebFrontEnd/smartcoach-frontend/src/Components/Admin/Dashboard.js
...End/smartcoach-frontend/src/Components/Admin/Dashboard.js
+5
-3
WebFrontEnd/smartcoach-frontend/src/Components/Admin/StudentRequestForClass.js
...h-frontend/src/Components/Admin/StudentRequestForClass.js
+551
-0
WebFrontEnd/smartcoach-frontend/src/Components/Admin/add_class_details.js
...tcoach-frontend/src/Components/Admin/add_class_details.js
+291
-96
WebFrontEnd/smartcoach-frontend/src/Components/Home.js
WebFrontEnd/smartcoach-frontend/src/Components/Home.js
+72
-22
WebFrontEnd/smartcoach-frontend/src/Components/HomePage/TutorCard.js
.../smartcoach-frontend/src/Components/HomePage/TutorCard.js
+4
-3
WebFrontEnd/smartcoach-frontend/src/Components/HomePage/TutorProfileView.js
...oach-frontend/src/Components/HomePage/TutorProfileView.js
+475
-180
No files found.
BackEnd/WebBackEnd/models/ClassStudentList.model.js
0 → 100644
View file @
799ef536
const
mongoose
=
require
(
'
mongoose
'
);
const
Schema
=
mongoose
.
Schema
;
const
ClassStudentSchema
=
new
Schema
({
class_id
:{
type
:
mongoose
.
Schema
.
Types
.
ObjectId
,
ref
:
'
Classes
'
},
student_id
:{
type
:
mongoose
.
Schema
.
Types
.
ObjectId
,
ref
:
'
student
'
},
},{
timestamps
:
true
,
});
const
ClassStudentList
=
mongoose
.
model
(
'
ClassStudentList
'
,
ClassStudentSchema
);
module
.
exports
=
ClassStudentList
;
\ No newline at end of file
BackEnd/WebBackEnd/models/createClass.model.js
View file @
799ef536
...
...
@@ -12,6 +12,11 @@ const CreateClassSchema = new Schema({
subject
:{
type
:
String
},
class_fee
:{
type
:
String
},
student_list
:[{
type
:
mongoose
.
Schema
.
Types
.
ObjectId
,
ref
:
'
student
'
}],
class_fee_option
:
{
type
:
String
},
class_conduct_day
:
{
type
:
String
},
class_conduct_time
:
{
type
:
String
},
AdmissionFee
:
{
type
:
String
},
batchYear
:
{
type
:
String
},
isActiveClass
:
{
type
:
Boolean
,
default
:
true
...
...
@@ -20,6 +25,8 @@ const CreateClassSchema = new Schema({
type
:
Boolean
,
default
:
true
}
},{
timestamps
:
true
,
});
...
...
BackEnd/WebBackEnd/models/tutor.user.model.js
View file @
799ef536
...
...
@@ -23,7 +23,7 @@ const userSchema = new Schema({
},
{
timestamps
:
true
,
});
//const institute = mongoose.model('institute',userSchema);
const
User
=
mongoose
.
model
(
'
tutor
'
,
userSchema
);
module
.
exports
=
User
;
\ No newline at end of file
BackEnd/WebBackEnd/routes/createClass.route.js
View file @
799ef536
const
router
=
require
(
'
express
'
).
Router
();
let
classes
=
require
(
'
../models/createClass.model
'
);
let
student
=
require
(
'
../models/student.user.model
'
);
let
studentList
=
require
(
'
../models/ClassStudentList.model
'
);
const
mongoose
=
require
(
"
mongoose
"
);
router
.
route
(
'
/add
'
).
post
(
async
(
req
,
res
)
=>
{
console
.
log
(
"
Inside Create Class
"
)
console
.
log
(
res
.
body
)
if
(
req
.
body
.
institute_id
!==
""
){
...
...
@@ -16,8 +17,13 @@ router.route('/add').post(async(req,res) =>{
const
class_startingDate
=
req
.
body
.
class_startingDate
;
const
subject
=
req
.
body
.
subject
;
const
class_fee
=
req
.
body
.
class_fee
;
const
class_fee_option
=
req
.
body
.
class_fee_option
;
const
isActiveClass
=
req
.
body
.
isActiveClass
;
const
isActiveForStudent
=
req
.
body
.
isActiveForStudent
;
const
class_conduct_day
=
req
.
body
.
class_conduct_day
;
const
class_conduct_time
=
req
.
body
.
class_conduct_time
;
const
AdmissionFee
=
req
.
body
.
AdmissionFee
;
const
batchYear
=
req
.
body
.
batchYear
;
const
newClass
=
new
classes
({
tutor_id
,
...
...
@@ -29,8 +35,12 @@ router.route('/add').post(async(req,res) =>{
class_fee
,
isActiveClass
,
isActiveForStudent
,
institute_id
institute_id
,
class_fee_option
,
class_conduct_day
,
class_conduct_time
,
AdmissionFee
,
batchYear
});
console
.
log
(
newClass
)
...
...
@@ -47,8 +57,13 @@ router.route('/add').post(async(req,res) =>{
const
class_startingDate
=
req
.
body
.
class_startingDate
;
const
subject
=
req
.
body
.
subject
;
const
class_fee
=
req
.
body
.
class_fee
;
const
class_fee_option
=
req
.
body
.
class_fee_option
;
const
isActiveClass
=
req
.
body
.
isActiveClass
;
const
isActiveForStudent
=
req
.
body
.
isActiveForStudent
;
const
class_conduct_day
=
req
.
body
.
class_conduct_day
;
const
class_conduct_time
=
req
.
body
.
class_conduct_time
;
const
AdmissionFee
=
req
.
body
.
AdmissionFee
;
const
batchYear
=
req
.
body
.
batchYear
;
const
newClass
=
new
classes
({
tutor_id
,
...
...
@@ -60,7 +75,11 @@ router.route('/add').post(async(req,res) =>{
class_fee
,
isActiveClass
,
isActiveForStudent
,
class_fee_option
,
class_conduct_day
,
class_conduct_time
,
AdmissionFee
,
batchYear
});
console
.
log
(
newClass
)
...
...
@@ -70,11 +89,75 @@ router.route('/add').post(async(req,res) =>{
}).
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
}
});
router
.
route
(
'
/tutorClass/:id
'
).
get
(
function
(
req
,
res
)
{
let
id
=
req
.
params
.
id
;
//console.log("TutorId : " + id)
classes
.
find
({
"
tutor_id
"
:
id
}).
populate
(
'
institute_id
'
).
then
(
tutorsClasses
=>
{
///console.log(tutor);
res
.
json
(
tutorsClasses
);
}).
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Eroor:
'
+
err
));
});
router
.
route
(
'
/studentList/update
'
).
post
((
req
,
res
)
=>
{
const
class_id
=
req
.
body
.
_id
;
const
student_nic
=
req
.
body
.
student_nic
;
console
.
log
(
"
classID:
"
+
class_id
);
console
.
log
(
"
student_nic:
"
+
student_nic
);
classes
.
findById
(
class_id
,
function
(
err
,
tutorsClass
){
if
(
!
tutorsClass
)
req
.
status
(
404
).
send
(
"
Sorry Class Could not Found.
"
);
else
{
student
.
find
({
"
student_nic
"
:
student_nic
}).
then
(
student
=>
{
console
.
log
(
student
)
console
.
log
(
student
[
0
].
_id
)
if
(
student
[
0
].
student_nic
===
""
){
req
.
status
(
500
).
send
(
"
Sorry, This Student Not Registered
"
);
}
else
{
const
student_id
=
student
[
0
].
_id
;
const
newClassStudent
=
new
studentList
({
class_id
,
student_id
,
});
newClassStudent
.
save
().
then
(
result
=>
{
res
.
json
(
'
Student added to the Class!
'
);
})
.
catch
(
err
=>
{
res
.
status
(
500
).
send
(
"
Update not possible
"
);
});
}
}).
catch
(
err
=>
res
.
status
(
500
).
json
(
'
Eroor:
'
+
err
));
}
});
});
router
.
route
(
'
/studentList/:id
'
).
get
(
function
(
req
,
res
)
{
let
id
=
req
.
params
.
id
;
console
.
log
(
"
Class ID :
"
+
id
)
studentList
.
find
({
"
class_id
"
:
id
}).
populate
(
'
student_id
'
).
then
(
StudentList
=>
{
console
.
log
(
StudentList
);
res
.
json
(
StudentList
);
}).
catch
(
err
=>
{
console
.
log
(
err
);
res
.
status
(
400
).
json
(
'
Error:
'
+
err
)
});
});
module
.
exports
=
router
;
\ No newline at end of file
BackEnd/WebBackEnd/routes/filteredListNew.route.js
View file @
799ef536
...
...
@@ -99,7 +99,8 @@ router.route('/getFilteredList').post((req, res) => {
"
tutor_medium
"
:
teacherReview
.
tutor_medium
,
"
tutor_qualification
"
:
teacherReview
.
tutor_qualification
,
"
tutor_reviewValue
"
:
response
.
data
.
result
,
"
tutor_avg_rating
"
:
Number
(
TotalRating
/
teacherReview
.
ratings
.
length
)
"
tutor_avg_rating
"
:
Number
(
TotalRating
/
teacherReview
.
ratings
.
length
),
"
tutor_review_count
"
:
teacherReview
.
review
.
length
}
let
index
=
await
reviewListWithScore
.
findIndex
(
x
=>
x
.
teacher
===
teacherReview
.
teacher
);
...
...
BackEnd/WebBackEnd/routes/student.route.js
View file @
799ef536
...
...
@@ -89,68 +89,68 @@ router.route('/add').post( async(req,res) =>{
.
then
(
newUser
=>
{
////////////////////////////////////////////////////////////////////////////////////
//
const content = `
//
Hi ${student_name},\n
//
You are Create a Student Account on SmartCoach.\n
//
You can verify your email address click on 'http://localhost:3000/AccountVerified/${newUser.id}'
//
//
Used your email address as the username : ${user_email}
//
Used given password as the password
//
Thank You,
//
Team SmartCoach
//
`;
//
//
var mail = {
//
from: student_name,
//
to: user_email,
//
subject: 'Email Verification - Student',
//
text: content
//
}
//
//
transporter.sendMail(mail, (err, data) => {
//
if (err) {
//
res.json({
//
msg: 'fail'
//
})
//
} else {
//
res.json({
//
msg: 'success'
//
})
//
}
//
})
//
;
//
//
//
const content_guardian = `
//
Hi ${guardian_name},\n
//
Your student ${student_name} is Create a Student Account on SmartCoach.\n
//
//
You can know student progress through the email.
//
We will send Student attendance, Quiz marks, Assignment Marks and other details through this email.
//
//
Thank You,
//
Team SmartCoach
//
`;
//
//
var mail_guardian = {
//
from: guardian_name,
//
to: guardian_email,
//
subject: 'Student Information on SmartCoach',
//
text: content_guardian
//
}
//
//
transporter.sendMail(mail_guardian, (err, data) => {
//
if (err) {
//
res.json({
//
msg: 'fail'
//
})
//
} else {
//
res.json({
//
msg: 'success'
//
})
//
}
//
})
//
;
const
content
=
`
Hi
${
student_name
}
,\n
You are Create a Student Account on SmartCoach.\n
You can verify your email address click on 'http://localhost:3000/AccountVerified/
${
newUser
.
id
}
'
Used your email address as the username :
${
user_email
}
Used given password as the password
Thank You,
Team SmartCoach
`
;
var
mail
=
{
from
:
student_name
,
to
:
user_email
,
subject
:
'
Email Verification - Student
'
,
text
:
content
}
transporter
.
sendMail
(
mail
,
(
err
,
data
)
=>
{
if
(
err
)
{
res
.
json
({
msg
:
'
fail
'
})
}
else
{
res
.
json
({
msg
:
'
success
'
})
}
})
;
const
content_guardian
=
`
Hi
${
guardian_name
}
,\n
Your student
${
student_name
}
is Create a Student Account on SmartCoach.\n
You can know student progress through the email.
We will send Student attendance, Quiz marks, Assignment Marks and other details through this email.
Thank You,
Team SmartCoach
`
;
var
mail_guardian
=
{
from
:
guardian_name
,
to
:
guardian_email
,
subject
:
'
Student Information on SmartCoach
'
,
text
:
content_guardian
}
transporter
.
sendMail
(
mail_guardian
,
(
err
,
data
)
=>
{
if
(
err
)
{
res
.
json
({
msg
:
'
fail
'
})
}
else
{
res
.
json
({
msg
:
'
success
'
})
}
})
;
/////////////////////////////////////////////////////////////////////////////////////
})
...
...
WebFrontEnd/smartcoach-frontend/package-lock.json
View file @
799ef536
...
...
@@ -3660,6 +3660,11 @@
"resolved"
:
"https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.0.tgz"
,
"integrity"
:
"sha512-Io55IuQY3kydzHtbGvQya3H+KorS/M9rSNyfCGCg9WZ4pyT/lCxIlpJgG1GXW/PswzC84Tr2fBYi+7+jFVQQBw=="
},
"bootstrap-icons"
:
{
"version"
:
"1.5.0"
,
"resolved"
:
"https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.5.0.tgz"
,
"integrity"
:
"sha512-44feMc7DE1Ccpsas/1wioN8ewFJNquvi5FewA06wLnqct7CwMdGDVy41ieHaacogzDqLfG8nADIvMNp9e4bfbA=="
},
"brace-expansion"
:
{
"version"
:
"1.1.11"
,
"resolved"
:
"https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz"
,
...
...
@@ -10176,6 +10181,11 @@
"minimist"
:
"^1.2.5"
}
},
"moment"
:
{
"version"
:
"2.29.1"
,
"resolved"
:
"https://registry.npmjs.org/moment/-/moment-2.29.1.tgz"
,
"integrity"
:
"sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
},
"move-concurrently"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz"
,
...
...
WebFrontEnd/smartcoach-frontend/package.json
View file @
799ef536
...
...
@@ -7,6 +7,8 @@
"@testing-library/react"
:
"^11.2.6"
,
"@testing-library/user-event"
:
"^12.8.3"
,
"bootstrap"
:
"^4.6.0"
,
"bootstrap-icons"
:
"^1.5.0"
,
"moment"
:
"^2.29.1"
,
"react"
:
"^17.0.2"
,
"react-bootstrap-icons"
:
"^1.5.0"
,
"react-dom"
:
"^17.0.2"
,
...
...
WebFrontEnd/smartcoach-frontend/src/Components/Admin/Dashboard.js
View file @
799ef536
...
...
@@ -6,6 +6,7 @@ import AddFinance from './add_financial_details';
import
ViewFinance
from
'
./view_financial_details
'
;
import
EditFinance
from
'
./edit_financial_details
'
;
import
AddClass
from
'
./add_class_details
'
;
import
studentRequest
from
'
./StudentRequestForClass
'
;
export
default
class
Dashboard
extends
Component
{
render
()
{
...
...
@@ -358,10 +359,10 @@ export default class Dashboard extends Component {
<
/NavLink
>
<
/li
>
<
li
>
<
a
href
=
"
#
"
>
<
NavLink
to
=
{
"
/admin/classes/studentRequests/
"
}
>
<
i
className
=
"
metismenu-icon
"
><
/i
>
S
chedule
<
/
a
>
S
tudent
Requests
<
/
NavLink
>
<
/li
>
<
li
>
<
a
href
=
"
#
"
>
...
...
@@ -452,6 +453,7 @@ export default class Dashboard extends Component {
<
Route
path
=
"
/admin/finance/add
"
exact
component
=
{
AddFinance
}
/
>
<
Route
path
=
{
"
/admin/finance/edit/:id
"
}
exact
component
=
{
EditFinance
}
/
>
<
Route
path
=
"
/admin/classes/add
"
exact
component
=
{
AddClass
}
/
>
<
Route
path
=
"
/admin/classes/studentRequests
"
exact
component
=
{
studentRequest
}
/
>
<
/div
>
{
/* Footer */
}
...
...
WebFrontEnd/smartcoach-frontend/src/Components/Admin/StudentRequestForClass.js
0 → 100644
View file @
799ef536
import
React
,
{
Component
}
from
"
react
"
;
import
axios
from
"
axios
"
;
import
*
as
configs
from
"
../../Config/config
"
;
import
swal
from
"
sweetalert
"
;
import
*
as
Icon
from
"
react-bootstrap-icons
"
;
import
moment
from
"
moment
"
;
export
default
class
StudentRequestForClass
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
tutorID
:
'
6127b1d7ed4ff23bb0344538
'
,
instituteList
:
[],
ClassMethods
:
[],
subjectList
:
[],
selectedClassMethod
:
''
,
isSelectInstitute
:
false
,
HomeClassType
:
[
"
Group Class
"
,
"
Individual Class
"
],
OtherClassTypes
:
[
"
Group Class
"
,
"
Mass Class
"
,
"
Revision Class
"
,
"
Paper Class
"
,
"
Individual Class
"
],
ClassTypes
:[],
TutorClassList
:
[],
selectedClassType
:
''
,
selectedSubject
:
''
,
labelClassMethod
:
''
,
labelClassType
:
''
,
labelClassCreatedDate
:
''
,
labelClassStartingDate
:
''
,
labelSubject
:
''
,
labelClassFee
:
''
,
labelClassFeeOption
:
''
,
labelBatch
:
''
,
labelClassID
:
''
,
typedNIC
:
''
,
ClassStudentList
:[],
}
this
.
onChangeClassMethod
=
this
.
onChangeClassMethod
.
bind
(
this
);
this
.
onChangeClassTypeDropDown
=
this
.
onChangeClassTypeDropDown
.
bind
(
this
);
this
.
onChangeSubjectDropDown
=
this
.
onChangeSubjectDropDown
.
bind
(
this
);
this
.
onSelectOneClass
=
this
.
onSelectOneClass
.
bind
(
this
);
this
.
onChangeTypedNIC
=
this
.
onChangeTypedNIC
.
bind
(
this
);
this
.
onSubmitAddToClass
=
this
.
onSubmitAddToClass
.
bind
(
this
);
this
.
GetStudentList
=
this
.
GetStudentList
.
bind
(
this
);
}
componentDidMount
()
{
axios
.
get
(
configs
.
BASE_URL
+
'
/tutorSingUp/
'
+
this
.
state
.
tutorID
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
//console.log(response.data);
this
.
setState
({
instituteList
:
response
.
data
.
tutor_instituteIDList
,
ClassMethods
:
response
.
data
.
tutor_class_type
,
subjectList
:
response
.
data
.
tutor_subjects
,
},
()
=>
{
axios
.
get
(
configs
.
BASE_URL
+
'
/createClass/tutorClass/
'
+
this
.
state
.
tutorID
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
this
.
setState
({
TutorClassList
:
response
.
data
},
()
=>
{
})
})
})
})
}
GetStudentList
(){
axios
.
get
(
configs
.
BASE_URL
+
'
/createClass/studentList/
'
+
this
.
state
.
labelClassID
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
this
.
setState
({
ClassStudentList
:
response
.
data
},
()
=>
{
console
.
log
(
this
.
state
.
ClassStudentList
);
})
})
}
onSubmitAddToClass
(){
if
(
this
.
state
.
labelClassID
!==
""
){
const
payload
=
{
_id
:
this
.
state
.
labelClassID
,
student_nic
:
this
.
state
.
typedNIC
}
axios
.
post
(
configs
.
BASE_URL
+
'
/createClass/studentList/update
'
,
payload
)
.
then
(
res
=>
{
console
.
log
(
res
)
swal
(
"
success!!!
"
,
res
.
data
,
"
success
"
).
then
(()
=>
{
//e.target.reset();
//window.location.reload();
this
.
GetStudentList
();
});
})
.
catch
(
function
(
error
)
{
if
(
error
.
response
)
{
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
//console.log(error.response.data);
//console.log(error.response.status);
//console.log(error.response.headers);
if
(
error
.
response
.
status
===
500
){
swal
(
"
Sorry!!!
"
,
"
This Student Not Registered
"
,
"
warning
"
).
then
(()
=>
{
//e.target.reset();
//window.location.reload();
});
}
}
else
if
(
error
.
request
)
{
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
// console.log(error.request);
}
else
{
// Something happened in setting up the request that triggered an Error
//console.log('Error', error.message);
}
//console.log(error.config);
});
}
else
{
swal
(
"
Ops!!!
"
,
"
Please Select a class first
"
,
"
warning
"
);
}
}
onChangeTypedNIC
(
e
){
this
.
setState
({
typedNIC
:
e
.
target
.
value
})
}
onSelectOneClass
(
e
){
//console.log("E : " + e.target);
console
.
log
(
e
.
target
.
value
);
this
.
state
.
TutorClassList
.
map
((
selectedClass
)
=>
{
if
(
selectedClass
.
_id
===
e
.
target
.
value
){
console
.
log
(
"
crated date:
"
+
selectedClass
.
createdAt
)
this
.
setState
({
labelClassMethod
:
selectedClass
.
class_method
,
labelClassType
:
selectedClass
.
class_type
,
labelClassCreatedDate
:
selectedClass
.
createdAt
,
labelClassStartingDate
:
selectedClass
.
class_startingDate
,
labelSubject
:
selectedClass
.
subject
,
labelClassFee
:
selectedClass
.
class_fee
,
labelBatch
:
selectedClass
.
batch_no
,
labelClassFeeOption
:
selectedClass
.
class_fee_option
,
labelClassID
:
selectedClass
.
_id
},()
=>
{
this
.
GetStudentList
();
})
}
})
}
onChangeClassMethod
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
.
target
.
value
);
this
.
setState
({
selectedClassMethod
:
e
.
target
.
value
},()
=>
{
if
(
e
.
target
.
value
===
"
Institute
"
){
this
.
setState
({
isSelectInstitute
:
true
,
ClassTypes
:
this
.
state
.
OtherClassTypes
})
}
else
{
if
(
e
.
target
.
value
===
"
Home Visit
"
){
this
.
setState
({
isSelectInstitute
:
false
,
ClassTypes
:
this
.
state
.
HomeClassType
})
}
else
{
this
.
setState
({
isSelectInstitute
:
false
,
ClassTypes
:
this
.
state
.
OtherClassTypes
})
}
}
})
}
onChangeClassTypeDropDown
(
e
)
{
this
.
setState
({
selectedClassType
:
e
})
}
onChangeSubjectDropDown
(
e
)
{
this
.
setState
({
selectedSubject
:
e
})
}
render
()
{
return
(
<
div
>
<
div
className
=
"
app-page-title
"
>
<
div
className
=
"
page-title-wrapper
"
>
<
div
className
=
"
page-title-heading
"
>
<
div
className
=
"
page-title-icon
"
>
<
i
className
=
"
pe-7s-display1 fa fa-reddit-square
"
><
/i
>
<
/div
>
<
div
>
Student
Request
to
Classes
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
main-card mb card
"
>
<
div
className
=
"
card-body
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
scroll-area
"
style
=
{{
width
:
'
100%
'
,
margin
:
'
20px
'
}}
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
style
=
{{
width
:
'
30%
'
,
paddingLeft
:
'
15px
'
,
paddingBottom
:
'
10px
'
}}
>
<
input
type
=
"
text
"
placeholder
=
"
Search
"
className
=
"
form-control
"
style
=
{{
width
:
'
30%
'
}}
/
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
select
name
=
"
select
"
className
=
"
form-control
"
style
=
{{
width
:
'
100%
'
}}
onChange
=
{
e
=>
this
.
onChangeClassMethod
(
e
)}
>
<
option
value
=
"
0
"
selected
>
Class
Method
<
/option
>
{
this
.
state
.
ClassMethods
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
<
/select
>
<
/div
>
<
div
className
=
"
col
"
>
<
select
name
=
"
select
"
className
=
"
form-control
"
style
=
{{
width
:
'
100%
'
}}
onChange
=
{
e
=>
this
.
onChangeClassTypeDropDown
(
e
.
target
.
value
)}
>
<
option
value
=
"
0
"
selected
>
Class
Type
<
/option
>
{
this
.
state
.
ClassTypes
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
<
/select
>
<
/div
>
<
div
className
=
"
col
"
>
<
select
name
=
"
select
"
className
=
"
form-control
"
onChange
=
{
e
=>
this
.
onChangeSubjectDropDown
(
e
.
target
.
value
)}
>
<
option
value
=
"
0
"
selected
>
Subject
<
/option
>
{
this
.
state
.
subjectList
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
<
/select
>
<
/div
>
<
div
className
=
"
col
"
>
<
select
name
=
"
select
"
className
=
"
form-control
"
onChange
=
{
e
=>
this
.
onChangeSubjectDropDown
(
e
.
target
.
value
)}
>
<
option
value
=
"
0
"
selected
>
Status
<
/option
>
<
option
value
=
""
>
Active
<
/option
>
<
option
value
=
""
>
Deactivate
<
/option
>
<
/select
>
<
/div
>
<
div
className
=
"
col
"
>
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#086232
"
,
color
:
"
white
"
}}
onClick
=
{
this
.
FindTutor
}
><
b
>
Search
<
/b></
button
>
<
/div
>
<
/div
>
<
div
className
=
""
style
=
{{
marginTop
:
'
15px
'
}}
>
<
div
className
=
"
table-dark row
"
>
<
div
className
=
"
col-md-4
"
style
=
{{
textAlign
:
'
left
'
,
paddingLeft
:
'
30px
'
}}
>
<
label
>
Batch
Name
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
Starting
Date
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
Subject
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
Class
Method
/
Type
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
/div
>
{
/*<div className="col">*/
}
{
/* <div className="row">*/
}
{
/* <div className="col"><label>Edit /</label></div>*/
}
{
/* <div className="col"><label>Delete</label></div>*/
}
{
/* </div>*/
}
{
/*</div>*/
}
<
/div
>
{
this
.
state
.
TutorClassList
.
map
((
oneClass
)
=>
{
return
(
<
div
className
=
"
row
"
style
=
{{
background
:
'
#DCDCDC
'
,
paddingBottom
:
'
5px
'
,
paddingTop
:
'
5px
'
,
borderBottom
:
'
inset
'
}}
>
<
div
className
=
"
col-md-4
"
style
=
{{
textAlign
:
'
left
'
}}
>
<
label
style
=
{{
marginLeft
:
'
20px
'
}}
>
{
oneClass
.
batch_no
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
{
moment
(
oneClass
.
class_startingDate
).
format
(
"
L
"
)
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
{
oneClass
.
subject
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
{
oneClass
.
class_method
+
"
-
"
+
oneClass
.
class_type
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
button
className
=
"
rounded
"
style
=
{{
background
:
'
Orange
'
,
padding
:
'
3px
'
,
width
:
'
35px
'
}}
value
=
{
oneClass
.
_id
}
onClick
=
{
e
=>
this
.
onSelectOneClass
(
e
)}
>+<
/button
>
<
/div
>
{
/*<div className="col">*/
}
{
/* <div className="row">*/
}
{
/* <div className="col">*/
}
{
/* <button className="rounded" style={{background:'Orange', padding:'3px', width:'35px'}}><Icon.Pencil color="white" size={20}/></button>*/
}
{
/* </div>*/
}
{
/* <div className="col">*/
}
{
/* <button className="rounded" style={{background:'#8D2828', padding:'3px', width:'35px'}}><Icon.Eraser color="white" size={20}/></button>*/
}
{
/* </div>*/
}
{
/* </div>*/
}
{
/*</div>*/
}
<
/div
>
)
})}
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
b
><
label
style
=
{{
float
:
'
left
'
}}
>
Class
method
<
/label></
b
>
<
label
style
=
{{
float
:
'
right
'
,
paddingRight
:
'
10px
'
}}
>
:
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
{
this
.
state
.
labelClassMethod
}
<
/label
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
b
><
label
style
=
{{
float
:
'
left
'
}}
>
Class
type
<
/label></
b
>
<
label
style
=
{{
float
:
'
right
'
,
paddingRight
:
'
10px
'
}}
>
:
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
{
this
.
state
.
labelClassType
}
<
/label
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
col
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
b
><
label
style
=
{{
float
:
'
left
'
}}
>
Class
created
date
<
/label></
b
>
<
label
style
=
{{
float
:
'
right
'
,
paddingRight
:
'
10px
'
}}
>
:
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
{
moment
(
this
.
state
.
labelClassCreatedDate
).
format
(
"
L
"
)
}
<
/label
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
b
><
label
style
=
{{
float
:
'
left
'
}}
>
Class
starting
date
<
/label></
b
>
<
label
style
=
{{
float
:
'
right
'
,
paddingRight
:
'
10px
'
}}
>
:
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
{
moment
(
this
.
state
.
labelClassStartingDate
).
format
(
"
L
"
)}
<
/label
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
col
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
b
><
label
style
=
{{
float
:
'
left
'
}}
>
Subject
<
/label></
b
>
<
label
style
=
{{
float
:
'
right
'
,
paddingRight
:
'
10px
'
}}
>
:
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
{
this
.
state
.
labelSubject
}
<
/label
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
b
><
label
style
=
{{
float
:
'
left
'
}}
>
Class
fee
<
/label></
b
>
<
label
style
=
{{
float
:
'
right
'
,
paddingRight
:
'
10px
'
}}
>
:
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
Rs
.{
this
.
state
.
labelClassFee
+
"
"
}{
this
.
state
.
labelClassFeeOption
}
<
/label
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
col
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
b
><
label
style
=
{{
float
:
'
left
'
}}
>
Batch
<
/label></
b
>
<
label
style
=
{{
float
:
'
right
'
,
paddingRight
:
'
10px
'
}}
>
:
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
{
this
.
state
.
labelBatch
}
<
/label
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
style
=
{{
margin
:
'
20px
'
}}
>
<
div
className
=
"
row
"
>
<
h5
>
Student
List
<
/h5
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
Student
NIC
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
input
type
=
"
text
"
placeholder
=
"
NIC
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeTypedNIC
}
style
=
{{
width
:
'
100%
'
}}
/
>
<
/div
>
<
div
className
=
"
col
"
>
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#216E9B
"
,
color
:
"
white
"
,
width
:
'
60%
'
}}
onClick
=
{
this
.
onSubmitAddToClass
}
><
b
>
Add
to
Class
<
/b></
button
>
<
/div
>
<
/div
>
<
div
className
=
""
style
=
{{
marginTop
:
'
10px
'
}}
>
<
div
className
=
"
table-dark row
"
>
<
div
className
=
"
col
"
style
=
{{
textAlign
:
'
left
'
}}
>
<
label
>
Student
NIC
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
Student
Name
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
input
type
=
"
text
"
placeholder
=
"
Search from NIC
"
className
=
"
form-control
"
style
=
{{
width
:
'
100%
'
,
margin
:
'
3px
'
}}
/
>
<
/div
>
<
/div
>
{
this
.
state
.
ClassStudentList
.
map
((
student
)
=>
{
return
(
<
div
className
=
"
row
"
style
=
{{
background
:
'
#DCDCDC
'
,
paddingBottom
:
'
5px
'
,
paddingTop
:
'
5px
'
,
borderBottom
:
'
inset
'
}}
>
<
div
className
=
"
col-md-4
"
style
=
{{
textAlign
:
'
left
'
}}
>
<
label
>
{
student
.
student_id
.
student_nic
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
{
student
.
student_id
.
student_name
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
button
className
=
"
rounded
"
style
=
{{
background
:
'
#8D2828
'
,
padding
:
'
3px
'
,
width
:
'
50%
'
,
color
:
'
white
'
}}
>
Remove
<
/button
>
<
/div
>
<
/div
>
)
})}
<
/div
>
<
/div
>
<
div
className
=
"
col
"
style
=
{{
margin
:
'
20px
'
}}
>
<
div
className
=
"
row
"
>
<
h5
>
Students
requests
<
/h5
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-
"
>
<
label
style
=
{{
float
:
'
left
'
}}
>
All
Student
Requests
to
selected
Class
<
/label
>
<
/div
>
<
/div
>
<
div
className
=
""
style
=
{{
marginTop
:
'
10px
'
}}
>
<
div
className
=
"
table-dark row
"
>
<
div
className
=
"
col
"
>
<
label
>
Student
NIC
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
Student
Name
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
background
:
'
#DCDCDC
'
,
paddingBottom
:
'
5px
'
,
paddingTop
:
'
5px
'
,
borderBottom
:
'
inset
'
}}
>
<
div
className
=
"
col-md-4
"
style
=
{{
textAlign
:
'
left
'
}}
>
<
label
><
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
><
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
button
className
=
"
rounded
"
style
=
{{
background
:
'
#086232
'
,
padding
:
'
3px
'
,
width
:
'
35px
'
}}
><
Icon
.
ArrowLeftCircle
color
=
"
white
"
size
=
{
20
}
/></
button
>
<
button
className
=
"
rounded
"
style
=
{{
background
:
'
#8D2828
'
,
padding
:
'
3px
'
,
width
:
'
35px
'
}}
><
Icon
.
Eraser
color
=
"
white
"
size
=
{
20
}
/></
button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)
}
}
\ No newline at end of file
WebFrontEnd/smartcoach-frontend/src/Components/Admin/add_class_details.js
View file @
799ef536
...
...
@@ -2,30 +2,39 @@ import React, {Component} from "react";
import
axios
from
"
axios
"
;
import
*
as
configs
from
"
../../Config/config
"
;
import
swal
from
"
sweetalert
"
;
import
*
as
Icon
from
"
react-bootstrap-icons
"
;
import
moment
from
'
moment
'
export
default
class
AddClassDetails
extends
Component
{
export
default
class
AddClassDetails
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
tutorID
:
'
6127b1d7ed4ff23bb0344538
'
,
tutorID
:
'
6127b1d7ed4ff23bb0344538
'
,
instituteList
:
[],
ClassMethods
:
[],
subjectList
:
[],
selectedClassMethod
:
''
,
isSelectInstitute
:
false
,
HomeClassType
:
[
"
Group Class
"
,
"
Individual Class
"
],
OtherClassTypes
:
[
"
Group Class
"
,
"
Mass Class
"
,
"
Revision Class
"
,
"
Paper Class
"
,
"
Individual Class
"
],
ClassTypes
:[],
selectedClassType
:
''
,
selectedInstitute
:
''
,
batchName
:
''
,
classStartingDate
:
Date
,
selectedSubject
:
''
,
ClassFee
:
''
,
isActiveClass
:
false
,
isActiveForStudent
:
false
,
ClassMethods
:
[],
subjectList
:
[],
selectedClassMethod
:
''
,
isSelectInstitute
:
false
,
HomeClassType
:
[
"
Group Class
"
,
"
Individual Class
"
],
OtherClassTypes
:
[
"
Group Class
"
,
"
Mass Class
"
,
"
Revision Class
"
,
"
Paper Class
"
,
"
Individual Class
"
],
ClassTypes
:
[],
selectedClassType
:
''
,
selectedInstitute
:
''
,
batchName
:
''
,
batchYear
:
''
,
classStartingDate
:
Date
,
selectedSubject
:
''
,
ClassFee
:
''
,
isActiveClass
:
false
,
isActiveForStudent
:
false
,
TutorClassList
:
[],
classFeeOptions
:
[
"
Per hour
"
,
"
Per Day
"
,
"
Per Month
"
],
selectedClassFeeOption
:
''
,
days
:
[
"
Monday
"
,
"
TuesDay
"
,
"
Wednesday
"
,
"
Thursday
"
,
"
Friday
"
,
"
Saturday
"
,
"
Sunday
"
],
selectedDay
:
''
,
HoursTime
:
''
,
AdmissionFee
:
''
,
}
this
.
onChangeClassMethod
=
this
.
onChangeClassMethod
.
bind
(
this
);
...
...
@@ -38,31 +47,70 @@ export default class AddClassDetails extends Component{
this
.
onChangeIsActiveClass
=
this
.
onChangeIsActiveClass
.
bind
(
this
);
this
.
onChangeIsActiveForStudent
=
this
.
onChangeIsActiveForStudent
.
bind
(
this
);
this
.
onSubmitCreateClass
=
this
.
onSubmitCreateClass
.
bind
(
this
);
this
.
onChangeClassFeeOptions
=
this
.
onChangeClassFeeOptions
.
bind
(
this
);
this
.
onChangeBatchYear
=
this
.
onChangeBatchYear
.
bind
(
this
);
this
.
onChangeDay
=
this
.
onChangeDay
.
bind
(
this
);
this
.
onChangeHours
=
this
.
onChangeHours
.
bind
(
this
);
this
.
onChangeAdmissionFee
=
this
.
onChangeAdmissionFee
.
bind
(
this
);
}
componentDidMount
()
{
axios
.
get
(
configs
.
BASE_URL
+
'
/tutorSingUp/
'
+
this
.
state
.
tutorID
)
.
then
(
response
=>
{
axios
.
get
(
configs
.
BASE_URL
+
'
/tutorSingUp/
'
+
this
.
state
.
tutorID
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
//console.log(response.data);
//console.log(response.data);
this
.
setState
({
instituteList
:
response
.
data
.
tutor_instituteIDList
,
ClassMethods
:
response
.
data
.
tutor_class_type
,
subjectList
:
response
.
data
.
tutor_subjects
,
this
.
setState
({
instituteList
:
response
.
data
.
tutor_instituteIDList
,
ClassMethods
:
response
.
data
.
tutor_class_type
,
subjectList
:
response
.
data
.
tutor_subjects
,
},
()
=>
{
},
()
=>
{
axios
.
get
(
configs
.
BASE_URL
+
'
/createClass/tutorClass/
'
+
this
.
state
.
tutorID
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
this
.
setState
({
TutorClassList
:
response
.
data
},
()
=>
{
console
.
log
(
this
.
state
.
instituteList
);
})
})
})
})
})
}
onChangeAdmissionFee
(
e
)
{
this
.
setState
({
AdmissionFee
:
e
.
target
.
value
})
}
onChangeHours
(
e
)
{
this
.
setState
({
HoursTime
:
e
.
target
.
value
})
}
onChangeDay
(
e
)
{
this
.
setState
({
selectedDay
:
e
})
}
onChangeClassFeeOptions
(
e
)
{
this
.
setState
({
selectedClassFeeOption
:
e
})
}
onChangeInstituteDropDown
(
e
)
{
...
...
@@ -83,6 +131,11 @@ export default class AddClassDetails extends Component{
batchName
:
e
.
target
.
value
})
}
onChangeBatchYear
(
e
)
{
this
.
setState
({
batchYear
:
e
.
target
.
value
})
}
onChangeClassStartingDate
(
e
)
{
this
.
setState
({
...
...
@@ -104,11 +157,11 @@ export default class AddClassDetails extends Component{
onChangeIsActiveClass
(
e
)
{
if
(
this
.
state
.
isActiveClass
)
{
if
(
this
.
state
.
isActiveClass
)
{
this
.
setState
({
isActiveClass
:
false
})
}
else
{
}
else
{
this
.
setState
({
isActiveClass
:
true
})
...
...
@@ -117,40 +170,39 @@ export default class AddClassDetails extends Component{
}
onChangeIsActiveForStudent
(
e
)
{
if
(
this
.
state
.
isActiveForStudent
)
{
if
(
this
.
state
.
isActiveForStudent
)
{
this
.
setState
({
isActiveForStudent
:
false
})
}
else
{
}
else
{
this
.
setState
({
isActiveForStudent
:
true
})
}
}
onChangeClassMethod
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
.
target
.
value
);
this
.
setState
({
selectedClassMethod
:
e
.
target
.
value
},
()
=>
{
if
(
e
.
target
.
value
===
"
Institute
"
)
{
},
()
=>
{
if
(
e
.
target
.
value
===
"
Institute
"
)
{
this
.
setState
({
isSelectInstitute
:
true
,
ClassTypes
:
this
.
state
.
OtherClassTypes
isSelectInstitute
:
true
,
ClassTypes
:
this
.
state
.
OtherClassTypes
})
}
else
{
if
(
e
.
target
.
value
===
"
Home Visit
"
){
}
else
{
if
(
e
.
target
.
value
===
"
Home Visit
"
)
{
this
.
setState
({
isSelectInstitute
:
false
,
ClassTypes
:
this
.
state
.
HomeClassType
isSelectInstitute
:
false
,
ClassTypes
:
this
.
state
.
HomeClassType
})
}
else
{
}
else
{
this
.
setState
({
isSelectInstitute
:
false
,
ClassTypes
:
this
.
state
.
OtherClassTypes
isSelectInstitute
:
false
,
ClassTypes
:
this
.
state
.
OtherClassTypes
})
}
...
...
@@ -162,39 +214,43 @@ export default class AddClassDetails extends Component{
e
.
preventDefault
();
let
instituteID
=
''
;
this
.
state
.
instituteList
.
map
(
name
=>
{
if
(
this
.
state
.
selectedInstitute
===
name
.
institute_name
)
{
if
(
this
.
state
.
selectedInstitute
===
name
.
institute_name
)
{
instituteID
=
name
.
_id
;
}
})
const
newClass
=
{
tutor_id
:
this
.
state
.
tutorID
,
class_method
:
this
.
state
.
selectedClassMethod
,
class_type
:
this
.
state
.
selectedClassType
,
institute_id
:
instituteID
,
batch_no
:
this
.
state
.
batchName
,
class_startingDate
:
this
.
state
.
classStartingDate
,
subject
:
this
.
state
.
selectedSubject
,
class_fee
:
this
.
state
.
ClassFee
,
isActiveClass
:
this
.
state
.
isActiveClass
,
isActiveForStudent
:
this
.
state
.
isActiveForStudent
,
tutor_id
:
this
.
state
.
tutorID
,
class_method
:
this
.
state
.
selectedClassMethod
,
class_type
:
this
.
state
.
selectedClassType
,
institute_id
:
instituteID
,
batch_no
:
this
.
state
.
batchName
,
class_startingDate
:
this
.
state
.
classStartingDate
,
subject
:
this
.
state
.
selectedSubject
,
class_fee
:
this
.
state
.
ClassFee
,
class_fee_option
:
this
.
state
.
selectedClassFeeOption
,
isActiveClass
:
this
.
state
.
isActiveClass
,
isActiveForStudent
:
this
.
state
.
isActiveForStudent
,
class_conduct_day
:
this
.
state
.
selectedDay
,
class_conduct_time
:
this
.
state
.
HoursTime
,
AdmissionFee
:
this
.
state
.
AdmissionFee
,
batchYear
:
this
.
state
.
batchYear
}
axios
.
post
(
configs
.
BASE_URL
+
'
/createClass/add
'
,
newClass
)
.
then
(
res
=>
{
swal
(
"
success!!!
"
,
res
,
"
success
"
).
then
(()
=>
{
//
e.target.reset();
//window.location.reload
();
.
then
(
res
=>
{
console
.
log
(
res
)
swal
(
"
success!!!
"
,
res
.
data
,
"
success
"
).
then
(()
=>
{
//
e.target.reset();
//window.location
();
});
window
.
location
.
reload
();
//
window.location.reload();
})
}
render
()
{
return
(
return
(
<
div
>
<
div
className
=
"
app-page-title
"
>
...
...
@@ -215,7 +271,7 @@ export default class AddClassDetails extends Component{
<
form
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-md-
6
"
>
<
div
className
=
"
col-md-
4
"
>
<
div
className
=
"
card-body
"
>
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Class
Method
<
/label
>
...
...
@@ -224,7 +280,7 @@ export default class AddClassDetails extends Component{
<
option
value
=
""
disabled
selected
>
Select
Class
Method
<
/option
>
{
this
.
state
.
ClassMethods
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
...
...
@@ -233,7 +289,7 @@ export default class AddClassDetails extends Component{
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Class
Type
<
/label
>
<
select
name
=
"
select
"
className
=
"
form-control
"
onChange
=
{
e
=>
this
.
onChangeClassTypeDropDown
(
e
.
target
.
value
)}
>
onChange
=
{
e
=>
this
.
onChangeClassTypeDropDown
(
e
.
target
.
value
)}
>
<
option
value
=
""
disabled
selected
>
Select
Class
Type
<
/option
>
{
this
.
state
.
ClassTypes
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
...
...
@@ -243,45 +299,101 @@ export default class AddClassDetails extends Component{
<
/div
>
{
this
.
state
.
isSelectInstitute
===
true
?
<
div
className
=
"
position-relative form-group
"
>
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Institute
<
/label
>
<
select
name
=
"
select
"
className
=
"
form-control
"
onChange
=
{
e
=>
this
.
onChangeInstituteDropDown
(
e
)}
>
onChange
=
{
e
=>
this
.
onChangeInstituteDropDown
(
e
)}
>
<
option
value
=
""
disabled
selected
>
Select
the
Institute
<
/option
>
{
this
.
state
.
instituteList
.
map
((
dis
)
=>
<
option
value
=
{
dis
.
institute_name
}
>
<
option
value
=
{
dis
.
institute_name
}
>
{
dis
.
institute_name
}
<
/option>
)
}
<
/select
>
<
/div
>
:
<
div
><
/div>
}
<
/div
>
:
<
div
><
/div>
}
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Batch
Name
<
/label
>
<
input
type
=
"
text
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeBatchName
}
/
>
<
/div
>
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Class
Starting
Date
<
/label
>
<
input
type
=
"
date
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeClassStartingDate
}
/
>
<
label
>
Batch
Name
&
Year
<
/label
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
input
type
=
"
text
"
placeholder
=
"
Batch Name
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeBatchName
}
/
>
<
/div
>
<
div
className
=
"
col
"
>
<
input
type
=
"
Number
"
placeholder
=
"
Year
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeBatchYear
}
/
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Subject
<
/label
>
<
select
name
=
"
select
"
className
=
"
form-control
"
onChange
=
{
e
=>
this
.
onChangeSubjectDropDown
(
e
.
target
.
value
)}
>
onChange
=
{
e
=>
this
.
onChangeSubjectDropDown
(
e
.
target
.
value
)}
>
<
option
value
=
""
disabled
selected
>
Select
the
Subject
<
/option
>
{
this
.
state
.
subjectList
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
<
/select
>
<
/div
>
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Class
Fee
<
/label
>
<
input
type
=
"
text
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeClassFee
}
/
>
<
label
>
Class
Starting
Date
<
/label
>
<
input
type
=
"
date
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeClassStartingDate
}
/
>
<
/div
>
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Class
Conduct
Day
and
Time
<
/label
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
select
name
=
"
select
"
className
=
"
form-control
"
onChange
=
{
e
=>
this
.
onChangeDay
(
e
.
target
.
value
)}
>
<
option
value
=
""
disabled
selected
>
Select
the
Day
<
/option
>
{
this
.
state
.
days
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
<
/select
>
<
/div
>
<
div
className
=
"
col
"
>
<
input
type
=
"
text
"
placeholder
=
"
7.00 PM - 9.00 PM
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeHours
}
/
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Class
Fee
(
Rs
.)
<
/label
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
input
type
=
"
text
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeClassFee
}
/
>
<
/div
>
<
div
className
=
"
col
"
>
<
select
name
=
"
select
"
className
=
"
form-control
"
onChange
=
{
e
=>
this
.
onChangeClassFeeOptions
(
e
.
target
.
value
)}
>
<
option
value
=
""
disabled
selected
>
Select
Options
<
/option
>
{
this
.
state
.
classFeeOptions
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
<
/select
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
position-relative form-group
"
>
<
label
>
Admission
Fee
<
/label
>
<
div
className
=
"
col
"
>
<
input
type
=
"
text
"
placeholder
=
"
Admission Fee
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeAdmissionFee
}
/
>
<
/div
>
<
/div
>
<
div
className
=
"
position-relative form-group
"
>
<
input
type
=
"
checkbox
"
id
=
"
onlineClass
"
className
=
"
form-control
"
...
...
@@ -315,36 +427,43 @@ export default class AddClassDetails extends Component{
<
/div
>
<
div
className
=
"
position-relative form-group
"
>
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#8D4433
"
,
color
:
"
white
"
,
margin
:
'
50px
'
,
width
:
'
50%
'
}}
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#216E9B
"
,
color
:
"
white
"
,
margin
:
'
50px
'
,
width
:
'
50%
'
}}
onClick
=
{
this
.
onSubmitCreateClass
}
><
b
>
Create
Class
<
/b></
button
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-
6
"
>
<
div
className
=
"
col-md-
8
"
>
<
div
className
=
"
card-body
"
>
<
div
className
=
"
position-relative form-group
"
>
<
label
><
h5
>
Classes
<
/h5></
label
>
<
/div
>
<
div
className
=
"
card-border
"
style
=
{{
background
:
'
lightgray
'
,
padding
:
'
15px
'
}}
>
<
div
className
=
"
card-border
"
style
=
{{
background
:
'
lightgray
'
,
padding
:
'
15px
'
}}
>
<
div
className
=
"
row
"
>
<
h5
style
=
{{
marginLeft
:
'
10px
'
}}
>
Filters
<
/h5
>
<
h5
style
=
{{
marginLeft
:
'
10px
'
}}
>
Filters
<
/h5
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
select
name
=
"
select
"
className
=
"
form-control
"
style
=
{{
width
:
'
100%
'
}}
<
select
name
=
"
select
"
className
=
"
form-control
"
style
=
{{
width
:
'
100%
'
}}
onChange
=
{
e
=>
this
.
onChangeClassMethod
(
e
)}
>
<
option
value
=
""
disabled
selected
>
Class
Method
<
/option
>
{
this
.
state
.
ClassMethods
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
<
/select
>
<
/div
>
<
div
className
=
"
col
"
>
<
select
name
=
"
select
"
className
=
"
form-control
"
style
=
{{
width
:
'
100%
'
}}
<
select
name
=
"
select
"
className
=
"
form-control
"
style
=
{{
width
:
'
100%
'
}}
onChange
=
{
e
=>
this
.
onChangeClassTypeDropDown
(
e
.
target
.
value
)}
>
<
option
value
=
""
disabled
selected
>
Class
Type
<
/option
>
{
this
.
state
.
ClassTypes
.
map
((
dis
)
=>
...
...
@@ -358,7 +477,7 @@ export default class AddClassDetails extends Component{
onChange
=
{
e
=>
this
.
onChangeSubjectDropDown
(
e
.
target
.
value
)}
>
<
option
value
=
""
disabled
selected
>
Subject
<
/option
>
{
this
.
state
.
subjectList
.
map
((
dis
)
=>
<
option
value
=
{
dis
}
>
<
option
value
=
{
dis
}
>
{
dis
}
<
/option>
)
}
<
/select
>
...
...
@@ -373,25 +492,101 @@ export default class AddClassDetails extends Component{
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
10px
'
}}
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
10px
'
}}
>
<
div
className
=
"
col-6
"
>
<
input
type
=
"
text
"
placeholder
=
"
Search
"
className
=
"
form-control
"
/>
<
input
type
=
"
text
"
placeholder
=
"
Search
"
className
=
"
form-control
"
/>
<
/div
>
<
div
className
=
"
col
"
>
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#8D4433
"
,
color
:
"
white
"
}}
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#8D4433
"
,
color
:
"
white
"
}}
onClick
=
{
this
.
ResetFilters
}
><
b
>
Reset
<
/b></
button
>
<
/div
>
<
div
className
=
"
col
"
>
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#086232
"
,
color
:
"
white
"
}}
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#086232
"
,
color
:
"
white
"
}}
onClick
=
{
this
.
FindTutor
}
><
b
>
Search
<
/b></
button
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
div
className
=
"
container
"
style
=
{{
marginTop
:
'
15px
'
}}
>
<
div
className
=
"
table-dark row
"
>
<
div
className
=
"
col-md-4
"
style
=
{{
textAlign
:
'
left
'
}}
>
<
label
>
Batch
Name
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
Starting
Date
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
Subject
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
Class
Method
/
Type
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
><
label
>
Edit
/<
/label></
div
>
<
div
className
=
"
col
"
><
label
>
Delete
<
/label></
div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
scroll-area-lg
"
style
=
{{
marginLeft
:
'
-15px
'
,
marginRight
:
'
-15px
'
}}
>
{
this
.
state
.
TutorClassList
.
map
((
oneClass
)
=>
{
return
(
<
div
className
=
"
row
"
style
=
{{
background
:
'
#DCDCDC
'
,
paddingBottom
:
'
5px
'
,
paddingTop
:
'
5px
'
,
borderBottom
:
'
inset
'
}}
>
<
div
className
=
"
col-md-4
"
style
=
{{
textAlign
:
'
left
'
,
marginLeft
:
'
10px
'
}}
>
<
label
style
=
{{}}
>
{
oneClass
.
batch_no
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
{
moment
(
oneClass
.
class_startingDate
).
format
(
"
L
"
)}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
{
oneClass
.
subject
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
label
>
{
oneClass
.
class_method
+
"
-
"
+
oneClass
.
class_type
}
<
/label
>
<
/div
>
<
div
className
=
"
col
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
button
className
=
"
rounded
"
style
=
{{
background
:
'
Orange
'
,
padding
:
'
3px
'
,
width
:
'
35px
'
}}
><
Icon
.
Pencil
color
=
"
white
"
size
=
{
20
}
/
>
<
/button
>
<
/div
>
<
div
className
=
"
col
"
>
<
button
className
=
"
rounded
"
style
=
{{
background
:
'
#8D2828
'
,
padding
:
'
3px
'
,
width
:
'
35px
'
}}
><
Icon
.
Eraser
color
=
"
white
"
size
=
{
20
}
/
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)
})}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
WebFrontEnd/smartcoach-frontend/src/Components/Home.js
View file @
799ef536
import
React
,
{
Component
}
from
"
react
"
;
import
Dropdown
from
'
react-dropdown
'
;
import
StarRatingComponent
from
'
react-star-rating-component
'
;
import
'
react-dropdown/style.css
'
;
import
MianImage
from
"
../Images/mainimage2.jpg
"
;
import
RecommendIcon
from
"
../Images/recomended.png
"
;
...
...
@@ -100,11 +98,11 @@ export default class Home extends Component{
if
(
this
.
state
.
TutorFilteredList
.
length
>
0
){
if
(
this
.
state
.
TotalRecommendationCount
<
=
100
){
if
(
this
.
state
.
TotalRecommendationCount
==
=
100
){
this
.
getRecommendation
();
}
else
{
swal
(
"
Sorry
"
,
"
Total Filter value Count is not correct.
\n
Please Set Total Filter Value as
less than or
equal to 100.
"
,
"
warning
"
);
swal
(
"
Sorry
"
,
"
Total Filter value Count is not correct.
\n
Please Set Total Filter Value as equal to 100.
"
,
"
warning
"
);
}
}
else
{
...
...
@@ -186,24 +184,72 @@ export default class Home extends Component{
});
}
OnChangeIsCRPastResults
(
e
)
{
this
.
setState
({
isRVPastResults
:
e
.
target
.
value
});
if
(
this
.
state
.
isRVPastResults
){
this
.
setState
({
isRVPastResults
:
false
,
RVPastResults
:
0
},()
=>
{
this
.
calculateTotalRecommendationCount
();
});
}
else
{
this
.
setState
({
isRVPastResults
:
true
});
}
}
OnChangeIsCRRatings
(
e
)
{
this
.
setState
({
isRVRatings
:
e
.
target
.
value
});
if
(
this
.
state
.
isRVRatings
){
this
.
setState
({
isRVRatings
:
false
,
RVRatings
:
0
},()
=>
{
this
.
calculateTotalRecommendationCount
();
});
}
else
{
this
.
setState
({
isRVRatings
:
true
});
}
}
OnChangeIsCRReviews
(
e
)
{
this
.
setState
({
isRVReviews
:
e
.
target
.
value
});
if
(
this
.
state
.
isRVReviews
){
this
.
setState
({
isRVReviews
:
false
,
RVReviews
:
0
},()
=>
{
this
.
calculateTotalRecommendationCount
();
});
}
else
{
this
.
setState
({
isRVReviews
:
true
});
}
}
OnChangeIsCRStudentCount
(
e
)
{
this
.
setState
({
isStudentCount
:
e
.
target
.
value
});
if
(
this
.
state
.
isStudentCount
){
this
.
setState
({
isStudentCount
:
false
,
RVStudentCount
:
0
},()
=>
{
this
.
calculateTotalRecommendationCount
();
});
}
else
{
this
.
setState
({
isStudentCount
:
true
});
}
}
OnChangeStream
(
e
)
{
...
...
@@ -336,13 +382,19 @@ export default class Home extends Component{
tutor_qualification
:
tutor
.
tutor_qualification
,
tutor_reviewValue
:
tutor
.
tutor_reviewValue
,
tutor_avg_rating
:
tutor
.
tutor_avg_rating
,
tutor_finalScore
:
FinalScore
tutor_finalScore
:
FinalScore
,
tutor_review_count
:
tutor
.
tutor_review_count
}
TutorFinalList
.
push
(
temp
);
})
TutorFinalList
.
sort
((
a
,
b
)
=>
b
.
tutor_finalScore
-
a
.
tutor_finalScore
);
this
.
setState
({
TutorFilteredListFinal
:
TutorFinalList
},()
=>
{
if
(
this
.
state
.
TotalRecommendationCount
===
0
){
swal
(
"
Ops!!!
"
,
"
You are not added any Filters...
\n
Please add filters to get correct recommendation
"
,
"
warning
"
);
}
})
}
...
...
@@ -455,7 +507,7 @@ export default class Home extends Component{
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginRight
:
'
50px
'
,
marginLeft
:
'
50px
'
,
marginTop
:
'
10px
'
,
padding
:
'
10px
'
,
background
:
'
#1E4258
'
}}
>
<
h5
style
=
{{
color
:
"
white
"
,
float
:
'
left
'
}}
>
Customized
Recommendation
<
/h5
>
<
h5
style
=
{{
color
:
"
white
"
,
float
:
'
left
'
}}
>
Customized
Your
Recommendation
<
/h5
>
<
/div
>
{
this
.
state
.
isClickFilterArrow
?
...
...
@@ -655,13 +707,11 @@ export default class Home extends Component{
<
div
className
=
"
row
"
style
=
{{
justifyContent
:
'
center
'
}}
>
{
this
.
state
.
isClickFilterArrow
?
<
button
className
=
"
form-control
"
style
=
{{
width
:
'
5%
'
,
height
:
'
50px
'
}}
onClick
=
{
this
.
onClickFilterArrow
}
>
<
span
style
=
{{
margin
:
'
20px
'
,
cursor
:
'
pointer
'
}}
><
Icon
.
ArrowBarUp
color
=
"
#444444
"
size
=
{
35
}
/></
span
>
<
span
style
=
{{
margin
:
'
5px
'
,
cursor
:
'
pointer
'
}}
><
Icon
.
ArrowBarUp
color
=
"
#444444
"
size
=
{
35
}
/></
span
>
<
/button
>
:
<
button
className
=
"
form-control
"
style
=
{{
width
:
'
5%
'
,
height
:
'
50px
'
}}
onClick
=
{
this
.
onClickFilterArrow
}
>
<
span
style
=
{{
margin
:
'
20px
'
,
cursor
:
'
pointer
'
}}
><
Icon
.
ArrowBarDown
color
=
"
#444444
"
size
=
{
35
}
/></
span
>
<
span
style
=
{{
margin
:
'
5px
'
,
cursor
:
'
pointer
'
}}
><
Icon
.
ArrowBarDown
color
=
"
#444444
"
size
=
{
35
}
/></
span
>
<
/button
>
}
<
/div
>
...
...
WebFrontEnd/smartcoach-frontend/src/Components/HomePage/TutorCard.js
View file @
799ef536
...
...
@@ -64,7 +64,7 @@ export default class TutorCard extends Component{
<
img
src
=
{
Star
}
style
=
{{
width
:
'
20px
'
,
height
:
'
20px
'
}}
/
>
<
/div
>
<
div
className
=
"
col
"
>
<
h5
style
=
{{
float
:
"
left
"
}}
>
5
<
/h5
>
<
h5
style
=
{{
float
:
"
left
"
}}
>
{
this
.
props
.
data
.
tutor_avg_rating
.
toFixed
(
1
)}
<
/h5
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
...
...
@@ -72,7 +72,7 @@ export default class TutorCard extends Component{
<
img
src
=
{
ReviewImg
}
style
=
{{
width
:
'
20px
'
,
height
:
'
20px
'
}}
/
>
<
/div
>
<
div
className
=
"
col
"
>
<
h5
style
=
{{
float
:
"
left
"
}}
>
23
reviews
<
/h5
>
<
h5
style
=
{{
float
:
"
left
"
}}
>
{
this
.
props
.
data
.
tutor_review_count
}
reviews
<
/h5
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
...
...
@@ -84,7 +84,8 @@ export default class TutorCard extends Component{
<
/div
>
<
/div
>
<
div
className
=
"
row
"
>
<
button
className
=
"
form-control
"
style
=
{{
background
:
"
#216E9B
"
,
color
:
"
white
"
,
marginLeft
:
'
15px
'
,
marginRight
:
'
15px
'
}}
><
b
>
View
Profile
<
/b></
button
>
<
button
className
=
"
form-control
"
value
=
{
this
.
props
.
data
.
_id
}
style
=
{{
background
:
"
#216E9B
"
,
color
:
"
white
"
,
marginLeft
:
'
15px
'
,
marginRight
:
'
15px
'
}}
><
b
>
View
Profile
<
/b></
button
>
<
/div
>
<
/div
>
...
...
WebFrontEnd/smartcoach-frontend/src/Components/HomePage/TutorProfileView.js
View file @
799ef536
...
...
@@ -4,6 +4,8 @@ import TestTeacher from "../../Images/teacher.jpg";
import
{
FaStar
}
from
"
react-icons/fa
"
;
import
axios
from
"
axios
"
;
import
*
as
configs
from
"
../../Config/config
"
;
import
*
as
Icon
from
"
react-bootstrap-icons
"
;
import
moment
from
"
moment
"
;
export
default
class
TutorProfileView
extends
Component
{
...
...
@@ -12,6 +14,7 @@ export default class TutorProfileView extends Component{
super
(
props
);
this
.
state
=
{
tutor_id
:
'
6127b1d7ed4ff23bb0344538
'
,
rating
:
0
,
overRollRating
:
3.5
,
ratingCount
:
20
,
...
...
@@ -23,8 +26,22 @@ export default class TutorProfileView extends Component{
alreadyRate
:
false
,
review
:
''
,
student_id
:
''
,
tutor_id
:
''
,
version
:
'
1
'
,
TutorClassList
:[],
instituteList
:
[],
ClassMethods
:
[],
subjectList
:
[],
tutor_name
:
''
,
tutor_email
:
''
,
tutor_phone
:
''
,
tutor_address
:
''
,
tutor_gender
:
''
,
tutor_medium
:
''
,
tutor_qualification
:
''
,
OnlineClass
:
''
,
HomeVisit
:
''
,
Institute
:
''
,
tutorManinCities
:
[],
};
...
...
@@ -37,6 +54,68 @@ export default class TutorProfileView extends Component{
this
.
submitRating
=
this
.
submitRating
.
bind
(
this
);
}
componentDidMount
()
{
axios
.
get
(
configs
.
BASE_URL
+
'
/tutorSingUp/
'
+
this
.
state
.
tutor_id
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
//console.log(response.data);
this
.
setState
({
instituteList
:
response
.
data
.
tutor_instituteIDList
,
ClassMethods
:
response
.
data
.
tutor_class_type
,
subjectList
:
response
.
data
.
tutor_subjects
,
tutor_name
:
response
.
data
.
tutor_name
,
tutor_email
:
response
.
data
.
tutor_email
,
tutor_phone
:
response
.
data
.
tutor_phone
,
tutor_address
:
response
.
data
.
tutor_address
,
tutor_gender
:
response
.
data
.
tutor_gender
,
tutor_medium
:
response
.
data
.
tutor_medium
,
tutor_qualification
:
response
.
data
.
tutor_qualification
,
tutorManinCities
:
response
.
data
.
tutor_main_city
},
()
=>
{
this
.
state
.
ClassMethods
.
map
((
type
)
=>
{
if
(
type
===
"
Online class
"
){
this
.
setState
({
OnlineClass
:
type
})
}
else
if
(
type
===
"
Home Visit
"
){
this
.
setState
({
HomeVisit
:
type
})
}
else
if
(
type
===
"
Institute
"
){
this
.
setState
({
Institute
:
type
})
}
})
axios
.
get
(
configs
.
BASE_URL
+
'
/createClass/tutorClass/
'
+
this
.
state
.
tutor_id
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
this
.
setState
({
TutorClassList
:
response
.
data
},
()
=>
{
})
})
})
})
}
onClickRatingValue
(
e
)
{
console
.
log
(
e
.
target
.
value
);
this
.
setState
({
...
...
@@ -106,15 +185,15 @@ export default class TutorProfileView extends Component{
<
div
className
=
"
row
"
>
<
div
className
=
"
col
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-
4
"
>
<
div
className
=
"
col-
"
>
<
img
src
=
{
TestTeacher
}
style
=
{{
width
:
'
160px
'
,
height
:
'
160px
'
,
float
:
'
left
'
,
margin
:
'
30px
'
}}
/
>
<
/div
>
<
div
className
=
"
col
"
style
=
{{
padding
:
'
20px
'
,
float
:
'
left
'
,
marginTop
:
'
20px
'
}}
>
<
div
className
=
"
row
"
>
<
h5
>
Sanath
Kumara
<
/h5
>
<
h5
>
{
this
.
state
.
tutor_name
}
<
/h5
>
<
/div
>
<
div
className
=
"
row
"
>
<
label
>
B
.
Sc
(
Mgt
)
Special
,
University
of
Sri
Jayawardanapura
<
/label
>
<
label
>
{
this
.
state
.
tutor_qualification
}
<
/label
>
<
/div
>
<
div
className
=
"
row
"
>
...
...
@@ -140,9 +219,11 @@ export default class TutorProfileView extends Component{
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
h6
>
About
Me
<
/h6
>
<
div
className
=
"
row
"
style
=
{{
marginLeft
:
'
0px
'
,
paddingLeft
:
'
20px
'
,
paddingTop
:
'
5px
'
,
paddingBottom
:
'
5px
'
,
background
:
'
#022140
'
,
color
:
'
white
'
}}
>
<
h5
>
About
Me
<
/h5
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
div
className
=
"
col
"
>
<
label
style
=
{{
textAlign
:
'
justify
'
}}
>
...
...
@@ -155,8 +236,9 @@ export default class TutorProfileView extends Component{
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
h6
>
About
My
Class
<
/h6
>
<
div
className
=
"
row
"
style
=
{{
marginLeft
:
'
0px
'
,
paddingLeft
:
'
20px
'
,
paddingTop
:
'
5px
'
,
paddingBottom
:
'
5px
'
,
background
:
'
#022140
'
,
color
:
'
white
'
}}
>
<
h5
>
About
My
Class
<
/h5
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
div
className
=
"
col
"
>
...
...
@@ -170,220 +252,433 @@ export default class TutorProfileView extends Component{
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginLeft
:
'
0px
'
,
paddingLeft
:
'
20px
'
,
paddingTop
:
'
5px
'
,
paddingBottom
:
'
5px
'
,
background
:
'
#022140
'
,
color
:
'
white
'
}}
>
<
h5
>
Contact
Details
<
/h5
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginLeft
:
'
20px
'
,
marginTop
:
'
20px
'
}}
>
<
div
className
=
"
col-
"
>
<
Icon
.
Telephone
color
=
"
black
"
size
=
{
22
}
/
>
<
/div
>
<
div
className
=
"
col-
"
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
15px
'
}}
>
<
label
>+
94
{
this
.
state
.
tutor_phone
}
<
/label
>
<
/div
>
<
/div
>
<
div
className
=
"
col
"
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
h4
>
Rating
and
Reviews
<
/h4
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
div
className
=
"
col-4
"
>
<
div
className
=
"
row
"
style
=
{{
padding
:
'
15px
'
}}
>
<
h2
style
=
{{
marginLeft
:
'
15px
'
}}
><
span
style
=
{{
color
:
'
gray
'
}}
><
b
style
=
{{
fontSize
:
'
40px
'
,
color
:
"
black
"
}}
>
{
this
.
state
.
overRollRating
}
<
/b>/
5
<
/span></
h2
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginLeft
:
'
20px
'
,
marginTop
:
'
10px
'
}}
>
<
div
className
=
"
col-
"
>
<
Icon
.
Envelope
color
=
"
black
"
size
=
{
22
}
/
>
<
/div
>
<
div
className
=
"
row
"
>
{[...
Array
(
5
)].
map
((
star
,
i
)
=>
{
const
ratingValue
=
i
+
1
;
return
<
label
style
=
{{
marginLeft
:
'
20px
'
,
float
:
'
left
'
}}
>
<
input
type
=
"
radio
"
name
=
"
rating
"
style
=
{{
display
:
"
none
"
,
cursor
:
"
pointer
"
}}
value
=
{
ratingValue
}
//onClick={this.onClickRatingValue}
/
>
<
FaStar
size
=
{
40
}
color
=
{
ratingValue
<=
(
this
.
state
.
overRollRating
)
?
"
#ffc107
"
:
"
#e4e5e9
"
}
//onMouseEnter={() => this.onMouseEnter(i + 1)}
style
=
{{
cursor
:
"
pointer
"
}}
/
>
<
/label
>
})}
<
div
className
=
"
col-
"
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
15px
'
}}
>
<
label
>
{
this
.
state
.
tutor_email
}
<
/label
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
padding
:
'
15px
'
}}
>
<
span
style
=
{{
marginLeft
:
'
15px
'
}}
>
{
this
.
state
.
ratingCount
}
Ratings
<
/span
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
20px
'
,
marginLeft
:
'
0px
'
,
paddingLeft
:
'
20px
'
,
paddingTop
:
'
5px
'
,
paddingBottom
:
'
5px
'
,
background
:
'
#022140
'
,
color
:
'
white
'
}}
>
<
h5
>
Tutor
'
s Classes</h5>
</div>
<div className="row" style={{marginLeft:
'
20
px
'
,marginTop:
'
20
px
'
}}>
<div className="col-">
<h6>Language : <b>{this.state.tutor_medium}</b></h6>
</div>
</div>
<
div
className
=
"
col-6
"
>
<
div
className
=
"
row
"
style
=
{{
padding
:
'
5px
'
}}
>
<
div
className
=
"
col-
"
>
{[...
Array
(
5
)].
map
((
star
,
i
)
=>
{
const
ratingValue
=
i
+
1
;
<div className="row" style={{marginLeft:
'
20
px
'
,marginTop:
'
10
px
'
}}>
<div className="col-">
<h6>Subjects : <b>{this.state.subjectList}</b></h6>
</div>
return
<
label
style
=
{{
marginLeft
:
'
15px
'
,
float
:
'
left
'
}}
>
<
input
type
=
"
radio
"
name
=
"
rating
"
style
=
{{
display
:
"
none
"
,
cursor
:
"
pointer
"
}}
value
=
{
ratingValue
}
/
>
<
FaStar
size
=
{
20
}
color
=
{
ratingValue
<=
5
?
"
#ffc107
"
:
"
#e4e5e9
"
}
style
=
{{
cursor
:
"
pointer
"
}}
/
>
<
/label
>
})}
</div>
<div className="row" style={{marginLeft:
'
20
px
'
, marginTop:
'
10
px
'
}}>
<div className="col-">
{this.state.OnlineClass === "" ?
<Icon.XOctagon color="black" size={18}/>
:
<Icon.Check2Circle color="black" size={18}/>
}
</div>
<div className="col-" style={{float:
'
left
'
, marginLeft:
'
15
px
'
}}>
<label>Online Classes</label>
</div>
</div>
<div className="" style={{marginLeft:
'
20
px
'
}}>
<div className="scroll-area">
<div className="table-dark row">
<div className="col">
<label>Class Type</label>
</div>
<div className="col">
<label>A/L Batch</label>
</div>
<div className="col">
<label>Starting Date</label>
</div>
<div className="col">
<label>Subject</label>
</div>
<div className="col">
<label>Day and Time</label>
</div>
<div className="col">
</div>
</div>
<
div
className
=
"
col
"
>
<
span
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
10px
'
}}
>
{
this
.
state
.
ratingFive
}
rate
(
s
)
<
/span
>
<
/div
>
</div>
<
div
className
=
"
row
"
style
=
{{
padding
:
'
5px
'
}}
>
<
div
className
=
"
col-
"
>
{[...
Array
(
5
)].
map
((
star
,
i
)
=>
{
const
ratingValue
=
i
+
1
;
return
<
label
style
=
{{
marginLeft
:
'
15px
'
,
float
:
'
left
'
}}
>
<
input
type
=
"
radio
"
name
=
"
rating
"
style
=
{{
display
:
"
none
"
,
cursor
:
"
pointer
"
}}
value
=
{
ratingValue
}
/
>
<
FaStar
size
=
{
20
}
color
=
{
ratingValue
<=
4
?
"
#ffc107
"
:
"
#e4e5e9
"
}
style
=
{{
cursor
:
"
pointer
"
}}
/
>
<
/label
>
})}
</div>
{this.state.TutorClassList.map((tutorClass)=>{
if(tutorClass.class_method === "Online class"){
return(
<div className="row" style={{background:
'
#
DCDCDC
'
, paddingBottom:
'
5
px
'
, paddingTop:
'
5
px
'
,marginLeft:
'
5
px
'
, borderBottom:
'
inset
'
}}>
<div className="col">
<label>{tutorClass.class_type}</label>
</div>
<div className="col">
<label>{tutorClass.batchYear}</label>
</div>
<div className="col">
<label>{moment(tutorClass.class_startingDate).format("L") }</label>
</div>
<div className="col">
<label>{tutorClass.subject}</label>
</div>
<div className="col">
<label>{tutorClass.class_conduct_day} - {tutorClass.class_conduct_time}</label>
</div>
<div className="col">
<button className="rounded" style={{background:
'
Orange
'
, padding:
'
3
px
'
, width:
'
35
px
'
}} value={""} onClick={e => this.onSelectOneClass(e)}>+</button>
</div>
</div>
)
}
})}
<div className="row" style={{marginLeft:
'
20
px
'
, marginTop:
'
5
px
'
}}>
<div className="col-">
{this.state.HomeVisit === "" ?
<Icon.XOctagon color="black" size={18}/>
:
<Icon.Check2Circle color="black" size={18}/>
}
</div>
<div className="col-" style={{float:
'
left
'
, marginLeft:
'
15
px
'
}}>
<label>Home Visit</label>
</div>
</div>
<div className="row" style={{marginLeft:
'
20
px
'
, marginTop:
'
0
px
'
}}>
<div className="col-" style={{marginLeft:
'
30
px
'
}}>
<Icon.GeoAlt color="black" size={18}/>
</div>
<div className="col-" style={{float:
'
left
'
, marginLeft:
'
15
px
'
}}>
<label>Home Visit Areas : {this.state.tutorManinCities.map((city)=>{
return(
<span>{city} | </span>
)
})}</label>
</div>
</div>
<div className="row" style={{marginLeft:
'
20
px
'
, marginTop:
'
5
px
'
}}>
{this.state.Institute === "" ?
<Icon.XOctagon color="black" size={18}/>
:
<Icon.Check2Circle color="black" size={18}/>
}
<div className="col-" style={{float:
'
left
'
, marginLeft:
'
15
px
'
}}>
<label>Institutes</label>
</div>
</div>
<div className="row" style={{marginLeft:
'
20
px
'
, marginTop:
'
0
px
'
}}>
<div className="col-" style={{marginLeft:
'
30
px
'
}}>
<Icon.Building color="black" size={18}/>
</div>
<div className="col-" style={{float:
'
left
'
, marginLeft:
'
15
px
'
}}>
<label>Institutes : {this.state.instituteList.map((city)=>{
return(
<span>{city.institute_name} | </span>
)
})}</label>
</div>
</div>
<div className="" style={{marginLeft:
'
20
px
'
}}>
<div className="scroll-area">
<div className="table-dark row">
<div className="col">
<label>Class Type</label>
</div>
<div className="col">
<label>A/L Batch</label>
</div>
<div className="col">
<label>Starting Date</label>
</div>
<div className="col">
<label>Subject</label>
</div>
<div className="col">
<label>Institute</label>
</div>
<div className="col">
<label>Day and Time</label>
</div>
<div className="col">
</div>
</div>
<
div
className
=
"
col
"
>
<
span
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
10px
'
}}
>
{
this
.
state
.
ratingFour
}
rate
(
s
)
<
/span
>
<
/div
>
</div>
<
div
className
=
"
row
"
style
=
{{
padding
:
'
5px
'
}}
>
<
div
className
=
"
col-
"
>
{[...
Array
(
5
)].
map
((
star
,
i
)
=>
{
const
ratingValue
=
i
+
1
;
return
<
label
style
=
{{
marginLeft
:
'
15px
'
,
float
:
'
left
'
}}
>
<
input
type
=
"
radio
"
name
=
"
rating
"
style
=
{{
display
:
"
none
"
,
cursor
:
"
pointer
"
}}
value
=
{
ratingValue
}
/
>
<
FaStar
size
=
{
20
}
color
=
{
ratingValue
<=
3
?
"
#ffc107
"
:
"
#e4e5e9
"
}
style
=
{{
cursor
:
"
pointer
"
}}
/
>
<
/label
>
})}
</div>
{this.state.TutorClassList.map((tutorClass)=>{
if(tutorClass.class_method === "Institute"){
return(
<div className="row" style={{background:
'
#
DCDCDC
'
, paddingBottom:
'
5
px
'
, paddingTop:
'
5
px
'
,marginLeft:
'
5
px
'
, borderBottom:
'
inset
'
}}>
<div className="col">
<label>{tutorClass.class_type}</label>
</div>
<div className="col">
<label>{tutorClass.batchYear}</label>
</div>
<div className="col">
<label>{moment(tutorClass.class_startingDate).format("L") }</label>
</div>
<div className="col">
<label>{tutorClass.subject}</label>
</div>
<div className="col">
<label>{tutorClass.institute_id.institute_name}</label>
</div>
<div className="col">
<label>{tutorClass.class_conduct_day} - {tutorClass.class_conduct_time}</label>
</div>
<div className="col">
<button className="rounded" style={{background:
'
Orange
'
, padding:
'
3
px
'
, width:
'
35
px
'
}} value={""} onClick={e => this.onSelectOneClass(e)}>+</button>
</div>
</div>
)
}
})}
<
/div
>
<
div
className
=
"
col
"
>
<
span
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
10px
'
}}
>
{
this
.
state
.
ratingThree
}
rate
(
s
)
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
padding
:
'
5px
'
}}
>
<
div
className
=
"
col-
"
>
</div>
<div className="col">
<div className="row" style={{marginTop:
'
20
px
'
,marginLeft:
'
0
px
'
, paddingLeft:
'
20
px
'
,paddingTop:
'
5
px
'
,paddingBottom:
'
5
px
'
,
background:
'
#
022140
'
,color:
'
white
'
}}>
<h5>Rating and Reviews</h5>
</div>
<div className="row" style={{margin:
'
20
px
'
}}>
<div className="col">
<div className="row" style={{padding:
'
15
px
'
}}>
<h2 style={{marginLeft:
'
15
px
'
}}><span style={{color:
'
gray
'
}}><b
style={{fontSize:
'
40
px
'
, color: "black"}}>{this.state.overRollRating}</b>/5</span></h2>
</div>
<div className="row">
{[...Array(5)].map((star, i) => {
const ratingValue = i + 1;
return
<
label
style
=
{{
marginLeft
:
'
1
5
px
'
,
float
:
'
left
'
}}
>
return <label style={{marginLeft:
'
1
0
px
'
, float:
'
left
'
}}>
<input type="radio" name="rating"
style={{display: "none", cursor: "pointer"}}
value={ratingValue}
//onClick={this.onClickRatingValue}
/>
<
FaStar
size
=
{
20
}
color
=
{
ratingValue
<=
2
?
"
#ffc107
"
:
"
#e4e5e9
"
}
<FaStar size={35}
color={ratingValue <= (this.state.overRollRating) ? "#ffc107" : "#e4e5e9"}
//onMouseEnter={() => this.onMouseEnter(i + 1)}
style={{cursor: "pointer"}}/>
</label>
})}
</div>
<
div
className
=
"
col
"
>
<
span
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
10px
'
}}
>
{
this
.
state
.
ratingTwo
}
rate
(
s
)
<
/span
>
<div className="
row" style={{padding:
'
15
px
'
}}
>
<span style={{
marginLeft:
'
15
px
'
}}>{this.state.ratingCount} Ratings
</span>
</div>
</div>
<
div
className
=
"
row
"
style
=
{{
padding
:
'
5px
'
}}
>
<
div
className
=
"
col-
"
>
{[...
Array
(
5
)].
map
((
star
,
i
)
=>
{
const
ratingValue
=
i
+
1
;
<div className="col">
<div className="row" style={{padding:
'
2
px
'
}}>
<div className="col-">
{[...Array(5)].map((star, i) => {
const ratingValue = i + 1;
return <label style={{marginLeft:
'
5
px
'
, float:
'
left
'
}}>
<input type="radio" name="rating"
style={{display: "none", cursor: "pointer"}}
value={ratingValue}
/>
<FaStar size={20}
color={ratingValue <= 5 ? "#ffc107" : "#e4e5e9"}
style={{cursor: "pointer"}}/>
</label>
})}
</div>
<div className="col">
<span style={{float:
'
left
'
, marginLeft:
'
10
px
'
}}>{this.state.ratingFive} rate(s)</span>
</div>
return
<
label
style
=
{{
marginLeft
:
'
15px
'
,
float
:
'
left
'
}}
>
<
input
type
=
"
radio
"
name
=
"
rating
"
style
=
{{
display
:
"
none
"
,
cursor
:
"
pointer
"
}}
value
=
{
ratingValue
}
/
>
<
FaStar
size
=
{
20
}
color
=
{
ratingValue
<=
1
?
"
#ffc107
"
:
"
#e4e5e9
"
}
style
=
{{
cursor
:
"
pointer
"
}}
/
>
<
/label
>
})}
</div>
<div className="row" style={{padding:
'
2
px
'
}}>
<div className="col-">
{[...Array(5)].map((star, i) => {
const ratingValue = i + 1;
return <label style={{marginLeft:
'
5
px
'
, float:
'
left
'
}}>
<input type="radio" name="rating"
style={{display: "none", cursor: "pointer"}}
value={ratingValue}
/>
<FaStar size={20}
color={ratingValue <= 4 ? "#ffc107" : "#e4e5e9"}
style={{cursor: "pointer"}}/>
</label>
})}
</div>
<div className="col">
<span style={{float:
'
left
'
, marginLeft:
'
10
px
'
}}>{this.state.ratingFour} rate(s)</span>
</div>
</div>
<
div
className
=
"
col
"
>
<
span
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
10px
'
}}
>
{
this
.
state
.
ratingOne
}
rate
(
s
)
<
/span
>
<div className="row" style={{padding:
'
2
px
'
}}>
<div className="col-">
{[...Array(5)].map((star, i) => {
const ratingValue = i + 1;
return <label style={{marginLeft:
'
5
px
'
, float:
'
left
'
}}>
<input type="radio" name="rating"
style={{display: "none", cursor: "pointer"}}
value={ratingValue}
/>
<FaStar size={20}
color={ratingValue <= 3 ? "#ffc107" : "#e4e5e9"}
style={{cursor: "pointer"}}/>
</label>
})}
</div>
<div className="col">
<span style={{float:
'
left
'
, marginLeft:
'
10
px
'
}}>{this.state.ratingThree} rate(s)</span>
</div>
</div>
<div className="row" style={{padding:
'
2
px
'
}}>
<div className="col-">
{[...Array(5)].map((star, i) => {
const ratingValue = i + 1;
return <label style={{marginLeft:
'
5
px
'
, float:
'
left
'
}}>
<input type="radio" name="rating"
style={{display: "none", cursor: "pointer"}}
value={ratingValue}
/>
<FaStar size={20}
color={ratingValue <= 2 ? "#ffc107" : "#e4e5e9"}
style={{cursor: "pointer"}}/>
</label>
})}
</div>
<div className="col">
<span style={{float:
'
left
'
, marginLeft:
'
10
px
'
}}>{this.state.ratingTwo} rate(s)</span>
</div>
</div>
<div className="row" style={{padding:
'
2
px
'
}}>
<div className="col-">
{[...Array(5)].map((star, i) => {
const ratingValue = i + 1;
return <label style={{marginLeft:
'
5
px
'
, float:
'
left
'
}}>
<input type="radio" name="rating"
style={{display: "none", cursor: "pointer"}}
value={ratingValue}
/>
<FaStar size={20}
color={ratingValue <= 1 ? "#ffc107" : "#e4e5e9"}
style={{cursor: "pointer"}}/>
</label>
})}
</div>
<div className="col">
<span style={{float:
'
left
'
, marginLeft:
'
10
px
'
}}>{this.state.ratingOne} rate(s)</span>
</div>
</div>
</div>
<
/div
>
<
/div
>
</div>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
{[...
Array
(
5
)].
map
((
star
,
i
)
=>
{
const
ratingValue
=
i
+
1
;
return
<
label
style
=
{{
marginLeft
:
'
20px
'
}}
>
<
input
type
=
"
radio
"
name
=
"
rating
"
style
=
{{
display
:
"
none
"
,
cursor
:
"
pointer
"
}}
value
=
{
ratingValue
}
onClick
=
{
this
.
onClickRatingValue
}
/
>
<
FaStar
size
=
{
40
}
color
=
{
ratingValue
<=
(
this
.
state
.
rating
||
this
.
state
.
hover
)
?
"
#ffc107
"
:
"
#e4e5e9
"
}
onMouseEnter
=
{()
=>
this
.
onMouseEnter
(
i
+
1
)}
style
=
{{
cursor
:
"
pointer
"
}}
/
>
<
/label
>
})}
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
span
style
=
{{
marginLeft
:
'
20px
'
}}
>
You
Rate
[{
this
.
state
.
rating
}]
stars
for
the
product
.
<
/span
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
h5
style
=
{{
marginLeft
:
'
20px
'
}}
>
You
can
review
to
this
Tutor
<
/h5
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
input
type
=
"
text
"
id
=
"
tutorAddress
"
className
=
"
form-control
"
placeholder
=
"
Tutor ID
"
onChange
=
{
this
.
onTutorID
}
style
=
{{
width
:
'
50%
'
}}
required
/>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<
input
type
=
"
text
"
id
=
"
tutorAddress
"
className
=
"
form-control
"
placeholder
=
"
SID
"
onChange
=
{
this
.
onSID
}
style
=
{{
width
:
'
50%
'
}}
required
/>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
<div className="row" style={{margin:
'
20
px
'
}}>
{[...Array(5)].map((star, i) => {
const ratingValue = i + 1;
return <label style={{marginLeft:
'
20
px
'
}}>
<input type="radio" name="rating" style={{display: "none", cursor: "pointer"}}
value={ratingValue}
onClick={this.onClickRatingValue}/>
<FaStar size={40}
color={ratingValue <= (this.state.rating || this.state.hover) ? "#ffc107" : "#e4e5e9"}
onMouseEnter={() => this.onMouseEnter(i + 1)}
style={{cursor: "pointer"}}/>
</label>
})}
</div>
<div className="row" style={{margin:
'
20
px
'
}}>
<span style={{marginLeft:
'
20
px
'
}}>You Rate [{this.state.rating}] stars for the product.</span>
</div>
<div className="row" style={{margin:
'
20
px
'
}}>
<h5 style={{marginLeft:
'
20
px
'
}}>You can review to this Tutor</h5>
</div>
<div className="row" style={{margin:
'
20
px
'
}}>
<input type="text" id="tutorAddress" className="form-control"
placeholder="Tutor ID"
onChange={this.onTutorID}
style={{width:
'
50
%
'
}} required/>
</div>
<div className="row" style={{margin:
'
20
px
'
}}>
<input type="text" id="tutorAddress" className="form-control"
placeholder="SID"
onChange={this.onSID}
style={{width:
'
50
%
'
}} required/>
</div>
<div className="row" style={{margin:
'
20
px
'
}}>
<textarea style={{width:
'
50
%
'
, marginLeft:
'
20
px
'
}} value={this.state.comments}
onChange={this.onChangeComment}/>
</div>
<div className="row" style={{margin:
'
20
px
'
}}>
{this.state.alreadyRate === false ?
<a type="submit" onClick={this.submitRating}
className="profile-edit-btn nav-link btn btn-primary stop-color-final"
name="btnAddMore"
style={{
float:
'
left
'
, marginLeft:
'
20
px
'
, marginTop:
'
00
px
'
, marginBottom:
'
20
px
'
,
backgroundColor:
'
orange
'
, borderColor:
'
orange
'
, fontSize:
'
20
px
'
, width:
'
25
%
'
}}>
Add Comment
</a>
:
<a type="submit" onClick={this.updateRating}
className="profile-edit-btn nav-link btn btn-primary stop-color-final"
name="btnAddMore"
style={{
float:
'
left
'
, marginLeft:
'
20
px
'
, marginTop:
'
00
px
'
, marginBottom:
'
20
px
'
,
backgroundColor:
'
orange
'
, borderColor:
'
orange
'
, fontSize:
'
20
px
'
, width:
'
25
%
'
}}>
Update Comment
</a>
}
</div>
</div>
</div>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
20px
'
}}
>
{
this
.
state
.
alreadyRate
===
false
?
<
a
type
=
"
submit
"
onClick
=
{
this
.
submitRating
}
className
=
"
profile-edit-btn nav-link btn btn-primary stop-color-final
"
name
=
"
btnAddMore
"
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
20px
'
,
marginTop
:
'
00px
'
,
marginBottom
:
'
20px
'
,
backgroundColor
:
'
orange
'
,
borderColor
:
'
orange
'
,
fontSize
:
'
20px
'
,
width
:
'
25%
'
}}
>
Add
Comment
<
/a
>
:
<
a
type
=
"
submit
"
onClick
=
{
this
.
updateRating
}
className
=
"
profile-edit-btn nav-link btn btn-primary stop-color-final
"
name
=
"
btnAddMore
"
style
=
{{
float
:
'
left
'
,
marginLeft
:
'
20px
'
,
marginTop
:
'
00px
'
,
marginBottom
:
'
20px
'
,
backgroundColor
:
'
orange
'
,
borderColor
:
'
orange
'
,
fontSize
:
'
20px
'
,
width
:
'
25%
'
}}
>
Update
Comment
<
/a
>
}
<
/div
>
</div>
...
...
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