window.globalAltDown=false; window.CPA_cancelAlertButton=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.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:'Informations générales', baseCls: 'x-plain', items: [ new Ext.form.FieldSet({ labelWidth:150, collapsible: false, title: 'Informations générales', 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: 'Groupe d\'élément', emptyText:'Choix...', 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: 'Elément', emptyText:'Choix...', 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: 'Valeur', 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: 'Période', emptyText:'Choix...', 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:'Choix...', queryParam:'term', minChars: 2, tpl: '
{code_budget}
', displayField:'code_budget', fieldLabel:'Poste budgétaire', mode:'remote', }), new Ext.form.ComboBox({ hiddenName: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetType', id: 'formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_budgetTypeId', width:350, hideOnSelect:false, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_budgetItemType.php' }), remoteSort: true, autoLoad: true, fields : [{type:'int', name:'id'},'intitule'], }), triggerAction:'all', valueField:'id', minChars:1, fieldLabel: 'Type d\'imputation', emptyText:'Choix...', queryParam:'term', displayField:'intitule', mode:'remote', forceSelection:false, }) ] }), new Ext.form.FieldSet({ collapsible: false, hidden:true, id:'classifElement_module_2Id', labelWidth:150, title: 'Description', autoHeight: true, items: [ { xtype:'htmleditor', fieldLabel: 'Matière / Matter', name: 'classifElement_editer_1_textarea', id: 'classifElement_editer_1__id_element', width:200, height:80, listeners: { render: function () { this.getToolbar().hide(); } } }, { xtype:'textfield', fieldLabel: 'Colori / Color', name: 'classifElement_editer_2_textfield', id: 'classifElement_editer_2__id_element', width:200, listeners: { render:function() { } } }, new Ext.form.ComboBox({ hiddenName: 'classifElement_editer_22_combobox', id: 'classifElement_editer_22__id_element', width:200, disabled:boolInput_droits_readOnly, hideOnSelect:false, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_classif_combobox_elements.php?idChamp=22' }), remoteSort: true, autoLoad: true, fields : [{type:'int', name:'id'},'intitule'] }), triggerAction:'all', valueField:'id', minChars:1, queryParam:'term', displayField:'intitule', fieldLabel:'Entretien', mode:'remote', forceSelection:false, listeners: { render:function() { } } }), ] }), new Ext.form.FieldSet({ collapsible: false, hidden:true, id:'classifElement_module_8Id', labelWidth:150, title: 'Précisions', autoHeight: true, items: [ { xtype:'checkbox', fieldLabel: 'Consommable ?', name: 'classifElement_editer_4_checkbox', id: 'classifElement_editer_4__id_element', width:200, inputValue:1, listeners: { render:function() { } } }, new Ext.ux.form.LovCombo({ hiddenName: 'classifElement_editer_5_multichoix', id: 'classifElement_editer_5__id_element', width:200, separator:';', hideOnSelect:false, disabled:boolInput_droits_readOnly, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_classif_combobox_elements.php?idChamp=5' }), remoteSort: true, autoLoad: true, fields : ['id','intitule'], }), triggerAction:'all', valueField:'id', minChars:1, queryParam:'term', displayField:'intitule', fieldLabel:'Mise', mode:'remote', forceSelection:false, listeners: { render:function() { } } }), { xtype:'textfield', fieldLabel: 'Matière', name: 'classifElement_editer_21_textfield', id: 'classifElement_editer_21__id_element', width:200, listeners: { render:function() { } } }, { xtype:'textfield', fieldLabel: 'Colori', name: 'classifElement_editer_6_textfield', id: 'classifElement_editer_6__id_element', width:200, listeners: { render:function() { } } }, { xtype:'htmleditor', fieldLabel: 'Instructions de préparation', name: 'classifElement_editer_7_textarea', id: 'classifElement_editer_7__id_element', width:200, height:80, listeners: { render: function () { this.getToolbar().hide(); } } }, { xtype:'htmleditor', fieldLabel: 'Référence', name: 'classifElement_editer_8_textarea', id: 'classifElement_editer_8__id_element', width:200, height:80, listeners: { render: function () { this.getToolbar().hide(); } } }, ] }), new Ext.form.FieldSet({ collapsible: false, hidden:true, id:'classifElement_module_810Id', labelWidth:150, title: 'Dimensions', autoHeight: true, items: [ { xtype:'numberfield', fieldLabel: 'Longueur (en cm)', name: 'classifElement_editer_9_numberfield', id: 'classifElement_editer_9__id_element', width:200, listeners: { render:function() { } } }, { xtype:'numberfield', fieldLabel: 'Hauteur (en cm)', name: 'classifElement_editer_10_numberfield', id: 'classifElement_editer_10__id_element', width:200, listeners: { render:function() { } } }, { xtype:'numberfield', fieldLabel: 'Largeur (en cm)', name: 'classifElement_editer_11_numberfield', id: 'classifElement_editer_11__id_element', width:200, listeners: { render:function() { } } }, { xtype:'numberfield', fieldLabel: 'Diamètre (en cm)', name: 'classifElement_editer_12_numberfield', id: 'classifElement_editer_12__id_element', width:200, listeners: { render:function() { } } }, { xtype:'numberfield', fieldLabel: 'Poids', name: 'classifElement_editer_13_numberfield', id: 'classifElement_editer_13__id_element', width:200, listeners: { render:function() { } } }, { xtype:'numberfield', fieldLabel: 'Volume en m3', name: 'classifElement_editer_20_numberfield', id: 'classifElement_editer_20__id_element', width:200, listeners: { render:function() { } } }, ] }), new Ext.form.FieldSet({ collapsible: false, hidden:true, id:'classifElement_module_9Id', labelWidth:150, title: 'Caractéristiques perruque', autoHeight: true, items: [ { xtype:'textfield', fieldLabel: 'Couleur', name: 'classifElement_editer_15_textfield', id: 'classifElement_editer_15__id_element', width:200, listeners: { render:function() { } } }, { xtype:'textfield', fieldLabel: 'Style', name: 'classifElement_editer_16_textfield', id: 'classifElement_editer_16__id_element', width:200, listeners: { render:function() { } } }, { xtype:'numberfield', fieldLabel: 'Longueur', name: 'classifElement_editer_17_numberfield', id: 'classifElement_editer_17__id_element', width:200, listeners: { render:function() { } } }, { xtype:'textfield', fieldLabel: 'Matière', name: 'classifElement_editer_18_textfield', id: 'classifElement_editer_18__id_element', width:200, listeners: { render:function() { } } }, { xtype:'textfield', fieldLabel: 'Référence produit', name: 'classifElement_editer_19_textfield', id: 'classifElement_editer_19__id_element', width:200, listeners: { render:function() { } } }, ] }), ], buttons: [{ text: 'Valider les modifications', id:'btnSubmit_dblClick_elementsFicheEditorGrid_contratId', disabled:boolInput_droits_readOnly, handler: function(){ var messageErreur='' /* if(Ext.getCmp('formPanelgridFichestFieldSetListingEditorGrid_modifierFieldSet_typesProductionId').getValue()=='') { var messageErreur = messageErreur + 'Le type n\'est pas renseigné
'; } */ if(messageErreur!='') { $j.gritter.add({title: 'Erreur',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(), classifElement_4: Ext.getCmp('classifElement_editer_4__id_element').getValue(), classifElement_5: Ext.getCmp('classifElement_editer_5__id_element').getValue(), classifElement_6: Ext.getCmp('classifElement_editer_6__id_element').getValue(), classifElement_7: Ext.getCmp('classifElement_editer_7__id_element').getValue(), classifElement_8: Ext.getCmp('classifElement_editer_8__id_element').getValue(), classifElement_9: Ext.getCmp('classifElement_editer_9__id_element').getValue(), classifElement_10: Ext.getCmp('classifElement_editer_10__id_element').getValue(), classifElement_11: Ext.getCmp('classifElement_editer_11__id_element').getValue(), classifElement_12: Ext.getCmp('classifElement_editer_12__id_element').getValue(), classifElement_13: Ext.getCmp('classifElement_editer_13__id_element').getValue(), classifElement_15: Ext.getCmp('classifElement_editer_15__id_element').getValue(), classifElement_16: Ext.getCmp('classifElement_editer_16__id_element').getValue(), classifElement_17: Ext.getCmp('classifElement_editer_17__id_element').getValue(), classifElement_18: Ext.getCmp('classifElement_editer_18__id_element').getValue(), classifElement_19: Ext.getCmp('classifElement_editer_19__id_element').getValue(), classifElement_20: Ext.getCmp('classifElement_editer_20__id_element').getValue(), classifElement_21: Ext.getCmp('classifElement_editer_21__id_element').getValue(), classifElement_22: Ext.getCmp('classifElement_editer_22__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 store = Ext.getCmp('classifElement_editer_22__id_element').getStore(); store.load({callback:function() { ComboSetterCustom(Ext.getCmp('classifElement_editer_22__id_element'),parseInt(reponse.data.classifElement_22_combobox),false); }}); 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.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:'Choix...', 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(), idCentre4:Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire4Id').getValue(), idCentre5:Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire5Id').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+' résultat(s) (cliquez pour sélectionner)'); $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 effectuée',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('Aucun résultat trouvé'); $j('#formPanelGridComboBudgetItem_innerDroiteFieldSetTitre').empty().append('Résultats de la recherche'); } } }); } 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: '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: 'Centres budgétaires', 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:'Nature', 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_centreDirections', checkDroit3:1, idCS:2 }, remoteSort: true, autoLoad: false, fields : [{type:'int', name:'id'},'intitule'] }), triggerAction:'all', valueField:'id', minChars:1, queryParam:'term', displayField:'intitule', fieldLabel:'Direction', 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_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:'Production', mode:'remote', listeners:{ select:function() { formPanelGridComboBudgetItem_majDivDroite(idEcheance); }, } }), new Ext.form.ComboBox({ name:'formPanelGridComboBudgetItem_posteBudgetaire4', id:'formPanelGridComboBudgetItem_posteBudgetaire4Id', width:240, hideOnSelect:false, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_centreBudgetaires.php' }), baseParams:{ table:'budget_centreService', checkDroit3:1, idCS:3 }, remoteSort: true, autoLoad: false, fields : [{type:'int', name:'id'},'intitule'] }), triggerAction:'all', valueField:'id', minChars:1, queryParam:'term', displayField:'intitule', fieldLabel:'Service', mode:'remote', listeners:{ select:function() { formPanelGridComboBudgetItem_majDivDroite(idEcheance); }, } }), new Ext.form.ComboBox({ name:'formPanelGridComboBudgetItem_posteBudgetaire5', id:'formPanelGridComboBudgetItem_posteBudgetaire5Id', width:240, hideOnSelect:false, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_centreBudgetaires.php' }), baseParams:{ table:'budget_centreLieux', checkDroit3:1, idCS:4 }, remoteSort: true, autoLoad: false, fields : [{type:'int', name:'id'},'intitule'] }), triggerAction:'all', valueField:'id', minChars:1, queryParam:'term', displayField:'intitule', fieldLabel:'Lieu', 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: 'Résultats de la recherche', autoHeight: true, items: [ { xtype:'displayfield', value:'
Utilisez les filtres ci-contre pour rechercher un poste budgétaire
', hideLabel:true } ] }) ] } ] }); window_GridBudgetItem = new Ext.Window({ title: 'Rechercher un poste budgétaire', closable:true, draggable:true, modal:true, width: 700, resizable:false, height: 450, plain:true, layout: 'fit', id: 'window_GridBudgetItemId', items: formPanelGridComboBudgetItem, listeners:{ show:function() { //Ext.getCmp(idCombo).getStore().load(); } }, tbar:[ { text:'RAZ', iconCls:'erase', handler:function() { Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire1Id').setValue(''); Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire2Id').setValue(''); Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire3Id').setValue(''); Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire4Id').setValue(''); Ext.getCmp('formPanelGridComboBudgetItem_posteBudgetaire5Id').setValue(''); $j('#formPanelGridComboBudgetItem_innerDroiteDiv').empty().append('Utilisez les filtres ci-contre pour rechercher un poste budgétaire'); $j('#formPanelGridComboBudgetItem_innerDroiteFieldSetTitre').empty().append('Résultats de la recherche'); } } ] }).show(); }); }, 500); } } }); gridEcheances_CM = new Ext.grid.ColumnModel( [{ header: 'Date', sortable: true, editor:new Ext.form.DateField({ allowBlank: false, format:'d-m-Y', }), dataIndex: 'date', width: 100, }, { header: 'Montant', sortable: true, editor:new Ext.form.NumberField({ allowBlank: false, allowDecimals:true, }), dataIndex: 'montant', width: 80, },{ header: '%', sortable: false, dataIndex: 'pourcentage', editor:new Ext.form.NumberField({ allowBlank: false, allowDecimals:true, }), width: 60 },{ header: 'Analytique', sortable: false, editor:comboBudgetItem, dataIndex: 'analytique', width: 230 }, { header: ' ', sortable: false, dataIndex: 'loupe', width: 30, renderer:function(value, metaData, record, rowIndex, colIndex, store) { return ''; } },{ header: 'Note', 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:'Echéancier', 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:'Ajouter', 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:'Supprimer', iconCls:'delete', 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:'Demande de confirmation', msg: 'Etes-vous sûr(e) ?', 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: 'Confirmation',text: 'Suppression(s) effectuée(s)',image: '_img/notification/ok.png',sticky: false, time: '1000'}); } }); } }, icon: Ext.MessageBox.QUESTION }); //} } }, { text:'Affecter le solde', 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: 'Confirmation',text: 'Modification effectuée',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, 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: 'Confirmation',text: 'Modification effectuée',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: 'Modifier un élément', closable:true, draggable:true, modal:true, width: 720, 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: 'Confirmation',text: 'Interface lançée ou exécutée',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: 'Informations générales', autoHeight: true, items: [ { xtype:'datefieldplus', name:'formPanelAccesMyDieseEditer_debut', id:'formPanelAccesMyDieseEditer_debutId', fieldLabel:'Date de début', format:'d-m-Y', submitFormat:'Y-m-d', width:200, listeners:{ select:function(thisCustom) { var dateCustom = thisCustom.activeDate; Ext.getCmp('formPanelAccesMyDieseEditer_finId').setMinValue(dateCustom); } } },{ xtype:'datefieldplus', name:'formPanelAccesMyDieseEditer_fin', id:'formPanelAccesMyDieseEditer_finId', fieldLabel:'Date de fin', format:'d-m-Y', submitFormat:'Y-m-d', width:200, 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:400, 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:'Sélectionnez ou tapez un email', queryParam:'term', displayField:'valeur', mode:'remote', forceSelectionCustom:false }) ] }), new Ext.form.FieldSet({ collapsible: false, title: 'Paramètres', // autoHeight: true, items: [ new Ext.TabPanel({ activeTab: 0, plain: true, deferredRender: false, height:500, items: [{ title: 'Actions et vues', items: [ new Ext.Panel ({ layout: 'form', padding: 5, items: [ new Ext.form.FieldSet({ collapsible: false, title: 'GTA', autoHeight: true, items: [ new Ext.form.ComboBox({ hiddenName: 'formPanelAccesMyDieseEditer_profil', id: 'formPanelAccesMyDieseEditer_profilId', width:400, 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:'Profil GTA', valueField:'id', minChars:1, emptyText:'Choix...', queryParam:'term', displayField:'intitule', mode:'remote', forceSelection:false }), new Ext.ux.form.LovCombo({ hiddenName: 'formPanelAccesMyDieseEditer_docs', id: 'formPanelAccesMyDieseEditer_docsId', width:400, 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:'Document(s)', valueField:'id', separator:';', minChars:1, emptyText:'Choix...', queryParam:'term', displayField:'intitule', mode:'local', forceSelection:false }), new Ext.ux.form.LovCombo({ hiddenName: 'formPanelAccesMyDieseEditer_typesAbsences', id: 'formPanelAccesMyDieseEditer_typesAbsencesId', width:400, hideOnSelect:false, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_typeAbsences.php' }), remoteSort: false, autoLoad: false, fields : ['id','intitule'] }), triggerAction:'all', fieldLabel:'Types absence/présence', valueField:'id', minChars:1, emptyText:'Choix...', queryParam:'term', displayField:'intitule', mode:'local', forceSelection:false }), new Ext.form.ComboBox({ hiddenName: 'formPanelAccesMyDieseEditer_valideur', id: 'formPanelAccesMyDieseEditer_valideurId', width:400, 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:'Valideur', valueField:'id', minChars:1, emptyText:'Choix...', queryParam:'term', displayField:'intitule', mode:'remote', forceSelection:false }), { xtype:'checkbox', id:'formPanelAccesMyDieseEditer_LimitPlanningPublieId', name:'formPanelAccesMyDieseEditer_LimitPlanningPublie', fieldLabel:'Planning publié seulement', style: { marginBottom: '6px', marginTop: '6px', } },{ xtype:'checkbox', id:'formPanelAccesMyDieseEditer_nePasAfficherHeuresId', name:'formPanelAccesMyDieseEditer_nePasAfficherHeures', fieldLabel:'Ne pas afficher les heures', style: { marginBottom: '6px', marginTop: '6px', } } ]}), new Ext.form.FieldSet({ collapsible: false, title: 'Menus', autoHeight: true, items: [ { xtype:'checkbox', id:'formPanelAccesMyDieseEditer_afficherProductionId', name:'formPanelAccesMyDieseEditer_afficherProduction', fieldLabel:'Accès production', style: { marginBottom: '6px', marginTop: '6px', } },{ xtype:'checkbox', id:'formPanelAccesMyDieseEditer_afficherContactId', name:'formPanelAccesMyDieseEditer_afficherContact', fieldLabel:'Accès contact', style: { marginBottom: '6px', marginTop: '6px', } }, ]}) ] }) ] },{ title: 'Droits', items: [ new Ext.Panel ({ layout: 'form', padding: 5, height:210, items: [ new Ext.ux.form.LovCombo({ hiddenName: 'formPanelAccesMyDieseEditer_groupeDroit', id: 'formPanelAccesMyDieseEditer_groupeDroitId', width:400, 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:'Choix...', queryParam:'term', displayField:'intitule', mode:'local', forceSelection:false, listeners:{ afterrender:function(e) { comboMultiCustomList('formPanelAccesMyDieseEditer_groupeDroitId',198,false); }, } }), ] }) ] }] }) ] }) ], buttons: [{ text: 'Annuler', handler: function() { editerAccesMyDiese_window.close(); }, iconCls:'delete' },{ text: 'Sauvegarder les modifications', disabled:'true', handler: function(thisCustom) { var messageErreur=''; if(Ext.getCmp('formPanelAccesMyDieseEditer_debutId').getValue()=='') { var messageErreur = messageErreur + 'Le champ début est obligatoire.
'; } if(Ext.getCmp('formPanelAccesMyDieseEditer_finId').getValue()=='') { var messageErreur = messageErreur + 'Le champ fin est obligatoire.
'; } if(Ext.getCmp('formPanelAccesMyDieseEditer_emailConnexionId').getValue()=='') { var messageErreur = messageErreur + 'Le champ email de connexion est obligatoire.
'; } if(messageErreur!='') { $j.gritter.add({title: 'Erreur',text: messageErreur,image: '_img/notification/ko.png',sticky: false, time: '1000'}); } else { thisCustom.enableLoader(); Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/accesMyDiese_checkDoublonPeriode.php', params: { email: Ext.getCmp('formPanelAccesMyDieseEditer_emailConnexionId').getValue(), idContact:idContact, debut:Ext.getCmp('formPanelAccesMyDieseEditer_debutId').getValueSubmitFormat(), fin:Ext.getCmp('formPanelAccesMyDieseEditer_finId').getValueSubmitFormat(), }, success: function (result,request) { if(result.responseText=='ko') { $j.gritter.add({title: 'Erreur',text: 'Un accès avec cet email existe déjà.',image: '_img/notification/ko.png',sticky: false, time: '2000'}); thisCustom.disableLoader(); } else if(result.responseText=='ko2') { $j.gritter.add({title: 'Erreur',text: 'Vous avez atteint le maximum de comptes myDiese autorisés. Merci de contacter votre administrateur.',image: '_img/notification/ko.png',sticky: false, time: '2000'}); thisCustom.disableLoader(); } else { formPanelAccesMyDieseEditer.getForm().submit({ clientValidation: true, url: '_ajax/editerAccesMyDiese.php', params:{ id:idMyDiese, idContact:idContact, dateDebut:Ext.getCmp('formPanelAccesMyDieseEditer_debutId').getValueSubmitFormat(), dateFin:Ext.getCmp('formPanelAccesMyDieseEditer_finId').getValueSubmitFormat(), }, success: function(form, action) { $j.gritter.add({title: 'Confirmation',text: 'Ajout effectué',image: '_img/notification/ok.png',sticky: false, time: '2000'}); store.reload(); editerAccesMyDiese_window.close(); } }); } } }); } }, iconCls:'save', id:'btnEditerMyDiese' }] }); editerAccesMyDiese_window = new Ext.Window({ title: 'Editer cet accès', closable:true, draggable:true, modal:true, width: 750, resizable:false, height: 870, plain:true, id: 'editerAccesMyDiese_windowId', items: formPanelAccesMyDieseEditer }).show(); formPanelAccesMyDieseEditer.getForm().load({ url: '_datasMysql/form_editerAccesMyDiese.php', params: { id: idMyDiese }, success:function(form,action) { // inception de callback des stores du compte MyDiese // --profils var store = Ext.getCmp('formPanelAccesMyDieseEditer_profilId').getStore(); store.load({callback:function() { Ext.getCmp('formPanelAccesMyDieseEditer_profilId').setValue(action.result.data.idProfil); // --docs var store = Ext.getCmp('formPanelAccesMyDieseEditer_docsId').getStore(); store.load({callback:function() { Ext.getCmp('formPanelAccesMyDieseEditer_docsId').setValue(action.result.data.templates); // --absences var store = Ext.getCmp('formPanelAccesMyDieseEditer_typesAbsencesId').getStore(); store.load({callback:function() { Ext.getCmp('formPanelAccesMyDieseEditer_typesAbsencesId').setValue(action.result.data.typesAbsences); // --valideur var store = Ext.getCmp('formPanelAccesMyDieseEditer_valideurId').getStore(); store.load({callback:function() { Ext.getCmp('formPanelAccesMyDieseEditer_valideurId').setValue(action.result.data.idUserValideur); // -- groupes de droit var store = Ext.getCmp('formPanelAccesMyDieseEditer_groupeDroitId').getStore(); store.load({callback:function() { Ext.getCmp('formPanelAccesMyDieseEditer_groupeDroitId').setValue(action.result.data.groupeDroit); Ext.getCmp('formPanelAccesMyDieseEditer_groupeDroitId').getStore().reload(); // --On rend accessible le bouton de sauvegarde du compte une fois que tout est bien loadé Ext.getCmp('btnEditerMyDiese').setDisabled(false); }}); }}); }}); }}); }}); } }); } function nl2br (str, is_xhtml) { if (typeof str === 'undefined' || str === null) { return ''; } var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '
' : '
'; return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'); } function isValidDate(dateString) { var regEx = /^\d{4}-\d{2}-\d{2}$/; if(!dateString.match(regEx)) return false; // Invalid format var d = new Date(dateString); var dNum = d.getTime(); if(!dNum && dNum !== 0) return false; // NaN value, Invalid date return d.toISOString().slice(0,10) === dateString; } function validateHhMm(value) { if(value=='24:00') { return false; } var isValid = /^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$/.test(value); return isValid; } function isBic(value) { var bic = value.replace( / /g, "" ); if(bic=='') { return true; } if(/([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?/i.test( bic.toUpperCase() ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( bic.toUpperCase() )) { return true; } else { return false; } } /** * IBAN is the international bank account number. * It has a country - specific format, that is checked here too * * Validation is case-insensitive. Please make sure to normalize input yourself. */ function validIban(value) { if(value=='') { return true; } return IBAN.isValid(value); // Remove spaces and to upper case var iban = value.replace( / /g, "" ).toUpperCase(), ibancheckdigits = "", leadingZeroes = true, cRest = "", cOperator = "", countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p; if(iban=='') { return true; } // Check for IBAN code length. // It contains: // country code ISO 3166-1 - two letters, // two check digits, // Basic Bank Account Number (BBAN) - up to 30 chars var minimalIBANlength = 5; if ( iban.length < minimalIBANlength ) { return false; } // Check the country code and find the country specific format countrycode = iban.substring( 0, 2 ); bbancountrypatterns = { "AL": "\\d{8}[\\dA-Z]{16}", "AD": "\\d{8}[\\dA-Z]{12}", "AT": "\\d{16}", "AZ": "[\\dA-Z]{4}\\d{20}", "BE": "\\d{12}", "BH": "[A-Z]{4}[\\dA-Z]{14}", "BA": "\\d{16}", "BR": "\\d{23}[A-Z][\\dA-Z]", "BG": "[A-Z]{4}\\d{6}[\\dA-Z]{8}", "CR": "\\d{17}", "HR": "\\d{17}", "CY": "\\d{8}[\\dA-Z]{16}", "CZ": "\\d{20}", "DK": "\\d{14}", "DO": "[A-Z]{4}\\d{20}", "EE": "\\d{16}", "FO": "\\d{14}", "FI": "\\d{14}", "FR": "\\d{10}[\\dA-Z]{11}\\d{2}", "GE": "[\\dA-Z]{2}\\d{16}", "DE": "\\d{18}", "GI": "[A-Z]{4}[\\dA-Z]{15}", "GR": "\\d{7}[\\dA-Z]{16}", "GL": "\\d{14}", "GT": "[\\dA-Z]{4}[\\dA-Z]{20}", "HU": "\\d{24}", "IS": "\\d{22}", "IE": "[\\dA-Z]{4}\\d{14}", "IL": "\\d{19}", "IT": "[A-Z]\\d{10}[\\dA-Z]{12}", "KZ": "\\d{3}[\\dA-Z]{13}", "KW": "[A-Z]{4}[\\dA-Z]{22}", "LV": "[A-Z]{4}[\\dA-Z]{13}", "LB": "\\d{4}[\\dA-Z]{20}", "LI": "\\d{5}[\\dA-Z]{12}", "LT": "\\d{16}", "LU": "\\d{3}[\\dA-Z]{13}", "MK": "\\d{3}[\\dA-Z]{10}\\d{2}", "MT": "[A-Z]{4}\\d{5}[\\dA-Z]{18}", "MR": "\\d{23}", "MU": "[A-Z]{4}\\d{19}[A-Z]{3}", "MC": "\\d{10}[\\dA-Z]{11}\\d{2}", "MD": "[\\dA-Z]{2}\\d{18}", "ME": "\\d{18}", "NL": "[A-Z]{4}\\d{10}", "NO": "\\d{11}", "PK": "[\\dA-Z]{4}\\d{16}", "PS": "[\\dA-Z]{4}\\d{21}", "PL": "\\d{24}", "PT": "\\d{21}", "RO": "[A-Z]{4}[\\dA-Z]{16}", "SM": "[A-Z]\\d{10}[\\dA-Z]{12}", "SA": "\\d{2}[\\dA-Z]{18}", "RS": "\\d{18}", "SK": "\\d{20}", "SI": "\\d{15}", "ES": "\\d{20}", "SE": "\\d{20}", "CH": "\\d{5}[\\dA-Z]{12}", "TN": "\\d{20}", "TR": "\\d{5}[\\dA-Z]{17}", "AE": "\\d{3}\\d{16}", "GB": "[A-Z]{4}\\d{14}", "VG": "[\\dA-Z]{4}\\d{16}" }; bbanpattern = bbancountrypatterns[ countrycode ]; // As new countries will start using IBAN in the // future, we only check if the countrycode is known. // This prevents false negatives, while almost all // false positives introduced by this, will be caught // by the checksum validation below anyway. // Strict checking should return FALSE for unknown // countries. if ( typeof bbanpattern !== "undefined" ) { ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" ); if ( !( ibanregexp.test( iban ) ) ) { return false; // Invalid country specific format } } // Now check the checksum, first convert to digits ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 ); for ( i = 0; i < ibancheck.length; i++ ) { charAt = ibancheck.charAt( i ); if ( charAt !== "0" ) { leadingZeroes = false; } if ( !leadingZeroes ) { ibancheckdigits += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf( charAt ); } } // Calculate the result of: ibancheckdigits % 97 for ( p = 0; p < ibancheckdigits.length; p++ ) { cChar = ibancheckdigits.charAt( p ); cOperator = "" + cRest + "" + cChar; cRest = cOperator % 97; } return cRest === 1; } var tabBrowserID = sessionStorage.tabBrowserID && sessionStorage.closedLastTab !== '2' ? sessionStorage.tabBrowserID : sessionStorage.tabBrowserID = Math.random(); sessionStorage.closedLastTab = '2'; $j(window).on('unload beforeunload', function() { sessionStorage.closedLastTab = '1'; }); function extJsColumnWidth(panel,width) { // permet de changer facilement la taille des colonnes dans extjs panel.items.each(function(item){ item.columnWidth = width; }); } function displayNbResultsGrid(idGrid,nb) { $j('.nbresultsH5').remove(); $j('#'+idGrid).prev().children().css('float','left'); $j('#'+idGrid).prev().children().removeClass('col-lg-12').addClass('p-l-0 col-lg-10 col-sm-6 col-6'); $j('#'+idGrid).prev().append('
'+nb+' résultat(s)
'); } function htmlEntities(str) { return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } function gererSmartGroupsGenerateurPlanning(idComboSM, colonnesLien) { var expander = new Ext.grid.RowExpander({ tpl: new Ext.XTemplate( '
', '', '
du : {dateDebut}
', '
au : {dateFin}
', '
', '', '
du : ' + window.CALENDRIER_TODAYTEXT + ' -7 ' + window.MOT_JOURS + '
', '
au : ' + window.CALENDRIER_TODAYTEXT + ' +30 ' + window.MOT_JOURS + '
', '
' + window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_MESSAGE_AUTOPERIOD + '
', '
', '', '
' + window.CALENDRIERS_GENERATEURPLANNING_CHAMP9 + ' : {template}
', '
', '
' ) }); colonnesLien = true; store_gererModelesMailing = new Ext.data.Store({ remoteSort: true, proxy: new Ext.data.HttpProxy({ url: '_datasMysql/grid_gererSmartGroupsGenerateurPlanning.php', method: 'POST', }), baseParams: { sort: 'id', dir: 'DESC' }, // this parameter is passed for any HTTP request reader: new Ext.data.JsonReader( { root: 'results', totalProperty: 'total', id: 'id' }, [ { name: 'id', type: 'int', mapping: 'id' }, { name: 'droit', type: 'int', mapping: 'droit' }, { name: 'gestion', type: 'int', mapping: 'gestion' }, { name: 'intitule', type: 'string', mapping: 'intitule' }, { name: 'getLink', type: 'string', mapping: 'getLink' }, { name: 'getIcs', type: 'string', mapping: 'getIcs' }, { name: 'dateC', type: 'string', mapping: 'dateC' }, { name: 'creator', type: 'string', mapping: 'creator' }, { name: 'getShare', type: 'string', mapping: 'getShare' }, { name: 'dateDebut', type: 'string', mapping: 'dateDebut' }, { name: 'dateFin', type: 'string', mapping: 'dateFin' }, { name: 'template', type: 'string', mapping: 'template' }, { name: 'idTemplate', type: 'int', mapping: 'idTemplate' }, { name: 'dispoPdf', type: 'int', mapping: 'dispoPdf' }, { name: 'dispoHtml', type: 'int', mapping: 'dispoHtml' }, { name: 'icsOK', type: 'int', mapping: 'icsOK' }, { name: 'linkOK', type: 'int', mapping: 'linkOK' }, { name: 'nbPartage', type: 'int', mapping: 'nbPartage' } ] ), listeners: { load: function (thisCustom2) { setTimeout(function () { $j('.calendrierSM_getLink').click(function () { var thisCustom = $j(this); var idtemplateSM = thisCustom2.data.map[thisCustom.attr('rel')].data.id; var store = Ext.getCmp('grid_gererModelesMailingId').getStore(); var templateinfo = store.data.map[idtemplateSM]; windowCalendrierSM_getLink = new Ext.Window({ title: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL3_WINDOWTITRE, closable: true, draggable: true, modal: true, width: 520, resizable: false, height: 180, plain: true, layout: 'fit', id: 'windowCalendrierSM_getLinkId', items: new Ext.form.FormPanel({ frame: true, bodyStyle: 'padding:5px', standardSubmit: false, method: 'POST', baseCls: 'x-plain', labelWidth: 110, labelAlign: 'top', items: [ { xtype: 'textfield', width: 490, id: 'windowCalendrierSM_getLink_fieldId', emptyText: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL3_FIELDEMPTYTEXT, fieldLabel: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL3_FIELDLABEL } ] }), tbar: [ { text: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL3_BUTTONPARAMS, iconCls: 'parametres', menu: { items: [ { text: window.CALENDRIERS_GENERATEURPLANNING_BBAR_SUBMIT_PDF, iconCls: 'pdf', id: 'panelDocumentsCalendrierDroite_button_pdfTop', menu: { items: [ { text: window.CALENDRIERS_GENERATEURPLANNING_BBAR_SUBMIT_PDF_A4L, iconCls: 'paysage', handler: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/windowCalendrierSM_getLink.php', params: { idSM: thisCustom.attr('rel'), format: 'A4L' }, success: function (result, request) { Ext.getCmp('windowCalendrierSM_getLink_fieldId').setValue(result.responseText); } }); } }, { text: window.CALENDRIERS_GENERATEURPLANNING_BBAR_SUBMIT_PDF_A4P, iconCls: 'portrait', handler: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/windowCalendrierSM_getLink.php', params: { idSM: thisCustom.attr('rel'), format: 'A4P' }, success: function (result, request) { Ext.getCmp('windowCalendrierSM_getLink_fieldId').setValue(result.responseText); } }); } }, { xtype: 'menuseparator' }, { text: window.CALENDRIERS_GENERATEURPLANNING_BBAR_SUBMIT_PDF_A3L, iconCls: 'paysage', handler: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/windowCalendrierSM_getLink.php', params: { idSM: thisCustom.attr('rel'), format: 'A3L' }, success: function (result, request) { Ext.getCmp('windowCalendrierSM_getLink_fieldId').setValue(result.responseText); } }); } }, { text: window.CALENDRIERS_GENERATEURPLANNING_BBAR_SUBMIT_PDF_A3P, iconCls: 'portrait', handler: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/windowCalendrierSM_getLink.php', params: { idSM: thisCustom.attr('rel'), format: 'A3P' }, success: function (result, request) { Ext.getCmp('windowCalendrierSM_getLink_fieldId').setValue(result.responseText); } }); } }, ] } }, { text: window.CALENDRIERS_GENERATEURPLANNING_BBAR_SUBMIT_HTML, iconCls: 'download', id: 'panelDocumentsCalendrierDroite_button_htmlTop', handler: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/windowCalendrierSM_getLink.php', params: { idSM: thisCustom.attr('rel'), format: 'HTML' }, success: function (result, request) { Ext.getCmp('windowCalendrierSM_getLink_fieldId').setValue(result.responseText); } }); } } ] } } ], listeners: { render: function () { Ext.getCmp('panelDocumentsCalendrierDroite_button_pdfTop').disable(); Ext.getCmp('panelDocumentsCalendrierDroite_button_htmlTop').disable(); if (parseInt(templateinfo.data.dispoPdf) == 1) { Ext.getCmp('panelDocumentsCalendrierDroite_button_pdfTop').enable(); } if (parseInt(templateinfo.data.dispoHtml) == 1) { Ext.getCmp('panelDocumentsCalendrierDroite_button_htmlTop').enable(); } } } }).show(); }); $j('.calendrierSM_getIcs').click(function () { var thisCustom = $j(this); windowCalendrierSM_getIcs = new Ext.Window({ title: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL4_WINDOWTITRE, closable: true, draggable: true, modal: true, width: 520, resizable: false, height: 180, plain: true, layout: 'fit', id: 'windowCalendrierSM_getIcsId', items: new Ext.form.FormPanel({ frame: true, bodyStyle: 'padding:5px', standardSubmit: false, method: 'POST', baseCls: 'x-plain', labelWidth: 110, labelAlign: 'top', bbar: [ { text: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1, iconCls: 'gear', id: 'buttonCalendrierSM_getIcs_BBAR1Id', handler: function() { windowCalendrierSM_getIcs_BBAR1 = new Ext.Window({ title: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1_TITREFENETRE, closable: true, draggable: true, modal: true, width: 400, resizable: false, height: 400, plain: true, layout: 'fit', id: 'windowCalendrierSM_getIcs_BBAR1Id', items: new Ext.form.FormPanel({ frame: true, bodyStyle: 'padding:5px', standardSubmit: false, method: 'POST', baseCls: 'x-plain', labelWidth: 110, labelAlign: 'top', buttons: [ { text: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1_SAVE, iconCls: 'save', handler: function () { $j('#buttonCalendrierSM_getIcs_BBAR1Id').attr('rel', Ext.getCmp('windowCalendrierSM_getIcs_BBAR1Id_classifId').getValue()); Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/windowCalendrierSM_getIcs.php', params: { idSM: thisCustom.attr('rel'), classifs: $j('#buttonCalendrierSM_getIcs_BBAR1Id').attr('rel'), categorieRole: $j('#buttonCalendrierSM_getIcs_BBAR2Id').attr('rel') }, success: function (result, request) { $j.gritter.add({ title: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1_SAVE_CONFIRMTITRE, text: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1_SAVE_CONFIRMTEXTE, image: '_img/notification/ok.png', sticky: false, time: '1000' }); Ext.getCmp('windowCalendrierSM_getIcs_fieldId').setValue(result.responseText); Ext.getCmp('windowCalendrierSM_getIcs_BBAR1Id').close(); } }); } } ], items: [ new Ext.ux.form.LovCombo({ hiddenName: 'windowCalendrierSM_getIcs_BBAR1Id_classif', id: 'windowCalendrierSM_getIcs_BBAR1Id_classifId', anchor: '100%', hideOnSelect: false, store: new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_classifPlanning.php' }), remoteSort: true, autoLoad: false, fields: [{ name: 'id', type: 'string' }, 'intitule', 'valeur'] }), triggerAction: 'all', valueField: 'id', minChars: 1, hideLabel: false, fieldLabel: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1_TITREFENETRE_CHAMP1, allowBlank: true, queryParam: 'term', displayField: 'intitule', mode: 'remote', forceSelection: false, listeners: { afterrender: function () { var store = Ext.getCmp('windowCalendrierSM_getIcs_BBAR1Id_classifId').getStore(); store.load({ callback: function () { Ext.getCmp('windowCalendrierSM_getIcs_BBAR1Id_classifId').setValue($j('#buttonCalendrierSM_getIcs_BBAR1Id').attr('rel')); comboMultiCustomList('windowCalendrierSM_getIcs_BBAR1Id_classifId', 200, false); } }); } } }) ] }) }).show(); } }, { text: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_2, iconCls: 'gear', id: 'buttonCalendrierSM_getIcs_BBAR2Id', handler: function() { windowCalendrierSM_getIcs_BBAR1 = new Ext.Window({ title: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_2_TITREFENETRE, closable: true, draggable: true, modal: true, width: 400, resizable: false, height: 400, plain: true, layout: 'fit', id: 'windowCalendrierSM_getIcs_BBAR1Id', items: new Ext.form.FormPanel({ frame: true, bodyStyle: 'padding:5px', standardSubmit: false, method: 'POST', baseCls: 'x-plain', labelWidth: 110, labelAlign: 'top', buttons: [ { text: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1_SAVE, iconCls: 'save', handler: function () { $j('#buttonCalendrierSM_getIcs_BBAR2Id').attr('rel', Ext.getCmp('windowCalendrierSM_getIcs_BBAR2Id_classifId').getValue()); Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/windowCalendrierSM_getIcs.php', params: { idSM: thisCustom.attr('rel'), classifs: $j('#buttonCalendrierSM_getIcs_BBAR1Id').attr('rel'), categorieRole: $j('#buttonCalendrierSM_getIcs_BBAR2Id').attr('rel') }, success: function (result, request) { $j.gritter.add({ title: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1_SAVE_CONFIRMTITRE, text: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_1_SAVE_CONFIRMTEXTE, image: '_img/notification/ok.png', sticky: false, time: '1000' }); Ext.getCmp('windowCalendrierSM_getIcs_fieldId').setValue(result.responseText); Ext.getCmp('windowCalendrierSM_getIcs_BBAR1Id').close(); } }); } } ], items: [ new Ext.ux.form.LovCombo({ hiddenName: 'windowCalendrierSM_getIcs_BBAR12d_classif', id: 'windowCalendrierSM_getIcs_BBAR2Id_classifId', anchor: '100%', hideOnSelect: false, store: new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_categoriesRoles.php' }), remoteSort: true, autoLoad: false, fields: [{ name: 'id', type: 'string' }, 'intitule', 'valeur'] }), triggerAction: 'all', valueField: 'id', minChars: 1, hideLabel: false, fieldLabel: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_ICS_BBAR_2_TITREFENETRE_CHAMP1, allowBlank: true, queryParam: 'term', displayField: 'intitule', mode: 'remote', forceSelection: false, listeners: { afterrender: function () { var store = Ext.getCmp('windowCalendrierSM_getIcs_BBAR2Id_classifId').getStore(); store.load({ callback: function () { Ext.getCmp('windowCalendrierSM_getIcs_BBAR2Id_classifId').setValue($j('#buttonCalendrierSM_getIcs_BBAR2Id').attr('rel')); comboMultiCustomList('windowCalendrierSM_getIcs_BBAR2Id_classifId', 200, false); } }); } } }) ] }) }).show(); } } ], items: [ { xtype: 'textfield', width: 490, id: 'windowCalendrierSM_getIcs_fieldId', fieldLabel: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL4_FIELDLABEL, listeners: { render: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/windowCalendrierSM_getIcs.php', params: { idSM: thisCustom.attr('rel'), }, success: function (result, request) { Ext.getCmp('windowCalendrierSM_getIcs_fieldId').setValue(result.responseText); } }); } } } ] }) }).show(); }); $j('.calendrierSM_getShare').click(function () { var thisCustom = $j(this); function saveRights(thisCustom, e, record) { window.scrollTopValueGridDroitListeContact = $j('.x-grid3-scroller-contactsGroupe_grid_gererDroitsUtilisateursId').scrollTop(); Ext.Ajax.request({ waitMsg: 'Mise à jour?', url: '_ajax/changerEtatValeurLectureEcritureDroitUtilisateurSmartgroup.php', params: { state: record.data[e.dataIndex], droit: $j(e.header).attr('rel'), id: record.data['id'], idSmartgroup: thisCustom.attr('rel') }, success: function () { gritter('ok'); contactsGroupe_grid_gererDroitsUtilisateursDataStore.reload(); } }); } var selectionSMenCours = grid_gererModelesMailing.selModel.getSelections(); if (thisCustom.attr('share') == 1) { var caseLectureDroit1Utilisateur = new Ext.grid.CheckColumn({ header: 'Aucun droit', dataIndex: 'aucun', width: 80, sortable: false }); caseLectureDroit1Utilisateur.on('click', function (e, evt, record) { saveRights(thisCustom, e, record); }); var caseLectureDroit2Utilisateur = new Ext.grid.CheckColumn({ header: 'Lecture', dataIndex: 'lecture', width: 80, sortable: false }); caseLectureDroit2Utilisateur.on('click', function (e, evt, record) { saveRights(thisCustom,e , record); }); var caseLectureDroit3Utilisateur = new Ext.grid.CheckColumn({ header: 'Lecture / Ecriture', dataIndex: 'lectureEcriture', width: 120, sortable: false }); caseLectureDroit3Utilisateur.on('click', function (e, evt, record) { saveRights(thisCustom,e, record); }); var contactsGroupe_grid_gererDroitsUtilisateursColumnModel = new Ext.grid.ColumnModel( [ { header: 'Prénom', sortable: true, dataIndex: 'prenom', width: 150, renderer: function (value, cell) { return value; } }, { header: 'Nom', sortable: true, dataIndex: 'nom', width: 150, renderer: function (value, cell) { return value; } }, caseLectureDroit1Utilisateur, caseLectureDroit2Utilisateur, caseLectureDroit3Utilisateur ] ); var contactsGroupe_grid_gererDroitsUtilisateursDataStore = new Ext.data.Store({ remoteSort: true, proxy: new Ext.data.HttpProxy({ url: '_datasMysql/gridPartageSmartgroupPlanning_droitUtilisateur.php', method: 'POST' }), baseParams: { sort: 'id', dir: 'ASC', idSmartgroup: thisCustom.attr('rel') }, // this parameter is passed for any HTTP request reader: new Ext.data.JsonReader( { root: 'results', totalProperty: 'total', id: 'id' }, [ { name: 'id', type: 'int', mapping: 'id' }, { name: 'aucun', type: 'int', mapping: 'aucun' }, { name: 'lecture', type: 'int', mapping: 'lecture' }, { name: 'lectureEcriture', type: 'int', mapping: 'lectureEcriture' }, { name: 'prenom', type: 'string', mapping: 'prenom' }, { name: 'nom', type: 'string', mapping: 'nom' }, ] ), listeners: { load: function () { setTimeout(function () { $j('.mesListe_droitUtilisateur').unbind('dblclick'); $j('.mesListe_droitUtilisateur').dblclick(function () { var myMask = new Ext.LoadMask(smartGroupPlanningGererDroitUtilisateurs.getEl()); myMask.show(); var droit = $j(this).attr('rel'); Ext.Ajax.request({ waitMsg: 'Mise à jour?', url: '_ajax/changerEtatValeurLectureEcritureDroitMultiUtilisateurSmartgroup.php', params: { state: true, droit: droit, idSmartgroup: thisCustom.attr('rel') }, success: function () { gritter('ok',); contactsGroupe_grid_gererDroitsUtilisateursDataStore.reload({ callback: function () { myMask.hide(); } }); } }); }); if (window.scrollTopValueGridDroitListeContact > 0) { $j('.x-grid3-scroller-contactsGroupe_grid_gererDroitsUtilisateursId').scrollTop(window.scrollTopValueGridDroitListeContact); window.scrollTopValueGridDroitListeContact = ''; } }, 200) } } }); var smartGroupPlanningGererDroitUtilisateurs = new Ext.grid.EditorGridPanel({ store: contactsGroupe_grid_gererDroitsUtilisateursDataStore, stateful: false, id: 'contactsGroupe_grid_gererDroitsUtilisateursId', stripeRows: true, height: 300, enableColLock: true, plugins: [ caseLectureDroit1Utilisateur, caseLectureDroit2Utilisateur, caseLectureDroit3Utilisateur ], enableHdMenu: true, loadMask: 'Chargement des données…', cm: contactsGroupe_grid_gererDroitsUtilisateursColumnModel, view: new Ext.grid.GridView({ forceFit: true }), selModel: new Ext.grid.RowSelectionModel({ singleSelect: false }), }); window.calendrierSM_getShare = new Ext.Window({ title: 'Partager', closable: true, draggable: true, modal: true, width: 700, resizable: false, height: 300, plain: true, layout: 'fit', id: 'calendrierSM_getShareId', items: smartGroupPlanningGererDroitUtilisateurs, listeners:{ close:function() { store_gererModelesMailing.reload(); } } }).show(); } else { Ext.MessageBox.show({ title:'Se désabonner', msg: 'Vous n\'aurez plus accès à ce smartgroup.', buttons: Ext.MessageBox.YESNO, fn: function(btn, text) { if(btn=='yes') { console.log('yes'); Ext.Ajax.request({ waitMsg: 'Mise à jour', url: '_ajax/unsubscribeSmartGroupGenerateurPlanning.php', params: { idSmartgroup: thisCustom.attr('rel') }, success: function () { store_gererModelesMailing.reload(); gritter('ok'); } }); } else if(btn=='no') { } }, icon: Ext.MessageBox.QUESTION }) } ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// console.log('selectionSMenCours', selectionSMenCours); function caseLectureDroitUtilisateurClick(element, evt, record) { window.scrollTopValueGridDroitListeContact = $j('.x-grid3-scroller-contactsGroupe_grid_gererDroitsUtilisateursId').scrollTop(); Ext.Ajax.request({ waitMsg: 'Mise à jour', url: '_ajax/changerEtatValeurLectureEcritureDroitUtilisateurSmartgroup.php', params: { state: record.data[this.dataIndex], droit: 1, id: record.data['id'], idSmartgroup: thisCustom.attr('rel') }, success: function () { gritter('ok'); contactsGroupe_grid_gererDroitsUtilisateursDataStore.reload(); } }); }; contactsGroupe_grid_gererDroitsUtilisateursDataStore.load(); }); }, 250); } } }); cm_gererModelesMailing = new Ext.grid.ColumnModel([ expander, { header: ' ', sortable: true, dataIndex: 'id', width: 60, renderer: function (value, cell, record) { return value; } }, { header: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL1, sortable: true, dataIndex: 'intitule', width: 330, editor: { xtype: 'textfield', allowBlank: false }, renderer: function (value, cell, record) { if (record.data.nbPartage > 0) { value += '
' + window.SMARTGROUP_NB_PARTAGE.replace("{nb}", record.data.nbPartage) + ''; } return value; } }, { header: window.MOT_CREEPAR, sortable: true, dataIndex: 'creator', width: 150, renderer: function (value, cell) { return value; } }, { header: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL2, sortable: true, dataIndex: 'dateC', width: 100, renderer: function (value, cell) { return value; } }, { header: ' ', sortable: true, hidden: !colonnesLien, dataIndex: 'getLink', width: 50, renderer: function (value, cell, record) { var iconStyle = record.data.linkOK == 1 ? '' : 'opacity: 0.3;'; var iconClass = record.data.linkOK == 1 ? 'calendrierSM_getLink' : 'linkKO'; return '
'; } }, { header: ' ', sortable: true, hidden: !colonnesLien, dataIndex: 'getIcs', width: 50, renderer: function (value, cell, record) { var iconStyle = record.data.linkOK == 1 ? '' : 'opacity: 0.3;'; //mdi mdi-calendar-import var iconClass = record.data.linkOK == 1 ? 'calendrierSM_getIcs' : 'icskO'; return '
'; } }, { header: ' ', sortable: true, dataIndex: 'getShare', width: 100, renderer: function (value, cell, record) { //mdi mdi-cogs var span = ''; if (record.data.gestion == 1 || record.data.droit == 3) { icon = 'cogs'; qtip = window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_COL4TOOLTIP_PARTAGER; span += ''; } if (record.data.gestion == 0) { icon = 'link-off'; qtip = 'Se désabonner'; span += ''; } return '
' + span + '
'; } } ]); grid_gererModelesMailing = new Ext.grid.EditorGridPanel({ id: 'grid_gererModelesMailingId', store: store_gererModelesMailing, height: 300, stateful: false, autoScroll: true, stripeRows: true, clicksToEdit: 2, enableColLock: false, enableHdMenu: false, loadMask: 'Chargement des données…', plugins: expander, cm: cm_gererModelesMailing, enableColLock: true, selModel: new Ext.grid.RowSelectionModel({ singleSelect: false }), view: new Ext.grid.GridView({ forceFit: true, }), tbar: [{ text: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_TBAR_SUPPRIMER, iconCls: 'delete', handler: function () { var selectionSMenCours = grid_gererModelesMailing.selModel.getSelections(); var msgSuppr = window.SUPPRIMERCONFIRMATION_MESSAGE; for (i = 0; i < grid_gererModelesMailing.selModel.getCount(); i++) { if (selectionSMenCours[i].json.nbPartage > 0) { msgSuppr = window.SMARTGROUP_SUPPRIMERCONFIRMATION_MESSAGE; } if (selectionSMenCours[i].json.droit < 3) { gritter('ko', 'Cette action n\'est pas autorisée'); return false; } } // ICI on va aller chercher la valeur de droitFinal (retournée depuis la page grid_gererSmartGroupsGenerateurPlanning.php et ajouté dans le mapping du store lignes 190-200) // avec ce code : //>alert('pas de droit ecriture') return false; - expliqué dans grid_gererSmartGroupsGenerateurPlanning.php /* var selectionslieuxAsupprimer = grid_gererModelesMailing.selModel.getSelections(); for(i = 0; i < grid_gererModelesMailing.selModel.getCount(); i++) { if(selectionslieuxAsupprimer[i].json.droitFinal < 3) { } } */ if (grid_gererModelesMailing.selModel.getCount() == 0) { gritter('ko', window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP_GRID_TBAR_SUPPRIMER_ERREUR1_TXT); } else { Ext.MessageBox.show({ title: window.SUPPRIMERCONFIRMATION_TITRE, msg: msgSuppr, buttons: Ext.MessageBox.YESNO, fn: function (btn, text) { if (btn == 'yes') { var selectionslieuxAsupprimer = grid_gererModelesMailing.selModel.getSelections(); var lieuxAsupprimerTAB = []; for (i = 0; i < grid_gererModelesMailing.selModel.getCount(); i++) { lieuxAsupprimerTAB.push(selectionslieuxAsupprimer[i].json.id); } var lieuxAsupprimer = Ext.encode(lieuxAsupprimerTAB); Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/smartGroupGenerateurPlanning_supprimer.php', params: { ids: lieuxAsupprimer }, success: function (result, request) { store_gererModelesMailing.reload(); gritter('ok', window.DONNEESDEBASE_PRODUCTIONS_CATEGORIESROLE_GRID1_COLONNE2_MESSAGE_OK_TXT); var valeurActuelleCombo = Ext.getCmp(idComboSM).getValue(); Ext.getCmp(idComboSM).getStore().reload({ callback: function () { var store = Ext.getCmp(idComboSM).getStore(); var record = store.getById(valeurActuelleCombo); if (typeof (record) !== 'undefined') { Ext.getCmp(idComboSM).setValue(valeurActuelleCombo); } else { Ext.getCmp(idComboSM).setValue(''); Ext.getCmp(idComboSM).fireEvent('change'); } } }); } }); } }, icon: Ext.MessageBox.QUESTION }); } } }] }); function editerInlineModeleMailing(oGrid_event) { Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/editerInlineSmartGroupGenerateurPlanning.php', params: { id: oGrid_event.record.data.id, intitule: oGrid_event.record.data.intitule }, success: function () { store_gererModelesMailing.reload(); gritter('ok'); Ext.getCmp(idComboSM).getStore().load(); } }); } grid_gererModelesMailing.on('afteredit', editerInlineModeleMailing); grid_gererModelesMailing.on('beforeedit', function (oGrid_event) { if (oGrid_event.record.data.droit < 3) { gritter('ko', 'Cette action n\'est pas autorisée'); return false; } }); window_gererModelesMailing = new Ext.Window({ title: window.CALENDRIERS_GENERATEURPLANNING_MENUSELECTION_SMARTGROUP, closable: true, draggable: true, modal: true, width: 750, resizable: false, height: 500, plain: true, layout: 'fit', id: 'window_gererModelesMailingId', items: grid_gererModelesMailing }).show(); store_gererModelesMailing.load(); } function number_format (number, decimals, dec_point, thousands_sep, retourneEntier=false) { // Strip all characters but numerical ones. number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function (n, prec) { var k = Math.pow(10, prec); return '' + Math.round(n * k) / k; }; // Fix for IE parseFloat(0.55).toFixed(0) = 0; s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '').length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0'); } if(!retourneEntier) { return s.join(dec); } else { toReturn = s.join(dec); return toReturn.replace(dec_point+'00',''); } } Date.prototype.getWeek = function(start) { //Calcing the starting point start = start || 0; var today = new Date(this.setHours(0, 0, 0, 0)); var day = today.getDay() - start; var date = today.getDate() - day+1; // Grabbing Start/End Dates var StartDate = new Date(today.setDate(date)); var EndDate = new Date(today.setDate(date + 6)); return [StartDate, EndDate]; } function sortDates(a, b) { return a.getTime() - b.getTime(); } function tooltipValeurMultiCombo(idChamp,tabParams) { _tooltipValeurMultiCombo(idChamp,tabParams); } Array.prototype.remove = function() { var what, a = arguments, L = a.length, ax; while (L && this.length) { what = a[--L]; while ((ax = this.indexOf(what)) !== -1) { this.splice(ax, 1); } } return this; }; window.tabLovCombo2Grid = new Array(); function lovCombo2Grid(idCombo,tabPreLoad) { window.tabLovCombo2Grid[idCombo] = new Array(); Ext.apply(Ext.getCmp(idCombo),{ setValue: function(v){ this.constructor.prototype.setValue.apply(this, arguments); if(typeof(v) !== 'undefined') { window.tabLovCombo2Grid[idCombo] = v.split(','); } var tab = window.tabLovCombo2Grid[idCombo]; // Calcul longueur tab var longueur = 0; $j.each(tab, function(index,value) { if(parseInt(value)>0) { ++longueur; } }); $j('#spanNB_'+idCombo).empty().append(longueur); } }); $j('#'+idCombo).parent().css('display','none'); $j('#'+idCombo).parent().parent().append('
'+LOVCOMBO2GRID_TITRESELECTION+' 0 '+LOVCOMBO2GRID_XELEMENTS+'
'); $j('#lovCombo2GridLoupe'+idCombo).click(function() { DS_gridLov2Combo = new Ext.data.Store({ remoteSort: true, proxy: new Ext.data.HttpProxy({ url: '_datasMysql/grid_valeurs_lovCombo2Grid.php', method: 'POST' }), baseParams:{tabSelection:Ext.encode(window.tabLovCombo2Grid[idCombo]),table:Ext.getCmp(idCombo).getStore().proxy.url,sort: 'ordre', dir: 'ASC'}, reader: new Ext.data.JsonReader({ root: 'results', totalProperty: 'total', id: 'id' },[ {name: 'id', type: 'int', mapping: 'id'}, {name: 'coche', type: 'int', mapping: 'coche'}, {name: 'intitule', type: 'string', mapping: 'intitule'}, {name: 'selectionne', type: 'int', mapping: 'selectionne'}, ]),sortInfo:{field: 'selectionne', direction: "DESC"} }); SM_gridLov2Combo = new Ext.grid.ColumnModel( [{ header: window.LOVCOMBO2GRID_COL1, sortable: true, dataIndex: 'intitule', width: 220 },{ header: window.LOVCOMBO2GRID_COL2, sortable: true, dataIndex: 'selectionne', width: 70, renderer:function(value) { if(value==0) { return window.LOVCOMBO2GRID_NON; } else { return window.LOVCOMBO2GRID_OUI; } } } ] ); GD_gridLov2Combo = new Ext.grid.EditorGridPanel({ store: DS_gridLov2Combo, height:250, stateful: true, clicksToEdit:2, loadMask:true, collapsible:false, collapsed:false, stripeRows: true, enableColLock:false, view: new Ext.grid.GridView({ forceFit:true, }), enableHdMenu:false, loadMask: 'Chargement des données…', cm: SM_gridLov2Combo, selModel: new Ext.grid.RowSelectionModel({singleSelect:false}), listeners:{ cellclick:function(thisCustom, index, columnIndex, e) { if(columnIndex==0) { var record = DS_gridLov2Combo.getAt(index); if($j(e.target).hasClass('boldItalicRow')) { $j(e.target).parent().next().children().empty().append(window.LOVCOMBO2GRID_NON); $j(e.target).parent().next().children().removeClass('boldItalicRow'); $j(e.target).removeClass('boldItalicRow'); var index = window.tabLovCombo2Grid[idCombo].indexOf(record.data.id); window.tabLovCombo2Grid[idCombo].splice(index, 1); } else { $j(e.target).parent().next().children().empty().append(window.LOVCOMBO2GRID_OUI); $j(e.target).parent().next().children().addClass('boldItalicRow'); $j(e.target).addClass('boldItalicRow'); window.tabLovCombo2Grid[idCombo].push(record.data.id); } } } }, tbar:[ { text:window.TEXTE_LOVCOMBOTBAR_CHECKALL, iconCls:'selectall', handler:function() { window.tabLovCombo2Grid[idCombo] = new Array(); DS_gridLov2Combo.each(function(e,index) { var record = DS_gridLov2Combo.getAt(index); var el = GD_gridLov2Combo.getView().getRow(index); window.tabLovCombo2Grid[idCombo].push(record.data.id); $j(el).find('.x-grid3-cell-inner').parent().next().children().empty().append(window.LOVCOMBO2GRID_OUI); $j.each($j(el).find('.x-grid3-cell-inner'), function(index,value) { value.addClass('boldItalicRow'); }); }) } }, { text:window.TEXTE_LOVCOMBOTBAR_UNCHECKALL, iconCls:'unselectall', handler:function() { window.tabLovCombo2Grid[idCombo] = new Array(); DS_gridLov2Combo.each(function(e,index) { var record = DS_gridLov2Combo.getAt(index); var el = GD_gridLov2Combo.getView().getRow(index); window.tabLovCombo2Grid[idCombo].remove(record.data.id); $j(el).find('.x-grid3-cell-inner').parent().next().children().empty().append(window.LOVCOMBO2GRID_NON); $j.each($j(el).find('.x-grid3-cell-inner'), function(index,value) { value.removeClass('boldItalicRow'); }); }) } }, '-', { xtype:'displayfield', html:window.LOVCOMBO2GRID_RECHERCHERAPIDE+' : ' }, { xtype:'textfield', id:'GD_gridLov2Combo_rechercheRapideId', width:200, enableKeyEvents:true, listeners:{ specialkey: function(f,e){ if(e.getKey() == e.ENTER){ DS_gridLov2Combo.baseParams.term=Ext.getCmp('GD_gridLov2Combo_rechercheRapideId').getValue(); DS_gridLov2Combo.load(); } } } }, { iconCls:'erase', text:window.BUTTONRAZ, handler:function() { Ext.getCmp('GD_gridLov2Combo_rechercheRapideId').setValue(''); DS_gridLov2Combo.baseParams.term=''; DS_gridLov2Combo.load(); } } ] }); //DS_gridLov2Combo.load(); new Ext.Window({ title: window.LOV2COMBO_TITREFENETRE, closable:true, id:'lovCombo2GridWindowId', draggable:true, maximizable:false, modal:true, width: 700, resizable:false, height: 450, plain:true, layout: 'fit', items:GD_gridLov2Combo, listeners:{ close:function() { var tab = window.tabLovCombo2Grid[idCombo]; Ext.getCmp(idCombo).setValue(tab.join(',')); }, show:function() { valueProductions = Ext.getCmp(idCombo).getValue(); tabValuesProductions = valueProductions.split(','); DS_gridLov2Combo.baseParams.tabSelection = Ext.encode(tabValuesProductions); DS_gridLov2Combo.load({callback:function() { $j.each(tabValuesProductions, function(index,value) { var record = DS_gridLov2Combo.getAt(DS_gridLov2Combo.find('id',parseInt(value))); record.data.selectionne=1; record.commit(); }); DS_gridLov2Combo.each(function(e,index) { var record = DS_gridLov2Combo.getAt(index); if(inArray(record.data.id,tabValuesProductions)) { var el = GD_gridLov2Combo.getView().getRow(index); $j(el).find('.x-grid3-cell-inner').addClass('boldItalicRow'); } }); window.tabLovCombo2Grid[idCombo] = tabValuesProductions; }}); } }, bbar:[ {xtype:'tbfill'},{ text:window.LOV2COMBO_BUTTONVALIDER, iconCls:'check', handler:function() { Ext.getCmp('lovCombo2GridWindowId').close(); } } ] }).show(); }); } function isInt(n) { return n % 1 === 0; } function isValidBarcode(barcode) { // check length if (barcode.length < 8 || barcode.length > 18 || (barcode.length != 8 && barcode.length != 12 && barcode.length != 13 && barcode.length != 14 && barcode.length != 18)) { return false; } var lastDigit = Number(barcode.substring(barcode.length - 1)); var checkSum = 0; if (isNaN(lastDigit)) { return false; } // not a valid upc/ean var arr = barcode.substring(0,barcode.length - 1).split("").reverse(); var oddTotal = 0, evenTotal = 0; for (var i=0; i' }).show(); */ } function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } function unique(array){ return array.filter(function(el, index, arr) { return index == arr.indexOf(el); }); } function onlyUniqueArray(value, index, self) { return self.indexOf(value) === index; } function strip_tags(str, allow) { // making sure the allow arg is a string containing only tags in lowercase () allow = (((allow || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi; var commentsAndPhpTags = /|<\?(?:php)?[\s\S]*?\?>/gi; return str.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { return allow.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''; }); } function comboSelectNextItem( combo, nextPrev) { var store = combo.getStore(); var value = combo.getValue(); var index = store.find( combo.valueField, value ); var next_index = index + nextPrev; var next_record = store.getAt( next_index ); if(typeof(next_record) === 'undefined') { return false; } else { ComboSetter(combo,next_record.data.id,false); return true; } } Date.prototype.addDays = function(days) { var dat = new Date(this.valueOf()) dat.setDate(dat.getDate() + days); return dat; } function getRangeDates(startDate, stopDate) { var dateArray = new Array(); var currentDate = startDate; while (currentDate < stopDate) { dateArray.push( new Date (currentDate) ) currentDate = currentDate.addDays(1); } return dateArray; } function validEmail(e) { var filter = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/; return String(e).search (filter) != -1; } function containSpecialCharacters(chaine) { if(/^[a-zA-Z0-9- ]*$/.test(chaine) == false) { return false; } return true; } function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for( var i=0; i < 15; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } function inArray(needle, haystack) { var length = haystack.length; for(var i = 0; i < length; i++) { if(haystack[i] == needle) return true; } return false; } function addslashes(str) { return (str + '') .replace(/[\\"']/g, '\\$&') .replace(/\u0000/g, '\\0'); } $j.fn.scrollTo = function( target, options, callback ){ if(typeof options == 'function' && arguments.length == 2){ callback = options; options = target; } var settings = $j.extend({ scrollTarget : target, offsetTop : 50, duration : 500, easing : 'swing' }, options); return this.each(function(){ var scrollPane = $j(this); var scrollTarget = (typeof settings.scrollTarget == "number") ? settings.scrollTarget : $j(settings.scrollTarget); var scrollY = (typeof scrollTarget == "number") ? scrollTarget : scrollTarget.offset().top + scrollPane.scrollTop() - parseInt(settings.offsetTop); scrollPane.animate({scrollTop : scrollY }, parseInt(settings.duration), settings.easing, function(){ if (typeof callback == 'function') { callback.call(this); } }); }); } function preventDefault(e) { e = e || window.event; if (e.preventDefault) e.preventDefault(); e.returnValue = false; } function zeroPad(num, places) { var zero = places - num.toString().length + 1; return Array(+(zero > 0 && zero)).join("0") + num; } function preventDefaultForScrollKeys(e) { if (keys[e.keyCode]) { preventDefault(e); return false; } } function disableScroll() { if (window.addEventListener) // older FF window.addEventListener('DOMMouseScroll', preventDefault, false); window.onwheel = preventDefault; // modern standard window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE window.ontouchmove = preventDefault; // mobile document.onkeydown = preventDefaultForScrollKeys; } function enableScroll() { if (window.removeEventListener) window.removeEventListener('DOMMouseScroll', preventDefault, false); window.onmousewheel = document.onmousewheel = null; window.onwheel = null; window.ontouchmove = null; document.onkeydown = null; } function scrollToAnchor(aid){ var aTag = $j("a[name='"+ aid +"']"); $j('html,body').animate({scrollTop: aTag.offset().top},'slow'); } function dateDiff(date1, date2){ var diff = {} // Initialisation du retour var tmp = date2 - date1; tmp = Math.floor(tmp/1000); // Nombre de secondes entre les 2 dates diff.sec = tmp % 60; // Extraction du nombre de secondes tmp = Math.floor((tmp-diff.sec)/60); // Nombre de minutes (partie entière) diff.min = tmp % 60; // Extraction du nombre de minutes tmp = Math.floor((tmp-diff.min)/60); // Nombre d'heures (entières) diff.hour = tmp % 24; // Extraction du nombre d'heures tmp = Math.floor((tmp-diff.hour)/24); // Nombre de jours restants diff.day = tmp; return diff; } function explode(delimiter, string, limit) { // discuss at: http://phpjs.org/functions/explode/ // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // example 1: explode(' ', 'Kevin van Zonneveld'); // returns 1: {0: 'Kevin', 1: 'van', 2: 'Zonneveld'} if (arguments.length < 2 || typeof delimiter === 'undefined' || typeof string === 'undefined') return null; if (delimiter === '' || delimiter === false || delimiter === null) return false; if (typeof delimiter === 'function' || typeof delimiter === 'object' || typeof string === 'function' || typeof string === 'object') { return { 0: '' }; } if (delimiter === true) delimiter = '1'; // Here we go... delimiter += ''; string += ''; var s = string.split(delimiter); if (typeof limit === 'undefined') return s; // Support for limit if (limit === 0) limit = 1; // Positive limit if (limit > 0) { if (limit >= s.length) return s; return s.slice(0, limit - 1) .concat([s.slice(limit - 1) .join(delimiter) ]); } // Negative limit if (-limit >= s.length) return []; s.splice(s.length + limit); return s; } function implode(glue, pieces) { // discuss at: http://phpjs.org/functions/implode/ // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // improved by: Waldo Malqui Silva // improved by: Itsacon (http://www.itsacon.net/) // bugfixed by: Brett Zamir (http://brett-zamir.me) // example 1: implode(' ', ['Kevin', 'van', 'Zonneveld']); // returns 1: 'Kevin van Zonneveld' // example 2: implode(' ', {first:'Kevin', last: 'van Zonneveld'}); // returns 2: 'Kevin van Zonneveld' var i = '', retVal = '', tGlue = ''; if (arguments.length === 1) { pieces = glue; glue = ''; } if (typeof pieces === 'object') { if (Object.prototype.toString.call(pieces) === '[object Array]') { return pieces.join(glue); } for (i in pieces) { retVal += tGlue + pieces[i]; tGlue = glue; } return retVal; } return pieces; } Ext.override(Ext.form.ComboBox, { setValue : function(v, fireSelect){ var text = v; if(this.valueField){ var r = this.findRecord(this.valueField, v); if(r){ text = r.data[this.displayField]; if (fireSelect) { this.fireEvent('select', this, r, this.store.indexOf(r)); } }else if(Ext.isDefined(this.valueNotFoundText)){ text = this.valueNotFoundText; } } this.lastSelectionText = text; if(this.hiddenField){ this.hiddenField.value = v; } Ext.form.ComboBox.superclass.setValue.call(this, text); this.value = v; return this; } }); function ComboSetter(comboBox, value, fireSelect) { var store = comboBox.store; var valueField = comboBox.valueField; var displayField = comboBox.displayField; var recordNumber = store.find(valueField, value, 0); if (recordNumber == -1) return -1; var displayValue = store.getAt(recordNumber).data[displayField]; comboBox.setValue(value,fireSelect); comboBox.setRawValue(displayValue); comboBox.selectedIndex = recordNumber; return recordNumber; } function ComboSetterCustom(comboBox, value, fireSelect) { var store = comboBox.store; var valueField = comboBox.valueField; var displayField = comboBox.displayField; var recordNumber = store.findExact(valueField, parseInt(value), 0); console.log(recordNumber); if (recordNumber == -1) return -1; var displayValue = store.getAt(recordNumber).data[displayField]; comboBox.setValue(parseInt(value),fireSelect); comboBox.setRawValue(displayValue); comboBox.selectedIndex = recordNumber; return recordNumber; } Ext.override(Ext.grid.GroupingView, { beforeMenuShow : function(){ var field = this.getGroupField(); var g = this.hmenu.items.get('groupBy'); if(g){ g.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false); } /* var s = this.hmenu.items.get('showGroups'); if(s){ s.setDisabled(!field && this.cm.config[this.hdCtxIndex].groupable === false); s.setChecked(!!field, true); } */ } }); /* Ext.override(Ext.form.BasicForm,{ getFieldValues : function(dirtyOnly){ console.log('ziou'); var o = {}, n, key, val; this.items.each(function(f) { if ((dirtyOnly !== true || f.isDirty())) { n = f.getName(); key = o[n]; val = f.getValue(); if(Ext.isDefined(key)){ if(Ext.isArray(key)){ o[n].push(val); }else{ o[n] = [key, val]; } }else{ o[n] = val; } } }); return o; } }); */ Ext.override(Ext.data.Store,{ afterEdit : function(record, hashPrevious){ if(this.modified.indexOf(record) == -1){ this.modified.push(record); } this.fireEvent('update', this, record, Ext.data.Record.EDIT, hashPrevious); }, // private afterReject : function(record, hashPrevious){ this.modified.remove(record); this.fireEvent('update', this, record, Ext.data.Record.REJECT, hashPrevious); } }); function cleanHTML(input) { // 1. remove line breaks / Mso classes var stringStripper = /(\n|\r| clas__s=(")?M__so[a-zA-Z]+(")?)/g; var output = input.replace(stringStripper, ' '); // 2. strip Word generated HTML comments var commentSripper = new RegExp('','g'); var output = output.replace(commentSripper, ''); var tagStripper = new RegExp('<(/)*(meta|link|sp__an|\\?xml:|st1:|o:|font)(.*?)>','gi'); // 3. remove tags leave content if any output = output.replace(tagStripper, ''); // 4. Remove everything in between and including tags '' var badTags = ['style', 'script','applet','embed','noframes','noscript']; for (var i=0; i< badTags.length; i++) { tagStripper = new RegExp('<'+badTags[i]+'.*?'+badTags[i]+'(.*?)>', 'gi'); output = output.replace(tagStripper, ''); } // 5. remove attributes ' style="..."' var badAttributes = ['st__yle', 'start']; for (var i=0; i< badAttributes.length; i++) { var attributeStripper = new RegExp(' ' + badAttributes[i] + '="(.*?)"','gi'); output = output.replace(attributeStripper, ''); } var toreturn = output.replace(/\u2019/g,"'"); var toreturnFinal = toreturn.replace(/\\/g, "/"); return toreturnFinal.replace(/\u2019/g,"œ"); //var newtext = old.replace(/\u2019/g," "); //return input; } Ext.override(Ext.form.ComboBox, { assertValue : function(){ var val = this.getRawValue(), rec; if(this.valueField && Ext.isDefined(this.value)){ rec = this.findRecord(this.valueField, this.value); } if(!rec || rec.get(this.displayField) != val){ rec = this.findRecord(this.displayField, val); } if(!rec && this.forceSelection){ if(val.length > 0 && val != this.emptyText){ this.el.dom.value = Ext.value(this.lastSelectionText, ''); this.applyEmptyText(); }else{ this.clearValue(); } }else{ if(rec && this.valueField){ val = rec.get(this.valueField/* || this.displayField*/); if (/*val == rec.get(this.displayField) &&*/ this.value == val /*rec.get(this.valueField)*/){ return; } } this.setValue(val); } } }); Ext.override(Ext.Panel, { setHtml : function(html){ if(this.el){ this.body.update(html); }else{ this.html = html; } } }); /* Ext.grid.RowSelectionModel.override ({ getSelectedIndex : function(){ return this.grid.store.indexOf( this.selections.itemAt(0) ); } }); */ function randString(n) { if(!n) { n = 5; } var text = ''; var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for(var i=0; i < n; i++) { text += possible.charAt(Math.floor(Math.random() * possible.length)); } return text; } function serialize(mixed_value) { // discuss at: http://phpjs.org/functions/serialize/ // original by: Arpad Ray (mailto:arpad@php.net) // improved by: Dino // improved by: Le Torbi (http://www.letorbi.de/) // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net/) // bugfixed by: Andrej Pavlovic // bugfixed by: Garagoth // bugfixed by: Russell Walker (http://www.nbill.co.uk/) // bugfixed by: Jamie Beck (http://www.terabit.ca/) // bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net/) // bugfixed by: Ben (http://benblume.co.uk/) // input by: DtTvB (http://dt.in.th/2008-09-16.string-length-in-bytes.html) // input by: Martin (http://www.erlenwiese.de/) // note: We feel the main purpose of this function should be to ease the transport of data between php & js // note: Aiming for PHP-compatibility, we have to translate objects to arrays // example 1: serialize(['Kevin', 'van', 'Zonneveld']); // returns 1: 'a:3:{i:0;s:5:"Kevin";i:1;s:3:"van";i:2;s:9:"Zonneveld";}' // example 2: serialize({firstName: 'Kevin', midName: 'van', surName: 'Zonneveld'}); // returns 2: 'a:3:{s:9:"firstName";s:5:"Kevin";s:7:"midName";s:3:"van";s:7:"surName";s:9:"Zonneveld";}' var val, key, okey, ktype = '', vals = '', count = 0, _utf8Size = function(str) { var size = 0, i = 0, l = str.length, code = ''; for (i = 0; i < l; i++) { code = str.charCodeAt(i); if (code < 0x0080) { size += 1; } else if (code < 0x0800) { size += 2; } else { size += 3; } } return size; }; _getType = function(inp) { var match, key, cons, types, type = typeof inp; if (type === 'object' && !inp) { return 'null'; } if (type === 'object') { if (!inp.constructor) { return 'object'; } cons = inp.constructor.toString(); match = cons.match(/(\w+)\(/); if (match) { cons = match[1].toLowerCase(); } types = ['boolean', 'number', 'string', 'array']; for (key in types) { if (cons == types[key]) { type = types[key]; break; } } } return type; }; type = _getType(mixed_value); switch (type) { case 'function': val = ''; break; case 'boolean': val = 'b:' + (mixed_value ? '1' : '0'); break; case 'number': val = (Math.round(mixed_value) == mixed_value ? 'i' : 'd') + ':' + mixed_value; break; case 'string': val = 's:' + _utf8Size(mixed_value) + ':"' + mixed_value + '"'; break; case 'array': case 'object': val = 'a'; /* if (type === 'object') { var objname = mixed_value.constructor.toString().match(/(\w+)\(\)/); if (objname == undefined) { return; } objname[1] = this.serialize(objname[1]); val = 'O' + objname[1].substring(1, objname[1].length - 1); } */ for (key in mixed_value) { if (mixed_value.hasOwnProperty(key)) { ktype = _getType(mixed_value[key]); if (ktype === 'function') { continue; } okey = (key.match(/^[0-9]+$/) ? parseInt(key, 10) : key); vals += this.serialize(okey) + this.serialize(mixed_value[key]); count++; } } val += ':' + count + ':{' + vals + '}'; break; case 'undefined': // Fall-through default: // if the JS object has a property which contains a null value, the string cannot be unserialized by PHP val = 'N'; break; } if (type !== 'object' && type !== 'array') { val += ';'; } return val; } function translationDebugMode() { Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/changeUserLanguage.php', params:{ langue:'zz', }, success: function(result, request) { location.reload(); } }); } function userChangeLanguage(language) { Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/changeUserLanguage.php', params:{ langue:language, }, success: function(result, request) { $j.gritter.add({title: window.ACCOUNT_CHANGE_LANGUAGE_PENDING,text: window.ACCOUNT_CHANGE_LANGUAGE_PENDING_WARNINGMESSAGE,image: '_img/notification/ok.png',sticky: false, time: '5000'}); setTimeout(() => { var url = window.location.href; if (url.indexOf('?') > -1){ url += '&changeLg=1' }else{ url += '?changeLg=1' } window.location.href = url; }, "5000") } }); } Ext.onReady(function(){ $j('#page-wrapper').on('click',function(){ if ($j('.navbar-static-side').is(':visible')) { $j('body').removeClass('mini-navbar'); } }); $j('#burger-menu a').on('click',function(){ if ($j('#burger-menu span').is(':visible')) { $j('.mini-compte').css({'display':'block'}); $j('#burger-menu span').css({'display':'none'}); } else { if ($j('.taille-ecran').is(':visible')) { $j('#burger-menu span').css({'display':'inline'}); $j('.mini-compte').css({'display':'none'}); } else { $j('.mini-compte').css({'display':'block'}); $j('#burger-menu span').css({'display':'none'}); } } }); }); function exportButtonExcel(grid, documentName, id = 'grid2ExcelBtnId') { Ext.getCmp(id).enableLoader(); const conf = grid.getColumnModel().config; const data = grid.getStore().data.items; tabData = new Array(); $j.each(data, function (index, value) { if (!value.hidden) { tabData.push(new Array(JSON.stringify(value.data))); } }); tabHeader = new Array(); $j.each(conf, function (index, value) { if (!value.hidden) { tabHeader.push(new Array(value.header, value.dataIndex)); } }); const etatObjet_string = JSON.stringify(tabHeader); const etatObjet_string_data = JSON.stringify(tabData); const idCustomExportGrid2Excel = documentName; Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/grid2Excel.php', params: { conf: etatObjet_string, data: etatObjet_string_data, file: idCustomExportGrid2Excel }, success: function (result, request) { document.location.href = 'https://aix.diesesoftware.com/sharedFiles/aix/temp/' + idCustomExportGrid2Excel + '.xlsx'; Ext.getCmp(id).disableLoader(); }, failure: function () { $j.gritter.add({ title: 'Erreur', text: 'Erreur système ou trop de résultat, opération impossible', image: '_img/notification/ko.png', sticky: false, time: '7000' }); Ext.getCmp(id).disableLoader(); } }); } function exportQueryToXlsx(id, filename, array) { Ext.getCmp(id).enableLoader(); Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/queryToXlsx.php', params: { grids: array, fileName: filename, tabID: tabBrowserID }, success: function (result, request) { window.bgTaskToken = makeid(); console.log(result); executeQuery_checkBgTask(true, window.bgTaskToken); $j.gritter.add({ title: 'Confirmation', text: 'Export lancé. Vous pouvez suivre l\'avancement en haut à droite.', image: '_img/notification/ok.png', sticky: false, time: '3000' }); Ext.getCmp(id).disableLoader(); } }); } function triggerClickPictoPresenceArtiste(thisCustom, thisImg, rechargerVolet,tabParams) { if (thisCustom.attr('data-clickProcessing') == 1) { return false; } if (thisCustom.attr('data-droitFinal') != 3) { return false; } thisCustom.attr('data-clickProcessing', 1); if (thisCustom.attr('rel') == '0') { var imageSiAnnuler = '_img/activiteArtiste_unchecked.png'; var estSuppression = 0; stateCustom = true; var thisRelSuivant = 1; } else { var imageSiAnnuler = thisImg.attr('src'); var estSuppression = 1; var stateCustom = false; var thisRelSuivant = 0; } thisImg.attr('src', '_img/ajax-loader3.gif'); if (parseInt(thisCustom.attr('data-categoriers')) == 1) { //idActiviteA=0&idActivitePG=12661&checkerAlertes=1&idFiche=3013&idTypeAbsence=&suppression=0&debut=2020-03-11+08%3A00%3A00&fin=2020-03-11+12%3A00%3A00 var strRev = thisCustom.attr('rev'); tabstrRev = strRev.split('-'); $j.ajax({ url: '_ajax/gta_checkAlerte.php', type: 'POST', data: { idActiviteA: 0, idActivitePG: tabstrRev[1], checkerAlertes: 1, extraParamsCOB_idRoles: tabstrRev[0], //idFiche:thisCustom.attr('data-idfichecob'), castParActivite_getIdFiche: 1, castParActivite_getIdFiche_idContact: thisCustom.attr('data-idcontact'), idTypeAbsence: 0, suppression: estSuppression, debut: thisImg.attr('name'), fin: thisImg.attr('data-datefin'), }, success: function (data) { var reponse = Ext.decode(data); if (reponse.resultat == 'ko') { new Ext.Window({ title: reponse.titre, closable: true, draggable: true, id: 'fenetreAlerte_' + thisImg.attr('rev'), modal: false, width: 500, resizable: false, pageX: window.pageXFenetreAlerteCastActivite, pageY: window.pageYFenetreAlerteCastActivite, height: 150, plain: true, stateful: false, layout: 'fit', html: '
' + reponse.message + '
', listeners: { close: function () { window.pageXFenetreAlerteCastActivite = (($j(window).width() / 2) - 150); window.pageYFenetreAlerteCastActivite = 10; if(window.CPA_cancelAlertButton) { thisImg.attr('src', imageSiAnnuler); } window.CPA_cancelAlertButton=false; thisCustom.attr('data-clickProcessing', 0); } }, bbar: [ {xtype: 'tbfill'}, { text: 'Annuler', iconCls: 'cancel', handler: function () { window.CPA_cancelAlertButton=true; Ext.getCmp('fenetreAlerte_' + thisImg.attr('rev')).close(); } }, { text: 'Confirmer', iconCls: 'check', handler: function () { Ext.Ajax.request({ waitMsg: 'Mise à jour?', url: '_ajax/majContactCastActivite.php', timeout:45000, params: {state: stateCustom, idFicheCob:thisCustom.attr('data-idfichecob'), id: thisImg.attr('rev')}, success: function (response) { var reponse = Ext.decode(response.responseText); thisImg.attr('rel', thisRelSuivant); thisCustom.attr('rel', thisRelSuivant); thisImg.attr('src', reponse.image); thisImg.parent().addClass('notifMajPicto'); thisImg.next().attr('rel', reponse.id); thisImg.next().next().attr('rel', reponse.id); thisCustom.attr('data-idfichecob', reponse.idFicheCob); $j('.pictoPresenceArtisteTD').aToolTip(); if (rechargerVolet) { var parametres1 = Ext.decode($j('#parametres_volet1').val()); parametres1.dateChecked = thisImg.attr('name'); $j('#parametres_volet1').val(Ext.encode(parametres1)); majVolet_volet1(Ext.decode($j('#parametres_volet1').val())); } thisCustom.find('.divHoraireDifferent').css('display', 'none'); thisCustom.find('.divHoraireDifferent2').css('display', 'none'); Ext.getCmp('fenetreAlerte_' + thisImg.attr('rev')).close(); thisCustom.attr('data-clickProcessing', 0); if(parseInt(tabParams.refreshCastPG)==1) { if (thisCustom.attr('data-fonctioncastsysteme') == '13' || thisCustom.attr('data-fonctioncastsysteme') == '14') { loadMiniCast(tabParams.idProductionForcee,tabParams.idActivite,0); } } } }); } } ] }).show(); window.pageXFenetreAlerteCastActivite = window.pageXFenetreAlerteCastActivite + 10; window.pageYFenetreAlerteCastActivite = window.pageYFenetreAlerteCastActivite + 10; } else { Ext.Ajax.request({ waitMsg: 'Mise à jour?', url: '_ajax/majContactCastActivite.php', timeout:45000, params: {state: stateCustom, idFicheCob:thisCustom.attr('data-idfichecob'), id: thisImg.attr('rev')}, success: function (response) { var reponse = Ext.decode(response.responseText); thisImg.attr('rel', thisRelSuivant); thisCustom.attr('rel', thisRelSuivant); thisImg.attr('src', reponse.image); thisImg.parent().addClass('notifMajPicto'); thisImg.next().attr('rel', reponse.id); thisImg.next().next().attr('rel', reponse.id); thisCustom.attr('data-idfichecob', reponse.idFicheCob); //thisCustom.attr('title','ziou'); if (rechargerVolet) { var parametres1 = Ext.decode($j('#parametres_volet1').val()); parametres1.dateChecked = thisImg.attr('name'); $j('#parametres_volet1').val(Ext.encode(parametres1)); $j('.pictoPresenceArtisteTD').aToolTip(); majVolet_volet1(Ext.decode($j('#parametres_volet1').val())); } thisCustom.find('.divHoraireDifferent').css('display', 'none'); thisCustom.find('.divHoraireDifferent2').css('display', 'none'); thisCustom.attr('data-clickProcessing', 0); if(parseInt(tabParams.refreshCastPG)==1) { if (thisCustom.attr('data-fonctioncastsysteme') == '13' || thisCustom.attr('data-fonctioncastsysteme') == '14') { loadMiniCast(tabParams.idProductionForcee,tabParams.idActivite,0); } } } }); } }, error: function (xhr, textStatus, errorThrown) { Ext.MessageBox.show({ title: 'Erreur', msg: 'Erreur système ou réseau', buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } }); } else { Ext.Ajax.request({ waitMsg: 'Mise à jour?', url: '_ajax/barrieres/reglesCastActivite/check.php', params: { id: thisImg.attr('rev'), //idRole_idActivite_idMoment estSuppression: estSuppression, fstart:thisImg.attr('name'), fend:thisImg.attr('data-datefin'), quickCast:thisImg.attr('data-quickcast') }, success: function (result, request) { var reponse = Ext.decode(result.responseText); if (reponse.message != '') { new Ext.Window({ title: reponse.titre, closable: true, draggable: true, id: 'fenetreAlerte_' + thisImg.attr('rev'), modal: false, width: 500, resizable: false, pageX: window.pageXFenetreAlerteCastActivite, pageY: window.pageYFenetreAlerteCastActivite, height: 150, plain: true, stateful: false, layout: 'fit', html: '
' + reponse.message + '
', listeners: { close: function () { window.pageXFenetreAlerteCastActivite = (($j(window).width() / 2) - 150); window.pageYFenetreAlerteCastActivite = 10; thisCustom.attr('data-clickProcessing', 0); if(window.CPA_cancelAlertButton) { thisImg.attr('src', imageSiAnnuler); } window.CPA_cancelAlertButton=false; } }, bbar: [ {xtype: 'tbfill'}, { text: 'Annuler', iconCls: 'cancel', handler: function () { window.CPA_cancelAlertButton=true; Ext.getCmp('fenetreAlerte_' + thisImg.attr('rev')).close(); } }, { text: 'Confirmer', iconCls: 'check', handler: function () { Ext.Ajax.request({ waitMsg: 'Mise à jour?', url: '_ajax/majContactCastActivite.php', timeout:45000, params: {state: stateCustom, idFicheCob:thisCustom.attr('data-idfichecob'), id: thisImg.attr('rev')}, success: function (response) { var reponse = Ext.decode(response.responseText); thisImg.attr('rel', thisRelSuivant); thisCustom.attr('rel', thisRelSuivant); thisImg.attr('src', reponse.image); thisImg.parent().addClass('notifMajPicto'); thisImg.next().attr('rel', reponse.id); thisImg.next().next().attr('rel', reponse.id); thisCustom.attr('data-idfichecob', reponse.idFicheCob); $j('.pictoPresenceArtisteTD').aToolTip(); if (rechargerVolet) { var parametres1 = Ext.decode($j('#parametres_volet1').val()); parametres1.dateChecked = thisImg.attr('name'); $j('#parametres_volet1').val(Ext.encode(parametres1)); majVolet_volet1(Ext.decode($j('#parametres_volet1').val())); } thisCustom.find('.divHoraireDifferent').css('display', 'none'); thisCustom.find('.divHoraireDifferent2').css('display', 'none'); Ext.getCmp('fenetreAlerte_' + thisImg.attr('rev')).close(); thisCustom.attr('data-clickProcessing', 0); if(parseInt(tabParams.refreshCastPG)==1) { if (thisCustom.attr('data-fonctioncastsysteme') == '13' || thisCustom.attr('data-fonctioncastsysteme') == '14') { loadMiniCast(tabParams.idProductionForcee,tabParams.idActivite,0); } } } }); } } ] }).show(); window.pageXFenetreAlerteCastActivite = window.pageXFenetreAlerteCastActivite + 10; window.pageYFenetreAlerteCastActivite = window.pageYFenetreAlerteCastActivite + 10; } else { Ext.Ajax.request({ waitMsg: 'Mise à jour?', url: '_ajax/majContactCastActivite.php', timeout:45000, params: {state: stateCustom, idFicheCob:thisCustom.attr('data-idfichecob'), id: thisImg.attr('rev')}, success: function (response) { var reponse = Ext.decode(response.responseText); thisImg.attr('rel', thisRelSuivant); thisCustom.attr('rel', thisRelSuivant); thisImg.attr('src', reponse.image); thisImg.parent().addClass('notifMajPicto'); thisImg.next().attr('rel', reponse.id); thisImg.next().next().attr('rel', reponse.id); thisCustom.attr('data-idfichecob', reponse.idFicheCob); //thisCustom.attr('title','ziou'); if (rechargerVolet) { var parametres1 = Ext.decode($j('#parametres_volet1').val()); parametres1.dateChecked = thisImg.attr('name'); $j('#parametres_volet1').val(Ext.encode(parametres1)); $j('.pictoPresenceArtisteTD').aToolTip(); majVolet_volet1(Ext.decode($j('#parametres_volet1').val())); } thisCustom.find('.divHoraireDifferent').css('display', 'none'); thisCustom.find('.divHoraireDifferent2').css('display', 'none'); thisCustom.attr('data-clickProcessing', 0); if(parseInt(tabParams.refreshCastPG)==1) { if (thisCustom.attr('data-fonctioncastsysteme') == '13' || thisCustom.attr('data-fonctioncastsysteme') == '14') { loadMiniCast(tabParams.idProductionForcee,tabParams.idActivite,0); } } } }); } } }); } }; function reloadlistpj() { Ext.Ajax.request({ url: '_ajax/listePJ_temp_contractual_doc.php', params: { nomRepertoireTemp: Ext.getCmp("formPanel_sendByMail_utilisationTemplate_dirId").getValue(), }, success: function(result) { $j('#window_sendByMail_utilisationTemplate_PJ_span').empty(); var reponse=Ext.decode(result.responseText); $j.each(reponse,function(index,value) { $j('#window_sendByMail_utilisationTemplate_PJ_span').append(' '+value.label+'x'); }); $j('.supprimerAttachementTemp').click(function(){ var labelFichier = $j(this).attr('rev'); $j(this).empty().append(''); Ext.Ajax.request({ url: '_ajax/listePJ_temp_contractual_doc_supp.php', params: { nomfichier: labelFichier, nomRepertoireTemp: Ext.getCmp("formPanel_sendByMail_utilisationTemplate_dirId").getValue(), }, success: function() { reloadlistpj(); }, }); }); } }); } function contractualDocumentSendByMail(idGrid,idFiche,idContact,fromBdc=0) { if(Ext.getCmp(idGrid).selModel.getCount()==0) { $j.gritter.add({title: 'Erreur',text: 'Merci de sélection un et un seul contrat',image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } var selectionContratAEditer = Ext.getCmp(idGrid).selModel.getSelections(); if(selectionContratAEditer[0].data.lien=='') { $j.gritter.add({title: 'Erreur',text: 'Générez le PDF du document contractuel en utilisant le statut approprié afin de pouvoir envoyer le mail',image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } new Ext.Window({ title: 'Envoyer ce contrat par mail ('+selectionContratAEditer[0].json.intitule+')', closable:true, autoScroll:true, minimizable:false, modal:true, width: 1040, resizable:false, height: 850, plain:true, layout: 'fit', id: 'window_sendByMail_utilisationTemplateId', items:[ new Ext.form.FormPanel({ frame: true, id:'formPanel_sendByMail_utilisationTemplateId', bodyStyle:'padding:5px', standardSubmit: false, method: 'POST', baseCls: 'x-plain', labelWidth: 150, items: [ new Ext.form.FieldSet({ labelWidth:150, collapsible: false, // title: 'Contenu de l\'email', autoHeight: true, items: [ { //hidden text to store the name of the folder were we will put all the file to send xtype:'textfield', hidden:'true', id:'formPanel_sendByMail_utilisationTemplate_dirId', name:'formPanel_sendByMail_utilisationTemplate_dir', }, new Ext.ux.form.SuperBoxSelect({ id:'formPanelAjouterContrat_fieldset2_contactId', hiddenName:'formPanelAjouterContrat_fieldset2_contact', fieldLabel: 'Destinataire', emptyText:'Choix...', resizable: true, name: 'states', width:800, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_emailContact.php' }), remoteSort: true, autoLoad: false, fields : [{name:'id',type:'int'},'label'] }), mode: 'remote', displayField: 'label', displayFieldTpl: '{label}', minChars:1, valueField: 'id', forceSelection : true, }), new Ext.ux.form.SuperBoxSelect({ id:'formPanelAjouterContrat_fieldset2_contactccId', hiddenName:'formPanelAjouterContrat_fieldset2_contactcc', fieldLabel: 'Cc', emptyText:'Choix...', resizable: true, name: 'states', width:800, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_emailContact.php' }), remoteSort: true, autoLoad: false, fields : [{name:'id',type:'int'},'label'] }), mode: 'remote', displayField: 'label', displayFieldTpl: '{label}', minChars:1, valueField: 'id', forceSelection : true, }), new Ext.ux.form.SuperBoxSelect({ id:'formPanelAjouterContrat_fieldset2_contactbccId', hiddenName:'formPanelAjouterContrat_fieldset2_contactbcc', fieldLabel: 'Cci', emptyText:'Choix...', resizable: true, name: 'states', width:800, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_emailContact.php' }), remoteSort: true, autoLoad: false, fields : [{name:'id',type:'int'},'label'] }), mode: 'remote', displayField: 'label', displayFieldTpl: '{label}', minChars:1, valueField: 'id', forceSelection : true, }), { xtype:'displayfield', fieldLabel:'Pièce jointe', value:'
' }, { xtype:'textfield', width:800, fieldLabel:'Sujet', name:'formPanel_sendByMail_utilisationTemplate_sujet', id:'formPanel_sendByMail_utilisationTemplate_sujetId' }, { xtype:'htmleditor', width:800, height:450, name:'formPanel_sendByMail_utilisationTemplate_message', id:'formPanel_sendByMail_utilisationTemplate_messageId', fieldLabel:'Message' } ] }), ] }) ], tbar:[ { text: 'Sujet', iconCls: 'textShort', menu:{ items:[ { text: 'Texte mail convocation EN / objet', id:'17', handler:function() { Ext.getCmp('formPanel_sendByMail_utilisationTemplateId').getForm().load({ url: '_datasMysql/form_fiche_contrat_envoi_doc.php', params: { idTexte:17, idDocContractuel: selectionContratAEditer[0].json.id, idContact:idContact }, }) } }, ] } }, { text: 'Contenu', iconCls: 'textSubject', menu:{ items:[ { text: 'Texte mail convocation EN / message', id:'16', handler:function() { Ext.getCmp('formPanel_sendByMail_utilisationTemplateId').getForm().load({ url: '_datasMysql/form_fiche_contrat_envoi_doc.php', params: { idTexte:16, idDocContractuel: selectionContratAEditer[0].json.id, idContact:idContact }, }) } }, ] } }, { text: 'Ajouter une pièce jointe', iconCls: 'attachment', handler:function() { var fileUploaderWizard = new Diese.UI.FileModalUploader({ uploadFileServiceURL:'_ajax/uploader_temp_file_contractual_doc.php', // https://diesestatic.diesesoftware.com/upload.php formFileParameterName:'formulaireUploadFichier', customFormDataAction:function(fileData,formData){ formData.append('formulaireUploadFichier_intitule',fileData.fileCaption); formData.append('idProduction',''); formData.append('userId',''); formData.append('userName',""); formData.append('idClient',"aix"); formData.append('idSubClient',"aix"); formData.append('id',""); formData.append('dir',Ext.getCmp("formPanel_sendByMail_utilisationTemplate_dirId").getValue()); } }); fileUploaderWizard.onFilesUploaded.subscribe(function() { reloadlistpj(); }); fileUploaderWizard.show(); } } ], bbar:[ { xtype:'tbfill' }, { xtype:'button', text:'Envoyer', id:'window_sendByMail_utilisationTemplate_buttonSubmitId', iconCls:'sendMail', handler:function() { var tabDestinataires = new Array(); //ici on doit recup supercombo et tranformer en tabdestinataire var value=Ext.getCmp('formPanelAjouterContrat_fieldset2_contactId').getValue(); tabDestinataires.push(value); var selectionDestinatairesFinale = value; var valueCC=Ext.getCmp('formPanelAjouterContrat_fieldset2_contactccId').getValue(); var valueBCC=Ext.getCmp('formPanelAjouterContrat_fieldset2_contactbccId').getValue(); var messageErreur=''; if(Ext.getCmp('formPanelAjouterContrat_fieldset2_contactId').getValue() == '') { var messageErreur = messageErreur + 'Merci de cocher au moins un destinataire
'; } if(Ext.getCmp('formPanel_sendByMail_utilisationTemplate_messageId').getValue()=='
') { var messageErreur = messageErreur + 'Le champ message est obligatoire
'; } if(Ext.getCmp('formPanel_sendByMail_utilisationTemplate_sujetId').getValue()=='') { var messageErreur = messageErreur + 'Le champ sujet est obligatoire
'; } if(messageErreur!='') { $j.gritter.add({title: 'Erreur',text: messageErreur,image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } Ext.getCmp('window_sendByMail_utilisationTemplate_buttonSubmitId').enableLoader(); Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/genRandomKey.php', params: {}, success: function(data) { var idKey = data.responseText; Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/envoyerEmailDocumentContractuel.php', params: { idDocContractuel: selectionContratAEditer[0].json.id, message:Ext.getCmp('formPanel_sendByMail_utilisationTemplate_messageId').getValue(), sujet:Ext.getCmp('formPanel_sendByMail_utilisationTemplate_sujetId').getValue(), destinataires:selectionDestinatairesFinale, idDocContractuel: selectionContratAEditer[0].json.id, idFiche:idFiche, idContact:idContact, idKey:idKey, dir:Ext.getCmp('formPanel_sendByMail_utilisationTemplate_dirId').getValue(), cc:valueCC, bcc:valueBCC, fromBdc:fromBdc }, success: function (result,request) { $j.gritter.add({title: 'Confirmation',text: 'Votre email a bien été envoyé',image: '_img/notification/ok.png',sticky: false, time: '2000'}); Ext.getCmp('window_sendByMail_utilisationTemplateId').close(); window.gridNotes.getStore().reload(); } }); } }); } } ] }).show(); Ext.getCmp('formPanel_sendByMail_utilisationTemplateId').getForm().load({ url: '_datasMysql/form_envoyerDocumentContractuel.php', params: { idDocContractuel: selectionContratAEditer[0].json.id, idContact:idContact, idFiche:idFiche, }, success:function(action, response) { $j('#window_sendByMail_utilisationTemplate_PJ_span').empty().append(response.result.data.fichier); Ext.getCmp('formPanel_sendByMail_utilisationTemplate_dirId').setValue(response.result.dir); var store = Ext.getCmp('formPanelAjouterContrat_fieldset2_contactId').getStore(); store.load({ params:{ idFichesComm: response.result.idFicheComm, }, callback: function() { Ext.getCmp('formPanelAjouterContrat_fieldset2_contactId').setValue(response.result.idFicheComm); }, }); reloadlistpj(); } }); } function openFrichteePanelPlanning(label,file,tabParams) { if(!window.globalAltDown) { return false; } frichteePanelWindow = new Ext.Window({ title: label, closable:true, draggable:true, modal:true, frichtee: true, resizable:false, plain:true, layout: 'fit', id: 'frichteePanelWindowId', items: new Ext.form.FormPanel({ frame: true, standardSubmit: false, method: 'POST', cls:'labelTopResponsive', baseCls: 'x-plain', labelWidth: 100, defaults: { //anchors: 500 }, defaultType: 'textfield', items: [ { xtype:'displayfield', hideLabel:true, value:'
' } ] }), bbar:[ { text:'Fermer', iconCls:'cancel', handler:function() { frichteePanelWindow.close(); } } ], listeners:{ show:function() { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_volets/'+file, params: { params:Ext.encode(tabParams) }, success: function (result, request) { $j('#container_frichteePanelWindow').empty().append(result.responseText); } }); } } }); frichteePanelWindow.show(); } function exportButtonExcel(grid, documentName, id = 'grid2ExcelBtnId') { Ext.getCmp(id).enableLoader(); const conf = grid.getColumnModel().config; const data = grid.getStore().data.items; tabData = new Array(); $j.each(data, function (index, value) { if (!value.hidden) { tabData.push(new Array(JSON.stringify(value.data))); } }); tabHeader = new Array(); $j.each(conf, function (index, value) { if (!value.hidden) { tabHeader.push(new Array(value.header, value.dataIndex)); } }); const etatObjet_string = JSON.stringify(tabHeader); const etatObjet_string_data = JSON.stringify(tabData); const idCustomExportGrid2Excel = documentName; Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/grid2Excel.php', params: { conf: etatObjet_string, data: etatObjet_string_data, file: idCustomExportGrid2Excel }, success: function (result, request) { document.location.href = 'https://aix.diesesoftware.com/sharedFiles/aix/temp/' + idCustomExportGrid2Excel + '.xlsx'; Ext.getCmp(id).disableLoader(); }, failure: function () { $j.gritter.add({ title: 'Erreur', text: 'Erreur système ou trop de résultat, opération impossible', image: '_img/notification/ko.png', sticky: false, time: '7000' }); Ext.getCmp(id).disableLoader(); } }); } function exportQueryToXlsx(id, filename, array) { Ext.getCmp(id).enableLoader(); Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/queryToXlsx.php', params: { grids: array, fileName: filename, tabID: tabBrowserID }, success: function (result, request) { window.bgTaskToken = makeid(); console.log(result); executeQuery_checkBgTask(true, window.bgTaskToken); $j.gritter.add({ title: 'Confirmation', text: 'Export lancé. Vous pouvez suivre l\'avancement en haut à droite.', image: '_img/notification/ok.png', sticky: false, time: '3000' }); Ext.getCmp(id).disableLoader(); } }); } function formPanelContactExpress(idElement, marginTop, marginRight, marginLeft, position, mail) { var idElementJquery = $j('#' + idElement + ''); var superComboSelect = false; if (typeof (Ext.getCmp(idElement).inputEl) !== 'undefined') { var stringTest = $j(Ext.getCmp(idElement).inputEl.dom).attr('class'); if (stringTest.includes('superbox')) { var idElementJquery = $j('#x-form-el-' + idElement + '').children(); var superComboSelect = true; } } console.log(idElementJquery.parent().parent()); idElementJquery.parent().parent().append(''); $j('#imgAddContactExpress' + idElement).click(function () { Ext.getCmp(idElement).getStore().load(); var tabFieldSetAffiches = new Array(); var formPanelAjoutContactExpress = new Ext.FormPanel({ frame: true, formId: 'formPanelAjoutContactExpress', xtype: 'form', bodyStyle: 'padding:5px;', method: 'POST', autoScroll: true, id: 'fournisseur_ajouterContactWindow_formPanel', items: [ new Ext.form.FieldSet({ collapsible: false, width: 450, title: 'Informations générales', autoHeight: true, items: [ new Ext.form.ComboBox({ name: 'fournisseur_ajouterContactWindow_formPanel_titre', id: 'fournisseur_ajouterContactWindow_formPanel_titreId', width: 200, hideOnSelect: false, store: new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_titres.php' }), remoteSort: true, autoLoad: true, fields: ['id', 'abrev'] }), triggerAction: 'all', valueField: 'id', queryParam: 'term', displayField: 'abrev', fieldLabel: 'Titre', mode: 'local' }), { xtype: 'textfield', name: 'fournisseur_ajouterContactWindow_formPanel_nom', id: 'fournisseur_ajouterContactWindow_formPanel_nomId', enableKeyEvents: true, fieldLabel: 'Nom', width: 200, listeners: { keydown: function (thisCustom, param2) { if (param2.browserEvent.key == '"') { // if(!param2.shiftKey && !param2.ctrlKey && param2.keyCode==51) { $j.gritter.add({ title: 'Erreur', text: 'Les guillemets ne sont pas autorisés dans ce champ.', image: '_img/notification/ko.png', sticky: false, time: '1000' }); return false; } }, blur: function (thisCustom, param2, param3) { var str = Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_nomId').getValue(); if (str.indexOf('"') >= 0) { Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_nomId').setValue(''); $j.gritter.add({ title: 'Erreur', text: 'Les guillemets ne sont pas autorisés dans ce champ.', image: '_img/notification/ko.png', sticky: false, time: '1000' }); return false; } }, keyup: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/fournisseur_ajouterContactWindow_formPanel_doublonDiv.php', params: { prenom: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_prenomId').getValue(), nom: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_nomId').getValue() }, success: function (result, request) { $j('#fournisseur_ajouterContactWindow_formPanel_doublonDiv').empty().append(result.responseText); $j('.contactExpressPreSelect').click(function () { var thisRelIdContactExpress = $j(this).attr('rel'); if (superComboSelect) { Ext.getCmp(idElement).getStore().load({ params: { idContactUnique: thisRelIdContactExpress }, callback: function (records, options, success) { Ext.getCmp(idElement).addItem({ id: parseInt(thisRelIdContactExpress) }); Ext.getCmp('fournisseur_ajouterContactWindow').close(); } }); } else { Ext.getCmp(idElement).getStore().load({ params: { idContactUnique: thisRelIdContactExpress }, callback: function (records, options, success) { $j('#contactExpressPreSelect').val(thisRelIdContactExpress); Ext.getCmp('fournisseur_ajouterContactWindow').close(); ComboSetter(Ext.getCmp(idElement), thisRelIdContactExpress, false); } }); } }); } }); } } }, { xtype: 'textfield', enableKeyEvents: true, name: 'fournisseur_ajouterContactWindow_formPanel_prenom', id: 'fournisseur_ajouterContactWindow_formPanel_prenomId', fieldLabel: 'Prénom', width: 200, listeners: { keydown: function (thisCustom, param2, param3) { if (param2.browserEvent.key == '"') { // if(!param2.shiftKey && !param2.ctrlKey && param2.keyCode==51) { $j.gritter.add({ title: 'Erreur', text: 'Les guillemets ne sont pas autorisés dans ce champ.', image: '_img/notification/ko.png', sticky: false, time: '1000' }); return false; } }, blur: function (thisCustom, param2, param3) { var str = Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_prenomId').getValue(); if (str.indexOf('"') >= 0) { Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_prenomId').setValue(''); $j.gritter.add({ title: 'Erreur', text: 'Les guillemets ne sont pas autorisés dans ce champ.', image: '_img/notification/ko.png', sticky: false, time: '1000' }); return false; } }, keyup: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/fournisseur_ajouterContactWindow_formPanel_doublonDiv.php', params: { prenom: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_prenomId').getValue(), nom: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_nomId').getValue() }, success: function (result, request) { $j('#fournisseur_ajouterContactWindow_formPanel_doublonDiv').empty().append(result.responseText); $j('.contactExpressPreSelect').click(function () { var thisRelIdContactExpress = $j(this).attr('rel'); if (superComboSelect) { Ext.getCmp(idElement).getStore().load({ params: { idContactUnique: thisRelIdContactExpress }, callback: function (records, options, success) { Ext.getCmp(idElement).addItem({ id: parseInt(thisRelIdContactExpress) }); Ext.getCmp('fournisseur_ajouterContactWindow').close(); } }); } else { Ext.getCmp(idElement).getStore().load({ params: { idContactUnique: thisRelIdContactExpress }, callback: function (records, options, success) { $j('#contactExpressPreSelect').val(thisRelIdContactExpress); Ext.getCmp('fournisseur_ajouterContactWindow').close(); ComboSetter(Ext.getCmp(idElement), thisRelIdContactExpress, false); } }); } }); } }); } } }, { xtype: 'textfield', enableKeyEvents: true, name: 'fournisseur_ajouterContactWindow_formPanel_mail', id: 'fournisseur_ajouterContactWindow_formPanel_mailId', fieldLabel: 'Mail', width: 200, listeners: { keydown: function (thisCustom, param2, param3) { if (param2.browserEvent.key == '"') { // if(!param2.shiftKey && !param2.ctrlKey && param2.keyCode==51) { $j.gritter.add({ title: 'Erreur', text: 'Les guillemets ne sont pas autorisés dans ce champ.', image: '_img/notification/ko.png', sticky: false, time: '1000' }); return false; } }, blur: function (thisCustom, param2, param3) { var str = Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_prenomId').getValue(); if (str.indexOf('"') >= 0) { Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_prenomId').setValue(''); $j.gritter.add({ title: 'Erreur', text: 'Les guillemets ne sont pas autorisés dans ce champ.', image: '_img/notification/ko.png', sticky: false, time: '1000' }); return false; } }, keyup: function () { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/fournisseur_ajouterContactWindow_formPanel_doublonDiv.php', params: { prenom: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_prenomId').getValue(), nom: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_nomId').getValue() }, success: function (result, request) { $j('#fournisseur_ajouterContactWindow_formPanel_doublonDiv').empty().append(result.responseText); $j('.contactExpressPreSelect').click(function () { var thisRelIdContactExpress = $j(this).attr('rel'); if (superComboSelect) { Ext.getCmp(idElement).getStore().load({ params: { idContactUnique: thisRelIdContactExpress }, callback: function (records, options, success) { Ext.getCmp(idElement).addItem({ id: parseInt(thisRelIdContactExpress) }); Ext.getCmp('fournisseur_ajouterContactWindow').close(); } }); } else { Ext.getCmp(idElement).getStore().load({ params: { idContactUnique: thisRelIdContactExpress }, callback: function (records, options, success) { $j('#contactExpressPreSelect').val(thisRelIdContactExpress); Ext.getCmp('fournisseur_ajouterContactWindow').close(); ComboSetter(Ext.getCmp(idElement), thisRelIdContactExpress, false); } }); } }); } }); } } }, new Ext.form.ComboBox({ name: 'fournisseur_ajouterContactWindow_formPanel_typec', id: 'fournisseur_ajouterContactWindow_formPanel_typecId', width: 200, hideOnSelect: false, store: new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_roles_typesContacts.php?checkDroit3=1' }), remoteSort: true, autoLoad: true, listeners: { load: function () { var store = Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getStore(); if (store.data.items.length == 1) { Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').setValue(store.data.items[0].id); Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').fireEvent('select', '', store.data.items[0], ''); } }, }, fields: [{ name: 'id', type: 'int' }, 'intitule', 'fieldset'] }), triggerAction: 'all', valueField: 'id', queryParam: 'term', minChars: 1, displayField: 'intitule', fieldLabel: 'Type', mode: 'remote', listeners: { select: function (combo, record, index) { displayMandatoryFieldset(record); }, blur: function(combo, record, index) { var index = this.store.findExact('id', parseInt(this.getValue())); var record = this.store.getAt(index); displayMandatoryFieldset(record); } } }), new Ext.ux.form.LovCombo({ name: 'fournisseur_ajouterContactWindow_formPanel_services', id: 'fournisseur_ajouterContactWindow_formPanel_servicesId', width: 200, separator: ';', listWidth: 400, hideOnSelect: false, store: new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_services_creationContact.php' }), remoteSort: true, autoLoad: true, fields: [{ name: 'id', type: 'int' }, 'intitule'],//$arrayUtilisateur listeners: { load: function () { Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_servicesId').setValue('{{ userArray.services }}'); var store = Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_servicesId').getStore(); if (store.data.items.length == 1) { Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_servicesId').setValue(store.data.items[0].id); } }, } }), triggerAction: 'all', valueField: 'id', queryParam: 'term', displayField: 'intitule', fieldLabel: 'Géré par', mode: 'local', listeners: { afterrender: function () { } } }) ] }), new Ext.form.FieldSet({ collapsible: false, width: 450, title: 'Recherche d\'homonymes', autoHeight: true, items: [ { xtype: 'displayfield', hideLabel: true, value: '
' } ] }) ], buttons: [ { text: 'Créer', iconCls: 'save', handler: function (thisCustom) { var messageErreur = '' if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_servicesId').getValue() == '') { var messageErreur = messageErreur + 'Le champ Géré par est obligatoire.
'; } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '') { var messageErreur = messageErreur + 'Le champ type est obligatoire.
'; } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_nomId').getValue() == '') { var messageErreur = messageErreur + 'Le champ nom est obligatoire.
'; } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_titreId').getValue() == '') { var messageErreur = messageErreur + 'Le champ titre est obligatoire.
'; } if(mail == true) { if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_mailId').getValue() == '') { var messageErreur = messageErreur + 'Le champ mail est obligatoire.'; } } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '1') { } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '4') { } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '5') { } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '7') { } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '9') { } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '10') { } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '11') { } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '12') { } if (Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue() == '13') { } window.varThisRel = $j(this).attr('rel'); if (messageErreur != '') { $j.gritter.add({ title: 'Erreur(s)', text: messageErreur, image: '_img/notification/ko.png', sticky: false, time: '3000' }); } else { thisCustom.enableLoader(); Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/ajouterContactExpress.php', params: { prenom: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_prenomId').getValue(), titre: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_titreId').getValue(), nom: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_nomId').getValue(), mail: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_mailId').getValue(), services: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_servicesId').getValue(), type: Ext.getCmp('fournisseur_ajouterContactWindow_formPanel_typecId').getValue(), formValues: Ext.encode(formPanelAjoutContactExpress.getForm().getValues()) }, success: function (result, request) { Ext.getCmp('fournisseur_ajouterContactWindow').close(); var thisIdCustom = result.responseText; if (superComboSelect) { Ext.getCmp(idElement).getStore().load({ params: { idContactUnique: thisIdCustom }, callback: function (records, options, success) { Ext.getCmp(idElement).addItem({ id: parseInt(thisIdCustom) }); } }); } else { Ext.getCmp(idElement).getStore().load({ params: { idContactUnique: thisIdCustom }, callback: function (records, options, success) { Ext.getCmp(idElement).setValue(parseInt(thisIdCustom)); Ext.getCmp(idElement).fireEvent('select'); $j('.contactie_tempName').empty().append(Ext.getCmp(idElement).getRawValue()); $j.gritter.add({ title: 'Confirmation', text: 'Le contact a bien été créé', image: '_img/notification/ok.png', sticky: false, time: '1000' }); } }); } } }); } } } ] }); new Ext.Window({ title: 'Créer un nouveau contact', closable: true, draggable: false, modal: true, width: 500, resizable: false, height: 550, autoScroll: true, plain: true, layout: 'fit', id: 'fournisseur_ajouterContactWindow', items: [ formPanelAjoutContactExpress ], listeners:{ show:function(){ if(mail == true) { $j('#fournisseur_ajouterContactWindow_formPanel_mailId').parent().parent().css('display','block') } else { $j('#fournisseur_ajouterContactWindow_formPanel_mailId').parent().parent().css('display','none') } } } }).show(); }); } function formatrewriting(str) { str = str.replace(/\s+/g, '-').split('-'); str = str.map((elem) => elem.normalize('NFD').replace(/([\u0300-\u036f]|[^0-9a-zA-Z])/g, '')); return str.join('-'); } function gritter (image, text = null, time = 2000, title = null) { image = image.toLowerCase(); if (image == 'ok' ) { if (text == null) { text = 'Modification(s) effectuée(s)'; } if (title == null) { title = 'Confirmation' } } if (image == 'ko') { if (text == null) { text = 'Erreur'; } if (title == null) { title = 'Erreur'; } } $j.gritter.add({ title: title, text: text, image: '_img/notification/' + image +'.png', sticky: false, time: time }) } function saveGridState(grid, idGridUnique = null) { if (typeof(grid) === 'object') { var etatObjet = grid.getState(); var id = grid.getId(); } else if (typeof(grid) === 'string') { var etatObjet = Ext.getCmp(grid).getState(); var id = grid; } if(idGridUnique !== null) { id = idGridUnique; } var etatObjet_string = JSON.stringify(etatObjet); Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/saveGridState.php', scripts: true, params: { etat: etatObjet_string, idGridUnique: id } }); } function previewPdf(selectionContratAEditer) { if(selectionContratAEditer[0].data.lien=='') { $j.gritter.add({title: 'Erreur',text: 'Générez le PDF du document contractuel en utilisant le statut approprié afin de pouvoir envoyer le mail',image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } new Ext.Window({ title: 'Prévisualiser le PDF', closable:true, draggable:true, modal:true, resizable:false, frichtee:true, frichtee_minWidth:$j(window).width()/2, autoHeight: true, id: 'previewPdfId', html:'', bbar:[ { xtype:'button', text:'Fermer', iconCls:'cancel', handler:function() { Ext.getCmp('previewPdfId').close(); } } ] }).show(); } Date.prototype.getWeekNumber = function(){ var d = new Date(Date.UTC(this.getFullYear(), this.getMonth(), this.getDate())); var dayNum = d.getUTCDay() || 7; d.setUTCDate(d.getUTCDate() + 4 - dayNum); var yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1)); return Math.ceil((((d - yearStart) / 86400000) + 1)/7) }; /* Given a start date, end date and day name, return ** an array of dates between the two dates for the ** given day inclusive ** @param {Date} start - date to start from ** @param {Date} end - date to end on ** @param {string} dayName - name of day ** @returns {Array} array of Dates */ function getDaysBetweenDates(start, end, dayName) { var result = []; var days = {sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6}; var day = days[dayName.toLowerCase().substr(0,3)]; // Copy start date var current = new Date(start); // Shift to next of required days current.setDate(current.getDate() + (day - current.getDay() + 7) % 7); // While less than end date, add dates to result array while (current < end) { result.push(new Date(+current)); current.setDate(current.getDate() + 7); } return result; } function GTAFiltrerContrats(vue, forceDebut='', forceFin='') { var checkbox_contratAffiche = new Ext.grid.CheckColumn({ header: 'Affiché ?', dataIndex: 'contratAffiche', width:80, sortable: false }); if(vue=='month') { var valueTri = $j('#gtaM_userTri').val(); } else { var valueTri = $j('#gta_userTri').val() } var gridGTAFiltreContrats = new Ext.grid.EditorGridPanel({ id:'gridGTAFiltreContratsId', xtype:'editorgrid', view: new Ext.grid.GridView({ forceFit:true, listeners:{ refresh: function () { setTimeout(function () { $j.each($j('.x-grid3-scroller-gridGTAFiltreContratsId .x-grid3-row'), function (index, value) { var thisCustomActivityDiv = $j(this); thisCustomActivityDiv.attr('data-id',$j(this).find('.x-grid3-col:first').attr('data-id')); var thisCustomActivityDiv_dataId = $j(this).attr('data-id'); thisCustomActivityDiv.unbind('mouseenter'); thisCustomActivityDiv.mouseenter(function (e) { setTimeout(function () { if ($j('.x-grid3-row[data-id="' + thisCustomActivityDiv_dataId + '"]:hover').length != 0) { window.tooltipGridActivity_mouseEntered = true; thisCustomActivityDiv.tooltip({ title: '', html: true, trigger: 'manual', delay: { show: 0 }, }).tooltip('show'); window.ajaxRequest_majGenererToolTipCOB = $j.ajax({ url: '_ajax/gta_getTooltipContrat.php', type: 'POST', data: { id: thisCustomActivityDiv_dataId, }, success: function (data) { thisCustomActivityDiv.tooltip('dispose'); $j('.tooltip').remove(); if ($j('.x-grid3-row[data-id="' + thisCustomActivityDiv_dataId + '"]:hover').length != 0) { thisCustomActivityDiv.tooltip({ boundary: 'window', //placement: 'right', trigger: 'manual', delay: { show: 100 }, title: base64.decode(data), html: true }).tooltip('show'); } } }); } }, 250); }); thisCustomActivityDiv.mouseleave(function () { var thisCustomActivityDiv = $j(this); thisCustomActivityDiv.tooltip('dispose'); window.tooltipGridActivity_mouseEntered = false; }); }); }, 500); } } }), store: new Ext.data.Store({ remoteSort: false, autoLoad:false, proxy: new Ext.data.HttpProxy({ url: '_datasMysql/grid_gta_filtresContrats.php', method: 'POST' }), baseParams:{week:Ext.getCmp('filtreGta_weekId').getValue(), start:forceDebut, end: forceFin, vue:vue, sort: 'id', dir: 'ASC'}, reader: new Ext.data.JsonReader({ root: 'results', totalProperty: 'total', id: 'id' },[ {name: 'id', type: 'int', mapping: 'idFiche'}, {name: 'contratAffiche', type: 'int', mapping: 'contratAffiche'}, {name: 'idFiche', type: 'int', mapping: 'idFiche'}, {name: 'nom', type: 'string', mapping: 'nom'}, {name: 'prenom', type: 'string', mapping: 'prenom'}, {name: 'contratService', type: 'string', mapping: 'contratService'}, {name: 'contratFonction', type: 'string', mapping: 'contratFonction'}, {name: 'ordre', type: 'string', mapping: 'ordre'}, ]),sortInfo:{field: 'id', direction: "ASC"}, }), tbar:new Ext.Toolbar({ items:[ { text:'Tout sélectionner', iconCls:'selectall', handler:function() { var store = Ext.getCmp('gridGTAFiltreContratsId').getStore(); $j.each(store.data.items,function(index,value) { value.data.contratAffiche=1; }); store.commitChanges(); Ext.getCmp('gridGTAFiltreContratsId').getView().refresh(); } },{ text:'Tout désélectionner', iconCls:'unselectall', handler:function() { var store = Ext.getCmp('gridGTAFiltreContratsId').getStore(); $j.each(store.data.items,function(index,value) { value.data.contratAffiche=0; }); store.commitChanges(); Ext.getCmp('gridGTAFiltreContratsId').getView().refresh(); } }, '|', { xtype:'displayfield', value:'Trier par :  ' }, new Ext.form.ComboBox({ id:'gta_listeFiltreContratsId_tierPar', width:200, hideOnSelect:false, store:new Ext.data.SimpleStore({ fields:['id','intitule'], data:[ ['1','Nom'], ['2','Fonction / Nom'], ['3','Service / Fonction / Nom'], ['4','Service / Nom'], ['5','Lieu'], ['6','Ordre / Nom'], ['7','Type de contrat / nom'], ['8','Prénom'] ] }), triggerAction:'all', valueField:'id', value:valueTri, queryParam:'term', displayField:'intitule', mode:'local', listeners:{ select:function() { var store = Ext.getCmp('gridGTAFiltreContratsId').getStore(); store.baseParams.userTri=Ext.getCmp('gta_listeFiltreContratsId_tierPar').getValue(); store.load(); }, render:function() { var store = Ext.getCmp('gridGTAFiltreContratsId').getStore(); store.baseParams.userTri=Ext.getCmp('gta_listeFiltreContratsId_tierPar').getValue(); store.baseParams.week=Ext.getCmp('filtreGta_weekId').getValue(); store.load(); //userTri=Ext.getCmp('gta_listeFiltreContratsId_tierPar').getValue() } } }),'|', new Ext.ux.form.LovComboOkbtn({ name:'contacts_formpanel_GTAaffecterliste_triContrats', id:'contacts_formpanel_GTAaffecterlisteId_triContrats', width:200, listWidth:300, hideOnSelect:false, emptyText:'Choisir une liste...', store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_contactsGroupes.php', }), baseParams:{ gta:1, type:'1,2,3,4', }, remoteSort: true, autoLoad: true, fields : [{name:'id', type:'int'},'intitule'] }), triggerAction:'all', valueField:'id', queryParam:'term', displayField:'intitule', mode:'local', listeners:{ select:function(thisCustom) { var store = Ext.getCmp('gridGTAFiltreContratsId').getStore(); store.baseParams.idListe=Ext.getCmp('contacts_formpanel_GTAaffecterlisteId_triContrats').getValue(); store.load(); } } }), { text:'RAZ', iconCls:'erase', handler:function() { var store = Ext.getCmp('gridGTAFiltreContratsId').getStore(); store.baseParams.idListe=''; store.load(); Ext.getCmp('contacts_formpanel_GTAaffecterlisteId_triContrats').setValue(); } }, ], style:'background-color:#F9FBFD' }), height:$j(window).height()-190, stateful: true, clicksToEdit:2, plugins:[checkbox_contratAffiche], collapsible:false, collapsed:false, stripeRows: true, enableColLock:false, enableHdMenu:false, loadMask: 'Chargement des données…', cm: new Ext.grid.ColumnModel( [checkbox_contratAffiche, { header: 'Nom', sortable: true, dataIndex: 'nom', width: 250, renderer:function(value, cell, record) { return record.data.prenom+' '+record.data.nom; } },{ header: 'Service', sortable: true, dataIndex: 'contratService', width: 200 },{ header: 'Fonction', sortable: true, dataIndex: 'contratFonction', width: 200, },{ header: 'Ordre', sortable: true, editor:{ xtype:'numberfield' }, dataIndex: 'ordre', width: 100, } ] ), selModel: new Ext.grid.RowSelectionModel({singleSelect:false}), listeners:{ afteredit:function(oGrid_event) { Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/editerInline_filtrerContratGTA.php', params: { id: oGrid_event.record.data.idFiche, ordre: oGrid_event.record.data.ordre, }, success: function() { gridGTAFiltreContrats.getStore().reload(); $j.gritter.add({title: 'Confirmation',text: 'Modification effectuée',image: '_img/notification/ok.png',sticky: false, time: '1000'}); } }); } } }); new Ext.Window({ title: 'Filtrer les contrats affichés', closable:true, draggable:true, id:'gta_listeFiltreContratsId', modal:true, resizable:false, frichtee:true, frichtee_minWidth:$j(window).width()/2, plain:true, items: gridGTAFiltreContrats, listeners:{ close:function() { if(vue=='week') { loadGta(Ext.getCmp('filtreGta_weekId').getValue()); } else { if(Ext.getCmp('inner_gtaVueMensuelle_tbarDatefieldId').isVisible()) { loadGtaVueMensuelle(Ext.getCmp('inner_gtaVueMensuelle_tbar_moisId').getValue(), Ext.getCmp('inner_gtaVueMensuelle_tbar_anneeId').getValue(),Ext.getCmp('inner_gtaVueMensuelle_tbarDatefieldId').getValueSubmitFormat()); } else { loadGtaVueMensuelle(Ext.getCmp('inner_gtaVueMensuelle_tbar_moisId').getValue(), Ext.getCmp('inner_gtaVueMensuelle_tbar_anneeId').getValue()); } } } }, bbar:[ {xtype:'tbfill'},{ xtype:'button', iconCls:'check', text:'Valider', handler:function() { tabFinal = new Array(0); var store = Ext.getCmp('gridGTAFiltreContratsId').getStore(); $j.each(store.data.items,function(index,value) { if(value.data.contratAffiche) { tabFinal.push(value.data.idFiche); } }); this.enableLoader(); Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/gta_filtrerContrat_afficher.php', params: { ids:tabFinal.join(','), vue:vue }, success: function() { Ext.getCmp('gta_listeFiltreContratsId').close(); } }); } } ] }).show(); } function emptyGridMessage(elementReference, text = "Il n\'y a rien à afficher") { var enfant = elementReference[0].children; setTimeout(() => { enfant[0].innerHTML = "

" + text + "

"; }, 1); } function navigation(formPanelId, submitBtn,windowElement) { var keyMap = Ext.getCmp(formPanelId).getKeyMap(); keyMap.on(13,function() { if (windowElement.frichtee) { submitBtn = 'customBtnFrichtee-' + submitBtn.replace('customBtnFrichtee-',''); document.getElementById(submitBtn).click(); } else { document.getElementById(submitBtn).click(); } }); keyMap.on(9,function() { var focusedId = document.activeElement; var focusedCmp = Ext.getCmp(focusedId.id); focusedCmp.fireEvent('blur'); focusedId.classList.remove("x-form-focus"); }); } function setFocusOnFirstField(form, required = false, forceFirstField = false) { if (typeof form === 'string') { form = Ext.getCmp(form); } var formItems = form.findByType('field'); var fieldToFocus = formItems[0]; if(!forceFirstField) { for (var i = 0; i < formItems.length; i++) { if (formItems[i].getValue() === "") { if (required) { if (formItems[i]['allowBlank'] === false || formItems[i]['initialConfig']['cls']=='mandatory') { fieldToFocus = formItems[i]; break; } } else { fieldToFocus = formItems[i]; break; } } } } fieldToFocus.focus(); } function editerPosteBudgetaire(idPosteBudgetaire,itemToRefresh) { gridBudgetItemValeurs_store = new Ext.data.Store({ // id: 'elementsFicheEditorGrid_store', remoteSort: true, proxy: new Ext.data.HttpProxy({ url: '_datasMysql/grid_valeurBudgetItem.php', method: 'POST' }), baseParams:{sort: 'id', dir: 'DESC', idBudgetItem:idPosteBudgetaire}, // this parameter is passed for any HTTP request reader: new Ext.data.JsonReader({ root: 'results', totalProperty: 'total', id: 'id' },[ {name: 'id', type: 'int', mapping: 'id'}, {name: 'montant1', type: 'string', mapping: 'montant1'}, {name: 'montant2', type: 'string', mapping: 'montant2'}, {name: 'montant3', type: 'string', mapping: 'montant3'}, {name: 'montant4', type: 'string', mapping: 'montant4'}, {name: 'commentaire', type: 'string', mapping: 'commentaire'}, {name: 'exercice', type: 'string', mapping: 'exercice'}, {name: 'actif', type: 'int', mapping: 'actif'}, ]) }); var gridBudgetItemValeurs_cm = new Ext.grid.ColumnModel( [ { header: 'Exercice', sortable: false, dataIndex: 'exercice', width: 100, renderer: function(value, cell){ return value; } },{ header: '', sortable: false, dataIndex: 'montant1', editor:new Ext.form.NumberField({ allowBlank: true, allowDecimals:true }), hidden:true, width: 100, renderer: function(value, cell){ return value; } },{ header: '', sortable: false, dataIndex: 'montant2', editor:new Ext.form.NumberField({ allowBlank: true, allowDecimals:true }), hidden:true, width: 100, renderer: function(value, cell){ return value; } },{ header: 'Prévision', sortable: false, dataIndex: 'montant3', editor:new Ext.form.NumberField({ allowBlank: true, allowDecimals:true }), hidden:false, width: 100, renderer: function(value, cell){ return value; } },{ header: '', sortable: false, dataIndex: 'montant4', editor:new Ext.form.NumberField({ allowBlank: true, allowDecimals:true }), hidden:true, width: 100, renderer: function(value, cell){ return value; } },{ header: 'Commentaire', sortable: false, dataIndex: 'commentaire', editor:new Ext.form.TextField({ allowBlank: true }), width: 100, renderer: function(value, cell){ return value; } }, ] ) var gridBudgetItemValeurs = new Ext.grid.EditorGridPanel({ id: 'gridBudgetItemValeursId', store: gridBudgetItemValeurs_store, height:300, xtype:'editorgrid', autoScroll:true, stateful: false, stripeRows: true, view: new Ext.grid.GridView({ forceFit:true, }), clicksToEdit:2, selModel: new Ext.grid.RowSelectionModel({singleSelect:true}), enableColLock:false, enableHdMenu:false, loadMask: 'Chargement des données…', cm: gridBudgetItemValeurs_cm, enableColLock:true, tbar:new Ext.Toolbar({ style:'background-color:#F9FBFD', items:[ { text:'Ajouter', iconCls:'add', id:'buttonEditerPosteBudgetaireAjouterId', handler:function() { var ajouterBudgetItemValeurFormPanel = new Ext.FormPanel({ bodyStyle: 'border:none', cls:'labelTopResponsive', defaultType: 'textfield', method: 'POST', items: [ new Ext.form.ComboBox({ hiddenName: 'ajouterBudgetItemValeurFormPanel_exercice', fieldLabel:'Exercice', id: 'ajouterBudgetItemValeurFormPanel_exerciceId', width:'90%', diesev3:true, hideOnSelect:false, store:new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_budgetExercices.php' }), remoteSort: true, autoLoad: false, fields : ['id','intitule'] }), triggerAction:'all', valueField:'id', minChars:1, queryParam:'term', displayField:'intitule', mode:'remote', forceSelection:false }), { xtype:'numberfield', allowDecimals:true, width:'90%', fieldLabel:'', name:'ajouterBudgetItemValeurFormPanel_montant1', id:'ajouterBudgetItemValeurFormPanel_montant1Id', listeners:{ render:function() { $j('#ajouterBudgetItemValeurFormPanel_montant1Id').parent().parent().css('display','none'); } } },{ xtype:'numberfield', allowDecimals:true, width:'90%', fieldLabel:'', name:'ajouterBudgetItemValeurFormPanel_montant2', id:'ajouterBudgetItemValeurFormPanel_montant2Id', listeners:{ render:function() { $j('#ajouterBudgetItemValeurFormPanel_montant2Id').parent().parent().css('display','none'); } } },{ xtype:'numberfield', allowDecimals:true, width:'90%', fieldLabel:'Prévision', name:'ajouterBudgetItemValeurFormPanel_montant3', id:'ajouterBudgetItemValeurFormPanel_montant3Id', listeners:{ render:function() { } } },{ xtype:'numberfield', allowDecimals:true, width:'90%', fieldLabel:'', name:'ajouterBudgetItemValeurFormPanel_montant4', id:'ajouterBudgetItemValeurFormPanel_montant4Id', listeners:{ render:function() { $j('#ajouterBudgetItemValeurFormPanel_montant4Id').parent().parent().css('display','none'); } } },{ xtype:'textfield', width:'90%', name:'editerBudgetItemFormPanel_commentaire', id:'editerBudgetItemFormPanel_commentaireId', fieldLabel:'Commentaire' } ], }); ajouterBudgetItemValeurWindow = new Ext.Window({ title: 'Ajouter une valeur à ce poste budgétaire', closable:true, draggable:true, modal:true, frichtee:true, resizable:false, plain:true, layout: 'fit', id: 'ajouterBudgetItemValeurWindowId', items: ajouterBudgetItemValeurFormPanel, bbar:[ { text:'Annuler', iconCls:'cancel', handler:function() { ajouterBudgetItemValeurWindow.close(); } },{ text:'Sauvegarder', iconCls:'save', handler:function() { var thisCustom=this; var messageErreur='' if(Ext.getCmp('ajouterBudgetItemValeurFormPanel_exerciceId').getValue()=='') { messageErreur = messageErreur+" Le champ exercice est obligatoire.
"; } if(messageErreur!='') { $j.gritter.add({title: 'Erreur(s)',text: messageErreur,image: '_img/notification/ko.png',sticky: false, time: '1000'}); } else { thisCustom.enableLoader(); Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/ajouterBudgetItemValeur.php', params: { idBudgetItem:idPosteBudgetaire, exercice: Ext.getCmp('ajouterBudgetItemValeurFormPanel_exerciceId').getValue(), montant1: Ext.getCmp('ajouterBudgetItemValeurFormPanel_montant1Id').getValue(), montant2: Ext.getCmp('ajouterBudgetItemValeurFormPanel_montant2Id').getValue(), montant3: Ext.getCmp('ajouterBudgetItemValeurFormPanel_montant3Id').getValue(), montant4: Ext.getCmp('ajouterBudgetItemValeurFormPanel_montant4Id').getValue(), commentaire:Ext.getCmp('editerBudgetItemFormPanel_commentaireId').getValue() }, success: function() { gridBudgetItemValeurs_store.reload(); ajouterBudgetItemValeurWindow.close(); $j.gritter.add({title: 'Confirmation',text: 'Valeur ajoutée',image: '_img/notification/ok.png',sticky: false, time: '1000'}); } }); } } } ] }).show(); } },{ text:'Supprimer', iconCls:'delete', id:'buttonEditerPosteBudgetaireSupprimerId', handler:function() { var selectionBudgetItemValeur = gridBudgetItemValeurs.selModel.getSelections(); Ext.MessageBox.show({ title:'Demande de confirmation', msg: 'Etes-vous sûr(e) ?', buttons: Ext.MessageBox.YESNO, icon: Ext.MessageBox.QUESTION, fn: function(btn, text) { if(btn=='yes') { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/barrieres/budgetItemValeur.php', params: { id: selectionBudgetItemValeur[0].json.id, idBudgetItem:idPosteBudgetaire }, success: function (result,request) { if(result.responseText!='') { $j.gritter.add({title: 'Erreur',text: 'Des échéances sont enregistrées sur cet exercice et pour ce poste budgétaire.
',image: '_img/notification/ko.png',sticky: false, time: '1000'}); } else { Ext.Ajax.request({ waitMsg: 'Patientez', url: '_ajax/supprimerBudgetItemValeur.php', params: { id: selectionBudgetItemValeur[0].json.id, }, success: function (result,request) { gridBudgetItemValeurs_store.reload(); $j.gritter.add({title: 'Confirmation',text: 'Suppression effectuée',image: '_img/notification/ok.png',sticky: false, time: '1000'}); } }); } } }); } } }); } } ] }) }); gridBudgetItemValeurs.on('beforeedit', function(oGrid_event) { if(oGrid_event.field=='commentaire') { if(window.droitBudgetItem==false) { $j.gritter.add({title: 'Erreur',text: 'Droits insuffisants',image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } } else if(oGrid_event.field=='montant1') { $j.gritter.add({title: 'Erreur',text: 'Droits insuffisants',image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } else if(oGrid_event.field=='montant2') { $j.gritter.add({title: 'Erreur',text: 'Droits insuffisants',image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } else if(oGrid_event.field=='montant3') { $j.gritter.add({title: 'Erreur',text: 'Droits insuffisants',image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } else if(oGrid_event.field=='montant4') { $j.gritter.add({title: 'Erreur',text: 'Droits insuffisants',image: '_img/notification/ko.png',sticky: false, time: '1000'}); return false; } }); gridBudgetItemValeurs.on('afteredit', function(oGrid_event) { Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/editerInline_editerBudgetItemValeur.php', params: { id: oGrid_event.record.data.id, montant1: oGrid_event.record.data.montant1, montant2: oGrid_event.record.data.montant2, montant3: oGrid_event.record.data.montant3, montant4: oGrid_event.record.data.montant4, commentaire: oGrid_event.record.data.commentaire }, success: function() { gridBudgetItemValeurs_store.reload(); } }); }); gridBudgetItemValeurs_store.load(); var editerBudgetItemFormPanel = new Ext.FormPanel({ bodyStyle: 'border:none', defaultType: 'textfield', cls:'labelTopResponsive', method: 'POST', items: [ new Ext.form.FieldSet({ collapsible: false, title: 'Informations générales', autoHeight: true, items:[ { xtype:'textfield', name:'editerBudgetItemFormPanel_code', width:'90%', id:'editerBudgetItemFormPanel_codeId', disabled:true, fieldLabel:'Code' }, new Ext.form.ComboBox({ hiddenName: 'editerBudgetItemFormPanel_idType', fieldLabel:'Type', id: 'editerBudgetItemFormPanel_idTypeId', width:'90%', diesev3:true, hideOnSelect:false, store: new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: '_datasMysql/store_budgetItemType.php' }), remoteSort: true, autoLoad: false, fields: [{name:'id',type:'int'}, 'intitule'] }), triggerAction:'all', valueField:'id', minChars:1, queryParam:'term', displayField:'intitule', mode:'remote', forceSelection:false }), { xtype:'textfield', name:'editerBudgetItemFormPanel_libelle', width:'90%', id:'editerBudgetItemFormPanel_libelleId', fieldLabel:'Libellé' }, ] }), new Ext.form.FieldSet({ collapsible: false, title: 'Valeurs', autoHeight: true, items:[ gridBudgetItemValeurs ] }) ], }); window.droitBudgetItem=true; editerBudgetItemFormPanel.getForm().load({ url: '_datasMysql/form_editerPosteBudgetaire.php', params: { idBudgetItem: idPosteBudgetaire }, success:function(form,action) { var reponse = Ext.decode(action.response.responseText); var store = Ext.getCmp('editerBudgetItemFormPanel_idTypeId').getStore(); store.load({callback:function() { Ext.getCmp('editerBudgetItemFormPanel_idTypeId').setValue(parseInt(reponse.data.idType)) }}); if(reponse.data.droitFinal!='3') { window.droitBudgetItem=false; Ext.getCmp('buttonEditerPosteBudgetaireId').disable(); Ext.getCmp('buttonEditerPosteBudgetaireAjouterId').disable(); Ext.getCmp('buttonEditerPosteBudgetaireSupprimerId').disable(); } } }); editerBudgetItemWindow = new Ext.Window({ title: 'Editer ce poste budgétaire', closable:true, draggable:true, modal:true, frichtee:true, resizable:false, plain:true, layout: 'fit', id: 'editerBudgetItemWindowId', items: editerBudgetItemFormPanel, bbar:[ { text:'Sauvegarder', iconCls:'save', id:'buttonEditerPosteBudgetaireId', handler:function() { var messageErreur='' if(Ext.getCmp('editerBudgetItemFormPanel_libelleId').getValue()=='') { messageErreur = messageErreur+" Le champ libellé est obligatoire.
"; } if(Ext.getCmp('editerBudgetItemFormPanel_idTypeId').getValue()=='') { messageErreur = messageErreur+" Le champ type est obligatoire.
"; } if(messageErreur!='') { $j.gritter.add({title: 'Erreur(s)',text: messageErreur,image: '_img/notification/ko.png',sticky: false, time: '1000'}); } else { Ext.getCmp('buttonEditerPosteBudgetaireId').enableLoader(); Ext.Ajax.request({ waitMsg: 'Please wait', url: '_ajax/editer_budgetItem.php', params: { idBudgetItem: idPosteBudgetaire, intitule:Ext.getCmp('editerBudgetItemFormPanel_libelleId').getValue(), idType:Ext.getCmp('editerBudgetItemFormPanel_idTypeId').getValue() }, success: function() { $j.gritter.add({title: 'Confirmation',text: 'Modification effectuée',image: '_img/notification/ok.png',sticky: false, time: '1000'}); editerBudgetItemWindow.close(); if(itemToRefresh.initialConfig.xtype=='editortreegrid'){ itemToRefresh.getRootNode().reload(); //tree.getRootNode().reload(); } else { itemToRefresh.getStore().reload(); } } }); } } } ] }).show(); } function displayMandatoryFieldset(record) { $j('.fieldSetClassif').each(function() { Ext.getCmp($j(this).attr('id')).hide(); }); if (record !== undefined) { var fieldSets = record.data.fieldset; var fieldSetTab = fieldSets.split('|'); $j.each(fieldSetTab, function(index, value) { if (typeof(Ext.getCmp(value)) !== 'undefined') { Ext.getCmp(value).show(); } }); } }