@extends('modal_pages.base')

@section('main')
<form class="modal-form" action="{{ url()->current() }}" method="POST" enctype="multipart/form-data">
    {{ csrf_field() }}
    <div class="container">
        <div class="col-md-12">
            <div class="middle p-3" style="background-color:white; border-radius:6px;">
                <p style="font-size: 16px; font-weight: bold; margin: 0px;">This proposal will be sent to the following supervisor</p>
                <div class="alert" style="padding: 0px; margin: 0px">
                    <input type="hidden" name="id" value="{{$std_proposal->id}}">
                    <input type="hidden" name="teacher_id" value="{{$teacher->id}}">
                    <input type="hidden" name="student_id" value="{{$student->id}}">
                    <div class="d-flex">
                        @if($teacher->university)
                             <img class="img-responsive listFlag mt-2" style="border-radius: 2px; padding: 0px;height: 45px; width: 44px;" src="{{ asset('/assets/img/flags/4x3').'/'.strtolower(cn($teacher,'university.country.iso_3166_2','')).'.svg' }}" alt="Flag" data-toggle="tooltip" title="" data-placement="top">
                        {{-- @else
                        <div class="inner_left mt-1" style="background-color: #141639c4; padding: 18px 0px 0px 0px; height: 47px; width: 56px; margin-top: 9px !important;">
                            <p style="color:white; font-weight:600 !important; letter-spacing: 2px; text-align: center; margin-top: -8px; font-size: 17px;">{{ name_initials($teacher->first_name, $teacher->last_name) }}</p>
                        </div> --}}
                        @endif
                        <div class="alert" style="background-color:white; padding: 3px 7px; margin-bottom: 0px;">
                            <span style="margin: 0px;">{{$teacher->first_name}} {{$teacher->last_name}}</span></br>
                            <span class="text-muted" style="font-weight: 500;">{{$teacher->designation}}</span></br>
                            @if($teacher->others_department)
                                <span class="text-muted" style="font-weight: 500;">{{$teacher->others_department}}</span>
                            @else
                                <span class="text-muted" style="font-weight: 500;">{{cn($teacher,'department_name.name','')}}</span>
                            @endif
                            <span> • </span>
                            @if($teacher->university_name)
                                <span class="text-muted" style="font-weight: 500;">{{$teacher->university_name}}</span>
                            @else
                                <span class="text-muted" style="font-weight: 500;">{{cn($teacher,'university.name','')}}</span>
                            @endif
                        </div>
                    </div>

                </div>
            </div>
        </div>

        <div class="middle p-3 mt-3" style="background-color:white; border-radius:6px;">
            <p style="font-size: 16px; font-weight: bold; margin-bottom: 0px !important;">Please select which proposal you want to send</p>
            <div class="alert mb-3 propose" style="padding: 0px; margin-bottom: 0px">
                <div style="width:100%;">
                    @if(count($proposal) > 0)
                    @foreach($proposal as $row)
                    <div class="p-2" style="border-bottom: 2px solid #eee;">
                        <div class="custom-control custom-radio custom-control-inline">
                            <div class="form-check mb-0">
                                <input class="form-check-input mt-2" type="radio" name="proposal_id" value="{{$row->id}}" id="flexRadioDefault1">
                                <label class="form-check-label" for="flexRadioDefault1" style="font-weight: 600 !important; font-size: 13px;">{{$row->title}}</label></br>
                                <span class="label_badge_radius" style="background-image: linear-gradient(90deg,rgba(46,17,83,.19),#f5f4fd); font-weight: 400 !important; font-size: 10px;">Ref. ({{ $row->proposal_ref}})</span>
                            </div>
                        </div>
                    </div>
                    @endforeach
                    @else
                    <div class="col md-4 mt-1">
                        <div class="col-md-12">
                            <span class="alert mt-3" role="alert" style="font-size: 12px !important; border-radius: .55rem; padding: 8px 12px; margin-top: 6px; background: #fff0d6; color: #fdad2a; border-color: #ffebca; border-width: 3px; border-style: double;"> <i class="fa fa-warning" style="font-size: 11px; margin-right: 5px; color: #fdad2a !important; top: 0px; position: relative;"></i>No proposal available!</span>
                        </div>
                    </div>
                    @endif

                </div>
            </div>
        </div>
    </div>
    <div class="container mt-3">
        <div class="col-md-12 p-3" style="background-color:white; border-radius:6px;">
            <p style="margin:0px; font-size: 16px; font-weight: bold;">Select propose start date</p>
            <div class="row">
                <div class="col-md-6">
                    <div class="mb-1">
                            <label class="form-label"></label>
                        <div class="form-icon position-relative" style="margin-top: -10px;">
                            <select name="startdate" id="start date" class="form-control frm" required=""  style="font-size: 13px;">
                                <option disabled="" selected="" value="">Year</option>
                                @foreach($years as $year)
                                <option value="{{$year}}">{{$year}}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="mb-1">
                            <label class="form-label"></label>
                        <div class="form-icon position-relative" style="margin-top: -10px;">
                            <select name="startmonth" id="month" class="form-control frm" required="">
                                <option disabled="" selected="" value="">Month</option>
                                @for($i=1; $i<=12; $i++)
                                    <option value="{{ date('m', mktime(0, 0, 0, $i, 1)) }}">{{ date('F', mktime(0, 0, 0, $i, 1)) }}</option>
                                @endfor
                            </select>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-12 text-end">
            <button type="submit" class="btn btn1 mt-3 mb-3" style="padding: 3px 18px;">Submit</button>
        </div>
    </div>
</form>

<script>
    $(function(){
        // $('.select2').select2();
        $('#modal_page_footer').hide();
    });
    </script>
@endsection
