Replace CustomerExtrenalInfo.jsp

parent de4f5303
......@@ -18,6 +18,15 @@
button:hover {
background-color: darkblue;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
<script>
function updateInputBox() {
......@@ -28,6 +37,29 @@
function getDetails() {
document.getElementById("detailsForm").submit();
}
function createTableFromJson(data, parentElement) {
for (var key in data) {
if (data.hasOwnProperty(key)) {
var value = data[key];
var row = parentElement.insertRow();
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = key;
if (typeof value === 'object' && value !== null) {
cell2.innerHTML = "";
var nestedTable = document.createElement("table");
var nestedBody = document.createElement("tbody");
nestedTable.appendChild(nestedBody);
createTableFromJson(value, nestedBody);
cell2.appendChild(nestedTable);
} else {
cell2.innerHTML = value;
}
}
}
}
</script>
</head>
<body>
......@@ -53,12 +85,9 @@
if ("pan".equals(selectedOption)) {
panNumber = dbAccess.getDBColumnValue("CUSTOMER", "PAN_NO", "CUST_CODE = '" + custCode + "'", userInfo.getTransDB());
BaseLogger.log("3", null, null, "PanNumber:: " + panNumber);
if (panNumber != null && !panNumber.isEmpty()) {
panVerificationResponse = dbAccess.getDBColumnValue("CUST_EXT_INFO", "INFO_RESPONSE", "CUST_CODE = '" + custCode + "' AND INFO_TYPE = 'Pan Verification'", userInfo.getTransDB());
BaseLogger.log("3", null, null, "INFO_RESPONSE:: " + panVerificationResponse);
if (panVerificationResponse == null) {
// Call the API if panVerificationResponse is null
......@@ -150,31 +179,7 @@
</thead>
<tbody>
<script>
var jsonData = <%=panVerificationResponse.replaceAll("\"", "\\\"")%>;
function createTableFromJson(data, parentElement) {
for (var key in data) {
if (data.hasOwnProperty(key)) {
var value = data[key];
var row = parentElement.insertRow();
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = key;
if (typeof value === 'object' && value !== null) {
cell2.innerHTML = "";
var nestedTable = document.createElement("table");
var nestedBody = document.createElement("tbody");
nestedTable.appendChild(nestedBody);
createTableFromJson(value, nestedBody);
cell2.appendChild(nestedTable);
} else {
cell2.innerHTML = value;
}
}
}
}
var jsonData = '<%= panVerificationResponse.replaceAll("\"", "\\\"") %>';
var tableBody = document.getElementById("jsonData").getElementsByTagName('tbody')[0];
createTableFromJson(JSON.parse(jsonData), tableBody);
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment