<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>{#$txt_title#} - Powered by HuCart.COM</title>
<link href="./css/bootstrap.min.css" rel="stylesheet">
<link href="./css/info.css" rel="stylesheet">
<script language="javascript" src="{#$base_weburl#}/js/pinyin.js"></script>
<script language="javascript" src="{#$base_weburl#}/js/admin_common.js"></script>
<!--[if lt IE 9]>
  <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script language="javascript">
	var webroot_url = '{#$base_weburl#}';
	function submitFun()
	{
			var idpro_name 			= document.getElementById('pro_name');
			var idprs_id 			= document.getElementById('prs_id');
			var idpro_num 			= document.getElementById('pro_num');
			var idpro_unit 			= document.getElementById('pro_unit');
			var idpro_img 			= document.getElementById('pro_img');
			var idpro_sell_price 	= document.getElementById('pro_sell_price');
			var content				= CKEDITOR.instances.pro_content.getData();
			//var idsuggestionInfo 	= document.getElementById('suggestionInfo');
	
			if(idpro_name.value=='')
			{
				alert('{#$lang.pro_name_err#}');
				idpro_name.focus();
				return false;
			}else if(idprs_id.value=='')
			{
				alert('{#$lang.prs_id_err#}');
				idprs_id.focus();
				return false;
			}else if(idpro_num.value=='')
			{
				alert('{#$lang.pro_num_err#}');
				idpro_num.focus();
				return false;
			}else if(idpro_unit.value=='')
			{
				alert('{#$lang.pro_unit_err#}');
				idpro_unit.focus();
				return false;
			}else if(idpro_img.value=='')
			{
				alert('{#$lang.pro_img_err#}');
				idpro_img.focus();
				return false;
			}else if(idpro_sell_price.value=='')
			{
				alert('{#$lang.pro_sell_price_err#}');
				idpro_sell_price.focus();
				return false;
			}else if(content=='')
			{
				alert('{#$lang.pro_content_err#}');
				CKEDITOR.instances.pro_content.focus();
				return false;
			}
	
			//document.formSub.action='./index.php?load=product&act=add_info';
			document.formSub.target="_self"
			document.formSub.submit();
	}
	
	
	function get_pro_attribute(obj,pro_id_val)
	{
		$.post("./index.php?load=ajax_pro_type&act=get_pro_type",{ prt_id: obj.value,pro_id:pro_id_val },function(data){
		$("#div_pro_attribute").html(data);
		});	
	}
	
	function is_exists_barcode(obj)
	{
		pro_id_val = document.getElementById('pro_id').value;
		if(obj.value!=''){
			$.post("./index.php?load=ajax_exists_barcode&act=get_barcode",{barcode_val: obj.value ,pro_id:pro_id_val },function(data){
				if(data=='error'){
					$("#barcode_show_div").css("color","red");
					$("#barcode_show_div").html('{#$lang.barcode_exists_say#}');
				}else{
					$("#barcode_show_div").css("color","black");
					$("#barcode_show_div").html('{#$lang.barcode_say#}');
					}
			});
		}
	}
</script>
</head>
<body>
    <div class="info-tit"><span class="glyphicon glyphicon-paperclip"> </span> {#$lang.title#} > {#$txt_title#} ({#$lang.need_edit#}&nbsp;&nbsp; {#$lang.need_add#} {#$lang.need_del#})<a href="http://help.hucart.com/item-product_edit.html" target="_blank"  title="{#$lang.help_url#}"><span class="glyphicon glyphicon-question-sign" style="float: right;"></span></a></div>
    <!-- custom con start -->
    <div class="info-add">
      <form class="form-horizontal" name="add-form" id="add-form" method="post" action="{#$act_url#}">
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"><font color="red">*</font> {#$lang.field_list.pro_name#}</label>
          <div class="col-sm-10">
            <input class="form-control" name="pro_name" id="pro_name" value="{#$info.pro_name#}" type="text"  style="width:450px;"  onblur="getPinYinValue('pro_name','pro_phoneticize')"  >
          </div>
        </div>
  
        <div class="form-group form-group-sm" style="display:none;">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.pro_phoneticize#}</label>
          <div class="col-sm-3">
            <input class="form-control" name="pro_phoneticize" id="pro_phoneticize" value="{#$info.pro_phoneticize#}" type="text"  style="width:300px;"    >
          </div><div class="col-sm-3">{#$lang.phoneticize_say#}</div>
        </div>   
        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"><font color="red">*</font> {#$lang.field_list.prs_id#}</label>
          <div class="col-sm-3">
            {#$pro_sort_select#}
          </div>
        </div>      
        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.bra_id#}</label>
          <div class="col-sm-3">
            {#$brand_select#} 
          </div>
        </div> 

        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.prt_id#}</label>
          <div class="col-sm-3">
            {#$pro_type_select#} 
          </div><script language="javascript" >
obj =  document.getElementById('prt_id');
get_pro_attribute(obj, '{#$info.pro_id#}');</script>
        </div> 

        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.prt_id_val#}</label>
          <div class="col-sm-6">
           <div id="div_pro_attribute"></div>
          </div>
        </div> 

        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.pro_barcode#}</label>
          <div class="col-sm-3">
            <input class="form-control" name="pro_barcode" id="pro_barcode" value="{#$info.pro_barcode#}" type="text"  style="width:300px;"  onblur="is_exists_barcode(this)"   >
          </div><div class="col-sm-4" style="margin-left:12px;" id="barcode_show_div">{#$lang.barcode_say#}</div>
        </div>
        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.pro_spec#}</label>
          <div class="col-sm-6">
            <input class="form-control" name="pro_spec" id="pro_spec" value="{#$info.pro_spec#}" type="text"  style="width:300px;"    >
          </div>
        </div>
        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"><font color="red">*</font> {#$lang.field_list.pro_num#}</label>
          <div class="col-sm-6">
            <input class="form-control" name="pro_num" id="pro_num" value="{#$info.pro_num#}" type="text"  style="width:300px;"    >
          </div>
        </div> 
        
        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"><font color="red">*</font> {#$lang.field_list.pro_unit#}</label>
          <div class="col-sm-6">
            <input class="form-control" name="pro_unit" id="pro_unit" value="{#$info.pro_unit#}" type="text"  style="width:300px;"    >
          </div>
        </div> 
        
        
        <div class="form-group form-group-sm" id="img_div_arr">
          <label class="col-sm-2 control-label" for="i-tit"><font color="red">*</font> {#$lang.field_list.pro_img#} <span  onclick="add_img_div()" >(+)</span></label>
          <div class="col-sm-3">
            <input class="form-control" name="pro_img[]" id="pro_img_0" value="{#$info.pro_img#}" type="text"  style="width:300px;"    >
          </div>
          <div class="col-sm-3" style="margin-left:12px;"><button type="button" class="btn btn-default"  onclick="select_img('product','pro_img_0')" >{#$lang.add_img#}</button></div>
        </div> 
 {#foreach item=img_item key=img_key from=$img_info#}
        <div class="form-group form-group-sm" id="imgdel_{#$img_key#}">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.pro_img#} <span  onclick="del_img_div('del_{#$img_key#}')" >(-)</span></label>
          <div class="col-sm-3">
            <input class="form-control" name="pro_img[]" id="pro_img_a{#$img_key#}" value="{#$img_item.pri_url#}" type="text"  style="width:300px;"    >
          </div>
          <div class="col-sm-3" style="margin-left:12px;"><button type="button" class="btn btn-default" onclick="select_img('product','pro_img_a{#$img_key#}')" >{#$lang.add_img#}</button></div>
        </div> 
 
 {#/foreach#}

        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.pro_production#}</label>
          <div class="col-sm-6">
            <input class="form-control" name="pro_production" id="pro_production" value="{#$info.pro_production#}" type="text"  style="width:300px;"    >
          </div>
        </div> 


        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"><font color="red">*</font> {#$lang.field_list.pro_sell_price#}</label>
          <div class="col-sm-6">
            <input class="form-control" name="pro_sell_price" id="pro_sell_price" value="{#$info.pro_sell_price#}" type="text"  style="width:300px;"    >
          </div>
        </div> 
        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.pro_market_price#}</label>
          <div class="col-sm-6">
            <input class="form-control" name="pro_market_price" id="pro_market_price" value="{#$info.pro_market_price#}" type="text"  style="width:300px;"    >
          </div>
        </div> 
        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.pro_lowest_price#}</label>
          <div class="col-sm-6">
            <input class="form-control" name="pro_lowest_price" id="pro_lowest_price" value="{#$info.pro_lowest_price#}" type="text"  style="width:300px;"    >
          </div>
        </div> 
        
        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"> {#$lang.field_list.pro_buy_price#}</label>
          <div class="col-sm-6">
            <input class="form-control" name="pro_buy_price" id="pro_buy_price" value="{#$info.pro_buy_price#}" type="text"  style="width:300px;"    >
          </div>
        </div> 

        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"><font color="red">*</font> {#$lang.field_list.pro_content#}</label>
          <div class="col-sm-6">
            {#$ckeditorLoad#}
          </div>
        </div> 

        <div class="form-group form-group-sm">
          <label class="col-sm-2 control-label" for="i-tit"><font color="red">*</font> {#$lang.field_list.pro_enabled#}</label>
          <div class="col-sm-6">
{#foreach key=ek item=ei from=$lang.enabled_arr#}&nbsp;&nbsp;
{#$ei#}<input type="radio"   name="pro_enabled" id="pro_enabled[{#$ek#}]"  value="{#$ek#}" {#if $ek eq 1#} checked="checked" {#/if#}>
{#/foreach#}
          </div>
        </div> 

        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary  btn-sm" onclick="return submitFun(this)" >{#$edit_submit#}</button>&nbsp;&nbsp;&nbsp;&nbsp;
            <button type="reset" class="btn btn-default btn-sm">{#$lang.reset#}</button>
          </div>
        </div>
        <input type="hidden" name="act_type" value="{#$act_type#}">
        <input type="hidden" name="pro_id" id="pro_id"  value="{#$info.pro_id#}">
      </form>
    </div>
    <!-- custom con end -->

    <footer class="footer">
      <div class="container">
        <p class="text-muted">Powered by <a href="http://Www.HuCart.COM" target="_blank">HuCart.COM</a></p>
      </div>
    </footer>
<script src="{#$base_weburl#}/js/jquery.min.js"></script>
<script src="{#$base_weburl#}/js/base.js"></script>
   <script language="javascript">
   var index_key = 0 ;
   function add_tr(obj_id)
   {
		var obj_id 			= obj_id;
		var sml_val 		= index_key;
		var show_name 		= $("#txt_pra_name_"+obj_id).val();
		var input_str 		= $("#show_val_id_"+obj_id).html(); 
		var price_str 		= $("#show_pri_id_"+obj_id).html();
		//alert(input_str);
		$('#pra_tr_'+obj_id).after("<tr  id=\"pra_tr_"+obj_id+"_sm"+sml_val+"\"   bgcolor=\"#f3f3f3\" onMouseOut=\"this.bgColor='#f3f3f3';\"; onMouseOver=\"this.bgColor='#C3E2FF';\" ><td class=\"tdcenter\">"+show_name+"</td><td class=\"keykey\">"+input_str+"</td><td class=\"keykey\">"+price_str+"</td><td class=\"keykey\"> <span  onclick=\"del_tr("+obj_id+","+sml_val+")\" >(-)</span> </td></tr>");
		index_key = index_key + 1;
   }
	var index_img_key = 0;
   function add_img_div()
   {
		$('#img_div_arr').after('<div class="form-group form-group-sm" id=\"img'+index_img_key+'\" ><label class="col-sm-2 control-label" for="i-tit">{#$lang.field_list.pro_img#} <span  onclick="del_img_div('+index_img_key+')" >(-)</span></label><div class="col-sm-3"><input class="form-control" name="pro_img[]" id="pro_img_b'+index_img_key+'" value="{#$info.pro_img#}" type="text"  style="width:300px;"></div><div class="col-sm-3"><button type="button" class="btn btn-default" onclick="select_img(\'product\',\'pro_img_b'+index_img_key+'\')" >{#$lang.add_img#}</button></div></div>');
		index_img_key = index_img_key + 1;   
   }
   

   function del_img_div(del_key)
   { 
		 var is_del = window.confirm("{#$lang.is_delete#}");  
 		 var obj_id = obj_id;
         if(!is_del){  
              return false;  
          }else{  
              $('#img'+del_key).remove();  
              return false;  
          }  
          return false;  
   }
   
   
   function del_tr(obj_id,sml_val)
   { 
		 var is_del = window.confirm("{#$lang.is_delete#}");  
 		 var obj_id = obj_id;
         if(!is_del){  
              return false;  
          }else{  
              $('#pra_tr_'+obj_id+'_sm'+sml_val).remove();  
              return false;  
          }  
          return false;  
   }
    </script>
</body>
</html>