<?php include_once 'header.php';?>

<div class="row">
  <div class="col-md-12">
    <ul class="nav nav-pills nav-pills-warning">
      <li class="nav-item">
        <a class="nav-link" href="<?php echo JAK_rewrite::jakParseurl('billing');?>"><?php echo $jkl["hd57"];?></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="<?php echo JAK_rewrite::jakParseurl('billing', 'packages');?>"><?php echo $jkl["hd60"];?></a>
      </li>
      <li class="nav-item">
          <a class="nav-link active" href="<?php echo JAK_rewrite::jakParseurl('billing', 'products');?>"><?php echo $jkl["hd296"];?></a>
      </li>
    </ul>
  </div>
</div>
<hr>

<div class="row">
<div class="col-md-4">
<div class="card">
  <div class="card-header">
    <h3 class="card-title"><i class="fal fa-list"></i> <?php echo $jkl["hd297"];?></h3>
    </div><!-- /.box-header -->
    <form method="post" action="<?php echo $_SERVER['REQUEST_URI'];?>">
    <div class="card-body">
        
  <?php if ($errors) { ?>
    <div class="alert alert-danger"><?php if (isset($errors["e"])) echo $errors["e"];
    if (isset($errors["e1"])) echo $errors["e1"];?></div>
  <?php } ?>  
    <div class="form-group<?php if (isset($errors["e"])) echo " has-danger";?>">
      <label for="envato_item_id"><?php echo $jkl["hd298"];?></label>
      <input type="text" name="envato_item_id" id="envato_item_id" class="form-control" value="<?php if (isset($_REQUEST["envato_item_id"])) echo $_REQUEST["envato_item_id"];?>">
    </div>
          
    <div class="form-group<?php if (isset($errors["e1"])) echo " has-danger";?>">
      <label for="product_name"><?php echo $jkl["hd299"];?></label>
      <input type="text" name="product_name" id="product_name" class="form-control" value="<?php if (isset($_REQUEST["product_name"])) echo $_REQUEST["product_name"];?>">
    </div>

    <div class="form-group">
      <label for="description"><?php echo $jkl["hd300"];?></label>
      <textarea name="description" class="form-control" rows="3"><?php if (isset($_REQUEST["description"])) echo $_REQUEST["description"];?></textarea>
    </div>

  </div>
            
  <div class="card-footer">
    <button type="submit" name="insert_env_product" class="btn btn-primary"><?php echo $jkl["g38"];?></button>
  </div>

  </form>
      
  </div>
</div>
<div class="col-md-8">
  <div class="card">
    <div class="card-header">
      <h3 class="card-title"><i class="fa fa-list-alt"></i> <?php echo $jkl["hd296"];?></h3>
      </div><!-- /.box-header -->
      <div class="card-body">

        <?php if (isset($PRODUCTS_ALL) && is_array($PRODUCTS_ALL) && !empty($PRODUCTS_ALL)) { ?>
      <div class="table-responsive">
      <table class="table table-striped">
        <thead>
          <tr>
            <th>#</th>
            <th><?php echo $jkl["hd299"];?></th>
            <th><?php echo $jkl["hd298"];?></th>
            <th></th>
            <th></th>
            <th></th>
          </tr>
        </thead>
        <tfoot>
          <tr>
            <th>#</th>
            <th><?php echo $jkl["hd299"];?></th>
            <th><?php echo $jkl["hd298"];?></th>
            <th></th>
            <th></th>
            <th></th>
          </tr>
        </tfoot>
        <tbody>
          <?php foreach($PRODUCTS_ALL as $v) { ?>
          <tr>
          <td><?php echo $v["id"];?></td>
          <td><a href="<?php echo JAK_rewrite::jakParseurl('billing', 'products', 'edit', $v["id"]);?>"><?php echo $v["product_name"];?></a></td>
          <td><?php echo $v["envato_item_id"];?></td>
          <td><a class="btn btn-default btn-sm" href="<?php echo JAK_rewrite::jakParseurl('billing', 'products', 'lock', $v["id"]);?>"><i class="fa fa-<?php if ($v["active"] == '1') { ?>check<?php } else { ?>lock<?php } ?>"></i></a></td>
          <td><a class="btn btn-default btn-sm" href="<?php echo JAK_rewrite::jakParseurl('billing', 'products', 'edit', $v["id"]);?>"><i class="fa fa-pencil"></i></a></td>
          <td><a class="btn btn-danger btn-sm btn-confirm" href="<?php echo JAK_rewrite::jakParseurl('billing', 'products', 'delete', $v["id"]);?>" data-title="<?php echo addslashes($jkl["g48"]);?>" data-text="<?php echo addslashes($jkl["e30"]);?>" data-type="warning" data-okbtn="<?php echo addslashes($jkl["g279"]);?>" data-cbtn="<?php echo addslashes($jkl["g280"]);?>"><i class="fa fa-trash-alt"></i></a></td>
          </tr>
          <?php } ?>
        </tbody>
      </table>
      </div>
      <?php } else { ?>

      <div class="alert alert-info">
        <?php echo $jkl['i3'];?>
      </div>

      <?php } ?>

      </div>
    </div>
  </div>    
</div>

<?php include_once 'footer.php';?>
