<?php $__env->startSection('styles'); ?>

    <link href="/assets/global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css" rel="stylesheet" type="text/css"/>
    <link href="/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="/assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="/assets/global/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css"
          rel="stylesheet" type="text/css"/>
    <link href="/assets/global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css" rel="stylesheet" type="text/css"/>
    <link href="/assets/global/plugins/bootstrap-editable/inputs-ext/address/address.css" rel="stylesheet"
          type="text/css"/>


    <style>

        .pac-container {
            z-index: 10052 !important;
        }

        #map {
            width: auto !important;
            height: 500px !important;
        }

        #map_edit {
            width: auto !important;
            height: 500px !important;
        }

        tfoot {
            display: table-header-group;
        }

        tfoot input {
            font-weight: normal !important;
        }

        tfoot select {
            font-weight: normal !important;
        }

        .dataTables_filter {
            display: none;
        }

        #orders-table_length {
            display: none;
        }

        .ws-nr {
            width: 100% !important;
        }
    </style>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <?php if(session()->has('error')): ?>
        <div class="alert alert-danger"><?php echo e(session()->get('error')); ?></div>
    <?php endif; ?>
    <?php if(session()->has('success')): ?>
        <div class="alert alert-success"><?php echo e(session()->get('success')); ?></div>
    <?php endif; ?>
    <?php if(count($errors) > 0): ?>
        <div class="alert alert-danger">
            <ul>
                <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li><?php echo e($error); ?></li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
        </div>
    <?php endif; ?>
    <h1 class="page-title">
        Danh sách phương tiện
    </h1>

    <div class="row"
         style="padding-bottom: 15px; margin-right: 0px; margin-left: 0px; padding-top: 15px; margin-bottom: 15px; border-bottom: 1px solid #e7ecf1; background-color: #EFF2F5">
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-2">
                    <label class="control-label">Chọn nhà</label>
                </div>
                <div class="col-md-10">
                    <select class="form-control" id="hostels">
                        <option value="">Tất cả nhà</option>
                        <?php

                            $hostelArrs = \App\Models\Hostel::where('owner_id', auth('backend')->user()->id)->pluck('id')->toArray();

                             if(auth('backend')->user()->type == \App\User::STAFF) {
                         $hostelArrs = \App\Components\Functions::getHostelArrStaff();

                        }

                                $hostels = \App\Models\Hostel::whereIn('id', $hostelArrs)->get();

                        ?>
                        <?php $__currentLoopData = $hostels; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $hostel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option
                                    value="<?php echo e($hostel->id); ?>"><?php echo e($hostel->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">

            <div class="row">
                <div class="col-md-12" id="hostels-button">
                    <a style="margin-left: 10px" class="btn green-meadow pull-right btn-export-excel"
                       data-type="outcome"
                       href="#">
                        <i class="fa fa-file-excel"></i> Xuất Excel</a>
                    <a style="margin-left: 10px" class="btn red pull-right btn-add" id="btn-add-bike"
                       href="#add-bike" data-toggle="modal">
                        <i class="fa fa-file-excel"></i> Thêm </a>

                </div>
            </div>
        </div>


    </div>
    <div class="row">
        
        
        
        <div class="col-md-12">
            <table class="table table-striped table-bordered table-hover" id="orders-table">
                <thead>
                <tr style="background-color: #5376B9; color: white">
                    <th>STT</th>
                    <th>Tên</th>
                    <th>Loại</th>
                    <th>BKS</th>
                    <th>Hình Ảnh</th>
                    <th>Nhà</th>
                    <th>Phòng</th>
                    <th>Người thuê</th>
                    <th>Hành động</th>
                </tr>
                </thead>
                <tfoot>
                <tr>
                    <th></th>
                    <th><input type="text" class="form-control"></th>
                    <th>
                        <select class="form-control" style="font-weight: normal">
                            <option value="">Vui lòng chọn</option>
                            <option value="<?php echo e(\App\Models\RenterRoom::MOTORBIKE); ?>">Xe máy</option>
                            <option value="<?php echo e(\App\Models\RenterRoom::ELECTRIC_BIKE); ?>">Xe điện</option>
                            <option value="<?php echo e(\App\Models\RenterRoom::BICYCLE); ?>">Xe đạp</option>
                            <option value="<?php echo e(\App\Models\RenterRoom::CAR); ?>">Ô tô</option>
                        </select>
                    </th>
                    <th><input type="text" class="form-control"></th>
                    <th>
                        <input type="text" class="form-control">
                    </th>
                    <th>
                        <select class="form-control" style="font-weight: normal">
                            <option value="">Vui lòng chọn</option>

                            <?php $__currentLoopData = $hostels; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $hostel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($hostel->id); ?>"><?php echo e($hostel->name); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </th>
                    <th>
                        <select class="form-control" style="font-weight: normal">
                            <option value="">Vui lòng chọn</option>
                            <?php $__currentLoopData = $rooms; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $room): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($room->id); ?>"><?php echo e($room->name); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </th>
                    <th>
                        <?php
                            $roomArrs = $rooms->pluck('id')->toArray();
                                $renters = \App\Models\RenterBike::join('users', 'renter_bikes.renter_id', '=', 'users.id')
                        ->whereIn('renter_bikes.room_id', $roomArrs)
                        ->groupBy('renter_bikes.renter_id')
                        ->get();
                        ?>
                        <select class="form-control" style="font-weight: normal">
                            <option value="">Vui lòng chọn</option>
                            <?php $__currentLoopData = $renters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $renter): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($renter->id); ?>"><?php echo e($renter->name); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </th>
                    <th></th>
                </tr>
                </tfoot>
            </table>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12" id="detail">
        </div>
    </div>



    <div class="modal fade bs-modal-lg" id="edit-renter" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">Cập nhật thông tin khách thuê</h4>
                </div>
                <div class="modal-body" id="edit-renter-content">


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn dark btn-outline" data-dismiss="modal" id="dismiss-modal">Hủy
                    </button>
                    <button type="button" class="btn green" id="btn-save-edit-renter">Lưu</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

    <div class="modal fade bs-modal-lg" id="add-bike" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close2" data-dismiss="modal" aria-hidden="true"><span
                                aria-hidden="true" style="
    color: white;
">×</span></button>
                    <h4 class="modal-title">Thêm xe</h4>
                </div>
                <div class="modal-body" id="add-bike-content">


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn dark btn-outline" data-dismiss="modal" id="dismiss-modal">Hủy
                    </button>
                    <button type="button" class="btn green" id="btn-save">Lưu</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

    <div class="modal fade bs-modal-lg" id="edit-bike" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close2" data-dismiss="modal" aria-hidden="true"><span
                                aria-hidden="true" style="
    color: white;
">×</span></button>
                    <h4 class="modal-title">Sửa xe</h4>
                </div>
                <div class="modal-body" id="edit-bike-content">


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn dark btn-outline" data-dismiss="modal" id="dismiss-modal">Hủy
                    </button>
                    <button type="button" class="btn green" id="btn-save-edit">Lưu</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
    <script src="/assets/global/plugins/dropzone/dropzone.min.js" type="text/javascript"></script>
    <script src="/assets/pages/scripts/form-dropzone.min.js" type="text/javascript"></script>
    <script src="/assets/global/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
    <script src="/assets/global/plugins/jquery-validation/js/additional-methods.min.js" type="text/javascript"></script>
    <script type="text/javascript"
            src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCydLs7dhJPuozABFQjJO-uk1PITW18oo8&libraries=places&region=vi&language=vi&sensor=false"></script>
    <script type="text/javascript" src="/js/gmap.js"></script>

    <script>
        $.validator.addMethod("greaterThan",
            function (value, element, param) {
                var $otherElement = $(param);
                return parseInt(value, 10) >= parseInt($otherElement.val(), 10);
            }
        );
    </script>


<?php $__env->stopPush(); ?>


<?php $__env->startPush('scripts'); ?>
    
    

    
    
    
    


    
    
    
    
    

    <script>
        var table;

        //    $(document).on('change', '.add-image-hostel', function(e) {
        //        alert('123');
        //       $('.fileinput-exists').css({
        //           'width' : '48%'
        //       });
        //
        //      $('.btn-file').css({
        //          'width' : '100%'
        //      });
        //
        //
        //    });

        $('#hostels').on('change', function () {
            table.ajax.reload();
        });

        $(document).off('click', '.btn-edit-renter').on('click', '.btn-edit-renter', function (e) {

            e.preventDefault();

            var renter_id = $(this).attr('data-renter');


            $.ajax({
                url: '<?php echo e(url('admin2/renter/edit')); ?>' + '/' + renter_id,
                type: 'get',
                dataType: 'json',
                beforeSend: function () {
                    $('#edit-renter-content').addClass('ht-on-loading');
                },
                success: function (response) {
                    $('#edit-renter-content').removeClass('ht-on-loading').html(response.data);
                    $('.select2').select2();
                    $('.datepicker').datepicker({
                        format: 'dd/mm/yyyy',
                        autoclose: true
                    });
                }
            });

        });

        $(document).on('click', '.btn-export-excel', function (e) {
            e.preventDefault();
            var hostel_id = $('#hostels').val();
            var url = '<?php echo url('admin2/bike/bike.data'); ?>' + '?is_export=1&hostel_id=' + hostel_id;
            window.location.href = url;
        });


        $(function () {

//        $('#orders-table tfoot th').each( function (index) {
//            if(index != 0 && index != 9) {
//                $(this).html('<input type="text" class="form-control" />');
//            }
//        } );
            table = $('#orders-table').DataTable({
                "bDestroy": true,
                processing: true,
                searching: true,
                "aaSorting": [[0, 'desc']],
                serverSide: true,
                ajax: {
                    url: '<?php echo url('admin2/bike/bike.data'); ?>',
                    data: function (d) {
                        d.hostel_id = $('#hostels').val()
                    }
                },
                columns: [
                    {data: 'DT_Row_Index', name: 'DT_Row_Index', orderable: false, searchable: false},
                    {data: 'name', name: 'name'},
                    {data: 'type', name: 'type'},
                    {data: 'bks', name: 'bks'},
                    {data: 'image', name: 'image'},
                    {data: 'hostel_id', name: 'hostel_id'},
                    {data: 'room_id', name: 'room_id'},
                    {data: 'renter_id', name: 'renter_id'},

                    {data: 'action', name: 'action'},

                ],
            });


            table.columns().every(function (index) {
                if (index !== 0 && index !== 1) {
                    var that = this;
                    $('input', this.footer()).on('keyup change', function () {
                        if (that.search() !== this.value) {
                            that
                                .search(this.value)
                                .draw();
                        }
                    });

                    $('select', this.footer()).on('change', function () {
                        if (that.search() !== this.value) {
                            that
                                .search(this.value)
                                .draw();
                        }
                    });
                }
            });

        });


        $(document).on('change', '#province_id', function (e) {
            var id = $(this).val();
            $.ajax({
                url: '<?php echo e(url('get-sub-location')); ?>',
                type: 'get',
                data: {
                    'id': $(this).val(),
                    'type': 'province',
                },
                dataType: 'html',
                success: function (response) {
                    $('#district_id').html(response);
                    $('#ward_id').html('');
                    getCoor(id, 'province');


                }
            });
        });

        $(document).on('change', '#district_id', function (e) {
            var id = $(this).val();
            $.ajax({
                url: '<?php echo e(url('get-sub-location')); ?>',
                type: 'get',
                data: {
                    'id': $(this).val(),
                    'type': 'district'
                },
                dataType: 'html',
                success: function (response) {
                    $('#ward_id').html(response);
                    getCoor(id, 'district');
                }
            });
        });

        $(document).on('click', '#btn-add-bike-2', function (e) {
            e.preventDefault();
            var renter_id = $(this).attr('data-renter');
            var room_id = $(this).attr('data-room');

            $.ajax({
                url: '<?php echo e(url('admin2/room/get-add-bike')); ?>',
                type: 'get',
                dataType: 'json',
                success: function (response) {
                    $('#renter-bikes-2').append(response.data);
                }
            });


        });


        $(document).on('click', '.btn-delete-bike-js', function (e) {
            e.preventDefault();
            $(this).closest('.row').remove();
        });

        $(document).on('click', '.btn-delete-bike', function (e) {
            e.preventDefault();

            var id = $(this).attr('data-id');
            var that = this;

            bootbox.confirm({
                message: "Bạn có chắc chắn muốn xóa",
                buttons: {
                    confirm: {
                        label: 'Có',
                        className: 'btn-success'
                    },
                    cancel: {
                        label: 'Không',
                        className: 'btn-danger'
                    }
                },


                callback: function (result) {
                    if (result == true) {
                        $.ajax({
                            url: '<?php echo e(url('admin2/room/delete-bike')); ?>',
                            type: 'post',
                            data: {
                                id: id
                            },
                            dataType: 'json',
                            success: function (response) {
                                swal('Xóa thành công', '', 'success');
                                $(that).closest('tbody').html(response.data);
                            }
                        });
                    }
                }
            });
        });

        //    $(document).on('change', '#ward_id', function (e) {
        //        var id = $(this).val();
        //        getCoor(id, 'ward');
        //    });


        $(document).on('click', '#btn-save-edit-renter', function (e) {
            e.preventDefault();

            var form = $('#form-edit-renter')[0];
            var data = new FormData(form);

            var formStatus = $('#form-edit-renter').validate({
                errorElement: "span",
                errorClass: "help-block help-block-error",

                highlight: function (e) {
                    $(e).closest(".form-group").addClass("has-error")
                },
                unhighlight: function (e) {
                    $(e).closest(".form-group").removeClass("has-error")
                },
                success: function (e) {
                    e.closest(".form-group").removeClass("has-error")
                },
                rules: {
                    'name': "required",
                    //  'amenities[]': "required",
                    'phone': {
                        required: true,
                        number: true
                    },
                    'date_join': {
                        required: true,
                    },
                    'residence_status': {
                        required: true,
                    },
                },
                messages: {
                    'name': "Không được bỏ trống tên",
                    'phone': "Không được bỏ trống SĐT",
                    'date_join': "Không được bỏ trống ngày vào",
                    'residence_status': "Không được bỏ trống khai báo tạm trú",
                    // 'amenities[]': "Không được bỏ trống tiện ích"
                }
            }).form();

            if (formStatus) {
                $.ajax({
                    url: '<?php echo e(url('admin2/renter/edit')); ?>',
                    type: 'post',
                    data: data,
                    dataType: 'json',
                    contentType: false,
                    processData: false,

                    beforeSend: function () {
                        $('#edit-renter-content').addClass('ht-on-loading');
                    },
                    success: function (response) {
                        $('#edit-renter-content').removeClass('ht-on-loading');
                        if (response.status == 1) {
                            swal('Thành công', 'Dữ liệu đã được cập nhật', 'success');
                            table.ajax.reload();
                            $('#edit-renter').modal('hide');
                        }

                        if (response.status == 0) {
                            swal('Thông báo', response.message, 'info');
                            $('#edit-renter').modal('hide');
                        }

                    }
                });
            }
        });


        $(document).on('change', '#edit-renter-residence-status', function (e) {
            var residence_status = $(this).val();
            if (residence_status !== '<?php echo e(\App\Models\RenterRoom::RESIDENCE_LIMIT); ?>') {
                $('#edit-renter-date-end-residence').hide();
            } else {
                $('#edit-renter-date-end-residence').show();
            }
        });

        $(document).on('change', '#province2', function (e) {
            $.ajax({
                url: '<?php echo e(url('get-sub-location')); ?>',
                type: 'get',
                data: {
                    'id': $(this).val(),
                    'type': 'province',
                },
                dataType: 'html',
                success: function (response) {
                    $('#district1').html(response);
                    $('#ward1').html('');
                    $('.select2').select2();

                }
            });
        });

        $(document).on('change', '#district1', function (e) {
            $.ajax({
                url: '<?php echo e(url('get-sub-location')); ?>',
                type: 'get',
                data: {
                    'id': $(this).val(),
                    'type': 'district'
                },
                dataType: 'html',
                success: function (response) {
                    $('#ward1').html(response);
                    $('.select2').select2();
                }
            });
        });
        $(document).on('click', '.btn-delete-bike-list', function (e) {
            e.preventDefault();

            var id = $(this).attr('data-id');
            var that = this;

            bootbox.confirm({
                message: "Bạn có chắc chắn muốn xóa",
                buttons: {
                    confirm: {
                        label: 'Có',
                        className: 'btn-success'
                    },
                    cancel: {
                        label: 'Không',
                        className: 'btn-danger'
                    }
                },


                callback: function (result) {
                    if (result == true) {
                        $.ajax({
                            url: '<?php echo e(url('admin2/room/delete-bike')); ?>',
                            type: 'post',
                            data: {
                                id: id
                            },
                            dataType: 'json',
                            success: function (response) {
                                swal('Xóa thành công', '', 'success');
                                $(that).parents('tr').remove();
                            }
                        });
                    }
                }
            });
        });

        $(document).on('click', '#btn-add-bike', function () {
            $.ajax({
                url: '<?php echo e(url('admin2/bike/create')); ?>',
                type: 'get',
                dataType: 'json',
                beforeSend: function () {
                    $('#add-bike-content').addClass('ht-on-loading');
                },
                success: function (response) {
                    $('#add-bike-content').removeClass('ht-on-loading').html(response.data);
                }
            });
        });

        $(document).on('click', '.btn-edit', function () {
            $.ajax({
                url: '<?php echo e(url('admin2/bike/edit')); ?>',
                type: 'get',
                data: {
                    id: $(this).attr('data-id')
                },
                dataType: 'json',
                beforeSend: function () {
                    $('#edit-bike-content').addClass('ht-on-loading');
                },
                success: function (response) {
                    $('#edit-bike-content').removeClass('ht-on-loading').html(response.data);
                }
            });
        });

        $(document).on('change', '#hostel_id', function () {
            $.ajax({
                url: '<?php echo e(url('admin2/hostel/select-rooms')); ?>',
                type: 'get',
                data: {
                    hostel_id: $(this).val()
                },
                dataType: 'json',
                success: function (response) {
                    $('#room_id').html(response.data);
                }
            })
        });

        $(document).on('change', '#room_id', function () {
            $.ajax({
                url: '<?php echo e(url('admin2/renter/renter-by-room')); ?>',
                type: 'get',
                data: {
                    room_id: $(this).val()
                },
                dataType: 'json',
                success: function (response) {
                    $('#renter_id').html(response.data);
                }
            })
        });

        $(document).on('click', '#clear-input-file', function () {
        $('.fileinput').fileinput('reset');
        });

        $('#btn-save').click(function (e) {
            e.preventDefault();

            var formStatus = $('#form-add-bike').validate({
                errorElement: "span",
                errorClass: "help-block help-block-error",

                highlight: function (e) {
                    $(e).closest(".form-group").addClass("has-error")
                },
                unhighlight: function (e) {
                    $(e).closest(".form-group").removeClass("has-error")
                },
                success: function (e) {
                    e.closest(".form-group").removeClass("has-error")
                },
                rules: {
                    'name': "required",
                    //  'amenities[]': "required",
                    'type': {
                        required: true,
                    },
                    'hostel_id': {
                        required: true,
                    },
                    'room_id': {
                        required: true,
                    },
                    'renter_id': {
                        required: true,
                    },
                },
                messages: {
                    'type': "Không được bỏ trống Loại xe",
                    'name': "Không được bỏ trống tên",
                    'hostel_id': "Không được bỏ trống nhà",
                    'room_id': "Không được bỏ trống phòng",
                    'renter_id': "Không được bỏ trống người thuê",
                }
            }).form();

            if (formStatus) {

                var data = new FormData($('#form-add-bike')[0]);
                $.ajax({
                    url: '<?php echo e(url('admin2/bike/create')); ?>',
                    type: 'post',
                    data: data,
                    dataType: 'json',
                    processData: false,
                    contentType: false,
                    beforeSend: function () {
                        $('#add-bike-content').addClass('ht-on-loading');
                    },
                    success: function (response) {
                        $('#add-bike-content').removeClass('ht-on-loading');

                        if (response.status == 1) {
                            swal('Thành công', 'Dữ liệu đã được lưu lại', 'success');
                            $('#add-bike').modal('hide');

                        } else if (response.status == 0) {
                            swal('Thông báo', response.message, 'warning');
                        } else if (response.status == 2) {
                            swal('Thông báo', response.message, 'info');
                        }
                        table.ajax.reload();
                    }
                });
            }
        });

        $('#btn-save-edit').click(function (e) {
            e.preventDefault();

            var formStatus = $('#form-add-bike').validate({
                errorElement: "span",
                errorClass: "help-block help-block-error",

                highlight: function (e) {
                    $(e).closest(".form-group").addClass("has-error")
                },
                unhighlight: function (e) {
                    $(e).closest(".form-group").removeClass("has-error")
                },
                success: function (e) {
                    e.closest(".form-group").removeClass("has-error")
                },
                rules: {
                    'name': "required",
                    //  'amenities[]': "required",
                    'type': {
                        required: true,
                    },
                    'hostel_id': {
                        required: true,
                    },
                    'room_id': {
                        required: true,
                    },
                    'renter_id': {
                        required: true,
                    },
                },
                messages: {
                    'type': "Không được bỏ trống Loại xe",
                    'name': "Không được bỏ trống tên",
                    'hostel_id': "Không được bỏ trống nhà",
                    'room_id': "Không được bỏ trống phòng",
                    'renter_id': "Không được bỏ trống người thuê",
                }
            }).form();

            if (formStatus) {

                var data = new FormData($('#form-add-bike')[0]);
                $.ajax({
                    url: '<?php echo e(url('admin2/bike/update')); ?>',
                    type: 'post',
                    data: data,
                    dataType: 'json',
                    processData: false,
                    contentType: false,
                    beforeSend: function () {
                        $('#add-bike-content').addClass('ht-on-loading');
                    },
                    success: function (response) {
                        $('#add-bike-content').removeClass('ht-on-loading');

                        if (response.status == 1) {
                            swal('Thành công', 'Dữ liệu đã được lưu lại', 'success');
                            $('#add-bike').modal('hide');
                            $('#edit-bike').modal('hide');
                        } else if (response.status == 0) {
                            swal('Thông báo', response.message, 'warning');
                        } else if (response.status == 2) {
                            swal('Thông báo', response.message, 'info');
                        }
                        table.ajax.reload();
                    }
                });
            }
        });

    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('admin2', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>