@extends('admin.layouts.app')

@push('styles_top')

@endpush

@section('content')
    <section class="section">
        <div class="section-header">
            <h1>تعديل شهادة منتسورى جديدة</h1>
            <div class="section-header-breadcrumb">
                <div class="breadcrumb-item active"><a href="/admin/">{{trans('admin/main.dashboard')}}</a>
                </div>
                <div class="breadcrumb-item">
                    تعديل  شهادة منتسورى جديدة
                </div>
            </div>
        </div>

        <div class="section-body">
            <div class="card">
                <div class="card-body">
                   
                    <hr class="my-4">

                    <form method="post" action="{{'/admin/certificates/'.$certificate->id.'/imtmontessori-certificates/update' }}" id="templateForm" class="form-horizontal form-bordered">
                        {{ csrf_field() }}

                        <div class="row">
                            <div class="col-lg-6">
                                

                                   <div class="form-group mt-15">
                                               <label class="input-label d-block">{{ trans('admin/main.user') }}</label>

                                                <select id="categories" class="custom-select @error('student_id')  is-invalid @enderror" name="student_id" required>
                                                 
                                                    @foreach(App\User::where('role_name', App\Models\Role::$user)->get() as $category)
                                                      
                                                             
                                                           
                                                            <option value="{{ $category->id }}" {{ $certificate->student_id == $category->id ? 'selected' : '' }}>{{ $category->full_name }}</option>
                                                       
                                                    @endforeach
                                                </select>

                                               @error('student_id')
                                            <div class="invalid-feedback d-block">{{ $message }}</div>
                                            @enderror
                                            </div>
                                
                                

                                <div class="form-group">
                                    <label class="control-label" for="inputDefault">السن</label>
                                    <input type="text" name="age" class="form-control @error('age') is-invalid @enderror" value="{{ $certificate->age  }}">
                                    <div class="invalid-feedback">@error('age') {{ $message }} @enderror</div>
                                </div>
                                
                                <div class="form-group">
                                    <label class="control-label" for="inputDefault">التاريخ</label>
                                    <input type="text" name="date" class="form-control @error('date') is-invalid @enderror" value="{{  $certificate->date }}">
                                    <div class="invalid-feedback">@error('date') {{ $message }} @enderror</div>
                                </div>
                                
                                <div class="form-group">
                                    <label class="control-label" for="inputDefault">نوع الشهادة</label>
                                    <select name="type" class="form-control @error('type') is-invalid @enderror">
                                        <option value="">{{ trans('admin/main.select_type') }}</option>
                                        <option value="normal" @if($certificate->student_type=='normal') selected @endif>للطلبة غير ذوى الاحتياجات الخاصة</option>
                                        <option value="special" @if($certificate->student_type=='special') selected @endif>للطلبة ذوى الاحتياجات الخاصة</option>
                                    </select>
                                    <div class="invalid-feedback">@error('type') {{ $message }} @enderror</div>
                                </div>
                              

                            </div>
                        </div>

                    

                       

                     

                        <div class="form-group">
                            <div class="col-md-12">
                                <button class="btn btn-success pull-left" id="submiter" type="button" {{--data-action="{{ !empty($template) ? '/admin/certificates/templates/'. $template->id .'/update' : '/admin/certificates/templates/store' }}" --}} data-action="{{'/admin/certificates/'.$certificate->id.'/imtmontessori-certificates/update' }}">{{ trans('public.save') }}</button>
                                <button class="btn btn-info pull-left" id="preview" type="button" data-action="/admin/certificates/imtmontessori-preview">{{ trans('admin/main.preview_certificate') }}</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </section>
@endsection

@push('scripts_bottom')


    <script src="/assets/default/js/admin/certificates.min.js"></script>
@endpush
