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) {
			if (this.sortInfo && typeof this.sortInfo.field !== 'undefined') {				
                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:'Allgemeine Informationen',
                            baseCls: 'x-plain',
                            items: [
                                    new Ext.form.FieldSet({
                                            labelWidth:150,
                                            collapsible: false,
                                            title: 'Allgemeine Informationen',
                                            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: 'Gruppe',
                                        emptyText:'wählen ...',
                                        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:'wählen ...',
                                        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: 'Wert',
                                    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: 'Gesamt',
                                    width:350
                                },{
                                    xtype:'textfield',
                                    fieldLabel: 'Notiz',
                                    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: 'Zeitraum',
                                        emptyText:'wählen ...',
                                        queryParam:'term',
                                        displayField:'intitule',
                                        mode:'remote',
                                        forceSelection:false,
                                      
                                    }),
                               
                                {
                                    xtype:'datefieldplus',
                                    fieldLabel: 'Datum',
                                    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: 'Etat',
                                                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:'wählen ...',
                                                        queryParam:'term',
                                                        minChars: 2,
                                                        tpl: '
';
                            }
*/
                           if(messageErreur!='') {
                                $j.gritter.add({title: 'Fehler',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'],
                                        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:'wählen ...',
            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: {
                                                                                        
                                        }, 
                                        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+' Ergebnis(-se) (Klicken, um sie auszuwählen)');
                                                    
                                                    
                                                $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: 'Bestätigung',text: 'Änderungen',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('Kein Ergebnis.');
                                                    $j('#formPanelGridComboBudgetItem_innerDroiteFieldSetTitre').empty().append('Suchenergebnisse');
                                            }
                                        }
                                    });
                                }
                                
                                
                
    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: 'Kostenstellen',
                                                    autoHeight: true,
                                                    items: [
                                                        
                                                    ]
                                                }),
                                                {
                                                    cellCls:'tdValignTop',
                                                    bodyStyle:'border:none; width:300px; margin-left:10px',
                                                    items:[
                                                        new Ext.form.FieldSet({
                                                        collapsible: false,
                                                        collapsed:false,
                                                        checkboxToggle:false,
                                                        title: 'Suchergebnisse',
                                                        autoHeight: true,
                                                            items: [
                                                                {
                                                                    xtype:'displayfield',
                                                                    value:'
';
        }
      },{
        header: 'Notiz',
        sortable: false,
        editor:new Ext.form.TextField({
          allowBlank: true,
        }),
        dataIndex: 'note',
        width: 190
      },
                  ]
    );
    
   var gridEcheances =  new Ext.grid.EditorGridPanel({
      store: gridEcheances_DS,
      id:'gridEcheancesId',
      title:'Zeitplan',
      stateful: false,
      clicksToEdit:2,
      height:300,
      autoScroll:true,
      collapsible:false,
      collapsed:false,
      stripeRows: true,
      enableColLock:false,
      enableHdMenu:false,
      loadMask: 'Chargement des données…',
      cm: gridEcheances_CM,
      view: new Ext.grid.GridView({
          
        getRowClass : function(row, index){
            var cls = '';
            var data = row.data;
            if(data.estSysteme==1) {
                var cls = 'ligne_rouge';
            }
        
            return cls;
           }
      }),
      selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
      tbar:[
          {
              text:'Hinzufügen',
              iconCls:'add',
              disabled:window.elementEnregistreEstEnfant,
              handler:function() {
              
                Ext.Ajax.request({   
                    waitMsg: 'Please wait',
                    url: '_ajax/ajouter_echeance_elementContrat.php',
                    params:{
                        idFiche:tabVars['post_idFiche'],
                        idElement:idElement
                    },
                    success: function(data) {
                        gridEcheances_DS.reload();
                    }                  
                });
              }
          },
          {
              text:'Löschen',
              iconCls:'trash',
              disabled:window.elementEnregistreEstEnfant,
              handler:function() {
                var selectionselementFicheAsupprimer = gridEcheances.selModel.getSelections();
                 var elementFicheAsupprimerTAB = [];
                 for(i = 0; i< gridEcheances.selModel.getCount(); i++){
                  elementFicheAsupprimerTAB.push(selectionselementFicheAsupprimer[i].json.id);
                 }
                 var elementFicheAsupprimer = Ext.encode(elementFicheAsupprimerTAB);
              
/*
                  if((gridEcheances.getStore().getCount()-elementFicheAsupprimerTAB.length)==0) {
                $j.gritter.add({title: 'Erreur',text: 'Vous ne pouvez pas supprimer la dernière échéance',image: '_img/notification/ko.png',sticky: false, time: '1000'});
                  } else {
*/
                  
                  
                  
                    Ext.MessageBox.show({
                           title:'Warnung',
                           msg: 'Sind Sie sicher ?',
                           buttons: Ext.MessageBox.YESNO,
                           fn: function(btn, text) {
                               if(btn=='yes') {				
                                    var selectionselementFicheAsupprimer = gridEcheances.selModel.getSelections();
                                     var elementFicheAsupprimerTAB = [];
                                     for(i = 0; i< gridEcheances.selModel.getCount(); i++){
                                      elementFicheAsupprimerTAB.push(selectionselementFicheAsupprimer[i].json.id);
                                     }
                                     var elementFicheAsupprimer = Ext.encode(elementFicheAsupprimerTAB);
                                     Ext.Ajax.request({  
                                        waitMsg: 'Patientez',
                                        url: '_ajax/supprimer_echeance_element_fiche.php', 
                                        params: { 
                                               ids:  elementFicheAsupprimer,               
                                          }, 
                                        success: function (result,request) {
                                            gridEcheances_DS.reload();  
                                            $j.gritter.add({title: 'Bestätigung',text: 'Die Auswahl ist jetzt entfernt',image: '_img/notification/ok.png',sticky: false, time: '1000'});
                                          }
                                     });				           
                               }
                           },
                           icon: Ext.MessageBox.QUESTION
                       });	
                      
                      
                      
                  //}
              
              }
          },
          {
              text:'Saldo zuteilen',
              iconCls:'deferrais',
              disabled:window.elementEnregistreEstEnfant,
              handler:function() {
                  var selectionElement_affecterSolde = gridEcheances.selModel.getSelections();
                  
                  if(gridEcheances.selModel.getCount()!=1) {
                    $j.gritter.add({title: 'Erreur',text: 'Merci de sélectionner une et une seule ligne	',image: '_img/notification/ko.png',sticky: false, time: '1000'});
                      
                  } else {
                      
                        Ext.Ajax.request({   
                          waitMsg: 'Please wait',
                          url: '_ajax/affecterSoldeEcheanceElementContrat.php',
                          params: { 
                                idEcheance:selectionElement_affecterSolde[0].json.id,
                                idFiche:tabVars['arrayFiche_id'],
                                idProduction:tabVars['arrayFiche_idProduction'],
                                idElementEnregistre:idElement,
                                idRole:tabVars['arrayFiche_idRole'],
                                idContact:tabVars['arrayContact_id']
                          }, success: function() {
                              gridEcheances_DS.reload();
                            $j.gritter.add({title: 'Bestätigung',text: 'Änderungen',image: '_img/notification/ok.png',sticky: false, time: '1000'});
                    
                          }                  
                       }); 
                  }
                //selectionElement_affecterSolde[i].json.id
              }
              
          }
      ],
      listeners:{
          beforeedit:function() {
              return !window.elementEnregistreEstEnfant;
          },
          afteredit:function(oGrid_event) {
              var date = new Date(oGrid_event.record.data.date);
           Ext.Ajax.request({   
              waitMsg: 'Please wait',
              url: '_ajax/editerInlineEcheanceElementContrat.php',
              params: { 
                      id: oGrid_event.record.data.id,
                      idStatutEcheance: oGrid_event.record.data.statutIntitule,
                      montant: oGrid_event.record.data.montant,
                      note: oGrid_event.record.data.note,
                      idBudgetItem: oGrid_event.record.data.analytique,
                      field:oGrid_event.field,
                      date: date.format('Y-m-d'),
                      pourcentage: oGrid_event.record.data.pourcentage,
                    idFiche:tabVars['arrayFiche_id'],
                    idProduction:tabVars['arrayFiche_idProduction'],
                    idRole:tabVars['arrayFiche_idRole'],
                    idContact:tabVars['arrayContact_id']
              }, success: function() {
                  gridEcheances_DS.reload();
                $j.gritter.add({title: 'Bestätigung',text: 'Änderungen',image: '_img/notification/ok.png',sticky: false, time: '1000'});
        
              }                  
           }); 
              
              
          }
      }
   });
//	gridEcheances_DS.load();
    var tabs_modifierElementFiche = new Ext.TabPanel({
        activeTab:activeTab,
        autoHeight:true,
        items:[
            formPanel_modifierElementFiche
        ],
        listeners: {
            tabchange:function() {
                gridEcheances_DS.load();
            }
        }
    });
    if(parseInt(tabVars['arrayTypeFiche_estBudget'])==1 && parseInt(tabVars['arrayTypeContrat_idCategorieContrat'])!=2) {
        tabs_modifierElementFiche.add(gridEcheances);
    }
    var window_modifierElementFiche = new Ext.Window({
        title: 'Element bearbeiten',
        closable:true,
        draggable:true,
        modal:true,
        width: 900,
        resizable:false,	          
        autoHeight: true,
        plain:true,
        layout: 'auto',
        listeners:{
            close:function() {
                if(dataStoreToReload.baseParams.id=='fichesContratEcheancesDataStoreId') {
                    dataStoreToReload.reload({params:{resetDueDates:1,resetDueDates_idFiche:tabVars['post_idFiche'],resetDueDates_idElement:idElement}});
                } else {
                    dataStoreToReload.reload();
                }
            }
        },
        id: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_window',
        items: tabs_modifierElementFiche
    });
    window_modifierElementFiche.show();
                    
                    }
                });
                
}
Array.prototype.unset = function(value) {
    if(this.indexOf(value) != -1) { // Make sure the value exists
        this.splice(this.indexOf(value), 1);
    }   
}
function HTMLentitiesdecode (texte) {
//texte = texte.replace(/#/g,'#'); // 160 A0
//texte = texte.replace(/\n/g,'\n'); // 160 A0
//texte = texte.replace(/\r/g,'\r'); // 160 A0
texte = texte.replace(/&/g,'&'); // 38 26
texte = texte.replace(/"/g,'"'); // 34 22
texte = texte.replace(/</g,'<'); // 60 3C
texte = texte.replace(/>/g,'>'); // 62 3E
texte = texte.replace(/¢/g,'\242');
texte = texte.replace(/£/g,'\243');
texte = texte.replace(/€/g,'\€');
texte = texte.replace(/¥/g,'\245');
texte = texte.replace(/°/g,'\260');
//texte = texte.replace(/\274/g,'¼');
texte = texte.replace(/Œ/g,'\274');
//texte = texte.replace(/\275/g,'½');
texte = texte.replace(/œ/g,'\275');
//texte = texte.replace(/\276/g,'¾');
texte = texte.replace(/Ÿ/g,'\276');
texte = texte.replace(/¡/g,'\241');
texte = texte.replace(/«/g,'\253');
texte = texte.replace(/»/g,'\273');
texte = texte.replace(/¿/g,'\277');
texte = texte.replace(/À/g,'\300');
texte = texte.replace(/Á/g,'\301');
texte = texte.replace(/Â/g,'\302');
texte = texte.replace(/Ã/g,'\303');
texte = texte.replace(/Ä/g,'\304');
texte = texte.replace(/Å/g,'\305');
texte = texte.replace(/Æ/g,'\306');
texte = texte.replace(/Ç/g,'\307');
texte = texte.replace(/È/g,'\310');
texte = texte.replace(/É/g,'\311');
texte = texte.replace(/Ê/g,'\312');
texte = texte.replace(/Ë/g,'\313');
texte = texte.replace(/Ì/g,'\314');
texte = texte.replace(/Í/g,'\315');
texte = texte.replace(/Î/g,'\316');
texte = texte.replace(/Ï/g,'\317');
texte = texte.replace(/Ð/g,'\320');
texte = texte.replace(/Ñ/g,'\321');
texte = texte.replace(/Ò/g,'\322');
texte = texte.replace(/Ó/g,'\323');
texte = texte.replace(/Ô/g,'\324');
texte = texte.replace(/Õ/g,'\325');
texte = texte.replace(/Ö/g,'\326');
texte = texte.replace(/Ø/g,'\330');
texte = texte.replace(/Ù/g,'\331');
texte = texte.replace(/Ú/g,'\332');
texte = texte.replace(/Û/g,'\333');
texte = texte.replace(/Ü/g,'\334');
texte = texte.replace(/Ý/g,'\335');
texte = texte.replace(/Þ/g,'\336');
texte = texte.replace(/ß/g,'\337');
texte = texte.replace(/à/g,'\340');
texte = texte.replace(/á/g,'\341');
texte = texte.replace(/â/g,'\342');
texte = texte.replace(/ã/g,'\343');
texte = texte.replace(/ä/g,'\344');
texte = texte.replace(/å/g,'\345');
texte = texte.replace(/æ/g,'\346');
texte = texte.replace(/ç/g,'\347');
texte = texte.replace(/è/g,'\350');
texte = texte.replace(/é/g,'\351');
texte = texte.replace(/ê/g,'\352');
texte = texte.replace(/ë/g,'\353');
texte = texte.replace(/ì/g,'\354');
texte = texte.replace(/í/g,'\355');
texte = texte.replace(/î/g,'\356');
texte = texte.replace(/ï/g,'\357');
texte = texte.replace(/ð/g,'\360');
texte = texte.replace(/ñ/g,'\361');
texte = texte.replace(/ò/g,'\362');
texte = texte.replace(/ó/g,'\363');
texte = texte.replace(/ô/g,'\364');
texte = texte.replace(/õ/g,'\365');
texte = texte.replace(/ö/g,'\366');
texte = texte.replace(/ø/g,'\370');
texte = texte.replace(/ù/g,'\371');
texte = texte.replace(/ú/g,'\372');
texte = texte.replace(/û/g,'\373');
texte = texte.replace(/ü/g,'\374');
texte = texte.replace(/ý/g,'\375');
texte = texte.replace(/þ/g,'\376');
texte = texte.replace(/ÿ/g,'\377');
return texte;
}
Array.prototype.findValue = function(name, value){
   var array = $j.map(this, function(v,i){
        var haystack = v[name];
        var needle = new RegExp(value);
        // check for string in haystack
        // return the matched item if true, or null otherwise
      return needle.test(haystack) ? v : null;
   });
  return this;
}
function windowLaunchInterface(rel) {
	Ext.MessageBox.show({
    	title:window.SUPPRIMERCONFIRMATION_TITRE,
		msg: window.SUPPRIMERCONFIRMATION_MESSAGE,
		buttons: Ext.MessageBox.YESNO,
		fn: function(btn, text) {
        	if(btn=='yes') {
	        	$j.gritter.add({title: 'Bestätigung',text: 'Die Schnittstelle wurde ausgeführt',image: '_img/notification/ok.png',sticky: false, time: '4000'});
				Ext.Ajax.request({ 
					waitMsg: 'Patientez',
					url: rel, 
					success: function (result,request) {
						window.bgTaskToken=makeid();
						//executeQuery_checkBgTask(false, window.bgTaskToken);
						$j('#asyncProgressBarWrapper').css('display','block');
						executeQuery_checkBgTask(true, window.bgTaskToken);
					}
				});						           
        	}
    	},
		icon: Ext.MessageBox.QUESTION
    });
}
function window_myDiese_editer(idMyDiese,idContact,store) {
	
	var formPanelAccesMyDieseEditer = new Ext.FormPanel({
	
		bodyStyle: 'padding: 15px;border:none',
		defaultType: 'textfield',      
		id:'formPanelAccesMyDieseEditerId', 
		labelWidth:200,
		method: 'POST',
		items: [
			new Ext.form.FieldSet({
				collapsible: false,
				title: 'Allgemeine Informationen',
				autoHeight: true,
				items: [
					{
						xtype:'datefieldplus',
						name:'formPanelAccesMyDieseEditer_debut',
						id:'formPanelAccesMyDieseEditer_debutId',
						fieldLabel:'Anfangsdatum',
						format:'d-m-Y',
						submitFormat:'Y-m-d',
						width:200,
                        cls: 'mandatory',
						listeners:{
							select:function(thisCustom) {
								var dateCustom = thisCustom.activeDate;
								Ext.getCmp('formPanelAccesMyDieseEditer_finId').setMinValue(dateCustom);
							}
						}
					},{
						xtype:'datefieldplus',
						name:'formPanelAccesMyDieseEditer_fin',
						id:'formPanelAccesMyDieseEditer_finId',
						fieldLabel:'Ende',
						format:'d-m-Y',
						submitFormat:'Y-m-d',
						width:200,
                        cls: 'mandatory',
						listeners:{
							select:function(thisCustom) {
								var dateCustom = thisCustom.activeDate;
								Ext.getCmp('formPanelAccesMyDieseEditer_debutId').setMaxValue(dateCustom);
							}
						}
					},
					new Ext.form.ComboBox({
						hiddenName: 'formPanelAccesMyDieseEditer_emailConnexion', 
						id: 'formPanelAccesMyDieseEditer_emailConnexionId',
						width:'90%',
                        diesev3: true,
                        cls: 'mandatory',
						hideOnSelect:false,
						store:new Ext.data.JsonStore({
							proxy: new Ext.data.HttpProxy({
								url: '_datasMysql/store_emailsContact.php?idContact='+idContact
							}),    
							remoteSort: true,
							autoLoad: false,
							fields : ['id','valeur']
						}),
						triggerAction:'all',
						fieldLabel:'Email',
						valueField:'valeur',
						minChars:1,
						emptyText:'Bitte wählen Sie oder geben Sie eine E-mail ein',
						queryParam:'term',
						displayField:'valeur',
						mode:'remote',
						forceSelectionCustom:false
					}),
                    new Ext.form.ComboBox({
                        hiddenName: 'formPanelAccesMyDieseEditer_langue',
                        id: 'formPanelAccesMyDieseEditer_langueId',
                        width: '90%',
                        diesev3: true,
                        hideOnSelect: false,
                        store: new Ext.data.JsonStore({
                            proxy: new Ext.data.HttpProxy({
                                url: '_datasMysql/store_langues_diese.php'
                            }),
                            remoteSort: true,
                            autoLoad: false,                            
                            fields: [{name: 'code', type: 'string'}, 'intitule']
                        }),
                        triggerAction: 'all',
                        valueField: 'code',
                        minChars: 1,
                        fieldLabel: 'Sprache',
                        queryParam: 'term',
                        displayField: 'intitule',
                        mode: 'remote',
                        forceSelection: false
                    })
				]
			}),
			new Ext.form.FieldSet({
				collapsible: false,
				title: 'Parameter',
	// 			autoHeight: true,
				items: [
					new Ext.TabPanel({
	    				activeTab: 0,
	    				plain: true,
	    				deferredRender: false,
	    				height:500,
                        cls: 'noWhiteTabs',
	    				items: [{
	        				title: 'Aktionen und Ansichten',
                            style: 'background-color:#F9FBFD',
	        				items: [
	        					new Ext.Panel ({
	        						layout: 'form',
	        						padding: 5,
	        						items: [
		        						new Ext.form.FieldSet({
											collapsible: false,
											title: 'Personalplanung',
											autoHeight: true,
											items: [
												new Ext.form.ComboBox({
													hiddenName: 'formPanelAccesMyDieseEditer_profil', 
													id: 'formPanelAccesMyDieseEditer_profilId',
													width:'90%',
                                                    diesev3: true,
													hideOnSelect:false,
													store:new Ext.data.JsonStore({
														proxy: new Ext.data.HttpProxy({
															url: '_datasMysql/store_profils_mydiese.php'
														}),    
														remoteSort: false,
														autoLoad: true,
														fields : ['id','intitule']
													}),
													triggerAction:'all',
													fieldLabel:'Personalplanung profile',
													valueField:'id',
													minChars:1,
													emptyText:'wählen ...',
													queryParam:'term',
													displayField:'intitule',
													mode:'remote',
													forceSelection:false
												}),
												new Ext.ux.form.LovCombo({
													hiddenName: 'formPanelAccesMyDieseEditer_docs', 
													id: 'formPanelAccesMyDieseEditer_docsId',
													width:'90%',
                                                    diesev3: true,
													hideOnSelect:false,
													store:new Ext.data.JsonStore({
														proxy: new Ext.data.HttpProxy({
															url: '_datasMysql/stores_templatesMydiese.php'
														}),    
														remoteSort: true,
														autoLoad: true,
														fields : ['id','intitule']
													}),
													triggerAction:'all',
													fieldLabel:'Dokument(e)',
													valueField:'id',
                                                    separator:';',
													minChars:1,
													emptyText:'wählen ...',
													queryParam:'term',
													displayField:'intitule',
													mode:'local',
													forceSelection:false
												}),
												new Ext.ux.form.LovCombo({
													hiddenName: 'formPanelAccesMyDieseEditer_typesAbsences', 
													id: 'formPanelAccesMyDieseEditer_typesAbsencesId',
													width:'90%',
                                                    separator: ';',
                                                    diesev3: true,
													hideOnSelect:false,
													store:new Ext.data.JsonStore({
														proxy: new Ext.data.HttpProxy({
															url: '_datasMysql/store_typeAbsences.php'
														}),    
														remoteSort: false,
														autoLoad: false,
														fields : ['id','intitule']
													}),
                                                    /* listeners: {
                                                        select: function(combo, record, index) {
                                                            (function() {
                                                                var displayValue = combo.getRawValue();
                                                                
                                                                if (displayValue && displayValue.indexOf(',') !== -1) {
                                                                    var newDisplayValue = displayValue.replace(/,/g, ';');
                                                                    
                                                                    combo.setRawValue(newDisplayValue);
                                                                }
                                                                
                                                                console.log('Valeur affichée modifiée:', combo.getRawValue());
                                                                console.log('Valeur réelle (IDs):', combo.getValue());
                                                                
                                                            }).defer(10);
                                                        },
                                                        
                                                        blur: function(combo) {
                                                            var displayValue = combo.getRawValue();
                                                            if (displayValue && displayValue.indexOf(',') !== -1) {
                                                                var newDisplayValue = displayValue.replace(/,/g, ';');
                                                                combo.setRawValue(newDisplayValue);
                                                            }
                                                        }
                                                    }, */
													triggerAction:'all',
													fieldLabel:'Typ von Abwesenheit',
													valueField:'id',
													minChars:1,
													emptyText:'wählen ...',
													queryParam:'term',
													displayField:'intitule',
													mode:'local',
													forceSelection:false
												}), 
												new Ext.form.ComboBox({
													hiddenName: 'formPanelAccesMyDieseEditer_valideur', 
													id: 'formPanelAccesMyDieseEditer_valideurId',
													width:'90%',
                                                    diesev3: true,
													hideOnSelect:false,
													store:new Ext.data.JsonStore({
														proxy: new Ext.data.HttpProxy({
															url: '_datasMysql/store_groupesUtilisateurs_utilisateurs.php'
														}),    
														remoteSort: false,
														autoLoad: true,
														fields : ['id','intitule']
													}),
													triggerAction:'all',
													fieldLabel:'Bestätiger',
													valueField:'id',
													minChars:1,
													emptyText:'wählen ...',
													queryParam:'term',
													displayField:'intitule',
													mode:'remote',
													forceSelection:false
												}),
												{
													xtype:'checkbox',
													id:'formPanelAccesMyDieseEditer_LimitPlanningPublieId',
													name:'formPanelAccesMyDieseEditer_LimitPlanningPublie',
													fieldLabel:'Nur veröffentliche Spielplandaten',
													style: {
														marginBottom: '6px',
														marginTop: '6px',
													}
												},{
													xtype:'checkbox',
													id:'formPanelAccesMyDieseEditer_nePasAfficherHeuresId',
													name:'formPanelAccesMyDieseEditer_nePasAfficherHeures',
													fieldLabel:'Stunden ausblenden',
													style: {
														marginBottom: '6px',
														marginTop: '6px',
													}
												}		
											]}),
											new Ext.form.FieldSet({
											collapsible: false,
											title: 'Module',
											autoHeight: true,
											items: [
			        							{
													xtype:'checkbox',
													id:'formPanelAccesMyDieseEditer_afficherProductionId',
													name:'formPanelAccesMyDieseEditer_afficherProduction',
													fieldLabel:'Veranstaltungen erreichen',
													style: {
														marginBottom: '6px',
														marginTop: '6px',
													}
												},{
													xtype:'checkbox',
													id:'formPanelAccesMyDieseEditer_afficherContactId',
													name:'formPanelAccesMyDieseEditer_afficherContact',
													fieldLabel:'Kontakte erreichen',
													style: {
														marginBottom: '6px',
														marginTop: '6px',
													}
												},											]})
	        						]
	        					})				
	        				]
	    				},{
	        				title: 'Zugriffsrechte',
                            style: 'background-color:#F9FBFD',
	        				items: [
	        					new Ext.Panel ({
	        						layout: 'form',
	        						padding: 5,
	        						height:210,
	        						items: [
										new Ext.ux.form.LovCombo({
											hiddenName: 'formPanelAccesMyDieseEditer_groupeDroit', 
											id: 'formPanelAccesMyDieseEditer_groupeDroitId',
											width:'90%',
                                            diesev3: true,
											hideLabel:true,
											hideCheckAll:true,
											hideOnSelect:false,
											store:new Ext.data.JsonStore({
												proxy: new Ext.data.HttpProxy({
													url: '_datasMysql/store_groupesUtilisateurs.php'
												}),    
												remoteSort: false,
												autoLoad: false,
												fields : ['id','intitule'],
												listeners: {
													load:function(e) {
														idGroupes = Ext.getCmp('formPanelAccesMyDieseEditer_groupeDroitId').getValue();
														idGroupes = idGroupes.split(',');
														
														idGroupes.forEach(function(element) {
															$j("#checkbox_formPanelAccesMyDieseEditer_groupeDroitId_"+element).trigger( "click" );
														})
													}
												}
											}),
											triggerAction:'all',
											fieldLabel:"[droit]",
											valueField:'id',
											minChars:1,
											emptyText:'wählen ...',
											queryParam:'term',
											displayField:'intitule',
											mode:'local',
											forceSelection:false,
											listeners:{
												afterrender:function(e) {
													comboMultiCustomList('formPanelAccesMyDieseEditer_groupeDroitId',198,false);
												},
											}
										}), 
	        						]
	        					})
	
	        				]
	    				}]
					})
				]
			})
		]
										             
	});
	editerAccesMyDiese_window = new Ext.Window({
    	title: 'Diesen Zugriff bearbeiten',
    	closable:true,
    	draggable:true,
    	modal:true,
		resizable:false,	
    	plain:true,
        frichtee:true,
        frichtee_minWidth:$j(window).width()/2,
        listeners: {
            render: function(thisCustom) {
                setTimeout(() => {
                    navigation('editerAccesMyDiese_windowId', 'btnEditerMyDiese',thisCustom);
                    setFocusOnFirstField('editerAccesMyDiese_windowId', true);
                }, 250);
            },
        },
        bbar: 
        [
            {
                text: 'Änderungen speichern',
                disabled:'true',
                iconCls:'save',
                id:'btnEditerMyDiese',
                handler: function() {
                    thisCustom = this;
                    
                    var messageErreur='';
                    if(Ext.getCmp('formPanelAccesMyDieseEditer_debutId').getValue()=='') {
                        var messageErreur = messageErreur + 'Anfangsdatum ist pflichtfeld.

