
<?php $__env->startSection('title'); ?>
<title><?php echo e($websiteLang->where('lang_key','property_purpose')->first()->custom_text); ?></title>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('admin-content'); ?>
    <!-- DataTales Example -->
    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary"><?php echo e($websiteLang->where('lang_key','property_purpose')->first()->custom_text); ?></h6>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th><?php echo e($websiteLang->where('lang_key','serial')->first()->custom_text); ?></th>
                            <th><?php echo e($websiteLang->where('lang_key','purpose')->first()->custom_text); ?></th>
                            <th><?php echo e($websiteLang->where('lang_key','status')->first()->custom_text); ?></th>
                            <th><?php echo e($websiteLang->where('lang_key','action')->first()->custom_text); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $purposes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e(++$index); ?></td>
                            <td><?php echo e($item->custom_purpose); ?></td>
                            <td>
                                <?php if($item->status==1): ?>
                                <a href="" onclick="locationStatus(<?php echo e($item->id); ?>)"><input type="checkbox" checked data-toggle="toggle" data-on="<?php echo e($websiteLang->where('lang_key','active')->first()->custom_text); ?>" data-off="<?php echo e($websiteLang->where('lang_key','inactive')->first()->custom_text); ?>" data-onstyle="success" data-offstyle="danger"></a>
                            <?php else: ?>
                                <a href="" onclick="locationStatus(<?php echo e($item->id); ?>)"><input type="checkbox" data-toggle="toggle" data-on="<?php echo e($websiteLang->where('lang_key','active')->first()->custom_text); ?>" data-off="<?php echo e($websiteLang->where('lang_key','inactive')->first()->custom_text); ?>" data-onstyle="success" data-offstyle="danger"></a>

                            <?php endif; ?>
                            </td>
                            <td>
                                <a href="javascript:;" data-toggle="modal" data-target="#updateCountry-<?php echo e($item->id); ?>" class="btn btn-primary btn-sm"><i class="fas fa-edit    "></i></a>

                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    </tbody>
                </table>
            </div>
        </div>
    </div>


    <!-- update Location Modal -->
    <?php $__currentLoopData = $purposes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="modal fade" id="updateCountry-<?php echo e($item->id); ?>" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                        <div class="modal-header">
                                <h5 class="modal-title"><?php echo e($websiteLang->where('lang_key','purpose_form')->first()->custom_text); ?></h5>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true">&times;</span>
                                    </button>
                            </div>
                    <div class="modal-body">
                        <div class="container-fluid">

                            <form action="<?php echo e(route('admin.property-purpose.update',$item->id)); ?>" method="post" enctype="multipart/form-data">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('patch'); ?>

                                <div class="form-group">
                                    <label ><?php echo e($websiteLang->where('lang_key','default_purpose')->first()->custom_text); ?></label>
                                    <input type="text" class="form-control" readonly value="<?php echo e($item->purpose); ?>">
                                </div>

                                <div class="form-group">
                                    <label for="purpose"><?php echo e($websiteLang->where('lang_key','purpose')->first()->custom_text); ?></label>
                                    <input type="text" class="form-control" name="purpose" id="purpose" value="<?php echo e($item->custom_purpose); ?>">
                                </div>





                                <div class="form-group">
                                    <label for="status"><?php echo e($websiteLang->where('lang_key','status')->first()->custom_text); ?></label>
                                    <select name="status" id="status" class="form-control">
                                        <option <?php echo e($item->status==1 ? 'selected' :''); ?> value="1"><?php echo e($websiteLang->where('lang_key','active')->first()->custom_text); ?></option>
                                        <option <?php echo e($item->status==0 ? 'selected' :''); ?> value="0"><?php echo e($websiteLang->where('lang_key','inactive')->first()->custom_text); ?></option>
                                    </select>
                                </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-dismiss="modal"><?php echo e($websiteLang->where('lang_key','close')->first()->custom_text); ?></button>
                        <button type="submit" class="btn btn-primary"><?php echo e($websiteLang->where('lang_key','update')->first()->custom_text); ?></button>
                    </div>
                </form>
                </div>
            </div>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>



    <script>


        function locationStatus(id){

            // project demo mode check
            var isDemo="<?php echo e(env('PROJECT_MODE')); ?>"
            var demoNotify="<?php echo e(env('NOTIFY_TEXT')); ?>"
            if(isDemo==0){
                toastr.error(demoNotify);
                return;
            }
            // end

            $.ajax({
                type:"get",
                url:"<?php echo e(url('/admin/property-purpose-status/')); ?>"+"/"+id,
                success:function(response){
                   toastr.success(response)
                },
                error:function(err){
                    console.log(err);

                }
            })
        }
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/cloudelite/imobi.eliteteclda.com/resources/views/admin/property-purpose/index.blade.php ENDPATH**/ ?>