<?php
  $user_data = $this->session->userdata['user'];
?>

<div class="content-wrapper">
  <section class="content-header">
    <h1>
       <?= $pTitle ?>
        <small><?= $pDescription ?></small>
    </h1>
    <ol class="breadcrumb">
     <li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
     <li><?= $menu ?></li>
     <li class="active"><?= $smenu ?></li>
    </ol>
  </section>
<section class="content">
  <div class="row">
   <div class="col-md-12">
      <?php 
       if($this->session->flashdata('message')) { 
        $flashdata = $this->session->flashdata('message'); ?>
        <div class="alert alert-<?= $flashdata['class'] ?>">
         <button class="close" data-dismiss="alert" type="button">×</button>
         <?= $flashdata['message'] ?>
       </div>
     <?php } ?>
   </div>
  <div class="col-md-12">
    <div class="box box-warning">
     <div class="box-header with-border">
       <div class="col-md-6"><h3 class="box-title">Admin Details</h3></div>
       <div class="col-md-6" align="right">
          <a class="btn btn-sm btn-primary" href="<?= base_url('User/editProfile') ?>">Edit</a>
          <a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
       </div>
     </div>
     <div class="box-body">
      <div class="col-md-12">
        <div class="col-md-2">
          <div class="form-group has-feedback">
           <img src="<?= base_url($user_data->profile_image) ?>" class="cpoint" 
            onclick="viewImageModal('Profile Image','<?= base_url($user_data->profile_image) ?>');"
            onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';" height="100" width="100" />
         </div>
       </div>
       <div class="col-md-5">
         <div class="row">
           <div class="col-md-5"><span>Display Name </span></div>
           <div class="col-md-7">
             <span>:</span>
             <label class="padLeft20">
               <?= $user_data->display_name ?> 
             </label>
           </div>
         </div>
         <div class="row">
           <div class="col-md-5"><span>User Name </span></div>
           <div class="col-md-7">
             <span>:</span>
             <label class="padLeft20">
               <?= $user_data->username ?> 
             </label>
           </div>
         </div>
         <?php 
         if($this->session->userdata('user_type') == 2 && 
            isset($this->session->userdata['mechanic_data']) && 
            !empty($this->session->userdata['mechanic_data'])){ 
          $mechanic_data = $this->session->userdata['user']->mechanic_data; ?>

          <div class="row padTop20">
            <div class="col-md-5"><span>First Name </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->first_name ?> 
              </label>
            </div>
          </div>

          <div class="row">
            <div class="col-md-5"><span>Last Name </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->last_name ?> 
              </label>
            </div>
          </div>

          <div class="row">
            <div class="col-md-5"><span>Phone Number </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->phone ?> 
              </label>
            </div>
          </div>

          <div class="row">
            <div class="col-md-5"><span>Email ID </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->email_id ?> 
              </label>
            </div>
          </div>

          <div class="row">
            <div class="col-md-5"><span>Address </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->address ?> 
              </label>
            </div>
          </div>

          <div class="row">
            <div class="col-md-5"><span>City </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->city ?> 
              </label>
            </div>
          </div>

          <div class="row">
            <div class="col-md-5"><span>State </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->state ?> 
              </label>
            </div>
          </div>

          <?php 
          if(isset($this->session->userdata['mechanic_shop_data']) && 
             !empty($this->session->userdata['mechanic_shop_data'])){ 
            $shop_data = $this->session->userdata['mechanic_shop_data'];
          ?>
            <div class="row padTop20">
              <div class="col-md-5"><span>Shop Name </span></div>
              <div class="col-md-7">
                <span>:</span>
                <label class="padLeft20">
                  <?= $shop_data->shop_name ?> 
                </label>
              </div>
            </div>

            <div class="row">
              <div class="col-md-5"><span>Shop Address </span></div>
              <div class="col-md-7">
                <span>:</span>
                <label class="padLeft20">
                  <?= $shop_data->address ?> 
                </label>
              </div>
            </div>

            <div class="row">
              <div class="col-md-5"><span>Shop Phone </span></div>
              <div class="col-md-7">
                <span>:</span>
                <label class="padLeft20">
                  <?= $shop_data->phone ?> 
                </label>
              </div>
            </div>

            <div class="row">
              <div class="col-md-5"><span>Shop Email </span></div>
              <div class="col-md-7">
                <span>:</span>
                <label class="padLeft20">
                  <?= $shop_data->email_id ?> 
                </label>
              </div>
            </div>
          <?php } ?>
        </div>

        <div class="col-md-5">
          <div class="row">
            <div class="col-md-5"><span>Licence Number </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->licence_number ?> 
              </label>
            </div>
          </div>
          
          <div class="row">
            <div class="col-md-5"><span>Licence Exp. Date </span></div>
            <div class="col-md-7">
              <span>:</span>
              <label class="padLeft20">
                <?= $mechanic_data->licence_exp_date ?> 
              </label>
            </div>
          </div>
          
          <div class="row">
            <div class="col-md-5">
              <span>Licence </span>
            </div>
            <div class="col-md-12">
              <img src="<?= base_url($mechanic_data->licence) ?>" 
               onclick="viewImageModal('Licence Image','<?= base_url($mechanic_data->licence) ?>');" 
               onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" 
               class="cpoint" alt="Licence Image" height="200px" width="auto" 
               style="padding-left: 20%;">
            </div>
          </div>
        </div>
        <?php } else { ?>
          </div>
        <?php } ?>
        </div>
       </div>
      </div>
     </div>
    </div>
  </div>
</section>
</div>