Removed stale files
This commit is contained in:
@@ -1,686 +0,0 @@
|
||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
|
||||
pageEncoding="ISO-8859-1"%>
|
||||
<%@page language="java" session="true" %>
|
||||
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Cygnus 1.0 |
|
||||
<c:if test="${caseDetails.getFormMode() eq 1}">Add Cases</c:if>
|
||||
<c:if test="${caseDetails.getFormMode() eq 2}">Edit Details</c:if>
|
||||
</title>
|
||||
<script language="javascript" src="/matrix/js/lib/constants.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/jquery1.7.2.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ui/uifuncs.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/lib/jsfuncs.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ui/msgdialog.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ui/select.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/appjs/punching.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/validator.js?ver=2" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ajax.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ajax-dynamic-list.js" type="text/javascript"></script>
|
||||
|
||||
<link href="/matrix/css/button.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/div.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/textbox.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/select.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/table.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/autocomplete.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/bootstrap-5.3.8.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/matrix-v2.css?v=6" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/matrix-shell-v2.css?v=7" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/tool-workspace-v3.css?v=2" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/punch-workspace-v3.css?v=1" rel="stylesheet" type="text/css" />
|
||||
<link href="/matrix/css/add-cases-v4.css?v=5" rel="stylesheet" type="text/css" />
|
||||
<script src="/matrix/js/matrix-dialog-child.js" type="text/javascript"></script>
|
||||
<script src="/matrix/js/bootstrap-5.3.8.bundle.min.js" defer></script>
|
||||
<script src="/matrix/js/matrix-shell-v2.js" defer></script>
|
||||
<link href="/matrix/css/matrix-frame-dialog.css?v=6" rel="stylesheet" type="text/css" />
|
||||
<script src="/matrix/js/matrix-frame-dialog.js?v=2" defer></script>
|
||||
<script src="/matrix/js/matrix-dialog-child.js" type="text/javascript"></script>
|
||||
<script src="/matrix/js/matrix-accessibility-v1.js?v=1" defer></script>
|
||||
<link href="/matrix/css/matrix-theme-v2.css?v=4" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body class="matrix-v2 matrix-shell matrix-tool-workspace matrix-punch-workspace matrix-add-cases">
|
||||
<div id='PageFrame'>
|
||||
<c:if test="${caseDetails.getFormMode() eq 1}">
|
||||
<%@ include file="/WEB-INF/app/fragments/app-shell-header.jspf" %>
|
||||
<%-- Shared shell owns ${Sessvals.menuHtml}. --%>
|
||||
</c:if>
|
||||
|
||||
<div id="formcontainer" class="matrix-tool-workspace__content">
|
||||
<form:form method="post" name="caseDetails" id="caseDetails" modelAttribute="caseDetails" >
|
||||
<!-- Common Details (Section1) Visible for all portfolios-->
|
||||
<div>
|
||||
<!-- Title -->
|
||||
<div class="title">
|
||||
<img class="matrix-title-icon" src="/matrix/images/commondet.png" align="absmiddle" />
|
||||
<span class="matrix-title-text" align="absmiddle">Common Details</span>
|
||||
<c:choose>
|
||||
<c:when test="${caseDetails.getFormMode() eq 1}">
|
||||
<div class="divselect" id="divportfolio" style="width:167px;position:absolute;top:3px;right:13px;">
|
||||
<form:select path="PortfolioId" multiple="false" id="portlist" style="width:185px" onchange="SubmitForm('casedet','_parent','caseDetails')">
|
||||
<form:option value="-1" label="SELECT PORTFOLIO" selected="true"/>
|
||||
<c:forEach items="${portlist}" var="port">
|
||||
<form:option value="${port[0]}" label="${port[1]}" />
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<form:hidden path="PortfolioId" id="portlist" />
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</div>
|
||||
<!-- -->
|
||||
<!-- Form (Section1) -->
|
||||
<div id="FormPanel1" class="FormPanel">
|
||||
<table align="center" class="matrix-form-controls" width="99%">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
MV Code
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input style="width:65px;text-transform:uppercase" readonly="true" path="MvCode" value="${caseDeails.getMvCode()}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Appl No.
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="25" style="width:115px;text-transform:uppercase" id="ApplNo" path="ApplNo" value="${caseDetails.getApplNo()}" onblur="if(validate(this,'t','AlphaNumeric')){FindSameDet(this,'A','CustomerName');}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Bank Code
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="25" style="width:70px;text-transform:uppercase" path="BankCode" value="${caseDetails.getBankCode()}" onblur="validate(this,'f','AlphaNumeric');" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Branch
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<div class="divselect" id="divbranch" style="width:135px;">
|
||||
<form:select path="BankBranchId" multiple="false" id="branchlist" style="width:153px" onblur="validate(this,'t','');">
|
||||
<form:option value="-1" label="SELECT" selected="true"/>
|
||||
<c:forEach items="${branchlist}" var="brnch">
|
||||
<form:option value="${brnch[0]}" label="${brnch[1]}" />
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Product
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<div class="divselect" id="divproduct" style="width:132px;">
|
||||
<form:select path="Product" multiple="false" id="prodlist" style="width:150px" onblur="validate(this,'t','');">
|
||||
<form:option value="-1" label="SELECT" selected="true"/>
|
||||
<c:forEach items="${prodlist}" var="prod">
|
||||
<form:option value="${prod[0]}" label="${prod[1]}" />
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Name
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="60" style="width:200px" path="CustomerName" value="${caseDetails.getCustomerName()}" onblur="validate(this,'t','AlphaSpace');" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Father Name
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="25" style="width:145px" path="FatherName" value="${caseDetails.getFatherName()}" onblur="validate(this,'f','AlphaSpace');" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
App Type
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<div class="divselect" id="divapptype" style="width:135px;">
|
||||
<form:select path="CustomerType" multiple="false" id="typelist" style="width:153px" onchange="ToggleChks((this.value.toUpperCase()!='APPLICANT' && this.value.toUpperCase()!='-1'),'chksresi!C0L!chksoff!C0L!chksprop!C0L!','!C0L!')" onblur="validate(this,'t','');">
|
||||
<form:option value="-1" label="SELECT" selected="true"/>
|
||||
<c:forEach items="${typelist}" var="type">
|
||||
<form:option value="${type[0]}" label="${type[1]}" />
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Category
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<div class="divselect" id="divcategory" style="width:115px;">
|
||||
<form:select path="Category" multiple="false" id="catlist" style="width:133px">
|
||||
<form:option value="-1" label="SELECT" selected="true"/>
|
||||
<c:forEach items="${catlist}" var="cat">
|
||||
<form:option value="${cat[0]}" label="${cat[1]}" />
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
DOB
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="10" style="width:80px" path="DOB" id="dob" value="${caseDetails.getDOB()}" onkeydown="return addSlashes(this,event)" onblur="validate(this,'f','Date')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Mobile No.
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="21" style="width:120px" path="MobileNo" value="${caseDetails.getMobileNo()}" onblur="validate(this,'f','AllowWrong');" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Loan Amt
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="15" style="width:100px" path="LoanAmount" value="${caseDetails.getLoanAmount()}" onblur="validate(this,'f','LoanAmount');" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
C Person
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="25" style="width:200px" path="ContactPerson" value="${caseDetails.getContactPerson()}" onblur="validate(this,'f','AlphaSpace');" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<div class="lblcontainer">
|
||||
Special Inst.
|
||||
</div>
|
||||
<div class="inputcontainer">
|
||||
<form:input maxlength="50" id="splist" style="width:833px" path="SpecialInst" value="${caseDetails.getSpecialInst()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- -->
|
||||
</div>
|
||||
<!-- -->
|
||||
|
||||
<!-- Residence Details (Section2) Visible for portfolios in which residence visit/ residence TVR could be initiated-->
|
||||
<div id="section2">
|
||||
<!-- Title -->
|
||||
<div class="title">
|
||||
<img class="matrix-title-icon" src="/matrix/images/resdet.png" />
|
||||
<span class="matrix-title-text">Residence Details</span>
|
||||
<div class="divchk" id="ctrldiv">
|
||||
<form:checkbox path="Rvr" id="chkresi" onclick="HandleClick(this)" />RVR
|
||||
<form:checkbox path="SameResi" id="chksresi" onclick="return FindSameDet(this,'R','ResiPhone')" /><span id="chksresi">Same Resi</span>
|
||||
<form:checkbox path="Rtvr" id="chkteler" onclick="HandleClick(this)" /><span id="chkteler">RTV</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<!-- Form (Section2) -->
|
||||
<div id="FormPanel2" class="FormPanel">
|
||||
<table align="center" class="matrix-form-controls" style="width:100%">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
House No.
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="20" style="width:70px" path="ResiAdd1" value="${caseDetails.getResiAdd1()}" onblur="validate(this,document.getElementById('chkresi').checked ? 't':'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Sub Locality
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="70" style="width:180px" path="ResiAdd2" value="${caseDetails.getResiAdd2()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
City
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<div class="divselect" id="divrcity" style="width:110px;">
|
||||
<form:select path="ResiCity" multiple="false" id="ResiAdd3_citylist" style="width:128px" onblur="validate(this,document.getElementById('chkresi').checked ? 't':'f','')" >
|
||||
<form:option value="-1" label="Select" selected="true"/>
|
||||
<form:option value="Unknown" label="Unknown"/>
|
||||
<c:forEach items="${citylist}" var="city">
|
||||
<form:option value="${city[0]}" label="${city[1]}" />
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Locality
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="50" style="width:180px" path="ResiAdd3" value="${caseDetails.getResiAdd3()}" onkeyup="ajax_showOptions(this,event)" onblur="onLocalityBlur(this,document.getElementById('chkresi').checked ? 't':'f')" />
|
||||
<form:hidden path="ResiLoc" id="ResiAdd3_hidden" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Landmark
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="50" style="width:150px" path="ResiLandmark" value="${caseDetails.getResiLandmark()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Pincode
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="6" style="width:45px" id="ResiAdd3_Pincode" path="ResiPincode" value="${caseDetails.getResiPincode()}" onblur="validate(this,document.getElementById('chkresi').checked ? 't':'f','Pincode')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Phone No.
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input maxlength="25" style="width:107px" path="ResiPhone" value="${caseDetails.getResiPhone()}" onblur="validate(this,document.getElementById('chkteler').checked ? 't':'f','Phone')" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- -->
|
||||
</div>
|
||||
<!-- -->
|
||||
|
||||
<!-- Office Details (Section3) Visible for portfolios in which office visit/ office TVR could be initiated-->
|
||||
<div id="section3">
|
||||
<!-- Title -->
|
||||
<div class="title">
|
||||
<img class="matrix-title-icon" src="/matrix/images/optmale.png" />
|
||||
<span class="matrix-title-text">Office Details</span>
|
||||
<div class="divchk" id="ctrldiv">
|
||||
<form:checkbox path="Ovr" id="chkoffice" onclick="HandleClick(this)" />OVR
|
||||
<form:checkbox path="RCO" id="chkrco" style="display:none" onclick="HandleClick(this)" /><span id="chkrco">RCO</span>
|
||||
<form:checkbox path="SameOffice" id="chksoff" onclick="return FindSameDet(this,'O','OffPhone')" /><span id="chksoff">Same Office</span>
|
||||
<form:checkbox path="Otvr" id="chkteleo" onclick="HandleClick(this)" /><span id="chkteleo">OTV</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<!-- Form (Section3) -->
|
||||
<div id="FormPanel3" class="FormPanel">
|
||||
<table align="center" class="matrix-form-controls">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Company
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input maxlength="50" style="width:215px" path="CompanyName" value="${caseDetails.getCompanyName()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Plot No.
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="20" style="width:90px" path="OffAdd1" value="${caseDetails.getOffAdd1()}" onblur="validate(this,document.getElementById('chkoffice').checked ? 't':'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Sub Locality
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="70" style="width:200px" path="OffAdd2" value="${caseDetails.getOffAdd2()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
City
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<div class="divselect" id="divocity" style="width:110px;">
|
||||
<form:select path="OffCity" multiple="false" id="OffAdd3_citylist" style="width:128px" onblur="validate(this,document.getElementById('chkoffice').checked ? 't':'f','')">
|
||||
<form:option value="-1" label="Select" selected="true"/>
|
||||
<form:option value="Unknown" label="Unknown"/>
|
||||
<c:forEach items="${citylist}" var="city">
|
||||
<form:option value="${city[0]}" label="${city[1]}" />
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Locality
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="50" style="width:200px" path="OffAdd3" value="${caseDetails.getOffAdd3()}" onkeyup="ajax_showOptions(this,event)" onblur="validate(this,document.getElementById('chkoffice').checked ? 't':'f','SplInstruction')" />
|
||||
<form:hidden path="OffLoc" id="OffAdd3_hidden" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Pincode
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="6" style="width:45px" id="OffAdd3_Pincode" path="OffPincode" value="${caseDetails.getOffPincode()}" onblur="validate(this,document.getElementById('chkoffice').checked ? 't':'f','Pincode')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Landmark
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input maxlength="50" style="width:215px" path="OffLandmark" value="${caseDetails.getOffLandmark()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Department
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input maxlength="25" style="width:200px" path="Department" value="${caseDetails.getDepartment()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Designation
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input maxlength="25" style="width:210px" path="Designation" value="${caseDetails.getDesignation()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Office Phone-Extn
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input maxlength="25" style="width:150px" path="OffPhone" value="${caseDetails.getOffPhone()}" onblur="validate(this,document.getElementById('chkteleo').checked ? 't':'f','Phone')" />-<form:input type="text" style="width:23px" path="Extension" value="${caseDetails.getExtension()}" onblur="validate(this,'f','Extension')" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- -->
|
||||
</div>
|
||||
<!-- -->
|
||||
|
||||
<!-- Property Details (Section4) Visible for portfolios in which property visit could be initiated-->
|
||||
<div id="section4">
|
||||
<!-- Title -->
|
||||
<div class="title">
|
||||
<img class="matrix-title-icon" src="/matrix/images/resdet.png" />
|
||||
<span class="matrix-title-text">Property Details</span>
|
||||
<div class="divchk" id="ctrldiv">
|
||||
<form:checkbox path="Pvr" id="chkprop" onclick="HandleClick(this)" />PVR
|
||||
<form:checkbox path="RCP" id="chkrcp" style="display:none" onclick="HandleClick(this)" /><span id="chkrcp">RCP</span>
|
||||
<form:checkbox path="OCP" id="chkocp" style="display:none" onclick="HandleClick(this)" /><span id="chkocp">OCP</span>
|
||||
<form:checkbox path="SameProp" id="chksprop" onclick="return FindSameDet(this,'P','PropAdd3_Pincode')" /><span id="chksprop">Same Property</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<!-- Form (Section4) -->
|
||||
<div id="FormPanel4" class="FormPanel">
|
||||
<table align="center" class="matrix-form-controls">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
House / Plot No.
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="20" style="width:120px" path="PropAdd1" value="${caseDetails.getPropAdd1()}" onblur="validate(this,document.getElementById('chkprop').checked ? 't':'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Sub Locality
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="70" style="width:200px" path="PropAdd2" value="${caseDetails.getPropAdd2()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
City
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<div class="divselect" id="divpcity" style="width:110px;">
|
||||
<form:select path="PropCity" multiple="false" id="PropAdd3_citylist" style="width:128px" onblur="validate(this,document.getElementById('chkprop').checked ? 't':'f','')">
|
||||
<form:option value="-1" label="Select" selected="true"/>
|
||||
<form:option value="Unknown" label="Unknown"/>
|
||||
<c:forEach items="${citylist}" var="city">
|
||||
<form:option value="${city[0]}" label="${city[1]}" />
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Locality
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="50" style="width:200px" path="PropAdd3" value="${caseDetails.getPropAdd3()}" onkeyup="ajax_showOptions(this,event)" onblur="validate(this,document.getElementById('chkprop').checked ? 't':'f','SplInstruction')" />
|
||||
<form:hidden path="PropLoc" id="PropAdd3_hidden" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Landmark
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="50" style="width:180px" path="PropLandmark" value="${caseDetails.getPropLandmark()}" onblur="validate(this,'f','SplInstruction')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-left:2px">
|
||||
<div class="lblcontainer" style="padding:1px">
|
||||
Pincode
|
||||
</div>
|
||||
<br >
|
||||
<div class="inputcontainer" style="padding:1px">
|
||||
<form:input readonly="true" maxlength="6" style="width:45px" id="PropAdd3_Pincode" path="PropPincode" value="${caseDetails.getResiPincode()}" onblur="validate(this,document.getElementById('chkprop').checked ? 't':'f','Pincode')" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- -->
|
||||
</div>
|
||||
<!-- -->
|
||||
|
||||
<!-- Reference Details (Section5) Visible for portfolios in which reference calling could be initiated-->
|
||||
<div id="section5">
|
||||
<!-- Title -->
|
||||
<div class="title">
|
||||
<img class="matrix-title-icon" src="/matrix/images/ref.png" />
|
||||
<span class="matrix-title-text">Reference Details</span>
|
||||
<div class="divchk" id="ctrldiv">
|
||||
<form:checkbox path="Refvr" id="chkref" onclick="setFormValidation(this,'FormPanel5','Ref1Name,Ref1Address,Ref1Contactno','t,f,t','AlphaSpace,SplInstruction,Phone',false)" />Ref Check
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<!-- Form (Section5) -->
|
||||
<div id="FormPanel5" class="FormPanel">
|
||||
<table align="center" class="matrix-form-controls">
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>Name</td>
|
||||
<td>Address</td>
|
||||
<td>Contact Numbers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Reference 1 </td>
|
||||
<td><form:input maxlength="30" style="width:200px" path="Ref1Name" value="${caseDetails.getRef1Name()}" onblur="validate(this,document.getElementById('chkref').checked ? 't':'f','AlphaSpace')" /></td>
|
||||
<td><form:input maxlength="100" style="width:450px" path="Ref1Address" value="${caseDetails.getRef1Address()}" onblur="validate(this,'f','SplInstruction')" /></td>
|
||||
<td><form:input maxlength="25" style="width:160px" path="Ref1Contactno" value="${caseDetails.getRef1Contactno()}" onblur="validate(this,document.getElementById('chkref').checked ? 't':'f','Phone')" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>Name</td>
|
||||
<td>Address</td>
|
||||
<td>Contact Numbers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Reference 2 </td>
|
||||
<td><form:input maxlength="30" style="width:200px" path="Ref2Name" value="${caseDetails.getRef2Name()}" onblur="validate(this,'f','AlphaSpace')" /></td>
|
||||
<td><form:input maxlength="100" style="width:450px" path="Ref2Address" value="${caseDetails.getRef2Address()}" onblur="validate(this,'f','SplInstruction')" /></td>
|
||||
<td><form:input maxlength="25" style="width:160px" path="Ref2Contactno" value="${caseDetails.getRef2Contactno()}" onblur="validate(this,'f','Phone')" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- -->
|
||||
</div>
|
||||
<!-- -->
|
||||
|
||||
<!-- Dynamic Form (Section6). All controls under this section will be generated dynamically during runtime-->
|
||||
<div id="section6">
|
||||
<!-- Title -->
|
||||
<div class="title">
|
||||
<img class="matrix-title-icon" src="/matrix/images/edit_form.png" alt="" />
|
||||
<span class="matrix-title-text">Other Details</span>
|
||||
</div>
|
||||
<!-- -->
|
||||
<div id="FormPanel6" class="FormPanel">
|
||||
${caseDetails.getDynamicPanel()}
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
|
||||
<!-- Document Details (Section7) Visible for portfolios in which document verification could be done-->
|
||||
<div id="section7">
|
||||
<!-- Title -->
|
||||
<div class="title">
|
||||
<img class="matrix-title-icon" src="/matrix/images/documents.png" />
|
||||
<span class="matrix-title-text">Document Details</span>
|
||||
<div class="divchk" id="ctrldiv">
|
||||
<form:checkbox path="Docvr" id="chkdoc" onclick="hideForm(this.id,'FormPanel7')" />Doc VR
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<!-- Form (Section7) -->
|
||||
<div id="FormPanel7" class="FormPanel">
|
||||
<table align="center" class="matrix-form-controls">
|
||||
<tr>
|
||||
<td>Document</td>
|
||||
<td>Vendor</td>
|
||||
<td>Service Provider</td>
|
||||
<td>Name</td>
|
||||
<td>Unique No.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="divselect" id="divdoclist" style="width:90px;">
|
||||
<select id="doclist" style="width:108px">
|
||||
<option value="-1" selected="true">
|
||||
<c:forEach items="${doclist}" var="doc">
|
||||
<option value="${doc[0]}" >${doc[1]}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td><input type="text" style="width:150px" value="" id="vendor" /></td>
|
||||
<td><input type="text" style="width:200px" value="" id="serviceprovider" /></td>
|
||||
<td><input type="text" style="width:200px" value="" id="name" /></td>
|
||||
<td><input type="text" style="width:180px" value="" id="uniqueno" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- -->
|
||||
</div>
|
||||
<form:hidden path="DynamicFields" value="${caseDetails.getDynamicFields()}" />
|
||||
<form:hidden path="VisibleContents" value="${caseDetails.getVisibleContents()}" />
|
||||
<form:hidden path="FormMode" />
|
||||
<form:hidden path="UUID" />
|
||||
<form:hidden path="CaseId" />
|
||||
<!-- -->
|
||||
<input type="hidden" id="invalidfields" value="0" />
|
||||
<c:if test="${caseDetails.getFormMode() eq 2}">
|
||||
<input type="button" class="button" name="btncancel" style="margin-left:1px;margin-top:5px;float:right" value="Cancel" id="btncancel" accesskey="C" onclick="MatrixDialog.close(0)" />
|
||||
</c:if>
|
||||
<input type="button" class="button" name="btnsave" style="margin-top:5px;float:right" value="Save" id="btnsave" accesskey="S" onclick="return ValidateSubmitForm('caseDetails');" />
|
||||
</form:form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<!-- Page Load Javascript -->
|
||||
<script language="javascript" type="text/javascript">
|
||||
HideSections('rtv');
|
||||
HideSections('otv');
|
||||
HideSections('section');
|
||||
UnhideSections('${visibleContents}','!C0L!');
|
||||
hideForm('chkresi','FormPanel2');
|
||||
hideForm('chkoffice','FormPanel3');
|
||||
hideForm('chkprop','FormPanel4');
|
||||
hideForm('chkref','FormPanel5');
|
||||
hideForm('chkdoc','FormPanel7');
|
||||
ToggleChks((document.getElementById('chkresi').checked && document.getElementById('chkoffice').checked),'chkrco'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('chkresi').checked),'chkrcp'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('chkoffice').checked),'chkocp'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('typelist').value.toUpperCase()!='APPLICANT' && document.getElementById('typelist').value.toUpperCase()!='-1'),'chksresi!C0L!chksoff!C0L!chksprop!C0L!','!C0L!');
|
||||
document.getElementById('ApplNo').focus();
|
||||
</script>
|
||||
<!-- -->
|
||||
<!-- Process Message -->
|
||||
<c:if test="${not empty caseDetails.getErrMsg()}">
|
||||
<script language="javascript" type="text/javascript"> CallMessage('${caseDetails.getErrMsg()}',3000,200,300); </script>
|
||||
<c:if test="${caseDetails.isProcessFlag()==true and caseDetails.getFormMode()==2}">
|
||||
<script language="javascript" type="text/javascript">MatrixDialog.close(1);</script>
|
||||
</c:if>
|
||||
</c:if>
|
||||
<!-- -->
|
||||
</html>
|
||||
@@ -18,11 +18,12 @@
|
||||
<script language="javascript" src="/matrix/js/jquery1.7.2.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ui/uifuncs.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/lib/jsfuncs.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/lib/notifications.js?ver=1" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/lib/payload-crypto.js?ver=1" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ui/msgdialog.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ui/select.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/appjs/punching.js?ver=6" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/edp/initiation.js?ver=1" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/edp/initiation.js?ver=7" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/edp/application-save.js?ver=2" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/validator.js?ver=2" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ajax.js" type="text/javascript"></script>
|
||||
<script language="javascript" src="/matrix/js/ajax-dynamic-list.js?ver=1" type="text/javascript"></script>
|
||||
|
||||
@@ -1,765 +0,0 @@
|
||||
var records=new Array(1);
|
||||
var fields=new Array(1);
|
||||
var recIndx = 0;
|
||||
var recpos = 0;
|
||||
var autocut = 0;
|
||||
var SameAddr=new Array(0);
|
||||
var AddrElem=new Array(4);
|
||||
var selectedAddr=-1;
|
||||
var FocusAfter="customername";
|
||||
AddrElem[0]=["rv","raddr1","raddr2","raddr3","rlandmark","Rcolony","colr","rcity","rpincode","rphone"];
|
||||
AddrElem[1]=["ov","companyname","oaddr1","oaddr2","oaddr3","olandmark","Ocolony","colo","ocity","opincode","ophone","extension"];
|
||||
AddrElem[2]=["pv","paddr1","paddr2","paddr3","plandmark","Pcolony","colp","pcity","ppincode"];
|
||||
AddrElem[3]=["bankcode","bankcode","bank_branch_id","product","loanamount","apptype","contactperson","specialinst"];
|
||||
|
||||
function InitPage()
|
||||
{
|
||||
var portField = document.getElementById("portfolio_id");
|
||||
var initialPortField = document.getElementById("initial-portfolio-id");
|
||||
var visibleContentsField = document.getElementById("visiblecontents");
|
||||
var port = initialPortField ? initialPortField.value : (portField ? portField.value : "-1");
|
||||
var viscontents = visibleContentsField ? visibleContentsField.value : "";
|
||||
if (viscontents && viscontents.slice(-ColDelim.length) !== ColDelim) {
|
||||
viscontents += ColDelim;
|
||||
}
|
||||
|
||||
centerDivBoth("formcontainer","H");
|
||||
HideSections('rtv');
|
||||
HideSections('otv');
|
||||
HideSections('section');
|
||||
UnhideSections(viscontents,ColDelim);
|
||||
if (portField) {
|
||||
$(portField).val(port);
|
||||
}
|
||||
if(port>0)
|
||||
{
|
||||
if(document.getElementById("ajaxmsg") !== null)
|
||||
{
|
||||
CallMessage('1001AJX:warning:Another operation is being processed, please wait..',3000,200,300);
|
||||
return;
|
||||
}
|
||||
LoadingMsg("Fetching records, please wait...","ajaxmsg");
|
||||
RunAjax("GET","punchedrecs","val0="+port+"&val1="+($("#dynamicfields").val())+"&val2="+($("#uuid").val()),1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function ValidateSubmitForm(FormName)
|
||||
{
|
||||
var Chkresi=document.getElementById('rv');
|
||||
var Chkoff=document.getElementById('ov');
|
||||
var Chkprop=document.getElementById('pv');
|
||||
if(Chkresi.checked || Chkoff.checked || Chkprop.checked || document.getElementById('rtv').checked || document.getElementById('otv').checked || document.getElementById('refv').checked)
|
||||
{
|
||||
validate(document.getElementById('applno'),'t','AlphaNumeric');
|
||||
validate(document.getElementById('bank_branch_id'),'t','');
|
||||
validate(document.getElementById('product'),'t','');
|
||||
validate(document.getElementById('customername'),'t','AlphaSpace');
|
||||
validate(document.getElementById('apptype'),'t','');
|
||||
if(Chkresi.checked)
|
||||
{
|
||||
CheckForm(Chkresi,'raddr1,raddr2,raddr3,rlandmark,colr,rcity,rpincode','t,f,t,f,t,t,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode');
|
||||
if(document.getElementById('Rcolony').value=='' || document.getElementById('Rcolony').value=='0')
|
||||
{
|
||||
highlightField(document.getElementById('colr'));
|
||||
}
|
||||
}
|
||||
if(Chkoff.checked)
|
||||
{
|
||||
CheckForm(Chkoff,'companyname,oaddr1,oaddr2,oaddr3,olandmark,colo,ocity,opincode,department,designation','f,t,f,t,f,t,t,f,f,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode,SplInstruction,SplInstruction');
|
||||
if(document.getElementById('Ocolony').value=='' || document.getElementById('Ocolony').value=='0')
|
||||
{
|
||||
highlightField(document.getElementById('colo'));
|
||||
}
|
||||
}
|
||||
if(document.getElementById('rtv').checked)
|
||||
{
|
||||
CheckForm(document.getElementById('rtv'),'rphone','t','Phone');
|
||||
}
|
||||
if(document.getElementById('otv').checked)
|
||||
{
|
||||
CheckForm(document.getElementById('otv'),'ophone','t','Phone');
|
||||
}
|
||||
if(Chkprop.checked)
|
||||
{
|
||||
CheckForm(Chkprop,'paddr1,paddr2,paddr3,plandmark,colp,pcity,ppincode','t,f,t,f,t,t,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode');
|
||||
if(document.getElementById('Pcolony').value=='' || document.getElementById('Pcolony').value=='0')
|
||||
{
|
||||
highlightField(document.getElementById('colp'));
|
||||
}
|
||||
}
|
||||
if(document.getElementById('refv').checked)
|
||||
{
|
||||
CheckForm(document.getElementById('refv'),'refname1,refaddress1,refcontactno1','t,f,t','AlphaSpace,SplInstruction,Phone');
|
||||
}
|
||||
if (invalidFields>0)
|
||||
{
|
||||
CallMessage('VLFRM:error:There are one or more error(s) in form. Please correct them and try again.',3000,200,300);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(document.getElementById("ajaxmsg") !== null)
|
||||
{
|
||||
CallMessage('1001AJX:warning:Another operation is being processed, please wait..',3000,200,300);
|
||||
return;
|
||||
}
|
||||
var Qstr=PrepareQStr();
|
||||
if(document.getElementById("ajaxmsg") !== null)
|
||||
{
|
||||
CallMessage('1001AJX:warning:Another operation is being processed, please wait..',3000,200,300);
|
||||
return false;
|
||||
}
|
||||
LoadingMsg("Saving details, please wait...","ajaxmsg");
|
||||
RunAjax("GET","updatecase",Qstr,2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CallMessage('VLFRM:error:Atleast one address verification is mandatory.',3000,200,300);
|
||||
}
|
||||
}
|
||||
function PrepareQStr()
|
||||
{
|
||||
var val0='';
|
||||
var val1='';
|
||||
var indx=3;
|
||||
autocut=$("#autocut").is(":checked") ? 1 : 0;
|
||||
var lindx=fields[0].length-1;
|
||||
var cid=$("#case_id").val();
|
||||
var temp='';
|
||||
|
||||
for(indx;indx<lindx;indx++)
|
||||
{
|
||||
temp='';
|
||||
if($("#"+fields[0][indx]).length > 0)
|
||||
{
|
||||
if(fields[0][indx]=='rv' || fields[0][indx]=='sradd' || fields[0][indx]=='rtv' ||
|
||||
fields[0][indx]=='ov' || fields[0][indx]=='soadd' || fields[0][indx]=='otv' || fields[0][indx]=='rco'
|
||||
|| fields[0][indx]=='pv' || fields[0][indx]=='rcp' || fields[0][indx]=='ocp' || fields[0][indx]=='spadd'|| fields[0][indx]=='refv'|| fields[0][indx]=='docv')
|
||||
{
|
||||
temp=$("#"+fields[0][indx]).is(':checked') ? '1':'0';
|
||||
}
|
||||
else if(fields[0][indx]=='portfolio_id' || fields[0][indx]=='bank_branch_id' || fields[0][indx]=='company_id' || fields[0][indx]=='branch_id' || fields[0][indx]=='Rcolony' || fields[0][indx]=='Ocolony' || fields[0][indx]=='Pcolony')
|
||||
{
|
||||
temp=$("#"+fields[0][indx]).val()=='' ? '0':$("#"+fields[0][indx]).val();
|
||||
}
|
||||
else if(fields[0][indx]=='colr' || fields[0][indx]=='colo' || fields[0][indx]=='colp' || fields[0][indx]=='status')
|
||||
{
|
||||
temp=$("#"+fields[0][indx]).val();
|
||||
records[recpos][indx]=temp.replace(/\'/g,'');
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp="''"+$("#"+fields[0][indx]).val().replace(/,/g, ' ')+"''";
|
||||
}
|
||||
val0=val0+fields[0][indx]+',';
|
||||
val1=val1+temp+",";
|
||||
records[recpos][indx]=temp.replace(/\'/g,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
val0=val0+fields[0][indx]+',';
|
||||
val1=val1+"NULL,";
|
||||
records[recpos][indx]=temp.replace(/\'/g,'');
|
||||
}
|
||||
}
|
||||
val1=val1.replace(/&/g,'~AmP~');
|
||||
return "val0="+val0+"&val1="+val1+"&val2="+cid+"&val3="+($("#uuid").val())+"&val4="+autocut+"&val5="+($("#usid").val())+"&val6="+($("#portfolio_id").val())+"&val7="+($("#formmode").val());
|
||||
}
|
||||
function GotoRecord(el,searchtype)
|
||||
{
|
||||
recno=el.value;
|
||||
if(recno!='')
|
||||
{
|
||||
if(searchtype == 'recno')
|
||||
{
|
||||
if(recno > recIndx || recno <=0)
|
||||
{
|
||||
CallMessage('1001IRNG:error:Invalid input. Out of range',3000,200,300);
|
||||
}
|
||||
else
|
||||
{
|
||||
recpos=recno-1;
|
||||
FillDetails(recpos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(index = 0; index < records.length; index++ )
|
||||
{
|
||||
if( records[index][4] === recno ) {
|
||||
recpos = index;
|
||||
FillDetails(recpos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function AddNewRecord()
|
||||
{
|
||||
if(recIndx== 0 || records[recIndx-1][0]!='0')
|
||||
{
|
||||
var cols=fields[0].length;
|
||||
recIndx = recIndx+1;
|
||||
recpos = recIndx-1;
|
||||
records[recpos]=new Array(cols);
|
||||
records[recpos][0]='0';
|
||||
records[recpos][1]=$("#portfolio_id").val();
|
||||
records[recpos][cols-4]='0';
|
||||
records[recpos][cols-3]=$("#company_id").val();
|
||||
records[recpos][cols-2]=$("#branch_id").val();
|
||||
records[recpos][cols-1]='';
|
||||
records[recpos][2]='******';
|
||||
}
|
||||
else
|
||||
{
|
||||
recpos=recIndx-1;
|
||||
}
|
||||
FillDetails(recpos);
|
||||
}
|
||||
function AfterResponse(response,oprID)
|
||||
{
|
||||
var rindx=0;
|
||||
if(oprID==1)
|
||||
{
|
||||
$("#ajaxmsg").remove();
|
||||
if(response.trim().search('Error')==-1)
|
||||
{
|
||||
var rows=response.split(RowDelim);
|
||||
for(rindx=0;rindx<rows.length-1;rindx++)
|
||||
{
|
||||
var cindx=0;
|
||||
var cols=rows[rindx].split(ColDelim);
|
||||
if(rindx==0)
|
||||
{
|
||||
fields[rindx]=new Array(cols.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
records[rindx-1]=new Array(cols.length);
|
||||
}
|
||||
for(cindx=0;cindx<cols.length;cindx++)
|
||||
{
|
||||
if(rindx==0)
|
||||
{
|
||||
fields[rindx][cindx]=cols[cindx];
|
||||
}
|
||||
else
|
||||
{
|
||||
records[rindx-1][cindx]=cols[cindx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
CallMessage(response,3000,200,300);
|
||||
}
|
||||
recIndx= rindx==0 ? rindx : rindx-1;
|
||||
$("#recfound").html("<b>( 0 / "+(recIndx==0 ? "0" : recIndx)+" )</b>");
|
||||
recpos=recIndx==0 ? 0 : recIndx-1;
|
||||
FillDetails(recpos);
|
||||
}
|
||||
else if(oprID==2)
|
||||
{
|
||||
collen=fields[0].length;
|
||||
$("#ajaxmsg").remove();
|
||||
if(response.trim().search('Error')==-1)
|
||||
{
|
||||
if(autocut==1)
|
||||
{
|
||||
records[recpos][collen-4]='1';
|
||||
}
|
||||
if($("#case_id").val()!='0')
|
||||
{
|
||||
findRecord(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
records[recpos][2]=response.split(ColDelim)[0];
|
||||
records[recpos][0]=response.split(ColDelim)[1];
|
||||
records[recpos][collen-1]=response.split(ColDelim)[2];
|
||||
AddNewRecord();
|
||||
}
|
||||
CallMessage('1001IRNG:info:Record updated successfully',3000,200,300);
|
||||
}
|
||||
else
|
||||
{
|
||||
records[recpos][collen-4]='-1';
|
||||
CallMessage(response,3000,200,300);
|
||||
}
|
||||
}
|
||||
else if(oprID==19 || oprID==20 || oprID==21 || oprID==22)
|
||||
{
|
||||
TabRows=response.split(RowDelim);
|
||||
for(indx=0;indx<TabRows.length-1;indx++)
|
||||
{
|
||||
if($("#portfolio_id").val()==81)
|
||||
{
|
||||
var appl = $("#applno").val();
|
||||
alert('Application number '+appl+' already exists.');
|
||||
appl= (appl.search('_1') < 0 ? appl+'_1' : appl.split('_')[0]+'_'+(parseInt(appl.split('_')[1])+1));
|
||||
$("#applno").val(appl);
|
||||
validate(document.getElementById('applno'),'t','AlphaNumeric');
|
||||
document.getElementById('applno').focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
TabCols=TabRows[indx].split(ColDelim);
|
||||
SameAddr[indx]=new Array(TabCols.length);
|
||||
for(cindx=0;cindx<TabCols.length;cindx++)
|
||||
{
|
||||
SameAddr[indx][cindx]=TabCols[cindx];
|
||||
}
|
||||
}
|
||||
}
|
||||
SelectAddr(oprID-19);
|
||||
}
|
||||
}
|
||||
function findRecord(arrOpr)
|
||||
{
|
||||
tempPos= recpos;
|
||||
maxLen= recIndx-1;
|
||||
if(arrOpr==1) tempPos=0;
|
||||
if(arrOpr==2)
|
||||
{
|
||||
if(tempPos>0) tempPos=tempPos-1;
|
||||
else return false;
|
||||
}
|
||||
if(arrOpr==3)
|
||||
{
|
||||
if(tempPos<maxLen) tempPos=tempPos+1;
|
||||
else return false;
|
||||
}
|
||||
if(arrOpr==4) tempPos=maxLen;
|
||||
recpos= tempPos;
|
||||
FillDetails(recpos);
|
||||
}
|
||||
function FillDetails(indx)
|
||||
{
|
||||
if(recIndx > 0)
|
||||
{
|
||||
document.forms['casedetails'].reset();
|
||||
$("#recfound").html("<b>( "+(indx+1)+" / "+(recIndx==0 ? "0" : recIndx)+" )</b>");
|
||||
var findx=0;
|
||||
for(findx=0;findx<fields[0].length;findx++)
|
||||
{
|
||||
if($("#"+fields[0][findx]).length > 0)
|
||||
{
|
||||
if(fields[0][findx]=='rv' || fields[0][findx]=='sradd' || fields[0][findx]=='rtv' ||
|
||||
fields[0][findx]=='ov' || fields[0][findx]=='soadd' || fields[0][findx]=='otv' || fields[0][findx]=='rco'
|
||||
|| fields[0][findx]=='pv' || fields[0][findx]=='rcp' || fields[0][findx]=='ocp' || fields[0][findx]=='spadd'|| fields[0][findx]=='refv'|| fields[0][findx]=='docv')
|
||||
{
|
||||
|
||||
if(fields[0][findx]=='docv')
|
||||
{
|
||||
if($("#"+fields[0][findx]).is(":visible"))
|
||||
{
|
||||
$("#"+fields[0][findx]).attr('checked',true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(records[indx][findx]=='1')
|
||||
{
|
||||
$("#"+fields[0][findx]).attr('checked',true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#"+fields[0][findx]).attr('checked',false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#"+fields[0][findx]).val(records[indx][findx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($("#status").val()=='1')
|
||||
{
|
||||
$("#btnsave").hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#btnsave").show();
|
||||
}
|
||||
FireClickEvents();
|
||||
document.getElementById("applno").focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
CallMessage('5005MQRY:error:No records found',3000,200,300);
|
||||
AddNewRecord();
|
||||
}
|
||||
}
|
||||
function FireClickEvents()
|
||||
{
|
||||
HandleClick(document.getElementById('rv'));
|
||||
HandleClick(document.getElementById('ov'));
|
||||
HandleClick(document.getElementById('rtv'));
|
||||
HandleClick(document.getElementById('otv'));
|
||||
HandleClick(document.getElementById('pv'));
|
||||
HandleClick(document.getElementById('refv'));
|
||||
}
|
||||
function FireToggleEvents()
|
||||
{
|
||||
ToggleChks((document.getElementById('rv').checked && document.getElementById('ov').checked),'rco'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('apptype').value.toUpperCase()!='APPLICANT' && document.getElementById('apptype').value.toUpperCase()!='-1'),'sradd!C0L!soadd!C0L!spadd!C0L!','!C0L!');
|
||||
ToggleChks((document.getElementById('rv').checked),'rcp'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('ov').checked),'ocp'+ColDelim,ColDelim);
|
||||
}
|
||||
function HandleClick(el)
|
||||
{
|
||||
if(el.id=='rv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel2','raddr1,raddr2,raddr3,rlandmark,rcity,colr,rpincode','t,f,t,f,t,t,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,,SplInstruction,Pincode',document.getElementById('rtv').checked);
|
||||
EnableDisableFields(el.checked,'raddr1,raddr2,raddr3,rlandmark,colr,rpincode',',');
|
||||
}
|
||||
if(el.id=='rtv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel2','rphone','t','Phone',document.getElementById('rv').checked);
|
||||
}
|
||||
if(el.id=='ov')
|
||||
{
|
||||
setFormValidation(el,'FormPanel3','companyname,oaddr1,oaddr2,oaddr3,olandmark,ocity,colo,opincode,department,designation','f,t,f,t,f,t,t,f,f,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,SplInstruction,Pincode,SplInstruction,SplInstruction',document.getElementById('otv').checked);
|
||||
EnableDisableFields(el.checked,'oaddr1,oaddr2,oaddr3,olandmark,colo,opincode',',');
|
||||
}
|
||||
if(el.id=='rco')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('rco',1);
|
||||
}
|
||||
else
|
||||
{AutoFill('rco',0);}
|
||||
}
|
||||
if(el.id=='otv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel3','ophone','t','Phone',document.getElementById('ov').checked);
|
||||
}
|
||||
if(el.id=='pv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel4','paddr1,paddr2,paddr3,plandmark,pcity,colp,ppincode','t,f,t,f,t,t,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,,SplInstruction,Pincode',false);
|
||||
EnableDisableFields(el.checked,'paddr1,paddr2,paddr3,plandmark,colp,ppincode',',');
|
||||
if(!el.checked)
|
||||
{
|
||||
chkrcp=document.getElementById('rcp');
|
||||
chkrcp.checked=false;
|
||||
chkocp=document.getElementById('ocp');
|
||||
chkocp.checked=false;
|
||||
}
|
||||
}
|
||||
if(el.id=='rcp')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('rcp',1);
|
||||
chkocp=document.getElementById('ocp');
|
||||
chkocp.checked=false;
|
||||
chkprop=document.getElementById('pv');
|
||||
chkprop.checked=true;
|
||||
HandleClick(chkprop);
|
||||
}
|
||||
else
|
||||
{AutoFill('rcp',0);}
|
||||
}
|
||||
if(el.id=='ocp')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('ocp',1);
|
||||
chkrcp=document.getElementById('rcp');
|
||||
chkrcp.checked=false;
|
||||
chkprop=document.getElementById('pv');
|
||||
chkprop.checked=true;
|
||||
HandleClick(chkprop);
|
||||
}
|
||||
else
|
||||
{AutoFill('ocp',0);}
|
||||
}
|
||||
if(el.id=='refv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel5','refname1,refaddress1,refcontactno1','t,f,t','AlphaSpace,SplInstruction,Phone',false);
|
||||
}
|
||||
}
|
||||
function setFormValidation(Elem,FormPanel,ChildElems,IsRequired,Validation,CounterPartElem)
|
||||
{
|
||||
/*if(Elem.checked && !CounterPartElem)
|
||||
{
|
||||
hideForm(Elem.id, FormPanel);
|
||||
}
|
||||
if(!Elem.checked)
|
||||
{
|
||||
CheckForm(Elem,ChildElems,IsRequired,Validation);
|
||||
if(!CounterPartElem)
|
||||
{
|
||||
hideForm(Elem.id, FormPanel);
|
||||
}
|
||||
}*/
|
||||
|
||||
if(Elem.checked || CounterPartElem)
|
||||
{
|
||||
UnhideSections(FormPanel+ColDelim, ColDelim);
|
||||
}
|
||||
else
|
||||
{
|
||||
HideSections(FormPanel);
|
||||
}
|
||||
CheckForm(Elem,ChildElems,IsRequired,Validation);
|
||||
FireToggleEvents();
|
||||
}
|
||||
function CheckForm(Elem,ChildElems,IsRequired,Validation)
|
||||
{
|
||||
var Childs=ChildElems.split(",");
|
||||
var IsChildReq=IsRequired.split(",");
|
||||
var ValidString=Validation.split(",");
|
||||
for(Indx=0;Indx<Childs.length;Indx++)
|
||||
{
|
||||
validate(document.getElementById(Childs[Indx]),Elem.checked ? IsChildReq[Indx]:'f',ValidString[Indx]);
|
||||
}
|
||||
}
|
||||
function AutoFill(Opt,FillMode)
|
||||
{
|
||||
var SourceFields="";
|
||||
var TargetFields="";
|
||||
var isSameAdd=false;
|
||||
if(Opt=='rco')
|
||||
{
|
||||
SourceFields="raddr1"+ColDelim+"raddr2"+ColDelim+"raddr3"+ColDelim+"Rcolony"+ColDelim+"colr"+ColDelim+"rcity"+ColDelim+"rlandmark"+ColDelim+"rpincode"+ColDelim+"rphone";
|
||||
TargetFields="oaddr1"+ColDelim+"oaddr2"+ColDelim+"oaddr3"+ColDelim+"Ocolony"+ColDelim+"colo"+ColDelim+"ocity"+ColDelim+"olandmark"+ColDelim+"opincode"+ColDelim+"ophone";
|
||||
if(document.getElementById('Rcolony').value==document.getElementById('Ocolony').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
else if(Opt=='rcp')
|
||||
{
|
||||
SourceFields="raddr1"+ColDelim+"raddr2"+ColDelim+"raddr3"+ColDelim+"Rcolony"+ColDelim+"colr"+ColDelim+"rcity"+ColDelim+"rlandmark"+ColDelim+"rpincode";
|
||||
TargetFields="paddr1"+ColDelim+"paddr2"+ColDelim+"paddr3"+ColDelim+"Pcolony"+ColDelim+"colp"+ColDelim+"pcity"+ColDelim+"plandmark"+ColDelim+"ppincode";
|
||||
if(document.getElementById('Rcolony').value==document.getElementById('Pcolony').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
else if(Opt=='ocp')
|
||||
{
|
||||
SourceFields="oaddr1"+ColDelim+"oaddr2"+ColDelim+"oaddr3"+ColDelim+"Ocolony"+ColDelim+"colo"+ColDelim+"ocity"+ColDelim+"olandmark"+ColDelim+"opincode";
|
||||
TargetFields="paddr1"+ColDelim+"paddr2"+ColDelim+"paddr3"+ColDelim+"Pcolony"+ColDelim+"colp"+ColDelim+"pcity"+ColDelim+"plandmark"+ColDelim+"ppincode";
|
||||
if(document.getElementById('Ocolony').value==document.getElementById('Pcolony').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
if(FillMode==1)
|
||||
{
|
||||
CopyDetails(SourceFields,TargetFields);
|
||||
}
|
||||
else if(FillMode==0 && isSameAdd)
|
||||
{
|
||||
ClearDetails(TargetFields);
|
||||
}
|
||||
}
|
||||
function ToggleChks(IsVisible,ChildElems,Delim)
|
||||
{
|
||||
if(IsVisible)
|
||||
{
|
||||
UnhideSections(ChildElems,Delim);
|
||||
}
|
||||
else
|
||||
{
|
||||
var Childs=ChildElems.split(Delim);
|
||||
for(indx=0;indx<Childs.length-1;indx++)
|
||||
{
|
||||
HideSections(Childs[indx]);
|
||||
document.getElementById(Childs[indx]).checked=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ClearDetails(TargetFields)
|
||||
{
|
||||
if(TargetFields.length!=0)
|
||||
{
|
||||
var TargetList=TargetFields.split(ColDelim);
|
||||
if(TargetList.length==TargetList.length)
|
||||
{
|
||||
for(pos=0;pos<TargetList.length;pos++)
|
||||
{
|
||||
$("#"+TargetList[pos]).val("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function CopyDetails(SourceFields,TargetFields)
|
||||
{
|
||||
if(SourceFields.length!=0 && TargetFields.length!=0)
|
||||
{
|
||||
var SourceList=SourceFields.split(ColDelim);
|
||||
var TargetList=TargetFields.split(ColDelim);
|
||||
if(SourceList.length==TargetList.length)
|
||||
{
|
||||
for(pos=0;pos<SourceList.length;pos++)
|
||||
{
|
||||
$("#"+TargetList[pos]).val($("#"+SourceList[pos]).val());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function AfterOptSelect(ElemToRemove,OprID)
|
||||
{
|
||||
FillSameDet(selectedAddr, OprID);
|
||||
selectedAddr=-1;
|
||||
ElemToRemove.parentNode.removeChild(ElemToRemove);
|
||||
}
|
||||
function ShowAddrOptions(OprID)
|
||||
{
|
||||
var optDiv=document.createElement("div");
|
||||
var Addr="";
|
||||
optDiv.setAttribute("id","optDiv");
|
||||
optDiv.setAttribute("class","FormPanel");
|
||||
optDiv.setAttribute("style","font-family:Tahoma;overflow:visible");
|
||||
var OptionPanel="<div id='TablePanel' class='tableContainer'><table border='0' cellspacing='0' width='100%' id='cutlist'><thead class='thead'><tr title='Row Title'><td colspan='2'>Available Addresses</td></tr></thead><tbody class='scrollContent'>";
|
||||
for(indx=0;indx<SameAddr.length;indx++)
|
||||
{
|
||||
OptionPanel=OptionPanel+"<tr><td><input type='radio' name='rb1' id='rb"+indx+"' value='"+indx+"' onclick='selectedAddr=this.value;' /></td>";
|
||||
OptionPanel=OptionPanel+"<td style='padding-right:5px'>";
|
||||
for(cindx=0;cindx<4;cindx++)
|
||||
{
|
||||
Addr=Addr+" "+SameAddr[indx][cindx];
|
||||
}
|
||||
OptionPanel=OptionPanel+""+Addr+"</td></tr>";
|
||||
Addr="";
|
||||
}
|
||||
OptionPanel=OptionPanel+"<tr><td colspan='2'><input type='button' class='button' name='btnok' style='margin-top:5px;float:right' value='OK' id='btnok' accesskey='K' onclick=\"AfterOptSelect(document.getElementById('inptDialog'),"+OprID+");\"";
|
||||
OptionPanel=OptionPanel+"</tbody></table></div>";
|
||||
optDiv.innerHTML=OptionPanel;
|
||||
ShowInputDialog(optDiv,"Select Address","hint","inptDialog");
|
||||
document.getElementById('rb0').focus();
|
||||
}
|
||||
function FillSameDet(AddrIndex,OprID)
|
||||
{
|
||||
|
||||
if(!(AddrIndex < 0))
|
||||
{
|
||||
for(cindx=0;cindx<SameAddr[AddrIndex].length;cindx++)
|
||||
{
|
||||
$("#"+AddrElem[OprID][cindx+1]).val((SameAddr[AddrIndex][cindx]));
|
||||
}
|
||||
document.getElementById(FocusAfter).focus();
|
||||
ToggleChks((document.getElementById('apptype').value.toUpperCase()!='APPLICANT' && document.getElementById('apptype').value.toUpperCase()!='-1'),'sradd!C0L!soadd!C0L!spadd!C0L!','!C0L!');
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById(AddrElem[OprID][0]).focus();
|
||||
if(document.getElementById(AddrElem[OprID][0]).type=='checkbox'){document.getElementById(AddrElem[OprID][0]).checked=false;}
|
||||
}
|
||||
}
|
||||
function SelectAddr(OprID)
|
||||
{
|
||||
|
||||
if(SameAddr.length>1)
|
||||
{
|
||||
ShowAddrOptions(OprID);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillSameDet(0,OprID);
|
||||
}
|
||||
}
|
||||
function FindSameDet(Elm,Visit,focAfter)
|
||||
{
|
||||
if($("#case_id").val()!='0' && Visit=='A')
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
FocusAfter=focAfter;
|
||||
var procFlag=true;
|
||||
if(Elm.type=='checkbox')
|
||||
{
|
||||
procFlag=Elm.checked;
|
||||
}
|
||||
if(procFlag)
|
||||
{
|
||||
Applno=document.getElementById('applno').value;
|
||||
if(Applno.length==0)
|
||||
{
|
||||
if(Elm.type=='checkbox'){Elm.checked=false;}
|
||||
CallMessage('VLFRM:error:Please enter application number.',3000,200,300);
|
||||
document.getElementById('applno').focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SameAddr=new Array(0); // Empty Address Array
|
||||
oprId=(Visit=='R' ? 19:Visit=='O' ? 20:Visit=='P' ? 21:22);
|
||||
QryStr="val="+Applno+"&val1="+$("#portfolio_id").val()+"&val2="+oprId;
|
||||
RunAjax("GET","findsdet",QryStr,oprId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function FindStr(el,elmids,rstfld)
|
||||
{
|
||||
el.value=el.value.split('->')[0];
|
||||
var skey=el.value.trim().toUpperCase();
|
||||
if(skey!='UNKNOWN' && skey!='-1')
|
||||
{
|
||||
var elms=elmids.split(ColDelim);
|
||||
var indx=0;
|
||||
for(indx=0;indx<elms.length;indx++)
|
||||
{
|
||||
if($("#"+elms[indx]).val().toUpperCase().search(skey)>-1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function HandleBlur(el)
|
||||
{
|
||||
if(el.id=='rcity' || el.id=='ocity' || el.id=='pcity')
|
||||
{
|
||||
var pel= (el.id=='rcity' ? 'Rcolony':(el.id=='ocity' ? 'Ocolony':'Pcolony'));
|
||||
var cel= (el.id=='rcity' ? 'raddr':(el.id=='ocity' ? 'oaddr':'paddr'));
|
||||
var hel= (el.id=='rcity' ? 'colr':(el.id=='ocity' ? 'colo':'colp'));
|
||||
var chk= (el.id=='rcity' ? 'rv':(el.id=='ocity' ? 'ov':'pv'));
|
||||
if(!FindStr(el,cel+'2!C0L!'+cel+'3'))
|
||||
{
|
||||
CallMessage("1001AREA:error:Invalid area.", 3000, 200, 300);
|
||||
$(el).val("-1");
|
||||
$("#"+pel).val("");
|
||||
$("#"+hel).val("");
|
||||
}
|
||||
validate(el,document.getElementById(chk).checked ? 't':'f','');
|
||||
}
|
||||
if(el.id=='colr' || el.id=='colo' || el.id=='colp')
|
||||
{
|
||||
var pel= (el.id=='colr' ? 'rv':(el.id=='colo' ? 'ov':'pv'));
|
||||
var cel= (el.id=='colr' ? 'raddr':(el.id=='colo' ? 'oaddr':'paddr'));
|
||||
if(!FindStr(el,cel+'2!C0L!'+cel+'3'))
|
||||
{
|
||||
CallMessage("1001AREA:error:Invalid colony.", 3000, 200, 300);
|
||||
$(el).val("");
|
||||
}
|
||||
if(el.value=='')
|
||||
{
|
||||
document.getElementsByName(el.id+'_hidden')[0].value='';
|
||||
}
|
||||
if(document.getElementsByName(el.id+'_hidden')[0].value=='')
|
||||
{
|
||||
el.value='';
|
||||
}
|
||||
validate(el,document.getElementById(pel).checked ? 't':'f','SplInstruction');
|
||||
}
|
||||
}
|
||||
@@ -1,425 +0,0 @@
|
||||
//RowDelim="~R0W~";
|
||||
//ColDelim="~C0L~";
|
||||
var SameAddr=new Array(0);
|
||||
var AddrElem=new Array(4);
|
||||
var selectedAddr=-1;
|
||||
var FocusAfter="CustomerName";
|
||||
AddrElem[0]=["chksresi","ResiAdd1","ResiAdd2","ResiAdd3","ResiLandmark","ResiAdd3_hidden","ResiAdd3_citylist","ResiAdd3_Pincode","ResiPhone"];
|
||||
AddrElem[1]=["chksoff","CompanyName","OffAdd1","OffAdd2","OffAdd3","OffLandmark","OffAdd3_hidden","OffAdd3_citylist","OffAdd3_Pincode","OffPhone","Extension"];
|
||||
AddrElem[2]=["chksprop","PropAdd1","PropAdd2","PropAdd3","PropLandmark","PropAdd3_hidden","PropAdd3_citylist","PropAdd3_Pincode"];
|
||||
AddrElem[3]=["BankCode","BankCode","branchlist","prodlist","LoanAmount","typelist","ContactPerson","splist"];
|
||||
|
||||
function SubmitPunching(pageURL,TargetWindow)
|
||||
{
|
||||
document.caseDetails.action=pageURL;
|
||||
document.caseDetails.target=TargetWindow;
|
||||
document.caseDetails.submit();
|
||||
}
|
||||
function FindSameDet(Elm,Visit,focAfter)
|
||||
{
|
||||
if($("#FormMode").val()=='2' && Visit=='A')
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
FocusAfter=focAfter;
|
||||
var procFlag=true;
|
||||
if(Elm.type=='checkbox')
|
||||
{
|
||||
procFlag=Elm.checked;
|
||||
}
|
||||
if(procFlag)
|
||||
{
|
||||
Applno=document.getElementById('ApplNo').value;
|
||||
if(Applno.length==0)
|
||||
{
|
||||
if(Elm.type=='checkbox'){Elm.checked=false;}
|
||||
CallMessage('VLFRM:error:Please enter application number.',3000,200,300);
|
||||
document.getElementById('ApplNo').focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SameAddr=new Array(0); // Empty Address Array
|
||||
oprId=(Visit=='R' ? 19:Visit=='O' ? 20:Visit=='P' ? 21:22);
|
||||
QryStr="val="+Applno+"&val1="+$("#portlist").val()+"&val2="+oprId;
|
||||
RunAjax("GET","findsdet",QryStr,oprId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function copyTelNo(isCopy,SourceElemId,TargetElemId)
|
||||
{
|
||||
if(isCopy)
|
||||
{
|
||||
var copyStr="/";
|
||||
if(($("#"+TargetElemId).val().length) > 0)
|
||||
{
|
||||
|
||||
copyStr=$("#"+TargetElemId).val()+"/"+$("#"+SourceElemId).val();
|
||||
}
|
||||
else
|
||||
{
|
||||
copyStr=$("#"+SourceElemId).val();
|
||||
}
|
||||
$("#"+TargetElemId).val(copyStr);
|
||||
}
|
||||
}
|
||||
function SelectAddr(OprID)
|
||||
{
|
||||
if(SameAddr.length>1)
|
||||
{
|
||||
ShowAddrOptions(OprID);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillSameDet(0,OprID);
|
||||
}
|
||||
}
|
||||
function FillSameDet(AddrIndex,OprID)
|
||||
{
|
||||
if(!(AddrIndex < 0))
|
||||
{
|
||||
for(cindx=0;cindx<SameAddr[AddrIndex].length;cindx++)
|
||||
{
|
||||
$("#"+AddrElem[OprID][cindx+1]).val((SameAddr[AddrIndex][cindx]));
|
||||
}
|
||||
document.getElementById(FocusAfter).focus();
|
||||
ToggleChks((document.getElementById('typelist').value.toUpperCase()!='APPLICANT' && document.getElementById('typelist').value.toUpperCase()!='-1'),'chksresi!C0L!chksoff!C0L!chksprop!C0L!','!C0L!');
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById(AddrElem[OprID][0]).focus();
|
||||
if(document.getElementById(AddrElem[OprID][0]).type=='checkbox'){document.getElementById(AddrElem[OprID][0]).checked=false;}
|
||||
}
|
||||
}
|
||||
function ShowAddrOptions(OprID)
|
||||
{
|
||||
var optDiv=document.createElement("div");
|
||||
var Addr="";
|
||||
optDiv.setAttribute("id","optDiv");
|
||||
optDiv.setAttribute("class","FormPanel");
|
||||
optDiv.setAttribute("style","font-family:Tahoma;overflow:visible");
|
||||
var OptionPanel="<div id='TablePanel' class='tableContainer'><table border='0' cellspacing='0' width='100%' id='cutlist'><thead class='thead'><tr title='Row Title'><td colspan='2'>Available Addresses</td></tr></thead><tbody class='scrollContent'>";
|
||||
for(indx=0;indx<SameAddr.length;indx++)
|
||||
{
|
||||
OptionPanel=OptionPanel+"<tr><td><input type='radio' name='rb1' id='rb"+indx+"' value='"+indx+"' onclick='selectedAddr=this.value;' /></td>";
|
||||
OptionPanel=OptionPanel+"<td style='padding-right:5px'>";
|
||||
for(cindx=0;cindx<4;cindx++)
|
||||
{
|
||||
Addr=Addr+" "+SameAddr[indx][cindx];
|
||||
}
|
||||
OptionPanel=OptionPanel+""+Addr+"</td></tr>";
|
||||
Addr="";
|
||||
}
|
||||
OptionPanel=OptionPanel+"<tr><td colspan='2'><input type='button' class='button' name='btnok' style='margin-top:5px;float:right' value='OK' id='btnok' accesskey='K' onclick=\"AfterOptSelect(document.getElementById('inptDialog'),"+OprID+");\"";
|
||||
OptionPanel=OptionPanel+"</tbody></table></div>";
|
||||
optDiv.innerHTML=OptionPanel;
|
||||
ShowInputDialog(optDiv,"Select Address","hint","inptDialog");
|
||||
document.getElementById('rb0').focus();
|
||||
}
|
||||
function AfterOptSelect(ElemToRemove,OprID)
|
||||
{
|
||||
FillSameDet(selectedAddr, OprID);
|
||||
selectedAddr=-1;
|
||||
ElemToRemove.parentNode.removeChild(ElemToRemove);
|
||||
}
|
||||
function GatherRequirement(portID)
|
||||
{
|
||||
ClearDropDown("branch"+ColDelim+"product",ColDelim);
|
||||
HideSections("section");
|
||||
if(portID!=0)
|
||||
{
|
||||
QryStr="val0="+portID;
|
||||
RunAjax("GET","filldds",QryStr,1);
|
||||
}
|
||||
}
|
||||
function AfterResponse(AjaxResponse,OprID)
|
||||
{
|
||||
if(OprID==1)
|
||||
{
|
||||
ArrangePage(AjaxResponse);
|
||||
}
|
||||
else if(OprID==19 || OprID==20 || OprID==21 || OprID==22)
|
||||
{
|
||||
TabRows=AjaxResponse.split(RowDelim);
|
||||
for(indx=0;indx<TabRows.length-1;indx++)
|
||||
{
|
||||
TabCols=TabRows[indx].split(ColDelim);
|
||||
SameAddr[indx]=new Array(TabCols.length);
|
||||
for(cindx=0;cindx<TabCols.length;cindx++)
|
||||
{
|
||||
SameAddr[indx][cindx]=TabCols[cindx];
|
||||
}
|
||||
}
|
||||
SelectAddr(OprID-19);
|
||||
}
|
||||
}
|
||||
function ArrangePage(AjaxResponse)
|
||||
{
|
||||
if(AjaxResponse!='')
|
||||
{
|
||||
var TempArr=AjaxResponse.split("#BRAN#");
|
||||
var branch=TempArr[0];
|
||||
|
||||
TempArr=TempArr[1].split("#PROD#");
|
||||
var product=TempArr[0];
|
||||
var process=TempArr[1];
|
||||
|
||||
FillDD("branch",branch,RowDelim,ColDelim);
|
||||
FillDD("product",product,RowDelim,ColDelim);
|
||||
UnhideSections(process,ColDelim);
|
||||
}
|
||||
}
|
||||
function ToggleChks(IsVisible,ChildElems,Delim)
|
||||
{
|
||||
if(IsVisible)
|
||||
{
|
||||
UnhideSections(ChildElems,Delim);
|
||||
}
|
||||
else
|
||||
{
|
||||
var Childs=ChildElems.split(Delim);
|
||||
for(indx=0;indx<Childs.length-1;indx++)
|
||||
{
|
||||
HideSections(Childs[indx]);
|
||||
document.getElementById(Childs[indx]).checked=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function setFormValidation(Elem,FormPanel,ChildElems,IsRequired,Validation,CounterPartElem)
|
||||
{
|
||||
if(Elem.checked && !CounterPartElem)
|
||||
{
|
||||
hideForm(Elem.id, FormPanel);
|
||||
}
|
||||
if(!Elem.checked)
|
||||
{
|
||||
CheckForm(Elem,ChildElems,IsRequired,Validation);
|
||||
if(!CounterPartElem)
|
||||
{
|
||||
hideForm(Elem.id, FormPanel);
|
||||
}
|
||||
}
|
||||
ToggleChks((document.getElementById('chkresi').checked && document.getElementById('chkoffice').checked),'chkrco'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('chkresi').checked),'chkrcp'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('chkoffice').checked),'chkocp'+ColDelim,ColDelim);
|
||||
}
|
||||
function AutoFill(Opt,FillMode)
|
||||
{
|
||||
var SourceFields="";
|
||||
var TargetFields="";
|
||||
var isSameAdd=false;
|
||||
if(Opt=='chkrco')
|
||||
{
|
||||
SourceFields="ResiAdd1"+ColDelim+"ResiAdd2"+ColDelim+"ResiAdd3"+ColDelim+"ResiAdd3_hidden"+ColDelim+"ResiAdd3_citylist"+ColDelim+"ResiLandmark"+ColDelim+"ResiAdd3_Pincode"+ColDelim+"ResiPhone";
|
||||
TargetFields="OffAdd1"+ColDelim+"OffAdd2"+ColDelim+"OffAdd3"+ColDelim+"OffAdd3_hidden"+ColDelim+"OffAdd3_citylist"+ColDelim+"OffLandmark"+ColDelim+"OffAdd3_Pincode"+ColDelim+"OffPhone";
|
||||
if(document.getElementById('ResiAdd3_hidden').value==document.getElementById('OffAdd3_hidden').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
else if(Opt=='chkrcp')
|
||||
{
|
||||
SourceFields="ResiAdd1"+ColDelim+"ResiAdd2"+ColDelim+"ResiAdd3"+ColDelim+"ResiAdd3_hidden"+ColDelim+"ResiAdd3_citylist"+ColDelim+"ResiLandmark"+ColDelim+"ResiAdd3_Pincode";
|
||||
TargetFields="PropAdd1"+ColDelim+"PropAdd2"+ColDelim+"PropAdd3"+ColDelim+"PropAdd3_hidden"+ColDelim+"PropAdd3_citylist"+ColDelim+"PropLandmark"+ColDelim+"PropAdd3_Pincode";
|
||||
if(document.getElementById('ResiAdd3_hidden').value==document.getElementById('PropAdd3_hidden').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
else if(Opt=='chkocp')
|
||||
{
|
||||
SourceFields="OffAdd1"+ColDelim+"OffAdd2"+ColDelim+"OffAdd3"+ColDelim+"OffAdd3_hidden"+ColDelim+"OffAdd3_citylist"+ColDelim+"OffLandmark"+ColDelim+"OffAdd3_Pincode";
|
||||
TargetFields="PropAdd1"+ColDelim+"PropAdd2"+ColDelim+"PropAdd3"+ColDelim+"PropAdd3_hidden"+ColDelim+"PropAdd3_citylist"+ColDelim+"PropLandmark"+ColDelim+"PropAdd3_Pincode";
|
||||
if(document.getElementById('OffAdd3_hidden').value==document.getElementById('PropAdd3_hidden').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
if(FillMode==1)
|
||||
{
|
||||
CopyDetails(SourceFields,TargetFields);
|
||||
}
|
||||
else if(FillMode==0 && isSameAdd)
|
||||
{
|
||||
ClearDetails(TargetFields);
|
||||
}
|
||||
}
|
||||
function ClearDetails(TargetFields)
|
||||
{
|
||||
if(TargetFields.length!=0)
|
||||
{
|
||||
var TargetList=TargetFields.split(ColDelim);
|
||||
if(TargetList.length==TargetList.length)
|
||||
{
|
||||
for(pos=0;pos<TargetList.length;pos++)
|
||||
{
|
||||
$("#"+TargetList[pos]).val("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function CopyDetails(SourceFields,TargetFields)
|
||||
{
|
||||
if(SourceFields.length!=0 && TargetFields.length!=0)
|
||||
{
|
||||
var SourceList=SourceFields.split(ColDelim);
|
||||
var TargetList=TargetFields.split(ColDelim);
|
||||
if(SourceList.length==TargetList.length)
|
||||
{
|
||||
for(pos=0;pos<SourceList.length;pos++)
|
||||
{
|
||||
$("#"+TargetList[pos]).val($("#"+SourceList[pos]).val());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function CheckForm(Elem,ChildElems,IsRequired,Validation)
|
||||
{
|
||||
var Childs=ChildElems.split(",");
|
||||
var IsChildReq=IsRequired.split(",");
|
||||
var ValidString=Validation.split(",");
|
||||
for(Indx=0;Indx<Childs.length;Indx++)
|
||||
{
|
||||
validate(document.getElementById(Childs[Indx]),Elem.checked ? IsChildReq[Indx]:'f',ValidString[Indx]);
|
||||
}
|
||||
}
|
||||
function onLocalityBlur(el,IsRequired)
|
||||
{
|
||||
if(el.value=='')
|
||||
{
|
||||
document.getElementById(el.id+'_hidden').value='';
|
||||
}
|
||||
if(document.getElementById(el.id+'_hidden').value=='')
|
||||
{
|
||||
el.value='';
|
||||
}
|
||||
validate(el,IsRequired,'SplInstruction');
|
||||
}
|
||||
function ValidateSubmitForm(FormName)
|
||||
{
|
||||
var Chkresi=document.getElementById('chkresi');
|
||||
var Chkoff=document.getElementById('chkoffice');
|
||||
var Chkprop=document.getElementById('chkprop');
|
||||
if(Chkresi.checked || Chkoff.checked || Chkprop.checked || document.getElementById('chkteler').checked || document.getElementById('chkteleo').checked || document.getElementById('chkref').checked || document.getElementById('chkdoc').checked)
|
||||
{
|
||||
validate(document.getElementById('ApplNo'),'t','AlphaNumeric');
|
||||
validate(document.getElementById('branchlist'),'t','');
|
||||
validate(document.getElementById('prodlist'),'t','');
|
||||
validate(document.getElementById('CustomerName'),'t','AlphaSpace');
|
||||
validate(document.getElementById('typelist'),'t','');
|
||||
if(Chkresi.checked)
|
||||
{
|
||||
CheckForm(Chkresi,'ResiAdd1,ResiAdd2,ResiAdd3,ResiLandmark,ResiAdd3_citylist,ResiAdd3_Pincode','t,f,t,f,t,t','SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode');
|
||||
if(document.getElementById('ResiAdd3_hidden').value=='' || document.getElementById('ResiAdd3_hidden').value=='0')
|
||||
{
|
||||
highlightField(document.getElementById('ResiAdd3'));
|
||||
}
|
||||
}
|
||||
if(Chkoff.checked)
|
||||
{
|
||||
CheckForm(Chkoff,'CompanyName,OffAdd1,OffAdd2,OffAdd3,OffLandmark,OffAdd3_citylist,OffAdd3_Pincode,Department,Designation','f,t,f,t,f,t,t,f,f,t','SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode,SplInstruction,SplInstruction');
|
||||
if(document.getElementById('OffAdd3_hidden').value=='' || document.getElementById('OffAdd3_hidden').value=='0')
|
||||
{
|
||||
highlightField(document.getElementById('OffAdd3'));
|
||||
}
|
||||
}
|
||||
if(document.getElementById('chkteler').checked)
|
||||
{
|
||||
CheckForm(document.getElementById('chkteler'),'ResiPhone','t','Phone');
|
||||
}
|
||||
if(document.getElementById('chkteleo').checked)
|
||||
{
|
||||
CheckForm(document.getElementById('chkteleo'),'OffPhone','t','Phone');
|
||||
}
|
||||
if(Chkprop.checked)
|
||||
{
|
||||
CheckForm(Chkprop,'PropAdd1,PropAdd2,PropAdd3,PropLandmark,PropAdd3_citylist,PropAdd3_Pincode','t,f,t,f,t,t','SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode');
|
||||
if(document.getElementById('PropAdd3_hidden').value=='' || document.getElementById('PropAdd3_hidden').value=='0')
|
||||
{
|
||||
highlightField(document.getElementById('PropAdd3'));
|
||||
}
|
||||
}
|
||||
if(document.getElementById('chkref').checked)
|
||||
{
|
||||
CheckForm(document.getElementById('chkref'),'Ref1Name,Ref1Address,Ref1Contactno','t,f,t','AlphaSpace,SplInstruction,Phone');
|
||||
}
|
||||
if (invalidFields>0)
|
||||
{
|
||||
CallMessage('VLFRM:error:There are one or more error(s) in form. Please correct them and try again.',3000,200,300);
|
||||
}
|
||||
else
|
||||
{
|
||||
SubmitForm('casesave','_parent',FormName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CallMessage('VLFRM:error:Atleast one address verification is mandatory.',3000,200,300);
|
||||
}
|
||||
}
|
||||
function HandleClick(el)
|
||||
{
|
||||
if(el.id=='chkresi')
|
||||
{
|
||||
setFormValidation(el,'FormPanel2','ResiAdd1,ResiAdd2,ResiAdd3,ResiLandmark,ResiAdd3_citylist,ResiAdd3_Pincode','t,f,t,f,t,t,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode',document.getElementById('chkteler').checked);
|
||||
EnableDisableFields(el.checked,'ResiAdd1,ResiAdd2,ResiAdd3,ResiLandmark,ResiAdd3_Pincode',',');
|
||||
}
|
||||
if(el.id=='chkteler')
|
||||
{
|
||||
setFormValidation(el,'FormPanel2','ResiPhone','t','Phone',document.getElementById('chkresi').checked);
|
||||
}
|
||||
if(el.id=='chkoffice')
|
||||
{
|
||||
setFormValidation(el,'FormPanel3','CompanyName,OffAdd1,OffAdd2,OffAdd3,OffLandmark,OffAdd3_citylist,OffAdd3_Pincode,Department,Designation','f,t,f,t,f,t,t,f,f,t','SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode,SplInstruction,SplInstruction',document.getElementById('chkteleo').checked);
|
||||
EnableDisableFields(el.checked,'OffAdd1,OffAdd2,OffAdd3,OffLandmark,OffAdd3_Pincode',',');
|
||||
}
|
||||
if(el.id=='chkrco')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('chkrco',1);
|
||||
}
|
||||
else
|
||||
{AutoFill('chkrco',0);}
|
||||
}
|
||||
if(el.id=='chkteleo')
|
||||
{
|
||||
setFormValidation(el,'FormPanel3','OffPhone','t','Phone',document.getElementById('chkoffice').checked);
|
||||
}
|
||||
if(el.id=='chkprop')
|
||||
{
|
||||
setFormValidation(el,'FormPanel4','PropAdd1,PropAdd2,PropAdd3,PropLandmark,PropAdd3_citylist,PropAdd3_Pincode','t,f,t,f,t,t','SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode',false);
|
||||
EnableDisableFields(el.checked,'PropAdd1,PropAdd2,PropAdd3,PropLandmark,PropAdd3_Pincode',',');
|
||||
}
|
||||
if(el.id=='chkrcp')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('chkrcp',1);
|
||||
chkocp=document.getElementById('chkocp');
|
||||
chkocp.checked=false;
|
||||
chkprop=document.getElementById('chkprop');
|
||||
chkprop.checked=true;
|
||||
HandleClick(chkprop);
|
||||
}
|
||||
else
|
||||
{AutoFill('chkrcp',0);}
|
||||
}
|
||||
if(el.id=='chkocp')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('chkocp',1);
|
||||
chkrcp=document.getElementById('chkrcp');
|
||||
chkrcp.checked=false;
|
||||
chkprop=document.getElementById('chkprop');
|
||||
chkprop.checked=true;
|
||||
HandleClick(chkprop);
|
||||
}
|
||||
else
|
||||
{AutoFill('chkocp',0);}
|
||||
}
|
||||
}
|
||||
143
cygnus-onprem-app/build/WebContent/js/edp/application-save.js
Normal file
143
cygnus-onprem-app/build/WebContent/js/edp/application-save.js
Normal file
@@ -0,0 +1,143 @@
|
||||
(function (window, document) {
|
||||
"use strict";
|
||||
|
||||
const API = Object.freeze({ key: "payload-key", save: "application-save" });
|
||||
const BOOLEAN_FIELDS = Object.freeze({
|
||||
residenceVerification: "rv",
|
||||
residenceTelephoneVerification: "rtv",
|
||||
officeVerification: "ov",
|
||||
officeTelephoneVerification: "otv",
|
||||
propertyVerification: "pv",
|
||||
referenceVerification: "refv",
|
||||
documentVerification: "docv",
|
||||
residenceCoApplicant: "rco",
|
||||
residenceCoProprietor: "rcp",
|
||||
officeCoProprietor: "ocp",
|
||||
sameResidenceAddress: "sradd",
|
||||
sameOfficeAddress: "soadd",
|
||||
samePropertyAddress: "spadd",
|
||||
autoCutOff: "autocut"
|
||||
});
|
||||
const VALUE_FIELDS = Object.freeze({
|
||||
applicationId: "case_id", portfolioId: "portfolio_id", bankBranchId: "bank_branch_id",
|
||||
applicationNumber: "applno", bankCode: "bankcode", product: "product",
|
||||
loanAmount: "loanamount", customerName: "customername", fatherName: "fathername",
|
||||
applicationType: "apptype", category: "category", dateOfBirth: "dob",
|
||||
contactPerson: "contactperson", mobileNumber: "mobileno", specialInstruction: "specialinst",
|
||||
residenceAddress1: "raddr1", residenceAddress2: "raddr2", residenceAddress3: "raddr3",
|
||||
residenceLandmark: "rlandmark", residenceColonyId: "Rcolony", residenceCity: "rcity",
|
||||
residencePincode: "rpincode", residencePhone: "rphone", companyName: "companyname",
|
||||
officeAddress1: "oaddr1", officeAddress2: "oaddr2", officeAddress3: "oaddr3",
|
||||
officeLandmark: "olandmark", officeColonyId: "Ocolony", officeCity: "ocity",
|
||||
officePincode: "opincode", department: "department", designation: "designation",
|
||||
officePhone: "ophone", extension: "extension", propertyAddress1: "paddr1",
|
||||
propertyAddress2: "paddr2", propertyAddress3: "paddr3", propertyLandmark: "plandmark",
|
||||
propertyColonyId: "Pcolony", propertyCity: "pcity", propertyPincode: "ppincode",
|
||||
referenceName1: "refname1", referenceAddress1: "refaddress1",
|
||||
referenceContactNumber1: "refcontactno1", referenceName2: "refname2",
|
||||
referenceAddress2: "refaddress2", referenceContactNumber2: "refcontactno2",
|
||||
formMode: "formmode"
|
||||
});
|
||||
const INTEGER_FIELDS = new Set(["applicationId", "portfolioId", "bankBranchId", "residenceColonyId",
|
||||
"officeColonyId", "propertyColonyId", "formMode"]);
|
||||
const element = (id) => document.getElementById(id);
|
||||
const value = (id) => element(id)?.value?.trim() ?? "";
|
||||
const integer = (id) => {
|
||||
const parsed = Number.parseInt(value(id), 10);
|
||||
return Number.isFinite(parsed) ? parsed : 0;
|
||||
};
|
||||
const checked = (id) => Boolean(element(id)?.checked);
|
||||
|
||||
function collectDynamicFields() {
|
||||
const names = value("dynamicfields").split(window.ColDelim || "!C0L!").filter(Boolean);
|
||||
return names.reduce((result, name) => {
|
||||
if (/^(?:field(?:[1-9]|1[0-2])|dtfield1)$/.test(name) && element(name)) {
|
||||
result[name] = value(name);
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function collectCase() {
|
||||
const details = {};
|
||||
Object.entries(VALUE_FIELDS).forEach(([property, id]) => {
|
||||
details[property] = INTEGER_FIELDS.has(property) ? integer(id) : value(id);
|
||||
});
|
||||
Object.entries(BOOLEAN_FIELDS).forEach(([property, id]) => { details[property] = checked(id); });
|
||||
details.dynamicFields = collectDynamicFields();
|
||||
return details;
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
const verificationIds = ["rv", "rtv", "ov", "otv", "pv", "refv", "docv"];
|
||||
if (!verificationIds.some(checked)) {
|
||||
notify("danger", "APP-4221", "At least one verification type is required.");
|
||||
return false;
|
||||
}
|
||||
window.invalidFields = 0;
|
||||
window.validate(element("applno"), "t", "AlphaNumeric");
|
||||
window.validate(element("bank_branch_id"), "t", "");
|
||||
window.validate(element("product"), "t", "");
|
||||
window.validate(element("customername"), "t", "AlphaSpace");
|
||||
window.validate(element("apptype"), "t", "");
|
||||
if (checked("rv")) window.CheckForm(element("rv"), "raddr1,raddr2,raddr3,rlandmark,colr,rcity,rpincode", "t,f,t,f,t,t,f", "SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode");
|
||||
if (checked("ov")) window.CheckForm(element("ov"), "companyname,oaddr1,oaddr2,oaddr3,olandmark,colo,ocity,opincode,department,designation", "f,t,f,t,f,t,t,f,f,f", "SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode,SplInstruction,SplInstruction");
|
||||
if (checked("pv")) window.CheckForm(element("pv"), "paddr1,paddr2,paddr3,plandmark,colp,pcity,ppincode", "t,f,t,f,t,t,f", "SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode");
|
||||
if (checked("rtv")) window.CheckForm(element("rtv"), "rphone", "t", "Phone");
|
||||
if (checked("otv")) window.CheckForm(element("otv"), "ophone", "t", "Phone");
|
||||
if (checked("refv")) window.CheckForm(element("refv"), "refname1,refaddress1,refcontactno1", "t,f,t", "AlphaSpace,SplInstruction,Phone");
|
||||
[["rv", "Rcolony", "colr"], ["ov", "Ocolony", "colo"], ["pv", "Pcolony", "colp"]]
|
||||
.forEach(([flag, hidden, visible]) => {
|
||||
if (checked(flag) && integer(hidden) === 0) window.highlightField(element(visible));
|
||||
});
|
||||
if (document.querySelector(".matrix-validation-error-icon")) {
|
||||
notify("danger", "APP-4221", "Correct the highlighted fields and submit the application again.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function notify(type, code, message, referenceId) {
|
||||
window.CygnusNotifications.show({ type, code, message, referenceId });
|
||||
}
|
||||
|
||||
function applyResult(result, originalApplicationId) {
|
||||
element("case_id").value = result.applicationId;
|
||||
if (element("mvcode")) element("mvcode").value = result.mvCode || "";
|
||||
if (Array.isArray(window.fields?.[0]) && Array.isArray(window.records?.[window.recpos])) {
|
||||
[["case_id", result.applicationId], ["mvcode", result.mvCode]].forEach(([name, fieldValue]) => {
|
||||
const index = window.fields[0].indexOf(name);
|
||||
if (index >= 0) window.records[window.recpos][index] = fieldValue;
|
||||
});
|
||||
}
|
||||
notify("success", "APP-2001", `Application ${result.mvCode || result.applicationId} saved successfully.`);
|
||||
if (originalApplicationId === 0 && typeof window.AddNewRecord === "function") window.AddNewRecord();
|
||||
else if (originalApplicationId > 0 && typeof window.findRecord === "function") window.findRecord(3);
|
||||
}
|
||||
|
||||
async function save(event) {
|
||||
event?.preventDefault();
|
||||
if (!validateForm()) return false;
|
||||
const button = element("btnsave");
|
||||
if (button?.disabled) return false;
|
||||
const details = collectCase();
|
||||
if (button) button.disabled = true;
|
||||
try {
|
||||
const envelope = await window.CygnusPayloadCrypto.encrypt(details, { keyUrl: API.key });
|
||||
const response = await fetch(API.save, { method: "POST", credentials: "same-origin",
|
||||
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
||||
body: JSON.stringify(envelope) });
|
||||
const body = await response.json().catch(() => null);
|
||||
if (!response.ok || !body?.success) throw body?.message || body || {};
|
||||
applyResult(body.data, details.applicationId);
|
||||
} catch (error) {
|
||||
notify("danger", error.code || "APP-5001",
|
||||
error.message || "Cygnus could not save the application details.", error.referenceId);
|
||||
} finally {
|
||||
if (button) button.disabled = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
window.CygnusInitiation = Object.freeze({ save });
|
||||
}(window, document));
|
||||
@@ -1,170 +1,649 @@
|
||||
(function (window, document) {
|
||||
"use strict";
|
||||
/*
|
||||
* Case Initiation page behaviour.
|
||||
*
|
||||
* This file owns record loading/navigation, verification-section state,
|
||||
* address copying and duplicate-address lookup. The encrypted JSON save
|
||||
* workflow is intentionally isolated in application-save.js.
|
||||
*/
|
||||
var records=new Array(1);
|
||||
var fields=new Array(1);
|
||||
var recIndx = 0;
|
||||
var recpos = 0;
|
||||
var autocut = 0;
|
||||
var SameAddr=new Array(0);
|
||||
var AddrElem=new Array(4);
|
||||
var selectedAddr=-1;
|
||||
var FocusAfter="customername";
|
||||
AddrElem[0]=["rv","raddr1","raddr2","raddr3","rlandmark","Rcolony","colr","rcity","rpincode","rphone"];
|
||||
AddrElem[1]=["ov","companyname","oaddr1","oaddr2","oaddr3","olandmark","Ocolony","colo","ocity","opincode","ophone","extension"];
|
||||
AddrElem[2]=["pv","paddr1","paddr2","paddr3","plandmark","Pcolony","colp","pcity","ppincode"];
|
||||
AddrElem[3]=["bankcode","bankcode","bank_branch_id","product","loanamount","apptype","contactperson","specialinst"];
|
||||
|
||||
function InitPage()
|
||||
{
|
||||
var portField = document.getElementById("portfolio_id");
|
||||
var initialPortField = document.getElementById("initial-portfolio-id");
|
||||
var visibleContentsField = document.getElementById("visiblecontents");
|
||||
var port = initialPortField ? initialPortField.value : (portField ? portField.value : "-1");
|
||||
var viscontents = visibleContentsField ? visibleContentsField.value : "";
|
||||
if (viscontents && viscontents.slice(-ColDelim.length) !== ColDelim) {
|
||||
viscontents += ColDelim;
|
||||
}
|
||||
|
||||
const API = Object.freeze({ key: "payload-key", save: "application-save" });
|
||||
const BOOLEAN_FIELDS = Object.freeze({
|
||||
residenceVerification: "rv",
|
||||
residenceTelephoneVerification: "rtv",
|
||||
officeVerification: "ov",
|
||||
officeTelephoneVerification: "otv",
|
||||
propertyVerification: "pv",
|
||||
referenceVerification: "refv",
|
||||
documentVerification: "docv",
|
||||
residenceCoApplicant: "rco",
|
||||
residenceCoProprietor: "rcp",
|
||||
officeCoProprietor: "ocp",
|
||||
sameResidenceAddress: "sradd",
|
||||
sameOfficeAddress: "soadd",
|
||||
samePropertyAddress: "spadd",
|
||||
autoCutOff: "autocut"
|
||||
});
|
||||
const VALUE_FIELDS = Object.freeze({
|
||||
applicationId: "case_id", portfolioId: "portfolio_id", bankBranchId: "bank_branch_id",
|
||||
applicationNumber: "applno", bankCode: "bankcode", product: "product",
|
||||
loanAmount: "loanamount", customerName: "customername", fatherName: "fathername",
|
||||
applicationType: "apptype", category: "category", dateOfBirth: "dob",
|
||||
contactPerson: "contactperson", mobileNumber: "mobileno", specialInstruction: "specialinst",
|
||||
residenceAddress1: "raddr1", residenceAddress2: "raddr2", residenceAddress3: "raddr3",
|
||||
residenceLandmark: "rlandmark", residenceColonyId: "Rcolony", residenceCity: "rcity",
|
||||
residencePincode: "rpincode", residencePhone: "rphone", companyName: "companyname",
|
||||
officeAddress1: "oaddr1", officeAddress2: "oaddr2", officeAddress3: "oaddr3",
|
||||
officeLandmark: "olandmark", officeColonyId: "Ocolony", officeCity: "ocity",
|
||||
officePincode: "opincode", department: "department", designation: "designation",
|
||||
officePhone: "ophone", extension: "extension", propertyAddress1: "paddr1",
|
||||
propertyAddress2: "paddr2", propertyAddress3: "paddr3", propertyLandmark: "plandmark",
|
||||
propertyColonyId: "Pcolony", propertyCity: "pcity", propertyPincode: "ppincode",
|
||||
referenceName1: "refname1", referenceAddress1: "refaddress1",
|
||||
referenceContactNumber1: "refcontactno1", referenceName2: "refname2",
|
||||
referenceAddress2: "refaddress2", referenceContactNumber2: "refcontactno2",
|
||||
formMode: "formmode"
|
||||
});
|
||||
const INTEGER_FIELDS = new Set(["applicationId", "portfolioId", "bankBranchId", "residenceColonyId",
|
||||
"officeColonyId", "propertyColonyId", "formMode"]);
|
||||
const element = (id) => document.getElementById(id);
|
||||
const value = (id) => element(id)?.value?.trim() ?? "";
|
||||
const integer = (id) => {
|
||||
const parsed = Number.parseInt(value(id), 10);
|
||||
return Number.isFinite(parsed) ? parsed : 0;
|
||||
};
|
||||
const checked = (id) => Boolean(element(id)?.checked);
|
||||
|
||||
function collectDynamicFields() {
|
||||
const names = value("dynamicfields").split(window.ColDelim || "!C0L!").filter(Boolean);
|
||||
return names.reduce((result, name) => {
|
||||
if (/^(?:field(?:[1-9]|1[0-2])|dtfield1)$/.test(name) && element(name)) {
|
||||
result[name] = value(name);
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function collectCase() {
|
||||
const details = {};
|
||||
Object.entries(VALUE_FIELDS).forEach(([property, id]) => {
|
||||
details[property] = INTEGER_FIELDS.has(property) ? integer(id) : value(id);
|
||||
});
|
||||
Object.entries(BOOLEAN_FIELDS).forEach(([property, id]) => { details[property] = checked(id); });
|
||||
details.dynamicFields = collectDynamicFields();
|
||||
return details;
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
const verificationIds = ["rv", "rtv", "ov", "otv", "pv", "refv", "docv"];
|
||||
if (!verificationIds.some(checked)) {
|
||||
showAlert("danger", "APP-4221", "At least one verification type is required.");
|
||||
return false;
|
||||
}
|
||||
window.invalidFields = 0;
|
||||
window.validate(element("applno"), "t", "AlphaNumeric");
|
||||
window.validate(element("bank_branch_id"), "t", "");
|
||||
window.validate(element("product"), "t", "");
|
||||
window.validate(element("customername"), "t", "AlphaSpace");
|
||||
window.validate(element("apptype"), "t", "");
|
||||
if (checked("rv")) window.CheckForm(element("rv"), "raddr1,raddr2,raddr3,rlandmark,colr,rcity,rpincode", "t,f,t,f,t,t,f", "SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode");
|
||||
if (checked("ov")) window.CheckForm(element("ov"), "companyname,oaddr1,oaddr2,oaddr3,olandmark,colo,ocity,opincode,department,designation", "f,t,f,t,f,t,t,f,f,f", "SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode,SplInstruction,SplInstruction");
|
||||
if (checked("pv")) window.CheckForm(element("pv"), "paddr1,paddr2,paddr3,plandmark,colp,pcity,ppincode", "t,f,t,f,t,t,f", "SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,Pincode");
|
||||
if (checked("rtv")) window.CheckForm(element("rtv"), "rphone", "t", "Phone");
|
||||
if (checked("otv")) window.CheckForm(element("otv"), "ophone", "t", "Phone");
|
||||
if (checked("refv")) window.CheckForm(element("refv"), "refname1,refaddress1,refcontactno1", "t,f,t", "AlphaSpace,SplInstruction,Phone");
|
||||
[["rv", "Rcolony", "colr"], ["ov", "Ocolony", "colo"], ["pv", "Pcolony", "colp"]]
|
||||
.forEach(([flag, hidden, visible]) => {
|
||||
if (checked(flag) && integer(hidden) === 0) window.highlightField(element(visible));
|
||||
});
|
||||
if (document.querySelector(".matrix-validation-error-icon")) {
|
||||
showAlert("danger", "APP-4221", "Correct the highlighted fields and submit the application again.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function showAlert(level, code, message, referenceId) {
|
||||
let host = element("case-save-alerts");
|
||||
if (!host) {
|
||||
host = document.createElement("div");
|
||||
host.id = "case-save-alerts";
|
||||
host.className = "position-fixed top-0 start-50 translate-middle-x p-3";
|
||||
host.style.cssText = "z-index:1085;max-width:720px;width:calc(100% - 2rem)";
|
||||
document.body.append(host);
|
||||
}
|
||||
const alert = document.createElement("div");
|
||||
alert.className = `alert alert-${level} alert-dismissible fade show shadow-sm`;
|
||||
alert.setAttribute("role", "alert");
|
||||
const strong = document.createElement("strong");
|
||||
strong.textContent = `${code}: `;
|
||||
alert.append(strong, document.createTextNode(message));
|
||||
if (referenceId) {
|
||||
const reference = document.createElement("small");
|
||||
reference.className = "d-block mt-1";
|
||||
reference.textContent = `Reference: ${referenceId}`;
|
||||
alert.append(reference);
|
||||
}
|
||||
const close = document.createElement("button");
|
||||
close.type = "button";
|
||||
close.className = "btn-close";
|
||||
close.setAttribute("data-bs-dismiss", "alert");
|
||||
close.setAttribute("aria-label", "Close");
|
||||
alert.append(close);
|
||||
host.replaceChildren(alert);
|
||||
window.setTimeout(() => window.bootstrap?.Alert.getOrCreateInstance(alert).close(), 7000);
|
||||
}
|
||||
|
||||
function applyResult(result, originalApplicationId) {
|
||||
element("case_id").value = result.applicationId;
|
||||
if (element("mvcode")) element("mvcode").value = result.mvCode || "";
|
||||
if (Array.isArray(window.fields?.[0]) && Array.isArray(window.records?.[window.recpos])) {
|
||||
[["case_id", result.applicationId], ["mvcode", result.mvCode]].forEach(([name, fieldValue]) => {
|
||||
const index = window.fields[0].indexOf(name);
|
||||
if (index >= 0) window.records[window.recpos][index] = fieldValue;
|
||||
});
|
||||
}
|
||||
showAlert("success", "APP-2001", `Application ${result.mvCode || result.applicationId} saved successfully.`);
|
||||
if (originalApplicationId === 0 && typeof window.AddNewRecord === "function") window.AddNewRecord();
|
||||
else if (originalApplicationId > 0 && typeof window.findRecord === "function") window.findRecord(3);
|
||||
}
|
||||
|
||||
async function save(event) {
|
||||
event?.preventDefault();
|
||||
if (!validateForm()) return false;
|
||||
const button = element("btnsave");
|
||||
if (button?.disabled) return false;
|
||||
const details = collectCase();
|
||||
if (button) button.disabled = true;
|
||||
try {
|
||||
const envelope = await window.CygnusPayloadCrypto.encrypt(details, { keyUrl: API.key });
|
||||
const response = await fetch(API.save, { method: "POST", credentials: "same-origin",
|
||||
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
||||
body: JSON.stringify(envelope) });
|
||||
const body = await response.json().catch(() => null);
|
||||
if (!response.ok || !body?.success) throw body?.message || body || {};
|
||||
applyResult(body.data, details.applicationId);
|
||||
} catch (error) {
|
||||
showAlert("danger", error.code || "APP-5001",
|
||||
error.message || "Cygnus could not save the application details.", error.referenceId);
|
||||
} finally {
|
||||
if (button) button.disabled = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
window.CygnusInitiation = Object.freeze({ save });
|
||||
}(window, document));
|
||||
centerDivBoth("formcontainer","H");
|
||||
HideSections('rtv');
|
||||
HideSections('otv');
|
||||
HideSections('section');
|
||||
UnhideSections(viscontents,ColDelim);
|
||||
if (portField) {
|
||||
$(portField).val(port);
|
||||
}
|
||||
if(port>0)
|
||||
{
|
||||
if(document.getElementById("ajaxmsg") !== null)
|
||||
{
|
||||
CallMessage('1001AJX:warning:Another operation is being processed, please wait..',3000,200,300);
|
||||
return;
|
||||
}
|
||||
LoadingMsg("Fetching records, please wait...","ajaxmsg");
|
||||
RunAjax("GET","punchedrecs","val0="+port+"&val1="+($("#dynamicfields").val())+"&val2="+($("#uuid").val()),1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function GotoRecord(el,searchtype)
|
||||
{
|
||||
recno=el.value;
|
||||
if(recno!='')
|
||||
{
|
||||
if(searchtype == 'recno')
|
||||
{
|
||||
if(recno > recIndx || recno <=0)
|
||||
{
|
||||
CallMessage('1001IRNG:error:Invalid input. Out of range',3000,200,300);
|
||||
}
|
||||
else
|
||||
{
|
||||
recpos=recno-1;
|
||||
FillDetails(recpos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(index = 0; index < records.length; index++ )
|
||||
{
|
||||
if( records[index][4] === recno ) {
|
||||
recpos = index;
|
||||
FillDetails(recpos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function AddNewRecord()
|
||||
{
|
||||
if(recIndx== 0 || records[recIndx-1][0]!='0')
|
||||
{
|
||||
var cols=fields[0].length;
|
||||
recIndx = recIndx+1;
|
||||
recpos = recIndx-1;
|
||||
records[recpos]=new Array(cols);
|
||||
records[recpos][0]='0';
|
||||
records[recpos][1]=$("#portfolio_id").val();
|
||||
records[recpos][cols-4]='0';
|
||||
records[recpos][cols-3]=$("#company_id").val();
|
||||
records[recpos][cols-2]=$("#branch_id").val();
|
||||
records[recpos][cols-1]='';
|
||||
records[recpos][2]='******';
|
||||
}
|
||||
else
|
||||
{
|
||||
recpos=recIndx-1;
|
||||
}
|
||||
FillDetails(recpos);
|
||||
}
|
||||
function AfterResponse(response,oprID)
|
||||
{
|
||||
var rindx=0;
|
||||
if(oprID==1)
|
||||
{
|
||||
$("#ajaxmsg").remove();
|
||||
if(response.trim().search('Error')==-1)
|
||||
{
|
||||
var rows=response.split(RowDelim);
|
||||
for(rindx=0;rindx<rows.length-1;rindx++)
|
||||
{
|
||||
var cindx=0;
|
||||
var cols=rows[rindx].split(ColDelim);
|
||||
if(rindx==0)
|
||||
{
|
||||
fields[rindx]=new Array(cols.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
records[rindx-1]=new Array(cols.length);
|
||||
}
|
||||
for(cindx=0;cindx<cols.length;cindx++)
|
||||
{
|
||||
if(rindx==0)
|
||||
{
|
||||
fields[rindx][cindx]=cols[cindx];
|
||||
}
|
||||
else
|
||||
{
|
||||
records[rindx-1][cindx]=cols[cindx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
CallMessage(response,3000,200,300);
|
||||
}
|
||||
recIndx= rindx==0 ? rindx : rindx-1;
|
||||
$("#recfound").html("<b>( 0 / "+(recIndx==0 ? "0" : recIndx)+" )</b>");
|
||||
recpos=recIndx==0 ? 0 : recIndx-1;
|
||||
FillDetails(recpos);
|
||||
}
|
||||
else if(oprID==2)
|
||||
{
|
||||
collen=fields[0].length;
|
||||
$("#ajaxmsg").remove();
|
||||
if(response.trim().search('Error')==-1)
|
||||
{
|
||||
if(autocut==1)
|
||||
{
|
||||
records[recpos][collen-4]='1';
|
||||
}
|
||||
if($("#case_id").val()!='0')
|
||||
{
|
||||
findRecord(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
records[recpos][2]=response.split(ColDelim)[0];
|
||||
records[recpos][0]=response.split(ColDelim)[1];
|
||||
records[recpos][collen-1]=response.split(ColDelim)[2];
|
||||
AddNewRecord();
|
||||
}
|
||||
CallMessage('1001IRNG:info:Record updated successfully',3000,200,300);
|
||||
}
|
||||
else
|
||||
{
|
||||
records[recpos][collen-4]='-1';
|
||||
CallMessage(response,3000,200,300);
|
||||
}
|
||||
}
|
||||
else if(oprID==19 || oprID==20 || oprID==21 || oprID==22)
|
||||
{
|
||||
TabRows=response.split(RowDelim);
|
||||
for(indx=0;indx<TabRows.length-1;indx++)
|
||||
{
|
||||
if($("#portfolio_id").val()==81)
|
||||
{
|
||||
var appl = $("#applno").val();
|
||||
alert('Application number '+appl+' already exists.');
|
||||
appl= (appl.search('_1') < 0 ? appl+'_1' : appl.split('_')[0]+'_'+(parseInt(appl.split('_')[1])+1));
|
||||
$("#applno").val(appl);
|
||||
validate(document.getElementById('applno'),'t','AlphaNumeric');
|
||||
document.getElementById('applno').focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
TabCols=TabRows[indx].split(ColDelim);
|
||||
SameAddr[indx]=new Array(TabCols.length);
|
||||
for(cindx=0;cindx<TabCols.length;cindx++)
|
||||
{
|
||||
SameAddr[indx][cindx]=TabCols[cindx];
|
||||
}
|
||||
}
|
||||
}
|
||||
SelectAddr(oprID-19);
|
||||
}
|
||||
}
|
||||
function findRecord(arrOpr)
|
||||
{
|
||||
tempPos= recpos;
|
||||
maxLen= recIndx-1;
|
||||
if(arrOpr==1) tempPos=0;
|
||||
if(arrOpr==2)
|
||||
{
|
||||
if(tempPos>0) tempPos=tempPos-1;
|
||||
else return false;
|
||||
}
|
||||
if(arrOpr==3)
|
||||
{
|
||||
if(tempPos<maxLen) tempPos=tempPos+1;
|
||||
else return false;
|
||||
}
|
||||
if(arrOpr==4) tempPos=maxLen;
|
||||
recpos= tempPos;
|
||||
FillDetails(recpos);
|
||||
}
|
||||
function FillDetails(indx)
|
||||
{
|
||||
if(recIndx > 0)
|
||||
{
|
||||
document.forms['casedetails'].reset();
|
||||
$("#recfound").html("<b>( "+(indx+1)+" / "+(recIndx==0 ? "0" : recIndx)+" )</b>");
|
||||
var findx=0;
|
||||
for(findx=0;findx<fields[0].length;findx++)
|
||||
{
|
||||
if($("#"+fields[0][findx]).length > 0)
|
||||
{
|
||||
if(fields[0][findx]=='rv' || fields[0][findx]=='sradd' || fields[0][findx]=='rtv' ||
|
||||
fields[0][findx]=='ov' || fields[0][findx]=='soadd' || fields[0][findx]=='otv' || fields[0][findx]=='rco'
|
||||
|| fields[0][findx]=='pv' || fields[0][findx]=='rcp' || fields[0][findx]=='ocp' || fields[0][findx]=='spadd'|| fields[0][findx]=='refv'|| fields[0][findx]=='docv')
|
||||
{
|
||||
|
||||
if(fields[0][findx]=='docv')
|
||||
{
|
||||
if($("#"+fields[0][findx]).is(":visible"))
|
||||
{
|
||||
$("#"+fields[0][findx]).attr('checked',true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(records[indx][findx]=='1')
|
||||
{
|
||||
$("#"+fields[0][findx]).attr('checked',true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#"+fields[0][findx]).attr('checked',false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#"+fields[0][findx]).val(records[indx][findx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($("#status").val()=='1')
|
||||
{
|
||||
$("#btnsave").hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#btnsave").show();
|
||||
}
|
||||
FireClickEvents();
|
||||
document.getElementById("applno").focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
CallMessage('5005MQRY:error:No records found',3000,200,300);
|
||||
AddNewRecord();
|
||||
}
|
||||
}
|
||||
function FireClickEvents()
|
||||
{
|
||||
HandleClick(document.getElementById('rv'));
|
||||
HandleClick(document.getElementById('ov'));
|
||||
HandleClick(document.getElementById('rtv'));
|
||||
HandleClick(document.getElementById('otv'));
|
||||
HandleClick(document.getElementById('pv'));
|
||||
HandleClick(document.getElementById('refv'));
|
||||
}
|
||||
function FireToggleEvents()
|
||||
{
|
||||
ToggleChks((document.getElementById('rv').checked && document.getElementById('ov').checked),'rco'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('apptype').value.toUpperCase()!='APPLICANT' && document.getElementById('apptype').value.toUpperCase()!='-1'),'sradd!C0L!soadd!C0L!spadd!C0L!','!C0L!');
|
||||
ToggleChks((document.getElementById('rv').checked),'rcp'+ColDelim,ColDelim);
|
||||
ToggleChks((document.getElementById('ov').checked),'ocp'+ColDelim,ColDelim);
|
||||
}
|
||||
function HandleClick(el)
|
||||
{
|
||||
if(el.id=='rv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel2','raddr1,raddr2,raddr3,rlandmark,rcity,colr,rpincode','t,f,t,f,t,t,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,,SplInstruction,Pincode',document.getElementById('rtv').checked);
|
||||
EnableDisableFields(el.checked,'raddr1,raddr2,raddr3,rlandmark,colr,rpincode',',');
|
||||
}
|
||||
if(el.id=='rtv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel2','rphone','t','Phone',document.getElementById('rv').checked);
|
||||
}
|
||||
if(el.id=='ov')
|
||||
{
|
||||
setFormValidation(el,'FormPanel3','companyname,oaddr1,oaddr2,oaddr3,olandmark,ocity,colo,opincode,department,designation','f,t,f,t,f,t,t,f,f,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,SplInstruction,,SplInstruction,Pincode,SplInstruction,SplInstruction',document.getElementById('otv').checked);
|
||||
EnableDisableFields(el.checked,'oaddr1,oaddr2,oaddr3,olandmark,colo,opincode',',');
|
||||
}
|
||||
if(el.id=='rco')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('rco',1);
|
||||
}
|
||||
else
|
||||
{AutoFill('rco',0);}
|
||||
}
|
||||
if(el.id=='otv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel3','ophone','t','Phone',document.getElementById('ov').checked);
|
||||
}
|
||||
if(el.id=='pv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel4','paddr1,paddr2,paddr3,plandmark,pcity,colp,ppincode','t,f,t,f,t,t,f','SplInstruction,SplInstruction,SplInstruction,SplInstruction,,SplInstruction,Pincode',false);
|
||||
EnableDisableFields(el.checked,'paddr1,paddr2,paddr3,plandmark,colp,ppincode',',');
|
||||
if(!el.checked)
|
||||
{
|
||||
chkrcp=document.getElementById('rcp');
|
||||
chkrcp.checked=false;
|
||||
chkocp=document.getElementById('ocp');
|
||||
chkocp.checked=false;
|
||||
}
|
||||
}
|
||||
if(el.id=='rcp')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('rcp',1);
|
||||
chkocp=document.getElementById('ocp');
|
||||
chkocp.checked=false;
|
||||
chkprop=document.getElementById('pv');
|
||||
chkprop.checked=true;
|
||||
HandleClick(chkprop);
|
||||
}
|
||||
else
|
||||
{AutoFill('rcp',0);}
|
||||
}
|
||||
if(el.id=='ocp')
|
||||
{
|
||||
if(el.checked)
|
||||
{
|
||||
AutoFill('ocp',1);
|
||||
chkrcp=document.getElementById('rcp');
|
||||
chkrcp.checked=false;
|
||||
chkprop=document.getElementById('pv');
|
||||
chkprop.checked=true;
|
||||
HandleClick(chkprop);
|
||||
}
|
||||
else
|
||||
{AutoFill('ocp',0);}
|
||||
}
|
||||
if(el.id=='refv')
|
||||
{
|
||||
setFormValidation(el,'FormPanel5','refname1,refaddress1,refcontactno1','t,f,t','AlphaSpace,SplInstruction,Phone',false);
|
||||
}
|
||||
}
|
||||
function setFormValidation(Elem,FormPanel,ChildElems,IsRequired,Validation,CounterPartElem)
|
||||
{
|
||||
/*if(Elem.checked && !CounterPartElem)
|
||||
{
|
||||
hideForm(Elem.id, FormPanel);
|
||||
}
|
||||
if(!Elem.checked)
|
||||
{
|
||||
CheckForm(Elem,ChildElems,IsRequired,Validation);
|
||||
if(!CounterPartElem)
|
||||
{
|
||||
hideForm(Elem.id, FormPanel);
|
||||
}
|
||||
}*/
|
||||
|
||||
if(Elem.checked || CounterPartElem)
|
||||
{
|
||||
UnhideSections(FormPanel+ColDelim, ColDelim);
|
||||
}
|
||||
else
|
||||
{
|
||||
HideSections(FormPanel);
|
||||
}
|
||||
CheckForm(Elem,ChildElems,IsRequired,Validation);
|
||||
FireToggleEvents();
|
||||
}
|
||||
function CheckForm(Elem,ChildElems,IsRequired,Validation)
|
||||
{
|
||||
var Childs=ChildElems.split(",");
|
||||
var IsChildReq=IsRequired.split(",");
|
||||
var ValidString=Validation.split(",");
|
||||
for(Indx=0;Indx<Childs.length;Indx++)
|
||||
{
|
||||
validate(document.getElementById(Childs[Indx]),Elem.checked ? IsChildReq[Indx]:'f',ValidString[Indx]);
|
||||
}
|
||||
}
|
||||
function AutoFill(Opt,FillMode)
|
||||
{
|
||||
var SourceFields="";
|
||||
var TargetFields="";
|
||||
var isSameAdd=false;
|
||||
if(Opt=='rco')
|
||||
{
|
||||
SourceFields="raddr1"+ColDelim+"raddr2"+ColDelim+"raddr3"+ColDelim+"Rcolony"+ColDelim+"colr"+ColDelim+"rcity"+ColDelim+"rlandmark"+ColDelim+"rpincode"+ColDelim+"rphone";
|
||||
TargetFields="oaddr1"+ColDelim+"oaddr2"+ColDelim+"oaddr3"+ColDelim+"Ocolony"+ColDelim+"colo"+ColDelim+"ocity"+ColDelim+"olandmark"+ColDelim+"opincode"+ColDelim+"ophone";
|
||||
if(document.getElementById('Rcolony').value==document.getElementById('Ocolony').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
else if(Opt=='rcp')
|
||||
{
|
||||
SourceFields="raddr1"+ColDelim+"raddr2"+ColDelim+"raddr3"+ColDelim+"Rcolony"+ColDelim+"colr"+ColDelim+"rcity"+ColDelim+"rlandmark"+ColDelim+"rpincode";
|
||||
TargetFields="paddr1"+ColDelim+"paddr2"+ColDelim+"paddr3"+ColDelim+"Pcolony"+ColDelim+"colp"+ColDelim+"pcity"+ColDelim+"plandmark"+ColDelim+"ppincode";
|
||||
if(document.getElementById('Rcolony').value==document.getElementById('Pcolony').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
else if(Opt=='ocp')
|
||||
{
|
||||
SourceFields="oaddr1"+ColDelim+"oaddr2"+ColDelim+"oaddr3"+ColDelim+"Ocolony"+ColDelim+"colo"+ColDelim+"ocity"+ColDelim+"olandmark"+ColDelim+"opincode";
|
||||
TargetFields="paddr1"+ColDelim+"paddr2"+ColDelim+"paddr3"+ColDelim+"Pcolony"+ColDelim+"colp"+ColDelim+"pcity"+ColDelim+"plandmark"+ColDelim+"ppincode";
|
||||
if(document.getElementById('Ocolony').value==document.getElementById('Pcolony').value)
|
||||
{
|
||||
isSameAdd=true;
|
||||
}
|
||||
}
|
||||
if(FillMode==1)
|
||||
{
|
||||
CopyDetails(SourceFields,TargetFields);
|
||||
}
|
||||
else if(FillMode==0 && isSameAdd)
|
||||
{
|
||||
ClearDetails(TargetFields);
|
||||
}
|
||||
}
|
||||
function ToggleChks(IsVisible,ChildElems,Delim)
|
||||
{
|
||||
if(IsVisible)
|
||||
{
|
||||
UnhideSections(ChildElems,Delim);
|
||||
}
|
||||
else
|
||||
{
|
||||
var Childs=ChildElems.split(Delim);
|
||||
for(indx=0;indx<Childs.length-1;indx++)
|
||||
{
|
||||
HideSections(Childs[indx]);
|
||||
document.getElementById(Childs[indx]).checked=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ClearDetails(TargetFields)
|
||||
{
|
||||
if(TargetFields.length!=0)
|
||||
{
|
||||
var TargetList=TargetFields.split(ColDelim);
|
||||
if(TargetList.length==TargetList.length)
|
||||
{
|
||||
for(pos=0;pos<TargetList.length;pos++)
|
||||
{
|
||||
$("#"+TargetList[pos]).val("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function CopyDetails(SourceFields,TargetFields)
|
||||
{
|
||||
if(SourceFields.length!=0 && TargetFields.length!=0)
|
||||
{
|
||||
var SourceList=SourceFields.split(ColDelim);
|
||||
var TargetList=TargetFields.split(ColDelim);
|
||||
if(SourceList.length==TargetList.length)
|
||||
{
|
||||
for(pos=0;pos<SourceList.length;pos++)
|
||||
{
|
||||
$("#"+TargetList[pos]).val($("#"+SourceList[pos]).val());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function AfterOptSelect(ElemToRemove,OprID)
|
||||
{
|
||||
FillSameDet(selectedAddr, OprID);
|
||||
selectedAddr=-1;
|
||||
ElemToRemove.parentNode.removeChild(ElemToRemove);
|
||||
}
|
||||
function ShowAddrOptions(OprID)
|
||||
{
|
||||
var optDiv=document.createElement("div");
|
||||
var Addr="";
|
||||
optDiv.setAttribute("id","optDiv");
|
||||
optDiv.setAttribute("class","FormPanel");
|
||||
optDiv.setAttribute("style","font-family:Tahoma;overflow:visible");
|
||||
var OptionPanel="<div id='TablePanel' class='tableContainer'><table border='0' cellspacing='0' width='100%' id='cutlist'><thead class='thead'><tr title='Row Title'><td colspan='2'>Available Addresses</td></tr></thead><tbody class='scrollContent'>";
|
||||
for(indx=0;indx<SameAddr.length;indx++)
|
||||
{
|
||||
OptionPanel=OptionPanel+"<tr><td><input type='radio' name='rb1' id='rb"+indx+"' value='"+indx+"' onclick='selectedAddr=this.value;' /></td>";
|
||||
OptionPanel=OptionPanel+"<td style='padding-right:5px'>";
|
||||
for(cindx=0;cindx<4;cindx++)
|
||||
{
|
||||
Addr=Addr+" "+SameAddr[indx][cindx];
|
||||
}
|
||||
OptionPanel=OptionPanel+""+Addr+"</td></tr>";
|
||||
Addr="";
|
||||
}
|
||||
OptionPanel=OptionPanel+"<tr><td colspan='2'><input type='button' class='button' name='btnok' style='margin-top:5px;float:right' value='OK' id='btnok' accesskey='K' onclick=\"AfterOptSelect(document.getElementById('inptDialog'),"+OprID+");\"";
|
||||
OptionPanel=OptionPanel+"</tbody></table></div>";
|
||||
optDiv.innerHTML=OptionPanel;
|
||||
ShowInputDialog(optDiv,"Select Address","hint","inptDialog");
|
||||
document.getElementById('rb0').focus();
|
||||
}
|
||||
function FillSameDet(AddrIndex,OprID)
|
||||
{
|
||||
|
||||
if(!(AddrIndex < 0))
|
||||
{
|
||||
for(cindx=0;cindx<SameAddr[AddrIndex].length;cindx++)
|
||||
{
|
||||
$("#"+AddrElem[OprID][cindx+1]).val((SameAddr[AddrIndex][cindx]));
|
||||
}
|
||||
document.getElementById(FocusAfter).focus();
|
||||
ToggleChks((document.getElementById('apptype').value.toUpperCase()!='APPLICANT' && document.getElementById('apptype').value.toUpperCase()!='-1'),'sradd!C0L!soadd!C0L!spadd!C0L!','!C0L!');
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById(AddrElem[OprID][0]).focus();
|
||||
if(document.getElementById(AddrElem[OprID][0]).type=='checkbox'){document.getElementById(AddrElem[OprID][0]).checked=false;}
|
||||
}
|
||||
}
|
||||
function SelectAddr(OprID)
|
||||
{
|
||||
|
||||
if(SameAddr.length>1)
|
||||
{
|
||||
ShowAddrOptions(OprID);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillSameDet(0,OprID);
|
||||
}
|
||||
}
|
||||
function FindSameDet(Elm,Visit,focAfter)
|
||||
{
|
||||
if($("#case_id").val()!='0' && Visit=='A')
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
FocusAfter=focAfter;
|
||||
var procFlag=true;
|
||||
if(Elm.type=='checkbox')
|
||||
{
|
||||
procFlag=Elm.checked;
|
||||
}
|
||||
if(procFlag)
|
||||
{
|
||||
Applno=document.getElementById('applno').value;
|
||||
if(Applno.length==0)
|
||||
{
|
||||
if(Elm.type=='checkbox'){Elm.checked=false;}
|
||||
CallMessage('VLFRM:error:Please enter application number.',3000,200,300);
|
||||
document.getElementById('applno').focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SameAddr=new Array(0); // Empty Address Array
|
||||
oprId=(Visit=='R' ? 19:Visit=='O' ? 20:Visit=='P' ? 21:22);
|
||||
QryStr="val="+Applno+"&val1="+$("#portfolio_id").val()+"&val2="+oprId;
|
||||
RunAjax("GET","findsdet",QryStr,oprId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function FindStr(el,elmids,rstfld)
|
||||
{
|
||||
el.value=el.value.split('->')[0];
|
||||
var skey=el.value.trim().toUpperCase();
|
||||
if(skey!='UNKNOWN' && skey!='-1')
|
||||
{
|
||||
var elms=elmids.split(ColDelim);
|
||||
var indx=0;
|
||||
for(indx=0;indx<elms.length;indx++)
|
||||
{
|
||||
if($("#"+elms[indx]).val().toUpperCase().search(skey)>-1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function HandleBlur(el)
|
||||
{
|
||||
if(el.id=='rcity' || el.id=='ocity' || el.id=='pcity')
|
||||
{
|
||||
var pel= (el.id=='rcity' ? 'Rcolony':(el.id=='ocity' ? 'Ocolony':'Pcolony'));
|
||||
var cel= (el.id=='rcity' ? 'raddr':(el.id=='ocity' ? 'oaddr':'paddr'));
|
||||
var hel= (el.id=='rcity' ? 'colr':(el.id=='ocity' ? 'colo':'colp'));
|
||||
var chk= (el.id=='rcity' ? 'rv':(el.id=='ocity' ? 'ov':'pv'));
|
||||
if(!FindStr(el,cel+'2!C0L!'+cel+'3'))
|
||||
{
|
||||
CallMessage("1001AREA:error:Invalid area.", 3000, 200, 300);
|
||||
$(el).val("-1");
|
||||
$("#"+pel).val("");
|
||||
$("#"+hel).val("");
|
||||
}
|
||||
validate(el,document.getElementById(chk).checked ? 't':'f','');
|
||||
}
|
||||
if(el.id=='colr' || el.id=='colo' || el.id=='colp')
|
||||
{
|
||||
var pel= (el.id=='colr' ? 'rv':(el.id=='colo' ? 'ov':'pv'));
|
||||
var cel= (el.id=='colr' ? 'raddr':(el.id=='colo' ? 'oaddr':'paddr'));
|
||||
if(!FindStr(el,cel+'2!C0L!'+cel+'3'))
|
||||
{
|
||||
CallMessage("1001AREA:error:Invalid colony.", 3000, 200, 300);
|
||||
$(el).val("");
|
||||
}
|
||||
if(el.value=='')
|
||||
{
|
||||
document.getElementsByName(el.id+'_hidden')[0].value='';
|
||||
}
|
||||
if(document.getElementsByName(el.id+'_hidden')[0].value=='')
|
||||
{
|
||||
el.value='';
|
||||
}
|
||||
validate(el,document.getElementById(pel).checked ? 't':'f','SplInstruction');
|
||||
}
|
||||
}
|
||||
|
||||
78
cygnus-onprem-app/build/WebContent/js/lib/notifications.js
Normal file
78
cygnus-onprem-app/build/WebContent/js/lib/notifications.js
Normal file
@@ -0,0 +1,78 @@
|
||||
(function (window, document) {
|
||||
"use strict";
|
||||
|
||||
const DEFAULT_DURATION = 7000;
|
||||
const VALID_TYPES = new Set(["success", "info", "warning", "danger"]);
|
||||
|
||||
function getHost() {
|
||||
let host = document.getElementById("cygnus-notifications");
|
||||
if (!host) {
|
||||
host = document.createElement("div");
|
||||
host.id = "cygnus-notifications";
|
||||
host.className = "position-fixed top-0 start-50 translate-middle-x p-3";
|
||||
host.style.cssText = "z-index:1085;max-width:720px;width:calc(100% - 2rem)";
|
||||
host.setAttribute("aria-live", "polite");
|
||||
host.setAttribute("aria-atomic", "true");
|
||||
document.body.append(host);
|
||||
}
|
||||
return host;
|
||||
}
|
||||
|
||||
function dismiss(alert) {
|
||||
const bootstrapAlert = window.bootstrap?.Alert;
|
||||
if (bootstrapAlert) {
|
||||
bootstrapAlert.getOrCreateInstance(alert).close();
|
||||
} else {
|
||||
alert.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function show(options) {
|
||||
const settings = options || {};
|
||||
const type = VALID_TYPES.has(settings.type) ? settings.type : "info";
|
||||
const host = getHost();
|
||||
const alert = document.createElement("div");
|
||||
alert.className = `alert alert-${type} alert-dismissible fade show shadow-sm`;
|
||||
alert.setAttribute("role", type === "danger" ? "alert" : "status");
|
||||
|
||||
if (settings.code) {
|
||||
const code = document.createElement("strong");
|
||||
code.textContent = `${settings.code}: `;
|
||||
alert.append(code);
|
||||
}
|
||||
alert.append(document.createTextNode(settings.message || ""));
|
||||
|
||||
if (settings.referenceId) {
|
||||
const reference = document.createElement("small");
|
||||
reference.className = "d-block mt-1";
|
||||
reference.textContent = `Reference: ${settings.referenceId}`;
|
||||
alert.append(reference);
|
||||
}
|
||||
|
||||
if (settings.dismissible !== false) {
|
||||
const close = document.createElement("button");
|
||||
close.type = "button";
|
||||
close.className = "btn-close";
|
||||
close.setAttribute("aria-label", "Close");
|
||||
close.addEventListener("click", () => dismiss(alert));
|
||||
alert.append(close);
|
||||
}
|
||||
|
||||
if (settings.stack === true) host.append(alert);
|
||||
else host.replaceChildren(alert);
|
||||
|
||||
const duration = settings.duration === undefined ? DEFAULT_DURATION : settings.duration;
|
||||
if (Number.isFinite(duration) && duration > 0) {
|
||||
window.setTimeout(() => {
|
||||
if (alert.isConnected) dismiss(alert);
|
||||
}, duration);
|
||||
}
|
||||
return alert;
|
||||
}
|
||||
|
||||
function clear() {
|
||||
document.getElementById("cygnus-notifications")?.replaceChildren();
|
||||
}
|
||||
|
||||
window.CygnusNotifications = Object.freeze({ show, clear });
|
||||
}(window, document));
|
||||
Reference in New Issue
Block a user