<?php
  /**
   * Cuntries
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2020
   * @version $Id: countries.tpl.php, v1.00 2020-02-26 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;
?>
<?php switch(Url::segment($this->segments)): case "edit": ?>
<!-- Start edit -->
<div class="wojo heading message">
  <div class="content">
    <h3><?php echo Lang::$word->CNT_TITLE;?></h3>
  </div>
</div>
<div class="wojo segment form">
  <form method="post" id="wojo_form" name="wojo_form">
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->NAME;?>
          <i class="icon asterisk"></i></label>
        <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" value="<?php echo $this->data->name;?>" name="name">
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->CNT_CURCODE;?>
          <i class="icon asterisk"></i></label>
        <input type="text" placeholder="<?php echo Lang::$word->CNT_CURCODE;?>" value="<?php echo $this->data->currency_code;?>" name="currency_code">
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CNT_CURNAME;?>
          <i class="icon asterisk"></i></label>
        <input type="text" placeholder="<?php echo Lang::$word->CNT_CURNAME;?>" value="<?php echo $this->data->currency_name;?>" name="currency_name">
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->CNT_CURSYM;?>
          <i class="icon asterisk"></i></label>
        <input type="text" placeholder="<?php echo Lang::$word->CNT_CURSYM;?>" value="<?php echo $this->data->currrency_symbol;?>" name="currrency_symbol">
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->SORTING;?>
          <i class="icon asterisk"></i></label>
        <input type="text" placeholder="<?php echo Lang::$word->SORTING;?>" value="<?php echo $this->data->sorting;?>" name="sorting">
      </div>
    </div>
    <div class="center aligned">
      <a href="<?php echo Url::url("/admin/countries");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a>
      <button type="button" data-action="processCountry" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->CNT_UPDATE;?></button>
    </div>
    <input type="hidden" name="id" value="<?php echo $this->data->id;?>">
  </form>
</div>
<?php break;?>
<?php default: ?>
<div class="wojo heading message">
  <div class="content">
    <h3><?php echo Lang::$word->CNT_TITLE;?></h3>
    <p class="wojo small grey text"><?php echo Lang::$word->CNT_INFO;?></p>
  </div>
</div>
<div class="wojo segment">
  <table class="wojo basic responsive table">
    <thead>
      <tr>
        <th class="auto center aligned"><i class="icon disabled id"></i></th>
        <th><?php echo Lang::$word->NAME;?></th>
        <th><?php echo Lang::$word->EMT_SUBJECT;?></th>
        <th class="center aligned"><?php echo Lang::$word->ACTIONS;?></th>
      </tr>
    </thead>
    <?php foreach ($this->data as $row):?>
    <tr id="item_<?php echo $row->id;?>">
      <td><span class="wojo small label"><?php echo $row->sorting;?></span></td>
      <td><a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>" class="grey">
        <?php echo $row->name;?></a></td>
      <td><?php echo $row->currency_name;?></td>
      <td class="auto"><a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>" class="wojo icon primary inverted circular button"><i class="icon note"></i></a></td>
    </tr>
    <?php endforeach;?>
  </table>
</div>
<?php break;?>
<?php endswitch;?>
