<form id="form-add-hostel-fee" action="#">
    <div class="table-scrollable">
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>STT</th>
                <th style="width: 20%"> Tên</th>
                <th style="width: 20%"> Loại phí</th>
                <th style="width: 18%"> Đơn giá</th>
                <th> Đơn vị</th>
                <th> Thiết lập</th>
                <th style="width: 18%"> Thao tác</th>
            </tr>
            </thead>

            <input type="hidden" name="hostel_id" value="{{ $hostel->id }}"/>
            <tbody id="table-hostel-fees">
            @foreach($fees as $fee)
                <tr>
                    <td>{{ $loop->index + 1 }}</td>
                    <td> {{ $fee->name }} </td>
                    <td> {{ $fee->type_text }} </td>
                    <td>
                        @if($fee->type == \App\Models\HostelFee::ELECTRIC || $fee->type == \App\Models\HostelFee::WATER || $fee->type == \App\Models\HostelFee::DYNAMIC
                        || $fee->type == \App\Models\HostelFee::WATER_DYNAMIC || $fee->type == \App\Models\HostelFee::ELECTRIC_DYNAMIC
                        )
                            Biến động
                        @else
                            {{ number_format($fee->fee, 0, '.', '.' ) }}
                        @endif
                    </td>
                    <td>{{ $fee->unit }}</td>
                    <td>
                        @if($fee->type == \App\Models\HostelFee::ELECTRIC || $fee->type == \App\Models\HostelFee::WATER)
                            <a data-hostel="{{ $hostel->id }}" data-type="{{ $fee->type }}" data-id="{{ $fee->id }}"
                               data-target="#hostel-fee-quota" data-toggle="modal"
                               class="btn btn-sm red btn-hostel-fee-quota">Thiết lập</a>
                        @endif
                    </td>
                    <td>
                        @if($fee->type != \App\Models\HostelFee::ELECTRIC && $fee->type != \App\Models\HostelFee::WATER)
                            <a href="#" class="btn btn-sm btn-default btn-edit-fee"
                               data-fee="{{ $fee->id }}"><i
                                        class="fa fa-pencil"></i> Sửa</a>
                        @endif
                        <a href="#" class="btn btn-sm btn-default btn-delete-fee"
                           data-fee="{{ $fee->id }}"><i
                                    class="fa fa-trash"></i> Xóa</a>
                    </td>
                </tr>
            @endforeach
            </tbody>

        </table>

    </div>
</form>
<div class="center">
    <button class="btn btn-success" id="btn-add-fee" data-hostel="{{ $hostel->id }}">Thêm chi phí</button>
</div>
<div class="text-center" style="margin-top: 15px">
    <div class="alert alert-warning">
        Chú ý: Nếu bạn sửa giá của 1 dịch vụ đang áp dụng, giá sẽ được áp dụng cho các hoá đơn được tạo ra sau lần sửa này. Các hoá đơn cũ không thay đổi</div>
</div>