<?php //\Zend\Debug\Debug::dump($userListing);  ?>
<div class="box-body">
    <table id="myTable" class="table table-bordered table-striped">
        <thead>
            <tr>
<!--            <th><input type="checkbox" class="selectall" />All</th>-->
                <th>S.No</th>
                <th>Vendor Id</th>
                <th>City</th>
                <th>Name</th>
                <th>Company Name</th>
                <th>Job Type</th>
                <th>Vehicle</th>               
                <th>Pending Doc</th>
                <th>Marketplace</th>
                <th>Vender<br>Status</th>
                <th>Login <br>Status</th>
                <th>Sign up <br>Status</th>
                <th>Action</th>

            </tr>
        </thead>
        <tbody>
            <?php
            if ($userListing) {

                $i = 1;
                foreach ($userListing as $listing) {
                    $loginStatus = $listing['login_status'];
                    $docs   =   $this->mainMenu()->getUserPendingDoc($listing['user_id']);
                    ?>
                    <tr>
        <!--                <td><input type="checkbox" rel="<?php echo $listing['user_id']; ?>" class="check" /></td>-->
                        <td><?php echo $i; ?></td>
                        <td><a href="<?php echo $this->url() . '/personal-detail/' . $listing['user_id']; ?>"><?php echo $listing['user_id'] ?></a></td>
                        <td><?php echo $listing['city_name']; ?></td>
                        <td><?php echo $listing['name']; ?><br>
                            <small><?php echo $listing['mobile']; ?></small><br><small><?php echo $listing['email']; ?></small>
                        </td>
                        <td><?php echo $listing['company_name']; ?></td>
                        <td><?php echo $listing['duty_type']; ?></td>
                        <td><?php echo $listing['vehicle_name']; ?> <br> <?php echo $listing['vehicle_no']; ?><br> <?php echo $listing['model']; ?></td>
                        
                        <td style="white-space:nowrap;">
                        <ul class="pending-doc">
                            <?php foreach($docs as $doc){ ?>
                            <li><i class="fa fa-angle-double-right" aria-hidden="true"></i> <?php echo $doc['document_name']; ?></li>
                            <?php }?>
                        </ul>
                        </td>
                        <td>
                            <div style="float:left;">
                                <div id="changestatus1" class="iconsize publish-marketplace" title="Publish"> </div>
                            </div>

                        </td>
                        <td>
        <?php //echo $listing['status']; ?>
                            <!--                   <br>-->
                            <div style="float:left;">
                                <div  class="iconsize <?php echo $listing['status_class']; ?>" name="ChangeStatus" div>
                                </div></div>
                        </td>

                        <td>
                            <div style="float:left;">
                               
                                <div id="changestatus-<?php echo $listing['user_id'] ?>" user_id="<?php echo $listing['user_id'] ?>" login_status="<?php echo $listing['login_status'];?>" class="<?php if ($listing['login_status'] == 1) { echo "change_login_status";}?> iconsize <?php echo ($loginStatus == 0) ? 'unaprovestatus' : 'aprovestatus'; ?>" name="ChangeStatus" title="<?php echo ($loginStatus == 0) ? 'Log-out' : 'Log-In'; ?>" onclick="changeRecordStatus('<?php echo $listing['user_id']; ?>', 'usermanagement', 'change-vendor-record-status', '<?php echo $listing['login_status'];?>')"></div>
                            </div>
                        </td>
                         <td><div style="float:left;">
                                                <div class="iconsize <?php echo $listing['signup_status_class']; ?>">
                                                </div></div><br/><?php echo $listing['status_name']; ?><br><?php echo $listing['created_date']; ?><br><small><?php echo $listing['booking']; ?> bookings</small></td>

                        <td><div class="hidden-sm hidden-xs action-buttons">
                                <ul class="icons-list margin-left0" style="list-style:none;">
                                    <li class="dropdown text-muted">
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></a>
                                        <ul class="dropdown-menu dropdown-menu-right">
                                             <li><a href="<?php echo $this->url().'/document-approval/'.$listing['user_id']; ?>"><i class="ace-icon fa fa-user bigger-130"></i> Approve Doc</a></li>
                                            <li><a href="<?php echo $this->url() . '/personal-detail/' . $listing['user_id']; ?>"><i class="ace-icon fa fa-edit bigger-130"></i> Edit</a></li>
                                            <li><a href="<?php echo $this->url() . '/personal-detail/' . $listing['user_id']; ?>"><i class="ace-icon fa fa-user bigger-130"></i> Profile</a></li>

                                            <li class="updatestatus" user_id="<?php echo $listing['user_id']; ?>" user_status="<?php echo $listing['is_active']; ?>"><a href="#" data-toggle="modal" data-target="#statuspopup" ><i class="ace-icon fa fa-user bigger-130"></i> Status</a></li>
                                            <li class="relationmanager" user_id="<?php echo $listing['user_id']; ?>" relation_id="<?php echo $listing['relation_manager_id']; ?>"><a href="#" data-toggle="modal" data-target="#relationpopup" ><i class="ace-icon fa fa-user bigger-130"></i> Relation Manager</a></li>
                                            <li class="adlive" user_id="<?php echo $listing['user_id']; ?>" user_type="<?php echo $listing['user_type_id']; ?>"><a href="#" data-toggle="modal" data-target="#updateusertype" ><i class="ace-icon fa fa-user bigger-130"></i> Update User Type</a></li>
                                            <li><a href="/credit/index/<?php echo $listing['user_id']; ?>"><i class="ace-icon fa  fa-history bigger-130"></i> Credit Limit</a></li>
                                            <li><a href="<?php echo $this->url() . '/change-password/' . $listing['user_id']; ?>"><i class="ace-icon fa fa-key bigger-130"></i> Reset Password</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </div></td>

                    </tr>
        <?php
        $i++;
    }
} else {
    ?>
                <tr><th colspan="12" style="text-align: center;">No Record Found</th></tr>
            <?php } ?>
        </tbody>
        <tfoot>
            <tr>
<!--                <th><input type="checkbox" class="selectall" /> All</th>-->
                <th>S.No</th>
                <th>Vendor Id</th>
                <th>City</th>
                <th>Name</th>
                <th>Company Name</th>
                <th>Vehicle</th>                
                <th>Pending Doc</th>
                <th>Marketplace</th>
                <th>Vender<br> Status</th>
                <th>Login<br> Status</th>
                <th>Sign up <br>Status</th>
                <th>Created at</th>
                <th>Action</th>
            </tr>
        </tfoot>
    </table>
</div>
<!-- /.box-body -->
<div id="updateusertype" class="modal fade" role="dialog">
<?php  echo $this->partial('user-type-status.phtml'); ?>
</div>

<!--Pop-up For Vendor Status Start-->

<div id="statuspopup" class="modal fade" role="dialog">
    <div class="modal-dialog">

        <!-- Modal content-->
        <div class="modal-content">
            <div style="color: green; padding: 10px;" class="success_msg_status"></div>
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Vendor Status</h4>
            </div>
            <div class="modal-body">
                <div class="col-sm-12 no-padding">
                    <div class="form-group clearfix margintopbottom20">
                        <?php
                        if ($vendorStatus['status'] == 1) {

                            foreach ($vendorStatus['data'] as $id => $val) {
                                ?>

                                <div class="col-sm-4">

                                    <div class="carbooking">
                                        <input type="radio" name="driver_sataus" id="<?php echo $val; ?>" value="<?php echo $id; ?>">
                                        <label for="<?php echo $val; ?>"><span class="radio"><?php echo $this->translate($val); ?></span></label>
                                    </div>

                                </div>

                            <?php }
                        }
                        ?>


                    </div>


                </div>
            </div>
            <div class="modal-footer">
                <input type="hidden" id="user_id" value="" name="userid">

                <input type="button" class="btn btn-danger" value="Save" name="save" id="savestatus"  />
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>

    </div>
</div>

<!--Pop-up For Vendor Status End-->



<!--Pop-up For Vendor Relation management Start-->

<div id="relationpopup" class="modal fade" role="dialog">
    <div class="modal-dialog">

        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Relation Manager </h4>
            </div>
            <div class="modal-body">
                <div class="col-sm-12 no-padding">
                    <div class="form-group clearfix margintopbottom20">

                        <table id="relation-manager-tbl" class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <!--<th><input type="checkbox" class="selectall" />All</th>-->
                                    <th>S.No</th>
                                    <th>Name</th>
                                    <th>Roll</th>
                                    <th>Department</th>
                                    <th>Action</th>

                                </tr>

                            </thead>
                            <tbody>

                                <?php
                                if ($relatinaldata) {
                                    $i = 1;
                                    foreach ($relatinaldata as $list) {
                                        ?>
                                        <tr>
                                            <td><?php echo $i; ?></td>
                                            <td><?php echo $list['first_name'] . ' ' . $list['last_name']; ?></td>
                                            <td><?php echo $list['role_name']; ?></td>
                                            <td><?php echo $list['department_name']; ?></td>

                                            <td><input type="button" class="btn btn-danger add-relation" value="Add" name="add" id="<?php echo $list['user_id']; ?>"></td>
                                        </tr>
                                        <?php
                                        $i++;
                                    }
                                } else {
                                    ?>
                                    <tr><th colspan="12" style="text-align: center;">No Record Found</th></tr>
                                <?php } ?>
                            </tbody>

                        </table>

                    </div>


                </div>
            </div>
            <div class="modal-footer">
                <input type="hidden" id="relational-user-id" value="" name="relational_user_id">
                <input type="hidden" id="relational-manager-id" value="" name="relational-manager-id">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>

    </div>
</div>
<!--Pop-up For Vendor Relation management End-->

<?php  echo $this->partial('view-status.phtml'); ?>