Online note taking app - Notes.ionotes

Fast | Easy | Short

Online Note Services - notes.io

//JS file for Training tab -> Sample
//@author baidehi.ghosh


// namespace for the tab
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;
}

//_______________________________________________________________________________________________delete___________________________________________________________________________________

/*highradius.training.openInvoiceDelete.createLayoutDrivenForm = function(dataTypeId,getData){
console.log('hello');
Ext.create('Ext.window.Window', {
title: 'Delete Film',
height:200,
width:500,
html : '<center>Are you sure you want to delete selected tasks ?<center>',
bodyStyle: {
padding: '20px',
color:'red'
},
layout: 'vbox',
items:[
{
xtype: 'panel',
width:500,
border:0,
margin:'50 0 0 0',
items:[{xtype:'button',
margin:"20 0 20 100",
width:100,
text:'Confirm',
formBind:true,
listeners:{click:del},
},
{
xtype:'button',
width:100,
margin:"20 10 20 10",
text:'cancel',
handler : function(btn) {

Ext.Ajax.request( {
url : resolveTrainingPath('DeleteOpenInvoice.do'),//edit logic here in this action call
method : 'POST',
params:{

},
success : function(result,request) {
waitBox.hide();
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!!");
}
win.destroy();
highradius.training.openInvoice.employeeDetailsGridPanel.getStore().reload();
},
failure : function(result,request) {
waitBox.hide();
Ext.example.msg('Status','Failed');
win.destroy();
}
});
}
else
{
win.destroy();
highradius.training.openInvoice.employeeDetailsGridPanel.getStore().reload();
Ext.example.msg('Status','No changes to update!!');
}
}
}]
}]
}).show();
}

*/
var deletefun=function(){
console.log('hello');
Ext.create('Ext.window.Window', {
title: 'Delete Film',
height:200,
width:500,
html : '<center>Are you sure you want to delete selected tasks ?<center>',
bodyStyle: {
padding: '20px',
color:'red'
},
layout: 'vbox',
items:[
{
xtype: 'panel',
width:500,
border:0,
margin:'50 0 0 0',
items:[{xtype:'button',
margin:"20 0 20 100",
width:100,
text:'Confirm',
formBind:true,
handler: deleteInvoice
},
{
xtype:'button',
width:100,
margin:"20 10 20 10",
text:'cancel',
handler: function () { this.up('window').close(); }
}]
}]
}).show();
}

var deleteInvoice=function(){

var temp1=highradius.training.openInvoice.employeeDetailsGridPanel.getSelectionModel().getSelection();
var pkInvoiceId=temp1[0].data.pkInvoiceId;
for ( i = 1; i < temp1.length; i++) {
pkInvoiceId += ","+temp1[i].data.pkInvoiceId;
}


var waitBox = Ext.MessageBox.wait('Please wait ...', 'Delete data');
console.log(pkInvoiceId);




Ext.Ajax.request( {
url : resolveTrainingPath('deleteInvoice.do'),//edit logic here in this action call
method : 'POST',
params:{
invoiceId:pkInvoiceId

},
success : function(result,request) {
waitBox.hide();
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:',"Delete Successfully!!");
if(responseText.msg=='Failure')
Ext.example.msg('Status:',"Failed!!");
}

highradius.training.openInvoice.employeeDetailsGridPanel.getStore().reload();
},
failure : function(result,request) {
waitBox.hide();
Ext.example.msg('Status','Failed');

}
});
}
















highradius.training.openInvoice.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 :'submitInvoiceDetails',
text : 'Submit',
formBind : true,
handler : function(btn) {
var ischanged = true;
var win = btn.up('window'),
formpanel = win.down('form');
var pkInvoiceId;
if (getData === undefined) {
pkInvoice=null;

}else{
pkInvoiceId=getData.get("pkInvoiceId");
}




//pkId = getData.get('pkId');
//put your ischanged logic here
if(ischanged){
var waitBox = Ext.MessageBox.wait('Please wait ...', 'Saving Employee Details');
//var params = JSON.stringify(formpanel.getForm().getValues());//converting to json
var params = formpanel.getForm().getValues();
console.log(params);


Ext.ComponentQuery.query('#submitInvoiceDetails')[0].disable();


//Form gets submitted here
Ext.Ajax.request( {
url : resolveTrainingPath('saveOpenTrnInvoice.do'),//edit logic here in this action call
method : 'POST',
params:{
//jsonData : params,//passing the data to be saved
// pkEmpId : pkId -- for update purpose
invoiceNumber:params.invoiceNumber,
companyCode:params.companyCode,
fiscalYear:params.fiscalYear,
itemNumber:params.itemNumber,
invoiceTotalAmount:params.invoiceTotalAmount,
invoiceDueAmount:params.invoiceDueAmount,
invoiceCreatedDate:params.invoiceCreatedDate,
dueDate:params.dueDate,
discount1Percentage:params.discount1Percentage,
discount2Percentage:params.discount2Percentage,
discount3Percentage:params.discount3Percentage,
debitCreditIndicator:params.debitCreditIndicator,
customerName:params.customerName,
description:params.description,
invoiceType:params.invoiceType,
pkInvoiceId:pkInvoiceId,

},
success : function(result,request) {
waitBox.hide();
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!!");
}
win.destroy();
highradius.training.openInvoice.employeeDetailsGridPanel.getStore().reload();
},
failure : function(result,request) {
waitBox.hide();
Ext.example.msg('Status','Failed');
win.destroy();
}
});
}
else
{
win.destroy();
highradius.training.openInvoice.employeeDetailsGridPanel.getStore().reload();
Ext.example.msg('Status','No changes to update!!');
}
}
},
{
text :'Cancel',
handler : function() {
win.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 = [];

// create Store
highradius.training.openInvoice.employeeDetailsGridStore = dms.common.createStore('invoiceDetails',resolveTrainingPath('getOpenInvoiceDetails.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('getOpenInvoiceDetails.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('getOpenInvoiceDetails.do'),highradius.training.openInvoice.savedSearchStore,highradius.training.openInvoice.employeeDetailsGridStore,highradius.training.openInvoice.advancedSearchPanel,employeeLayoutArray,resolveTrainingPath('getOpenInvoiceDetails.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',
actionIndentifier: highradius.training.openInvoice.dataTypeId + ":" + attributes + ":createNewInvoice",
tooltip: 'Add new Invoice',
handler: function(){
// display a new window on click of New button.
Ext.create('Ext.window.Window',{
title: 'Add New Invoice',
id: 'newInvoiceWindow',
height: 325,
scrollable: 'y',
width: 325,
items : [highradius.training.openInvoice.createLayoutDrivenForm(highradius.training.openInvoice.dataTypeId,highradius.training.openInvoice.employeeDetailsGridPanel.getSelectionModel().getSelected().items[0])],

}).show();
},
margin:'10 10 10 10',
},
{
xtype : 'button',
text : 'Delete',
actionIndentifier: highradius.training.openInvoice.dataTypeId + ":" + attributes + ":deleteInvoice",
tooltip: 'Delete Invoice',
listeners: {
click: deletefun
},
margin:'10 10 10 10',

}]},
// 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;

};
     
 
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.