@extends('layouts.app')
@section('title', __('meddocuments::lang.doc_types'))
@section('content')
<section class="content-header"><h1>@lang('meddocuments::lang.doc_types')</h1></section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        @slot('tool')
            <div class="box-tools">
                <button class="btn btn-primary meddoc-modal-btn" data-href="{{ route('meddoc.types.create') }}"><i class="fa fa-plus"></i> @lang('messages.add')</button>
            </div>
        @endslot
        <p class="text-muted">@lang('meddocuments::lang.types_help')</p>
        <div class="table-responsive">
            <table class="table table-bordered table-striped" id="meddoc_types_table" style="width:100%">
                <thead><tr>
                    <th>@lang('meddocuments::lang.label')</th>
                    <th>@lang('meddocuments::lang.type_key')</th>
                    <th>@lang('meddocuments::lang.scope')</th>
                    <th>@lang('meddocuments::lang.retention_days')</th>
                    <th>@lang('meddocuments::lang.requires_signature')</th>
                    <th>@lang('meddocuments::lang.status')</th>
                    <th>@lang('messages.action')</th>
                </tr></thead>
            </table>
        </div>
    @endcomponent
    <div class="modal fade meddoc_modal" tabindex="-1" role="dialog"></div>
</section>
@endsection
@section('javascript')
<script>
$(function () {
    var table = $('#meddoc_types_table').DataTable({
        processing: true, serverSide: true, ajax: '{{ route('meddoc.types.data') }}',
        columns: [
            { data: 'label', name: 'label' },
            { data: 'type_key', name: 'type_key' },
            { data: 'scope', name: 'scope', orderable: false, searchable: false },
            { data: 'retention_days', name: 'retention_days' },
            { data: 'requires_signature', name: 'requires_signature', orderable: false, searchable: false },
            { data: 'is_active', name: 'is_active', orderable: false, searchable: false },
            { data: 'action', name: 'action', orderable: false, searchable: false },
        ],
    });
    window.__meddocTables = window.__meddocTables || []; window.__meddocTables.push(table);
});
</script>
@include('meddocuments::partials.crud_scripts')
@endsection
