NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Ext.ns('cms.collections.configure.invoice.parameters');

var adminCollectionconfigureinvoiceparamPanel = 'cmscollectionsconfigureinvoiceparametersinvoiceparametersTabPanel';
var configureinvoiceparametersTabPanel;
var selectedconfigureInvoiceParametersTypeId;
var addconfigureInvoiceParametersType = 'Add';
var editconfigureInvoiceParametersType = 'Update';
var deleteconfigureInvoiceParametersType = 'Delete';
var storeValueCount = 0;
cms.collections.configure.invoice.parameters.grid = null;

//==================================== Actions Grid fields ===========================



cms.collections.configure.invoice.parameters.fieldsArray = [
['pkCmsTagCategory', 'Category Id', 'int'],
['fkCategoryType.name', 'Field Type', 'string'],
['name', 'Parameter Name', 'string'],
['description', 'Description', 'string']];
cms.collections.configure.invoice.parameters.headerArray = [];
var accountLanguages = cms.common.init.getLanguagesMappedToAccount();
var temp = accountLanguages.rows;
cms.collections.configure.invoice.parameters.accountLanguages = temp;
var winWidth = 0.25 + (cms.collections.configure.invoice.parameters.accountLanguages.length * 0.1);
winWidth += (3 * cms.collections.configure.invoice.parameters.accountLanguages.length / 100);



Ext.each(cms.collections.configure.invoice.parameters.accountLanguages, function(item) {
var language = item.split('::');
languageCode = language[2];
languageName = language[1];
if (languageCode != "-1") {
temp = ['cmsTagCategoryLang.' + languageCode, languageName + ' Display Name', 'string'];
console.log(languageCode);
console.log(languageName);
cms.collections.configure.invoice.parameters.fieldsArray.push(temp);

}

//cms.collections.configure.invoice.parameters.headerArray.push(cmsTagCategoryLang.' + languageCode);
});

cms.collections.configure.invoice.parameters.fieldsArray.push(['createUser', 'Create User', 'string']);
cms.collections.configure.invoice.parameters.fieldsArray.push(['createTime', 'Create Time', 'string']);
cms.collections.configure.invoice.parameters.fieldsArray.push(['updateUser', 'Update User', 'string']);
cms.collections.configure.invoice.parameters.fieldsArray.push(['updateTime', 'Update Time', 'string']);

var headerMap = {};
for (var i = 1; i < cms.collections.configure.invoice.parameters.fieldsArray.length; i++) {
var iArray = cms.collections.configure.invoice.parameters.fieldsArray[i];
console.log(iArray[0]);
console.log(iArray[1]);
headerMap[iArray[0]] = iArray[1];
}

for (let x in headerMap) {
cms.collections.configure.invoice.parameters.headerArray.push(x);
}
console.log(cms.collections.configure.invoice.parameters.headerArray);

// cms.collections.configure.invoice.parameters.fieldsArray = cms.collections.configure.invoice.parameters.fieldsArray.concat(fields);




//console.log(cms.collections.configure.invoice.parameters.fieldsArray);


// var filterMap = {};
// var rs = new Array();
// var gridConfig = {
// filters: filterMap,
// renderers: rs,
// singleSelect: false,
// //remote:false
// };

var invoiceParamTabPanel;
cms.collections.configure.invoice.parameters.invoiceparametersTabPanel = function(attributes) {
var gridConfig = {
singleSelect: false
};


cms.collections.configure.invoice.parameters.store = dms.common.createStore('pkCmsTagCategory', resolveCMSPath('getLanguageSpecificTagDetails.do'), cms.collections.configure.invoice.parameters.fieldsArray, null, null, null, true, true, null, true);

var my_store=Ext.create('Ext.data.Store', {
data: [
{pkCmsTagCategory:'154',"fkCategoryType.name":'Editablefield',name:'dunningblock',description:'damaged',"cmsTagCategoryLang.hi": "परीक्षण", "cmsTagCategoryLang.en": "Testxyz", "cmsTagCategoryLang.th": "bhsdhs", "cmsTagCategoryLang.fr": "gvdvchc", "cmsTagCategoryLang.tc": "hsbhbvhhv"},
// {pkCmsTagCategory:'155',shortName:{-1:"shortname2",1:"hindi shortnam2e"},reasonCode:"english shortname2",description_E:"english description2",description:{-1:"eng_description2",1:"hindi description2"}}
]
});
console.log(my_store);
// ============================= Invoice Parameters Grid =======================================
var buttonsArrayEmpty = [];

/* var headerMap = {};
for (var i = 0; i < cms.collections.configure.invoice.parameters.fieldsArray.length; i++) {
var iArray = cms.collections.configure.invoice.parameters.fieldsArray[i];
headerMap[iArray[0]] = iArray[1];

}*/
console.log(headerMap);
console.log(cms.collections.configure.invoice.parameters.fieldsArray);

cms.collections.configure.invoice.parameters.grid = dms.grid.component.createGridComponent('Count ', 'uniqueId', my_store, cms.collections.configure.invoice.parameters.fieldsArray, cms.collections.configure.invoice.parameters.headerArray, buttonsArrayEmpty, '{}', null);
cms.collections.configure.invoice.parameters.grid.addPlugin('PagingSelectionPersistence');
cms.collections.configure.invoice.parameters.grid.getSelectionModel().on('select', function() {

var getData = cms.collections.configure.invoice.parameters.grid.getPlugin('PagingSelectionPersistence').getPersistedSelection()[0];
var length = cms.collections.configure.invoice.parameters.grid.getPlugin('PagingSelectionPersistence').getPersistedSelection().length;
if (length == 0) {
Ext.ComponentQuery.query(">#editInvoiceParamButton")[0].disable();
Ext.ComponentQuery.query(">#deleteInvoiceParamButton")[0].disable();
Ext.ComponentQuery.query(">#addInvoiceParamButton")[0].enable();
}
if (length == 1) {
Ext.ComponentQuery.query('>#editInvoiceParamButton')[0].enable();
Ext.ComponentQuery.query('>#deleteInvoiceParamButton')[0].enable();
Ext.ComponentQuery.query('>#addInvoiceParamButton')[0].disable();
}
if (length > 1) {
Ext.ComponentQuery.query('>#addInvoiceParamButton')[0].disable();
Ext.ComponentQuery.query(">#editInvoiceParamButton")[0].disable();
Ext.ComponentQuery.query(">#deleteInvoiceParamButton")[0].enable();
}
selectedReasonId = getData.data['pkCmsTagCategory'];

});

cms.collections.configure.invoice.parameters.grid.getSelectionModel().on('deselect', function() {

var getData = cms.collections.configure.invoice.parameters.grid.getPlugin('PagingSelectionPersistence').getPersistedSelection()[0];
var length = cms.collections.configure.invoice.parameters.grid.getPlugin('PagingSelectionPersistence').getPersistedSelection().length;
if (length == 0) {
Ext.ComponentQuery.query(">#editInvoiceParamButton")[0].disable();
Ext.ComponentQuery.query(">#deleteInvoiceParamButton")[0].disable();
Ext.ComponentQuery.query(">#addInvoiceParamButton")[0].enable();
}
if (length == 1) {
Ext.ComponentQuery.query('>#editInvoiceParamButton')[0].enable();
Ext.ComponentQuery.query('>#deleteInvoiceParamButton')[0].enable();
Ext.ComponentQuery.query(">#addInvoiceParamButton")[0].disable();
}
if (length > 1) {
Ext.ComponentQuery.query('>#addInvoiceParamButton')[0].disable();
Ext.ComponentQuery.query(">#editInvoiceParamButton")[0].disable();
Ext.ComponentQuery.query(">#deleteInvoiceParamButton")[0].enable();
}
});

//================================ Panel Buttons =====================================

cms.collections.configure.invoice.parameters.grid.getView().autoFill = true;
invoiceParamTabPanel = new Ext.TabPanel({
itemId: adminCollectioninvoiceparamPanel + '-panel',
autoid: 'cmsAdminInvoiceParamTabPanel',
//tabIdentifier: dms.common.accountIdNRoleId + ":" + dms.constants.securityAction.menuId.corrRecipientRoles,
activeTab: 0,
bodyCssClass: true,
border: false,
autoHeight: true,
items: [{
title: common.i18n.getDisplayValue('CLS_ADMN_INV_PRM_CNFG', 'parameter Values'),
layout: 'fit',

tbar: [{
text: 'Add Parameter',
tooltip: 'Add',
iconCls: 'add',
itemId: 'addInvoiceParamButton',
autoid: 'cmsAddInvoiceParamBtn',
// actionIdentifier: dms.admin.tree.administrationDataTypeId + ":" + attributes.menuId + ":addDeleteTags",
handler: function() {
var getData = cms.collections.configure.invoice.parameters.grid.getPlugin('PagingSelectionPersistence').getPersistedSelection();
cms.collections.configure.invoice.parameters.addInvoiceParameter(getData);
}
},
{
text: 'Update Parameter',
tooltip: 'Update',
iconCls: 'editded',
itemId: 'editInvoiceParamButton',
disabled: 'true',
autoid: 'cmsEditInvoiceParamButton',
// actionIdentifier: dms.admin.tree.administrationDataTypeId + ":" + attributes.menuId + ":updateIPTags",
handler: function() {
var getData = cms.collections.configure.invoice.parameters.grid.getPlugin('PagingSelectionPersistence').getPersistedSelection();
cms.collections.configure.invoice.parameters.addInvoiceParameter(getData);
}
},
{
text: 'Delete Parameter',
tooltip: 'Delete',
iconCls: 'deleteded',
itemId: 'deleteInvoiceParamButton',
autoid: 'cmsDeleteInvoiceParamButton',
// actionIdentifier: dms.admin.tree.administrationDataTypeId + ":" + attributes.menuId + ":deleteIPTags",
handler: function() {
var getData = cms.collections.configure.invoice.parameters.grid.getPlugin('PagingSelectionPersistence').getPersistedSelection();
cms.collections.configure.invoice.parameters.deleteInvoiceParameter(getData);
}
}
],
items: [cms.collections.configure.invoice.parameters.grid]
}]

});
return invoiceParamTabPanel;
};
//------------------------------------Add---------------------------------------
cms.collections.configure.invoice.parameters.addInvoiceParameter = function(getData) {
cms.collections.configure.invoice.parameters.configItems = new Array();
var items = new Array();
storeValueCount = 0;
var winTitle = "Configure Invoice Parameter";

var tagCategoryTypeStore = dms.common.getDropDownStore('tagCategoryType', collections.common.invoiceParametersConfigDataTypeID, 'tagCategoryType');
tagCategoryTypeStore.load();
cms.collections.configure.invoice.parameters.tagCategoryCombo = new Ext.form.field.ComboBox({
fieldLabel: 'Field Type' + '<span style="color:red;" ext:qtip="This field is required"> *</span>',
typeAhead: true,
triggerAction: 'all',
lazyRender: true,
queryMode: 'local',
store: tagCategoryTypeStore,
typeAhead: false,
editable: false,
valueField: 'value',
displayField: 'displayName',
style: "width:450px !important",
labelStyle: "font-weight:bold !important; width:150px !important;",
allowBlank: false,
value: getData != null ? "Anu" : "",

});




var vboxIV = {
height: 80,
itemId: 'addCategoryTypeComboVboxId',
id: 'addCategoryTypeComboVboxId',
layout: 'hbox',
cls: 'expand-panel',
layoutConfig: {
align: 'stretch'
},
border: false,
items: [cms.collections.configure.invoice.parameters.tagCategoryCombo]


};

var para = new Ext.form.TextField({
name: 'param',
itemId: 'pa',
fieldLabel: 'Parameter name' + '<span style="color:red;" ext:qtip="This field is required"> *</span>',
maxLength: 250,
allowBlank: true,
style: "width:450px !important",
labelStyle: "font-weight:bold !important; width:150px !important;",
allowBlank: false,
value: getData != null ? getData.param : "",
});

var desc = new Ext.form.TextField({
name: 'desc',
itemId: 'dsc',
fieldLabel: 'Description',
maxLength: 250,
allowBlank: true,
style: "width:450px !important",
labelStyle: "font-weight:bold !important; width:150px !important;",
value: getData != null ? getData.desc : "",
});

cms.collections.configure.invoice.parameters.configItems.push(vboxIV);
cms.collections.configure.invoice.parameters.configItems.push(para);
cms.collections.configure.invoice.parameters.configItems.push(desc);


var languageTitle = new Ext.form.DisplayField({
fieldLabel: 'Language',
itemId: 'languageTitle',
frame: false,
cls: 'text-wrapper',
border: false,
labelStyle: "font-weight:bold !important;"
});

var enterValueTitle = new Ext.form.DisplayField({
fieldLabel: 'Enter Value' + '<span style="color:red;" ext:qtip="This field is required"> *</span>',
itemId: 'enterValueTitle',
frame: false,
cls: 'text-wrapper',
border: false,
labelStyle: "font-weight:bold !important;"
});


var allTitleComponents = {
// height: 20,
itemId: 'allTitleComponents',
layout: 'vbox',
cls: 'expand-panel',
layoutConfig: {
align: 'stretch'
},
border: false,
items: [languageTitle, enterValueTitle]

};

items.push({
items: [allTitleComponents]
});

var pageNumber = 0;
Ext.each(cms.collections.configure.invoice.parameters.accountLanguages, function(item) {


var language = item.split('::');
pageNumber = language[0];
var languageDisplayField = new Ext.form.DisplayField({
//fieldLabel : name,
itemId: 'languageDisplayField' + pageNumber,
frame: false,
cls: 'text-wrapper',
border: false,
value: language[1],
style: 'font-weight:bold !important;',
labelStyle: "font-weight:bold !important;",
fieldStyle: "font-weight:bold !important;"
});

var enterValValue = new Ext.form.TextField({
width: '150px',
itemId: 'enterValValue' + pageNumber,
id: 'enterValValue-' + pageNumber,
maxLength: 250,
allowBlank: true
});

var Page = Ext.create('Ext.panel.Panel', {
itemId: 'InvoiceParameterConfigPage' + pageNumber,
layout: 'anchor',
border: false,
defaults: {
anchor: '95%',
width: '200px'
},
items: [languageDisplayField, enterValValue]

});


items.push({
items: [Page]
});
});




var addInvoiceParameterConfig = {
// height: 20,
itemId: 'InvoiceParameterConfigHboxId' + pageNumber,
layout: 'hbox',
cls: 'expand-panel',
layoutConfig: {
align: 'stretch'
},
border: false,
items: items

};

cms.collections.configure.invoice.parameters.configItems.push(addInvoiceParameterConfig);

var configPanel = new Ext.form.FormPanel({
standardSubmit: true,
frame: true,
monitorValid: true,
scrollable: false,
buttonAlign: 'center',
//autoWidth : true,
animCollapse: false,
height: 300,
width: 200,
bodyStyle: 'background-color:#fff;padding: 10px;margin-left: 5px;',
buttonAlign: 'center',
layout: 'anchor',
cls: 'cls-window-invoiceParametersConfig',
autoScroll: false,
items: cms.collections.configure.invoice.parameters.configItems,
buttons: [{
text: common.i18n.getDisplayValue('COMMON_MSG_SUBMIT', 'Submit'),
tooltip: common.i18n.getDisplayValue('COMMON_MSG_SUBMIT', 'Submit'),
cls: 'hrc-btn-primary',
itemId: 'AddInvoiceParameterConfigSaveButton',
buttonAlign: 'center',
formBind: true,
handler: function() {
var query = {};
var URL = resolveCMSPath('addOrDeleteInvoiceParametersTags.do');
Ext.each(cms.collections.configure.invoice.parameters.accountLanguages, function(item) {
var language = item.split('::');
pageNumber = language[0];
var tagValues = Ext.getCmp('tagValues-' + pageNumber).getRawValue().split(',');
query[language[0]] = tagValues;
});
query = dms.common.formNestedMap(query);
if (Ext.encode(query) == '{}') {
// cms.collections.home.addorEditCustomerWin.destroy();
} else {
Ext.Ajax.request({
url: URL,
method: 'POST',
params: {
tagCategoryId: cms.collections.configure.invoice.parameters.tagCategoryCombo.getValue(),
query: Ext.encode(query)
},
success: function(response, opts) {
var responseTxt = Ext.decode(response.responseText);
var message = responseTxt.msg;
var success = responseTxt.success;
if (success && message.trim() == 'success') {
cms.collections.configure.invoice.parameters.grid.getStore().reload({
callback: function(r, options, success) {
Ext.example.msg('', common.i18n.getDisplayValue('ADM_CLS_IP_SUCCS_MSG', 'Changes saved successfully'));
if (success != true) {
Ext.Msg.alert(common.i18n.getDisplayValue('COMMON_MSG_INFO', 'Info'), common.i18n.getDisplayValue('ADM_CLS_IP_FAIL_MSG', 'Failed to save the changes'));
return;
}
}
});
cms.collections.configure.invoice.parameters.addorDeleteConfigWin.destroy();
} else if (success && message.trim()) {
this.setDisabled(false);
Ext.Msg.alert(common.i18n.getDisplayValue('COMMON_MSG_WARNING', 'Warning'), message.trim());
} else {
this.setDisabled(false);
Ext.example.msg(common.i18n.getDisplayValue('COMMON_MSG_ERROR', 'ERROR'), common.i18n.getDisplayValue('CLS_WL_OI_UPT_FAIL', 'Failed to update invoice(s)'));
}
}
});
}


}
},
{
text: common.i18n.getDisplayValue('COMMON_MSG_CANCEL', 'Cancel'),
cls: 'hrc-btn-tertiary hrc-btn-float-right',
handler: function() {
cms.collections.configure.invoice.parameters.addConfigWin.destroy();
}
}
],
});

cms.collections.configure.invoice.parameters.addConfigWin = new Ext.Window({
title: winTitle,
id: 'addOrEditWindow',
autoid: 'cmsInvoiceParametersConfigWindow',
width: screen.width * winWidth,
//height : hboxIV.height + 120,
height: screen.height * .55,
minWidth: screen.width * .40,
minHeight: screen.height * 0.4,
maxWidth: screen.width * 0.90,
maxHeight: screen.height * 0.75,
modal: true,
constrain: true,
layout: 'fit',
autoDestroy: false,
items: [configPanel],
listeners: {
afterrender: function() {
Ext.defer(function() {
window.scrollTo(this.x, this.y);
this.body.dom.scrollTop = 0;
}, 100, this);

}

}
});
cms.collections.configure.invoice.parameters.addConfigWin.show();
};



// ---------------------------------------------- Delete Window ----------------------------//
cms.collections.configure.invoice.parameters.deleteInvoiceParameter = function(getData) {
if (getData.length == 0) {
Ext.MessageBox.alert('Please select at least one checkbox');
} else {
var pktagCategoryId;
if (getData[0].data.pktagCategoryId != undefined && getData[0].data.pktagCategoryId != null && getData[0].data.pktagCategoryId != '') {
pktagCategoryId = getData[0].get('pktagCategoryId');
}

Ext.Msg.confirm('Do you want to delete the selected parameter(s) ?'),
function(btn, text) {
if (btn == 'yes') {
//cms.collections.configure.invoice.parameters.reasonsEncodedList = makeSynchAJAXCall(resolveCMSPath('getReasonMappings.do?communicationReasonId=' + reasonId, 'POST'));
//cms.collections.configure.invoice.parameters.reasonsMappingsStore = Ext.decode(cms.collections.configure.invoice.parameters.reasonsEncodedList);
//if (cms.collections.configure.invoice.parameters.reasonsMappingsStore.results == 0) {
Ext.Ajax.request({
url: resolveCMSPath('.do'),
params: {
communicationReasonId: pktagCategoryId
},
method: 'POST',
success: function(result, request) {
Ext.example.msg(common.i18n.getDisplayValue('Successfully Deleted the Communication Reason(s)'));
if (cms.collections.configure.invoice.parameters.grid) {
cms.collections.configure.invoice.parameters.grid.getStore().load();
}
},
failure: function(result, request) {
Ext.example.msg('Failed to DeleteInvoice Parameters');
}});
}
};
}};
     
 
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.