issue #0001889, issue #0001950 : Simplification, no more javascript

This commit is contained in:
Michael RICOIS 2014-05-13 20:39:35 +00:00
parent f91d0866bb
commit d48a6a1675
7 changed files with 46 additions and 62 deletions

View File

@ -61,6 +61,12 @@ class EvaluationController extends Zend_Controller_Action
*/
public function scoreshistoAction()
{
$this->view->headLink()
->appendStylesheet('/libs/tablesorter/themes/blue/style.css', 'all');
$this->view->headScript()
->appendFile('/libs/tablesorter/jquery.tablesorter.js', 'text/javascript');
$sessionEntreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$siren = substr($this->siret,0,9);

View File

@ -431,6 +431,9 @@ class SurveillanceController extends Zend_Controller_Action
$this->_forward('perms', 'error');
}
$this->view->headLink()
->appendStylesheet('/libs/tablesorter/themes/blue/style.css', 'all');
$this->view->headScript()
->appendFile('/libs/tablesorter/jquery.tablesorter.js', 'text/javascript')
->appendFile('/themes/default/scripts/surveillance.js', 'text/javascript');

View File

@ -1,21 +1,21 @@
<div id="center">
<h1><?=$this->translate('HISTORIQUE').' '.strtoupper($this->types[$this->type]);?></h1>
<h1><?=$this->translate("HISTORIQUE").' '.strtoupper($this->types[$this->type]);?></h1>
<div class="paragraph">
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?=$this->translate('Numéro identifiant Siren')?></td>
<td width="200" class="StyleInfoLib"><?=$this->translate("Numé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"><?=$this->translate('Dénomination sociale')?></td>
<td width="200" class="StyleInfoLib"><?=$this->translate("Dénomination sociale")?></td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
</table>
</div>
<h2><?=$this->translate('Historique des scores')?></h2>
<h2><?=$this->translate("Historique des scores")?></h2>
<div class="paragraph" style="text-align: right;">
<select name="type">
@ -31,15 +31,14 @@ $('select[name=type]').change(function(e){
</script>
</div>
<?php if ( count($this->scores)> 0 ) {?>
<?php $bornes = $this->bornes[$this->type];?>
<div class="paragraph">
<table id="synthese">
<table class="tablesorter" id="synthese">
<thead>
<tr class="head">
<th align="center" style="cursor:pointer;" onclick=sortTable(0)><?=$this->translate('Date')?> &#8593;&#8595;</th>
<th align="center" style="cursor:pointer;" onclick=sortTable(1)><?=$this->types[$this->type]?> &#8593;&#8595;</th>
<th align="center" style="cursor:pointer;" onclick=sortTable(2)><?=$this->translate('Encours')?> (K&euro;) &#8593;&#8595;</th>
<th><?=$this->translate('Motif du changement')?></th>
<tr>
<th align="center"><?=$this->translate("Date")?></th>
<th align="center"><?=$this->types[$this->type]?></th>
<th align="center"><?=$this->translate("Encours")?> (K&euro;)</th>
<th><?=$this->translate("Motif du changement")?></th>
</tr>
</thead>
<tbody>
@ -49,8 +48,19 @@ $('select[name=type]').change(function(e){
<?php $date = new Zend_Date($score->date, 'yyyy-MM-dd');?>
<?=$date->toString('dd/MM/yyyy')?>
</td>
<td align="center"><?=$score->value?> </td>
<td align="center"><?=$score->encours?> </td>
<?php
$style = '';
//Color value - @todo redraw the table and add it before view
if ( $score->value < $this->bornes[$this->type]['rouge'] ) {
$style = ' style="color:red;"';
} elseif ( $score->value < $this->bornes[$this->type]['orange'] ) {
$style = ' style="color:orange;"';
} else {
$style = ' style="color:green;"';
}
?>
<td align="center"<?=$style?>><?=$score->value?></td>
<td align="center"><?=number_format($score->encours,2)?></td>
<td><?=$score->label?></td>
</tr>
<?php }?>
@ -59,50 +69,14 @@ $('select[name=type]').change(function(e){
</div>
<script>
$(document).ready(function(){
$("#synthese tbody tr").each(function(){
if ($(this).find('td:eq(1)').text() < <?=$bornes['rouge']?>) {
$(this).find('td:eq(1)').css("color", "red");
} else if ($(this).find('td:eq(1)').text() < <?=$bornes['orange']?>) {
$(this).find('td:eq(1)').css("color", "orange");
} else {
$(this).find('td:eq(1)').css("color", "green");
}
$('#synthese').tablesorter({
dateFormat: 'uk',
headers: {
0: {sorter: 'shortDate'},
3: {sorter: false},
}
});
});
function sortTable(column){
var t;
if (!$("thead tr th").attr("class")) {
t = 1;
$("thead tr th").addClass("DESC");
} else if ($("thead tr th").attr("class")=='DESC') {
t = -1;
$("thead tr th").removeClass("DESC")
}
var rows = $('#synthese tbody tr').get();
rows.sort(function(a, b) {
var A = $(a).children('td').eq(column).text();
var B = $(b).children('td').eq(column).text();
if (column===0)
{
A = $.datepicker.parseDate('dd/mm/yy', $.trim(A));
B = $.datepicker.parseDate('dd/mm/yy', $.trim(B));
}
if((A - B) < 0) {
return -1*t;
}
if((A - B) > 0) {
return t;
}
return 0;
});
$.each(rows, function(index, row) {
$('#synthese').children('tbody').append(row);
});
}
</script>
<div class="paragraph">
<?php if ( $this->graph ) {?>
@ -111,7 +85,7 @@ function sortTable(column){
<?=$this->graphMap;?>
</map>
<?php } else {?>
<b><?=$this->translate('Impossible de générer le graphique')?></b>
<b><?=$this->translate("Impossible de générer le graphique")?></b>
<?php }?>
</div>

View File

@ -322,6 +322,7 @@ class Scores_Menu
'activateMenu' => array(
array('controller'=>'evaluation', 'action'=> 'scoringcommande'),
array('controller'=>'evaluation', 'action'=> 'aviscredit'),
array('controller'=>'evaluation', 'action'=> 'scoreshisto'),
),
'pages' => array(
array(

View File

@ -120,7 +120,7 @@ class WsScores
}
}
public function setSaisieContactEt($siret, $type, $value, $info, $id=null, $delete=false)
public function setSaisieContactEt($siret, $type, $value, $info, $id = null, $delete = false)
{
$params = new stdClass();
$params->id = $id;
@ -3037,7 +3037,7 @@ class WsScores
}
}
}
/**
* getScoreHistorique pour les derniers 5 ans
* @param string $siret

View File

@ -14,7 +14,7 @@ table.tablesorter thead tr th, table.tablesorter tfoot tr th {
padding: 4px;
}
table.tablesorter thead tr .header {
background-image: url(bg.gif);
background-image: url(./bg.gif);
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
@ -29,10 +29,10 @@ table.tablesorter tbody tr.odd td {
background-color:#F0F0F6;
}
table.tablesorter thead tr .headerSortUp {
background-image: url(asc.gif);
background-image: url(./asc.gif);
}
table.tablesorter thead tr .headerSortDown {
background-image: url(desc.gif);
background-image: url(./desc.gif);
}
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
background-color: #8dbdd8;

View File

@ -577,7 +577,7 @@ a.AncienSiege { background-color: #4D90FE; border: 1px solid #3079ED; color: #FF
#liasseForm td {color:#606060;}
#synthese {border-collapse: collapse;clear: both;font-size: 12px;padding: 2px;text-align: left;width: 100%;font-family: arial,sans-serif;font-size: 11px;}
#synthese .head {font-weight: bold;}
#synthese th {background: none repeat scroll 0 0 #B9C9FE;border: 1px solid #FFFFFF;color: #003399;font-size: 13px;font-weight: normal;padding: 4px;}
#synthese th {background-color:#B9C9FE; border:1px solid #FFFFFF; color:#003399; font-size:13px; font-weight:normal; padding:4px;}
#synthese td.right {text-align: right;}
#synthese td {background: none repeat scroll 0 0 #E8EDFF;border: 1px solid #FFFFFF;color: #666699;padding: 4px;}
#synthese tr:hover td {background: none repeat scroll 0 0 #D0DAFD;}