<?php
  /**
   * Product
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2017
   * @version $Id: product.tpl.php, v1.00 2017-05-05 10:12:05 gewa Exp $
   */
  if (!defined("_WOJO"))
      die('Direct access to this location is not allowed.');
?>
<div class="double-padding">
  <div class="row double-gutters">
    <div class="columns screen-60 tablet-60 mobile-100 phone-100">
      <h4>
        <a href="<?php echo Url::url('/category', $this->row->cslug);?>"><?php echo $this->row->name;?></a>
      </h4>
      <div class="wojo space divider"></div>
      <h2 class="title"><?php echo $this->row->title;?></h2>
      <?php include(THEMEBASE . '/snippets/ratingStars.tpl.php');?>
      <div class="wojo space divider"></div>
      <p class="wojo large bold text"><?php echo Utility::renderPrice($this->row->is_sale, $this->row->price, $this->row->sprice, "negative");?></p>
      <div class="wojo huge space divider"></div>
      <?php echo Validator::sanitize($this->row->body, "string", 300)?>
      <div class="wojo space divider"></div>
      <div class="padding-top">
        <div class="row gutters align-middle">
          <div class="columns shrink padding-right">
            <input class="spinner" type="number" value="1" min="1" max="20" data-spinner='{"size":""}'>
          </div>
          <div class="columns">
            <?php include(THEMEBASE . '/snippets/productButton.tpl.php');?>
          </div>
          <div class="columns shrink phone-100 content-center">
            <a data-tooltip="<?php echo Lang::$word->WISHLIST;?>" data-layout="list" data-id="<?php echo $this->row->id?>" class="wishlist wojo icon small basic circular button"><i class="icon heart"></i></a>
            <a data-tooltip="<?php echo Lang::$word->COMPARE;?>" data-layout="list" data-id="<?php echo $this->row->id?>" class="compare wojo icon small circular basic button mAction"><i class="icon files"></i></a>
          </div>
        </div>
      </div>
      <div class="share">
        <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo Url::url(Router::$path);?>" class="wojo small icon primary button" target="_blank"><i class="icon facebook"></i></a>
        <a href="https://twitter.com/home?status=<?php echo Url::url(Router::$path);?>" class="wojo small icon primary button" target="_blank"><i class="icon twitter"></i></a>
        <a href="https://pinterest.com/pin/create/button/?url=<?php echo Url::url(Router::$path);?>" class="wojo small icon primary button" target="_blank"><i class="icon pinterest"></i></a>
      </div>
    </div>
    <div class="columns screen-40 tablet-40 mobile-100 phone-100">
      <div class="wojo basic soft shadow attached segment content-center">
        <a class="lightbox" data-gall="gallery01" href="<?php echo Product::hasImage($this->row->thumb, $this->row->id);?>">
        <img id="mainimg" src="<?php echo Product::hasThumb($this->row->thumb, $this->row->id);?>" alt="<?php echo $this->row->title;?>"></a>
      </div>
      <!-- Image Gallery-->
      <?php if($this->images):?>
      <div class="wojo space divider"></div>
      <nav id="imageswitch" class="wojo images align-center">
        <a href="<?php echo Product::hasImage($this->row->thumb, $this->row->id);?>" class="wojo small basic image">
        <img src="<?php echo Product::hasThumb($this->row->thumb, $this->row->id);?>" alt=""></a>
        <?php foreach($this->images as $img):?>
        <a href="<?php echo Product::hasImage($img->name, $this->row->id);?>" class="wojo small basic image">
        <img src="<?php echo Product::hasThumb($img->name, $this->row->id);?>" alt=""></a>
        <?php endforeach;?>
      </nav>
      <?php endif;?>
      <!-- Product Audio-->
      <?php if($this->row->audio):?>
      <div class="wojo space divider"></div>
      <audio preload="auto" controls>
        <source src="<?php echo Product::hasAudio($this->row->audio, $this->row->id);?>">
      </audio>
      <?php endif;?>
    </div>
  </div>
</div>
<div class="wojo basic divider"></div>
<div class="odd-padding">
  <ul class="wojo product tabs" id="pMore">
    <li class="active">
      <a data-tab="#desc"><?php echo Lang::$word->DESCRIPTION;?></a>
    </li>
    <?php if($this->row->pbody and $this->row->membership_id and Content::is_valid($this->row->membership_id)):?>
    <li>
      <a data-tab="#vip"><?php echo Lang::$word->VIP;?></a>
    </li>
    <?php endif;?>
    <li>
      <a data-tab="#info"><?php echo Lang::$word->FRONT_ADINFO;?></a>
    </li>
    <?php if($this->core->enable_comments):?>
    <li>
      <a data-tab="#reviews"><?php echo Lang::$word->REVIEWS;?> (<span class="rcounter"><?php echo $this->row->comments;?></span>)</a>
    </li>
    <?php endif;?>
  </ul>
</div>
<div class="wojo basic divider"></div>
<div class="wojo basic attached primary segment">
  <div class="double-padding">
    <div id="desc" class="wojo tab item">
      <h5><?php echo Lang::$word->DESCRIPTION;?></h5>
      <div class="wojo divider"></div>
      <div class="wojo big space divider"></div>
      <?php echo Validator::CleanOut($this->row->body)?>
    </div>
    <?php if($this->row->pbody and $this->row->membership_id and Content::is_valid($this->row->membership_id)):?>
    <div id="vip" class="wojo tab item">
      <h5><?php echo Lang::$word->VIP;?></h5>
      <div class="wojo divider"></div>
      <div class="wojo big space divider"></div>
      <?php echo Validator::CleanOut($this->row->pbody)?>
    </div>
    <?php endif;?>
    <div id="info" class="wojo tab item">
      <h5><?php echo Lang::$word->FRONT_ADINFO;?></h5>
      <div class="wojo divider"></div>
      <div class="wojo big space divider"></div>
      <div class="row gutters align-middle">
        <div class="columns screen-50 tablet-40 moble-100 phone-100">
          <div class="wojo relaxed flex list align-middle">
            <?php echo $this->custom_fields;?>
          </div>
        </div>
        <?php if($this->row->youtube):?>
        <div class="columns screen-50 tablet-60 moble-100 phone-100">
          <div id="ytube" class="wojo basic attached segment">
            <a href="<?php echo $this->row->youtube;?>">
            </a>
          </div>
        </div>
        <?php endif;?>
      </div>
    </div>
    <?php if($this->core->enable_comments):?>
    <div id="reviews" class="wojo tab item">
      <h5><span class="rcounter"><?php echo $this->row->comments;?></span>
        <?php echo Lang::$word->REVIEWS . ' ' . strtolower(Lang::$word->FOR) . ' ' . $this->row->title;?></h5>
      <div class="wojo divider"></div>
      <div class="wojo big space divider"></div>
      <?php include_once(PLUGINBASE . "/comments/index.tpl.php");?>
    </div>
    <?php endif;?>
  </div>
</div>
<?php if($this->special):?>
<?php include_once(PLUGINBASE . "/_specials.tpl.php");?>
<?php endif;?>