window.globalAltDown=false;
window.globalCtrlDown=false;
window.CPA_cancelAlertButton=false;
window.preventClickReload_GD_gridLov2Combo=false;
Ext.onReady(function () {
Ext.override(Ext.ux.form.LovCombo, {
beforeBlur: Ext.emptyFn
});
var genKeypressListenerGlobal = new window.keypress.Listener();
genKeypressListenerGlobal.register_combo({
"keys" : "alt",
"on_keydown" : function() {
window.globalAltDown=true;
},
"on_keyup" : function(args) {
window.globalAltDown=false;
}
});
genKeypressListenerGlobal.register_combo({
"keys" : "ctrl",
"on_keydown" : function() {
window.globalCtrlDown=true;
},
"on_keyup" : function() {
window.globalCtrlDown=false;
}
});
genKeypressListenerGlobal.simple_combo("esc", function() {
if(frichtee_getTotalOpenedWindows()==1) {
if(typeof(Ext.getCmp(frichtee_getLastItemOpenedWindows())) !== 'undefined') {
closeNav();
}
}
});
$j('#overlayDiv').click(function() {
if(frichtee_getTotalOpenedWindows()==1) {
if(typeof(Ext.getCmp(frichtee_getLastItemOpenedWindows())) !== 'undefined') {
closeNav();
}
}
});
});
// left: 37, up: 38, right: 39, down: 40,
// spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
var keys = {37: 1, 38: 1, 39: 1, 40: 1};
function toObject(arr) {
var rv = {};
for (var i = 0; i < arr.length; ++i)
if (arr[i] !== undefined) rv[i] = arr[i];
return rv;
}
// when implementing the function remember to set the mode of the cobmbobox to local (and the autoload to true if the combobox is not load in a other way)
// this function return true if the queried value is in the store (only work when called by filterBy()) this fonction ignore the accent
// function used in tab_rechercheContact_moteur.php on the combobox formulaire_rechercherContactMesure_sexe
function customInStringFn(record, value) {
var recherche = this.query.toLowerCase();
var thisCombo = this.combo;
actualComboValue = Ext.getCmp(this.combo.id).getValue();
if(actualComboValue != '' && typeof(this.combo.separator) !== 'undefined') {
tabValues = actualComboValue.split(this.combo.separator);
comboStore = Ext.getCmp(this.combo.id).getStore();
let tabActualRawValues = new Array();
$j.each(tabValues, function(index,value) {
$j.each(thisCombo.store.snapshot.items,function(indexRecordCacheDatas, valueRecordCacheDatas) {
if(parseInt(valueRecordCacheDatas.data.id) == value) {
tabActualRawValues.push(thisCombo.store.snapshot.items[indexRecordCacheDatas].data[thisCombo.displayField]);
}
});
});
recherche = recherche.split(tabActualRawValues.join(thisCombo.separator+' ')).pop();
}
var recValue = record.get(thisCombo.displayField).toLowerCase();
//this is the accent that are replaced if you want to had one you need to add on this table and on the replace
var accentMap = {
'ъ':'-', 'Ъ':'-', 'ь':'-',
'â':'a', 'ǎ':'a', 'ą':'a', 'á':'a', 'ă':'a', 'ã':'a', 'å':'a', 'à':'a', 'א':'a', 'ǻ':'a', 'ā':'a', 'ä':'ae', 'æ':'ae', 'ǽ':'ae',
'ב':'b', 'Б':'b', 'þ':'b',
'ĉ':'c', 'ć':'c', 'ç':'c', 'ц':'c', 'צ':'c', 'ċ':'c', 'č':'c', 'ч':'ch',
'ד':'d', 'ď':'d', 'đ':'d', 'д':'d', 'ð':'d',
'є':'e', 'ע':'e', 'ę':'e', 'ĕ':'e', 'ē':'e', 'ė':'e', 'ě':'e','ê':'e', 'ə':'e', 'è':'e', 'ë':'e', 'é':'e',
'ƒ':'f', 'Ф':'f',
'ġ':'g', 'Г':'g', 'ĝ':'g', 'ğ':'g', 'ג':'g', 'Ґ':'g', 'ґ':'g', 'ģ':'g',
'ח':'h', 'ħ':'h', 'Ħ':'h', 'ĥ':'h', 'ה':'h',
'î':'i', 'ï':'i', 'í':'i', 'ì':'i', 'į':'i', 'ĭ':'i', 'ĩ':'i', 'ǐ':'i', 'и':'i', 'ї':'i', 'ī':'i', 'ij':'ij',
'й':'j', 'ĵ':'j', 'я':'ja', 'э':'je', 'ё':'jo', 'ю':'ju',
'ĸ':'k', 'כ':'k', 'к':'k', 'ķ':'k', 'ך':'k',
'ŀ':'l', 'ł':'l', 'ļ':'l', 'ĺ':'l', 'л':'l', 'ľ':'l', 'ל':'l',
'מ':'m', 'ם':'m', 'м':'m',
'ñ':'n', 'н':'n', 'ŋ':'n', 'נ':'n', 'ń':'n', 'ņ':'n', 'ʼn':'n', 'ň':'n',
'ő':'o', 'õ':'o', 'ô':'o', 'ŏ':'o', 'ō':'o', 'ø':'o', 'ǿ':'o', 'ǒ':'o', 'ò':'o', 'ơ':'o', 'ó':'o', 'œ':'oe', 'ö':'oe',
'פ':'p', 'ף':'p', 'п':'p',
'ק':'q',
'ŕ':'r', 'ř':'r', 'ŗ':'r', 'ר':'r',
'ș':'s', 'š':'s', 'ś':'s', 'ş':'s', 'ŝ':'s', 'щ':'sch', 'ш':'sh', 'ß':'ss',
'т':'t', 'ŧ':'t', 'ת':'t', 'ť':'t', 'ţ':'t', 'ț':'t', '™':'tm',
'ū':'u', 'ũ':'u', 'ư':'u', 'ų':'u', 'ŭ':'u', 'ů':'u', 'ű':'u', 'ǔ':'u', 'ù':'u', 'ú':'u', 'û':'u', 'ǚ':'u', 'ǜ':'u', 'ǖ':'u', 'ǘ':'u', 'ü':'ue',
'в':'v',
'ש':'w', 'ŵ':'w',
'ы':'y', 'ŷ':'y', 'ý':'y', 'ÿ':'y','Ы':'y',
'ž':'z', 'з':'z', 'ź':'z', 'ז':'z', 'ż':'z', 'ж':'zh',
};
tabRecherche = recherche.split(' ');
if(recherche == '') {
return true;
} else {
let rechercheElementOK = 0;
$j.each(tabRecherche, function(index,value) {
value = value.replace(/[ъЪьâǎąáăãåàאǻāäæǽבБþĉćçцצċčчדďđдðєעęĕēėěêəèëéƒФġГĝğגҐґģחħĦĥהîïíìįĭĩǐиїīijйĵяэёюĸכкķךŀłļĺлľלמםñнŋנńņʼnňőõôŏōøǿǒòơóœöפףпקŕřŗרșšśşŝщшßтŧתťţț™ūũưųŭůűǔùúûǚǜǖǘüвשŵыŷýÿЫžзźזżж]/g, function(match) {return accentMap[match];});
recValue = recValue.replace(/[ъЪьâǎąáăãåàאǻāäæǽבБþĉćçцצċčчדďđдðєעęĕēėěêəèëéƒФġГĝğגҐґģחħĦĥהîïíìįĭĩǐиїīijйĵяэёюĸכкķךŀłļĺлľלמםñнŋנńņʼnňőõôŏōøǿǒòơóœöפףпקŕřŗרșšśşŝщшßтŧתťţț™ūũưųŭůűǔùúûǚǜǖǘüвשŵыŷýÿЫžзźזżж]/g, function(match) {return accentMap[match];});
if (recValue.includes(value) || value.includes(recValue)) {
++rechercheElementOK;
}
});
if(rechercheElementOK==tabRecherche.length) {
return true;
}
}
}
Ext.override(Ext.data.GroupingStore, {
sort : function(fieldName, dir) {
if (this.remoteSort) {
return Ext.data.GroupingStore.superclass.sort.call(this, fieldName, dir);
}
var sorters = [];
//cater for any existing valid arguments to this.sort, massage them into an array of sorter objects
if (Ext.isArray(arguments[0])) {
sorters = arguments[0];
} else if (fieldName == undefined) {
//we preserve the existing sortInfo here because this.sort is called after
//clearGrouping and there may be existing sorting
sorters = this.sortInfo ? [this.sortInfo] : [];
} else {
//TODO: this is lifted straight from Ext.data.Store's singleSort function. It should instead be
//refactored into a common method if possible
var field = this.fields.get(fieldName);
if (!field) return false;
var name = field.name,
sortInfo = this.sortInfo || null,
sortToggle = this.sortToggle ? this.sortToggle[name] : null;
if (!dir) {
if (sortInfo && sortInfo.field == name) { // toggle sort dir
dir = (this.sortToggle[name] || 'ASC').toggle('ASC', 'DESC');
} else {
dir = field.sortDir;
}
}
this.sortToggle[name] = dir;
this.sortInfo = {field: name, direction: dir};
sorters = [this.sortInfo];
}
//add the grouping sorter object as the first multisort sorter
if (this.groupField) {
var groupDir = this.groupDir;
//Allow sorting groups
if (this.groupField === this.sortInfo.field)
groupDir = this.sortInfo.direction;
//We need to set the grouping direction according to the last sort that occured on
//the grouping field so that we don't break grouping while sorting on other fields.
//!Note: We avoid doing this during the first sort of a grouping action, otherwise
//it's overwriting the default grouping order.
else if (!Ext.isArray(arguments[0]))
groupDir = this.multiSortInfo.sorters[0].direction;
sorters.unshift({direction: groupDir, field: this.groupField});
}
return this.multiSort.call(this, sorters, dir);
}
});
Ext.ns('Ext.ux2.form'); // set up Ext.ux.form namespace
Ext.ux.form.myNumberField = Ext.extend(Ext.form.NumberField, {
initEvents : function(){
var allowed = this.baseChars + '';
if (this.allowDecimals) {
allowed += this.decimalSeparator;
allowed += "."; // << add comma
}
if (this.allowNegative) {
allowed += '-';
}
this.maskRe = new RegExp('[' + Ext.escapeRe(allowed) + ']');
Ext.form.NumberField.superclass.initEvents.call(this);
},
setValue : function(v){
v = Ext.isNumber(v) ? v : parseFloat(String(v).replace(',', "."));
return Ext.ux.form.myNumberField.superclass.setValue.call(this, v);
},
validateValue : function(value){
if(!Ext.form.NumberField.superclass.validateValue.call(this, value)){
return false;
}
if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
return true;
}
value = parseFloat(String(value).replace(",", "."));
return Ext.ux.form.myNumberField.superclass.validateValue.call(this, value);
},
parseValue : function(value){
value = parseFloat(String(value).replace(",", "."));
return Ext.ux.form.myNumberField.superclass.parseValue.call(this, value);
}
});
Ext.reg('mynumberfield', Ext.ux.form.myNumberField);
function dblClick_elementsFicheEditorGrid_contrat(idElement, idGroupeElement, activeTab, boolInput_droits_readOnly, tabVars, dataStoreToReload) {
var store_elements_fiches = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_elements_fiches.php'
}),
reader: new Ext.data.JsonReader({}, [ 'id', 'intitule']),
remoteSort: false,
autoLoad:false
});
if(tabVars['post_estBudget']=='' && (tabVars['config_PERIODE_CONTRAT']=='true' || parseInt(tabVars['config_PERIODE_CONTRAT'])==1)) {
var afficherComboPeriodes = true;
} else {
var afficherComboPeriodes = false;
}
var formPanel_modifierElementFiche = new Ext.form.FormPanel({
frame: true,
bodyStyle:'padding:5px',
autoHeight:true,
standardSubmit: false,
method: 'POST',
title:'General information',
baseCls: 'x-plain',
items: [
new Ext.form.FieldSet({
labelWidth:150,
collapsible: false,
title: 'General information',
autoHeight: true,
items: [
new Ext.form.ComboBox({
hiddenName: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_groupeElement',
id: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_groupeElementId',
width:350,
hideOnSelect:false,
store:new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_groupementsElements.php?idModule='+tabVars['arrayTypeModule_id']
}),
remoteSort: true,
autoLoad: false,
fields : [{type:'int', name:'id'},'intitule']
}),
triggerAction:'all',
valueField:'id',
minChars:1,
fieldLabel: 'Group',
emptyText:'Select',
queryParam:'term',
displayField:'intitule',
mode:'remote',
forceSelection:false,
listeners : {
select: function() {
var store = Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId').getStore();
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId').setValue('');
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_valeurId').setValue('');
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_totalId').setValue('');
store.load({ params: { groupeElement: this.getValue() }});
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId').enable();
}
}
}),
new Ext.form.ComboBox({
hiddenName: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_element',
id: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId',
width:350,
hideOnSelect:false,
store:new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_elements_fiches.php'
}),
remoteSort: true,
autoLoad: false,
fields : [ {type:'int', name:'id'}, {type:'int', name:'idTypeBudget'}, 'intitule']
}),
triggerAction:'all',
valueField:'id',
minChars:1,
disabled:false,
fieldLabel: 'Element',
emptyText:'Select',
queryParam:'term',
displayField:'intitule',
mode:'local',
forceSelection:false,
listeners:{
select:function(thisCustom, record) {
if(record.data.idTypeBudget>0) {
var store = Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetTypeId').getStore();
store.load({callback:function() {
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetTypeId').setValue(record.data.idTypeBudget);
}});
}
Ext.Ajax.request({
waitMsg: 'Please wait',
url: '_ajax/ajouter_element_fiche_contrat_calculerTotal.php',
params:{
idElement:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId').getValue(),
idElementEnregistre: idElement,
valeur:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_valeurId').getValue(),
idFiche:tabVars['arrayFiche_id'],
idProduction:tabVars['arrayFiche_idProduction'],
idRole:tabVars['arrayFiche_idRole'],
idContact:tabVars['arrayContact_id']
},
success: function(result, request) {
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_totalId').setValue(result.responseText);
}
});
}
}
}),
{
xtype:'mynumberfield',
fieldLabel: 'Value',
name: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_valeur',
id:'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_valeurId',
decimalPrecision:5,
width:350,
listeners:{
blur:function() {
Ext.Ajax.request({
waitMsg: 'Please wait',
url: '_ajax/ajouter_element_fiche_contrat_calculerTotal.php',
params:{
idElement:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId').getValue(),
idElementEnregistre: idElement,
valeur:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_valeurId').getValue(),
idFiche:tabVars['arrayFiche_id'],
idProduction:tabVars['arrayFiche_idProduction'],
idRole:tabVars['arrayFiche_idRole'],
idContact:tabVars['arrayContact_id']
},
success: function(result, request) {
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_totalId').setValue(result.responseText);
}
});
}
}
},{
xtype:'numberfield',
id:'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_totalId',
readOnly:true,
decimalPrecision:5,
fieldLabel: 'Total',
width:350
},{
xtype:'textfield',
fieldLabel: 'Note',
name: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_note',
id:'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_noteId',
width:350
},
new Ext.form.ComboBox({
hiddenName: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContrat',
id: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContratId',
width:350,
hideOnSelect:false,
store:new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_periodesContrat.php?idContrat='+tabVars['post_idFiche']
}),
remoteSort: true,
autoLoad: false,
fields : [{type:'int', name:'id'},'intitule']
}),
triggerAction:'all',
valueField:'id',
minChars:1,
fieldLabel: 'Period',
emptyText:'Select',
queryParam:'term',
displayField:'intitule',
mode:'remote',
forceSelection:false,
}),
{
xtype:'datefieldplus',
fieldLabel: 'Date',
format:'d-m-Y',
submitFormat:'Y-m-d',
name: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContrat_estDate',
id:'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContrat_estDateId',
width:150,
listeners:{
render:function() {
if(afficherComboPeriodes) {
$j('#formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContrat_estDateId').parent().parent().parent().css('display','none');
$j('#formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContratId').parent().parent().parent().css('display','block');
} else {
$j('#formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContrat_estDateId').parent().parent().parent().css('display','block');
$j('#formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContratId').parent().parent().parent().css('display','none');
}
}
}
},
]
}),
new Ext.form.FieldSet({
collapsible: false,
title: 'Budget',
labelWidth:150,
autoHeight: true,
items: [
new Ext.form.ComboBox({
hiddenName:'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetItem',
id:'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetItemId',
width:500,
listWidth: 500,
hideOnSelect:false,
store:new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_budgetItem.php?idProd='+tabVars['arrayFiche_idProduction'],
}),
baseParams:{
idTypeFiche:tabVars['arrayFiche_idTypeFiche'],
extraId:tabVars['budgetItemFiche'],
checkDroits23:1
},
remoteSort: true,
autoLoad: true,
fields : [{type:'int', name:'id'},'code_budget']
}),
triggerAction:'all',
valueField:'id',
emptyText:'Select',
queryParam:'term',
minChars: 2,
tpl: '
';
}
*/
if(messageErreur!='') {
$j.gritter.add({title: 'Error',text: messageErreur,image: '_img/notification/ko.png',sticky: false, time: '1000'});
} else {
if(!afficherComboPeriodes) {
var periodeContrat_estDate = Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContrat_estDateId').getValueSubmitFormat()
} else {
var periodeContrat_estDate = '';
}
Ext.getCmp('btnSubmit_dblClick_elementsFicheEditorGrid_contratId').enableLoader();
Ext.Ajax.request({
waitMsg: 'Please wait',
url: '_ajax/editer_element_ficheContrat.php',
params:{
idElementEnregistre: idElement,
idModule:tabVars['arrayTypeModule_id'],
classifElement_1: Ext.getCmp('classifElement_editer_1__id_element').getValue(),
classifElement_2: Ext.getCmp('classifElement_editer_2__id_element').getValue(),
idBudgetItem:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetItemId').getValue(),
idBudgetType:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetTypeId').getValue(),
valeur:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_valeurId').getValue(),
note:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_noteId').getValue(),
groupement:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_groupeElementId').getValue(),
element:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId').getValue(),
periodeContrat:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_periodeContratId').getValue(),
periodeContrat_estDate:periodeContrat_estDate
},
success: function() {
// dataStoreToReload.reload();
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_window').close();
}
});
}
},
iconCls:'save'
}],
listeners:{
show:function() {
//cls:'classifElement_module classifElement_module_',
if(typeof(Ext.getCmp('classifElement_module_'+tabVars['arrayTypeModule_id']+'Id')) !== 'undefined') {
Ext.getCmp('classifElement_module_'+tabVars['arrayTypeModule_id']+'Id').show();
}
}
}
});
formPanel_modifierElementFiche.getForm().load({
url: '_datasMysql/form_detailsFiche_elementEnregistre.php',
params: {
idElementEnregistre: idElement,
idModule:tabVars['arrayTypeModule_id']
},
success:function(form, action) {
var reponse = Ext.decode(action.response.responseText);
if(reponse.data.estEnfant==1) {
window.elementEnregistreEstEnfant=true;
} else {
window.elementEnregistreEstEnfant=false;
}
// Gestion des store des classif de type combobox
var storeBudgetType = Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetTypeId').getStore();
storeBudgetType.load({
callback:function() {
ComboSetterCustom(Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetTypeId'),parseInt(reponse.data.idTypeBudget),false);
}
});
var storeBudgetItem = Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetItemId').getStore();
storeBudgetItem.baseParams.extraId=reponse.data.idBudgetItem;
storeBudgetItem.load({
callback:function() {
ComboSetterCustom(Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetItemId'),parseInt(reponse.data.idBudgetItem),false);
}
});
var store = Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_groupeElementId').getStore();
store.load({
callback:function() {
ComboSetterCustom(Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_groupeElementId'),parseInt(reponse.data.idGroupement),false);
var store2 = Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId').getStore();
store2.baseParams.groupeElement=reponse.data.idGroupement;
store2.load({
callback:function() {
ComboSetterCustom(Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId'),parseInt(reponse.data.idElement),false);
Ext.Ajax.request({
waitMsg: 'Please wait',
url: '_ajax/ajouter_element_fiche_contrat_calculerTotal.php',
params:{
idElement:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_elementId').getValue(),
idElementEnregistre: idElement,
valeur:Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_valeurId').getValue(),
idFiche:tabVars['arrayFiche_id'],
idProduction:tabVars['arrayFiche_idProduction'],
idRole:tabVars['arrayFiche_idRole'],
idContact:tabVars['arrayContact_id']
},
success: function(result, request) {
Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_totalId').setValue(result.responseText);
}
});
}
});
}
});
var comboBudgetItem = new Ext.form.ComboBox({
hiddenName:'comboBudgetItemEditorGrid',
id:'comboBudgetItemEditorGridId',
hideOnSelect:false,
store:new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_budgetItem.php?idProd='+tabVars['arrayFiche_idProduction'],
}),
baseParams:{
idTypeFiche:tabVars['arrayFiche_idTypeFiche'],
extraId:tabVars['budgetItemFiche'],
checkDroits23:1
},
remoteSort: true,
autoLoad: false,
fields : [{type:'int', name:'id'},'code_budget']
}),
triggerAction:'all',
valueField:'id',
emptyText:'Select',
queryParam:'term',
displayField:'code_budget',
mode:'remote'
});
function formPanelGridComboBudgetItem_majDivDroite(idEcheance) {
$j('#formPanelGridComboBudgetItem_innerDroiteDiv').empty().append('');
Ext.Ajax.request({
waitMsg: 'Patientez',
url: '_ajax/formPanelLoupeComboBudgetItem_innerDroiteDiv.php',
params: {
idCentre1:Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire1Id').getValue(),
idCentre2:Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire2Id').getValue(),
idCentre3:Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire3Id').getValue(),
},
success: function (result,request) {
if(result.responseText!='') {
$j('#formPanelGridComboBudgetItem_innerDroiteDiv').empty().append(result.responseText);
var nbResultats = $j('#formPanelGridComboBudgetItem_innerDroiteDiv').find('div');
$j('#formPanelGridComboBudgetItem_innerDroiteFieldSetTitre').empty().append(nbResultats.length+' result(s) (click to select)');
$j('.formPanelLoupeComboBudgetItem_elementDiv').click(function() {
Ext.Ajax.request({
waitMsg: 'Please wait',
url: '_ajax/affecterBudgetItemEcheanceElementContrat.php',
params: {
id: idEcheance,
idBudgetItem:parseInt($j(this).attr('rel'))
},
success: function() {
gridEcheances_DS.reload();
Ext.getCmp('window_GridBudgetItemId').close();
$j.gritter.add({title: 'Confirmation',text: 'Modification done',image: '_img/notification/ok.png',sticky: false, time: '1000'});
}
});
/*
var store = Ext.getCmp(''+idCombo+'').getStore();
store.baseParams.extraId=parseInt($j(this).attr('rel'));
var thisCustom = $j(this);
store.load({
callback:function() {
if(ComboSetterCustom(Ext.getCmp(''+idCombo+''),parseInt(thisCustom.attr('rel')),false)<0) {
$j.gritter.add({title: 'Erreur',text: 'Ce poste budgétaire n\'existe pas',image: '_img/notification/ko.png',sticky: false, time: '2000'});
} else {
Ext.getCmp('window_GridBudgetItemId').close();
}
}
});
*/
});
} else {
$j('#formPanelGridComboBudgetItem_innerDroiteDiv').empty().append('No results found');
$j('#formPanelGridComboBudgetItem_innerDroiteFieldSetTitre').empty().append('Search Results');
}
}
});
}
var gridEcheances_DS = new Ext.data.Store({
remoteSort: true,
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/grid_echeances_elementContrat.php',
method: 'POST'
}),
baseParams:{idProduction:tabVars['arrayFiche_idProduction'], idRole:tabVars['arrayFiche_idRole'], idContact:tabVars['arrayContact_id'], idFiche:tabVars['post_idFiche'], idElement:idElement, sort: 'ordre', dir: 'ASC'},
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'total',
id: 'id'
},[
{name: 'id', type: 'int', mapping: 'id'},
{name: 'date', type: 'string', mapping: 'date'},
{name: 'note', type: 'string', mapping: 'note'},
{name: 'montant', type: 'string', mapping: 'montant'},
{name: 'estSysteme', type: 'int', mapping: 'estSysteme'},
{name: 'pourcentage', type: 'string', mapping: 'pourcentage'},
{name: 'analytique', type: 'string', mapping: 'analytique'},
{name: 'budgetItem', type: 'string', mapping: 'budgetItem'},
{name: 'statutIntitule', type: 'string', mapping: 'statutIntitule'},
{name: 'fonction', type: 'string', mapping: 'fonction'}
]),sortInfo:{field: 'id', direction: "ASC"},
listeners:{
load:function() {
setTimeout(function(){
$j('.gridBudgetItemLoupe').click(function() {
var idEcheance = $j(this).attr('rel');
var formPanelGridComboBudgetItem = new Ext.FormPanel({
bodyStyle: 'padding: 5px',
standardSubmit: false,
layout:'table',
layoutConfig: {
columns: 2,
tableAttrs: {
style: {
width: '100%',
cellspacing:'5',
}
},
},
method: 'POST',
items: [
new Ext.form.FieldSet({
collapsible: false,
collapsed:false,
checkboxToggle:false,
title: 'Budget centers',
autoHeight: true,
items: [
new Ext.form.ComboBox({
name:'formPanelGridComboBudgetItem_posteBudgetaire1',
id:'formPanelGridComboBudgetItem_posteBudgetaire1Id',
width:240,
hideOnSelect:false,
store:new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_centreBudgetaires.php'
}),
baseParams:{
table:'budget_centreLibre1',
checkDroit3:1,
idCS:6 },
remoteSort: true,
autoLoad: false,
fields : [{type:'int', name:'id'},'intitule']
}),
triggerAction:'all',
valueField:'id',
minChars:1,
queryParam:'term',
displayField:'intitule',
fieldLabel:'Department',
mode:'remote',
listeners:{
select:function() {
formPanelGridComboBudgetItem_majDivDroite(idEcheance);
},
}
}),
new Ext.form.ComboBox({
name:'formPanelGridComboBudgetItem_posteBudgetaire2',
id:'formPanelGridComboBudgetItem_posteBudgetaire2Id',
width:240,
hideOnSelect:false,
store:new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_centreBudgetaires.php'
}),
baseParams:{
table:'budget_centreProduction',
checkDroit3:1,
idCS:1 },
remoteSort: true,
autoLoad: false,
fields : [{type:'int', name:'id'},'intitule']
}),
triggerAction:'all',
valueField:'id',
minChars:1,
queryParam:'term',
displayField:'intitule',
fieldLabel:'Event Group',
mode:'remote',
listeners:{
select:function() {
formPanelGridComboBudgetItem_majDivDroite(idEcheance);
},
}
}),
new Ext.form.ComboBox({
name:'formPanelGridComboBudgetItem_posteBudgetaire3',
id:'formPanelGridComboBudgetItem_posteBudgetaire3Id',
width:240,
hideOnSelect:false,
store:new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: '_datasMysql/store_centreBudgetaires.php'
}),
baseParams:{
table:'budget_centreLibre2',
checkDroit3:1,
idCS:7 },
remoteSort: true,
autoLoad: false,
fields : [{type:'int', name:'id'},'intitule']
}),
triggerAction:'all',
valueField:'id',
minChars:1,
queryParam:'term',
displayField:'intitule',
fieldLabel:'Sub-allocation',
mode:'remote',
listeners:{
select:function() {
formPanelGridComboBudgetItem_majDivDroite(idEcheance);
},
}
}),
]
}),
{
cellCls:'tdValignTop',
bodyStyle:'border:none; width:300px; margin-left:10px',
items:[
new Ext.form.FieldSet({
collapsible: false,
collapsed:false,
checkboxToggle:false,
title: 'Search results',
autoHeight: true,
items: [
{
xtype:'displayfield',
value:'