@extends('layouts.app')
@section('title', __('medworkforce::lang.swap_requests'))
@section('content')
<section class="content-header"><h1>@lang('medworkforce::lang.swap_requests')</h1>
    <p>@lang('medworkforce::lang.swaps_help')</p>
</section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        <div class="table-responsive">
            <table class="table table-bordered table-striped" id="medwf_swaps_table">
                <thead><tr>
                    <th>@lang('medworkforce::lang.shift')</th>
                    <th>@lang('medworkforce::lang.requested_by')</th>
                    <th>@lang('medworkforce::lang.requested_with')</th>
                    <th>@lang('medworkforce::lang.reason')</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_swaps_table').DataTable({
        processing: true, serverSide: true,
        order: [[4, 'asc']],
        ajax: '{{ route('medwf.swaps.index') }}',
        columns: [
            { data: 'shift', name: 'shift', orderable: false },
            { data: 'requested_by_name', name: 'requested_by', orderable: false, searchable: false },
            { data: 'requested_with_name', name: 'requested_with_user_id', orderable: false, searchable: false },
            { data: 'reason', name: 'reason' },
            { data: 'status', name: 'status' },
            { data: 'action', name: 'action', orderable: false, searchable: false },
        ],
    });
    window.__medWfTables.push(table);
});
</script>
@endsection
