<!-- Begin Page Content -->
<div class="container-fluid">
    <div class="row column_title">
        <div class="col-md-12">
            <div class="page_title">
                <h2>User Info</h2>
            </div>
        </div>
    </div>

    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <!-- <h6 class="m-0 font-weight-bold text-primary">DataTables Example</h6> -->
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" width="100%" cellspacing="0">
                    <thead class="thead-dark">
                        <tr>
                            <th>#</th>
                            <th>Detail</th>
                          
                        </tr>
                    </thead>
                    <tbody>
                   <?php
                //    echo "<pre>";
                //    print_r($user);
                //    echo "</pre>";
                   ?>

                        <tr>
                            <td> First Name</td>
                            <td><?php echo ($user['firstName'] != "") ? $user['firstName'] : 'N/A'; ?></td>

                        </tr>
 
                        <tr>
                            <td> Last Name</td>
                            <td><?php echo ($user['lastName'] != "") ? $user['lastName'] : 'N/A'; ?></td>

                        </tr>

                         <tr>
                            <td>Phone</td>
                            <td><?php echo ($user['phoneNumber'] != "") ? $user['phoneNumber'] : 'N/A'; ?></td>

                        </tr>
                         <tr>
                            <td>Created Date</td>

                            <td>
                              <?php if($user['userDate'] != ""){ ?>
                                <?php echo date("Y-m-d",$user['userDate']/1000); ?>
                              <?php } else { ?>
                                N/A
                              <?php } ?>
                            </td>

                        </tr>
                         <tr>
                            <td>Email</td>
                            <td><?php echo ($user['email'] != "") ? $user['email'] : 'N/A'; ?></td>

                        </tr>

                       
                        <tr>
                            <td>Role</td>
                            <td><?php echo $user['userRole']; ?></td>

                        </tr>   

                        <tr>
                            <td>Image</td>
                            <td><?php if($user['image'] != ""){ ?>
                                <a href="<?php echo $user['image']; ?>" target="_blank">
                                    <img src="<?php echo $user['image']; ?>" width="100" height="100">
                                </a>
                            <?php } else { ?>
                                <img src="http://placehold.jp/100x100.png" width="100" height="100">
                            <?php } ?></td>

                        </tr>   
                        
                        
                       
                        <tr>
                            <td>Last Login</td>
                            <td><?php echo $user['userLastLogin']; ?></td>

                        </tr>       
                        

                        
                        
                    </tbody>
                </table>
            <?php if($user['userRole'] == 'seller') { ?> 
            <br><hr><br>
            <h6 class="m-0 font-weight-bold text-primary">Availability</h6>
            <br>
        <table class="table table-bordered" width="100%" cellspacing="0">
            <thead class="thead-dark">
                <tr>
                    <th>Day</th>
                    <th>Is Open</th>
                    <th>Start Time</th>
                    
                    <th>End Time</th>
                </tr>
            </thead>
            <tbody>


                <?php foreach ($user['availability'] as $availability) { ?>
                    <tr>
                        <td><?php echo $availability['name']; ?></td>
                        <td><?php echo ($availability['isOpen']==1) ? 'Yes' : 'No'; ?></td>
                        <td><?php echo ($availability['sValue'] != "") ? date("h:i A",$availability['sValue']/1000) : 'N/A' ; ?></td>
                        <td><?php echo ($availability['eValue'] != "") ? date("h:i A",$availability['eValue']/1000) : 'N/A' ; ?></td>
                    </tr>
                <?php } ?>

            </tbody>
        </table>
        <?php } ?>


        <?php if($user['userRole'] == 'seller') { ?> 
            <br><hr><br>
            <h6 class="m-0 font-weight-bold text-primary">Services Experience</h6>
            <br>
        <table class="table table-bordered" width="100%" cellspacing="0">
            <thead class="thead-dark">



            <tr>
                    <th>Service Name</th>
                    <th>Service Price</th>
                    <th>Service Experience</th>
                    <th>Service Detail</th>
                    <th>Rating</th>
                    <th>Address</th>

                </tr>
            </thead>
            <tbody>
                <?php foreach ($experties as $j=> $experty) {
                    $service=$this->common->readdatadocument('ServiceTypes', $experty['serviceId']);
                    // echo "<pre>";
                    // print_r($service);
                    // echo "</pre>";
                    ?>
                    <tr>
                        <td><?php echo $service['name']; ?></td>
                        <td><?php echo "$".$experty['servicePrice']; ?></td>
                        <td><?php echo $experty['serviceExperience']." Years"; ?></td>
                        <td><?php echo $experty['serviceDetail']; ?></td>
                        <td><?php echo $experty['averageRating']; ?></td>
                        <td><?php echo $experty['address']." ".$experty['city']." ".$experty['state']; ?></td>
                    </tr>
                <?php } ?>


            </tbody>
        </table>
        <?php } ?>
            </div>  
        </div>
    </div>



</div>
