<?php
  /**
   * Products New
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2016
   * @version $Id: _products_new.tpl.php, v1.00 2016-01-08 10:12:05 gewa Exp $
   */
  if (!defined("_WOJO"))
      die('Direct access to this location is not allowed.');
?>
<div class="row horizontal-gutters align-middle">
  <div class="columns">
    <h2><?php echo Lang::$word->PRD_NEW;?></h2>
  </div>
  <div class="columns shrink"><a data-action="toggle" data-page="product" class="wojo small primary icon label sAction"><i class="icon question sign"></i></a>
  </div>
</div>
<form method="post" id="wojo_form" name="wojo_form">
  <div class="wojo segment form">
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->NAME;?>
          <i class="icon asterisk"></i></label>
        <div class="wojo input">
          <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" name="title">
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->PRD_SLUG;?></label>
        <div class="wojo input">
          <input type="text" placeholder="<?php echo Lang::$word->PRD_SLUG;?>" name="slug">
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->PRD_PRICE;?>
          <i class="icon asterisk"></i></label>
        <div class="wojo right labeled input">
          <span class="wojo label"><?php echo Utility::currencySymbol();?></span>
          <input type="text" placeholder="<?php echo Lang::$word->PRD_PRICE;?>" name="price">
          <div class="wojo transparent label"><span class="wojo small text"><?php echo App::Core()->currency;?></span></div>
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->PRD_SPRICE;?>
          <i class="icon asterisk"></i></label>
        <div class="wojo right labeled input">
          <span class="wojo label"><?php echo Utility::currencySymbol();?></span>
          <input type="text" placeholder="<?php echo Lang::$word->PRD_SPRICE;?>" value="0" name="sprice">
          <div class="wojo transparent label"><span class="wojo small text"><?php echo App::Core()->currency;?></span></div>
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->PRD_TYPE;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox small radio field">
            <input name="type" type="radio" value="normal" checked="cheked">
            <label><?php echo Lang::$word->PRD_DEFAULT;?></label>
          </div>
          <div class="wojo checkbox small radio field">
            <input name="type" type="radio" value="affiliate">
            <label><?php echo Lang::$word->PRD_AFFILIATE;?></label>
          </div>
          <div class="wojo checkbox small radio field">
            <input name="type" type="radio" value="cdkey">
            <label><?php echo Lang::$word->PRD_CDKEY;?></label>
          </div>
        </div>
      </div>
    </div>
    <div id="affiliate" class="hide-all">
      <div class="wojo fields">
        <div class="field">
          <label><?php echo Lang::$word->PRD_AFFURL;?>
            <i class="icon asterisk"></i></label>
          <input type="text" placeholder="<?php echo Lang::$word->PRD_AFFURL;?>" name="affiliate">
        </div>
      </div>
    </div>
    <div id="cdkey" class="hide-all">
      <div class="wojo fields">
        <div class="field five wide">
          <label><?php echo Lang::$word->PRD_CDKEYS;?>
            <i class="icon asterisk"></i></label>
          <textarea name="cdkeys"></textarea>
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <div class="wojo primary attached segment">
          <h6 class="wojo secondary text"><?php echo Lang::$word->PRD_MLEVEL;?></h6>
          <div class="wojo divided horizontal list">
            <?php if($this->membership_list):?>
            <?php foreach($this->membership_list as $mrow):?>
            <div class="item">
              <div class="content middle aligned">
                <div class="wojo checkbox small">
                  <input type="checkbox" name="memberships[]" value="<?php echo $mrow->id;?>">
                  <label><?php echo $mrow->title;?></label>
                </div>
              </div>
            </div>
            <?php endforeach;?>
            <?php endif;?>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo fitted divider"></div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CATEGORIES;?></label>
        <div class="wojo secondary attached segment">
          <div class="scrollbox_y" style="height:370px;">
            <div class="wojo relaxed divided list">
              <?php echo $this->droplist;?>
            </div>
          </div>
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->FILES;?></label>
        <div class="wojo secondary attached segment">
          <?php if($this->files):?>
          <div class="wojo small icon input" id="filter">
            <input type="text" placeholder="Filter">
            <i class="find icon"></i>
          </div>
          <div class="wojo divider"></div>
          <div class="scrollbox_y" style="height:300px;">
            <div id="fsearch" class="wojo relaxed divided list">
              <?php foreach($this->files as $file):?>
              <?php $is_checked = (Validator::get('file') and Validator::get('file') ==  $file->id) ? ' checked="checked"' : null;?>
              <?php $is_active = (Validator::get('file') and Validator::get('file') ==  $file->id) ? ' highlite' : null;?>
              <div class="item<?php echo $is_active;?>">
                <div class="right floated content"><small class="size"><?php echo File::getSize($file->filesize);?> - <?php echo $file->extension;?></small></div>
                <div class="wojo mime basic image" style="background-color:<?php echo Product::fileStyle($file->extension);?>"><?php echo Product::fileIcon($file->extension, "");?></div>
                <div class="content middle aligned">
                  <div class="wojo checkbox small">
                    <input type="checkbox" name="files[]" value="<?php echo $file->id;?>"<?php echo $is_checked;?>>
                    <label><?php echo $file->alias;?></label>
                  </div>
                </div>
              </div>
              <?php endforeach;?>
            </div>
          </div>
          <?php endif;?>
        </div>
      </div>
    </div>
    <a class="wojo left floating tiny icon button" data-trigger="#uImages" data-type="slideDown" data-velocity="true" ><i class="icon chevron down"></i></a>
    <div class="hide-all" id="uImages">
      <div class="wojo basic attached segment">
        <h6 class="wojo secondary text"><?php echo Lang::$word->CF_TITLE;?></h6>
        <?php echo $this->custom_fields;?></div>
      <div class="wojo fields">
        <div class="field">
          <h6 class="wojo secondary text"><?php echo Lang::$word->IMAGES;?></h6>
          <label class="input">
            <input type="file" name="images" id="images" data-buttonClass="secondary" data-buttonText="<?php echo Lang::$word->MULTIPLE;?>" data-fields='{"qAction":1, "page":"processImages","id":<?php echo App::Session()->get("digitoken");?>}' class="filefield" multiple>
          </label>
          <div class="wojo boxed segment">
            <div class="scrollbox_y" style="height:300px;">
              <div class="row phone-block-1 mobile-block-2 tablet-block-3 screen-block-4 gutters content-center" id="sortable"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->PRD_EXPIRY;?>
          <i class="icon asterisk"></i></label>
        <div class="wojo action input">
          <input type="text" placeholder="<?php echo Lang::$word->PRD_EXPIRY;?>" value="0" name="expiry">
          <select name="expiry_type" class="wojo dropdown">
            <option value="days"><?php echo Lang::$word->PRD_EXP_DAYS;?></option>
            <option value="downloads"><?php echo Lang::$word->PRD_EXP_DOWN;?></option>
          </select>
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->PUBLISHED;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="active" type="radio" value="1" checked="chcked">
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="active" type="radio" value="0">
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo fitted divider"></div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->PRD_BODY;?></label>
        <textarea class="bodypost" name="body"></textarea>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->PRD_PBODY;?></label>
        <textarea class="bodypost" name="pbody"></textarea>
      </div>
    </div>
    <div class="wojo fitted divider"></div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->PRD_IMG;?></label>
        <input type="file" data-buttonText="<?php echo Lang::$word->BROWSE;?>" name="thumb" id="thumb" class="filefield">
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->PRD_AUDIO;?></label>
        <input type="file" data-buttonText="<?php echo Lang::$word->BROWSE;?>" name="audio" id="audio" class="filefield">
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->PRD_YTUBE;?></label>
        <div class="wojo left icon input">
          <i class="icon youtube alt"></i>
          <input type="text" placeholder="<?php echo Lang::$word->PRD_YTUBE;?>" name="youtube">
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->PRD_TAGS;?></label>
        <div class="wojo left icon input">
          <i class="icon tags"></i>
          <input type="text" placeholder="<?php echo Lang::$word->PRD_TAGS;?>" name="tags">
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->METAKEYS;?></label>
        <textarea class="small" placeholder="<?php echo Lang::$word->METAKEYS;?>" name="keywords"></textarea>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->METADESC;?></label>
        <textarea class="small" placeholder="<?php echo Lang::$word->METADESC;?>" name="description"></textarea>
      </div>
    </div>
  </div>
  <div class="content-center">
    <a href="<?php echo Url::url("/admin/products");?>" class="wojo small basic button"><?php echo Lang::$word->CANCEL;?></a>
    <button type="button" data-action="processItem" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->PRD_CREATE;?></button>
  </div>
</form>