import React, {Component} from "react";
import ItemNav from "./Navbar";
import ConfirmEmail from "../Images/confirmemail.png";
import axios from "axios";
import * as configs from "../Config/config";


export default class beforeConfirmation extends Component{
    constructor(props) {
        super(props);

        this.state = {
            sNameList : ['Saman Deshapriya', 'Kamal Perera', 'asiri Deshapriya', 'Kelumsiri Perera','sahan Perera', 'Shaminda Perera','Kelum Perera',
                'Kamal Surawera', 'damith madushan', 'kithmal Perera', 'banuka Perera', 'Kelumsiri Deshapriya','sahan Deshapriya', 'Shaminda Rajapaksha',
                'Kelum Rajapaksha', 'Sunil madushan', 'kithmal Perera', 'Sumin Perera', 'asiri Rajapaksha','banuka Rajapaksha', 'Shamin Rajapaksha',
                'Kelum Deshapriya', 'Sunil Akalanka', 'kithmal Akalanka', 'Sumin Akalanka', 'asiri Akalanka','banuka Akalanka', 'Shamin Akalanka',
                'Kelum Athukorala', 'Sunil Athukorala', 'kithmal Athukorala', 'Sumin Athukorala', 'asiri Athukorala','banuka Athukorala', 'Shamin Athukorala',
                'Kelum Pandula', 'Sunil Pandula', 'kithmal Pandula', 'Sumin Pandula', 'asiri Pandula','banuka Pandula', 'Shamin Pandula',
                'Nuwan Pandula', 'Deemantha Pandula', 'Eashan Yoshitha', 'Madura Fernando', 'asiri Fernando','banuka Fernando', 'Shamin Fernando',
                'Nuwan Fernando', 'Deemantha Fernando', 'Eashan Fernando', 'Madura Perera', 'Dasun Shanaka','Dinuka Fernando', 'Amal Fernando'],
            sNameList2 : ['Hemal Perera', 'Kithmal weeraraththne', 'Chaitha Dias'],

        };

        this.onSubmitStudent = this.onSubmitStudent.bind(this);

    }

    onSubmitStudent(){

        let NIC = 981617300;
        const fnameList = ['Lasitha', 'Thusitha', 'Bathika', 'Sameera', 'Kalana','Hirusha', 'Nipuna', 'Umesh', 'Rahal', 'Sachintha',
            'Lasan', 'Kishara', 'Rasitha', 'Yehan', 'Yenuka','Thisara', 'Malindu', 'Milinda', 'Tharaka', 'Hansaka',]
        const girlsList = ['Sammani','Tharaki', 'Tinali', 'Shanu', 'Divyani', 'Thakshila', 'Surangi', 'Sandani', 'Samadhi',
            'Kavisha','Dilhani', 'Anusari', 'Kethaki', 'Gayathra', 'Ishanka', 'Samudhi', 'Shehani', 'Tharumini', 'Kasuni', 'Kalani']
        const lName = 'Kempitiya'
        girlsList.map(name=>{

            let studentNIC = NIC + 'V';
            let studentName = name + ' ' + lName;
            const res = studentName.replace(/ /g, '')
            let studentEmail = res.toLowerCase() + '@gmail.com';
            let studentPsw = 'Abc@123';

            const student = {
                student_name : studentName,
                student_nic : studentNIC,
                student_email : studentEmail,
                student_phone : '0719855824',
                student_address : 'Colombo',
                student_password : studentPsw,
                student_gender : 'Female',
                student_image : '',
                guardian_name : 'ABC',
                guardian_email : 'abc@gmail.com',
                guardian_relationship : 'Mother',

            }

            axios.post(configs.BASE_URL + '/studentSingUp/add', student)
                .then(res =>{
                    //console.log("Inside Then")
                    setTimeout(() => {  console.log("World!"); }, 2000);
                })
            setTimeout(() => {  console.log("World!"); }, 2000);

            NIC = NIC + 1;
        })


    }

    render() {
        return (

            <div>
                <div className="row" style={{width:'100%'}}>
                    <ItemNav/>
                </div>
                <div  style={{width:'50%', margin:'auto', marginTop:'7%', padding:'10px', paddingBottom: '30px', border:'solid', borderColor:'#216E9B'}}>
                    <div className="row" style={{display:'contents'}}>
                        <img src={ConfirmEmail} style={{width:'300', height:'300px'}}/>
                    </div>
                    <div className="row" style={{padding: '40px'}}>
                        <span>Your Account has been successfully registered. To complete the process please check your email for a validation request</span>
                    </div>
                    {/*<form onSubmit={this.onSubmitStudent}>*/}
                    {/*    <div className="row" style={{padding: '40px'}}>*/}
                    {/*        <button type="submit" className="btn btn-primary">Register</button>*/}
                    {/*    </div>*/}
                    {/*</form>*/}

                </div>
            </div>
        )
    }
}