<?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 khách thuê
    </h1>
    <div class="row">
        <div class="portlet-body form">
            <div class="form-body">
                <div class="form-group">
                    <form action="#" class="mt-repeater form-horizontal">
                        <div data-repeater-list="group-a">
                            <div data-repeater-item="" class="mt-repeater-item">
                                <div class="mt-repeater-input">
                                    <label class="control-label">Tỉnh / Thành phố</label>
                                    <br>
                                    <select name="province" class="form-control select2" id="province_id">
                                        <option value="">Chọn tỉnh / thành phố</option>
                                        <?php $provinces = App\Models\Province::all(); ?>
                                        <?php $__currentLoopData = $provinces; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $province): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($province->provinceid); ?>"><?php echo e($province->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                                <div class="mt-repeater-input">
                                    <label class="control-label">Quận / huyện</label>
                                    <br>
                                    <select name="district" class="form-control select2" id="district_id">
                                    </select>
                                </div>
                                <div class="mt-repeater-input">
                                    <label class="control-label">Phường / xã</label>
                                    <br>
                                    <select name="ward" class="form-control select2" id="ward_id">

                                    </select>
                                </div>
                                <div class="mt-repeater-input">
                                    <a href="javascript:;" onclick="getPostByAttr()" data-repeater-delete=""
                                       class="btn btn-danger mt-repeater-delete">
                                        <i class="fa fa-check"></i> Lọc</a>
                                </div>
                            </div>
                        </div>
                    </form>
                </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>Hình ảnh</th>
                    <th>Tên</th>
                    <th>Quê quán</th>
                    <th>SĐT</th>
                    <th>Email</th>
                    <th>Nhà</th>
                    <th style="width: 7%">Phòng trọ</th>
                    <th>Ngày vào</th>
                    <th>Tạm trú</th>
                    <th>Thời hạn tạm trú</th>
                    <th>Đã cài app</th>
                    <th>Trạng thái</th>
                    <th>Tình trạng</th>
                    <th style="width: 10%;">Thao tác</th>
                </tr>
                </thead>
                <tfoot>
                <tr>
                    <th></th>
                    <th></th>
                    <th><input type="text" class="form-control"></th>
                    <th><input type="text" class="form-control"></th>
                    <th><input type="text" class="form-control"></th>
                    <th><input type="text" class="form-control"></th>
                    <th><input type="text" class="form-control"></th>
                    <th><input type="text" class="form-control"></th>

                    <th><input type="text" class="form-control"></th>

                    <th><select class="form-control select-col" style="font-weight: normal">
                            <option value="">Vui lòng chọn</option>
                            <option value="<?php echo e(\App\Models\RenterRoom::RESIDENCE_LIMIT); ?>">Có thời hạn</option>
                            <option value="<?php echo e(\App\Models\RenterRoom::RESIDENCE_NOT_LIMIT); ?>">Không thời hạn</option>
                            <option value="<?php echo e(\App\Models\RenterRoom::RESIDENCE_NOT_DECLARE); ?>">Chưa khai báo</option>
                        </select></th>
                    <th><input type="text" class="form-control"></th>
                    <th><select class="form-control select-col" style="font-weight: normal">
                            <option value="">Vui lòng chọn</option>
                            <option value="1">Đã cài app</option>
                            <option value="2">Chưa cài app</option>

                        </select>
                    </th>
                    <th>
                        <select class="form-control select-col">
                            <option value="">Tất cả</option>
                            <option value="<?php echo e(App\User::PAYMENT_TRIAL); ?>">Dùng thử</option>
                            <option value="<?php echo e(App\User::PAYMENT_PAYING); ?>">Đang trả tiền</option>
                            <option value="<?php echo e(App\User::PAYMENT_OVER); ?>">Quá hạn</option>
                            <option value="<?php echo e(App\User::PAYMENT_NOT_USE); ?>">Không sử dụng nữa</option>
                        </select>
                    </th>
                    <th><select class="form-control select-col" style="font-weight: normal">
                            <option value="">Vui lòng chọn</option>
                            <option value="<?php echo e(\App\Models\Renter::LIVING); ?>">Đang ở</option>
                            <option value="<?php echo e(\App\Models\Renter::LEFT); ?>">Đã chuyển đi</option>
                        </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="change-password" 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">Đổi mật khẩu</h4>
                </div>
                <div class="modal-body" id="change-password-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-password">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%'
        //      });
        //
        //
        //    });


        function getPostByAttr() {
            table.ajax.reload();
        }

        $(function () {
            table = $('#orders-table').DataTable({
                "bDestroy": true,
                processing: true,
                searching: true,
                serverSide: true,
                "aaSorting": [],
                ajax: {
                    url: '<?php echo url('admin2/renter/renter.data'); ?>',
                    data: function (d) {
                        d.province_id = $('#province_id').val();
                        d.district_id = $('#district_id').val();
                        d.ward_id = $('#ward_id').val();
                    }
                },
                columns: [

                    {data: 'DT_Row_Index', name: 'DT_Row_Index', orderable: false, searchable: false},
                    {data: 'image', name: 'image'},
                    {data: 'name', name: 'name'},
                    {data: 'address', name: 'address'},
                    {data: 'phone', name: 'phone'},
                    {data: 'email', name: 'email'},
                    {data: 'hostel_id', name: 'hostel_id'},
                    {data: 'room_id', name: 'room_id'},
                    {data: 'date_joined', name: 'date_joined'},
                    {data: 'residence_status', name: 'residence_status'},
                    {data: 'date_end_residence', name: 'date_end_residence'},
                    {data: 'is_install_app', name: 'is_install_app'},
                    {data: 'payment_status', name: 'payment_status'},
                    {data: 'status', name: 'status'},
                    {data: 'action', name: 'action', 'orderable' : false, searchable: false},
                ],
            });


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

                    $('.select-col', 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('');


                }
            });
        });

        $(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);
                }
            });
        });

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


        $(document).on('click', '#btn-save-password', function (e) {
            e.preventDefault();
            var data = $('#form-change-password').serialize();
            $.ajax({
                url: '<?php echo e(url('admin/owner/change-password-ajax')); ?>',
                type: 'post',
                data: data,
                dataType: 'json',
                beforeSend: function () {
                    $('#change-password-content').addClass('ht-on-loading');
                },
                success: function (response) {
                    $('#change-password').modal('hide');
                    if (response.status == 1) {
                        swal('Thành công', '', 'success');
                    } else {
                        swal('Thông báo', response.message, 'warning');
                    }
                }
            });
        });

        $(document).on('click', '.btn-change-password', function(e) {
            var id = $(this).attr('data-id');
            var that = this;
            $.ajax({
                url: '<?php echo e(url('admin/owner/change-password')); ?>',
                type: 'get',
                data: {
                    account_id: id,
                },
                beforeSend: function()
                {
                    $('#change-password-content').addClass('ht-on-loading');
                },
                dataType: 'json',
                success: function (response) {
                    $('#change-password-content').removeClass('ht-on-loading').html(response.data);
                }
            });
        });

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