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 != "en") {
temp = ['cmsTagCategoryLang.' + languageCode, languageName + ' Display Name', 'string'];
cms.collections.configure.invoice.parameters.fieldsArray.push(temp);

}

//cms.collections.configure.invoice.parameters.headerArray.push('name.' + 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];
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);

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('.do'), cms.collections.configure.invoice.parameters.fieldsArray, null, null, null, true, true, null, true);

// ============================= 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];

}*/
var my_store = Ext.create('Ext.data.Store', {
"data": [{
"pkCmsTagCategory": 154,
"fkCategoryType.name": "editableDropDownField1",
"name": "dunningblock",
"description": "damaged",
"cmsTagCategoryLang.hi": "परीक्षण",
"cmsTagCategoryLang.en": "Testxyz",
"cmsTagCategoryLang.th": "bhsdhs",
"cmsTagCategoryLang.fr": "gvdvchc",
"cmsTagCategoryLang.tc": "hsbhbvhhv"
},
{
"pkCmsTagCategory": 54,
"fkCategoryType.name": "editableDropDownField2",
"name": "dunningblock",
"description": "damaged",
"cmsTagCategoryLang.hi": "परीक्षण",
"cmsTagCategoryLang.en": "Testxyz",
"cmsTagCategoryLang.th": "bhsdhs",
"cmsTagCategoryLang.fr": "gvdvchc",
"cmsTagCategoryLang.tc": "hsbhbvhhv"
}]
});


cms.collections.configure.invoice.parameters.grid = dms.grid.component.createGridComponent('Count ', 'pkCmsTagCategory', 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();
//console.log(getData);
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();
}

});

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.panel.Panel({

itemId: adminCollectioninvoiceparamPanel + '-panel',
autoid: 'cmsAdminInvoiceParamTabPanel',
//tabIdentifier: dms.common.accountIdNRoleId + ":" + dms.constants.securityAction.menuId.corrRecipientRoles,
activeTab: 0,
bodyCssClass: true,
border: false,
autoHeight: true,
items: [{

layout: 'fit',
height: 570,
tbar: [{
text: 'Add Parameter',
tooltip: 'Add',
iconCls: 'add',
itemId: 'addInvoiceParamButton',
autoid: 'cmsAddInvoiceParamBtn',
// actionIdentifier: dms.admin.tree.administrationDataTypeId + ":" + attributes.menuId + ":addDeleteTags",
handler: function() {
cms.collections.configure.invoice.parameters.addInvoiceParameter();
}
},
{
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.getSelectionModel().getSelection();

cms.collections.configure.invoice.parameters.addInvoiceParameter(getData);
}
},
{
text: 'Delete Parameter',
tooltip: 'Delete',
iconCls: 'deleteded',
itemId: 'deleteInvoiceParamButton',
autoid: 'cmsDeleteInvoiceParamButton',
disabled: 'true',
// actionIdentifier: dms.admin.tree.administrationDataTypeId + ":" + attributes.menuId + ":deleteIPTags",
handler: function() {

var getData=cms.collections.configure.invoice.parameters.grid.getSelectionModel().getSelection();
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 = Ext.create('Ext.data.Store', {
proxy: {
type: 'ajax',
actionMethods : {
read : 'POST'
},
url: '/Collections/cms/dropDownItems.do',
reader: {
type: 'json',
rootProperty: 'rows'
}
},
autoLoad: true,
fields : [ 'displayName', 'value','isDefaultSelected','ref1','title','ref4']
});
tagCategoryTypeStore.load({
params: {
dataTypeId : '20808',
fieldId : 'tagCategoryType',
},
});

//var tagCategoryTypeStore = dms.common.getDropDownStore('tagCategoryType', 20808, '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>',
itemId: 'fieldT',
typeAhead: true,
triggerAction: 'all',
lazyRender: true,
queryMode: 'local',
store: tagCategoryTypeStore,
typeAhead: false,
editable: false,
name: "fieldType",
valueField: 'value',
displayField: 'displayName',
style: "width:450px !important",
labelStyle: "font-weight:bold !important; width:150px !important;",
allowBlank: false,
value: getData != null ? getData[0].get('fkCategoryType.name') : "",
});


var para = new Ext.form.TextField({
name: 'para',
itemId: 'param',
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[0].data.name : "",
});

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[0].data.description : "",
});

cms.collections.configure.invoice.parameters.configItems.push(cms.collections.configure.invoice.parameters.tagCategoryCombo);
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;padding:0px 50px 0px 0px;",
//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;padding:0px 50px 0px 0px;",
});


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];
languageCode = language[2];
if (languageCode != "en"){
var languageDisplayField = new Ext.form.DisplayField({
//fieldLabel : name,
itemId: 'languageDisplayField' + pageNumber,
frame: false,
cls: 'text-wrapper',
border: false,
value: language[1],
style: 'display:inline-block;text-align:center',
//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,
listeners: {
change: function() {
var noneCheck = true;
var allCheck = true;
Ext.each(cms.collections.configure.invoice.parameters.accountLanguages, function(item) {
var testLanguage = item.split('::');
testTranslationId = testLanguage[0];
if (testTranslationId != "-1") {
var value = Ext.getCmp('enterValValue-' + testTranslationId).getValue();
if (value == undefined || value == null || value == "") {
allCheck = false;
}
else {
noneCheck = false;
}
}
})
if (noneCheck ^ allCheck == true) {
Ext.ComponentQuery.query("#AddInvoiceParameterConfigSaveButton")[0].enable();
}
else {
Ext.ComponentQuery.query("#AddInvoiceParameterConfigSaveButton")[0].disable();
}
}
}


});

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: 125,
itemId: 'InvoiceParameterConfigHboxId' + pageNumber,
layout: 'hbox',
scrollable:true,
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:true,
animCollapse: false,
bodyStyle: 'background-color:#fff;padding: 10px;margin-left: 5px;',
buttonAlign: 'center',
layout:'anchor',
cls: 'cls-window-invoiceParametersConfig',
autoScroll:true,
items: cms.collections.configure.invoice.parameters.configItems,
// listeners :{
// afterrender: function(){
// var para = Ext.ComponentQuery.query('#param')[0].getValue();
// var dsc = Ext.ComponentQuery.query('#dsc')[0].getValue();
// var fiel = Ext.ComponentQuery.query('#fieldT')[0].getValue();
// console.log(para)
// if(para !=undefined && dsc !=undefined && fiel !=undefined || para !='' && dsc !='' && fiel !='' || para !=null && dsc !=null && fiel !=null){
// Ext.ComponentQuery.query("#AddInvoiceParameterConfigSaveButton")[0].enable();
// }
// }
// },
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('test.do');
Ext.each(cms.collections.configure.invoice.parameters.accountLanguages, function(item) {
var language = item.split('::');
pageNumber = language[0];
languageCode = language[2];
if (languageCode != "en") {
var tagValues = Ext.getCmp('enterValValue-' + pageNumber).getRawValue().split(',');
console.log(tagValues);
query[language[0]] = tagValues;
}
});

query = dms.common.formNestedMap(query);
var getData = cms.collections.configure.invoice.parameters.grid.getPlugin('PagingSelectionPersistence').getPersistedSelection()[0];
var selectedId = getData === undefined ? null : getData.data['pkCmsTagCategory'] ;
var param = Ext.ComponentQuery.query('#param')[0].getValue();
var dsc = Ext.ComponentQuery.query('#dsc')[0].getValue();
if (Ext.encode(query) == '{}') {
} else {
Ext.Ajax.request({
url: URL,
method: 'POST',
params: {
tagCategoryId:selectedId,
tagCategoryType: cms.collections.configure.invoice.parameters.tagCategoryCombo.getValue(),
parameterName: param,
description: dsc,
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.40,
maxWidth: screen.width * 0.85,
maxHeight: screen.height * 0.55,
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) {

Ext.create('Ext.window.Window', {
title: 'Delete invoice Tag',
height: 200,
width: 300,
bodyPadding: 5,
html: 'Are you sure you want to delete the record?',
buttons: [{
text: 'Yes',
handler: function () {
var pktagCategoryId = [];
for(i =0; i<getData.length; i++){
pktagCategoryId[i] = getData[i].get('pkCmsTagCategory');
}
console.log(pktagCategoryId);
Ext.Ajax.request({
url: resolveCMSPath('test.do'),
params: {
tagCategoryIds: pktagCategoryId
},
method: 'POST',
success: function(result, request) {
Ext.example.msg(common.i18n.getDisplayValue('Successfully Deleted'));
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');
}
});
}

}, {
text: 'No',

handler: function () {
this.up('window').close();
}
}]
}).show();
};

//Main tab

cms.collections.configure.invoice.parameters.tabPanel=function(attributes){
var configureInvoiceParameters=cms.collections.configure.invoice.parameters.invoiceparametersTabPanel();
var configureParameterValues=cms.collections.invoice.parameters.invoiceparametersTabPanel(attributes);
configureParameterValues.setTitle(null);
var mainTabPanel= new Ext.tab.Panel( {
itemId : adminCollectioninvoiceparamPanel + '-panel',
activeTab : 0,
bodyCssClass : true,
border : false,
autoDestroy: true,
items : [ {
title : 'Configure Invoice Parameter',
layout : 'fit',
itemId:'invoiceParameters',
//tabIdentifier :DmsConfigureMenuId!=null?dms.common.accountIdNRoleId+ ":" + DmsConfigureMenuId:undefined,
items : [configureInvoiceParameters]
}, {
title : 'Configure Parameter Values',
itemId:'invoiceValues',
layout : 'fit',
//tabIdentifier :fileTraceUploadMenuId!=null?dms.common.accountIdNRoleId+ ":" + fileTraceUploadMenuId:undefined,
items : [configureParameterValues]
}
],
beforetabchange : function(tab,newTab,currentTab){
if(newTab.itemId == 'invoiceParameters')
traceGridPanel.getStore().reload();
if(newTab.itemId == 'invoiceValues'){
configGridPanel.getStore().reload();
//dms.slimfast.admin.deduction.dmsConfigurations.createDMSConfigureGridButtons(configGridPanel, DmsConfigureMenuId);
}
}
});
return mainTabPanel;

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