@extends('supervisor.layouts.master')
@section('content') 
<div class="row">
    <div class="col-md-8 rounded p-2 ms-2">
        <div class="bg-white p-2 rounded">
            <h6 style="padding: 8px 4px 0px; color: #141639c4; font-weight:bold !important;">Application Summary</h6>
            <div class="col-md-12 bg-white">
                <div class="table-responsive">
                    <table class="table table-bordered list_table">
                        <thead>
                            <tr>
                                <th>Status</th>
                                <th>Jan</th>
                                <th>Feb</th>
                                <th>Mar</th>
                                <th>Apr</th>
                                <th>May</th>
                                <th>Jun</th>
                                <th>Jul</th>
                                <th>Aug</th>
                                <th>Sept</th>
                                <th>Oct</th>
                                <th>Nov</th>
                                <th>Dec</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td style="font-size: 12px;">App receive</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                            </tr>
                            <tr>
                                <td style="font-size: 12px;">Hold</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                            </tr>
                            <tr>
                                <td style="font-size: 12px;">Rejected</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                            </tr>
                            <tr>
                                <td style="font-size: 12px;">Pause</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                            </tr>
                            <tr>
                                <td style="font-size: 12px;">Interested</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                                <td style="font-size: 11px;">-</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-md-12 mt-3" style="margin-left: -4px;">
            <div class="row">
                <div class="col-md-5 bg-white rounded p-2 ms-3" style="width: 47.1%;">
                    <div class="row">
                        <div class="col-md-12 mt-2">
                                <div style="display: flex;">
                                    <div class="left" style="width: 90%;">
                                        <span class="title p-2" style="margin-bottom: 0px !important; color: #141639c4; font-weight:bold !important;">Profile</span>
                                    </div>
                                    <div class="right" style="width: 10%;">
                                        <span class="title" style="font-size:11px; font-weight: 600;">
                                                <button type="button" class="btn btn2" id="edit_profile_open_hide" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-pencil"></i></button>

                                        </span>
                                    </div>
                                </div>
                                <div class="single_glance_row mt-5" style="border-bottom: 1px solid #e8eef1;">
                                    <div class="col-md-12">
                                        <div id="demo16" class="collapse mt-2">
                                            <div class="panel-body profile_form" style="padding:10px; background-color: #4b4c6824; border: 1px solid #e9e5e5; border-radius: 5px;">
                                                <input type="hidden"  id="u_id" name="id" value="{{$user->id}}">
                                                    <div class="row">
                                                        <div class="col-md-6">
                                                            <div class="mb-2">
                                                                <label class="form-label config">First Name</label>
                                                                <div class="form-icon position-relative">
                                                                    <input type="text" class="form-control" placeholder="First Name" id="first_name" name="first_name" value="{{$user->first_name}}" required="" style="font-size: 13px;">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-6">
                                                            <div class="mb-2">
                                                                <label class="form-label config">Last Name</label>
                                                                <div class="form-icon position-relative">
                                                                    <input type="text" class="form-control" placeholder="Last Name" id="last_name" name="last_name" value="{{$user->last_name}}" required="" style="font-size: 13px;">
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <div class="mb-2">
                                                            <label class="form-label config">University Name</label>
                                                            <div class="form-icon position-relative">
                                                                {{-- <input type="text" class="form-control" placeholder="University Name" id="university_name" name="university_name" value="{{$user->university_name}}" required="" style="font-size: 13px;"> --}}
                                                                <select class="form-control" name="university" id="university_id">
                                                                    <option value="" disabled selected>Choose one..</option>
                                                                    @foreach($universities as $row)
                                                                        <option value="{{$row->id}}" @if($user->university_id ==$row->id) selected @endif>{{ $row->name}}</option>
                                                                    @endforeach

                                                                </select>

                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <div class="mb-2">
                                                            <label class="form-label config">Department</label>
                                                            <div class="form-icon position-relative">
                                                                <select class="form-control" name="department" id="department_id">
                                                                    <option value="" disabled selected>Choose one..</option>
                                                                    @foreach($departments as $row)
                                                                        <option value="{{$row->id}}" @if($user->department ==$row->id) selected @endif>{{ $row->name}}</option>
                                                                    @endforeach

                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <div class="mb-2">
                                                            <label class="form-label config">Designation</label>
                                                            <div class="form-icon position-relative">
                                                                <input type="text" class="form-control" placeholder="Designation" id="designation" name="designation" value="{{$user->designation}}" required="" style="font-size: 13px;">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <div class="text-end">
                                                            <button class="btn btn2 update_profile">Update</button>
                                                        </div>
                                                    </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <div class="left mb-2 mt-2">
                                <div id="load_profile_info">
                                </div>
                            </div>
                        </div>
                    </div>
                </div><!--end col-->
                <div class="col-md-5 bg-white rounded p-2 ms-4" style="width: 47.1%;">
                    <div class="row">
                        <div class="col-md-12">
                            <h6 style="padding: 13px 10px 0px; color: #141639c4; font-weight:bold !important;">Change password</h6>
                            <div class="form-icon position-relative p-2 mt-2">
                                <input type="hidden" name="user_id" value="{{$user->id}}" id="user_id">
                                <input type="password" class="form-control" placeholder="Old password" name="old_password" id="old_password" required="" style="font-size: 13px;">
                            </div>
                            <div class="form-icon position-relative p-2">
                                <input type="password" class="form-control" placeholder="New password" name="new_password" id="new_password" required="" style="font-size: 13px;">
                            </div>
                            <div class="form-icon position-relative p-2">
                                <input type="password" class="form-control" placeholder="Re-type new password" name="new_password_confirmation" id="new_password_confirmation" required="" style="font-size: 13px;">
                                <div class="col-md-12"  style="text-align: center;">
                                    <button class="btn btn2 mt-3 change_password">Changed</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div><!--end col-->
            </div><!--end col-->
        </div>
    </div><!--end col-->

    <div class="col-md-3 bg-white rounded mt-2 p-2 ms-3" style="width: 30%;">
        <div class="row">
            <div class="col-md-12">
                <h6 style="padding: 13px 8px 0px; margin-bottom: 0px; color: #141639c4; font-weight:bold !important;">Research Interest</h6>
                <p class="ms-2" style="font-size: 11px;">Make yourself visible to candidates</p>
                <div class="col-md-12 mt-2">
                    <div class="mb-2">
                        <div class="form-icon position-relative p-2" style="display: flex;">
                            <input type="hidden" name="user_id" value="{{$user->id}}" id="res_user_id">
                            <input type="text" class="form-control" placeholder="" name="research" id="research" required="">
                            <button class="btn btn2 research_interest" style="margin-left: -3.4rem; border-radius: 0px 6px 6px 0px">Add</button>
                        </div>
                    </div>

                    <div id="load_research_interest"></div>
                </div>
            </div>
        </div>
    </div>
</div>

@endsection
@push('js')
<script>
    $(function(){

        $("#edit_profile_open_hide").on('click', function(){
            $("#demo16").show();
        });

        fetch_sub_content(
            '#load_profile_info',
            "{{ route('sub-content', ['name'=>'load_profile_info']) }}"
        );

        fetch_sub_content(
            '#load_research_interest',
            "{{ route('sub-content', ['name'=>'load_research_interest']) }}"
        );

        $('.update_profile').on('click', function(){

            var id =$('#u_id').val();
            var first_name =$('#first_name').val();
            var last_name =$('#last_name').val();
            var university_id =$('#university_id').val();
            var department =$('#department_id option:selected').val();
            var designation =$('#designation').val();

            var form_data={
                _token: "{{ csrf_token() }}",
                id: id,
                first_name: first_name,
                last_name: last_name,
                university_id: university_id,
                department: department,
                designation: designation,
            }

            $.post("{{ route('ajax-post', ['name'=>'update_profile']) }}", form_data, function(res){
                pop_up_msg(res.msg);

                $("#demo16").hide();

                fetch_sub_content(
                    '#load_profile_info',
                    "{{ route('sub-content', ['name'=>'load_profile_info']) }}"
                );

            }).fail(function(err){

                pop_up_msg(err_msg(err), 'error');

            });
        });

        $('.change_password').on('click', function(){
            var id =$('#user_id').val();
            var old_password =$('#old_password').val();
            var new_password =$('#new_password').val();
            var new_password_confirmation =$('#new_password_confirmation').val();

            var form_data={
                _token: "{{ csrf_token() }}",
                id: id,
                old_password: old_password,
                new_password: new_password,
                new_password_confirmation: new_password_confirmation,
            }

            $.post("{{ route('ajax-post', ['name'=>'teacher_change_password']) }}", form_data, function(res){
                pop_up_msg(res.msg);

            }).fail(function(err){

                pop_up_msg(err_msg(err), 'error');

            });
        });

        $('.research_interest').on('click', function(){
            var id =$('#res_user_id').val();
            var research =$('#research').val();

            var form_data={
                _token: "{{ csrf_token() }}",
                id: id,
                research: research,
            }

            $.post("{{ route('ajax-post', ['name'=>'research_interest']) }}", form_data, function(res){
                pop_up_msg(res.msg);
                $('#research').val('');
                fetch_sub_content(
                    '#load_research_interest',
                    "{{ route('sub-content', ['name'=>'load_research_interest']) }}"
                );

            }).fail(function(err){

                pop_up_msg(err_msg(err), 'error');

            });
        });
    });
</script>

@endpush