<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
 <?php $this->load->view('front/includes/header-script')?>
 <title><?=TITLE?></title>
</head>
<body>
 <header>
  <div class="container">
   <div class="logo d-flex">
    <img src="<?=base_url();?>assets/front/img/logo.jpg" alt=""> 
    <span class="d-flex align-items-center justify-content-center">
    </span>
  </div>
</div>
</header>
<div class="container">
  <?php if($type == 1) { ?>
    <button id="print" type="button" class="btn" style="float: right; background: #be0000; color: #fff;" onclick="printContent('printd');" >Print Preview</button>
  <?php } ?>
  <section class="abc-approve" id="printd">
    <h1>Order No: <?=$orderno?></h1>
    <?php foreach($return_class as $value) { ?>
      <h2><?=$value['class_name']?></h2>
      <p>Start Date: <?=date("d-m-Y",strtotime($value['calss_start_date']))?><br>
       End Date: <?=date("d-m-Y",strtotime($value['calss_end_date']))?><br>
       Time: <?=date('h:i A',strtotime($value['calss_start_time']))?> – <?=date('h:i A',strtotime($value['calss_end_time']))?><br>
       Location: <?=$value['class_room']?><br>
       Days of Week: <?php ob_start(); foreach (explode(",", $value['class_day']) as $day) {
         echo ucfirst(strtolower($day)).',';
       }
       $output = ob_get_clean();
       echo rtrim($output, ',');
       ?>
     </p>
     <div class="approve">
       <?php if(isset($mcount) && $mcount > 0) { ?>
        <label><span><?=$mcount?></span>Member / Alumni</label>
        <?php foreach ($member as $mem) { ?>
          <div class="d-flex approve-content">
            <div class="col-sm-8 no-pad"><?=$mem['att_f_name']?>  <?=$mem['att_l_name']?>  <?=$mem['att_email']?>  <?=$mem['att_number']?>  <?=$mem['att_ssn']?></div>
            <div class="col-sm-4">$ <?=$mem['att_price']?>.00</div>
          </div>
        <?php } } if(isset($mcount2) && $mcount2 > 0) { ?>
          <label><span><?=$mcount2?></span>Member / Alumni 2+</label>
          <?php foreach ($member2 as $mem2) { ?>
            <div class="d-flex approve-content">
              <div class="col-sm-8 no-pad"><?=$mem2['att_f_name']?>  <?=$mem2['att_l_name']?>  <?=$mem2['att_email']?>  <?=$mem2['att_number']?>  <?=$mem2['att_ssn']?></div>
              <div class="col-sm-4">$ <?=$mem2['att_price']?>.00</div>
            </div>
          <?php } } if(isset($ncount) && $ncount > 0) { ?>
            <label><span><?=$ncount?></span>Non-Member</label>
            <?php foreach ($nonmember as $non) { ?>
              <div class="d-flex approve-content">
                <div class="col-sm-8 no-pad"><?=$non['att_f_name']?>  <?=$non['att_l_name']?>  <?=$non['att_email']?>  <?=$non['att_number']?> <?=$non['att_ssn']?></div>
                <div class="col-sm-4">$ <?=$non['att_price']?>.00</div>
              </div>
            <?php } } if(isset($ncount2) && $ncount2 > 0) { ?>
              <label><span><?=$ncount2?></span>Non-Member 2+</label>
              <?php foreach ($nonmember2 as $non2) { ?>
                <div class="d-flex approve-content">
                  <div class="col-sm-8 no-pad"><?=$non2['att_f_name']?>  <?=$non2['att_l_name']?>  <?=$non2['att_email']?>  <?=$non2['att_number']?> <?=$non2['att_ssn']?></div>
                  <div class="col-sm-4">$ <?=$non2['att_price']?>.00</div>
                </div>
              <?php } } if(isset($scount) && $scount > 0) { ?>
                <label><span><?=$scount?></span>Subscribing Employer</label>
                <?php foreach ($semember as $sem) { ?>
                  <div class="d-flex approve-content">
                    <div class="col-sm-8 no-pad"><?=$sem['att_f_name']?>  <?=$sem['att_l_name']?>  <?=$sem['att_email']?>  <?=$sem['att_number']?> <?=$sem['att_ssn']?></div>
                    <div class="col-sm-4">$ <?=$sem['att_price']?>.00</div>
                  </div>
                <?php } } ?>
                <div class="d-flex alumi-content class-sum">
                  <div class="col-sm-8 no-pad">Class Total</div>
                  <div class="col-sm-4">$ <?=$value['regclass_total_price']?>.00</div>
                </div>
              <?php } ?>
            </div>
            <hr>
            <div class="d-flex alumi-content class-sum">
              <div class="col-sm-8 no-pad">Order Details</div>
            </div>
            <div class="d-flex content class-sum">
              <div class="col-sm-4">
                <p>
                  Ordered Date: <?=$reg_date?><br>

                  Address     : <?=$address?><br>
                  Phone No    : <?=$phone_no?><br>
                  Email Id    : <?=$email_id?><br>
                  No Of Classes  : <?=$class_count?><br>
                  No Of Attendee : <?=$att_count?><br>
                </p>
              </div>
              <div class="col-sm-4">
                <p>
                  Holder Name : <?=$card_holder_name?><br>
                  Payment Type   : <?=$payment_type?><br>
                  Card Number    : <?='************' . substr($card_number,-4)?><br>
                  Card Type      : <?=$card_type?><br>
                  Expiration     : <?=$exp_month?>,<?=$exp_year?><br>
                </p>
              </div>
              <div class="col-sm-4">
                <p>
                  Status: <?=$status?><br>

                </p>
              </div>
            </div>
            <div class="d-flex alumi-content class-sum grand">
              <div class="col-sm-8 no-pad">Grand Total</div>
              <div class="col-sm-4">$ <?=$reg_total?>.00</div>
            </div>
          </section>
          <div class="d-flex justify-content-between abc-btn">
            <div class="p-2"><a href="<?= base_url();?>admin/order-list"><button type="button" class="btn" style="background: #be0000; color: #fff;">Back</button></a></div>
          </div>
        </div>
        <script type="text/javascript">
          function printContent(el){
            var restorepage = $('body').html();
            var printcontent = $('#' + el).clone();
            $('body').empty().html(printcontent);
            window.print();
            $('body').html(restorepage);
          }
        </script>
        <?php $this->load->view('front/includes/footer-script')?>
      </body>
      </html>