NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Ext.ns('highradius.training.openInvoice');

//datatype ID from DB, it is always reserved and hardcoded
highradius.training.openInvoice.dataTypeId = 110055;

function resolveTrainingPath(URL) {
URL = '/RRDMSProject/training/' + URL;
return URL;
}

//form

highradius.training.sample.createLayoutDrivenForm = function(dataTypeId,getData){
var fields = dms.common.getFieldObject(1, dataTypeId);//gets all fields mapped for your datatypeId
var layoutArray = dms.common.getEditLayoutsList(388,dataTypeId,false); //gets all layouts mapped for your datatype id.
var page1 = Ext.create('Ext.panel.Panel', {
itemId: 'page1',
layout: 'anchor',
defaults: {
anchor: '100%',
width:'100%',
labelWidth: "100%",
style:{padding:'10px 10px 0px 10px'}
},
border:false,
items: []

});

var pages = [page1];

var hboxIV = {
itemId: 'HboxId',
layout: 'column',
cls: 'expand-panel',
border:false,
layoutConfig: {
align: 'stretch'
},
defaults: {
bodyStyle: 'padding:10px' ,
flex: 1
},
items: [{
border: true,
bodyStyle: 'border-color:#fff',
items: [page1]
}]

};

var maxLength = 0;
for (var i = 0; i < layoutArray.length; i++) {
if (layoutArray[i] == undefined) {
return;
}
var colLength = layoutArray[i].length;
if (colLength > maxLength) {
maxLength = colLength;
}
}

var formFieldspanel = Ext.create('Ext.form.Panel', {
standardSubmit: true,
frame: true,
monitorValid: true,
animCollapse: false,
border:false,
formBind:true,
layout:'anchor',
//defaults:{anchor:"100% 50%"},
scrollable:true,
buttonAlign: 'center',
autoScroll:true,
items: [hboxIV],
listeners: {

//Once the form panel get rendered on UI this listener gets invoked to render the associated fields.
afterrender: function (form) {
for ( var i = 0; i < layoutArray.length; i++) {
var fieldArray = dms.common.createFieldProperties(layoutArray[i]);//sets field properties like mandatory, editable,hidden or value fields etc
var planeFields = fieldArray[0];
var fieldProps = fieldArray[1];
var merchantAccountArray = dms.common.createDeatailsDisplayArray(planeFields,fields); //maps field type in java with type in js display
var details = [];
for(var j=0; j<planeFields.length;j++) {

// Iterate each field and read the properties of each field like
// mandatory, length, field type, not editable, etc ….

var fieldId = planeFields[j];
details = merchantAccountArray[j];
if(details != undefined) {
var props = fieldProps[fieldId];
var customFields = {
storeName : props.store,
valueField : props.valueField,
mode:'remote'
};
var isTimeFormatExists = props.isTimeFormatExists;
var isHelpEnabled=details[9];
if(details[3] == 'Date'){
details[3] = 'SimpleDate';
}else if(details[3] == 'SpecialValueField' || details[3] == 'SpecialAmountField'){
details[3] = 'TextField';
}else if(details[3] == 'CheckBoxCmp'){
customFields['toolTip']=details[5];
customFields['isHelpEnabled']=isHelpEnabled;
}
if(props.mandatory == true ){
details[1] = details[1]+'<span style="color:red;" ext:qtip="This field is required"> * </span>'; //mandatory show in UI
}


//The actual EXT JS form field component gets created to be rendered.
var comp = dms.common.createAndAddComponent(details[0],details[1],details[3],'', pages[i], "",dataTypeId,customFields, false,null,null,undefined);



if(props.mandatory == true ){
comp.allowBlank=false;
comp.regex = /^[^s]+(s+[^s]+)*$/;
}
if(getData != null)
{
//ADD CUSTOM CONDITIONS FOR YOUR FIELDS HERE
if(fieldId == 'appUrl'){
comp.setValue(getData.get('appUrl'));

}else if(fieldId == 'bulkExportLimit'){
comp.setValue(getData.get('bulkExportLimit'));
comp.setMinValue(0);

}
else if(fieldId == 'selectAllLimit'){
comp.setValue(getData.get('selectAllLimit'));
comp.setMinValue(0);

}
else if(fieldId == 'extJsDateFormat'){
comp.setValue(getData.get('extJsDateFormat'));
}
else if(fieldId == 'mlSupportPMTDI'){
comp.items.items[0].setWidth(90);
if(getData.get('mlSupportPMTDI') === true){
comp.items.items[0].setValue(true);
}
else{
comp.items.items[1].setValue(true);

}
// comp.setValue(getData.get('mlSupportPMTDI'));
}
else if(fieldId == 'elasticSearchEnabled'){
comp.items.items[0].setWidth(90);
if(getData.get('elasticSearchEnabled') === true){
comp.items.items[0].setValue(true);
}
else{
comp.items.items[1].setValue(true);

}
// comp.setValue(getData.get('mlSupportPMTDI'));
}
else if(fieldId == 'userToMultipleCustomersAssociation'){
comp.items.items[0].setWidth(90);
if(getData.get('userToMultipleCustomersAssociation') === true){
comp.items.items[0].setValue(true);
}
else{
comp.items.items[1].setValue(true);

}
}

else {
//comp.store.load();
comp.setValue(getData.get(fieldId));
comp.setWidth('100%');
}
}

comp.labelStyle = 'width:120px;padding-left:5px';

comp.labelStyle = 'width:148px;padding-left:5px;padding-right:5px';

fields.push(details);
}
}
}
}
},


//Buttons to be created here
buttons : [
{
itemId :'submitEmployeeDetails',
text : 'New',
formBind : true,
handler : function() {
var ischanged = true;
var form = this.up('form').getForm();

//put your ischanged logic here
if(ischanged){
var waitBox = Ext.MessageBox.wait('Please wait ...', 'Saving Employee Details');
var params = JSON.stringify(form.getValues());//converting to json
Ext.ComponentQuery.query('#submitEmployeeDetails')[0].disable();
//Form gets submitted here
Ext.Ajax.request( {
url : resolveTrainingPath('addNewInvoice.do'),//edit logic here in this action call
method : 'POST',
params:{
jsonData : params,//passing the data to be saved

// pkEmpId : pkId -- for update purpose
//pkInvoiceId : pkId;
},
success : function(result,request) {
waitBox.hide();
console.log("Getting success");
var responseText = Ext.util.JSON.decode(result.responseText);
if((responseText != undefined && responseText.msg != null && responseText.msg != undefined)){
if(responseText.msg=='Success')
Ext.example.msg('Status:',"Saved Successfully!!");
if(responseText.msg=='Failure')
Ext.example.msg('Status:',"Failed!!");
}
Ext.ComponentQuery.query('#newInvoiceWindow')[0].close();
highradius.training.openInvoice.employeeDetailsGridPanel.getStore().reload();
},
failure : function(result,request) {
waitBox.hide();
console.log("Getting success");
Ext.example.msg('Status','Failed');
Ext.ComponentQuery.query('#newInvoiceWindow')[0].close();
}
});
}
else
{
Ext.ComponentQuery.query('#newInvoiceWindow')[0].destroy();
highradius.training.sample.employeeDetailsGridPanel.getStore().reload();
Ext.example.msg('Status','No changes to update!!');
}
}
},
{
text :'Cancel',
handler : function() {
Ext.ComponentQuery.query('#newInvoiceWindow')[0].close();
}
}
]
});

return formFieldspanel;
}

//this function is called from DB
highradius.training.openInvoice.createView = function(attributes) {

var fields = dms.common.getFields(1, highradius.training.openInvoice.dataTypeId);
var extraFields = [];

console.log(fields);


// create Store
highradius.training.openInvoice.employeeDetailsGridStore = dms.common.createStore('invoiceDetails', resolveTrainingPath('getInvoice.do'), fields, extraFields, undefined, undefined, undefined, false, undefined, true);

var layoutsArray = dms.common.getLayoutsList(highradius.training.openInvoice.dataTypeId, false);
var employeeLayoutArray = dms.common.createLayoutArray(layoutsArray[0], fields);
var headerArray = layoutsArray[1].split(",");
highradius.training.openInvoice.savedSearchStore = dms.common.getSavedSearchStore(highradius.training.openInvoice.dataTypeId);

//create advance search panel
highradius.training.openInvoice.advancedSearchPanel = dms.advancedsearch.component.createAdvancedSearchComponent('invoiceDetailsSearch', employeeLayoutArray, resolveTrainingPath('getInvoice.do'), highradius.training.openInvoice.employeeDetailsGridStore, highradius.training.openInvoice.savedSearchStore, highradius.training.openInvoice.dataTypeId, null);
//create simple search panel
highradius.training.openInvoice.simpleSearchPanel = dms.simplesearch.component.createSimpleSearchComponent('invoiceDetailsSearch', resolveTrainingPath('getInvoice.do'), highradius.training.openInvoice.savedSearchStore, highradius.training.openInvoice.employeeDetailsGridStore, highradius.training.openInvoice.advancedSearchPanel, employeeLayoutArray, resolveTrainingPath('getInvoice.do'), highradius.training.openInvoice.dataTypeId, null, null, null, null, null, null);




// create Grid
highradius.training.openInvoice.employeeDetailsGridPanel = dms.grid.component.createGridComponent('invoiceDetailsGrid', 'invoiceDetailsGridPanel',
highradius.training.openInvoice.employeeDetailsGridStore,
fields, headerArray, '', '{}',
highradius.training.openInvoice.dataTypeId, null, undefined,
undefined, undefined, highradius.training.openInvoice.dataTypeId);


// create the main panel which is rendered as the view
highradius.training.openInvoice.namePanel = Ext.create('Ext.panel.Panel', {

// don't want content to crunch against the borders
bodyPadding : 5,
title : 'Invoice Details',

// all items which are to be displayed in the panel go here
items : [highradius.training.openInvoice.advancedSearchPanel,
highradius.training.openInvoice.simpleSearchPanel,
{
// create a field set to contain all form fields
xtype : 'fieldset',
title : 'Add area',
layout : {
type : 'hbox',
align : 'middle'
},
// all items within the fieldset go here
items : [{
xtype : 'button',
text : 'New',
actionIdentifier : "110055:1406178:Button",
tooltip: 'Add new invoice',
handler: function() {
Ext.create('Ext.window.Window', {
title : 'Add new invoice',
id: 'newInvoiceWindow',
height : 400,
scrollable : 'y',
width : 550,
items: [highradius.training.sample.createLayoutDrivenForm(highradius.training.openInvoice.dataTypeId, highradius.training.openInvoice.employeeDetailsGridPanel.getSelectionModel().getSelected().items[0])]
}).show();
}
}]},
// add grid panel after search area is complete
highradius.training.openInvoice.employeeDetailsGridPanel
]
})

// return the main panel, which will be rendered on the UI alongwith items it contains
return highradius.training.openInvoice.namePanel;


// highradius.training.OpenInvoice.namePanel = Ext.create('Ext.button.Button',{
// text: "New",
// actionIdentifier : "110054:1406178:newButton"
// })
// return highradius.training.OpenInvoice.namePanel;
};



     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.