@extends('layouts.modal')

@section('modal_id'){{ 'modal-course-create' }}@overwrite
@section('modal_title'){{ 'Creando curso nuevo' }}@overwrite

@section('modal_body')
    <form method="POST" action="/course" enctype="multipart/form-data" id='modal-course-create-form'>
        @csrf
        <div class="row">
            <div class="form-group col-sm-6">
                <label for="modal-course-create-code-field">Codificacion:</label>
                <input id="modal-course-create-code-field" type="text" class="form-control" name="code" maxlength="8" minlength="8" size="8" required>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-sm-12">
                <label for="modal-course-create-title-field">Titulo:</label>
                <input id="modal-course-create-title-field" type="text" class="form-control" name="title" maxlength="255">
            </div>
        </div>
        <div class="row">
            <div class="form-group col-sm-8">
                <label for="modal-course-create-syllabus-field">Prontuario:</label>
                <input id="modal-course-create-syllabus-field" type="file" name="syllabus">
            </div>
            <div class="form-group col-sm-4">
                <label for="modal-dept-field">Departamento:</label>
                <select id="modal-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-course-create-form').submit()}
@overwrite
