<?php

/*------------------------------------------------------------------------
# com_invoices - Invoice Manager for Joomla
# ------------------------------------------------------------------------
# author        Germinal Camps
# copyright       Copyright (C) 2012 - 2016 JoomlaThat.com. All Rights Reserved.
# @license        http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites:       http://www.joomlathat.com
# Technical Support:  Forum - http://www.joomlathat.com/support
-------------------------------------------------------------------------*/

//no direct access
defined('_JEXEC') or die('Restricted access.'); 

//taxes for v 2.1
$taxrows = "";
$selected_tax = JText::_('TAX');

for ($j=0, $m=count( $this->taxes );$j < $m; $j++)  {
    $row = &$this->taxes[$j];
    
    if($row->id == $this->params->get('tax_id',0)) $selected_tax = $row->name;
   
  $taxrows .= '<li><a class="noHrefLink" onclick="set_item_tax(\'0_{{new_line}}\','.$row->id.',jQuery(this))">'.$row->name.'</a></li>';
}
?>
<tr id="itemrow0_{{new_line}}">
 
    <td >
      <input type="hidden" name="0_external_type_{{new_line}}" id="0_external_type_{{new_line}}" value="" />
      <input type="hidden" name="0_product_id_{{new_line}}" id="0_product_id_{{new_line}}" value="" />
      <input type="hidden" class="tax_id_input" name="0_tax_id_{{new_line}}" id="0_tax_id_{{new_line}}" value="<?php echo $this->params->get('tax_id',0); ?>" />
    </td>

    <td class="form-horizontal">

      <div class="input-group">
       <input class="form-control input-mini items_value" onchange="calculate_lines()" type="number" placeholder="<?php echo JText::_('VALUE');?>" name="0_value_{{new_line}}" id="0_value_{{new_line}}"  maxlength="10" value="" />
       <span class="input-group-addon ">x</span>
       <input class="form-control input-mini items_amount" onchange="calculate_lines()" type="number" placeholder="<?php echo JText::_('QTY');?>" name="0_amount_{{new_line}}" id="0_amount_{{new_line}}"  maxlength="10" value="" />
       <span class="input-group-addon ">-</span>
       <input class="form-control input-mini items_discount" onchange="calculate_lines()" type="number" placeholder="<?php echo JText::_('DISCOUNT');?>" name="0_discount_{{new_line}}" id="0_discount_{{new_line}}"  maxlength="10" value="" />
       <span class="input-group-addon ">+</span>

       <div class="input-group-btn tax-selector-dropdown">
          <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="tax-selector-title"><?php echo $selected_tax;?></span> <span class="caret"></span></button>
          <ul class="dropdown-menu">
            <li><a class="noHrefLink" onclick="set_item_tax('0_{{new_line}}',0,jQuery(this))"><?php echo JText::_('JNO');?></a></li>
            <?php echo $taxrows; ?>
          </ul>
        </div>

       <input class="form-control input-mini items_tax" onchange="calculate_lines()" type="number" placeholder="<?php echo JText::_('TAX');?>" name="0_tax_{{new_line}}" id="0_tax_{{new_line}}" maxlength="10" value="{{default_tax}}" />
       <span class="input-group-addon ">%</span>
     </div>

     <div class="row">
         <div class="form-group ">

          <div class="col-xs-9 name-container">
            <input class="form-control input-name" type="text" placeholder="<?php echo JText::_('NAME');?>" name="0_name_{{new_line}}" id="0_name_{{new_line}}"  maxlength="255" value="" />
          </div>

          <div class="col-xs-3 sku-container">
            <input class="form-control input-mini input-sku " type="text" placeholder="<?php echo JText::_('SKU');?>" name="0_sku_{{new_line}}" id="0_sku_{{new_line}}" maxlength="255" value="" />
          </div>

        </div>
      </div>

      <div class="form-group">
        <div class="col-xs-12 desc-container">
          <input class="form-control input-desc" type="text" placeholder="<?php echo JText::_('DESCRIPTION');?>" name="0_description_{{new_line}}" id="0_description_{{new_line}}"  maxlength="255" value="" />
        </div>

      </div>

   </td>

   <td>

    <div class="input-group"> 
      <span class="input-group-addon currency_before">{{currency_before}}</span>
      <input class="form-control input-mini items_total" readonly type="text" name="total_{{new_line}}" id="total_{{new_line}}" maxlength="10" value="" />
      <span class="input-group-addon currency_after">{{currency_after}}</span> 
    </div>

  </td>
</tr>