@extends('layouts.app')
@section('title', __('medward::lang.beds'))
@section('content')
<section class="content-header">
    <h1>{{ __('medward::lang.beds_of_ward', ['ward' => $ward->name]) }}</h1>
    <p><a href="{{ route('medward.wards.index') }}"><i class="fa fa-arrow-left"></i> @lang('medward::lang.wards')</a></p>
</section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        <div style="margin-bottom:12px;">
            <button class="btn btn-primary btn-sm medward-modal-btn" data-href="{{ route('medward.beds.create', $ward->id) }}">
                <i class="fa fa-plus"></i> @lang('medward::lang.add_bed')
            </button>
        </div>
        <div class="table-responsive">
            <table class="table table-bordered table-striped" id="medward_beds_table">
                <thead><tr>
                    <th>@lang('medward::lang.bed_number')</th>
                    <th>@lang('medward::lang.bed_type')</th>
                    <th>@lang('medward::lang.status')</th>
                    <th>@lang('medward::lang.cleaning_status')</th>
                    <th>@lang('medward::lang.actions')</th>
                </tr></thead>
            </table>
        </div>
    @endcomponent
    <div class="modal fade medward_modal" tabindex="-1" role="dialog"></div>
</section>
@endsection
@section('javascript')
@include('medward::partials.crud_scripts')
<script>
$(function () {
    var table = $('#medward_beds_table').DataTable({
        processing: true, serverSide: true,
        ajax: '{{ route('medward.wards.beds', $ward->id) }}',
        columns: [
            { data: 'bed_number', name: 'bed_number' },
            { data: 'bed_type', name: 'bed_type' },
            { data: 'status', name: 'status' },
            { data: 'cleaning_status', name: 'cleaning_status' },
            { data: 'action', name: 'action', orderable: false, searchable: false },
        ],
    });
    window.__medWardTables.push(table);
});
</script>
@endsection
