troubleshot

by Koko_ on September 3rd, 2010
No notes
Syntax: JavaScript
Show lines - Hide lines - Show in textbox - Download
<script language="javascript" type="text/javascript">
	var modified = false;
	var hauteurOriginePopup;
	$(document).ready(function() {
		hauteurOriginePopup = $("#popupDemandeDetail").height();
 
		//---------Demandes----------------
		$('#btnFermer').click(function() {
			fermer();
		});
		$("#popupDemandeDetailClose").click(function(){
			fermer();
		});
 
		$('#repondreDemande').dialog({ 
			autoOpen: false,
			title: "Répondre",
			buttons: {'Annuler': function() {vue();$('#repondreDemande').dialog('close');}, 'Valider': function() {repondre();}},
			draggable: true,
			modal: true,
			resizable: false,
			width: 600, 	
			beforeclose: function() { },
			closeOnEscape: true
 
		});
 
		$('#relancerDemande').dialog({ 
			autoOpen: false,
			title: "Relancer la demande",
			buttons: {'Annuler': function() {$('#relancerDemande').dialog('close');}, 'Valider': function() {relancer();}},
			draggable: true,
			modal: true,
			resizable: false,
			width: 600, 	
			beforeclose: function() { },
			closeOnEscape: true
 
		});
 
		$('#btnRepondre').click(function() {
			$('#repondreDemande').dialog("open");
			modified = true;
		});
 
		$('#btnRelDem').click(function() {
			$('#relancerDemande').dialog("open");
		});
 
		//Agrandi la popup si besoin était
		if($('#demandeDetail').height() + 10 > $("#popupDemandeDetail").height())
		{
			$('#popupDemandeDetail').height($('#demandeDetail').height() + 10);
		}
 
		$('#btnValider').click(function() {				
			if($('#newStatutCode :selected').val() != "")
			{
				$.ajax({
					type : "POST",
					url : "getData.php?request=updateDemandeDetail",
					data : ({numDemande : <?=urlencode($_GET["idDemande"])?>,
							commentaireCol : $('#commentaireCol').val(),
							statutCode : $('#newStatutCode :selected').val(),
							}),
					cache : false,
					beforeSend : function (XMLHttpRequest) {
						loadLoader("DivLoader","DivBackgroundLoader");
					},
					success : function(data, textStatus){
						modified = true;		
						fermer();						
					},
					error : function(XMLHttpRequest, textStatus, errorThrown) {
					},
					complete : function(XMLHttpRequest, textStatus){
						disableLoader();
					}
				});
			}
 
 
		});
 
	});
 
	function repondre()
	{
		if($('#repreponse').val() != "")
		{
			$.ajax({
				type : "GET",
				url : "getdata.php?request=addReponseCol",
				data : ({
							idDemande : <?php echo $_GET["idDemande"]; ?>,
							login : $('#repuser').val(),
							date : $('#repdate').val(),
							reponse : $('#repreponse').val()
						}),
				cache : false,
				beforeSend : function (XMLHttpRequest) {
					loadLoader("DivLoader","DivBackgroundLoader");
				},
				success : function(data, textStatus){
					$('#repreponse').attr('disabled','disabled');
					$('#messagesuivi').html("<h4>Le suivi a bien été mis à jour.</h4>");
 
					$('#repondreDemande').dialog("option", "buttons", { "Retour": function() { $('#repondreDemande').dialog('close'); } } );
 
 
				},
				error : function(XMLHttpRequest, textStatus, errorThrown) {
					$('#divRecherche').append("Error lors du chargement des donn&eacute;es");
				},
				complete : function(XMLHttpRequest, textStatus){
					disableLoader();
				}
			});
		}
		else
		{
			$('#messagesuivi').html("<h4>Veuillez entrer un commentaire</h4>");
		}
 
	}
 
	function fermer()
	{
		disablePopupDemandesDetail();
		$('#popupDemandeDetail').height(hauteurOriginePopup);
		//window.location.href = "declarationSuivi.php?actualiser=true";
		$('#repondreDemande').dialog('destroy');
		$('#repondreDemande').remove();
		$('#relancerDemande').dialog('destroy');
		$('#relancerDemande').remove();
 
	}
 
	function vue()
	{
		$.ajax({
			type : "GET",
			url : "getdata.php?request=updateVue",
			data : ({
						idDemande : <?php echo $_GET["idDemande"]; ?>
					}),
			cache : false,
			beforeSend : function (XMLHttpRequest) {
			},
			success : function(data, textStatus){
 
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				$('#divRecherche').append("Error lors du chargement des donn&eacute;es");
			},
			complete : function(XMLHttpRequest, textStatus){
			}
		});
	}
 
	function relancer()
	{
		if($('#relrelance').val() != "")
		{
			$.ajax({
				type : "GET",
				url : "getdata.php?request=addRelanceCol",
				data : ({
							idDemande : $('#relid').val(),
							login : $('#reluser').val(),
							date : $('#reldate').val(),
							relance : $('#relrelance').val()
						}),
				cache : false,
				beforeSend : function (XMLHttpRequest) {
					loadLoader("DivLoader","DivBackgroundLoader");
				},
				success : function(data, textStatus){
					$('#relrelance').attr('disabled','disabled');
					$('#messagerelance').html("<h4>La relance a bien été validé.</h4>");
 
					$('#relancerDemande').dialog("option", "buttons", { "Retour": function() { $('#relancerDemande').dialog('close'); } } );
 
 
				},
				error : function(XMLHttpRequest, textStatus, errorThrown) {
					$('#divRecherche').append("Error lors du chargement des donn&eacute;es");
				},
				complete : function(XMLHttpRequest, textStatus){
					disableLoader();
				}
			});
		}
		else
		{
			$('#messagerelance').html("<h4>Veuillez entrer une raison pour la relance</h4>");
		}
	}
 
</script>

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS