Commit 828e015e authored by Hasitha Samarasekara's avatar Hasitha Samarasekara

Home Page Tutor Cards created.

parent c3a7a738
......@@ -14,13 +14,12 @@ const userSchema = new Schema({
tutor_image:{type:String},
tutor_Stream:{type:String},
tutor_subjects:[{type:String}],
isOnlineClass:{type:Boolean},
isHomeVisit:{type:Boolean},
isInstitute:{type:Boolean},
tutor_class_type:[{type:String}],
tutor_main_district:{type:String},
tutor_main_city:{type:String},
tutor_main_city:[{type:String}],
tutor_medium:{type:String},
tutor_instituteIDList:[{type:String}],
tutor_qualification:{type:String},
tutor_instituteIDList:[{type:mongoose.Schema.Types.ObjectId,ref: 'Post'}],
}, {
timestamps:true,
});
......
......@@ -5,6 +5,7 @@ let userAccount = require('../models/userAccount.user.model');
const nodemailer = require('nodemailer');
const cred = require('../email-config/config');
const mongoose = require("mongoose");
////////////////////////////////////////////////////////////////////////////////////////
......@@ -33,6 +34,27 @@ router.route('/').get((req,res) =>{
.catch(err => res.status(400).json('Eroor: '+ err));
});
router.route('/getFilteredList').post((req,res) =>{
console.log(req.body);
tutor.find({
"tutor_Stream" : {'$regex': req.body.selectedStream, '$options': 'i'},
"tutor_subjects" : {'$regex': req.body.selectedSubject, '$options': 'i'},
"tutor_main_district" : {'$regex': req.body.selectedDistrict, '$options': 'i'},
"tutor_main_city" : {'$regex': req.body.selectedCity, '$options': 'i'},
"tutor_medium" : {'$regex': req.body.selectedLanguage, '$options': 'i'},
"tutor_class_type" : {'$regex': req.body.selectedClassType, '$options': 'i'},
})
.then(tutors => {
//console.log(tutors);
res.json(tutors)
})
.catch(err => res.status(400).json('Eroor: '+ err));
});
router.route('/add').post(async(req,res) =>{
console.log("Tutor Registration began")
......@@ -47,13 +69,19 @@ router.route('/add').post(async(req,res) =>{
const tutor_image = req.body.tutor_image;
const tutor_Stream = req.body.tutor_Stream;
const tutor_subjects = req.body.tutor_subjects;
const isOnlineClass = req.body.isOnlineClass;
const isHomeVisit = req.body.isHomeVisit;
const isInstitute = req.body.isInstitute;
const tutor_class_type = req.body.tutor_class_type;
const tutor_main_district = req.body.tutor_main_district;
const tutor_main_city = req.body.tutor_main_city;
const tutor_medium = req.body.tutor_medium;
const tutor_instituteIDList = req.body.tutor_instituteIDList;
const tutor_qualification = req.body.tutor_qualification;
let instituteObjectIDList = [];
req.body.tutor_instituteIDList.map(inst =>{
instituteObjectIDList.push(mongoose.Types.ObjectId(inst));
})
const tutor_instituteIDList = instituteObjectIDList;
//checking if the user is already exist in the database
const user = await tutor.findOne({
......@@ -73,13 +101,12 @@ router.route('/add').post(async(req,res) =>{
tutor_image,
tutor_Stream,
tutor_subjects,
isOnlineClass,
isHomeVisit,
isInstitute,
tutor_class_type,
tutor_main_district,
tutor_main_city,
tutor_medium,
tutor_instituteIDList
tutor_instituteIDList,
tutor_qualification
});
newTutor.save()
.then(tutor => {
......
......@@ -6856,6 +6856,12 @@
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc="
},
"fuse.js": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-3.6.1.tgz",
"integrity": "sha512-hT9yh/tiinkmirKrlv4KWOjztdoZo1mx9Qh4KvWqC7isoXwdUY3PNWUxceF4/qO9R6riA2C29jdTOeQOIROjgw==",
"optional": true
},
"gensync": {
"version": "1.0.0-beta.2",
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
......@@ -12599,6 +12605,14 @@
"workbox-webpack-plugin": "5.1.4"
}
},
"react-select-search": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/react-select-search/-/react-select-search-3.0.8.tgz",
"integrity": "sha512-9RfhAr7mv0NUGA2NDs50OHfqPplU3NAhJQlfKqB1pfSPO9uHu4J0Uc0LLRCym7zkp+7Ps+UMKyJoYBtt1fUJNg==",
"requires": {
"fuse.js": "^3.4.5"
}
},
"react-star-rating-component": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/react-star-rating-component/-/react-star-rating-component-1.4.1.tgz",
......
......@@ -12,6 +12,7 @@
"react-dropdown": "^1.9.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-select-search": "^3.0.8",
"react-star-rating-component": "^1.4.1",
"sweetalert": "^2.1.2",
"web-vitals": "^1.1.1"
......
import React, {Component} from "react";
import TestTeacher from "../../Images/teacher.jpg";
import Location from "../../Images/location.png";
import Star from "../../Images/star.png";
import ReviewImg from "../../Images/note.png";
import Calender from "../../Images/calender.png";
export default class HomeFooter extends Component{
constructor(props) {
super(props);
this.state = {
};
//this.FindTutor = this.FindTutor.bind(this);
}
render() {
return(
<div>
{/* Footer */}
<div className="app-wrapper-footer">
<div className="app-footer">
<div className="app-footer__inner">
<div className="app-footer-left">
<ul className="nav">
<li className="nav-item">
<a href="javascript:void(0);" className="nav-link">Copyright &copy; 2021</a>
</li>
<li className="nav-item">
<a href="javascript:void(0);" className="nav-link" style={{color:"red",marginLeft:"-25px"}}>SMART COACH</a>
</li>
</ul>
</div>
<div className="app-footer-right">
<ul className="nav">
<li className="nav-item">
<a href="javascript:void(0);" className="nav-link">Engineered By</a>
</li>
<li className="nav-item">
<a href="javascript:void(0);" className="nav-link" style={{color:"red",marginLeft:"-25px"}}>2021-049</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
)
}
}
\ No newline at end of file
import React, {Component} from "react";
import TestTeacher from "../../Images/teacher.jpg";
import Location from "../../Images/location.png";
import Star from "../../Images/star.png";
import ReviewImg from "../../Images/note.png";
import Calender from "../../Images/calender.png";
import RecommendIcon from "../../Images/recomended.png";
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:'#F8F8F8'}}>
<div className="col-8" style={{margin:'5px', border:'solid', padding:'10px', borderColor:'#216E9B'}}>
<div className="row">
<div className="col-4">
<img src={TestTeacher} style={{width:'90px', height:'80px'}}/>
<div className="row" style={{width:'80%',background:'#216E9B',
marginLeft:'10px',marginTop:'5px',justifyContent:'center'}}>
<h5 style={{color:'white',float:'center',marginBottom:'10px',marginTop:'5px'}}>98.5%</h5>
</div>
</div>
<div className="col-6" style={{margin:'0px'}}>
<div className="row">
<h6 style={{color:'#2D5F5D',float:'left'}}>
{this.props.data.tutor_subjects.map((subject) =>{return(<span style={{display:'inLineBlock'}}>|| {subject} </span>)})}
</h6>
</div>
<div className="row">
<h5 style={{color:'#2D5F5D'}}>{this.props.data.tutor_name}</h5>
</div>
<div className="row">
<label style={{color:'#2D5F5D', display:'inline-block',overflow:'hidden',
whiteSpace:'nowrap', textOverflow:'ellipsis'}}>{this.props.data.tutor_qualification}</label>
</div>
<div className="row">
<div className="col-1">
<img src={Location} style={{width:'20px', height:'20px', marginLeft:'-10px'}}/>
</div>
<div className="col" style={{display:'inline-block',overflow:'hidden',
whiteSpace:'nowrap', textOverflow:'ellipsis'}}>
<label style={{color:'#2D5F5D',paddingLeft:'0px', marginLeft:'-5px',float:'left',display:'inline-block',overflow:'hidden',
whiteSpace:'nowrap', textOverflow:'ellipsis'}}>
{this.props.data.tutor_main_city.map((city) =>{return(<span> {city} | </span>)})}
</label>
</div>
</div>
</div>
<div className="col-1">
</div>
</div>
</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"}}>5</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"}}>23 reviews</h5>
</div>
</div>
<div className="row">
<div className="col-1">
<img src={Calender} style={{width:'20px', height:'20px'}}/>
</div>
<div className="col">
<h5 style={{float:"left"}}>6y experience</h5>
</div>
</div>
<div className="row">
<button className="form-control" style={{background:"#216E9B", color:"white", marginLeft:'15px', marginRight:'15px'}}><b>View Profile</b></button>
</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>
{/*{console.log("In Tutor Card")}*/}
{/*{console.log(this.props)}*/}
</div>
)
}
}
\ No newline at end of file
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