107 lines
2.9 KiB
PHTML
Raw Normal View History

2011-08-08 19:03:26 +00:00
<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>
2011-08-09 09:45:20 +00:00
<h2>Extrait R.C.S</h2>
<div class="paragraph">
2011-08-08 19:03:26 +00:00
<?php
2011-08-09 09:45:20 +00:00
if(empty($this->message))
2011-08-08 19:03:26 +00:00
{
?>
<div id="result"><div id="progressbar"></div></div>
<script type="text/javascript">
var start = <?=$this->start?>;
var siren = <?=$this->siren?>;
2012-01-26 18:00:12 +00:00
var message = 'Le temps maximum d&quot;attente a été atteint. Merci de réssayez en cliquant <a href="<?=$this->url(array('controller'=>'pieces', 'action'=>'kbis', 'siret'=>$this->siren, 'essai'=>$this->start+1))?>">ici</a><br/>ou faire la demande pour recevoir le kbis par mail <input type="checkbox" name="sendmail" value="1"/>';
2011-08-08 19:03:26 +00:00
var pct = 0;
var prec = 0;
2012-01-26 18:01:43 +00:00
var checkInterval = 15;
2012-01-26 17:58:39 +00:00
var url = '<?=$this->url?>';
2011-08-08 19:03:26 +00:00
2012-01-26 17:55:18 +00:00
function checkKbis(start) {
if(start==1){
2011-08-08 19:03:26 +00:00
$.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); }
}
);
}
}
2012-01-26 17:55:18 +00:00
function updateKbis() {
2011-08-08 19:03:26 +00:00
$('#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);
}
}
2012-01-26 17:55:18 +00:00
function updateKbisInfo(html) {
2011-08-08 19:03:26 +00:00
$('#result').html(html);
clearInterval(holdTheInterval);
}
2012-01-26 17:55:18 +00:00
$(document).ready(function() {
$('input[type=checkbox][name=sendmail]').on('click', function(){
2011-09-06 08:10:31 +00:00
if($(this).prop('checked')){
2011-08-08 19:03:26 +00:00
$('#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; }
});
});
2011-08-09 09:45:20 +00:00
checkKbis(start);
var holdTheInterval = setInterval(updateKbis, 2400);
2011-08-09 09:45:20 +00:00
$('#progressbar').reportprogress(0);
2011-08-08 19:03:26 +00:00
</script>
<div id="formMail" style="display:none">
2011-08-09 09:45:20 +00:00
<form name="mailkbis" method="post" action="<?=$this->url(array('controller'=>'pieces', 'action'=>'kbis', 'siret'=>$this->siren))?>">
<input type="hidden" name="op" value="mailkbis"/>
<label>Votre Email : </label>
<input type="text" name="mail" value="<?=$this->email?>"/>
<input type="submit" name="mailkbis" value="Ok"/>
</form>
2011-08-08 19:03:26 +00:00
</div>
2011-08-09 09:45:20 +00:00
<?php } else { ?>
<?=$this->message?>
<?php }?>
2011-08-22 15:46:49 +00:00
</div>
2011-08-08 19:03:26 +00:00
</div>