
<?php $__env->startSection('title'); ?>
    <title><?php echo e(__('admin.Property Purpose')); ?></title>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('admin-content'); ?>
    <!-- Main Content -->
    <div class="main-content">
        <section class="section">
            <div class="section-header">
                <h1><?php echo e(__('admin.Property Purpose')); ?></h1>
            </div>
            <div class="section-body">

                <div class="row mt-4">
                    <div class="col">
                        <div class="card">
                            <div class="card-body">
                                <div class="table-responsive table-invoice">
                                    <table class="table table-striped">
                                        <thead>
                                            <tr>
                                                <th><?php echo e(__('admin.SN')); ?></th>
                                                <th><?php echo e(__('admin.Purpose')); ?></th>
                                                <th><?php echo e(__('admin.Translations')); ?></th>
                                                <th><?php echo e(__('admin.Status')); ?></th>
                                                <th><?php echo e(__('admin.Action')); ?></th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php $__currentLoopData = $purposes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $purpose): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <tr>
                                                    <td><?php echo e(++$index); ?></td>
                                                    <td><?php echo e($purpose->purpose); ?></td>
                                                    <td>
                                                        <?php $__empty_1 = true; $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                                            <i
                                                                class="fa <?php echo e($purpose->translation($language->code)?->first()?->custom_purpose ? 'fa-check' : 'fa-edit'); ?>"></i>
                                                            <a
                                                                href="<?php echo e(route('admin.property-purpose.translation', ['id' => $purpose->id, 'code' => $language->code])); ?>"><?php echo e(strtoupper($language->code)); ?></a>
                                                            <?php if(!$loop->last): ?>
                                                                ||
                                                            <?php endif; ?>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                                            <a
                                                                href="<?php echo e(route('admin.property-purpose.translation', ['id' => $purpose->id, 'code' => $language->code])); ?>"><?php echo e(strtoupper(config('app.locale'))); ?></a>
                                                        <?php endif; ?>
                                                    </td>
                                                    <td>
                                                        <?php if($purpose->status == 1): ?>
                                                            <a href="javascript:;"
                                                                onclick="changeBlogCategoryStatus(<?php echo e($purpose->id); ?>)">
                                                                <input id="status_toggle" type="checkbox" checked
                                                                    data-toggle="toggle" data-on="<?php echo e(__('admin.Active')); ?>"
                                                                    data-off="<?php echo e(__('admin.Inactive')); ?>"
                                                                    data-onstyle="success" data-offstyle="danger">
                                                            </a>
                                                        <?php else: ?>
                                                            <a href="javascript:;"
                                                                onclick="changeBlogCategoryStatus(<?php echo e($purpose->id); ?>)">
                                                                <input id="status_toggle" type="checkbox"
                                                                    data-toggle="toggle" data-on="<?php echo e(__('admin.Active')); ?>"
                                                                    data-off="<?php echo e(__('admin.Inactive')); ?>"
                                                                    data-onstyle="success" data-offstyle="danger">
                                                            </a>
                                                        <?php endif; ?>
                                                    </td>
                                                    <td>

                                                        <a href="javascript:;" data-toggle="modal"
                                                            data-target="#modelId-<?php echo e($purpose->id); ?>"
                                                            class="btn btn-primary btn-sm"><i class="fa fa-edit"
                                                                aria-hidden="true"></i></a>
                                                </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
        </section>
    </div>


    <?php $__currentLoopData = $purposes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $purpose): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <!-- Modal -->
        <div class="modal fade" id="modelId-<?php echo e($purpose->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(__('admin.Edit Property Purpose')); ?></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', $purpose->id)); ?>" method="POST">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('PUT'); ?>

                                <div class="form-group">
                                    <label for=""><?php echo e(__('admin.Default Purpose')); ?></label>
                                    <input type="text" name="default_purpose" value="<?php echo e($purpose->purpose); ?>"
                                        class="form-control">
                                </div>

                                <div class="form-group">
                                    <label for=""><?php echo e(__('admin.Custom Purpose')); ?></label>
                                    <input type="text" name="purpose" value="<?php echo e($purpose->custom_purpose); ?>"
                                        class="form-control">
                                </div>

                                <div class="form-group">
                                    <label><?php echo e(__('admin.Status')); ?> <span class="text-danger">*</span></label>
                                    <select name="status" class="form-control">
                                        <option <?php echo e($purpose->status == 1 ? 'selected' : ''); ?> value="1">
                                            <?php echo e(__('admin.Active')); ?></option>
                                        <option <?php echo e($purpose->status == 0 ? 'selected' : ''); ?> value="0">
                                            <?php echo e(__('admin.Inactive')); ?></option>
                                    </select>
                                </div>



                                <button type="submit" class="btn btn-primary"><?php echo e(__('admin.Update')); ?></button>
                            </form>
                        </div>
                    </div>

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



    <script>
        function changeBlogCategoryStatus(id) {
            var isDemo = "<?php echo e(env('PROJECT_MODE')); ?>"
            if (isDemo == 0) {
                toastr.error('This Is Demo Version. You Can Not Change Anything');
                return;
            }

            $.ajax({
                type: "put",
                data: {
                    _token: '<?php echo e(csrf_token()); ?>'
                },
                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('admin.master_layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home3/paprdcor/topriserealtors.com/resources/views/admin/property_purpose.blade.php ENDPATH**/ ?>