2011-08-08 19:03:26 +00:00

116 lines
2.9 KiB
PHTML

<div id="center">
<h1>COMMANDES DE PI&Eacute;CES</h1>
<div class="paragraph">
<table class="identite">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">
Num&eacute;ro identifiant Siren
</td>
<td width="350" class="StyleInfoData">
<?=$this->SirenTexte($this->siren)?>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
</table>
</div>
<?php
if(empty($message))
{
?>
<div id="result"><div id="progressbar"></div></div>
<script type="text/javascript">
var start = <?=$this->start?>;
var siren = <?=$this->siren?>;
var message = 'Le temps maximum d&quot;attente a été atteint. Merci de réssayez en cliquant <a href="./?page=kbis&siret=<?=$this->siren?>&start=<?=$this->start+1?>">ici</a><br/>ou faire la demande pour recevoir le kbis par mail <input type="checkbox" name="sendmail" value="1"/>';
var pct = 0;
var prec = 0;
var checkInterval = 10;
var url = '';
function checkKbis(start)
{
if(start>=1){
$.post( '<?=$this->url(array('controller'=>'pieces', 'action'=>'kbis'))?>',
{ start: start, siret: siren },
function (data, textStatus) { url = data; }
);
}else{
$.post( '<?=$this->url(array('controller'=>'pieces', 'action'=>'kbis'))?>',
{ start: 0, url: url, siret: siren },
function (data, textStatus) {
if( data!='' && data!='FALSE' ){ updateKbisInfo(data); }
}
);
}
}
function updateKbis(){
$('#progressbar').reportprogress(++pct);
if(pct==100){
updateKbisInfo(message);
pct=0;
}
if( Math.floor(pct/checkInterval)!=prec || pct==1 ){
prec = Math.floor(pct/checkInterval);
checkKbis(false);
}
}
function updateKbisInfo(html){
$('#result').html(html);
clearInterval(holdTheInterval);
}
$(document).ready(function(){
$('input[type=checkbox][name=sendmail]').live('click', function(){
if($(this).attr('checked')== true){
$('#formMail').css('display', 'block');
}else{
$('#formMail').css('display', 'none');
}
});
$('form[name=mailkbis]').submit(function(){
var eMail = $('input[name=mail]').val();
if(!checkEmail(eMail)){
alert('Veuillez saisir une adresse email.');
return false;
} else { return true; }
});
});
<?php
if( !(isset($_REQUEST['mailkbis']) && $_REQUEST['mailkbis']=='Ok') )
{
?>
checkKbis(start);
//var holdTheInterval = setInterval(updateKbis, 1800);
$('#progressbar').reportprogress(0);
<?php
}
?>
</script>
<?php
}
?>
<div id="formMail" style="display:none">
<form name="mailkbis" method="post" action="./?page=kbis2&siret=<?=$siret?>">
<input type="hidden" name="login" value="<?=$_SESSION['tabInfo']['login']?>"/>
<label>Votre Email : </label>
<input type="text" name="mail" value="<?php
if ($_SESSION['tabInfo']['login']<>'testreunica' &&
$_SESSION['tabInfo']['login']<>'reunicacsf')
echo $_SESSION['tabInfo']['email']
?>"/>
<input type="submit" name="mailkbis" value="Ok"/>
</form>
</div>
</div>