Commit 94813fd7 authored by Trushant's avatar Trushant

Committing jar

parent 53264261
package ibase.servlet;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.ParserConfigurationException;
import org.json.JSONObject;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import ibase.utility.BaseLogger;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
public class WelcomeMsgServlet extends HttpServlet{
//Added By Suraj on 18-11-2016 [ For Calendar Date format issue on server startup]Start
ServletContext servletContext = null;
ServletConfig servletConfig = null;
//Added By Suraj on 18-11-2016 [ For Calendar Date format issue on server startup]End
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException
{
//Added By Prajyot on 17MAY2013 [ As per Danish Sir for Russian Server Issue]
request.setCharacterEncoding( CommonConstants.ENCODING );
response.setContentType("application/x-www-form-urlencoded; charset="+CommonConstants.ENCODING);
BaseLogger.log("2",null,null,"inside doGet session 89");
response.setHeader("Access-Control-Allow-Origin","*");
response.setHeader("Access-Control-Allow-Headers","content-type,authorization");
response.setHeader("Access-Control-Allow-Credentials","true");
response.setHeader("Set-Cookie", "JSESSIONID="+request.getSession().getId()+"; HttpOnly; SameSite=none; secure");
request.getSession().setAttribute("NameInSession", "DANISH");
BaseLogger.log("2",null,null,"95 inside doGet session id :"+request.getSession().getId());
doPost( request, response );
}
public void doPost(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException
{
//Added By Prajyot on 17MAY2013 [ As per Danish Sir for Russian Server Issue]
//Added By Suraj on 14-11-2016 [To get servlet context object ]
servletConfig = getServletConfig();
servletContext = servletConfig.getServletContext();
request.setCharacterEncoding( CommonConstants.ENCODING );
response.setContentType("application/x-www-form-urlencoded; charset="+CommonConstants.ENCODING);
BaseLogger.log("2",null,null,"*** WelcomeMsgServlet Called ***");
String action = request.getParameter("action");
if("WELCOMEMSG".equals(action)){
ibase.utility.UserInfoBean usrInfo = ( ibase.utility.UserInfoBean )request.getSession().getAttribute( "USER_INFO" );
String welcomeMsg = "";
if(usrInfo != null)
{
//Add by Dnyaneshwar 28/DEC/2012 [Add new two values are emp. name & emp code ] Start
//welcomeMsg = usrInfo.getDesignation()+":"+usrInfo.getDivision()+":"+usrInfo.getSiteCode()+":"+usrInfo.getDateJoin();
welcomeMsg = usrInfo.getDesignation()+":"+usrInfo.getDivision()+":"+usrInfo.getSiteCode()+":"+usrInfo.getDateJoin()+":"+usrInfo.getEmpName()+":"+usrInfo.getEmpCode();
//Add by Dnyaneshwar 28/DEC/2012 [Add new two values are emp. name & emp code ] Start
}
//Added by Ajinkya Darvesh on 14/07/2017 [For passing session expired string to 500.html] [START]
else
{
//Changed by Sandeep S. on 19-JAN-17 [To check session exist or not for same user on same or on another machine] Start
//request.getSession().invalidate();
//Changed by Sandeep S. on 19-JAN-17 [To check session exist or not for same user on same or on another machine] End
//Changes made by Pratheek on 14-12-18[to show new descritpion and title of SESSION_EXPIRED on alert]-Start
//welcomeMsg="SESSION_EXPIRED";
welcomeMsg="Session Expired";
//Changes made by Pratheek on 14-12-18[to show new descritpion and title of SESSION_EXPIRED on alert]-End
}
//Added by Ajinkya Darvesh on 14/07/2017 [For passing session expired string to 500.html] [END]
OutputStream OutputString=response.getOutputStream();
OutputString.write(welcomeMsg.getBytes());
OutputString.flush();
OutputString.close();
}
//Added by Harshada 26th Nov 2012 [User connections on login]
else if("GETDISPLAYDETAILS".equalsIgnoreCase(action))
{
try
{
String dispDetails = getDisplayDetails(request);
PrintWriter writer = response.getWriter();
//Added by Dnyaneshwar Chavan on 24-OCT-13 [CO3ASUN005] [ Resolved the issue of when response in Russian language or etc. ] START
//response.setContentType("text/html");
response.setContentType( "text/html; charset="+CommonConstants.ENCODING );
//Added by Dnyaneshwar Chavan on 24-OCT-13 [CO3ASUN005] [ Resolved the issue of when response in Russian language or etc. ] END
writer.write( dispDetails );
writer.flush();
writer.close();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
}
//Added by Prajyot [W15HMIT002 - GPS_ENFORCED Implementation to pass CommonConstants params ] Start
else if("GET_SERVER_INFO".equalsIgnoreCase(action))
{
try
{
//Changed By Suraj on 14-11-2016 [ To set date formats from DateFormat.xml on server startup ]Start
BaseLogger.log("3",null,null,"APPL_DATE_FORMAT ["+CommonConstants.APPL_DATE_FORMAT+"] DISP_DATE_FORMAT ["+CommonConstants.DISP_DATE_FORMAT+"]");
JSONObject jsonObj = new JSONObject();
if( "".equals(CommonConstants.APPL_DATE_FORMAT) && this.servletContext != null )
{
CommonConstants.setAPPLICATION_CONTEXT(this.servletContext.getRealPath("/"));
//Commented by Sagar B. for Geo position related changes for multi tenancy on [11Jan18]
//jsonObj.put("GPS_ENABLED", CommonConstants.GEOPOS_ENABLE);
//jsonObj.put("GPS_ENFORCED", CommonConstants.GPS_ENFORCED);
jsonObj.put("APPL_DATE_FORMAT", CommonConstants.APPL_DATE_FORMAT);
jsonObj.put("DISP_DATE_FORMAT", CommonConstants.DISP_DATE_FORMAT);
jsonObj.put("APPL_DATETIME_FORMAT", CommonConstants.APPL_DATETIME_FORMAT);
jsonObj.put("DISP_DATETIME_FORMAT", CommonConstants.DISP_DATETIME_FORMAT);
// jsonObj.put("FRAMEWORK_VERSION", CommonConstants.FRAMEWORK_VERSION);
}
else
{
//Commented by Sagar B. for Geo position related changes for multi tenancy on [11Jan18]
//jsonObj.put("GPS_ENABLED", CommonConstants.GEOPOS_ENABLE);
//jsonObj.put("GPS_ENFORCED", CommonConstants.GPS_ENFORCED);
jsonObj.put("APPL_DATE_FORMAT", CommonConstants.APPL_DATE_FORMAT);
jsonObj.put("DISP_DATE_FORMAT", CommonConstants.DISP_DATE_FORMAT);
jsonObj.put("APPL_DATETIME_FORMAT", CommonConstants.APPL_DATETIME_FORMAT);
jsonObj.put("DISP_DATETIME_FORMAT", CommonConstants.DISP_DATETIME_FORMAT);
// jsonObj.put("FRAMEWORK_VERSION", CommonConstants.FRAMEWORK_VERSION);
}
//Changed By Suraj on 14-11-2016 [ To set date formats from DateFormat.xml on server startup ]End
BaseLogger.log("3",null,null,"jsonObj :==>" + jsonObj);
JSONObject respJSONObj = new JSONObject();
respJSONObj.put("SERVER_INFO", jsonObj);
BaseLogger.log("9",null,null,"respJSONObj :==>" + respJSONObj);
PrintWriter writer = response.getWriter();
response.setContentType( "text/plain; charset="+CommonConstants.ENCODING );
writer.write( respJSONObj.toString() );
writer.flush();
writer.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
//Added by Prajyot [W15HMIT002 - GPS_ENFORCED Implementation to pass CommonConstants params ] End
}
/**
* Gets "display-name" and "description"<br>
* from JbossHome/ibase.ear/META-INF/application.xml
*/
//Changes by Prajyot 09JAN2014 [Access displayName and description from application.xml] Start
private String getDisplayDetails(HttpServletRequest request) throws ParserConfigurationException, SAXException, IOException
{
String displayVal = "";
String dispNameTag = request.getParameter("displayName");
// String descTag = request.getParameter("description");
//
// String fileName = CommonConstants.APPLICATION_CONTEXT;
// String separator = System.getProperty("file.separator");
// String applFilePath = null;
//
// BaseLogger.log("9",null,null,"Called getDisplayValues():: " +fileName);
// if (fileName.contains(".war"))
// {
// int lastSeparatorIndex = fileName.lastIndexOf(separator + "ibase.war");
// if (lastSeparatorIndex == -1)
// {
// applFilePath = fileName;
// }
// else
// {
// applFilePath = fileName.substring(0, lastSeparatorIndex + 1) + "META-INF"+separator+"application.xml";
// }
// }
// BaseLogger.log("9",null,null,"Called getDisplayValues() from:: " + applFilePath);
// Document doc = null;
// File fXmlFile = new File(applFilePath);
// try
// {
// doc = new E12GenericUtility().parseFile(fXmlFile);
// NodeList applNodeList = doc.getElementsByTagName("application").item(0).getChildNodes();
// displayVal = getColumnValueFromNodeList(dispNameTag, applNodeList);
// BaseLogger.log("9",null,null,"display Details for user connections: " + dispNameTag + ":" + displayVal);
// displayVal = displayVal + "," + getColumnValueFromNodeList(descTag, applNodeList);;
// BaseLogger.log("9",null,null,"display Details for user connections: " + descTag + ":" + displayVal);
// }
// catch (Exception e)
// {
// BaseLogger.log("9",null,null,"Exception in parsing file: "+e.getMessage());
// e.printStackTrace();
// }
//Commented and Added by Sagar B. to show descr from enterprise table instead Application.xml in slide menu panel[18-Sep-18]START
try
{
ibase.utility.UserInfoBean usrInfo = ( ibase.utility.UserInfoBean )request.getSession().getAttribute( "USER_INFO" );
if( usrInfo != null )
{
if( E12GenericUtility.checkNull( usrInfo.getEnterpriseDescr() ).length() > 0 )
{
displayVal = dispNameTag + "," + E12GenericUtility.checkNull( usrInfo.getEnterpriseDescr() );
}
else
{
displayVal = dispNameTag + ", ";
}
BaseLogger.log("3",null,null,"displayVal::["+displayVal+"]");
}
}
catch (Exception e)
{
BaseLogger.log("0",null,null,"Exception in getDisplayDetails: "+e.getMessage());
}
//Commented and Added by Sagar B. to show descr from enterprise table instead Application.xml in slide menu panel[18-Sep-18]END
return displayVal;
}
private String getColumnValueFromNodeList( String colName, NodeList applNodeList )throws ITMException
{
String colValue = null;
try
{
int noOfChilds = applNodeList.getLength();
for(int colCtr = 0; colCtr < noOfChilds; colCtr++)
{
Node colNode = applNodeList.item(colCtr);
if(colNode != null && colNode.getNodeType() == Node.ELEMENT_NODE)
{
if(colNode.getNodeName().equals(colName))
{
if(colNode.getFirstChild() != null)
{
colValue = colNode.getFirstChild().getNodeValue();
}
else
{
colValue = colNode.getNodeValue();
}
break;
}
}
}
}
catch(Exception e)
{
throw new ITMException(e);
}
BaseLogger.log("2",null,null,"colValue[" + colValue + "]");
return colValue;
}
/*
private String getDisplayDetails(HttpServletRequest request) throws ParserConfigurationException, SAXException, IOException
{
String displayNameTag = request.getParameter("displayName");
String descTag = request.getParameter("description");
String displayVal = GenericUtility.getInstance().getDisplayValues(displayNameTag)+","+GenericUtility.getInstance().getDisplayValues(descTag);
return displayVal;
}
//END Harshada 26th Nov 2012 [User connections on login]
*/
//Changes by Prajyot 09JAN2014 [Access displayName and description from application.xml] Ends
}
/**
* Added on 03-12-20 new format itemCode
* @author Shrutika N
*
*/
var globalFormNo = "";
var globalGroupBoxId = "";
var globalDomId = "";
var globalAttributeJson = {};
var allFormValues = {};
var oldAttributeJson = {};
var oldAttributeArray = [];
function creteItemCode(groupBoxId, fieldName, id, label, formNo ,domId, applColour )
{
try
{
globalFormNo = formNo;
globalGroupBoxId = groupBoxId;
globalDomId = domId;
globalApplColour = applColour;
var feedHtml = drawFields(groupBoxId, fieldName, id, label, formNo ,domId,false);
setTimeout(() => {
drawOtherFields(groupBoxId, "item_type", "", "Item Type:", formNo ,domId, false );
drawOtherFields(groupBoxId, "item_type_descr", "", "Item Type Description:", formNo ,domId, true);
}, 1000);
return feedHtml;
}
catch (error)
{
console.log('Exception inside creteItemCode',error);
return "";
}
}
function drawOtherItemCodeFields(groupBoxId, fieldName, id, label, formNo ,domId )
{
console.log("drawOtherItemCodeFields...............33");
// drawOtherFields(groupBoxId, "item_type", "", "Item Type:", formNo ,domId, false );
//drawOtherFields(groupBoxId, "item_type_descr", "", "Item Type Description:", formNo ,domId, true);
}
function drawFields( groupBoxId, fieldName, id, label, formNo ,domId, isReadOnly )
{
try
{
var fieldId = "Detail"+formNo +"."+ domId +"."+fieldName;
var isPophelpField = window.parent.isPophelpField(fieldName);
var inputFieldId = "Detail"+formNo +"."+ domId +"."+fieldName +"_input";
globalAttributeJson[fieldName] = inputFieldId;
if( isPophelpField )
{
window.parent.getPopUpLabelForomJS(fieldId,formNo, label);
}
if( fieldName == "item_code" )
{
var html = "<table cellspacing='0' cellpadding='0'";
html = html + "class='horWizardTextPnl responsiveHoriPnlWidth' id='"+groupBoxId+"'>";
html = html + "<tbody>";
html = html + "<tr>";
html = html + "<td align='left' style='vertical-align: top;'>";
html = html + "<div style='display:flex;width:100%'>";
html = html + "<div class='e12CustomInputPanel' id='"+fieldName+"'";
html = html + "style='width:calc(97% - 36px);'>";
if( isReadOnly )
{
html = html + "<input style='width:calc(100% - 30px)' type='text' value=''" ;
html = html + " class='textReadOnly1 removeBorder textReadOnly1-readonly dsabled-field gwtTextFieldEditor gwt-field-groupbox' readonly ";
}
else
{
html = html + "<input style='width:calc(100% - 30px)' onblur=onBlurItemCodeFields(this); fieldName='"+fieldName+"' type='text' value=''" ;
html = html + " class='textBox1 responsivePnlWidth gwtTextFieldEditor fontstylewidget gwt-field-groupbox'";
}
html = html + "fieldid='"+fieldId+"' id='"+fieldId+"_input' format='TextBox'";
html = html + "groupboxid='"+groupBoxId+"' maxlength='120' required=''/>";
html = html + "<div ";
html = html + "class='label1 fontstylewidget gwtLabelflickerEditor gwt-label-groupbox'";
html = html + "id='"+fieldId+"_t' required=''>"+label+"</div>";
if( isPophelpField )
{
html = html + "<div";
html = html + " class='wizTransPophelpImg icon-pophelp pophelpTransactionEffect gwtPopUpTxtLabel'";
html = html + " onclick=window.parent.openPophelp(this); id='"+fieldId+"'>"
html = html + "</div>";
}
if( fieldName == "item_code")
{
}
html = html + "</div>";
html = html + "<div id='inserItemCodeImgIdDiv' onclick=insertItemCode(); class='addItemCodeDiv' >";
html = html + "<svg style='height: 20px;fill: "+globalApplColour+"' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg' "
html = html + " xmlns='http://www.w3.org/2000/svg' data-name='Layer 1' id='Layer_1' >"
html = html + "<title>add</title>"
html = html + "<path class='cls-1' d='M24,15a1,1,0,0,1-1,1H16v7a1,1,0,0,1-2,0V16H7a1,1,0,0,1,0-2h7V7a1,1,0,0,1,2,0v7h7A1,1,0,0,1,24,15Z'></path>"
html = html + "</svg>"
html = html + "</div>";
html = html + "</div>";
html = html + "</td>";
html = html + "</tr>";
html = html + "</tbody>";
html = html + "</table>";
}
else
{
var html = "<table cellspacing='0' cellpadding='0'";
html = html + "class='horWizardTextPnl responsiveHoriPnlWidth' id='"+groupBoxId+"'>";
html = html + "<tbody>";
html = html + "<tr>";
html = html + "<td align='left' style='vertical-align: top;'>";
html = html + "<div class='e12CustomInputPanel' id='"+fieldName+"'";
html = html + "style='position: relative; overflow: hidden; padding-left: 8px;width: calc(100% - 8px);'>";
if( isReadOnly )
{
html = html + "<input type='text' value=''" ;
html = html + " class='textReadOnly1 removeBorder textReadOnly1-readonly dsabled-field gwtTextFieldEditor gwt-field-groupbox' readonly ";
}
else
{
html = html + "<input onblur=onBlurItemCodeFields(this); fieldName='"+fieldName+"' type='text' value=''" ;
html = html + " class='textBox1 responsivePnlWidth gwtTextFieldEditor fontstylewidget gwt-field-groupbox'";
}
html = html + "fieldid='"+fieldId+"' id='"+fieldId+"_input' format='TextBox'";
html = html + "groupboxid='"+groupBoxId+"' maxlength='120' required=''/>";
html = html + "<div ";
html = html + "class='label1 fontstylewidget gwtLabelflickerEditor gwt-label-groupbox'";
html = html + "id='"+fieldId+"_t' required=''>"+label+"</div>";
if( isPophelpField )
{
html = html + "<div";
html = html + " class='wizTransPophelpImg icon-pophelp pophelpTransactionEffect gwtPopUpTxtLabel'";
html = html + " onclick=window.parent.openPophelp(this); id='"+fieldId+"'>"
html = html + "</div>";
}
if( fieldName == "item_code")
{
html = html + "<div id='inserItemCodeImgIdDiv' onclick=insertItemCode(); class='addItemCodeDiv' >";
html = html + "<svg style='height: 20px;fill: "+globalApplColour+"' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg' "
html = html + " xmlns='http://www.w3.org/2000/svg' data-name='Layer 1' id='Layer_1' >"
html = html + "<title>add</title>"
html = html + "<path class='cls-1' d='M24,15a1,1,0,0,1-1,1H16v7a1,1,0,0,1-2,0V16H7a1,1,0,0,1,0-2h7V7a1,1,0,0,1,2,0v7h7A1,1,0,0,1,24,15Z'></path>"
html = html + "</svg>"
html = html + "</div>";
}
html = html + "</div>";
html = html + "</td>";
html = html + "</tr>";
html = html + "</tbody>";
html = html + "</table>";
}
return html;
}
catch (error)
{
console.log('Exception inside drawFields',error);
return "";
}
}
function onBlurItemCodeFields(event)
{
var previousValue = window.parent.getFldData(event.getAttribute("fieldId"));
window.parent.setFldData(event.getAttribute("fieldId"), event.value);
allFormValues[event.id] = event.value;
console.log('inside onBlurItemCodeFields........178 previousValue',previousValue);
console.log('inside onBlurItemCodeFields........180 currentValue',event.value);
if( (previousValue != event.value) || ( previousValue == event.value && window.parent.geSetFromPophelp() ) )
{
window.parent.setDataSetFromPophelp("false");
if( event.getAttribute("fieldName") == "item_type")
{
var JSONObj = {};
JSONObj['item_type'] = event.value;
JSONObj['focusColumn'] = "item_type";
var itemCodeInputId = "Detail"+globalFormNo+"."+globalDomId+"."+"item_code_input";
var itemCodeField = document.getElementById(itemCodeInputId);
$.ajax({
type: 'GET',
url: '/ibase/rest/ItemCodeService/getdataattributes',
// data: strJSON,
data: { "jsonitem" : JSON.stringify(JSONObj) },
dataType : 'text',
success: function (data) {
// alert("Success getDataAttribute");
console.log('inside ItemCode.......105',data);
var jsonData = JSON.parse(data);
oldAttributeArray = oldAttributeJson[event.getAttribute("fieldId")];
if( oldAttributeArray != null )
{
console.log('inside ItemCode.......109',oldAttributeArray.length);
for (var i = 0; i < oldAttributeArray.length; i++)
{
console.log('inside ItemCode.......113',oldAttributeArray[i]);
var oldAttribute = document.getElementById(oldAttributeArray[i]);
if( oldAttribute != null )
{
oldAttribute.remove();
}
}
}
drawAttributeFields(jsonData,event.getAttribute("fieldId"));
},
error: function (data) {
alert("Faild getDataAttribute");
}
});
}
else if( event.getAttribute("fieldName") == "item_code")
{
var JSONObj = {};
JSONObj['item_code'] = event.value;
JSONObj['focusColumn'] = "item_code";
var itemCodeInputId = "Detail"+globalFormNo+"."+globalDomId+"."+"item_code_input";
$.ajax({
type: 'GET',
url: '/ibase/rest/ItemCodeService/getdataattributes',
data: { "jsonitem" : JSON.stringify(JSONObj) },
dataType : 'text',
success: function (data) {
console.log('inside ItemCode.......105',data);
var jsonData = JSON.parse(data);
oldAttributeArray = oldAttributeJson[event.getAttribute("fieldId")];
if( oldAttributeArray != null )
{
console.log('inside ItemCode.......298',oldAttributeArray.length);
for (var i = 0; i < oldAttributeArray.length; i++)
{
var oldAttribute = document.getElementById(oldAttributeArray[i]);
if( oldAttribute != null )
{
oldAttribute.remove();
}
}
}
drawAttributeFields(jsonData,event.getAttribute("fieldId"));
},
error: function (data) {
alert("Faild getDataAttribute");
}
});
}
}
}
function drawAttributeFields(jsonData, fieldId )
{
try
{
oldAttributeArray = [];
for (var key of Object.keys(jsonData))
{
if( key == "item_type_descr" || key == "item_type")
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+"."+key+"_input";
var labelId = "Detail"+globalFormNo+"."+globalDomId+"."+key+"_t";
if( document.getElementById(inputId) != null )
{
document.getElementById(inputId).value = jsonData[key];
globalAttributeJson[inputId] = document.getElementById(inputId).value;
console.log("Call setFieldData......283");
var id = "Detail"+globalFormNo+"."+globalDomId+"."+key;
window.parent.setFldData(id, jsonData[key]);
allFormValues[inputId] = jsonData[key];
var label = document.getElementById(labelId);
label.classList.add("labelflickerFixPosition");
}
}
else if( key == "descr")
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+"."+key;
var labelId = "Detail"+globalFormNo+"."+globalDomId+"."+key+"_t";
if( document.getElementById(inputId) != null )
{
document.getElementById(inputId).value = jsonData[key];
globalAttributeJson[inputId] = document.getElementById(inputId).value;
window.parent.setFldData(inputId, jsonData[key]);
var label = document.getElementById(labelId);
label.classList.add("labelflickerFixPosition");
}
}
else if( key != "no_of_attributes" && key.includes("phy_attrib_") )
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+"."+jsonData[key]+"_input";
if( document.getElementById(inputId) == null )
{
var feedHtml = drawAttributes(globalGroupBoxId, jsonData[key], "", jsonData[key], globalFormNo ,globalDomId , key, "");
}
}
else if( key != "no_of_attributes")
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+"."+key+"_input";
var labelId = "Detail"+globalFormNo+"."+globalDomId+"."+key+"_t";
if( document.getElementById(inputId) == null )
{
console.log('inside itemcode.js file......325',key);
var feedHtml = drawAttributes(globalGroupBoxId, key, "", key, globalFormNo ,globalDomId , key, jsonData[key]);
}
else
{
console.log('inside itemcode.js file......330',key);
document.getElementById(inputId).value = jsonData[key];
globalAttributeJson[key] = document.getElementById(inputId).value;
var label = document.getElementById(labelId);
label.classList.add("labelflickerFixPosition");
}
}
else
{
globalAttributeJson[key] = jsonData[key];
}
}
if( jsonData['descr'] != null )
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+".descr";
var labelId = "Detail"+globalFormNo+"."+globalDomId+".descr_t";
if( document.getElementById(inputId) != null )
{
document.getElementById(inputId).value = jsonData['descr'];
globalAttributeJson[inputId] = document.getElementById(inputId).value;
window.parent.setFldData(inputId, jsonData['descr']);
var label = document.getElementById(labelId);
label.classList.add("labelflickerFixPosition");
}
}
for (var fieldKey of Object.keys(allFormValues))
{
var currentField = document.getElementById(fieldKey);
if( currentField != null )
{
console.log('inside allFormValues.............157', allFormValues[fieldKey])
currentField.value = allFormValues[fieldKey];
}
}
oldAttributeJson[fieldId] = oldAttributeArray;
}
catch (error)
{
console.log('Exception inside drawFields',error);
}
}
function drawAttributes( groupBoxId, fieldName, id, label, formNo ,domId, attributeKey, fieldValue )
{
try
{
var fieldId = "Detail"+formNo +"."+ domId +"."+fieldName;
var isPophelpField = window.parent.isPophelpField(fieldName);
var inputId = "Detail"+formNo+"."+domId+"."+fieldName+"_input";
var tableID = "AtributTable_"+fieldId;
oldAttributeArray.push(tableID);
if( attributeKey.includes("phy_attrib_") )
{
globalAttributeJson[label] = inputId;
}
else
{
globalAttributeJson[attributeKey] = inputId;
}
if( isPophelpField )
{
window.parent.getPopUpLabelForomJS(fieldId,formNo, label);
}
var html = "<table attricellspacing='0' cellpadding='0'";
html = html + "class='horWizardTextPnl responsiveHoriPnlWidth' id='"+tableID+"'>";
html = html + "<tbody>";
html = html + "<tr>";
html = html + "<td align='left' style='vertical-align: top;'>";
html = html + "<div class='e12CustomInputPanel' id='"+fieldName+"'";
html = html + "style='position: relative; overflow: hidden; padding-left: 8px;width: calc(100% - 8px);'>";
html = html + "<input onblur=onBlurAttributeFields(this); type='text' value='"+fieldValue+"'" ;
html = html + "class='textBox1 responsivePnlWidth gwtTextFieldEditor fontstylewidget gwt-field-groupbox'";
html = html + "fieldid='"+fieldId+"' id='"+fieldId+"_input' format='TextBox'";
html = html + "groupboxid='"+groupBoxId+"' maxlength='120' required=''/>";
html = html + "<div ";
html = html + "class='label1 fontstylewidget gwtLabelflickerEditor gwt-label-groupbox'";
html = html + "id='"+fieldId+"_t' required=''>"+label+"</div>";
if( isPophelpField )
{
html = html + "<div";
html = html + " class='wizTransPophelpImg icon-pophelp pophelpTransactionEffect gwtPopUpTxtLabel'";
html = html + " onclick=window.parent.openPophelp(this); id='"+fieldId+"'>"
html = html + "</div>";
}
html = html + "</div>";
html = html + "</td>";
html = html + "</tr>";
html = html + "</tbody>";
html = html + "</table>";
var id = "Detail"+globalFormNo+"."+""+globalDomId+"."+"item_code_flowPanel";
var flowPnl = document.getElementById(id);
if( flowPnl != null && flowPnl.parentElement != null )
{
console.log('inide drawOtherFields...........559');
flowPnl.parentElement.innerHTML += html;
console.log('inide drawOtherFields...........561',flowPnl);
}
window.parent.setFldData(fieldId, fieldValue);
return html;
}
catch (error)
{
console.log('Exception inside drawAttributeFields',error);
return "";
}
}
function onBlurAttributeFields(event)
{
window.parent.setFldData(event.getAttribute("fieldId"), event.value);
var JSONObj = {};
var isAttributeBlank = false;
for (var key of Object.keys(globalAttributeJson))
{
if( key == "no_of_attributes" )
{
JSONObj[key] = globalAttributeJson[key];
}
else
{
console.log("Title ItemCodeBlur.........208["+globalAttributeJson[key]+"]]");
var inputId = globalAttributeJson[key];
if( document.getElementById(inputId) != null )
{
var value = document.getElementById(inputId).value;
JSONObj[key] = value;
console.log("Title ItemCodeBlur.........value["+value+"]]");
console.log("Title ItemCodeBlur.........key["+key+"]]");
console.log("Title ItemCodeBlur.........key.includes["+key.includes("phy_attrib_")+"]]");
//if( key.includes("phy_attrib_") && value.trim() == "" )
if( key != "item_code" && key != "descr" && value.trim() == "" )
{
isAttributeBlank = true;
}
}
}
}
if( !isAttributeBlank )
{
$.ajax({
type: 'GET',
url: '/ibase/rest/ItemCodeService/getdataitemcode',
data: { "attributeitem" : JSON.stringify(JSONObj) },
dataType: 'text',
success: function (data) {
//alert("Success getdataitemcode");
console.log('inside getdataitemcode sucess.......271',data);
var jsonData = JSON.parse(data);
for (var fieldName of Object.keys(jsonData))
{
if( fieldName == "item_code" )
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+"."+fieldName+"_input";
var currentFieldEle = document.getElementById(inputId);
if( currentFieldEle != null )
{
currentFieldEle.value = jsonData[fieldName];
}
}
else if( fieldName == "descr" )
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+"."+fieldName;
var currentFieldEle = document.getElementById(inputId);
if( currentFieldEle != null )
{
currentFieldEle.value = jsonData[fieldName];
var label = document.getElementById(inputId+"_t");
label.classList.add("labelflickerFixPosition");
}
}
}
},
error: function (data) {
alert("Fail webservice");
}
});
}
}
function insertItemCode()
{
var JSONObj = {};
for (var key of Object.keys(globalAttributeJson))
{
if( key == "no_of_attributes" )
{
JSONObj[key] = globalAttributeJson[key];
}
else
{
var inputId = globalAttributeJson[key];
if( document.getElementById(inputId) != null )
{
var value = document.getElementById(inputId).value;
JSONObj[key] = value;
}
}
}
$.ajax({
type: 'GET',
url: '/ibase/rest/ItemCodeService/insertitemcode',
data: { "jsonitem" : JSON.stringify(JSONObj) },
dataType: 'text',
success: function (data) {
//alert("Success getdataitemcode");
console.log('inside insertItemCode sucess.......340',data);
var jsonData = JSON.parse(data);
for (var fieldName of Object.keys(jsonData))
{
if( fieldName == "item_code" )
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+"."+fieldName+"_input";
var currentFieldEle = document.getElementById(inputId);
if( currentFieldEle != null )
{
currentFieldEle.value = jsonData[fieldName];
}
}
else if( fieldName == "descr" )
{
var inputId = "Detail"+globalFormNo+"."+globalDomId+"."+fieldName;
var currentFieldEle = document.getElementById(inputId);
if( currentFieldEle != null )
{
currentFieldEle.value = jsonData[fieldName];
var label = document.getElementById(inputId+"_t");
label.classList.add("labelflickerFixPosition");
}
}
}
},
error: function (data) {
alert("Fail insertItemCode webservice");
}
});
}
function drawOtherFields( groupBoxId, fieldName, id, label, formNo ,domId, isReadOnly )
{
var fieldId = "Detail"+formNo +"."+ domId +"."+fieldName;
var isPophelpField = window.parent.isPophelpField(fieldName);
var inputFieldId = "Detail"+formNo +"."+ domId +"."+fieldName +"_input";
globalAttributeJson[fieldName] = inputFieldId;
if( isPophelpField )
{
window.parent.getPopUpLabelForomJS(fieldId,formNo, label);
}
var flowPnlId = fieldId + "_flowPanel";
var html = "<div class='fieldFormFlowPanel' id='"+flowPnlId+"'>";
html = html + "<table cellspacing='0' cellpadding='0'";
html = html + "class='horWizardTextPnl responsiveHoriPnlWidth' id='"+groupBoxId+"'>";
html = html + "<tbody>";
html = html + "<tr>";
html = html + "<td align='left' style='vertical-align: top;'>";
html = html + "<div class='e12CustomInputPanel' id='"+fieldName+"'";
html = html + "style='position: relative; overflow: hidden; padding-left: 8px;width: calc(100% - 8px);'>";
if( isReadOnly )
{
html = html + "<input type='text' value=''" ;
html = html + " class='textReadOnly1 removeBorder textReadOnly1-readonly dsabled-field gwtTextFieldEditor gwt-field-groupbox' readonly ";
}
else
{
html = html + "<input onblur=onBlurItemCodeFields(this); fieldName='"+fieldName+"' type='text' value=''" ;
html = html + " class='textBox1 responsivePnlWidth gwtTextFieldEditor fontstylewidget gwt-field-groupbox'";
}
html = html + "fieldid='"+fieldId+"' id='"+fieldId+"_input' format='TextBox'";
html = html + "groupboxid='"+groupBoxId+"' maxlength='120' required=''/>";
html = html + "<div ";
html = html + "class='label1 fontstylewidget gwtLabelflickerEditor gwt-label-groupbox'";
html = html + "id='"+fieldId+"_t' required=''>"+label+"</div>";
if( isPophelpField )
{
html = html + "<div";
html = html + " class='wizTransPophelpImg icon-pophelp pophelpTransactionEffect gwtPopUpTxtLabel'";
html = html + " onclick=window.parent.openPophelp(this); id='"+fieldId+"'>"
html = html + "</div>";
}
if( fieldName == "item_code")
{
html = html + "<div id='inserItemCodeImgIdDiv' onclick=insertItemCode(); class='addItemCodeDiv' >";
html = html + " <img id='inserItemCodeImgId' src='images/addItem.svg' onclick=insertItemCode(); class='insertItemCodeIcon svg-red' >"
html = html + "</div>";
}
html = html + "</div>";
html = html + "</td>";
html = html + "</tr>";
html = html + "</tbody>";
html = html + "</table>";
html = html + "</div>";
var mainPanleId = "Detail"+formNo +"."+ domId +"."+"item_code_flowPanel";
var flowPnl = document.getElementById(mainPanleId);
if( flowPnl != null && flowPnl.parentElement != null )
{
flowPnl.parentElement.innerHTML += html;
}
}
function removeItemCodeFormatMap()
{
globalAttributeJson = {};
allFormValues = {};
oldAttributeJson = {};
oldAttributeArray = [];
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment