@extends('layouts.modal')

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

@section('modal_body')
    <form method="POST" action="" enctype="multipart/form-data" id='modal-section-edit-form'>
        @method('PATCH')
        @csrf
        <div class="row">
            <div class="form-group col-4">
                <label for="modal-section-edit-code-field">Numero de Seccion:</label>
                <input id="modal-section-edit-code-field" type="text" class="form-control" name="code" minlength="3" maxlength="3">
            </div>
            <div class="form-group col-8">
                <label for="modal-course-edit-syllabus-field">Prontuario:</label>
                <input type="file" id="modal-section-edit-syllabus-field" name="syllabus">
            </div>
        </div>
        <div class="row">
            <div class="form-group col-6">
                <label for="modal-section-edit-credits-field">Creditos:</label>
                <input type="number" id="modal-section-edit-credits-field" class="form-control" name="credits" step="0.01">
            </div>
            <div class="form-group col-6">
                <label for="modal-section-edit-student_count-field"># de Estudiantes:</label>
                <input type="number" id="modal-section-edit-student_count-field" class="form-control" name="student_count" step="1">
            </div>
        </div>
        <div class="row">
            <div class="form-group col-8">
                <label for="modal-section-edit-prof-field">Profesores (ctrl + click para multiples):</label>
                <select id="modal-section-edit-prof-field" class="form-control" name="professor_id[]" multiple>
                    @foreach (App\Professor::orderBy('last_name')->get() as $professor)
                        <option value="{{ $professor->id }}">
                            {{ $professor->last_name . ', ' . $professor->first_name }}
                        </option>
                    @endforeach
                </select>
            </div>
        </div>
    </form>
@overwrite

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