<commit_before>{page::header()}
{page::toolbar()}

<script type="text/javascript" language="javascript">
$(document).ready(function() {
  {if !$productID}
  $('.view').hide();
  $('.edit').show();
  $('#productName').focus();
  {else}
  $('#editProduct').focus();
  {/}
});
</script>

<form action="{$url_alloc_product}" method="post">
<input type="hidden" name="productID" value="{$productID}">
<table class="box">
  <tr>
    <th>Product</th>
    <th class="right">{page::help("product")}</th>
  </tr>
  <tr>
    <td colspan="2" valign="top">
      <div style="float:left; width:47%; padding:0px 12px; vertical-align:top;">

        <div class="view">
          <h6>Product Name{page::mandatory($productName)}</h6>
          <h2 style="margin-bottom:0px; display:inline;">{=$productName}</h2>
        </div>
        <div class="edit">
          <h6>Product Name{page::mandatory($productName)}</h6>
          <input type="text" style="width:100%" maxlength="255" id="productName" name="productName" value="{$productName}">
        </div>

        {if $description}
        <div class="view">
          <h6>Description</h6>
          {=$description}
        </div>
        {/}
        <div class="edit">
          <h6>Description</h6>
          <input type="text" style="width:100%" maxlength="255" id="description" name="description" value="{$description}">
        </div>


        {if $comment}
        <div class="view">
          <h6>Comment</h6>
          {page::to_html($comment)}
        </div>
        {/}
        <div class="edit">
          <h6>Comment</h6>
          {page::textarea("comment",$comment, array("width"=>"100%"))}
        </div>

      </div>
      
      <div style="float:right; width:47%; padding:0px 12px; vertical-align:top;">

      {if $taxName}
        {$sellPrice_check = sprintf("<input type='checkbox' name='sellPriceIncTax' value='1'%s> inc %s" ,$sellPriceIncTax ? ' checked':'',$taxName)}
        {if $sellPriceIncTax}
          {$sellPrice_label = " (inc ".$taxName.")"}
        {else}
          {$sellPrice_label = " (ex ".$taxName.")"}
        {/}
      {/}

        <div class="view">
          <h6>Sell Price{$sellPrice_label}{page::mandatory($sellPrice)}<div>Active</div></h6>
          <div style="float:left; width:30%;">
            {$sellPrice} {$sellPriceCurrencyTypeID}
          </div>
          <div style="float:right; width:50%;">
            {if $productActive}Yes{else}No{/}
          </div>
        </div>
        <div class="edit">
          <h6>Sell Price{$taxLabel}{page::mandatory($sellPrice)}<div>Active</div></h6>
          <div style="float:left; width:30%;" class="nobr">
            <input type="text" size="8" name="sellPrice" id="sellPrice" value="{$sellPrice}">
            <select name="sellPriceCurrencyTypeID">{$sellPriceCurrencyOptions}</select>
            {$sellPrice_check} 
          </div>
          <div style="float:right; width:50%;" class="nobr">
            <input type="checkbox" name="productActive" {if $productActive || !$productID}checked="checked"{/}>
          </div>
        </div>
    
      </div>
    </td>
  </tr>
  <tr>
    <td colspan="2" align="center" class="padded">
      <div class="view" style="margin-top:20px">
        <input type="button" id="editProduct" value="Edit Product" onClick="$('.view').hide();$('.edit').show();">
      </div>
      <div class="edit" style="margin-top:20px">
        <input type="hidden" name="productSaleID" value="{$_REQUEST.productSaleID}">
        <input type="submit" name="save" value="Save">
        <input type="button" value="Cancel Edit" onClick="$('.edit').hide();$('.view').show();">
      </div>
    </td>
  </tr>
</table>
<input type="hidden" name="sessID" value="{$sessID}">
</form>

{if $productID}

<form action="{$url_alloc_product}" method="post">
<input type="hidden" name="productID" value="{$productID}">
<table class="box">
  <tr>
    <th class="header">Product Costs
      <span>
        <a href="#x" class="magic" onClick="$('#product_cost_footer').before('<tr>'+$('#product_cost_row').html()+'</tr>');">New</a>
        {page::help("product_fixedCost")}
      </span>
    </th>
  </tr>
  <tr>
    <td>

      <table class="list">
        <tr>
          <th width="15%">Amount</th>
          <th width="35%">Source TF</th>
          <th>Description</th>
          {if config::get_config_item("taxName")}
            <th>{echo config::get_config_item("taxName")}</th>
          {/}<commit_msg>COSMETIC Hide Cancel Edit button if creating a product.<commit_after>{page::header()}
{page::toolbar()}

<script type="text/javascript" language="javascript">
$(document).ready(function() {
  {if !$productID}
  $('.view').hide();
  $('.edit').show();
  $('#productName').focus();
  {else}
  $('#editProduct').focus();
  {/}
});
</script>

<form action="{$url_alloc_product}" method="post">
<input type="hidden" name="productID" value="{$productID}">
<table class="box">
  <tr>
    <th>Product</th>
    <th class="right">{page::help("product")}</th>
  </tr>
  <tr>
    <td colspan="2" valign="top">
      <div style="float:left; width:47%; padding:0px 12px; vertical-align:top;">

        <div class="view">
          <h6>Product Name{page::mandatory($productName)}</h6>
          <h2 style="margin-bottom:0px; display:inline;">{=$productName}</h2>
        </div>
        <div class="edit">
          <h6>Product Name{page::mandatory($productName)}</h6>
          <input type="text" style="width:100%" maxlength="255" id="productName" name="productName" value="{$productName}">
        </div>

        {if $description}
        <div class="view">
          <h6>Description</h6>
          {=$description}
        </div>
        {/}
        <div class="edit">
          <h6>Description</h6>
          <input type="text" style="width:100%" maxlength="255" id="description" name="description" value="{$description}">
        </div>


        {if $comment}
        <div class="view">
          <h6>Comment</h6>
          {page::to_html($comment)}
        </div>
        {/}
        <div class="edit">
          <h6>Comment</h6>
          {page::textarea("comment",$comment, array("width"=>"100%"))}
        </div>

      </div>
      
      <div style="float:right; width:47%; padding:0px 12px; vertical-align:top;">

      {if $taxName}
        {$sellPrice_check = sprintf("<input type='checkbox' name='sellPriceIncTax' value='1'%s> inc %s" ,$sellPriceIncTax ? ' checked':'',$taxName)}
        {if $sellPriceIncTax}
          {$sellPrice_label = " (inc ".$taxName.")"}
        {else}
          {$sellPrice_label = " (ex ".$taxName.")"}
        {/}
      {/}

        <div class="view">
          <h6>Sell Price{$sellPrice_label}{page::mandatory($sellPrice)}<div>Active</div></h6>
          <div style="float:left; width:30%;">
            {$sellPrice} {$sellPriceCurrencyTypeID}
          </div>
          <div style="float:right; width:50%;">
            {if $productActive}Yes{else}No{/}
          </div>
        </div>
        <div class="edit">
          <h6>Sell Price{$taxLabel}{page::mandatory($sellPrice)}<div>Active</div></h6>
          <div style="float:left; width:30%;" class="nobr">
            <input type="text" size="8" name="sellPrice" id="sellPrice" value="{$sellPrice}">
            <select name="sellPriceCurrencyTypeID">{$sellPriceCurrencyOptions}</select>
            {$sellPrice_check} 
          </div>
          <div style="float:right; width:50%;" class="nobr">
            <input type="checkbox" name="productActive" {if $productActive || !$productID}checked="checked"{/}>
          </div>
        </div>
    
      </div>
    </td>
  </tr>
  <tr>
    <td colspan="2" align="center" class="padded">
      <div class="view" style="margin-top:20px">
        <input type="button" id="editProduct" value="Edit Product" onClick="$('.view').hide();$('.edit').show();">
      </div>
      <div class="edit" style="margin-top:20px">
        <input type="hidden" name="productSaleID" value="{$_REQUEST.productSaleID}">
        <input type="submit" name="save" value="Save">
        {if $productID}
        <input type="button" value="Cancel Edit" onClick="$('.edit').hide();$('.view').show();">
        {/}
      </div>
    </td>
  </tr>
</table>
<input type="hidden" name="sessID" value="{$sessID}">
</form>

{if $productID}

<form action="{$url_alloc_product}" method="post">
<input type="hidden" name="productID" value="{$productID}">
<table class="box">
  <tr>
    <th class="header">Product Costs
      <span>
        <a href="#x" class="magic" onClick="$('#product_cost_footer').before('<tr>'+$('#product_cost_row').html()+'</tr>');">New</a>
        {page::help("product_fixedCost")}
      </span>
    </th>
  </tr>
  <tr>
    <td>

      <table class="list">
        <tr>
          <th width="15%">Amount</th>
          <th width="35%">Source TF</th>
          <th>Description</th>
          {if config::get_config_item("taxName")}
            <th>{echo config::get_config_item("taxName")}</th>
          {/}
{'fraction_non_alphanumeric': 0.21664067721096011, 'fraction_numerical': 0.014257072844731567, 'mean_word_length': 2.9005212858384013, 'pattern_counts': {'":': 0, '<': 227, '<?xml version=': 0, '>': 229, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2616234', 'n_tokens_mistral': 3078, 'n_tokens_neox': 2956, 'n_words': 500}