Commit b9e812c7 authored by Gihan76's avatar Gihan76

Class Institute List

parent efb09f29
import React, {Component} from "react";
import axios from "axios";
import SelectSearch, {fuzzySearch} from 'react-select-search';
import * as configs from "../../Config/config";
const options = [
{name: 'Hasitha', value: '1'},
......@@ -13,6 +14,29 @@ export default class AddClassDetails extends Component{
constructor(props) {
super(props);
this.state = {
instituteList: ['Sakya Nugegoda', 'Montana Kiribathgoda', 'Wasiti Kiribathgoda']
}
}
// this.onChangeInstituteDropDown = this.onChangeInstituteDropDown.bind(this);
componentDidMount() {
axios.get(configs.BASE_URL + '/instituteSingUp/' )
.then(response =>{
if(response.data.length > 0){
console.log(response.data);
this.setState({
instituteList : response.data
})
}
})
}
onChangeInstituteDropDown(value) {
this.setState({
newInstitute: value.target.value
})
}
render() {
......@@ -52,11 +76,17 @@ export default class AddClassDetails extends Component{
<div className="position-relative form-group">
<label>Institute</label>
<select name="select" className="form-control">
<option>Select Institute</option>
<option>Sakya Nugegoda</option>
<option>Minasko Malabe</option>
<option>Rotary Nugegoda</option>
<option>Sasip Nugegoda</option>
onChange={e => this.onChangeInstituteDropDown(e)}
<option value="" disabled selected>Select Institute</option>
{this.state.instituteList.map((dis) =>
<option key={dis._id} id={dis._id} value={dis.institute_name}>
{dis.institute_name}
</option>)}
{/*<option>Select Institute</option>*/}
{/*<option>Sakya Nugegoda</option>*/}
{/*<option>Minasko Malabe</option>*/}
{/*<option>Rotary Nugegoda</option>*/}
{/*<option>Sasip Nugegoda</option>*/}
</select>
</div>
<div className="position-relative form-group">
......
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