@extends('layouts.app')
@section('title', __('medworkforce::lang.shift_templates'))
@section('content')
<section class="content-header"><h1>@lang('medworkforce::lang.shift_templates')</h1>
    <p>@lang('medworkforce::lang.templates_help')</p>
</section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        <div class="mb-2" style="margin-bottom:12px;">
            <button class="btn btn-primary btn-sm medwf-modal-btn" data-href="{{ route('medwf.templates.create') }}">
                <i class="fa fa-plus"></i> @lang('medworkforce::lang.add_template')
            </button>
        </div>
        <div class="table-responsive">
            <table class="table table-bordered table-striped" id="medwf_templates_table">
                <thead><tr>
                    <th>@lang('medworkforce::lang.template_name')</th>
                    <th>@lang('medworkforce::lang.start_time')</th>
                    <th>@lang('medworkforce::lang.end_time')</th>
                    <th>@lang('medworkforce::lang.break_minutes')</th>
                    <th>@lang('medworkforce::lang.night_allowance')</th>
                    <th>@lang('medworkforce::lang.color')</th>
                    <th>@lang('medworkforce::lang.status')</th>
                    <th>@lang('medworkforce::lang.actions')</th>
                </tr></thead>
            </table>
        </div>
    @endcomponent
    <div class="modal fade medwf_modal" tabindex="-1" role="dialog"></div>
</section>
@endsection
@section('javascript')
@include('medworkforce::partials.crud_scripts')
<script>
$(function () {
    var table = $('#medwf_templates_table').DataTable({
        processing: true, serverSide: true,
        ajax: '{{ route('medwf.templates.index') }}',
        columns: [
            { data: 'name', name: 'name' },
            { data: 'start_time', name: 'start_time' },
            { data: 'end_time', name: 'end_time' },
            { data: 'break_minutes', name: 'break_minutes' },
            { data: 'night_allowance', name: 'night_allowance' },
            { data: 'color_badge', name: 'name', orderable: false, searchable: false },
            { data: 'is_active', name: 'is_active' },
            { data: 'action', name: 'action', orderable: false, searchable: false },
        ],
    });
    window.__medWfTables.push(table);
});
</script>
@endsection
