@extends('layouts.app')
@section('title', __('medaccounting::lang.periods'))
@section('content')
<section class="content-header"><h1>@lang('medaccounting::lang.periods')</h1>
    <p>@lang('medaccounting::lang.periods_help')</p>
</section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        <div style="margin-bottom:12px;">
            <button class="btn btn-primary btn-sm medacc-modal-btn" data-href="{{ route('medacc.periods.create') }}">
                <i class="fa fa-plus"></i> @lang('medaccounting::lang.add_period')
            </button>
        </div>
        <div class="table-responsive">
            <table class="table table-bordered table-striped" id="medacc_periods_table">
                <thead><tr>
                    <th>@lang('medaccounting::lang.period_name')</th>
                    <th>@lang('medaccounting::lang.start_date')</th>
                    <th>@lang('medaccounting::lang.end_date')</th>
                    <th>@lang('medaccounting::lang.status')</th>
                    <th>@lang('medaccounting::lang.actions')</th>
                </tr></thead>
            </table>
        </div>
    @endcomponent
    <div class="modal fade medacc_modal" tabindex="-1" role="dialog"></div>
</section>
@endsection
@section('javascript')
@include('medaccounting::partials.crud_scripts')
<script>
$(function () {
    var table = $('#medacc_periods_table').DataTable({
        processing: true, serverSide: true,
        ajax: '{{ route('medacc.periods.index') }}',
        columns: [
            { data: 'name', name: 'name' },
            { data: 'start_date', name: 'start_date' },
            { data: 'end_date', name: 'end_date' },
            { data: 'status', name: 'status' },
            { data: 'action', name: 'action', orderable: false, searchable: false },
        ],
        order: [[1, 'desc']],
    });
    window.__medAccTables.push(table);
});
</script>
@endsection
