<?php $__env->startSection('content'); ?>
<?php Fun::lang()?>
<div class="title-add">
    <div class="page-bar"> 
        <ul class="page-breadcrumb"> 
            <li> <a class="ng-binding" href="#"><i class="fa fa-dashboard"></i> Dashboard</a> </li>
            <li><a href="#">Manage Agency Group</a></li>
        </ul> 
    </div>
</div>
<div class="page">
    <div class="top-content">
        <div class="row">
            <div class="col-sm-12 col-xs-12">
                <div class="title-add">
                    <div class="pull-left">
                      <h3>Agency Group</h3>
                    </div>
                </div>
                <div class="pull-right">
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Agency-GroupType-Create')): ?>
                        <a class="button_sm button_primary" href="<?php echo e(route('agency-group.create')); ?>"><span class="fa fa-plus"></span>  Create New</a>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
    <div class="box-body table-responsive">
        <table id="datatable" class="table  table-bordered table-hover nowrap">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Agency Group</th>
                    <th>Agency Group Amount</th>
                    <th>Condition Group</th>
                    <th>Percentage Group</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody>
            <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td><?php echo e($value->id); ?></td>
                    <td><?php echo e($value->agency_group_name); ?></td>
                    <td><?php echo e($value->agency_group_amount_get); ?> %</td>
                    <td><?php echo e($value->agency_group_condition); ?></td>
                    <td><?php echo e($value->agency_group_percentage); ?></td>
                    <td>
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Agency-GroupType-Edit')): ?>
                            <a href="<?php echo e(route("agency-group.edit", $value->id)); ?>"><span class="button_success fa fa-edit"></span></a>
                        <?php endif; ?>
                    </td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
    <script type="text/javascript">
        $(document).on('change', '.condition_com_option', function() {
            var id = $(this).find(':selected').val();
            $(".conditions").empty();
            $.ajax({
                type: 'post',
                url: "<?php echo e(route('get_commission_network_condition')); ?>",
                dataType: 'json',
                data: {
                    "_token": "<?php echo e(csrf_token()); ?>",
                    "id": id,
                },
                success: function(data) {
                    $(".conditions").empty();
                    var opt = '<option>please select</option>';

                    $.each(data, function(index, value) {
                        opt = '<option value="' + value.commission + '">' + value.commission + '</option>';
                        $('.agent_condition').val(value.condition);
                    });
                    $('.conditions').append(opt);

                }
            });

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



<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>