Location: PHPKode > projects > CoreAsset > coreasset/templates/show_asset.tpl
{include file="head.tpl"}
{include file="left.tpl"}

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="21"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/corner9.gif" width="5" height="21"></td>	
<td width="99%" class="header"><span class="whitetext">

  Show Asset
</span></td>
<td><img src="images/corner10.gif" width="5" height="21"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="border3side" valign="top" height="100%"><table width="100%" height="100%" border="0" cellspacing="8" cellpadding="0">
<tr>
<td valign="top">

<!-- #######################   Paste the Table to Table from here ############## -->
<form name="f1" method="post" action="?act=Submit">
<table cellSpacing="0" cellPadding="0" width="98%" align="center" border="0">
       
          <tr>
           
             <td>
            {if $status < 4}
				<table borderColor="#ffffff" cellSpacing="1" cellPadding="0" width="100%" border="0">
             
               <tr>
                  <td class="list_item" width="38%">
                  &nbsp;Nick Name</td>
                  <td class="list_item" width="">&nbsp;{$asset_nickname}</td>
                </tr>
                

                <tr>
                  <td class="list_item" width="38%">
                  &nbsp;Purchase Order No.</td>
                  <td class="list_item" width="">&nbsp;{$po_no}</td>
                </tr>

                <tr>
                  <td class="list_item" width="38%">
                  &nbsp;Price</td>
                  <td class="list_item" width="">&nbsp;{$asset_price}</td>
                </tr>

                <tr>
                  <td class="list_item" width="38%">
                  &nbsp;Vendor Name</td>
                  <td class="list_item" width="">
                  <input name="vendor_id" type="hidden" size="20" value="{$vendor_id}">
                  &nbsp;{$vendor_name} </td>
				   <input type="hidden" name="cur_date" value="{$cur_date}" /> 
                </tr>
                 </table>
				 
				 <table cellSpacing="1" cellPadding="0" width="100%" border="0">
                

                <tr>
                  <td class="list_item" width="20%">
                  &nbsp;Decription</td>
                  <td class="list_item" width="33%">&nbsp;{$asset_description}</td>
                </tr>

               <tr>
                  <td class="list_item" width="20%">
                  &nbsp;Receive Date</td>
                  <td class="list_item" width="33%">&nbsp;{$receive_date}</td>
                </tr>

         
                <input name="asset_tag"  type="hidden"  value="{$asset_tag}">

            	
            </table>
            <table cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
	
	<tr>
		<td>
		<table cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
		<tr>
			<td colspan="7" height="10" ></td>
			</tr>
			<tr>
			     
			    <td colspan="3"  height="20"  class="header"  valign="top">
				<td colspan="8"  height="20"  class="header"  valign="top"><font color="#FFFFFF">&nbsp;Equipment Details</font></td>
			</tr>
			<tr>
			<td colspan="7" height="10" ></td>
			</tr>
			<tr>
				<td class="btn_bg" width="10%">&nbsp;<strong>Equipment</strong></td>
				<td class="btn_bg" width="10%"><strong>Serial</strong></td>
				<td class="btn_bg" width="14%"><strong>Manufacturer</strong></td>
				<td class="btn_bg" width="10%"><strong>Price</strong></td>
				<td class="btn_bg" width="10%"><strong>Warranty </strong></td>
				<td class="btn_bg" width="10%"><strong>Status</strong></td>
				<td class="btn_bg" width="16%" ><strong>Issued User</strong></td>
				<td class="btn_bg" width="15%"><strong>Change Status</strong></td>
			</tr>
		</table>
		</td>
	 </tr>
	 <tr>
	 	<td valign="top" colspan="8">
		<div id="eq_list" style="border:#000000 1px solid; height:140px;width:100%; display:inline;">
			<table cellSpacing="1" cellPadding="0" width="100%" align="center" border="0">
				  {assign var="sequence" value=1}
				  <input name="equi_id" type="hidden" size="20" value="{$equi_id}">
				  
				  {section name=i loop=$equipment_name}
				 
				 
				<!-- /****************for showing data ********************************/-->
				    
					  
				  <tr>
					  <td class="list_item" height="50%" width="10%"> 
						&nbsp;<u><i>{$equipment_name[i]}</i></u>
					  </td>
					  
					  <td class="list_item" height="50%" width="10%">
						  &nbsp;{$serial_no[i]}
						  <input type="hidden" name="serial[]" value="{$serial_no[i]}" size="2"  />
						  <input type="hidden" name="serial_id[]" value="{$serial_id[i]}" size="2" id="serial"/>
					  </td>
					  
					  <td class="list_item" height="50%" width="14%">
						&nbsp;&nbsp;{$man[i]}
					  </td>
					  
					  <td class="list_item" height="50%" width="10%">
						&nbsp;&nbsp;{$eq_price[i]} 
					  </td>
					  
					  <td class="list_item" height="50%" width="10%">
						&nbsp;{$expiry_date[i]}
					  </td>
						  
					  <td class="list_item" height="50%" width="10%">
						&nbsp;{if $stat[i] == 1}<font color="GREEN">OK</font>{elseif $stat[i] == 2}<font color="DARKORANGE">Repairing</font>{elseif $stat[i] == 3}<font color="RED">Obsolete</font>{/if}
					  </td>
					  
						<input type="hidden" name="cur_stat[]" id="cur_stat" value="{$stat[i]}" />
					  
					  <td class="list_item" height="50%" width="16%">
						{if $issud_usernm[i]!=""}{$issud_usernm[i]}{else}<font color="darkorange">Not Assigned</font>{/if}
					  </td>
					  
					  <td class="list_item" height="50%" width="15%" align="center">
						<input type="checkbox" name="{'status_eq'|cat:$sequence}" id="{'status_eq'|cat:$sequence}" onclick="status_op(this,{$sequence},{$stat})" value="ok" {if $stat[i] == 3} disabled {/if}>
					  </td>
				  </tr>
				 
   				  <tr>	 
				      <td class="list_item" colspan="2"></td>
					  <td class="list_item" colspan="6" height="0"> 
					 <div id="{'eq_div_'|cat:$sequence}" style="border:#000000 1px solid; height:auto;width:400px; display:none; float:left;">
					  <table cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
					  <tr><td class="btn_bg1" colspan="8"></td></tr>
					  <tr>
					    <td class="list_item"></td>
					    <td class="list_item">Status</td>
						<td class="list_item">
						<select name="status[]" id="status" onchange="change_reason(this,{$stat[i]},{$sequence})">
						<option value="" selected>Select status</option>
						<option value="1" {if $stat[i]==1}selected{/if}>OK</option>
						<option value="2" {if $stat[i]==2}selected{/if}>Repairing</option>
						<option value="3" {if $stat[i]==3}selected{/if}>Obsolete</option>
						</select>
						</td>
					  </tr>
					  <tr>
					  	<td class="list_item" width="15%"></td>
					  	<td class="list_item">Comment</td>
						<td class="list_item">
						<input type="hidden" name="ser[]" id="ser" value="{$sequence}"  size="2"/>
						<textarea name="reason[]"  id="reason" rows="5">{$reason[i]}</textarea></td>
					  </tr>
					  <tr><td class="btn_bg1" colspan="8">
					  
					  <a onclick="return close_div({$sequence});"><img src="images/done_btn.gif" title="Done" border="0" style="cursor:pointer"/></a>
					  <a onclick="unchecked_box({$sequence});" ><img src="images/close_btn.gif" title="Close" border="0" style="cursor:pointer"/></a>
					
					  </td></tr>
					  </table>
					  
					  </div>
					  <input type="hidden" name="seq[]" id="seq" value="{$sequence++}" size="2" />
					  
					  </td>
					  <td class="txtbox_bgcolor" height="50%" colspan="1"></td>
				  </tr>
				   
				    	
				  {/section}
				  <input type="hidden" name="total_rows" id="total_rows" value="{$sequence-1}" size="2" />
				  
				 
				 
			</table>
			<table cellSpacing="1" cellPadding="0" width="100%" border="0">
			<tr>
			
			
			<td class="btn_bg1" colspan="8">
			<input type="image" src="images/go_btn.gif"  name="Submit" value="Submit" id="Submit" disabled="disabled" title="Apply Changes"/>
			</td>
			
			</tr>
			</table>
		 </div>
		 </td>
	 </tr>
	 </form>
 </table>
			
            {else}
            <table cellSpacing="1" cellPadding="0" width="100%" border="0">
                <tr>
                  <td class="txt" align="center" width="20%" height="23">
                  <font color="RED">{$mes}</font>
                  </td>
                </tr>
             </table>
            {/if}
            </td>
          </tr>
         
          </table>
        </td>
      </tr>
    </table>



<!-- ########################      End Here ##########################-->

{include file="foot.tpl"}
{literal}
<script language="javascript">
var old_reason	= new Array();
function change_reason(obj,old_stat,ind,reas)
{   
    var o = document.f1.elements["serial"];
	//alert(o.length);
	if(!o.length)
	{
	    //alert("if");
		var new_stat	= obj.value;
		var ob			= document.f1.reason;
		if(ob.value) {var text		= ob.value;}
		//var old_text    = ob[ind-1]  		
		if(new_stat == old_stat)
		{
			ob.value	= old_reason[0];
		}
		else
		{
			if(!old_reason[0]){old_reason[0]	= text;}
			ob.value	= "";
		}
	  	
	}
	else
	{
		//alert("else");
		var new_stat	= obj.value;
		var ob			= document.f1.elements["reason"];
		var text		= ob[ind-1].value;
        /*var old_text    = ob[old_stat-2].value;
		alert(old_stat+"--"+old_text);  */	
		if(new_stat == old_stat)
		{
			ob[ind-1].value	= old_reason[ind-1];
		}
		else
		{
			if(!old_reason[ind-1]){old_reason[ind-1]	= text; }
			ob[ind-1].value	= "";
		}
	}
}
function unchecked_box(i)
{
  chk_name = "status_eq"+i;
  document.getElementById(chk_name).checked = false;
  div_name = "eq_div_"+i;
  document.getElementById(div_name).style.display="none";
  all_show();
  rows = document.f1.total_rows.value;
  var f=0;
  for(var i= 1; i<=rows ;i++)
		{
			chk_name = "status_eq"+i;
			if(document.getElementById(chk_name).checked == true)
			{
			  f=1;  
			}
			
		}
		if(f==0)
		{
		  document.getElementById("Submit").disabled=true;
		}
}
function close_div(s)
{
  //alert(s);
  var obj_reason = document.f1.elements["reason"]; 
  var obj_status = document.f1.elements["status"];
 // alert(obj_reason);
// alert(obj_reason.length);
  if(obj_reason.length)
  {
	  var a= s-1;
	  if(obj_status[a].value=="")
	  {
		 alert("You Must Specify  The Status ");
		 obj_status[a].focus();
		 return false;
		 
	  }
	  if(obj_reason[a].value=="")
	  {
		 alert("You Must Specify  The Reason ");
		 obj_reason[a].focus();
		 return false;
		 
	  }
  }
  else
  {
  	if(obj_status.value=="")
	  {
		 alert("You Must Specify  The Status ");
		 obj_status.focus();
		 return false;
		 
	  }
	  if(obj_reason.value=="")
	  {
		 alert("You Must Specify  The Reason ");
		 obj_reason.focus();
		 return false;
		 
	  }
  }
 
  div_name = "eq_div_"+s;
  document.getElementById(div_name).style.display="none";
  if(if_chked())
	{
		document.getElementById("Submit").disabled=false;
	}
	else
	{
		document.getElementById("Submit").disabled=true;	
	}
  all_show(); 
  }
function all_show()
{
  rows = document.f1.total_rows.value;
  var obj_stat	= document.f1.elements["cur_stat"];
  //alert(obj_stat.length);
	   if(obj_stat.length)
	   {
		   for(var i= 1; i<=rows ;i++)
			{   
				chk_name = "status_eq"+i;
				var a=obj_stat[i-1].value;
				if(a != 3)
				{
					document.getElementById(chk_name).disabled = false;
				}
			}
		}
		else
		{
			chk_name = "status_eq1";
			var a=obj_stat.value;
			if(a != 3)
			{
				document.getElementById(chk_name).disabled = false;
			}
		}
}

function all_hide()
{ 
	rows = document.f1.total_rows.value;
	for(var i=1 ; i<=rows ;i++ )
	 {
	    div_name = "eq_div_"+i;
		document.getElementById(div_name).style.display="none";
		
	 }
}

function if_chked()
{
	rows = document.f1.total_rows.value;
	var flg = 0;
	
	for(var i=1; i<=rows; i++)
	{
		chk_name = "status_eq"+i;
		if(document.getElementById(chk_name).checked)
		{
			flg = 1;
		}

	}
	if(flg==1)
	{
		return true;
	}
	else
	{
		return false;	
	}
}

function status_op(obj,p,stat)
{
	var temp = stat;
	if(obj.checked == true)
	{
	all_hide();
	rows = document.f1.total_rows.value;
	
	div_name = "eq_div_"+p;
	document.getElementById(div_name).style.display="inline";
	
		for(var i= 1; i<=rows ;i++)
		{
			chk_name = "status_eq"+i;
			if( i != p)
			 {
			  	
				document.getElementById(chk_name).disabled = true;
				
			 }
		}
	}
	else
	 {
	   all_hide();
	   //alert(temp.type);
	   var obj_stat	= document.f1.elements["cur_stat"];
	   if(obj_stat.length)
	   {
		   for(var i= 1; i<=rows ;i++)
			{   
				chk_name = "status_eq"+i;
				var a=obj_stat[i-1].value;
				if(a != 3)
				{
					document.getElementById(chk_name).disabled = false;
				}
			}
		}
		else
		{
			chk_name = "status_eq1";
			var a=obj_stat.value;
			if(a != 3)
			{
				document.getElementById(chk_name).disabled = false;
			}
		}
	 if(if_chked())
	{
		document.getElementById("Submit").disabled=false;
	}
	else
	{
		document.getElementById("Submit").disabled=true;	
	}
	 }
}


function whoisselected()
{
  rows = document.f1.total_rows.value;
  for(var i= 1; i<=rows ;i++)
		{
			chk_name = "status_eq"+i;
			var a = document.getElementById(chk_name).checked;
			//alert(a);
		}
		
}
</script>
 {/literal}
 
Return current item: CoreAsset