<style>

    span.badge {
        font-size: 13px !important;
        padding: 10px !important;
    }

</style>
<?php $__env->startSection('content'); ?>
    <?php if(session('success')): ?>
        <div class="alert alert-success alert-dismissable fade show">
            <button class="close" data-dismiss="alert" aria-label="Close">×</button>
            <?php echo e(session('success')); ?>

        </div>
    <?php endif; ?>
    <!-- row -->
    <div class="row row-sm">
        <div class="col-xl-12">
            <div class="card">
                <div class="card-header pb-0">
                    <div class="d-flex justify-content-between">
                        <div class="col-lg-12 margin-tb">
                            <h5 class="pull-right alert alert-sm alert-danger">فلترة الشركات حسب نوع الاشتراك </h5>
                        </div>
                        <br>
                    </div>
                </div>
                <div class="card-body">
                    <form action="<?php echo e(route('subscriptions.filter.post')); ?>" method="POST">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('POST'); ?>
                        <div class="row mt-2 mb-2">
                            <div class="col-lg-4 pull-right">
                                <div class="form-group">
                                    <label class="d-block" for="">
                                        اختر نوع الاشتراك
                                    </label>
                                    <select name="type_id" required class="form-control" id="">
                                        <option value="">اختر نوع الاشتراك</option>
                                        <?php $__currentLoopData = $types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($type->id); ?>"><?php echo e($type->type_name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-4 pull-right">
                                <button style="margin-top: 25px;" type="submit" class="btn btn-md btn-danger">
                                    <i class="fa fa-check"></i>
                                    عرض الشركات
                                </button>
                            </div>
                        </div>
                    </form>
                    <div class="clearfix"></div>
                    <hr/>
                    <?php if(isset($subscriptions)): ?>
                        <?php if(!$subscriptions->isEmpty()): ?>
                            <div class="table-responsive">
                                <table
                                    class="table table-condensed table-striped table-bordered text-center table-hover">
                                    <thead>
                                    <tr>
                                        <th class="text-center">#</th>
                                        <th class="text-center">اسم الشركة</th>
                                        <th class="text-center">نوع الاشتراك</th>
                                        <th class="text-center">فترة الاشتراك بالايام</th>
                                        <th style="width: 15% !important;" class="text-center">البداية</th>
                                        <th style="width: 15% !important;" class="text-center">النهاية</th>
                                        <th class="text-center">حالة</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                        $i=0;
                                    ?>
                                    <?php $__currentLoopData = $subscriptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $subscription): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td><?php echo e(++$i); ?></td>
                                            <td><?php echo e($subscription->company->company_name); ?></td>
                                            <td><?php echo e($subscription->type->type_name); ?></td>
                                            <td><?php echo e($subscription->type->period); ?></td>
                                            <td><?php echo e($subscription->start_date); ?></td>
                                            <td><?php echo e($subscription->end_date); ?></td>
                                            <td>
                                                <?php if($subscription->status == 'active'): ?>
                                                    <span class="badge badge-success">
                                                    مفعل
                                                </span>
                                                <?php elseif($subscription->status == 'blocked'): ?>
                                                    <span class="badge badge-danger">
                                                    معطل
                                                </span>
                                                <?php endif; ?>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                            <div class="clearfix"></div>
                            <div class="col-lg-4 pull-right bg-danger text-white p-1 m-1">
                                عدد الشركات :
                                <?php echo e($i); ?>

                            </div>
                        <?php else: ?>
                            <p class="alert alert-sm alert-danger text-center">
                                لا يوجد شركات لهذا النوع من الاشتراكات
                            </p>
                        <?php endif; ?>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<script src="<?php echo e(asset('app-assets/js/jquery.min.js')); ?>"></script>
<script>
    $(document).ready(function () {

    });
</script>

<?php echo $__env->make('admin.layouts.app-main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/barasys/public_html/resources/views/admin/subscriptions/filter.blade.php ENDPATH**/ ?>