@extends('layouts.app')
@section('title', __('vrc::lang.reminders'))
@section('content')
<section class="content-header"><h1>@lang('vrc::lang.reminders')</h1></section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        @slot('tool')<div class="box-tools"><button class="btn btn-primary" data-toggle="modal" data-target="#vrc_rem_modal"><i class="fa fa-plus"></i> @lang('messages.add')</button></div>@endslot
        <table class="table table-bordered table-striped" id="vrc_rem_table">
            <thead><tr><th>@lang('vrc::lang.vehicle')</th><th>@lang('vrc::lang.type')</th><th>@lang('vrc::lang.valid_until')</th><th>@lang('vrc::lang.status')</th><th>@lang('messages.action')</th></tr></thead>
        </table>
    @endcomponent

    <div class="modal fade" id="vrc_rem_modal" tabindex="-1" role="dialog"><div class="modal-dialog"><div class="modal-content">
        {!! Form::open(['route' => 'vrc.service-reminders.store', 'class' => 'vrc-form']) !!}
        <div class="modal-header"><button type="button" class="close" data-dismiss="modal">&times;</button><h4 class="modal-title">@lang('vrc::lang.reminders')</h4></div>
        <div class="modal-body">
            <div class="form-group">{!! Form::label('vehicle_id', __('vrc::lang.vehicle') . ':*') !!}{!! Form::number('vehicle_id', null, ['class' => 'form-control', 'required', 'placeholder' => 'Vehicle id']) !!}</div>
            <div class="form-group">{!! Form::label('type', __('vrc::lang.type') . ':') !!}{!! Form::select('type', ['date'=>__('vrc::lang.reminder_date'),'mileage'=>__('vrc::lang.reminder_mileage'),'next_service'=>__('vrc::lang.reminder_next_service')], 'date', ['class' => 'form-control']) !!}</div>
            <div class="form-group">{!! Form::label('due_date', __('vrc::lang.valid_until') . ':') !!}{!! Form::date('due_date', null, ['class' => 'form-control']) !!}</div>
            <div class="form-group">{!! Form::label('channel', __('vrc::lang.channel') . ':') !!}{!! Form::select('channel', ['sms'=>'SMS','email'=>'Email','whatsapp'=>'WhatsApp'], 'sms', ['class' => 'form-control']) !!}</div>
        </div>
        <div class="modal-footer"><button type="submit" class="btn btn-primary">@lang('messages.save')</button><button type="button" class="btn btn-default" data-dismiss="modal">@lang('messages.close')</button></div>
        {!! Form::close() !!}
    </div></div></div>
</section>
@endsection
@section('javascript')
<script>
$(function () {
    var t = $('#vrc_rem_table').DataTable({ processing:true, serverSide:true, ajax:'{{ route('vrc.service-reminders.index') }}',
        columns:[{data:'plate_number',name:'v.plate_number'},{data:'type',name:'vrc_service_reminders.type'},{data:'due_date',name:'vrc_service_reminders.due_date'},{data:'status',name:'vrc_service_reminders.status',orderable:false},{data:'action',name:'action',orderable:false,searchable:false}]});
    window.__vrcTables = window.__vrcTables || []; window.__vrcTables.push(t);
});
</script>
@include('vrc::partials.crud_scripts')
@endsection
