<?php //\Zend\Debug\Debug::dump($userListing);
   ?>
<!-- /.box-header -->
<div class="box-body">
    <table id="myTable" class="table table-bordered table-striped">
        <thead>
            <tr>
<!--                <th width="2%"><input type="checkbox" class="selectall"> All</th>-->
                <th>S.No</th>
                <th>Id</th>
                <th>Vendor</th>
                <th>City</th>
                <th>Name</th>
                <th width="10%">Vehicle</th>
                <!---<th>Vehicle No</th>--->
                <th>Ignition Type</th>
                <th width="5%">Job Type</th>     
                <th>License No.</th>               
                <th>Pending Doc</th>
                <th>Marketplace</th>
                <th>Driver <br>Status</th>
                <th>Login <br>Status</th>
                <th>Sign up <br>Status</th>
                <th width="5%">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['vendor_name'] != '') ? $listing['vendor_name'] : 'NA'; ?></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['vehicle_name']; ?> <br> <?php echo $listing['vehicle_no']; ?><br> <?php echo $listing['model']; ?></td>
                        <td><?php echo $listing['fuel_type']; ?></td>
                        <td width="5%"><?php echo $listing['duty_type']; ?></td>
                        
                       
                        <td><?php echo $listing['driving_license_no']; ?></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="publish-marketplace iconsize" name="ChangeStatus" title="Publish"> </div>
                            </div>
                        </td>
                         <td>
                            <div style="float:left;">
                                <div  class="iconsize  <?php echo $listing['status_class']; ?>" name="ChangeStatus"> </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-driver-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 date('d-m-Y h:i:s', strtotime($listing['created_date'])) ?><br><small><?php echo $listing['booking']; ?> bookings</small></td>
                        <td>
                            <ul class="icons-list margin-left0 no-padding" 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 margin-left0">
                                        <!--<li><a href="#"><i class="ace-icon fa fa-link bigger-130" ></i> Links</a></li>-->
                                        <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['driver_status_id']; ?>"><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="#"><i class="ace-icon fa  fa-group bigger-130"></i> Group</a></li>-->
                                        <!--<li><a href="vechicle-detail.html"><i class="ace-icon fa  fa-car bigger-130"></i> Vehicle</a></li>-->
                                        <li><a href="<?php echo $this->url() . '/booking-history/' . $listing['user_id']; ?>"><i class="ace-icon fa  fa-history bigger-130"></i> Booking History</a></li>
                                        <li><a href="<?php echo $this->url() . '/allocation-history/' . $listing['user_id']; ?>"><i class="ace-icon fa  fa-tasks bigger-130"></i> Allocation History</a></li>
                                        <!--<li><a href="#"><i class="ace-icon fa fa-mobile-phone bigger-130" style="font-size:24px"></i> Send SMS To Driver</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="#"><i class="ace-icon fa fa-trash-o bigger-130"></i> Delete</a></li>-->

                                    </ul>
                                </li>
                            </ul>
                        </td>


                    </tr>
                    <?php
                    $i++;
                }
            } else {
                ?>
                <tr><th colspan="16" style="text-align: center;">No Record Found</th></tr>
            <?php } ?>

        </tbody>
        <tfoot>
            <tr>
                <th>S.No</th>
                <th>Id</th>
                <th>Vendor</th>
                <th>City</th>
                <th>Name</th>
                <th>Vehicle</th>
                <th>Ignition Type</th>
                <th width="5%">Job Type</th>        
                <th>License No.</th>
                <th>Pending Doc</th>
                <th>Marketplace</th>
                <th>Driver<br> Status</th>
                <th>Login<br> Status</th>
                <th>Sign up <br>Status</th>
                <th>Action</th>
            </tr>
        </tfoot>
    </table>
</div>

<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">Driver Status</h4>
            </div>
            <div class="modal-body">
                <div class="col-sm-12 no-padding">
                    <div class="form-group clearfix margintopbottom20">
                        <?php
                        if ($driverStatus['status'] == 1) {

                            foreach ($driverStatus['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 $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'); ?>

