<?php
  /**
   * Account Memberships
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2017
   * @version $Id: memberships.tpl.php, v1.00 2017-05-05 10:12:05 gewa Exp $
   */
  if (!defined("_WOJO"))
      die('Direct access to this location is not allowed.');
?>
<?php include_once(THEMEBASE . '/snippets/dashNav.tpl.php');?>
<div class="padding">
  <div class="row gutters">
    <div class="columns">
      <h2><?php echo Lang::$word->MEMBERSHIPS;?></h2>
    </div>
    <div class="columns shrink">
      <a href="<?php echo Url::url('/dashboard', 'history');?>" class="wojo small primary button"><i class="icon history"></i>
        <?php echo Lang::$word->HISTORY;?></a>
    </div>
  </div>
  <?php if($this->data):?>
  <div id="mBlock" class="row screen-block-3 tablet-block-2 mobile-block-1 phone-block-1 double-gutters align-center">
    <?php foreach($this->data as $row):?>
    <div class="column">
      <div id="item_<?php echo $row->id;?>" class="wojo attached segment content-center relative<?php echo App::Auth()->membership_id == $row->id ? ' shadow' : null;?>">
        <?php if($row->thumb):?>
        <img src="<?php echo UPLOADURL;?>/memberships/<?php echo $row->thumb;?>" alt="<?php echo $row->title;?>">
        <?php else:?>
        <img src="<?php echo UPLOADURL;?>/memberships/default.svg" alt="<?php echo $row->title;?>">
        <?php endif;?>
        <div class="wojo space divider"></div>
        <h4 class="content-center">
          <?php echo Utility::formatMoney($row->price);?>
          <?php echo $row->title;?></h4>
        <div class="wojo small space divider"></div>
        <p class="wojo small text"><?php echo Lang::$word->MEM_REC1;?>
          <?php echo ($row->recurring) ? Lang::$word->YES : Lang::$word->NO;?></p>
        <p class="wojo small text"><?php echo $row->days;?>@<?php echo Date::getPeriodReadable($row->period);?></p>
        <div class="wojo small space divider"></div>
        <p class="wojo tiny text"><?php echo $row->description;?></p>
        <div class="wojo space divider"></div>
        <div class="wojo divider"></div>
        <?php if(App::Auth()->membership_id != $row->id):?>
        <button type="button" class="wojo primary button mCart" data-id="<?php echo $row->id;?>"><?php echo ($row->price <> 0) ? Lang::$word->SELECT : Lang::$word->ACTIVATE;?></button>
        <?php else:?>
        <span class="wojo basic disabled button"><?php echo Lang::$word->ACTIVE;?></span>
        <?php endif;?>
      </div>
    </div>
    <?php endforeach;?>
  </div>
  <?php endif;?>
  <div id="mResult"></div>
</div>