
<div class="content-wrapper">
  <div class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1 class="m-0">Dashboard</h1>
        </div>
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="#">Home</a></li>
            <li class="breadcrumb-item active">Dashboard</li>
          </ol>
        </div>
      </div>
    </div>
  </div>
  <?php if(user()->role == 'User'): ?>
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-lg-3 col-6">
            <div class="small-box bg-info">
              <div class="inner">
                <h3><?php if($product->prd_id){echo 1; }else{echo 0;}?></h3>
                <p>Product Buy</p>
              </div>
              <div class="icon">
                <i class="ion ion-bag"></i>
              </div>
              <a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-primary">
              <div class="inner">
                <h3><?php if($course->title){echo 1; }else{echo 0;}?></h3>
                <p>Courses Buy</p>
              </div>
              <div class="icon">
                <i class="fas fa-award"></i>
              </div>
              <a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-success">
              <div class="inner">
                <h3>0</h3>
                <p>Due Invoices</p>
              </div>
              <div class="icon">
                <i class="fas fa-file-invoice-dollar"></i>
              </div>
              <a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-warning">
              <div class="inner">
                <h3>0</h3>
                <p>My Earning</p>
              </div>
              <div class="icon">
                <i class="fas fa-rupee-sign"></i>
              </div>
              <a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <div class="col-lg-12">
            <div class="card">
               <div class="card-header border-0">
                  <h3 class="card-title">My Courses</h3>
                  
               </div>
               <div class="card-body table-responsive p-0">
                  <table class="table table-striped table-valign-middle">
                     <thead>
                        <tr>
                           <th>Image</th>
                           <th>Name</th>
                           <th>Pay Amount</th>
                           <th>Due</th>
                        </tr>
                     </thead>
                     <tbody>
                      <?php if($course): ?>
                        <tr>
                           <td>
                              <img src="<?php echo base_url() ?><?php echo $course->image ?>" alt="Product 1" class="img-size-32 mr-2">
                           </td>
                           <td><?php echo $course->title; ?></td>
                           <td>&#x20B9;<?php echo $course->course_adv_payment; ?></td>
                           <td>&#x20B9;<?php if($course->online_training_discount)
                            {
                              $main_p =  $course->online_training_discount;
                            }
                            else
                            {
                              $main_p = $course->online_training_price;
                            }; 

                            echo $main_p - $course->course_adv_payment; ?>
                              
                            </td>
                        </tr>
                        <?php else:?>
                          <tr>
                            <td class="text-center" colspan="4">No Course Found</td>
                          </tr>
                        <?php endif;?>
                     </tbody>
                  </table>
               </div>
            </div>
          </div>
          <div class="col-lg-12">
            <div class="card">
               <div class="card-header border-0">
                  <h3 class="card-title">My Product</h3>
                  
               </div>
               <div class="card-body table-responsive p-0">
                  <table class="table table-striped table-valign-middle">
                     <thead>
                        <tr>
                           <th>Image</th>
                           <th>Name</th>
                           <th>Pay Amount</th>
                           <th>Due</th>
                        </tr>
                     </thead>
                     <tbody>
                        <?php if($product): ?>
                          <tr>
                             <td>
                                <img src="<?php echo base_url() ?><?php echo $product->prd_image ?>" alt="Product 1" class="img-size-32 mr-2">
                             </td>
                             <td><?php echo $product->prd_name; ?></td>
                             <td>&#x20B9;<?php echo $product->advance_payment; ?></td>
                             <td>&#x20B9;<?php if($product->disocunt_price)
                              {
                                $main_p =  $product->disocunt_price;
                              }
                              else
                              {
                                $main_p = $product->main_price;
                              }; 

                              echo $main_p - $product->advance_payment; ?>
                                
                              </td>
                          </tr>
                        <?php else:?>
                          <tr>
                            <td class="text-center" colspan="4">No Product Found</td>
                          </tr>
                        <?php endif;?>
                     </tbody>
                  </table>
               </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  <?php endif;?>
</div>
