<%@page import="groovy.ui.SystemOutputInterceptor"%>
<%@page import="ibase.utility.BaseLogger"%>
<%@page import="ibase.webitm.ejb.DBAccessEJB"%>
<%@page import="ibase.utility.UserInfoBean"%>
<%@page import="ibase.ejb.CommonDBAccessEJB"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<% 
	String tran_id= "",result_details = "", userId ="";

	tran_id = request.getParameter("tran_id");
	userId = request.getParameter("user_id");
	CommonDBAccessEJB commondb = new CommonDBAccessEJB();
	UserInfoBean userInfo =  commondb.createUserInfo(userId);
	DBAccessEJB dbAccessEJB = new DBAccessEJB();

	BaseLogger.log("3",userInfo,null,"daniel tran_id : " +tran_id);
	BaseLogger.log("3",userInfo,null,"daniel userId : " +userId);
	BaseLogger.log("3",userInfo,null,"daniel userinfo : " +userInfo);
	BaseLogger.log("3",userInfo,null,"daniel userInfo.getTransDB() : " +userInfo.getTransDB());

	try {
	
		result_details = dbAccessEJB.getDBColumnValue("follow_up_actions_logs", "result_details","tran_id= '"+tran_id+"' " ,userInfo.getTransDB());
		BaseLogger.log("3",userInfo,null,"daniel result_details"+result_details);
		request.setAttribute("resultDetails", result_details);
		result_details = "\""+result_details+"\"";
		BaseLogger.log("3",userInfo,null,"daniel result_details with dble quotes in start and end"+result_details);

	}

	catch(Exception e)
	{
		e.printStackTrace();
		BaseLogger.log("3",userInfo,null," daniel exception"+e);
	
	}

	
%>



<!DOCTYPE html>
<html lang="en">

<head>

  <meta charset="utf-8">
  <title>Result Details</title>
</head>

 <body>
<!--   
<p>Result Details: </p> 
 <div> 
 <c:set var="result_details" value= "=transactionResult(tran_id, userId)%>"/> 
 <p>Result Details:</p>
 <pre>
<c:out value="${result_details}"/>
</pre>
</div>
-->


<p>Result details :</p>

<!--   <input type="button" value = "Result Details" onclick= "displayResultData()"  -->

<%
  String escapedResult = result_details
      .replace("&", "&")
      .replace("<", "<")
      .replace(">", ">")
      .replace("\"", "\"")
      .replace("'", "'");
%>

<div id="resultoutput">

<div>
  <xmp>
    <%= escapedResult %>
  </xmp>
</div>

<div>
  <xmp>
    <%= org.apache.commons.lang.StringEscapeUtils.escapeHtml(result_details) %>
  </xmp>
</div>

 </div>
 
 
<!--      <input type= "hidden" style="display: none" value = " result details" id ="result_data">

 -->

<!--    <input type= "hidden" style="display: none" value = "  %=result_details%>" id ="result_data"> 
 -->

<!--    value ="  %=result_details%>"-->
<!--   <input type= "hidden" value =" %=xml%>" id ="result_data">-->
    
</body>

<script> 

// function displayResultData() {

//	console.log("inside function displayresultdata() ");
// console.log("var datareceived :containing result_details data daniel: "+dataReceived);
//var output = document.getElementById("resultoutput").innerHTML;
//console.log("resultoutput div daniel: "+output);
//var resultDetails = document.getElementById("result_data").value;
//console.log("resultDetails: daniel "+resultDetails);
//document.getElementById("resultoutput").textContent = dataReceived; 
//console.log("new Output data: daniel "+output);


//} 

</script>

</html>

