<?php //\Zend\Debug\Debug::dump($userListing); ?>
<table id="myTable" class="table table-bordered table-striped">
    <thead>
        <tr>
<!--            <th> <label class="pos-rel"><input type="checkbox" class="selectall" /><span class="lbl"></span> All</label></th>-->
            <th>S.No</th>
            <th>User Id</th>
            <th>Name</th>
            <th>Email</th>
            <th>Mobile</th>
            <th>Country</th>
            <th>City</th>
            <th>User Type</th>
            <th>Pending Doc</th>
            <th>User Status</th>
            <th>Login Status</th>
            <th>Signup Status</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody>
        <?php
        if ($userListing) {
///echo'<pre>';print_r($userListing);die();
            $i = 1;
            foreach ($userListing as $listing) {
                $docs   =   $this->mainMenu()->getUserPendingDoc($listing['user_id']);
                ?>
                <tr>
<!--                    <td class="center"><label class="pos-rel">
                          <input type="checkbox" rel="<?php echo $listing['user_id']; ?>" class="check" />
                            <span class="lbl"></span> </label>
                    </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['name']; ?></td>
                    <td><?php echo $listing['email']; ?></td>
                    <td><?php echo $listing['mobile']; ?></td>
                    <td><?php echo $listing['country_name']; ?></td>
                    <td><?php echo $listing['city_name']; ?></td>
                    <td><?php echo $listing['user_type']; ?></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  class="iconsize <?php echo $listing['status_class'];?>" name="ChangeStatus" div>
                       </div><br>
                    <?php //echo $listing['status'];?>

                     </div>
                </td>

                    <td class="hidden-480">
                        <div style="float:left;">
                            <?php if ($listing['login_status'] == 1): $buttonClass = "aprovestatus";
                            else: $buttonClass = "unaprovestatus";
                            endif; ?>
                            <div id="changestatus<?php echo $listing['user_id'] ?>" class="iconsize <?php echo $buttonClass; ?>" name="ChangeStatus" > </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']; ?></td>

                    <td><div class="hidden-sm hidden-xs action-buttons">
                            <ul class="icons-list" 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-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="#"><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>
                                        <!--<li><a href="#"><i class="ace-icon fa fa-ban bigger-130"></i> Block</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="#"><i class="ace-icon fa fa-trash-o bigger-130"></i> Delete</a></li>-->

                                    </ul>
                                </li>
                            </ul>
                        </div></td>
                </tr>
                <?php
                $i++;
            }
        } else {
            ?>
            <tr><th colspan="13" style="text-align: center;">No Record Found</th></tr>
<?php } ?>
    </tbody>
    <thead>
        <tr>
<!--            <th> <label class="pos-rel"><input type="checkbox" class="selectall" /><span class="lbl"></span> All</label></th>-->
            <th>S.No</th>
            <th>User Id</th>
            <th>Name</th>
            <th>Email</th>
            <th>Mobile</th>
            <th>Country</th>
            <th>City</th>
            <th>User Type</th>
            <th>Pending Doc</th>
            <th>User Status</th>
            <th>Login Status</th>
            <th>Signup Status</th>
            <th>Action</th>
        </tr>
    </thead>
</table>

<div id="updateusertype" class="modal fade" role="dialog">
<?php  echo $this->partial('user-type-status.phtml'); ?>
</div>
<!--popup for 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">User Status</h4>
      </div>
      <div class="modal-body">
         <div class="col-sm-12 no-padding">
                                                                    <div class="form-group clearfix margintopbottom20">
                                                                      <?php

                                                                     if($userstatus['status']==1){

                                                                      foreach ($userstatus['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>
<!--popup for 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'); ?>

