<?php
  /**
   * Trash
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2017
   * @version $Id: trash.tpl.php, v1.00 2017-05-05 10:12:05 gewa Exp $
   */
  if (!defined("_WOJO"))
      die('Direct access to this location is not allowed.');
	  
  if (!Auth::checkAcl("owner")) : print Message::msgError(Lang::$word->NOACCESS); return; endif;
?>
<div class="row half-gutters align-middle">
  <div class="column mobile-100 phone-100">
    <h2><?php echo Lang::$word->META_M_TRASH;?></h2>
    <p class="wojo small text"><?php echo Lang::$word->TRS_INFO;?></p>
  </div>
  <?php if($this->data):?>
  <div class="column shrink mobile-100 phone-100">
    <a data-set='{"option":[{"delete": "trashAll","title": "<?php echo Lang::$word->TRS_TEMPTY;?>"}],"action":"delete","redirect":"<?php echo Url::url(Router::$path);?>"}' class="action wojo small negative basic button"><?php echo Lang::$word->TRS_TEMPTY;?>
    </a>
  </div>
  <?php endif;?>
</div>
<?php if(!$this->data):?>
<div class="wojo segment content-center"><img src="<?php echo ADMINVIEW;?>/images/trash_empty.png" alt="">
  <p class="wojo small thick caps text"><?php echo Lang::$word->TRS_EMPTY;?></p>
</div>
<?php else:?>
<?php foreach($this->data as $type => $rows):?>
<?php switch($type): ?>
<?php case "faq":?>
<!-- faq -->
<div class="wojo soft shadow card">
  <div class="header">
    <h4><?php echo Lang::$word->ADM_FAQ;?></h4>
  </div>
  <div class="content">
    <div class="wojo divided list">
      <?php foreach($rows as $row):?>
      <?php $dataset = Utility::jSonToArray($row->dataset);?>
      <div class="item" id="faq_<?php echo $dataset->id;?>">
        <div class="right floated content">
          <a data-set='{"option":[{"qAction": 1,"page":"restoreFaq", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->question, "spchar");?>", "url":"/helper.php", "parent":"#page_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo positive text qAction"><?php echo Lang::$word->RESTORE;?></a>
          - <a data-set='{"option":[{"qAction": 1,"page":"deleteFaq", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->question, "spchar");?>", "url":"/helper.php", "parent":"#faq_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo negative text qAction"><?php echo Lang::$word->TRS_DELGOOD;?></a>
        </div>
        <?php echo $dataset->question;?>
      </div>
      <?php endforeach;?>
      <?php unset($dataset);?>
    </div>
  </div>
</div>
<?php break;?>
<!-- page -->
<?php case "page":?>
<div class="wojo soft shadow card">
  <div class="header">
    <h4><?php echo Lang::$word->ADM_PAGES;?></h4>
  </div>
  <div class="content">
    <div class="wojo divided list">
      <?php foreach($rows as $row):?>
      <?php $dataset = Utility::jSonToArray($row->dataset);?>
      <div class="item" id="page_<?php echo $dataset->id;?>">
        <div class="right floated content">
          <a data-set='{"option":[{"qAction": 1,"page":"restorePage", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->title, "spchar");?>", "url":"/helper.php", "parent":"#page_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo positive text qAction"><?php echo Lang::$word->RESTORE;?></a>
          - <a data-set='{"option":[{"qAction": 1,"page":"deletePage", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->title, "spchar");?>", "url":"/helper.php", "parent":"#page_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo negative text qAction"><?php echo Lang::$word->TRS_DELGOOD;?></a>
        </div>
        <?php echo $dataset->title;?>
      </div>
      <?php endforeach;?>
      <?php unset($dataset);?>
    </div>
  </div>
</div>
<?php break;?>
<!-- user -->
<?php case "user":?>
<div class="wojo soft shadow card">
  <div class="header">
    <h4><?php echo Lang::$word->ADM_USERS;?></h4>
  </div>
  <div class="content">
    <div class="wojo divided list">
      <?php foreach($rows as $row):?>
      <?php $dataset = Utility::jSonToArray($row->dataset);?>
      <div class="item" id="user_<?php echo $dataset->id;?>">
        <div class="right floated content">
          <a data-set='{"option":[{"qAction": 1,"page":"restoreUser", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->fname . ' ' . $dataset->lname, "spchar");?>", "url":"/helper.php", "parent":"#user_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo positive text qAction"><?php echo Lang::$word->RESTORE;?></a>
          - <a data-set='{"option":[{"qAction": 1,"page":"deleteUser", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->fname . ' ' . $dataset->lname, "spchar");?>", "url":"/helper.php", "parent":"#user_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo negative text qAction"><?php echo Lang::$word->TRS_DELGOOD;?></a>
        </div>
        <?php echo $dataset->fname . ' ' . $dataset->lname;?>
      </div>
      <?php endforeach;?>
      <?php unset($dataset);?>
    </div>
  </div>
</div>
<?php break;?>
<!-- membership -->
<?php case "membership":?>
<div class="wojo soft shadow card">
  <div class="header">
    <h4><?php echo Lang::$word->ADM_MEMS;?></h4>
  </div>
  <div class="content">
    <div class="wojo divided list">
      <?php foreach($rows as $row):?>
      <?php $dataset = Utility::jSonToArray($row->dataset);?>
      <div class="item" id="membership_<?php echo $dataset->id;?>">
        <div class="right floated content">
          <a data-set='{"option":[{"qAction": 1,"page":"restoreMembership", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->title, "spchar");?>", "url":"/helper.php", "parent":"#membership_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo positive text qAction"><?php echo Lang::$word->RESTORE;?></a>
          - <a data-set='{"option":[{"qAction": 1,"page":"deleteMembership", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->title, "spchar");?>", "url":"/helper.php", "parent":"#membership_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo negative text qAction"><?php echo Lang::$word->TRS_DELGOOD;?></a>
        </div>
        <?php echo $dataset->title;?>
      </div>
      <?php endforeach;?>
      <?php unset($dataset);?>
    </div>
  </div>
</div>
<?php break;?>
<!-- news -->
<?php case "news":?>
<div class="wojo soft shadow card">
  <div class="header">
    <h4><?php echo Lang::$word->ADM_NEWS;?></h4>
  </div>
  <div class="content">
    <div class="wojo divided list">
      <?php foreach($rows as $row):?>
      <?php $dataset = Utility::jSonToArray($row->dataset);?>
      <div class="item" id="news_<?php echo $dataset->id;?>">
        <div class="right floated content">
          <a data-set='{"option":[{"qAction": 1,"page":"restoreNews", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->title, "spchar");?>", "url":"/helper.php", "parent":"#news_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo positive text qAction"><?php echo Lang::$word->RESTORE;?></a>
          - <a data-set='{"option":[{"qAction": 1,"page":"deleteNews", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->title, "spchar");?>", "url":"/helper.php", "parent":"#news_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo negative text qAction"><?php echo Lang::$word->TRS_DELGOOD;?></a>
        </div>
        <?php echo $dataset->title;?>
      </div>
      <?php endforeach;?>
      <?php unset($dataset);?>
    </div>
  </div>
</div>
<?php break;?>
<?php case "coupon":?>
<!-- coupon -->
<div class="wojo soft shadow card">
  <div class="header">
    <h4><?php echo Lang::$word->ADM_COUPONS;?></h4>
  </div>
  <div class="content">
    <div class="wojo divided list">
      <?php foreach($rows as $row):?>
      <?php $dataset = Utility::jSonToArray($row->dataset);?>
      <div class="item" id="coupon_<?php echo $dataset->id;?>">
        <div class="right floated content">
          <a data-set='{"option":[{"qAction": 1,"page":"restoreCoupon", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->title, "spchar");?>", "url":"/helper.php", "parent":"#coupon_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo positive text qAction"><?php echo Lang::$word->RESTORE;?></a>
          - <a data-set='{"option":[{"qAction": 1,"page":"deleteCoupon", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->title, "spchar");?>", "url":"/helper.php", "parent":"#coupon_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo negative text qAction"><?php echo Lang::$word->TRS_DELGOOD;?></a>
        </div>
        <?php echo $dataset->title;?>
      </div>
      <?php endforeach;?>
      <?php unset($dataset);?>
    </div>
  </div>
</div>
<?php break;?>
<?php case "menu":?>
<!-- menu -->
<div class="wojo soft shadow card">
  <div class="header">
    <h4><?php echo Lang::$word->ADM_MENUS;?></h4>
  </div>
  <div class="content">
    <div class="wojo divided list">
      <?php foreach($rows as $row):?>
      <?php $dataset = Utility::jSonToArray($row->dataset);?>
      <div class="item" id="menu_<?php echo $dataset->id;?>">
        <div class="right floated content">
          <a data-set='{"option":[{"qAction": 1,"page":"restoreMenu", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->name, "spchar");?>", "url":"/helper.php", "parent":"#menu_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo positive text qAction"><?php echo Lang::$word->RESTORE;?></a>
          - <a data-set='{"option":[{"qAction": 1,"page":"deleteMenu", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->name, "spchar");?>", "url":"/helper.php", "parent":"#menu_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo negative text qAction"><?php echo Lang::$word->TRS_DELGOOD;?></a>
        </div>
        <?php echo $dataset->name;?>
      </div>
      <?php endforeach;?>
      <?php unset($dataset);?>
    </div>
  </div>
</div>
<?php break;?>
<?php case "category":?>
<!-- category -->
<div class="wojo soft shadow card">
  <div class="header">
    <h4><?php echo Lang::$word->ADM_CATS;?></h4>
  </div>
  <div class="content">
    <div class="wojo divided list">
      <?php foreach($rows as $row):?>
      <?php $dataset = Utility::jSonToArray($row->dataset);?>
      <div class="item" id="category_<?php echo $dataset->id;?>">
        <div class="right floated content">
          <a data-set='{"option":[{"qAction": 1,"page":"restoreCategory", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->name, "spchar");?>", "url":"/helper.php", "parent":"#category_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo positive text qAction"><?php echo Lang::$word->RESTORE;?></a>
          - <a data-set='{"option":[{"qAction": 1,"page":"deleteCategory", "id":<?php echo $row->id;?>}], "name":"<?php echo Validator::sanitize($dataset->name, "spchar");?>", "url":"/helper.php", "parent":"#category_<?php echo $dataset->id;?>", "complete":"remove"}' class="wojo negative text qAction"><?php echo Lang::$word->TRS_DELGOOD;?></a>
        </div>
        <?php echo $dataset->name;?>
      </div>
      <?php endforeach;?>
      <?php unset($dataset);?>
    </div>
  </div>
</div>
<?php break;?>
<?php endswitch;?>
<?php endforeach;?>
<?php endif;?>