<?php $__env->startSection('title'); ?> <?php if( ! empty($title)): ?> <?php echo e($title); ?> | <?php endif; ?> ##parent-placeholder-3c6de1b7dd91465d437ef415f94f36afc1fbc8a8## <?php $__env->stopSection(); ?>

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

    <div class="">
        <div id="wrapper">

            <?php echo $__env->make('admin.sidebar_menu', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

            <div id="page-wrapper">
                <?php if( ! empty($title)): ?>
                    <div class="row">
                        <div class="col-lg-12">
                            <h1 class="page-header"> <?php echo e($title); ?>  </h1>
                        </div> <!-- /.col-lg-12 -->
                    </div> <!-- /.row -->
                <?php endif; ?>
                <?php echo $__env->make('admin.flash_msg', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

                <div class="row">
                    <?php if(!$has_agents): ?>
                    <div class="col-xs-12">
                        <div class="agent-search-field">
                            <div class="form-group">
                                <form action="<?php echo e(route("agent_add",$property_id)); ?>" method="get">
                                <label for="name" class="col-sm-4 control-label">Search Agent</label>
                                <div class="col-sm-12">
                                    <input type="text" class="form-control" id="name"  name="name" placeholder="Search Agent">
                                    <button type="submit" class="btn btn-primary" style="display:block; margin-top:20px;"> SEARCH </button>
                                </div>
                                </form>
                                <div class="col-sm-12" style="margin-top:30px;">
                                    <?php if(isset($agents)): ?>
                                    <table style="width:100%">
                                      <tr>
                                        <th>Agent Name</th>
                                        <th>Phone Number</th>
                                        <th>Add Agent</th>
                                      </tr>
                                      <?php $__currentLoopData = $agents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                      <tr >
                                        <td style="padding:20px 5px"><?php echo e($agent->name); ?></td>
                                        <td style="padding:20px 5px"><?php echo e($agent->phone); ?></td>
                                        <td style="padding:20px 5px"><a href="<?php echo e(route('set_agent_add', ['property_id'=>$property_id, 'agent_id'=>$agent->id])); ?>" class="btn btn-primary"> ADD AGENT </a></td>
                                      </tr>
                                      <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                      
                                    </table>
                                    <?php else: ?>
                                    <h3>Enter A Search </h3>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php endif; ?>
                    <?php if(isset($agents_added)): ?>
                    <div class="col-sm-12" style="margin-top:30px; margin-bottom:20px;">
                        <h2>Agents Added</h2>
                    </div>
                    <div class="col-sm-12">
                        <?php if(isset($agents_added)): ?>
                        <table style="width:100%">
                          <tr>
                            <th>Agent Name</th>
                            <th>Phone Number</th>
                            <th>Property Name</th>
                            <th>Property Status</th>
                            <th> Invite Status </th>
                            <th>Remove</th>
                          </tr>
                          <?php $__currentLoopData = $agents_added; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                          <?php
                          $ad = App\Ad::find($property_id);
                          $agent_added = App\User::find($agent->agent_id);
                          
                          ?>
                          <tr >
                            <td style="padding:20px 5px"><?php echo e($agent_added->name); ?></td>
                            <td style="padding:20px 5px"><?php echo e($agent_added->phone); ?></td>
                            <td style="padding:20px 5px"><?php echo e($ad->title); ?></td>
                            <td style="padding:20px 5px">
                                <?php if($ad->status == 0): ?>
                                PENDING
                                <?php elseif($ad->status == 1): ?>
                                APPROVED
                                <?php elseif($ad->status == 2): ?>
                                BLOCKED
                                <?php endif; ?>
                            </td>
                            <td style="padding:20px 5px">
                                <?php if($agent->accepted == 0): ?>
                                PENDING
                                <?php else: ?>
                                    <?php if($agent->accepted == 1): ?>
                                    ACCEPTED
                                    <?php else: ?>
                                    REJECTED
                                    <?php endif; ?>
                                <?php endif; ?>
                            </td>
                            <td style="padding:20px 5px"><a href="#" class="btn btn-danger"> REMOVE </a></td>
                          </tr>
                          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                          
                        </table>
                        <?php else: ?>
                        <h3>Enter A Search </h3>
                        <?php endif; ?>
                    </div>
                    <?php endif; ?>
                </div>

            </div>   <!-- /#page-wrapper -->

        </div>   <!-- /#wrapper -->


    </div> <!-- /#container -->
<?php $__env->stopSection(); ?>

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


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


<?php echo $__env->make('layout.main', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>