Commit 30549259 authored by Hasitha Samarasekara's avatar Hasitha Samarasekara

Merge branch 'IT18063288' into 'master'

It18063288

See merge request !19
parents 98164579 5fdf3eef
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ClassStudentRequestSchema = new Schema({
class_id:{type:mongoose.Schema.Types.ObjectId,ref: 'Classes'},
student_id:{type:mongoose.Schema.Types.ObjectId,ref: 'student'},
tutor_id:{type:mongoose.Schema.Types.ObjectId,ref: 'tutor'},
},{
timestamps:true,
});
const ClassStudentRequestList = mongoose.model('ClassStudentRequestList',ClassStudentRequestSchema);
module.exports = ClassStudentRequestList;
\ No newline at end of file
......@@ -2,6 +2,7 @@ const router = require('express').Router();
let classes = require('../models/createClass.model');
let student = require('../models/student.user.model');
let studentList = require('../models/ClassStudentList.model');
let studentRequestList = require('../models/ClassStudentRquestList.model');
const mongoose = require("mongoose");
router.route('/add').post(async(req,res) =>{
......@@ -161,4 +162,64 @@ router.route('/studentList/:id').get(function (req, res) {
});
});
router.route('/studentRequestList/add').post((req, res) => {
const class_id = req.body._id;
const student_id = req.body.student_id;
const tutor_id = req.body.tutor_id;
console.log("classID: " + class_id);
console.log("student_nic: " + student_id);
classes.findById(class_id,function(err, tutorsClass){
if(!tutorsClass)
res.status(404).send("Sorry Class Could not Found.");
else {
student.find({"_id": student_id}).then(student => {
console.log(student)
console.log(student[0]._id)
if(student[0].student_nic === ""){
res.status(500).send("Sorry, This Student Not Registered");
}else{
const student_id = student[0]._id;
const newClassStudent = new studentRequestList({
class_id,
student_id,
tutor_id
});
studentRequestList.find({"student_id" : student_id, "class_id" : class_id}).then(reqClass =>{
console.log("reqClass : ")
console.log(reqClass)
if(reqClass.length > 0){
res.status(501).send("Already Request to this Class");
}
else{
newClassStudent.save().then(result =>{
res.json('Student Requested is complete!');
})
.catch(err =>{
res.status(500).send("Update not possible");
});
}
})
}
}).catch(err => res.status(500).json('Eroor: '+ err));
}
});
});
module.exports = router;
\ No newline at end of file
......@@ -14,11 +14,9 @@ import Dashboard from "./Components/Admin/Dashboard";
import StudentDashboard from "./Components/Student/StudentDashboard";
import QuestionDetails from "./Components/IT18050240/question_details"
import QuestionLayout from "./Components/IT18050240/question_layout"
import AdminQuestionManagement from "./Components/IT18050240/admin_question_management.js"
//import AdminQuestionManagement from "./Components/IT18050240/admin_question_management.js"
import QuestionBank from "./Components/IT18050240/question_bank"
import LessonAndExam from "./Components/IT18050240/lessonandexampage";
import AutomaticQuestion from "./Components/IT18050240/automatic_question"
import Upload from "./Components/IT18050240/UploadPage";
import TutorProfileView from "./Components/HomePage/TutorProfileView";
function App() {
return (
......@@ -30,7 +28,8 @@ function App() {
<Route path="/SignUp" exact component={SignUp}/>
<Route path="/beforeConfirm" exact component={beforeConfirmation}/>
<Route path="/AccountVerified/:id" exact component={VerifiedAccount}/>
{/*<Route path="/studentDashboard" exact component={StudentDashboard}/>*/}
<Route path="/Home/ViewProfile/:id" exact component={TutorProfileView}/>
<Route path="/studentDashboard" exact component={StudentDashboard}/>
{/*<Route path="/" exact component={Dashboard}/>*/}
......@@ -38,13 +37,10 @@ function App() {
<Route path="/admin"><Dashboard/></Route>
<Route path="/studentDashboard"><StudentDashboard/></Route>
<Route path="/questiondetails" exact component={QuestionDetails}/>
<Route path="/question/:id" exact component={QuestionLayout}/>
<Route path="/questionmanagement/:id" exact component={AdminQuestionManagement}/>
<Route path="/question" exact component={QuestionLayout}/>
{/*<Route path="/questionmanagement" exact component={AdminQuestionManagement}/>*/}
<Route path="/questionbank" exact component={QuestionBank}/>
<Route path="/questionmanagement" exact component={AdminQuestionManagement}/>
<Route path="/lesson" exact component={LessonAndExam}/>
<Route path="/automaticquestion" exact component={AutomaticQuestion}/>
<Route path="/upload" exact component={Upload}/>
{/*<Route path="/edititem/:id" exact component={AdminQuestionManagement}/>*/}
</Switch>
......
......@@ -15,6 +15,7 @@ import * as Icon from 'react-bootstrap-icons';
import axios from "axios";
import * as configs from "../Config/config";
import TutorCard from "./HomePage/TutorCard";
import RightSideAdd from "./HomePage/AdvertisementRightSide";
import swal from "sweetalert";
import Carousel from "react-bootstrap/Carousel";
......@@ -414,20 +415,7 @@ export default class Home extends Component {
let FinalStudentCountScore = (valueForStudentCount * Number(this.state.RVStudentCount)) / 100;
let FinalScore = finalReviewScore + FinalRatingScore + FinalStudentCountScore;
const temp = {
tutor_id: tutor.teacher,
tutor_name: tutor.tutor_name,
tutor_subjects: tutor.tutor_subjects,
tutor_class_type: tutor.tutor_class_type,
tutor_main_district: tutor.tutor_main_district,
tutor_main_city: tutor.tutor_main_city,
tutor_medium: tutor.tutor_medium,
tutor_qualification: tutor.tutor_qualification,
tutor_reviewValue: tutor.tutor_reviewValue,
tutor_avg_rating: tutor.tutor_avg_rating,
tutor_finalScore: FinalScore,
tutor_review_count: tutor.tutor_review_count
}
let oneday = 24 * 60 * 60 * 1000;
let NoOFDays = (todayDate - new Date(tutor.tutor_registered_date));
let NoOFDaysRegistered = Math.ceil(NoOFDays / oneday);
......@@ -437,8 +425,39 @@ export default class Home extends Component {
//
// }
if (NoOFDaysRegistered >= 365 && Number(tutor.tutor_review_count) > 10) {
const temp = {
tutor_id: tutor.teacher,
tutor_name: tutor.tutor_name,
tutor_subjects: tutor.tutor_subjects,
tutor_class_type: tutor.tutor_class_type,
tutor_main_district: tutor.tutor_main_district,
tutor_main_city: tutor.tutor_main_city,
tutor_medium: tutor.tutor_medium,
tutor_qualification: tutor.tutor_qualification,
tutor_reviewValue: tutor.tutor_reviewValue,
tutor_avg_rating: tutor.tutor_avg_rating,
tutor_finalScore: FinalScore,
tutor_review_count: tutor.tutor_review_count,
recommended_ : true
}
TutorRecommendedFinalList.push(temp);
} else {
const temp = {
tutor_id: tutor.teacher,
tutor_name: tutor.tutor_name,
tutor_subjects: tutor.tutor_subjects,
tutor_class_type: tutor.tutor_class_type,
tutor_main_district: tutor.tutor_main_district,
tutor_main_city: tutor.tutor_main_city,
tutor_medium: tutor.tutor_medium,
tutor_qualification: tutor.tutor_qualification,
tutor_reviewValue: tutor.tutor_reviewValue,
tutor_avg_rating: tutor.tutor_avg_rating,
tutor_finalScore: FinalScore,
tutor_review_count: tutor.tutor_review_count,
recommended_ : false
}
TutorOnlyFilterFinalList.push(temp);
}
......@@ -880,50 +899,63 @@ export default class Home extends Component {
}
</div>
<div className="row"
style={{background: '#F5F4ED', marginLeft: '50px', marginRight: '50px', marginTop: '10px'}}>
<h5 style={{margin: '10px'}}>{this.state.TutorFilteredList.length} Results</h5>
style={{background: '#1E4258', marginLeft: '50px', marginRight: '50px', marginTop: '10px'}}>
<h5 style={{color: "white", float: 'left',margin: '15px'}}>{this.state.TutorFilteredList.length} Results</h5>
</div>
{this.state.TutorFilteredRecommendedListFinal.length > 0 ?
<div className="row"
style={{
background: '#F5F4ED',
marginLeft: '50px',
marginRight: '50px',
marginTop: '10px'
}}>
<h4>Recommended List</h4>
</div>
:
<div>
</div>
}
<div className="">
{this.state.TutorFilteredRecommendedListFinal.length > 0 ? this.state.TutorFilteredRecommendedListFinal.map((card) => {
return (<TutorCard data={card}/>)
}) : <div></div>}
<div className="row">
<div className="col-8">
{this.state.TutorFilteredRecommendedListFinal.length > 0 ?
<div className="row"
style={{
background: '#1E4258',
marginLeft: '50px',
marginRight: '0px',
marginTop: '10px'
}}>
<h4 style={{color: "white", float: 'left',margin: '15px'}}>Recommended List</h4>
</div>
:
<div>
</div>
}
<div className="" style={{marginLeft:'50px',marginRight:'0px'}}>
{this.state.TutorFilteredRecommendedListFinal.length > 0 ? this.state.TutorFilteredRecommendedListFinal.map((card) => {
return (<TutorCard data={card}/>)
}) : <div></div>}
</div>
</div>
{this.state.TutorOnlyFilteredListFinal.length > 0 ?
<div className="row" style={{
background: '#F5F4ED',
marginLeft: '50px',
marginRight: '50px',
marginTop: '10px'
}}>
<h4>Filtered List</h4>
</div>
:
<div>
</div>
}
{this.state.TutorOnlyFilteredListFinal.length > 0 ?
<div className="row" style={{
background: '#1E4258',
marginLeft: '50px',
marginRight: '0px',
marginTop: '10px'
}}>
<h4 style={{color: "white", float: 'left',margin: '15px'}}>Filtered List</h4>
</div>
:
<div>
</div>
}
<div className="">
{this.state.TutorOnlyFilteredListFinal.length > 0 ? this.state.TutorOnlyFilteredListFinal.map((card) => {
return (<TutorCard data={card}/>)
}) : <div></div>}
<div className="" style={{marginLeft:'50px',marginRight:'0px'}}>
{this.state.TutorOnlyFilteredListFinal.length > 0 ? this.state.TutorOnlyFilteredListFinal.map((card) => {
return (<TutorCard data={card}/>)
}) : <div></div>}
</div>
</div>
<div className="col-3">
{this.state.TutorOnlyFilteredListFinal.length > 0 ?
<RightSideAdd></RightSideAdd>
:
<div>
</div>
}
</div>
</div>
<div className="app-main__outer">
<HomeFooter/>
......
import React, {Component} from "react";
import Carousel from "react-bootstrap/Carousel";
import AddR1 from "../../Images/ad_r1.jpg";
import AddR2 from "../../Images/ad_r2.jpg";
export default class AdvertisementRightSide extends Component{
constructor(props) {
super(props);
this.state = {
};
//this.FindTutor = this.FindTutor.bind(this);
}
render() {
return(
<div>
<Carousel style={{width:'100%'}} nextLabel={false} prevLabel={false} indicators={false} >
<Carousel.Item>
<img
className="toast-bottom-full-width"
src={AddR1}
alt="First slide"
/>
<Carousel.Caption>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img
className="d-block w-100"
src={AddR2}
alt="Second slide"
/>
<Carousel.Caption>
</Carousel.Caption>
</Carousel.Item>
{/*<Carousel.Item>*/}
{/* <img*/}
{/* className="d-block w-100"*/}
{/* src={AddR1}*/}
{/* alt="Third slide"*/}
{/* />*/}
{/* <Carousel.Caption>*/}
{/* </Carousel.Caption>*/}
{/*</Carousel.Item>*/}
</Carousel>
</div>
)
}
}
\ No newline at end of file
import React, {Component} from "react";
import Carousel from "react-bootstrap/Carousel";
import AddR1 from "../../Images/ad_top_s_01.jpg";
import AddR2 from "../../Images/ad_r2.jpg";
export default class AdvertisementTopSmall extends Component{
constructor(props) {
super(props);
this.state = {
};
//this.FindTutor = this.FindTutor.bind(this);
}
render() {
return(
<div className="row">
<div className="col">
<Carousel style={{width:'100%',height:'100px', margin:'10px'}} nextLabel={false} prevLabel={false} indicators={false} >
<Carousel.Item>
<img style={{width:'90%'}}
className="toast-bottom-full-width"
src={AddR1}
alt="First slide"
/>
<Carousel.Caption>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img style={{width:'90%'}}
className="d-block w-100"
src={AddR1}
alt="Second slide"
/>
<Carousel.Caption>
</Carousel.Caption>
</Carousel.Item>
{/*<Carousel.Item>*/}
{/* <img*/}
{/* className="d-block w-100"*/}
{/* src={AddR1}*/}
{/* alt="Third slide"*/}
{/* />*/}
{/* <Carousel.Caption>*/}
{/* </Carousel.Caption>*/}
{/*</Carousel.Item>*/}
</Carousel>
</div>
<div className="col">
<Carousel style={{width:'100%',height:'100px', margin:'10px'}} nextLabel={false} prevLabel={false} indicators={false} >
<Carousel.Item>
<img style={{width:'90%'}}
className="toast-bottom-full-width"
src={AddR1}
alt="First slide"
/>
<Carousel.Caption>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img style={{width:'90%'}}
className="d-block w-100"
src={AddR1}
alt="Second slide"
/>
<Carousel.Caption>
</Carousel.Caption>
</Carousel.Item>
{/*<Carousel.Item>*/}
{/* <img*/}
{/* className="d-block w-100"*/}
{/* src={AddR1}*/}
{/* alt="Third slide"*/}
{/* />*/}
{/* <Carousel.Caption>*/}
{/* </Carousel.Caption>*/}
{/*</Carousel.Item>*/}
</Carousel>
</div>
</div>
)
}
}
\ No newline at end of file
......@@ -15,8 +15,8 @@ export default class TutorCard extends Component{
render() {
return(
<div className="main-card mb-3 card">
<div className="row" style={{background:'#F5F4ED', marginLeft:'50px', marginRight:'50px', marginTop:'10px', marginBottom:'10px'}}>
<div className="col-9">
<div className="row" style={{background:'#F5F4ED', marginLeft:'10px', marginRight:'10px', marginTop:'10px', marginBottom:'10px'}}>
<div className="col">
<div className="row" style={{background:'#F8F8F8'}}>
<div className="col-8" style={{margin:'5px', border:'solid', padding:'10px', borderColor:'#216E9B'}}>
<div className="row">
......@@ -61,44 +61,53 @@ export default class TutorCard extends Component{
</div>
<div className="col" style={{margin:'5px', border:'solid', padding:'10px', borderColor:'#216E9B'}}>
<div className="row">
<div className="col-1">
<img src={Star} style={{width:'20px', height:'20px'}}/>
</div>
<div className="col" >
<h5 style={{float:"left"}}>{this.props.data.tutor_avg_rating.toFixed(1)}</h5>
</div>
</div>
<div className="row">
<div className="col-1">
<img src={ReviewImg} style={{width:'20px', height:'20px'}}/>
</div>
<div className="col">
<h5 style={{float:"left"}}>{this.props.data.tutor_review_count} reviews</h5>
</div>
</div>
<div className="row">
<div className="col-1">
<br/>
{/*<img src={Calender} style={{width:'20px', height:'20px'}}/>*/}
<div className="row">
<div className="col-1">
<img src={Star} style={{width:'20px', height:'20px'}}/>
</div>
<div className="col" >
<h5 style={{float:"left"}}>{this.props.data.tutor_avg_rating.toFixed(1)}</h5>
</div>
</div>
<div className="row">
<div className="col-1">
<img src={ReviewImg} style={{width:'20px', height:'20px'}}/>
</div>
<div className="col">
<h5 style={{float:"left"}}>{this.props.data.tutor_review_count} reviews</h5>
</div>
</div>
<div className="row">
<div className="col-1">
<br/>
{/*<img src={Calender} style={{width:'20px', height:'20px'}}/>*/}
</div>
<div className="col">
{/*<h5 style={{float:"left"}}>6y experience</h5>*/}
</div>
</div>
<div className="row">
<Link to={`/Home/ViewProfile/${this.props.data.tutor_id}`}> <button className="form-control"
style={{background:"#216E9B", color:"white", marginLeft:'15px', marginRight:'15px'}}><b>View Profile</b></button></Link>
</div>
</div>
<div className="col">
{/*<h5 style={{float:"left"}}>6y experience</h5>*/}
<div className="col-">
{this.props.data.recommended_ ?
<img src={RecommendIcon} style={{width:'80px', height:'70px', float:'left', margin:'10px'}}/>
:
<div>
</div>
}
</div>
</div>
<div className="row">
<Link to={`/Home/ViewProfile/${this.props.data.tutor_id}`}> <button className="form-control"
style={{background:"#216E9B", color:"white", marginLeft:'15px', marginRight:'15px'}}><b>View Profile</b></button></Link>
</div>
</div>
</div>
</div>
<div className="col" style={{background:'#F8F8F8'}}>
<div>
<br/>
</div>
<img src={RecommendIcon} style={{width:'100px', height:'90px', float:'left', margin:'10px'}}/>
</div>
</div>
</div>
......
......@@ -65,8 +65,9 @@ export default class NavBar extends Component {
top: '15px',
right: '120px',
color: '#EAE4E4',
marginRight: '50px'
}}><h5>{this.state.user_name !== null ? <span style={{cursor:'pointer'}} onClick={()=>{ window.location.replace("/studentDashboard");}}> {this.state.user_name}</span> : <label onClick={() => {
marginRight: '50px',
cursor:'pointer'
}}><h5>{this.state.user_name !== null ? <span style={{cursor:'pointer'}} onClick={()=>{ window.location.replace("/studentDashboard");}}> {this.state.user_name}</span> : <label style={{cursor:'pointer'}} onClick={() => {
// window.location.replace("UserLogin");
window.location = '/UserLogin';
}}>Login</label>} </h5></label>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment