<form class="row g-3 auto-width classes" action="{{ route('classes.update', $data->id)}}" method="post" enctype='multipart/form-data'>
    @csrf
    @method('PUT')
    <div class="col-md-12">
        <label for="validationCustomTitle" class="form-label">Class Name <span class="text-danger"><b>*</b></span></label>
        <input type="text" class="form-control" id="validationCustomTitle" name="class_name" aria-describedby="inputGroupPrepend" required value="{!! $data->class_name !!}">
        @if ($errors->has('class_name'))
        <span class="text-danger">{{ $errors->first('class_name') }}</span>
        @endif
        <span class="text-danger error_class_name" style="display: none;">This field is required.</span>
    </div>
    <div class="col-md-12">
        <label for="validationCustomTitle" class="form-label">Class Code <span class="text-danger"><b>*</b></span></label>
        <input  type="text" class="form-control" id="validationCustomTitle" name="class_code" aria-describedby="inputGroupPrepend" required value="{!! $data->class_code !!}">
        @if ($errors->has('class_code'))
        <span class="text-danger">{{ $errors->first('class_code') }}</span>
        @endif
        <span class="text-danger error_class_code" style="display: none;">This field is required.</span>
    </div>
    <div class="col-md-12">
        <label for="validationCustomTitle" class="form-label">Course Name <span class="text-danger"><b>*</b></span></label>
        <select class="form-control" name="course_id">
            <option value="">Select Course</option>
            @foreach ($coursers as $row)
            <option value="{{$row->id}}" {!! isset($data->course_id) && $data->course_id==$row->id ? 'selected': ' '   !!}>{{$row->course_title}}</option>
            @endforeach
        </select>
        <span class="text-danger error_class_code" style="display: none;">This field is required.</span>
    </div>
    <div class="col-md-12">
        <label for="validationCustomTitle" class="form-label">Sections <span class="text-danger"><b>*</b></span></label>
        <select class="single-select select-2" name="sections[]" required multiple>
            @foreach ($sections as $key => $record)
                <option value="{!! $record->id !!}" {!! isset($selectedSections) && in_array($record->id, explode(',', $selectedSections->sections)) ? 'selected' : '' !!}>{!! $record->section !!}</option>
            @endforeach
        </select>
        @if ($errors->has('sections'))
        <span class="text-danger">{{ $errors->first('sections') }}</span>
        @endif
        <span class="text-danger error_sections" style="display: none;">This field is required.</span>
    </div>
    <div class="col-md-12">
        <label for="validationCustomTitle" class="form-label">Priority </label>
        <input type="numer" class="form-control" id="validationCustomTitle" name="priority" aria-describedby="inputGroupPrepend" required value="{!! $data->priority !!}">
        @if ($errors->has('priority'))
        <span class="text-danger">{{ $errors->first('priority') }}</span>
        @endif
        <span class="text-danger error_name" style="display: none;">This field is required.</span>
    </div>
</form>
