Location: PHPKode > projects > SimpleHRM > simplehrm-1.0-beta1/simplehrm-1.0-beta1/templates/default/employee/emergencyInfo.tpl.html
<div class="cont">
    <div class="cont_bg_top"></div>
    <div class="cont_bg_mdl">
		<div class="message">{include file="employee/message"}</div>
        <input type="hidden" name="is_reset" id="is_reset" value="">
        <form id="emergency_info" name="emergency_info" method="post" action="javascript:void(0);" enctype="multipart/form-data">
        <input type="hidden" name="update_contact_id" value="{$sm.res.id_contact}" id="update_contact_id">
        <input type="hidden" name="update_id" value="{$sm.res_personal.id_employee}" id="upd_id">
		<div class="content">
        	{include file="employee/leftPan"}
			{include file="employee/rightPan"}
            <div style="margin-right:10px;">
            <div class="cont_hdr1 fltlft" style="padding-left:10px;">
                <div class="cont_hdr_lft fltlft"></div>
                <div class="cont_hdr_mdl1 fltlft" style="width:881px;">Emergency contact details</div>
                <div class="cont_hdr_rht fltlft"></div>
            </div>
            <div class="clear"></div>
            
<div class="cont_txt" style="margin-left:10px;">
                        <div class="txtbg_top fltlft"></div>
                        <div class="txtbg_mdl fltlft">
                    <table border='0' width="95%" class="mrgtp0" align="center">
                      <tr>
                         <td width="80%">
                           <table width="100%" border="0">
                            <tr>
                                <td  width="20%">Name: </td>
                                <td align="left" width="80%">
                                    <span class="detail">{$sm.res.name|default:'NA'}</span>
                                    <span class="edit_detail">
                                        <input type="text" name="employee[name]" value="{$sm.res.name}" id="name" class="text"/>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td >Surname: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.surname|default:'NA'}</span>
                                    <span class="edit_detail">
                                        <input type="text" name="employee[surname]" value="{$sm.res.surname}" id="surname" class="text"/>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td >Relation: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.relation|default:'NA'}</span>
                                    <span class="edit_detail"><input type="text" name="employee[relation]" value="{$sm.res.relation}" id="relation" class="text"/></span>
                                </td>
                            </tr>
                            <tr>
                                
                            </tr>
                            <tr>
                                <td >Address: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.address|default:'NA'}</span>
                                    <span class="edit_detail"><textarea name="employee[address]" id="address" class="text" rows="5">{$sm.res.address}</textarea></span>
                                </td>
                            </tr>
                            <tr>
                                
                            </tr>
                            <tr>
                                <td >
                                    Country: 
                                </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.country|default:"NA"|capitalize}</span>
                                    <span class="edit_detail">
                                        <select name="employee[country]" onchange="showStateCity(this,'state','city','1');" id="country">
                                            <option value="">-- Select --</option>
                                            {html_options options=$sm.country selected=""}
                                        </select>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td >State: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.state|default:"NA"|capitalize}</span>
                                    <span class="edit_detail">
                                        <select name="employee[state]" id="state" onchange="showStateCity(this,'city','','2');" >
                                            <option value="">-- Select --</option>
                                            {html_options options=$sm.state selected=""}
                                        </select>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td >City: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.city|default:"NA"|capitalize}</span>
                                    <span class="edit_detail">
                                        <select name="employee[city]" id="city" onchange="putCityValue(this);">
                                            <option value="">-- Select --</option>
                                            {html_options options=$sm.city selected=""}
                                        </select>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td >Zip code: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.zipcode|default:"NA"}</span>
                                    <span class="edit_detail">
                                        <input type="text" name="employee[zipcode]" value="{$sm.res.zipcode}" id="zipcode" class="text"/>
                                    </span>
                                </td>
                            </tr>
                            
                            
                            <tr>
                                <td >Mobile phone: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.mobile_phone|default:"NA"}</span>
                                    <span class="edit_detail">
                                        <input type="text" name="employee[mobile_phone]" value="{$sm.res.mobile_phone}" id="mobile_phone" class="text"/>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td >Work phone: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.work_phone|default:"NA"}</span>
                                    <span class="edit_detail">
                                        <input type="text" name="employee[work_phone]" value="{$sm.res.work_phone}" id="work_phone" class="text"/>
                                    </span>	
                                </td>
                            </tr>
                            <tr>
                                <td >Home phone: </td>
                                <td align="left">
                                    <span class="detail">{$sm.res.home_phone|default:"NA"}</span>
                                    <span class="edit_detail">
                                        <input type="text" name="employee[home_phone]" value="{$sm.res.home_phone}" id="home_phone" class="text"/>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                            	<td></td>
								<td>
                                    <span class="detail">
                                        <input type="button" name="edit" value="Edit" onclick="editDetail();" class="login_btn">
                                    </span>
                                    <span class="edit_detail">             
                                        <input type="button" name="save" value="Save" onclick="saveEmployee();" class="login_btn">
                                        <input type="button" name="reset" value="Reset" onclick="resetForm('emergencyDetail');" class="login_btn">
                                    </span>
                                    <span class="detail">
                                        {if $smarty.session.id_company}
                                        <input type="button" name="cancel" value="Back" onclick="cancelDetail();" class="login_btn">
                                        {/if}
                                    </span>
                                    <span class="edit_detail">
                                        {if $sm.res}
                                        <input type="button" name="cancel_edit" value="Back" onclick="cancelEdit();" class="login_btn">
                                        {/if}
                                    </span>
                                </td>
                            </tr>
                         </table>
                         </td>
                      </tr>
                    </table>
                    
                     </div>
                        <div class="txtbg_btm fltlft"></div>
                        <div class="clrbth"></div>
</div>
                    
            </div>
            <div class="clear"></div>
        </div>
        </form>
    </div>
    <div class="cont_bg_btm"></div>
</div>

{literal}
<script type="text/javascript">
// To select country,state,city
if('{/literal}{$sm.res.country}{literal}'!=''){
	$("#country").val('{/literal}{$sm.res.country}{literal}');
	var obj=document.getElementById('country');
	obj.options[obj.selectedIndex].value=obj.options[obj.selectedIndex].text;
}
if('{/literal}{$sm.res.state}{literal}'!=''){
	$("#state").val('{/literal}{$sm.res.state}{literal}');
	var obj=document.getElementById('state');
	obj.options[obj.selectedIndex].value=obj.options[obj.selectedIndex].text;
}
if('{/literal}{$sm.res.city}{literal}'!=''){
	$("#city").val('{/literal}{$sm.res.city}{literal}');

	var obj=document.getElementById('city');
	obj.options[obj.selectedIndex].value=obj.options[obj.selectedIndex].text;
}
if('{/literal}{$sm.res.id_employee}{literal}'==''){
	editDetail();
}
function showStateCity(obj,id1,id2,lvl){
	var id = obj.value;
	var url = "##LBL_SITE_URL##index.php/";
	$.post(url,{page:"employee",choice:"showStateCity",ce:0,id:id,flg:id1},function(res){
		$('#'+id1).html(res);
		if(lvl==1){
			$('#'+id2).html('<option value="">-- Select --</option>');
		}
	});
	var x=obj.selectedIndex;
	if(x!=0){
		obj.options[x].value=obj.options[x].text;
	}
}
function putCityValue(obj){
	var x=obj.selectedIndex;
	if(x!=0){
		obj.options[x].value=obj.options[x].text;
	}
}
function showDivsionJob(obj,id1,id2,lvl){
	var id = obj.value;
	var url = "##LBL_SITE_URL##index.php/";
	$.post(url,{page:"employee",choice:"show_division_job",ce:0,id:id,flg:id1},function(res){
		$('#'+id1).html(res);
		if(lvl==1){
			$('#'+id2).html('<option value="">-- Select --</option>');
		}
	});
}
function cancelEdit(){
	if($.trim($("#is_reset").val())=='1'){
		var upd_id=$("#upd_id").val();
		window.location="##LBL_SITE_URL##index.php/employee/emergencyDetail/id-"+upd_id;
	}else{
		$(".detail").removeClass('edit_detail');
		$(".temp").addClass('edit_detail');
	}
}
function cancelDetail(){
	window.location="##LBL_SITE_URL##index.php/employee/employeeList";
}
function saveEmployee(){
	var res = emergencyInfo();
	document.emergency_info.action="##LBL_SITE_URL##index.php/employee/updateEmergency";
	if(res){
		cShowActivity('1');
		document.emergency_info.submit();
	}else{
		var res = emergencyInfo();
	}
}
function emergencyInfo(){		
	var validator_emergency_info=$("#emergency_info").validate({
		rules: {
			"employee[name]": {
				required:true
			}
		},
		messages: {
			"employee[name]":{
				required:'This field is required.'
			}
		}
	});
	return validator_emergency_info.form();
}
</script>
<style type="text/css">
	.edit_detail{ display:none ;}
	select,option { text-transform : capitalize ;}
	
	#emergency_info .text {
		width:250px;
		margin-right:10px;
		padding:3px;
		border:1px solid #ccc;
		letter-spacing:1px;
		font-family:Arial, Helvetica, sans-serif;
	}
	#emergency_info select {
		border:1px solid #ccc;
		width:259px;	
		padding:4px;
		font-family:Arial, Helvetica, sans-serif;
	}
</style>
{/literal}
Return current item: SimpleHRM