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

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

<div class="card card-custom example example-compact">
    <div class="card-header">
        <h3 class="card-title">
            Allocate Batch
        </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">
                    Student:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <select class="form-control kt-select2 select2" id="reg_id" name="reg_id">
                        <option value="">Select Student</option>                       
                        @foreach ($registrations as $row) 
                            <option value="{{ $row ->id }}">{{ $row ->participant_name }}</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">
                    Course:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <select class="form-control kt-select2 select2" id="kt_select2_1" name="course_id">
                        <option value="">Select Course</option>                       
                        @foreach ($batches as $row) 
                            <option value="{{ $row ->id }}">{{ $row ->name }}</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">
                    Payment Cycle:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <select class="form-control" id="paymentcycle" name="paymentcycle">
                        <option values="">Payment Cycle</option>
                        <option selected>Monthly</option>
                        <option>Quarterly</option>
                        <option>Half Yearly</option>
                        <option>Yearly</option>
                    </select>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">Days/Week:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <select class="form-control " id="dow" name="dow" class="form-control" required>
                        <option>No. of times in week</option>
                        <option value="1" >1 day</option>
                        <option value="2" selected>2 days</option>
                        <option value="3">3 days</option>
                        <option value="4">4 days</option>
                        <option value="5">5 days</option>
                    </select>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">
                    Batch joining Date:</label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                <input type="date" class="form-control pickadate" value="<?php echo date("Y-m-d");?>" id="doj" name="doj" placeholder="&hellip;">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-lg-3 control-label">
                    Select Days and Class timings</label>
                <div class="col-lg-8 col-md-9 col-sm-12">
                    <table>
                        <tr>
                            <td>
                                <div id="mondiv">Monday
                                @foreach ($timings as $row) 
                                    <label>
                                        <input type="radio" name="Monday" value="{{ $row ->timename }}" />
                                        {{ $row->timename }}
                                    </label>
                                @endforeach
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div id="mondiv">Tuesday
                                @foreach ($timings as $row) 
                                    <label>
                                        <input type="radio" name="Tuesday" value="{{ $row ->timename }}" />
                                        {{ $row->timename }}
                                    </label>
                                @endforeach
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div id="weddiv"> Wednesday
                                @foreach ($timings as $row) 
                                    <label>
                                        <input type="radio" name="Wednesday" value="{{ $row ->timename }}" />
                                        {{ $row->timename }}
                                    </label>
                                @endforeach
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div id="thursdiv">Thursday
                                @foreach ($timings as $row) 
                                    <label>
                                        <input type="radio" name="Thursday" value="{{ $row ->timename }}" />
                                        {{ $row->timename }}
                                    </label>
                                @endforeach
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div id="fridiv">Friday
                                @foreach ($timings as $row) 
                                    <label>
                                        <input type="radio" name="Friday" value="{{ $row ->timename }}" />
                                        {{ $row ->timename }}
                                    </label>
                                @endforeach
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div id="satdiv">Saturday
                                @foreach ($timings as $row) 
                                    <label>
                                        <input type="radio" name="Saturday" value="{{ $row ->timename }}" />
                                        {{ $row ->timename }}
                                    </label>
                                @endforeach
                                </div>
                            </td>
                        </tr>
                        <tr>

                            <td>
                                <div id="sundiv">Sunday
                                @foreach ($timings as $row) 
                                    <label>
                                        <input type="radio" name="Sunday" value="{{ $row ->timename }}" />
                                        {{ $row ->timename }}
                                    </label>
                                @endforeach
                                </div>
                            </td>
                        </tr>
                    </table>
                    
                </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
@section('scripts')
    <script>
        $(document).ready(function() {
            $('.select2').select2();
        });
    </script>
@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