Javascript et gestion des profils
This commit is contained in:
parent
ead8a5ca94
commit
0b38f0d7ce
@ -23,8 +23,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
->appendHttpEquiv('Content-Language', 'fr-FR');
|
||||
|
||||
$view->headLink()
|
||||
->appendStylesheet('/libs/bootstrap-v3.0.0/css/bootstrap.min.css', 'all')
|
||||
->appendStylesheet('/themes/default/css/main.css', 'all');
|
||||
->appendStylesheet('/libs/bootstrap-v3.0.0/css/bootstrap.min.css', 'all');
|
||||
|
||||
$view->headScript()
|
||||
->appendFile('/libs/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
@ -34,7 +33,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
->appendFile('/libs/jquery-2.0.3.min.js', 'text/javascript')
|
||||
->appendFile('/libs/bootstrap-v3.0.0/js/bootstrap.min.js', 'text/javascript')
|
||||
->appendFile('/libs/ui-1.10.3/jquery-ui.min.js', 'text/javascript')
|
||||
->appendFile('/scripts/enrichissement.js', 'text/javascript');
|
||||
->appendFile('/themes/default/js/enrichissement.js', 'text/javascript');
|
||||
|
||||
$view->headTitle()->setSeparator(' - ');
|
||||
|
||||
|
@ -9,8 +9,8 @@ class DoublonController extends Zend_Controller_Action
|
||||
|
||||
public function fileformAction()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/scripts/jquery.form.js', 'text/javascript');
|
||||
$this->view->headScript()->appendFile('/scripts/jqueryprogressbar.js', 'text/javascript');
|
||||
$this->view->headScript()->appendFile('/themes/default/js/jquery.form.js', 'text/javascript');
|
||||
$this->view->headScript()->appendFile('/themes/default/js/jqueryprogressbar.js', 'text/javascript');
|
||||
$this->view->assign('filesize', ini_get('upload_max_filesize'));
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,7 @@ class EnvoiController extends Zend_Controller_Action
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/scripts/enrichissement.js', 'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet('/styles/enrichissement.css');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/css/enrichissement.css');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -15,21 +14,13 @@ class EnvoiController extends Zend_Controller_Action
|
||||
|
||||
public function fileformAction()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/scripts/jquery.form.js', 'text/javascript');
|
||||
$this->view->headScript()->appendFile('/scripts/jqueryprogressbar.js', 'text/javascript');
|
||||
$this->view->inlineScript()->appendFile('/themes/default/js/jquery.form.js', 'text/javascript');
|
||||
$this->view->inlineScript()->appendFile('/themes/default/js/jqueryprogressbar.js', 'text/javascript');
|
||||
$this->view->assign('filesize', ini_get('upload_max_filesize'));
|
||||
|
||||
//Récupérer les clients
|
||||
$dbConfig = array(
|
||||
'host' => MYSQL_HOST,
|
||||
'port' => MYSQL_PORT,
|
||||
'username' => MYSQL_USER,
|
||||
'password' => MYSQL_PASS,
|
||||
'dbname' => MYSQL_DEFAULT_DB,
|
||||
'driver_options' => array(MYSQLI_INIT_COMMAND => 'SET NAMES UTF8;'),
|
||||
//'driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8;')
|
||||
);
|
||||
$sqlmetier = Zend_Db::factory('Mysqli', $dbConfig);
|
||||
$c = Zend_Registry::get('config');
|
||||
$sqlmetier = Zend_Db::factory($c->profil->db->jo);
|
||||
$sql = $sqlmetier->select()
|
||||
->from('sdv1.clients', array('id', 'nom'))
|
||||
->where("actif = 'Oui'");
|
||||
|
@ -40,16 +40,8 @@ class IndexController extends Zend_Controller_Action
|
||||
$this->view->assign('fileFinish', $commandesM->fetchAll($sql));
|
||||
|
||||
//Récupérer les clients
|
||||
$dbConfig = array(
|
||||
'host' => MYSQL_HOST,
|
||||
'port' => MYSQL_PORT,
|
||||
'username' => MYSQL_USER,
|
||||
'password' => MYSQL_PASS,
|
||||
'dbname' => MYSQL_DEFAULT_DB,
|
||||
'driver_options' => array(MYSQLI_INIT_COMMAND => 'SET NAMES UTF8;'),
|
||||
//'driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8;')
|
||||
);
|
||||
$sqlmetier = Zend_Db::factory('Mysqli', $dbConfig);
|
||||
$c = Zend_Registry::get('config');
|
||||
$sqlmetier = Zend_Db::factory($c->profil->db->jo);
|
||||
$sql = $sqlmetier->select()
|
||||
->from('sdv1.clients', array('id', 'nom'))
|
||||
->where("actif = 'Oui'");
|
||||
|
@ -4,9 +4,7 @@ class ProfilController extends Zend_Controller_Action
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$profilM = new Application_Model_Profil($db);
|
||||
$profilM = new Application_Model_Profil();
|
||||
$sql = $profilM->select()->order('reference ASC');
|
||||
$rows = $profilM->fetchAll($sql);
|
||||
$this->view->assign('profils', $rows);
|
||||
@ -35,6 +33,8 @@ class ProfilController extends Zend_Controller_Action
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
$this->view->inlineScript()->appendFile('/themes/default/js/profil.js', 'text/javascript');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id', null);
|
||||
$doublon = array();
|
||||
|
@ -17,7 +17,7 @@ Le séparateur utilisé est la virgule (,).
|
||||
<h2>En attente de profil</h2>
|
||||
<div>
|
||||
<?php if (count($this->fileAttenteProfil)) {?>
|
||||
<table>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr><th>Fichier</th><th>Profil</th><th>Action</th></tr>
|
||||
</thead>
|
||||
@ -48,7 +48,7 @@ Le séparateur utilisé est la virgule (,).
|
||||
<h2>Enrichissements en cours</h2>
|
||||
<div>
|
||||
<?php if (count($this->fileEnCours)) {?>
|
||||
<table>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Fichier</th>
|
||||
@ -101,7 +101,7 @@ Le séparateur utilisé est la virgule (,).
|
||||
|
||||
<div>
|
||||
<?php if (count($this->fileFinish)) {?>
|
||||
<table>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr><th>Fichier</th><th>Ajout</th><th>Départ</th><th>Fin</th><th>Lignes total</th><th>Fichier enrichi</th></tr>
|
||||
</thead>
|
||||
|
@ -1,115 +1,74 @@
|
||||
<style>
|
||||
h1 {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
div#entete {
|
||||
width:350px;
|
||||
float:left;
|
||||
border:1px solid #bebebe;
|
||||
height:500px;
|
||||
overflow:auto;
|
||||
margin:2px;
|
||||
}
|
||||
|
||||
div#entete ul {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
div#entete li {
|
||||
background-color:#4D90FE;
|
||||
border-top:2px solid #ffffff;
|
||||
border-bottom:2px solid #ffffff;
|
||||
line-height:20px;
|
||||
font-weight:bold;
|
||||
color:#000000;
|
||||
padding:5px;
|
||||
margin-left:-20px;
|
||||
width:300px;
|
||||
}
|
||||
|
||||
div#dico {
|
||||
width:350px;
|
||||
height:500px;
|
||||
float:left;
|
||||
border:1px solid #bebebe;
|
||||
overflow:auto;
|
||||
margin:2px;
|
||||
}
|
||||
|
||||
div#dico ol {
|
||||
margin:5px 0;
|
||||
}
|
||||
|
||||
|
||||
div#dico ul {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
div#dico li {
|
||||
list-style-type:none;
|
||||
padding:5px;
|
||||
background-color:#4D90FE;
|
||||
border-top:2px solid #ffffff;
|
||||
border-bottom:2px solid #ffffff;
|
||||
line-height:20px;
|
||||
font-weight:bold;
|
||||
color:#000000;
|
||||
width:300px;
|
||||
margin-left:-30px;
|
||||
}
|
||||
|
||||
div#help {
|
||||
float:left;
|
||||
width:280px;
|
||||
margin:2px;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
div#help li {
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
border:1px solid;
|
||||
}
|
||||
|
||||
div#dico .panel-body {
|
||||
height:500px;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
div#dico .panel-body, div#entete .panel-body {
|
||||
padding:0;
|
||||
}
|
||||
</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>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-default" id="entete">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Entete</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="ui-widget-content">
|
||||
<ul class="list-group">
|
||||
<?php if (count($this->criteres)==0) {?>
|
||||
<span class="placeholder">Placer les elements ici</span>
|
||||
<?php } else {?>
|
||||
<?php foreach($this->criteres as $key => $element) {?>
|
||||
<li class="list-group-item" 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>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-default" id="dico">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Elements disponibles</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul class="list-group">
|
||||
<?php foreach($this->elements as $key => $element) {?>
|
||||
<li class="list-group-item" 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 }?>
|
||||
<?php }?>
|
||||
</ol>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</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 class="col-md-4">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Aide</h3>
|
||||
</div>
|
||||
<div class="panel-body" id="help"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="help">Aide</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="clear:both;">
|
||||
<div>
|
||||
Clé de dédoublonnage : <br/>
|
||||
<input type="checkbox" name="doublon" value="siret" <?php if(in_array('siret', $this->doublon)) echo ' checked';?>/> SIRET<br/>
|
||||
<input type="checkbox" name="doublon" value="siren" <?php if(in_array('siren', $this->doublon)) echo ' checked';?>/> SIREN<br/>
|
||||
@ -125,70 +84,4 @@ Référence <input type="text" name="profil" value="<?=$this->reference?>" />
|
||||
<?php } else {?>
|
||||
<a id="save" href="<?=$this->url(array('controller'=>'profil', 'action'=>'save'))?>">Sauvegarder</a>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('div#dico li').draggable({ appendTo: "body", helper: "clone" });
|
||||
$('div#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" );
|
||||
}
|
||||
});
|
||||
|
||||
$('div#entete').delegate('a.delete', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
$(this).parent().remove();
|
||||
});
|
||||
|
||||
$('div#entete').on({
|
||||
mouseenter: function() {
|
||||
$(this).append('<a href="#" class="delete">Supprimer</a>');
|
||||
},
|
||||
mouseleave: function() {
|
||||
$(this).find('a.delete').remove();
|
||||
}
|
||||
}, 'li');
|
||||
|
||||
$('#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!='') {
|
||||
var doublon = $('input[name=doublon]:checkbox:checked').map(function () {
|
||||
return this.value;
|
||||
}).get();
|
||||
$.post(url, { reference: ref, criteres: list, doublon: doublon }, function(data){
|
||||
if (data!='Erreur'){ window.location.href = '/'; }
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
|
||||
$('div#dico li').click(function(e){
|
||||
e.preventDefault();
|
||||
var key = $(this).attr('id');
|
||||
$.post('<?=$this->url(array('controller'=>'profil','action'=>'help'))?>', { key: key},
|
||||
function(data){ $('div#help').html(data); });
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
@ -1,7 +1,7 @@
|
||||
<div>
|
||||
<h2>Gestion des profils</h2>
|
||||
<?php if (count($this->profils)>0) {?>
|
||||
<table>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Référence</th>
|
||||
|
@ -1,47 +0,0 @@
|
||||
body {
|
||||
color: #000000;
|
||||
font: 0.8em "Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#global {
|
||||
position: relative;
|
||||
width:1000px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
#header {
|
||||
height: 10px;
|
||||
padding: 0 40px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#header h1 {
|
||||
border: 0 none;
|
||||
bottom: 15px;
|
||||
color: #DDDDDD;
|
||||
font-size: 2em;
|
||||
font-weight: normal;
|
||||
left: 60px;
|
||||
line-height: 1;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#header h1 {
|
||||
font-size:18px;
|
||||
margin:10px 5px;
|
||||
}
|
||||
|
||||
table td, table th {
|
||||
border:1px solid #000000;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-decoration:underline;
|
||||
margin:10px 0;
|
||||
}
|
63
public/themes/default/js/profil.js
Normal file
63
public/themes/default/js/profil.js
Normal file
@ -0,0 +1,63 @@
|
||||
$(function() {
|
||||
$('div#dico li').draggable({ appendTo: "body", helper: "clone" });
|
||||
$('div#entete ul').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+'" class="list-group-item"></li>').html( ui.draggable.html() ).appendTo( this );
|
||||
}
|
||||
}).sortable({
|
||||
items: "li:not(.placeholder)",
|
||||
sort: function() {
|
||||
$( this ).removeClass( "ui-state-default" );
|
||||
}
|
||||
});
|
||||
|
||||
$('div#entete').delegate('a.delete', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
$(this).parent().remove();
|
||||
});
|
||||
|
||||
$('div#entete').on({
|
||||
mouseenter: function() {
|
||||
$(this).append('<a href="#" class="delete pull-right">Supprimer</a>');
|
||||
},
|
||||
mouseleave: function() {
|
||||
$(this).find('a.delete').remove();
|
||||
}
|
||||
}, 'li');
|
||||
|
||||
$('#save').click(function(e){
|
||||
e.preventDefault();
|
||||
var url = $(this).attr('href');
|
||||
var list = new Array();
|
||||
$('#entete ul 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!='') {
|
||||
var doublon = $('input[name=doublon]:checkbox:checked').map(function () {
|
||||
return this.value;
|
||||
}).get();
|
||||
$.post(url, { reference: ref, criteres: list, doublon: doublon }, function(data){
|
||||
if (data!='Erreur'){ window.location.href = '/'; }
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
|
||||
$('div#dico li').click(function(e){
|
||||
e.preventDefault();
|
||||
var key = $(this).attr('id');
|
||||
$.post('/profil/help', { key: key},
|
||||
function(data){ $('div#help').html(data); });
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user