<input type="hidden" id="baseUrl" value="<?php echo base_url(); ?>">
<div class="col-sm-10">    
<!--    Search Section Starts Here -->
    <div class="row">    
        <div class="col-sm-12">
            <div class="col-sm-4 form-group padding-zero">                
                    <div class="col-sm-6 form-group ">
                        <select class="form-control"
                                id="SearchEduInsPubStatus">
                            <option value="">Publication Status</option>
                            <option value="0">Unpublished</option>
                            <option value="1">Published</option>
                            <option value="2">Pending</option>
                            <option value="3">Approved</option>                            
                        </select>
                    </div>

                    <div class="col-sm-6 form-group ">
                        <select class="form-control"
                                id="SearchEduInstype">
                            <option value="">Institute Type</option>
                            <option value="1">School</option>
                            <option value="2">College</option>
                            <option value="3">Graduate</option>
                            <option value="4">Post-Graduation</option>
                            <option value="5">PHD</option>
                            <option value="6">Post-PHD</option>
                        </select>
                    </div>                
            </div>

            <div class="col-sm-4 form-group">                
                    <div class="input-group">
                        <input class="form-control" id="SearchEduInsName" placeholder="Search here..." aria-describedby="basic-addon1" type="text">
                        <span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
                    </div>                
            </div>

            <div class="col-sm-4 form-group padding-zero">                
                    <div class="col-sm-6 form-group ">
                        <select class="form-control"
                                id="searchEduInsCountry">                                                       
                        </select>
                    </div>

                    <div class="col-sm-6 form-group ">
                        <select class="form-control"
                                id="searchEduInsCity">                            
                            <option value="">Select State</option>
                        </select>
                    </div>                
            </div>
        </div>
    </div>
<!--    Search Section Ends Here -->

<!-- Displaying Error Message Start Here -->
<div class="col-sm-12 text-center">
    <?php 
        if(isset($this->session->eduIns_error)){
            echo '<span class="text-danger">'.$this->session->eduIns_error.'</span>';
            $this->session->unset_userdata('eduIns_error');
        }elseif(isset($this->session->eduIns_success)){
            echo '<span class="text-success">'.$this->session->eduIns_success.'</span>';
            $this->session->unset_userdata('eduIns_success');
        }
    ?>
</div>
<!-- Displaying Error Message Ends Here -->

    <div class="row gray_ttc">
        <div class="col-sm-12 form-group" style="padding: 0">
            <div class="col-sm-12 white form-group" >
                <div class="col-sm-12 gray_ttc" style="margin-left: 5px">
                    <div class="col-sm-12 form-group" style="border-bottom: 1px solid #80c12c; display: block; padding-bottom: 10px;">
                        <span class=" col-sm-6  form-group">
                            <h3 id="header_name" style="margin: 0">Add Education Institute Name</h3>
                        </span> 
                        <span class=" col-sm-6 form-group text-right" style="padding-top: 8px;">
                            <a href="javascript:void(0)" id="add_edu_ins_btn" class="btn btn-success text-right"><i class="fa fa-plus-circle" title="Add Education Institute"></i></a>
                        </span>
                    </div>

                    <!--    Add Educational Institute Form Start    -->
                    <div class="row gray_ttc" style="display: none;" id="add_edu_form">

                        <div class="col-sm-12 ">
                            <div class="col-sm-12 row"><br></div>
                            <?php
                            $url = 'admin/save-education-institute';
                            echo form_open($url, 'name="add_new_edu_ins_form" id="add_new_education_form"');
                            ?>
                            <div class="col-sm-12">
                                <div class="form-group col-sm-12 ">
                                    <label for="education_institute_type" class="col-sm-2 padding-zero text-left">Institute Type :  &nbsp;&nbsp;</label>
                                    <div class="radio radio-success col-sm-10 padding-zero margin-zero">
                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="school"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="1">
                                        <label for="school">School</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="Collage"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="2"
                                               onchange=""  >
                                        <label for="Collage">Collage</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="Graduation"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="3"
                                               onchange=""  >
                                        <label for="Graduation">Graduation</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="Post_Graduation"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="4"
                                               onchange=""  >
                                        <label for="Post_Graduation">Post-Graduation</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="phd"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="5"
                                               onchange=""  >
                                        <label for="phd">PHD</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="Post_phd"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="6"
                                               onchange=""  >
                                        <label for="Post_phd">Post-PHD</label>
                                    </div>
                                    <span id="attended" style="color: red"></span>
                                </div>

                                <div class="col-sm-12 row">
                                    <div class="form-group col-sm-6">
                                        <div class="input-group">
                                            <select autofocus selected
                                                    class="form-control validate[required] text-input" 
                                                    id="eduInsCountry" 
                                                    name ="education_institute_country"
                                                    onchange=""
                                                    autofocus>
                                            </select>
                                            <span class="input-group-addon" id="basic-addon1" title="Please select country name"><i class="fa fa-flag-checkered"></i></span>
                                        </div>
                                        <span id="country" style="color: red"></span>
                                    </div>
                                    <div class="form-group col-sm-6">
                                        <div class="input-group">
                                            <select  
                                                class="form-control validate[required] text-input" 
                                                name ="education_institute_city" 
                                                onchange="selectInstitute();"
                                                id ="eduInsCity" autofocus>
                                                <option value=" ">Select State</option>
                                            </select>
                                            <span class="input-group-addon" id="basic-addon1" title="please city"><i class="fa fa-flag"></i></span>
                                        </div>
                                        <span id="city_id" style="color: red"></span>                       
                                    </div>
                                </div>

                                <input type="hidden" name="country_code" id ="country_code" >

                                <div class="col-sm-12 row ">
                                    <div class="form-group col-sm-6 ">
                                        <div id="O_Institution">
                                            <div class="input-group">
                                                <input autofocus type="text" 
                                                       name="education_institute_name"
                                                       id="other_education_institute_name"
                                                       class="form-control validate[required]"
                                                       class="form-control" 
                                                       placeholder="Please Type New Education Institute" 
                                                       aria-describedby="basic-addon1" >
                                                <span class="input-group-addon" id="basic-addon1"  title="Please Type New Education Institute"> <i class="fa fa-retweet"></i></span>
                                            </div>
                                            <span id="other_institute_id" style="color: red"></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group col-sm-12">
                                    <label for="education_institute_status" class="col-sm-2 padding-zero">Publication Status  : </label>
                                    <div class="radio radio-success col-sm-8 padding-zero margin-zero">
                                        <input type="radio" 
                                               name="education_institute_status"
                                               id="publish"
                                               data-errormessage-value-missing="Please Select Publication Status"
                                               class="validate[required]"
                                               value="1" >
                                        <label for="publish">Publish</label>
                                        <span style="margin-right: 30px"></span>
                                        <input type="radio" 
                                               name="education_institute_status"                                                  
                                               id="unpublish"
                                               data-errormessage-value-missing="Please Select Publication Status"
                                               class="validate[required]"
                                               value="0">
                                        <label for="unpublish">Unpublish</label>
                                        <span style="margin-right: 30px"></span>
                                        <input type="radio" 
                                               name="education_institute_status"                                                   
                                               id="pending"
                                               data-errormessage-value-missing="Please Select Publication Status"
                                               class="validate[required]"                                                   
                                               value="2">
                                        <label for="pending">Pending</label>
                                        <span style="margin-right: 30px"></span>
                                        <input type="radio" 
                                               name="education_institute_status"                                                  
                                               id="approved"
                                               data-errormessage-value-missing="Please Select Publication Status"
                                               class="validate[required]"                                                   
                                               value="3">
                                        <label for="approved">Approved</label>
                                    </div>
                                </div>
                                <span id="current_status" style="color: red"></span>
                            </div>

                            <div class="col-sm-12 "><br></div>
                            <div class="col-sm-12 ">

                                <div class="form-group col-sm-1 col-sm-offset-5">
                                    <button type="submit" id="add_education_button" class=" btn btn-default">
                                        <i class="fa fa-save" title="Add Education"></i></button>
                                </div>

                                <div class="form-group col-sm-1">
                                    <span id="edu_ins_cancel">
                                        <a class=" btn btn-default" href="javascript:void(0)">
                                            <i class="fa fa-times" title="Cancel"></i>
                                        </a>
                                    </span>
                                </div>


                            </div>
                            </form>
                        </div>
                    </div>
                    <!--    Add Educational Institute Form End    -->                  

                </div>

                <div class="col-sm-12 gray_ttc" style="margin-left: 5px; display: none;" id="edit_edu_form">
                    <div class="col-sm-12 form-group" style="border-bottom: 1px solid #80c12c; display: block">
                        <span class=" col-sm-6  form-group">
                            <h3 id="header_name" style="margin: 0">Edit Education Institute</h3>
                        </span>                         
                    </div> 
                    <!--    Edit Educational Institute Form Start    -->
                    <div class="row gray_ttc">

                        <div class="col-sm-12 ">
                            <div class="col-sm-12 row"><br></div>
                            <?php
                            $url = 'admin/update-education-institute';
                            echo form_open($url, 'name="edit_edu_ins_form" id="editEduIns"');
                            ?>
                            <input type="hidden" name="education_institute_id" id="eduInsId">
                            <div class="col-sm-12">
                                <div class="form-group col-sm-12 ">
                                    <label for="education_institute_type" class="col-sm-2 padding-zero text-left">Institute Type :  &nbsp;&nbsp;</label>
                                    <div class="radio radio-success col-sm-10 padding-zero margin-zero">
                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="school"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="1"
                                               onchange="" >
                                        <label for="school">School</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="Collage"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="2"
                                               onchange=""  >
                                        <label for="Collage">Collage</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="Graduation"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="3"
                                               onchange=""  >
                                        <label for="Graduation">Graduation</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="Post_Graduation"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="4"
                                               onchange=""  >
                                        <label for="Post_Graduation">Post-Graduation</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="phd"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="5"
                                               onchange=""  >
                                        <label for="phd">PHD</label>
                                        <span style="margin-right: 25px"></span>

                                        <input type="radio" 
                                               name="education_institute_type" 
                                               id="Post_phd"
                                               data-errormessage-value-missing="Please Select Institute Type"
                                               class="validate[required]"
                                               value="6"
                                               onchange=""  >
                                        <label for="Post_phd">Post-PHD</label>
                                    </div>
                                    <span id="attended" style="color: red"></span>
                                </div>

                                <div class="col-sm-12 row">
                                    <div class="form-group col-sm-6">
                                        <div class="input-group">
                                            <select autofocus selected
                                                    class="form-control validate[required] text-input" 
                                                    id="editEduInsCountry" 
                                                    name ="education_institute_country"
                                                    onchange=""
                                                    autofocus>
                                            </select>
                                            <span class="input-group-addon" id="basic-addon1" title="Please select country name"><i class="fa fa-flag-checkered"></i></span>
                                        </div>
                                        <span id="country" style="color: red"></span>
                                    </div>
                                    <div class="form-group col-sm-6">
                                        <div class="input-group">
                                            <select  
                                                class="form-control validate[required] text-input" 
                                                name ="education_institute_city" 
                                                id ="editEduInsCity" autofocus>
                                                <option value=" ">Select State</option>
                                            </select>
                                            <span class="input-group-addon" id="basic-addon1" title="Please Select city Name"><i class="fa fa-flag"></i></span>
                                        </div>
                                        <span id="city_id" style="color: red"></span>                       
                                    </div>
                                </div>

                                <input type="hidden" name="country_code" id ="country_code" >

                                <div class="col-sm-12 row ">
                                    <div class="form-group col-sm-6 ">
                                        <div id="O_Institution">
                                            <div class="input-group">
                                                <input autofocus type="text" 
                                                       name="education_institute_name"
                                                       id="editEduInsName"
                                                       class="form-control validate[required]"
                                                       class="form-control" 
                                                       placeholder="Please Type New Education Institute" 
                                                       aria-describedby="basic-addon1" >
                                                <span class="input-group-addon" id="basic-addon1"  title="Please Type New Education Institute"> <i class="fa fa-retweet"></i></span>
                                            </div>
                                            <span id="other_institute_id" style="color: red"></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group col-sm-12">
                                    <label for="education_institute_status" class="col-sm-2 padding-zero">Publication Status  : </label>
                                    <div class="radio radio-success col-sm-8 padding-zero margin-zero">
                                        <input type="radio" 
                                               name="education_institute_status"
                                               id="publish"
                                               data-errormessage-value-missing="Please Select Publication Status"
                                               class="validate[required]"
                                               value="1" >
                                        <label for="publish">Publish</label>
                                        <span style="margin-right: 30px"></span>
                                        <input type="radio" 
                                               name="education_institute_status"                                                  
                                               id="unpublish"
                                               data-errormessage-value-missing="Please Select Publication Status"
                                               class="validate[required]"
                                               value="0">
                                        <label for="unpublish">Unpublish</label>
                                        <span style="margin-right: 30px"></span>
                                        <input type="radio" 
                                               name="education_institute_status"                                                   
                                               id="pending"
                                               data-errormessage-value-missing="Please Select Publication Status"
                                               class="validate[required]"                                                   
                                               value="2">
                                        <label for="pending">Pending</label>
                                        <span style="margin-right: 30px"></span>
                                        <input type="radio" 
                                               name="education_institute_status"                                                  
                                               id="approved"
                                               data-errormessage-value-missing="Please Select Publication Status"
                                               class="validate[required]"                                                   
                                               value="3">
                                        <label for="approved">Approved</label>
                                    </div>
                                </div>
                                <span id="current_status" style="color: red"></span>
                            </div>

                            <div class="col-sm-12 "><br></div>
                            <div class="col-sm-12 ">

                                <div class="form-group col-sm-1 col-sm-offset-5">
                                    <button type="submit" id="updateEduIns" class=" btn btn-default">
                                        <i class="fa fa-save" title="Update Education"></i></button>
                                </div>

                                <div class="form-group col-sm-1">
                                    <span id="edit_edu_ins_cancel">
                                        <a class=" btn btn-default" href="javascript:void(0)">
                                            <i class="fa fa-times" title="Cancel"></i>
                                        </a>
                                    </span>
                                </div>
                            </div>
                            </form>
                        </div>
                    </div>
                    <!--    Edit Educational Institute Form End    -->
                </div>             

            </div>

            <div class="col-sm-12 white form-group" id="manageEduInsView">
                <div class="col-sm-12 gray_ttc" style="margin-left: 5px" >
                    <div class="col-sm-12 form-group" style="border-bottom: 1px solid #80c12c;">
                        <span class=" col-sm-12  form-group">
                            <h3 style="margin: 0">Manage Education Institute</h3>
                        </span> 
                    </div>

                    <div class="col-sm-12 form-group white">
                        <div class="col-sm-12 gray_ttc form-group" style="margin-left: 5px;border-bottom: 1px solid #80c12c">
                            <div class="form-group col-sm-6">
                                <strong>Education Institute Name</strong>
                            </div>
                            <div class="form-group col-sm-3">
                                <strong>Country</strong>
                            </div>                            
                            <div class="form-group col-sm-3">
                                <strong> Action</strong>
                            </div>                             
                        </div>
                        <div class="col-sm-12" style="height: 10px;"></div>
                        <div class="col-sm-12" id="eduInsList"> 
                            <?php
                            foreach ($all_eduIns_name as $eduIns_value) {
                                ?>
                                <div class="col-sm-12  form-group" style="margin-left: 5px;background: #ededed" id="eduIns_row<?php echo $eduIns_value->education_institute_id ?>">
                                    <div class=" col-sm-6 " style="padding-top: 5px;padding-bottom: 5px">
                                        <?php echo $eduIns_value->education_institute_name ?>
                                    </div>
                                    <div class=" col-sm-3 " style="padding-top: 5px;padding-bottom: 5px">
                                        <script type="text/javascript">
                                            var countryName = getCountryName('<?php echo $eduIns_value->education_institute_country ?>');
                                            document.write(countryName);
                                        </script>
                                    </div>
                                    <?php if ($this->session->person_role == 6) { ?>
                                        <div class="col-sm-2 " style="padding-top: 5px;padding-bottom: 5px">
                                            <a href="javascript:void(0)" onclick="editEduIns('<?php echo $eduIns_value->education_institute_id; ?>')" class="EditBtn"><i class="fa fa-edit" title="Edit"></i></a>                                    
                                            <span>&nbsp;&nbsp;</span>
                                            <a href="javascript:void(0)" id="deleteEduIns<?php echo $eduIns_value->education_institute_id; ?>" ><i class="fa fa-trash" title="Delete"></i></a>
                                            <?php if ($eduIns_value->education_institute_status == 2) { ?>
                                                <span>&nbsp;&nbsp;</span>
                                                <a href="javascript:void(0)" id="approveEduIns<?php echo $eduIns_value->education_institute_id; ?>"><i class="fa fa-refresh fa-spin" title="Pending"></i></a>
                                            <?php } ?>
                                        </div>
                                    <?php } ?>
                                </div>
                                <div class="modal fade" style="" id="deleteEduInsModal<?php echo $eduIns_value->education_institute_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                    <?php
                                    $id = $eduIns_value->education_institute_id;
                                    $message = "Are you sure to delete this education institute?";
                                    $this->cf->view_modal($id, $message);
                                    ?>
                                </div>     
                            <?php } ?>
                        </div>
                    </div>
                </div>                
                <?php echo $pagination_link; ?>              
            </div>
        </div>
    </div>
</div>


<div class="col-sm-10 form-group ">
    <div class="col-sm-12 gray">
        <label>&nbsp;&nbsp;<a href="<?php echo base_url() ?>">Dashboard </a>->> Education Institute</label>
    </div>
</div>
<script src="<?php echo base_url(); ?>back_end_resource/education_institute/education_institute.js" type="text/javascript"></script>
