@extends('admin.index')
@section('content')

<form action="{{ route('admin.notes.addNotesForMultyStudents') }}" method="post">
    @csrf
    <div class="card">
        <div class="border-bottom card-header">
            <h4 class="card-title">{{ trans("general.notes") }}</h4>
        </div>
        <div class="card-body">
            <div class="modal-body">
                <div class="col-12">
                    <div class="mb-1">
                        <label class="form-label" for="text">{{ trans('general.text') }}</label>
                        <textarea required name="text" id="setting-value" class="form-control"></textarea>
                    </div>
                </div>
                <div class="col-12">
                    <div class="mb-1">
                        <label class="form-label">{{trans('general.type')}}</label>
                        <select required name="type" class="form-select">
                            <option value="">--</option>
                            @foreach($notesTypes as $type)
                            <option value="{{ $type->id }}">{{ trans('general.'.$type->code) }}</option>
                            @endforeach
                        </select>
                        <div class="col-12 mt-75" id="details-options">
                            {{-- <label class="form-label" for="addStudentsSelect" id="addaddStudentsSelectSelectLabel"></label> id="addStudentsSelect"--}}
                            <select class="js-example-basic-multiple" name="studentIds[]" multiple="multiple">
                            @foreach ($students as $student)
                                <option value="{{ $student->id }}">{{ $student->first_name." " .$student->last_name }}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                   
                </div>
            </div>
        </div>

        <div class="card-footer">
            <button type="submit" class="btn btn-primary waves-effect waves-float waves-light">{{ trans('general.save') }}</button>
            <button type="reset" class="btn btn-outline-secondary waves-effect">{{ trans('general.reset') }}</button>
        </div>
    </div>

</form>

@push('scripts')

<script>
    function stageLevels(stage_id) {
        var jqxhr = $.ajax({
                url: "{{route('admin.stage.levels.all')}}",
                method: "GET",
                timeout: 0,
                data: {
                    stage_id: stage_id
                }
            })
            .done(function(response) {
                setLevelsOptions(response.data);
                console.log(response);
            })
            .fail(function(response) {
                console.log(response);
                setLevelsOptions([]);
                toastr.error(response.responseJSON.msg, '{{ trans("general.error") }}');
            });
    }
    $(document).ready(function() {
    $('.js-example-basic-multiple').select2();
});

    function setLevelsOptions(data) {
        var levelSelect = $('#levelSelect');
        levelSelect.html('');
        levelSelect.append($('<option>', {
            value: '',
            text: '--'
        }));
        $.each(data, function(index, val) {
            levelSelect.append($('<option>', {
                value: val.id,
                text: val.title +'  '+ val.code
            }));
        });
    }
</script>

@endpush

@push('header')


@endpush
@endsection