<?php include_once APP_PATH.'template/business/tplblocks/header.php';?>

<div class="row center">
  <div class="col-md-4 col-sm-6 ml-auto mr-auto">
    <div class="card card-profile card-plain">
      <div class="card-avatar border-white">
        <a href="#avatar">
          <img src="<?php echo BASE_URL.JAK_FILES_DIRECTORY.$jakclient->getVar("picture");?>" alt="<?php echo $jakclient->getVar("name");?>">
        </a>
      </div>
      <div class="card-body">
        <h4 class="card-title"><?php echo $jakclient->getVar("name");?></h4>
        <h6 class="card-category"><?php echo $jakclient->getVar("email");?></h6>
        <span class="badge badge-pill badge-primary"><?php echo sprintf($jkl['hd56'], (!empty($jakclient->getVar("chatrequests")) ? $jakclient->getVar("chatrequests") : 0));?></span>
        <span class="badge badge-pill badge-primary"><?php echo sprintf($jkl['hd57'], $jakclient->getVar("supportrequests"));?></span>
        <?php if (JAK_BILLING_MODE == 1) { ?>
          <span class="badge badge-pill badge-success"><?php echo sprintf($jkl['hd44'], $jakclient->getVar("credits"));?></span>
        <?php } elseif (JAK_BILLING_MODE == 2) { ?>
          <span class="badge badge-pill badge-success"><?php echo sprintf($jkl['hd45'], JAK_base::jakTimesince($jakclient->getVar("paid_until"), JAK_DATEFORMAT, JAK_TIMEFORMAT));?></span>
        <?php } elseif (JAK_BILLING_MODE == 3) { ?>
          <span class="badge badge-pill badge-success"><?php echo sprintf($jkl['hd142'], JAK_base::jakTimesince($jakclient->getVar("support_until"), JAK_DATEFORMAT, JAK_TIMEFORMAT));?></span>
        <?php } ?>

        <hr>
        <a href="<?php echo JAK_rewrite::jakParseurl(JAK_CLIENT_URL);?>" class="btn btn-move-left btn-round btn-outline-primary btn-sm"><i class="fa fa-chevron-left"></i><?php echo $jkl['hd143'];?></a>

      </div>

    </div> <!-- end card -->
  </div>
</div>

<div class="container">

  
  <div class="row">
    <?php if (JAK_CLIENTID && $jakclient->getVar("frontendadmin") == 1) { ?>
          <div class="col-md-12 ml-auto mr-auto text-center mb-1">
            <button class="btn btn-sm btn-primary firefrontedit e-<?php echo $pageid;?>" data-area="envato-<?php echo $pageid;?>" data-pageid="e-<?php echo $pageid;?>" data-lighteditor="false" type="button"><?php echo $jkl['hd66'];?></button>
            <button class="btn btn-sm btn-success firefrontsave e-<?php echo $pageid;?>" data-area="envato-<?php echo $pageid;?>" data-pageid="e-<?php echo $pageid;?>" type="button"><?php echo $jkl['hd53'];?></button>
            <button class="btn btn-sm btn-danger firefrontclose e-<?php echo $pageid;?>" data-area="envato-<?php echo $pageid;?>" data-pageid="e-<?php echo $pageid;?>" type="button"><?php echo $jkl['hd162'];?></button>
          </div>
        <?php } ?>
    <div class="col-md-12 envato-<?php echo $pageid;?>">
      <?php if (isset($cms_text) && !empty($cms_text)) foreach ($cms_text as $t) { if ($t["cmsslug"].$t["cmsid"] == 'envato-'.$pageid) { echo $t["description"]; break; } } ?>
    </div>
  </div>

  <h3><?php echo $jkl['hd144'];?></h3>

  <?php if ($errors) { ?>
    <div class="alert alert-danger">
      <?php if (isset($errors) && !empty($errors)) foreach ($errors as $e) { echo $e; }?>
    </div>
  <?php } ?>

  <form method="post" action="<?php echo $_SERVER['REQUEST_URI'];?>">

    <div class="input-group mb-3">
      <input type="text" class="form-control" name="purchase_code" id="purchase_code" placeholder="<?php echo $jkl["hd147"];?>" aria-label="<?php echo $jkl["hd147"];?>" aria-describedby="button-addon2">
      <div class="input-group-append">
        <button class="btn btn-success" type="submit" id="purchase_code2"><?php echo $jkl['hd151'];?></button>
      </div>
    </div>

    <input type="hidden" name="action" value="add_license">

  </form>

  <nav class="navbar navbar-expand-lg bg-primary">
    <div class="container">
      <h4 class="navbar-brand"><?php echo $jkl['hd145'];?></h4>
    </div>
  </nav>

  <div class="col-md-12">
    <div class="row">

      <?php if (isset($allLics) && !empty($allLics)) { ?>

        <div class="table-responsive mb-5">
          <table id="sortable-data" class="table">
            <thead class="table-custom-dark">
              <th><?php echo $jkl['hd150'];?></th>
              <th><?php echo $jkl['hd146'];?></th>
              <th><?php echo $jkl['hd147'];?></th>
              <th><?php echo $jkl['hd148'];?></th>
              <th><?php echo $jkl['hd149'];?></th>
            </thead>
            <?php foreach($allLics as $al) { ?>
              <tr>
                <td><?php echo $al["product_name"];?></td>
                <td><?php echo $al["purchase_name"];?></td>
                <td><?php echo $al["purchase_code"];?></td>
                <td><?php echo JAK_base::jakTimesince($al['purchased'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></td>
                <td><?php echo JAK_base::jakTimesince($al['support_expires'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></td>
              </tr>
            <?php } ?>
          </table>
        </div>

      <?php } else { ?>

        <div class="btn-block alert alert-info mt-3 mb-5">
          <?php echo $jkl['nolicense'];?>
        </div>

      <?php } ?>

    </div>

  </div>
</div>

<?php include_once APP_PATH.'template/business/tplblocks/footer.php';?>
