99 lines
3.0 KiB
PHTML
Raw Normal View History

<style>
#dialog div { margin: 5px 0; }
p.italic {font-style: italic;}
</style>
<?php if ($this->message) {?>
<?=$this->message?>
<script>
$('#dialog').dialog({ buttons: [{ text: "Fermer", click: function() {$(this).dialog('close');} } ] });
</script>
<?php } else {?>
2012-12-13 16:23:53 +00:00
<form name="lienchange" method="post" action="<?=$this->url(array('controller'=>'saisie', 'action'=>'lienchange'),null,true)?>">
<input type="hidden" name="idLien" value="<?=$this->lienref?>"/>
2012-12-13 16:23:53 +00:00
<input type="hidden" name="mode" value="<?=$this->mode?>"/>
2012-12-13 13:26:36 +00:00
<?php if ($this->mode=='fusion') {?>
<div><p>Fusionner la fiche <?=$this->nom?> (id=<?=$this->lienref?>)</p></div>
2012-12-13 16:23:53 +00:00
<?php } elseif ($this->mode=='moveact'){?>
<div><p>Déplacer l'actionnaire <?=$this->nom?> (id=<?=$this->lienref?>)</p></div>
2012-12-13 16:23:53 +00:00
<?php }elseif ($this->mode=='movepar') {?>
<div><p>Déplacer la participation <?=$this->nom?> (id=<?=$this->lienref?>)</p></div>
2012-12-13 16:23:53 +00:00
<?php }?>
2012-12-13 13:26:36 +00:00
<div id="searchFiche">
<div class="fieldgrp">
<label>Recherche du parent</label>
2012-12-13 13:26:36 +00:00
<select name="searchType">
<option value="nom">Nom</option>
<option value="siren">Siren</option>
<option value="id">Identifiant</option>
<option value="special">Spéciaux</option>
</select>
<select name="searchCountry" style="width:100px;">
<option value="">-</option>
<?php foreach($this->countries as $code => $item) {?>
<option value="<?=$code?>"<?=$select?>><?=$item['libPays']?></option>
<?php }?>
</select>
<input type="text" name="searchTxt" class="autocomplete"/>
</div>
</div>
<div><p class="italic">Attention le déplacement d'un lien implique le déplacement des liens descendants !</p></div>
2012-12-13 16:23:53 +00:00
</form>
2012-12-13 13:26:36 +00:00
<script>
$('input.autocomplete').autocomplete({
minLength:4,
delay:1000,
source: function(request, response) {
var query = request.term;
var type = $('select[name=searchType]').val();
switch( type ) {
case 'siren': break;
case 'id': break;
case 'nom':
if ($('select[name=searchCountry]').val()!='') {
query = query + ',' + $('select[name=searchCountry]').val();
}
break;
}
$.getJSON('<?=$this->url(array('controller'=>'saisie','action'=>'liensearch'),null,true)?>', { q: query, type: type },
function(data) { response(data); }
);
},
select: function(event, ui) {
2012-12-13 16:23:53 +00:00
$('form[name=lienchange]').prepend('<input type="hidden" name="id" value="'+ui.item.value+'"/>');
2012-12-13 13:26:36 +00:00
$('div#searchFiche').replaceWith('<b>Fiche sélectionnée '+ui.item.label+' (id = '+ui.item.value+')</b>');
$('#dialog').dialog({ buttons: [{
text: "Déplacer", click: function() {
var id = $('form[name=lienchange] input[name=id]').val();
if (id!='') {
var form = $('form[name=lienchange]');
$.post(form.attr('action'), form.serialize(), function(data){
$('form[name=lienchange]').replaceWith(data);
}).error(function(){ alert('Unknow error'); });
}
}}, {
text: "Annuler", click: function() { $(this).dialog('close'); } }
] });
2012-12-13 13:26:36 +00:00
}
});
</script>
<?php }?>