@extends('backend.layouts.app')
@section('title', @$data['title'])

@section('style')
    <link rel="stylesheet" href="{{ asset('css/bootstrapDatepicker.min.css') }}">
@endsection

@section('content')
    {!! breadcrumb([
        'title' => @$data['title'],
        route('admin.dashboard') => _trans('common.Dashboard'),
        '#' => @$data['title'],
    ]) !!}
    <div class="table-content table-basic">
        <div class="card">
            <div class="card-body">
                <form method="POST" action="{{ route('leaveRequest.store') }}" class="" enctype="multipart/form-data"
                    autocomplete="off">
                    @csrf
                    <input type="text" hidden value="{{ auth()->id() }}" name="user_id">
                    <div class="">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group mb-3">
                                    <label class="form-label">{{ _trans('common.Leave Type') }} <span
                                            class="text-danger">*</span></label>
                                    <select class="form-control select2" name="assign_leave_id" required>
                                        <option value="" disabled selected>{{ _trans('common.Choose One') }}
                                        </option>
                                        @foreach ($data['leaveTypes'] as $type)
                                            <option value="{{ $type->id }}">{{ @$type->type->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group mb-3">
                                    <label class="form-label">{{ _trans('common.Substitute') }}</label>
                                    <select name="substitute_id" class="form-control select2" id="user_id">

                                    </select>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group mb-3">
                                    <label class="form-label">{{ _trans('common.Leave Dates') }} <span
                                            class="text-danger">*</span></label>
                                    @if (settings('individual_day_wise_leave'))
                                        <input class="multi-date-picker form-control ot-form-control ot-input"
                                            type="text" name="dates" required
                                            placeholder="{{ _trans('common.Pick Leave Dates') }}">
                                    @else
                                        <input class="daterange-table-filter form-control" type="text" name="daterange"
                                            value="{{ date('m/d/Y') }}-{{ date('m/d/Y') }}" required>
                                    @endif
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div>
                                    <label class="form-label">{{ _trans('common.Attachment') }}</label>

                                    <div class="ot_fileUploader left-side mb-3">
                                        <input class="form-control" type="text"
                                            placeholder="{{ _trans('common.Attachment') }}" name="" readonly=""
                                            id="placeholder">
                                        <button class="primary-btn-small-input" type="button">
                                            <label class="btn btn-lg ot-btn-primary m-0"
                                                for="fileBrouse">{{ _trans('common.Browse') }}</label>
                                            <input type="file" class="d-none form-control" name="attachment"
                                                id="fileBrouse">
                                        </button>
                                    </div>

                                </div>
                            </div>

                            <div class="col-md-12">
                                <div class="form-group mb-3">
                                    <label class="form-label">{{ _trans('common.Reason') }} <span
                                            class="text-danger">*</span></label>
                                    <textarea name="reason" class="form-control ot-input mt-0" placeholder="{{ _trans('common.Reason') }} " rows="6"
                                        required></textarea>
                                </div>
                            </div>

                        </div>
                    </div>
                    <!-- /.card-body -->
                    <div class="d-flex justify-content-end mt-3">
                        <button type="submit" class="btn btn-gradian ">{{ _trans('common.Submit') }}</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <input type="hidden" id="get_user_url" value="{{ route('user.getUser') }}">
@endsection

@section('script')
    <script src="{{ asset('js/bootstrapDatepicker.min.js') }}"></script>
    <script>
        $('.multi-date-picker').datepicker({
            multidate: true,
            format: 'yyyy-mm-dd',
            todayHighlight: true,
        });
    </script>
@endsection
