163 lines
4.1 KiB
PHTML
163 lines
4.1 KiB
PHTML
<style>
|
|
div#entete {
|
|
width:350px;
|
|
float:left;
|
|
border:1px solid #bebebe;
|
|
height:500px;
|
|
overflow:auto;
|
|
margin:2px;
|
|
}
|
|
|
|
div#entete li {
|
|
background-color:#4D90FE;
|
|
border-top:2px solid #ffffff;
|
|
border-bottom:2px solid #ffffff;
|
|
line-height:20px;
|
|
font-weight:bold;
|
|
color:#000000;
|
|
margin-left:30px;
|
|
padding:5px 10px;
|
|
}
|
|
|
|
div#dico {
|
|
width:350px;
|
|
height:500px;
|
|
float:left;
|
|
border:1px solid #bebebe;
|
|
overflow:auto;
|
|
margin:2px;
|
|
}
|
|
|
|
div#dico li {
|
|
list-style-type:none;
|
|
padding:5px 10px;
|
|
background-color:#4D90FE;
|
|
border-top:2px solid #ffffff;
|
|
border-bottom:2px solid #ffffff;
|
|
line-height:20px;
|
|
font-weight:bold;
|
|
color:#000000;
|
|
}
|
|
|
|
div#help {
|
|
float:left;
|
|
width:auto;
|
|
margin:2px;
|
|
}
|
|
|
|
input[type="text"] {
|
|
border:1px solid;
|
|
}
|
|
</style>
|
|
|
|
<div id="entete">
|
|
<h1 class="ui-widget-header">Entete</h1>
|
|
<div class="ui-widget-content">
|
|
<ol>
|
|
<?php if (count($this->criteres)==0) {?>
|
|
<span class="placeholder">Placer les elements ici</span>
|
|
<?php } else {?>
|
|
<?php foreach($this->criteres as $key => $element) {?>
|
|
<li id="<?=$key?>">
|
|
<?php if (isset($element['lib'])) { echo $element['lib']; } else { echo $key; }?>
|
|
<?php if (isset($element['values']) && $element['values']!==false ) {
|
|
echo "<input type=\"text\" name=\"".$key."\" value=\"".$element['values']."\"/>"; }?>
|
|
</li>
|
|
<?php }?>
|
|
<?php }?>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="dico">
|
|
<h1 class="ui-widget-header">Elements disponibles</h1>
|
|
<ul>
|
|
<?php foreach($this->elements as $key => $element) {?>
|
|
<li id="<?=$key?>">
|
|
<?php if (isset($element['lib'])) { echo $element['lib']; } else { echo $key; }?>
|
|
<?php if (isset($element['values'])) { echo "<input type=\"text\" name=\"".$key."\" value=\"\"/>"; }?>
|
|
</li>
|
|
<?php }?>
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="help">Aide</div>
|
|
|
|
|
|
<div style="clear:both;">
|
|
Clé de dédoublonnage : <br/>
|
|
<input type="checbox" name="doublon[]" value="siret" <?php if(in_array('siret', $this->doublon)) echo ' checked';?>/> SIRET<br/>
|
|
<input type="checbox" name="doublon[]" value="siren" <?php if(in_array('siren', $this->doublon)) echo ' checked';?>/> SIREN<br/>
|
|
<input type="checbox" name="doublon[]" value="nic" <?php if(in_array('nic', $this->doublon)) echo ' checked';?>/> NIC<br/>
|
|
<input type="checbox" name="doublon[]" value="ref" <?php if(in_array('ref', $this->doublon)) echo ' checked';?>/> REF<br/>
|
|
</div>
|
|
|
|
<div style="clear:both;">
|
|
Référence <input type="text" name="profil" value="<?=$this->reference?>" />
|
|
|
|
<?php if ($this->edit) { ?>
|
|
<a id="save" href="<?=$this->url(array('controller'=>'profil', 'action'=>'save', 'id'=>$this->id))?>">Modifier</a>
|
|
<?php } else {?>
|
|
<a id="save" href="<?=$this->url(array('controller'=>'profil', 'action'=>'save'))?>">Sauvegarder</a>
|
|
<?php }?>
|
|
</div>
|
|
|
|
<script>
|
|
$(function() {
|
|
$("#dico li").draggable({
|
|
appendTo: "body",
|
|
helper: "clone"
|
|
});
|
|
$("#entete ol").droppable({
|
|
activeClass: "ui-state-default",
|
|
hoverClass: "ui-state-hover",
|
|
accept: ":not(.ui-sortable-helper)",
|
|
drop: function( e, ui ) {
|
|
e.preventDefault();
|
|
$( this ).find( ".placeholder" ).remove();
|
|
var id = ui.draggable.attr('id');
|
|
$('<li id="'+id+'"></li>').html( ui.draggable.html() ).appendTo( this );
|
|
}
|
|
}).sortable({
|
|
items: "li:not(.placeholder)",
|
|
sort: function() {
|
|
$( this ).removeClass( "ui-state-default" );
|
|
}
|
|
});
|
|
|
|
$("#entete").delegate("a.delete","click", function(e){
|
|
e.preventDefault();
|
|
$(this).parent().remove();
|
|
});
|
|
|
|
$("#entete ol").delegate("li" , "hover", function(e) {
|
|
e.preventDefault();
|
|
if (e.type === 'mouseenter') {
|
|
var html = $(this).html();
|
|
$(this).html(html+'<a href="#" style="float:right;" class="delete">Supprimer</a>');
|
|
} else {
|
|
$( this ).find( ".delete" ).remove();
|
|
}
|
|
});
|
|
|
|
$('#save').click(function(e){
|
|
e.preventDefault();
|
|
var url = $(this).attr('href');
|
|
var list = new Array();
|
|
$('#entete ol li').each(function(index){
|
|
var id = $(this).attr('id');
|
|
if($('input[name='+id+']', this).length>0){
|
|
id = id + '(' + $('input[name='+id+']', this).val() + ')';
|
|
}
|
|
list.push(id);
|
|
});
|
|
var ref = $('input[name=profil]').val();
|
|
if (ref!='') {
|
|
$.post(url, { reference: ref, criteres: list }, function(data){
|
|
if (data!='Erreur'){ window.location.href = '/'; }
|
|
}, 'json');
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|