<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*"  %>
<%@ include file="../CHECKPROFILE.jsp" %>
<% request.setCharacterEncoding("UTF-8"); %>
<jsp:useBean id="TREMP009" class="com.csc.library.system.Task" scope="page" />
<jsp:setProperty name="TREMP009" property="appname" value="empview" />
<%

	TREMP009.setChannel(request,response);
	HelpEntry screen = (HelpEntry) TREMP009.process("HelpEntry","TREMP009");	
	screen.process();
	screen.nextRec();
	screen.referLangOn();

	CheckNull chk = new CheckNull();

	String picture_aca = screen.getString("macademy","photo");
	if (picture_aca.equals("")){picture_aca = "DEFAULT.jpg";}

	String picture_loc = screen.getString("mtrlocation","photo");
	if (picture_loc.equals("")){picture_loc = "DEFAULT.jpg";}

	String picture_room = screen.getString("mtrroom","photo");
	if (picture_room.equals("")){picture_room = "DEFAULT.jpg";}

	DbInquiry db = null;

%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="myHR">

	<head>

		<title>Employee View</title>

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

		<link rel="stylesheet" href="<%=request.getContextPath()%>/CSS/font-awesome.css">
		<link rel="stylesheet" type="text/css" href="../CSS/Bootstrap/css/bootstrap.css" />
		<link rel="stylesheet" type="text/css" href="../CSS/EMPVIEW_LAYOUT.min.css" />
		
		<script type="text/javascript" src="../JS/jquery-2.1.3.min.js"></script>
		<script type="text/javascript" src="../JS/UTILITIES.js"></script>
		<script type="text/javascript"src="../JS/EVENTS.js"></script>
		<script type="text/javascript"src="../JS/SCREEN.js"></script>
		<script type="text/javascript" src="../JS/angular-1.3.15/angular.js"></script>
		<script type="text/javascript" src="../JS/ANGULAR/SCREEN_ANGULAR.js"></script>
		
		<script>
			setLang("<%=screen.getUProfile().get("lang")%>");
			var swap = new swaplang();
            var titlename = swap.swap2String("SW001941");
			setPageTitle(titlename);
		
			function viewTrainer(trainerid){
				var tmp = trainerid;
				with(document.cscform){
					 window.open("TREMP004.jsp?__fixCon=trainerid='"+tmp+"'","TRAINER","left=150,top=150,width=800,height=400,toolbar=no,status=no,scrollbars=yes,resizable=yes");
				}
			}
			function viewAcademy(){
				with(document.cscform){
					window.open('../TRAINING/UPLOAD/PICTURE/ACADEMY/'+photo_aca.value,'Picture','width=800,height=600,status=yes,scrollbars=yes,resizable=yes');
				}
			}
			function viewLocation(){
				with(document.cscform){
					window.open('../TRAINING/UPLOAD/PICTURE/LOCATION/'+photo_loc.value,'Picture','width=800,height=600,status=yes,scrollbars=yes,resizable=yes');
				}
			}
			function viewRoom(){
				with(document.cscform){
					window.open('../TRAINING/UPLOAD/PICTURE/ROOM/'+photo_room.value,'Picture','width=800,height=600,status=yes,scrollbars=yes,resizable=yes');
				}
			}
			function setOnPicError(pic){
				pic.value = "DEFAULT.jpg";
			}
			function backhead(){
				window.close();
			}
			function viewCourse(courseid){
				var tmp = courseid;
				with(document.cscform){
					 window.open("TREMP007.jsp?__fixCon=crsid='"+tmp+"'","COURSE","left=100,top=50,width=900,height=500,toolbar=no,status=no,scrollbars=yes,resizable=yes");
				}	
			}
			function replaceTexta(id){
				if(document.getElementById(id)!=null){
					var tmp = document.getElementById(id).value;
					while(tmp.indexOf("\x0D")>0){
						tmp = tmp.replace("\x0D","<br>");
					}
					document.write(tmp);
				}
			}
		</script>
	</head>
	<body>
		<div class="bg-com"></div>
		<section>
			<div class="container csc-content">
				<div class="csc-block-white">
					<form name="cscform" class="form-horizontal" method="post" action="TREMP009.jsp">
						<%=screen.InitialVariable()%>
						<script language="javascript">getInputFormatDate();</script>   
						<input type="hidden" name="__screen"  value="TREMP009">
						<input type="hidden" name="__help" value="">
						<input type="hidden" name="__fixCon" value="">
						<input type="hidden" name="__cmd"  value="">
						<input type="hidden" name="__calendar">
						<input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>">
						<input type="hidden" name="photo_aca" value="<%=picture_aca%>">
						<input type="hidden" name="photo_loc" value="<%=picture_loc%>">
						<input type="hidden" name="photo_room" value="<%=picture_room%>">
						
						
						<div class="container csc-content">
							<div class="center">
								<h4 swlang code="SW001941">Training Description</h4></br> 
							</div>
							<table class="table table-head table-hover table-bordered table-title-left table-left">
								<tbody>
									<tr>
										<th><%=screen.getLabel("TRAININGID")%></th>
										<td><%=screen.getString("TRAININGID")%>&nbsp;&nbsp;<label swlang code="SW001962">Training Name</label>&nbsp;<%=screen.getString("TRTITLE")%></td>
										<th><%=screen.getLabel("CRSID")%></th>
										<td><a href="javascript:viewCourse('<%=screen.getString("CRSID")%>');"><%=screen.getString("CRSID")%></a></td>
									</tr>
									<tr>  
										<th><%=screen.getLabel("MCOURSE","CRSDESC")%></th>
										<td><%=screen.getDataLabel("MCOURSE","CRSDESC")%></td>
										<th><%=screen.getLabel("MCOURSE","DETAIL")%></th>
										<td id="DETAIL" value="<%=screen.getDataLabel("MCOURSE","DETAIL")%>"><script>replaceTexta("DETAIL");</script></td>
									</tr> 
									<tr> 
										<th><%=screen.getLabel("MCOURSE","CRSEDESC")%></th>
										<td><%=screen.getDataLabel("MCOURSE","CRSEDESC")%></td>
										<th><%=screen.getLabel("MCOURSE","OBJECTIVE")%></th>
										<td id="OBJECTIVE" value="<%=screen.getDataLabel("MCOURSE","OBJECTIVE")%>"><script>replaceTexta("OBJECTIVE");</script></td>
									</tr>
									<tr>    
										<th swlang code="SW000612">Training Type</th>
										<td><%=screen.getInquiry().getCurrentDbRecord().getSystemCode("TRAIN_TYPE")%></td>
										
										<%
										if(new CscCalendar().afterDate(new CscCalendar(screen.inq.getCurrentDbRecord().getCscCalendar("RESDATETO").getYYYYMMDD()))) {
										%>
										
										<th><%=screen.getLabel("RESDATEFRM")%></th>
										<td>
											<%=screen.inq.getCurrentDbRecord().getCscCalendar("RESDATEFRM").getDDMMYYYY()%>
											&nbsp;&nbsp; <%=screen.getLabel("RESDATETO")%>&nbsp; 
											<%=screen.inq.getCurrentDbRecord().getCscCalendar("RESDATETO").getDDMMYYYY()%>
										</td>
										
										<%
										}else if(new CscCalendar().beforeDate(new CscCalendar(screen.inq.getCurrentDbRecord().getCscCalendar("RESDATEFRM").getYYYYMMDD()))) {
										%>
										<th><%=screen.getLabel("RESDATEFRM")%></th>
										<td>
											<%=screen.inq.getCurrentDbRecord().getCscCalendar("RESDATEFRM").getDDMMYYYY()%>
											&nbsp;&nbsp; <%=screen.getLabel("RESDATETO")%>&nbsp; 
											<%=screen.inq.getCurrentDbRecord().getCscCalendar("RESDATETO").getDDMMYYYY()%>
										</td>
										
										<%
											}else{
										%>
										
										<th><%=screen.inq.getCurrentDbRecord().getCscCalendar("RESDATEFRM").getDDMMYYYY()%></th>
										<td>
											<%=screen.inq.getCurrentDbRecord().getCscCalendar("RESDATEFRM").getDDMMYYYY()%>
											&nbsp;&nbsp; <%=screen.getLabel("RESDATETO")%>&nbsp; 
											<%=screen.inq.getCurrentDbRecord().getCscCalendar("RESDATETO").getDDMMYYYY()%>
										</td>
										<input type="hidden" name="chkRes" value="between">
										<%
											}
										%>
									</tr>
									
									<tr>    
										<th swlang code="SW000625">Training Academy</th>
										<td>
											<a href="javascript:viewAcademy('<%=screen.getString("macademy","instid")%>');" class="linkimage">
												<%=screen.getString("macademy","instdesc")%>
											</a>
											<img src="../TRAINING/UPLOAD/PICTURE/ACADEMY/<%=picture_aca%>" name="pic" width="0" height="0" border="0" onError="this.src='../TRAINING/UPLOAD/PICTURE/ACADEMY/DEFAULT.jpg';setOnPicError(photo_aca);">
										</td>
										<th><%=screen.getLabel("CLASSDATEFRM")%></th>
										<td>
											<%=screen.inq.getCurrentDbRecord().getCscCalendar("CLASSDATEFRM").getDDMMYYYY()%> &nbsp;&nbsp;
											<%=screen.getLabel("CLASSDATETO")%>&nbsp;<%=screen.inq.getCurrentDbRecord().getCscCalendar("CLASSDATETO").getDDMMYYYY()%>
										</td>
									</tr>
									<tr>   	
										<th swlang code="SW000615">Training Location</th>
										<td>
											<a href="javascript:viewLocation('<%=screen.getString("mtrlocation","locid")%>');"  class="linkimage">
												<%=screen.getString("mtrlocation","locdesc")%>
											</a>
											<img src="../TRAINING/UPLOAD/PICTURE/LOCATION/<%=picture_loc%>" name="pic2" width="0" height="0" border="0" onError="this.src='../TRAINING/UPLOAD/PICTURE/LOCATION/DEFAULT.jpg';setOnPicError(photo_loc);">
										</td>
										<th><%=screen.getLabel("CLASSHOUR")%></th>
										<td><%=screen.getString("CLASSHOUR")%></td>
									</tr>
									<tr>    
										<th swlang code="SW000624">Training Room</th>
										<td>
											<a href="javascript:viewRoom('<%=screen.getString("mtrroom","roomid")%>');"  class="linkimage">
												<%=screen.getString("mtrroom","roomdesc")%> 
											</a>
											<img src="../TRAINING/UPLOAD/PICTURE/ROOM/<%=picture_room%>" name="pic3" width="0" height="0" border="0" onError="this.src='../TRAINING/UPLOAD/PICTURE/ROOM/DEFAULT.jpg';setOnPicError(photo_room);">
										</td>
										<th swlang code="SW001961">Responsibler</th>
										<td>
											<%
												screen.inq.getCurrentDbRecord().refreshChild("TTRAINRESP");
												db=(DbInquiry)screen.inq.getCurrentDbRecord().getChild("TTRAINRESP");
												if(db.recCount()>0){
													do{
											%>	
											<%=db.getString("MEMPLOYEE","FULLNAME")%>&nbsp;<%=(db.getString("MAINRESP").equals("1"))?("( "+screen.getLabel("TTRAINRESP","MAINRESP")+" )"):""%><br>
											<%
													}while(db.next());
												}
											%>
										</td>
									</tr>
									<tr>    
										<th swlang code="SW000302">Remark</th>
										<td><%=screen.getString("MEMO")%></td>
										<th swlang code="SW000614">Trainer</th>
										<td>
											<%
												screen.inq.getCurrentDbRecord().refreshChild("TTRAINTRNER");
												db=(DbInquiry)screen.inq.getCurrentDbRecord().getChild("TTRAINTRNER");
												if(db.recCount()>0){
													do{
											%>	
											<a href="javascript:viewTrainer('<%=db.getString("TRAINERID")%>');"><%=db.getString("MTRAINER","FULLNAME")%>&nbsp;<%=(db.getString("MAINTRNER").equals("1"))?("( "+screen.getLabel("TTRAINTRNER","MAINTRNER")+" )"):""%></a>
											<%
													}while(db.next());
												}
											%>
										</td>
									</tr>
								</tbody>
							</table>
							<div class="center">
								<a href="javascript:close();" swlang code="SW012104" class="btn btn-primary">Close</a>
							</div>
						</div>
					</form>
				</div>
			</div>
		</section>
	</body>
</html>