@extends('layouts.app')
@section('title', __('medorganization::lang.staff_assignments'))
@section('content')
<section class="content-header"><h1>@lang('medorganization::lang.staff_assignments')
    <small>@lang('medorganization::lang.staff_assignments_help')</small>
</h1></section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        @slot('tool')<div class="box-tools"><button class="btn btn-primary medorg-modal-btn" data-href="{{ route('medorg.staff-assignments.create') }}"><i class="fa fa-plus"></i> @lang('medorganization::lang.assign')</button></div>@endslot
        <table class="table table-bordered table-striped" id="medorg_assignment_table">
            <thead><tr>
                <th>@lang('medorganization::lang.user')</th>
                <th>@lang('medorganization::lang.username')</th>
                <th>@lang('medorganization::lang.department')</th>
                <th>@lang('medorganization::lang.primary')</th>
                <th>@lang('messages.action')</th>
            </tr></thead>
        </table>
    @endcomponent
    <div class="modal fade medorg_modal" tabindex="-1" role="dialog"></div>
</section>
@endsection
@section('javascript')
<script>
$(function () {
    var table = $('#medorg_assignment_table').DataTable({
        processing: true, serverSide: true, ajax: '{{ route('medorg.staff-assignments.index') }}',
        columns: [
            { data: 'user_name', name: 'user_name', orderable: false },
            { data: 'username', name: 'u.username' },
            { data: 'department_name', name: 'd.name' },
            { data: 'is_primary', name: 'ud.is_primary', orderable: false },
            { data: 'action', name: 'action', orderable: false, searchable: false },
        ],
    });
    window.__medorgTables = window.__medorgTables || []; window.__medorgTables.push(table);
});
</script>
@include('medorganization::partials.crud_scripts')
@endsection
