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

<div class="text-end mb-3">
    <a href="<?php echo e(route('user.ptc.create')); ?>" class="btn btn--base btn-sm"><?php echo app('translator')->get('Create Advertisement'); ?></a>
</div>

<div class="custom--table-container table-responsive--md">
    <table class="table table custom--table">
        <thead>
            <tr>
                <th scope="col"><?php echo app('translator')->get('Title'); ?></th>
                <th scope="col"><?php echo app('translator')->get('Type'); ?></th>
                <th scope="col"><?php echo app('translator')->get('Viewed'); ?></th>
                <th scope="col"><?php echo app('translator')->get('Status'); ?></th>
                <th scope="col"><?php echo app('translator')->get('Action'); ?></th>
            </tr>
        </thead>
        <tbody>
            <?php $__empty_1 = true; $__currentLoopData = $ads; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ptc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr>
                <td><?php echo e(strLimit($ptc->title,20)); ?></td>
                <td>
                    <?php echo $ptc->typeBadge ?>
                </td>
                <td><?php echo e($ptc->showed); ?></td>

                <td>
                    <?php echo $ptc->statusBadge; ?>
                </td>
                <td>
                    <?php if($ptc->status == 3): ?>
                        <button class="btn btn--base btn-sm" disabled><i class="la la-pen"></i></button>
                    <?php else: ?>
                        <a class="btn btn--base btn-sm" href="<?php echo e(route('user.ptc.edit',$ptc->id)); ?>"><i class="la la-pen"></i></a>
                    <?php endif; ?>
                    <?php if($ptc->status == 1 || $ptc->status == 0): ?>
                        <?php if($ptc->status == 1): ?>
                            <a class="btn btn--danger btn-sm" href="<?php echo e(route('user.ptc.status',$ptc->id)); ?>"><i class="la la-eye-slash"></i></a>
                        <?php else: ?>
                            <a class="btn btn--success btn-sm" href="<?php echo e(route('user.ptc.status',$ptc->id)); ?>"><i class="la la-eye"></i></a>
                        <?php endif; ?>
                    <?php else: ?>
                        <button class="btn btn--danger btn-sm" disabled><i class="la la-eye-slash"></i></button>
                    <?php endif; ?>
                    <a href="javascript:void(0)" class="btn btn--primary btn-sm detailBtn" data-title="<?php echo e(strLimit($ptc->title,20)); ?>" data-duration="<?php echo e($ptc->duration); ?> <?php echo app('translator')->get('Sec'); ?>" data-max_show="<?php echo e($ptc->max_show); ?>" data-viewed="<?php echo e($ptc->showed); ?>" data-remain="<?php echo e($ptc->remain); ?>" data-amount="<?php echo e(showAmount($ptc->amount)); ?> <?php echo e($general->cur_text); ?>" data-status="<?php echo e($ptc->status); ?>" <?php if($ptc->status == 3): ?> data-reject_reason="<?php echo e($ptc->reject_reason); ?>" <?php endif; ?>>
                        <i class="la la-desktop"></i>
                    </a>
                </td>

            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td class="text-muted text-center" colspan="100%"><?php echo e(__($emptyMessage)); ?></td>
            </tr>
        <?php endif; ?>
        </tbody>
    </table>
</div>
        
<?php if($ads->hasPages()): ?>
    <div class="d-flex justify-content-end mt-4">
        <?php echo e($ads->links()); ?>

    </div>
<?php endif; ?>

<div id="detailModal" class="modal custom--modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><?php echo app('translator')->get('Details'); ?></h5>
                <span type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                    <i class="las la-times"></i>
                </span>
            </div>
            <div class="modal-body">
                <ul class="list-group adData mb-2">

                </ul>
                <div class="feedback"></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-dark btn-sm" data-bs-dismiss="modal"><?php echo app('translator')->get('Close'); ?></button>
            </div>
        </div>
    </div>
</div>

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

<?php $__env->startPush('script'); ?>
    <script>
        (function ($) {
            "use strict";
            $('.detailBtn').on('click', function () {
                var modal = $('#detailModal');
                var html = '';

                var title = $(this).data('title');
                html += `<li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><?php echo app('translator')->get('Title'); ?></span>
                        <span">${title}</span>
                    </li>`;
                
                var duration = $(this).data('duration');
                html += `<li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><?php echo app('translator')->get('Duration'); ?></span>
                        <span">${duration}</span>
                    </li>`;
                
                var maxShow = $(this).data('max_show');
                html += `<li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><?php echo app('translator')->get('Maximum Show'); ?></span>
                        <span">${maxShow}</span>
                    </li>`;
                
                var viewed = $(this).data('viewed');
                html += `<li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><?php echo app('translator')->get('Viewed'); ?></span>
                        <span">${viewed}</span>
                    </li>`;

                var remain = $(this).data('remain');
                html += `<li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><?php echo app('translator')->get('Remain'); ?></span>
                        <span">${remain}</span>
                    </li>`;

                var amount = $(this).data('amount');
                html += `<li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><?php echo app('translator')->get('Amount'); ?></span>
                        <span">${amount}</span>
                    </li>`;

                var status = $(this).data('status');
                if(status == 3){
                    var reject_reason = $(this).data('reject_reason');
                    html += `<li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><?php echo app('translator')->get('Reject Reason'); ?></span>
                        <span">${reject_reason}</span>
                    </li>`;
                }
                modal.find('.adData').html(html);
                modal.modal('show');
            });
        })(jQuery);

    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make($activeTemplate.'layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/kutwos5/public_html/core/resources/views/templates/ptc_diamond/user/ptc/ads.blade.php ENDPATH**/ ?>