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

{{-- Content --}}
@section('content')

<div class="card card-custom example example-compact">
    <div class="card-header">
        <h3 class="card-title">
            Trial Add/Edit
        </h3>
    </div>
    <!--begin::Form-->
    <form class="form" action="{{$action}}" method="POST">
        @csrf
        @isset($trial->Id)
        {{ method_field('PATCH')}}
        @endisset
        <div class="card-body">
            @if ($errors->any())           
            <div class="alert alert-danger">
                <strong>Error!</strong>
                <ul>
                    @foreach ($errors->all() as $error)
                    <li></li>
                    @endforeach
                </ul>
            </div>
            @endif

            <div class="form-group row">
                <label class="col-lg-3 control-label">Participant Name:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <input type="hidden" name="Id" value="{{$trial->Id}}" />
                    <input type="text" class="form-control" id="participant_name" name="participant_name" value="{{ $trial->participant_name }}" 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-lg-3 control-label">Gender:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <label>
                        <input type="radio" name="gender" id="genderm" {{ ($trial->gender=='M') ? 'CHECKED' : '' }} value="M" required />
                        Male
                    </label>
                    <label>
                        <input type="radio" name="gender" id="genderf" {{ ($trial->gender=='F') ? 'CHECKED' : '' }} value="F" required />
                        Female
                    </label>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">Parent Name:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <input type="text" class="form-control" id="ParentName" name="ParentName" value="{{$trial->ParentName}}" 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-lg-3 control-label">Phone:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <input type="text" class="form-control" id="Phone" name="Phone" value="{{$trial->Phone}}" onkeypress="return event.charCode >= 48 && event.charCode <= 57" required maxlength="10" required />
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">Email:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <input type="email" class="form-control" id="Email" name="Email" value="{{$trial->Email}}" />
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">Trial Date:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <input type="date" class="form-control" value="{{$trial->trialdate}}" id="trialdate" name="trialdate" placeholder="&hellip;" required>
                    <span class="form-text text-muted">Date format: <code>mm/dd/yyyy</code></span>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">Trial Time:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <div id="mondiv">
                        <label>
                            <input type="radio" name="trialtime" value="5 AM" />
                            5 AM&nbsp;&nbsp;&nbsp;
                        </label>
                        <label>
                            <input type="radio" name="trialtime" value="9 AM" />
                            9 AM&nbsp;&nbsp;&nbsp;
                        </label>
                        <label>
                            <input type="radio" name="trialtime" value="4 PM" />
                            4 PM&nbsp;&nbsp;&nbsp;
                        </label>
                        <label>
                            <input type="radio" name="trialtime" value="5 PM" />
                            5 PM&nbsp;&nbsp;&nbsp;
                        </label>
                    </div>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">Followup Date:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <input type="date" class="form-control pickadate" value="{{$trial->followupdate}}" id="followupdate" name="followupdate" placeholder="&hellip;">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">Tentative Batch:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <input type="text" class="form-control" id="tentativebatch" name="tentativebatch" value="{{$trial->tentativebatch}}" onkeypress="return ((event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123) || event.charCode == 8 || event.charCode == 32 || (event.charCode >= 48 && event.charCode <= 57));" maxlength="20" />
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">Comments:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <input type="text" class="form-control" id="comments" name="comments" value="{{$trial->comments}}" maxlength="150" />
                </div>
            </div>
        </div>
        <div class="card-footer">
            <div class="row">
                <div class="col-lg-9 ml-lg-auto">
                    <button type="submit" class="btn btn-success mr-2">Submit</button>
                    <button type="reset" class="btn btn-secondary">Cancel</button>
                </div>
            </div>
        </div>
    </form>
    <!--end::Form-->
</div>
@endsection
{{-- Styles Section --}}
@section('styles')
<link href="{{ asset('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css" />
@endsection
{{-- Scripts Section --}}
@section('scripts')
{{-- vendors --}}
<script src="{{ asset('plugins/custom/datatables/datatables.bundle.js') }}" type="text/javascript"></script>

{{-- page scripts --}}
<script src="{{ asset('js/pages/crud/datatables/extensions/buttons.js') }}" type="text/javascript"></script>

<script src="{{ asset('js/app.js') }}" type="text/javascript"></script>
@endsection