@extends('layouts.modal')

@section('modal_id'){{ 'modal-course-edit' }}@overwrite
@section('modal_title'){{ 'Editando Curso' }}@overwrite

@section('modal_body')
    <form method="POST" action="/course" enctype="multipart/form-data" id='modal-course-edit-form'>
        @method('PATCH')
        @csrf
        <input type="hidden" name="id">
        <div class="row">
            <div class="form-group col-8">
                <label for="modal-course-edit-title-field">Titulo:</label>
                <input id="modal-course-edit-title-field" type="text" class="form-control" name="title" maxlength="255">
            </div>
            <div class="form-group col-4">
                <label for="modal-course-edit-dept-field">Departamento:</label>
                <select id="modal-course-edit-dept-field" class="form-control" name="dept_id" default="1">
                    @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>
        <div class="row">
            <div class="form-group col-8">
                <label for="modal-course-edit-syllabus-field">Prontuario:</label>
                <input type="file" id="modal-course-edit-syllabus-field" name="syllabus">
            </div>
        </div>
    </form>
@overwrite

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