@extends('layouts.modal')

@section('modal_id'){{ 'modal-professor-create' }}@overwrite
@section('modal_title'){{ 'Creando profesor nuevo' }}@overwrite

@section('modal_body')
    <form method="POST" action="/professor" enctype="multipart/form-data" id='modal-professor-create-form'>
        @csrf
        <div class="row">
            <div class="form-group col-6">
                <label for="modal-professor-create-num-field"># de Profesor:</label>
                <input id="modal-professor-create-num-field" type="text" class="form-control" name="num_prof" maxlength="16" required>
            </div>
            <div class="form-group col-4">
                <label for="modal-professor-create-type-field">Tipo:</label>
                <select id="modal-professor-create-type-field" class="form-control" name="type">
                    <option value="plantilla">Plantilla</option>
                    <option value="contrato">Contrato</option>
                    <option value="ta">T.A.</option>
                </select>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-4">
                <label for="modal-professor-create-fname-field">Nombre:</label>
                <input id="modal-professor-create-fname-field" type="text" class="form-control" name="first_name" maxlength="255">
            </div>
            <div class="col-8">
                <label for="modal-professor-create-lname-field">Apellido:</label>
                <input id="modal-professor-create-lname-field" type="text" class="form-control" name="last_name" maxlength="255">
            </div>
        </div>
        <div class="row">
            <div class="form-group col-sm-8">
                <label for="modal-professor-create-email-field">Email:</label>
                <input id="modal-professor-create-email-field" type="email" name="email">
            </div>
            <div class="form-group col-4">
                <label for="modal-professor-create-dept-field">Departamento:</label>
                <select id="modal-professor-create-dept-field" class="form-control" name="dept_id" default="1" required>
                    @foreach (App\Department::all() as $department)
                        <option value="{{ $department->id }}"
                            @if ($department->id === 1)
                                selected
                            @else
                            {{-- TODO: Check if this should be displayed --}}
                                disabled hidden
                            @endif
                            >{{ $department->name }}</option>
                    @endforeach
                </select>
            </div>
        </div>
    </form>
@overwrite

@section('modal_submit_text'){{ 'Crear curso' }}@overwrite
@section('modal_submit')
    function(){document.getElementById('modal-professor-create-form').submit()}
@overwrite
