{{-- Extends layout --}}
@extends('layout.default')

{{-- Content --}}
@section('content')
<div class="card card-custom">
    <div class="card-header flex-wrap border-0 pt-6 pb-0">
        <div class="card-title">
            <h3 class="card-label">{{ config('global.participanttype') }} Edit
            </h3>
        </div>
    </div>
    <div class="card-body">
        @if ($errors->any())
        <div class="alert alert-danger">
            <strong>Error!</strong>
            <ul>
                @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
        @endif
        <!--begin::Form-->
        <form class="kt-form kt-form--label-right" action="{{ route('students.update', $registration->id) }}" method="POST">
            @csrf
            @method('PUT')
            <div class="kt-portlet__body">
                <div class="form-group row">
                    <div class="col-md-5">
                        <div class="form-group">
                            <label for="photo">
                                Profile Picture</label>
                            <input type="file" name="photo" accept="image/*">
                        </div>
                    </div>
                    <div class="col-md-5">
                        <div class="form-group">
                            <label for="photo">
                                Id Proof</label>
                            <input type="file" name="idproof" />
                        </div>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Enter Name</label>
                    <div class="col-9 col-form-label">
                        <input type="hidden" name="trialid" value="" />
                        <input type="text" class="form-control" id="participant_name" name="participant_name" value="{{ $registration->participant_name }}" placeholder="Enter Name" value="" minlength="2" maxlength="50" onkeypress="return ((event.charCode >= 65 && event.charCode <= 90) || (event.charCode >= 97 && event.charCode <= 122) || (event.charCode == 32))" required />
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Dob</label>
                    <div class="col-9 col-form-label">
                        <input type="date" date="yyyy-MM-dd" class="form-control" id="dob" name="dob" value="{{$registration->dob}}" required>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Gender</label>
                    <div class="col-9 col-form-label">
                        <div class="radio-inline">
                            <label class="radio radio-success">
                                <input type="radio" name="gender" {{ $registration->gender == 'M' ? 'checked' : ''}} id="gender" value="M" required />
                                <span></span>Male</label>
                            <label class="radio radio-success">
                                <input type="radio" name="gender" {{ $registration->gender == 'F' ? 'checked' : ''}} id="gender" value="F" required />
                                <span></span>Female</label>
                        </div>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">School / College</label>
                    <div class="col-9 col-form-label">
                        <input type="text" class="form-control" id="edu" name="edu" value="{{$registration->edu}}" placeholder="Enter School / College" maxlength="50" onkeypress="return ((event.charCode >= 65 && event.charCode <= 90) || (event.charCode >= 97 && event.charCode <= 122) || (event.charCode == 32))" />
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Board</label>
                    <div class="col-9 col-form-label">
                        <div class="radio-inline">
                            <label class="radio radio-success">
                                <input type="radio" name="SchoolType" {{ $registration->SchoolType == 'IB' ? 'checked' : ''}} id="SchoolType" value="IB" required  />
                                <span></span>IB</label>
                            <label class="radio radio-success">
                                <input type="radio" name="SchoolType" {{ $registration->SchoolType == 'IGCSE' ? 'checked' : ''}} id="SchoolType" value="IGCSE" required />
                                <span></span>IGCSE</label>
                        </div>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Grade</label>
                    <div class="col-9 col-form-label">
                        <select class="form-control" id="grade" name="grade" required>
                            <option value="" selected="">Grade</option>                           
                             @foreach ($grades as $row) 
                                <option value="{{ $row ->gradename }}" {{ $row ->gradename == $registration->grade ? 'selected' : ''}}>{{ $row ->gradename }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                <div class="form-group row">
                    <input type="hidden" id="Skill" name="Skill" value="1">
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Parent Name</label>
                    <div class="col-9 col-form-label">
                        <input type="text" class="form-control" id="father_name" name="father_name" value="{{$registration->father_name}}" placeholder="Father's Name" required maxlength="50" onkeypress="return ((event.charCode >= 65 && event.charCode <= 90) || (event.charCode >= 97 && event.charCode <= 122) || (event.charCode == 32))" />
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Address</label>
                    <div class="col-9 col-form-label">
                        <input type="text" class="form-control" id="address_1" name="address_1" value="{{$registration->address_1}}" placeholder="Address Line 1" maxlength="200" required />
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">City</label>
                    <div class="col-9 col-form-label">
                        <input type="text" class="form-control" id="city" name="city" value="{{$registration->city}}" placeholder="City" maxlength="20" />
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Pincode</label>
                    <div class="col-9 col-form-label">
                        <input type="text" class="form-control" id="pincode" name="pincode" value="{{$registration->pincode}}" placeholder="Pincode" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="6" />
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Email</label>
                    <div class="col-9 col-form-label">
                        <input type="email" class="form-control" id="email" name="email" value="{{$registration->email}}" placeholder="Email" value="" required />
                        <div id="status" style="left:0px;  padding-top: 10px;" class="col-md-2"></div>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Phone</label>
                    <div class="col-9 col-form-label">
                        <input type="text" class="form-control" id="phone_no" name="phone_no" value="{{$registration->phone_no}}" placeholder="Phone No" onkeypress="return event.charCode >= 48 && event.charCode <= 57" required maxlength="10" required />
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-3 col-form-label">Alternate no.</label>
                    <div class="col-9 col-form-label">
                        <input type="text" class="form-control" id="phone_no_alt" value="{{$registration->phone_no_alt}}" placeholder="Alternate No" onkeypress="return event.charCode >= 48 && event.charCode <= 57" required maxlength="10" name="phone_no_alt" />
                    </div>
                </div>
            </div>

            <div class="kt-portlet__foot">
                <div class="kt-form__actions">
                    <div class="row">
                        <div class="col-lg-6 kt-align-right">
                            <input type="submit" class="btn btn-primary" value="Save">
                        </div>
                        <div class="col-lg-6 kt-align-right">
                            <button type="reset" class="btn btn-secondary">Cancel</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <!--end::Form-->
    </div>
</div>
@endsection
{{-- Scripts Section --}}
@section('scripts')
{{-- page scripts --}}
<script src="{{ asset('js/app.js') }}" type="text/javascript"></script>
@endsection