@extends('layouts.app')

@section('title', __('bms::lang.packages'))

@section('content')

<section class="content-header">
    <h1>@lang('bms::lang.packages')</h1>
</section>

<section class="content">
    @component('components.widget', ['class' => 'box-primary', 'title' => __('bms::lang.packages')])
        @can('bms.packages.manage')
            @slot('tool')
                <div class="box-tools">
                    <button type="button" class="tw-dw-btn tw-dw-btn-primary tw-text-white bms-modal-btn"
                        data-href="{{ route('bms.packages.create') }}" data-container=".bms_modal">
                        <i class="fa fa-plus"></i> @lang('messages.add')
                    </button>
                </div>
            @endslot
        @endcan

        <div class="table-responsive">
            <table class="table table-bordered table-striped" id="bms_packages_table">
                <thead>
                    <tr>
                        <th>@lang('bms::lang.package')</th>
                        <th>@lang('bms::lang.hall')</th>
                        <th>@lang('bms::lang.fnb_level')</th>
                        <th>@lang('bms::lang.price')</th>
                        <th>@lang('bms::lang.status')</th>
                        <th>@lang('messages.action')</th>
                    </tr>
                </thead>
            </table>
        </div>
    @endcomponent

    <div class="modal fade bms_modal" tabindex="-1" role="dialog"></div>
</section>

@endsection

@section('javascript')
<script>
$(function () {
    var table = $('#bms_packages_table').DataTable({
        processing: true,
        serverSide: true,
        ajax: '{{ route('bms.packages.index') }}',
        columns: [
            { data: 'name', name: 'bms_packages.name' },
            { data: 'hall_name', name: 'bms_halls.name' },
            { data: 'fnb_level', name: 'bms_packages.fnb_level' },
            { data: 'price', name: 'bms_packages.price' },
            { data: 'is_active', name: 'bms_packages.is_active', orderable: false, searchable: false },
            { data: 'action', name: 'action', orderable: false, searchable: false },
        ],
        fnDrawCallback: function () { __currency_convert_recursively($('#bms_packages_table')); },
    });
    window.__bmsTables = window.__bmsTables || [];
    window.__bmsTables.push(table);
});
</script>
@include('bms::partials.crud_scripts')
@endsection
