 
 <?php $__env->startSection('content'); ?>
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.5.0/css/flag-icon.min.css">     
 <style>
    .world-icon{
        width: 27px;
    }
 </style>

     <!--page-content-wrapper-->
     <div class="page-content-wrapper">
         <div class="page-content">
             <div class="row">
                 <div class="col-lg-12 ">
                     <div class="card radius-10">
                         <div class="card-header">
                          <!--   <h5 class="mb-0">Filter Public Offers</h5>
                         </div>
                         <div class="card-body">
                             <form action="<?php echo e(url('publisher/offer/search')); ?>" method="get">
                                 <?php echo csrf_field(); ?>
                                 <div class="row">
                                     <div class="col-lg-4">
                                         <label class="form-label">Countries</label>

                                         <select class="select2 form-control select2-multiple" data-toggle="select2"
                                             multiple="multiple" data-placeholder="Choose Country..." name="countries[]">

                                             <?php $__currentLoopData = $country; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $q): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                 <option value="<?php echo e($q->country_name); ?>"><?php echo e($q->country_name); ?></option>
                                             <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                         </select>
                                     </div>
                                     <div class="col-lg-3">
                                         <label class="form-label">Name</label>
                                         <input type="" name="name" class="form-control"
                                             placeholder="Enter Name Keyword" id="name">
                                         <input type="hidden" name="page_type" class="form-control"
                                             placeholder="Enter Name Keyword" value="public_offer">
                                         <input type="hidden" name="offer_type" class="form-control"
                                             placeholder="Enter Name Keyword" value="public">
                                     </div>
                                     <div class="col-lg-2">
                                         <label class="form-label">Offer ID</label>
                                         <input type="" name="id" class="form-control"
                                             placeholder="Enter Offer ID" id="id">
                                     </div>

                                     <div class="col-lg-3">
                                         <label class="form-label">Targeting</label>

                                         <select name="ua_target[]" id="ua_target"
                                             class="select2 form-control select2-multiple" data-toggle="select2"
                                             multiple="multiple" data-placeholder="Choose Device...">

                                             <option value="Windows">Windows</option>
                                             <option value="Android">Android</option>
                                             <option value="Iphone">Iphone</option>
                                             <option value="Ipad">Ipad</option>
                                             <option value="Mac">Mac</option>

                                         </select>
                                     </div>


                                     <div class="col-lg-4">
                                         <label class="form-label">Category</label>
                                         <select name="category[]" class="select2 form-control select2-multiple"
                                             data-toggle="select2" multiple="multiple"
                                             data-placeholder="Choose Category...">

                                             <?php $__currentLoopData = $category; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $q): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                 <option value="<?php echo e($q->id); ?>"><?php echo e($q->category_name); ?></option>
                                             <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                         </select>
                                     </div>


                                     <div class="col-lg-3">
                                         <label class="form-label">Order</label>
                                         <select type="text" name="ascending" id="ascending" class="form-control">

                                             <option value="desc">Descending</option>
                                             <option value="asc">Ascending</option>
                                         </select>
                                     </div>
                                     <div class="col-lg-2 " style="margin-top: 28px">

                                         <button type="submit" class="btn btn-primary">Search</button>

                                     </div>


                                 </div>

                                 <input type="hidden" name="offer_type" value="public">
                             </form>
                         </div>
                     </div> -->

                     <div class="row g-4">
                         <div class="col-12">
                             <div class="mb-4">
                                 <h4 class="fs-16">Public Offers</h4>
                                 <table id="offer_table" class="table table-striped dt-responsive nowrap w-100">
                                     <thead>
                                         <tr>
                                             <th>OID</th>
                                             <th>Preview Image</th>
                                             <th>Name</th>
                                             <th>Category & Verticals</th>
                                             <th>Payout</th>
                                             <th>Allowed Devices</th>
                                             <th>Allowed Countries</th>
                                             <th>Action</th>
                                         </tr>
                                     </thead>
                                     <tbody>
                                         <?php $__currentLoopData = $offers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $offer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                             <tr>
                                                 <td><?php echo e($offer->id); ?></td>
                                                 <td><a href="<?php echo e(asset('uploads/')); ?>/<?php echo e($offer->preview_url); ?>"
                                                         target="_blank"><img
                                                             src="<?php echo e(asset('uploads/')); ?>/<?php echo e($offer->preview_url); ?>"
                                                             width="100 " height="100" style="object-fit: contain;"></a>
                                                 </td>
                                                 <td><?php echo e(\Illuminate\Support\Str::limit($offer->offer_name, 20)); ?></td>
                                                 <td><?php echo e($offer->category_name); ?><br><?php echo e($offer->verticals); ?></td>
                                                 <td>
                                                     <?php if($offer->payout_type == 'revshare'): ?>
                                                         RevShare
                                                     <?php else: ?>
                                                         $<?php echo e(round(($offer->payout * $offer->payout_percentage) / 100, 2)); ?>

                                                     <?php endif; ?>
                                                 </td>
                                                 <td>
                                                     <?php  $device=explode('|',$offer->ua_target); ?>
                                                     <?php $__currentLoopData = $device; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                         <?php if($d == 'Windows'): ?>
                                                            <i class="fab fa-microsoft" title="Windows"></i>
                                                         <?php elseif($d == 'Mac'): ?>
                                                            <i class="fadeIn animated fas fa-laptop" title="Mac"></i>
                                                         <?php elseif($d == 'Iphone'): ?>
                                                            <i class="fadeIn animated fas fa-mobile-alt" title="Iphone"></i>
                                                         <?php elseif($d == 'Ipad'): ?>
                                                            <i class="fas fa-mobile" title="Ipad"></i>
                                                         <?php elseif($d == 'Android'): ?>
                                                            <i class="fadeIn animated fab fa-android" title="Android"></i>
                                                         <?php elseif($d == 'All'): ?>
                                                             <i class="fab fa-microsoft" title="Windows"></i>
                                                             <i class="fadeIn animated fas fa-mobile-alt"
                                                                 title="Iphone"></i>
                                                             <i class="fas fa-mobile" title="Ipad"></i>
                                                             <i class="fadeIn animated fab fa-android"
                                                                 title="Android"></i>
                                                             <i class="fadeIn animated fas fa-laptop" title="Mac"></i>
                                                         <?php endif; ?>
                                                     <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                 </td>
                                                 <td style="max-width:100px; white-space: normal;">
                                                    <?php
                                                        $countryNames = explode('|', $offer->countries);
                                                        $countryISOs = [];
                                                        $maxImagesToShow = 3;
                                                        
                                                        foreach ($countryNames as $index => $countryName) {
                                                            if ($index < $maxImagesToShow) {
                                                                if (trim($countryName) === 'ALL') {
                                                                    $countryISOs[] = '<img class="world-icon" src="' . config("app.url") . '/public/public/assets/assets/world.png" >';
                                                                } else {
                                                                    $country = \App\Models\Countrie::where('country_name', trim($countryName))->first();
                                                                    if ($country) {
                                                                        $countryISOs[] = '<span class="flag-icon flag-icon-' . Str::lower($country->iso) . '"></span> ';
                                                                    }
                                                                }
                                                            } else {
                                                                // If there are more countries, add a placeholder and break out of the loop
                                                                $remainingCountries = count($countryNames) - $maxImagesToShow;
                                                                $countryISOs[] = '<span>..+' . $remainingCountries . ' more</span>';
                                                                break;
                                                            }
                                                        }
                                                
                                                        echo implode($countryISOs);
                                                    ?>
                                                </td>
                                                 <td><a class="btn btn-primary"
                                                         href="<?php echo e(url('publisher/offers-details')); ?>/<?php echo e($offer->id); ?>">Get Details</a></td>
                                             </tr>
                                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                     </tbody>
                                 </table>
                                 <div class="d-flex justify-content-center">
                                    <?php echo $offers->links(); ?>

                                </div>

                             </div> <!-- end card -->
                         </div><!-- end col-->
                     </div>
                 </div>
             </div>
         </div>
     </div>
 <?php $__env->stopSection(); ?>
 <?php $__env->startSection('js'); ?>
     <script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc="
         crossorigin="anonymous"></script>
     <script src="https://xbladecdn.b-cdn.net/cnew/site/js/bootstrap-slider.js"></script>


     <script type="text/javascript">
         $(function() {

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

<?php echo $__env->make('publisher.layout.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/admin/aff.cpalider.com/backend/resources/views/publisher/offer/public_offer.blade.php ENDPATH**/ ?>