Saisie cut-off (redraw code)
This commit is contained in:
parent
dc36edbf8f
commit
dfb74af73b
@ -2386,13 +2386,55 @@ class SaisieController extends Zend_Controller_Action
|
||||
|
||||
$request = $this->getRequest();
|
||||
$siren = $request->getParam('siren');
|
||||
$refresh = 0;
|
||||
$message = '';
|
||||
$getcutoff = null;
|
||||
|
||||
if ( $request->isXmlHttpRequest() ) {
|
||||
$this->_helper->layout()->disableLayout();
|
||||
if ( $request->isPost() ) {
|
||||
|
||||
$params = $request->getParams();
|
||||
$mode = $request->getParam('mode');
|
||||
|
||||
//Confirm delete
|
||||
if ( $mode == 'todelete' ) {
|
||||
|
||||
$this->view->assign('mode', 'todelete');
|
||||
|
||||
$this->view->assign('siren', $params['siren']);
|
||||
$this->view->assign('encours', $params['encours']);
|
||||
$this->view->assign('scoreSolv', $params['scoreSolv']);
|
||||
$this->view->assign('scoreDir', $params['scoreDir']);
|
||||
$this->view->assign('scoreConf', $params['scoreConf']);
|
||||
$this->view->assign('remarque', $params['remarque']);
|
||||
|
||||
}
|
||||
|
||||
//Delete
|
||||
elseif ($mode == 'delete') {
|
||||
|
||||
$this->view->assign('mode', 'delete');
|
||||
|
||||
$message = $ws->setScoreCutoff(
|
||||
$params['siren'],
|
||||
$params['encours']*1000,
|
||||
$params['scoreSolv'],
|
||||
$params['scoreDir'],
|
||||
$params['scoreConf'],
|
||||
$params['remarque'],
|
||||
1
|
||||
);
|
||||
if (is_int($message)){
|
||||
$message = "Cut-off est supprimé.";
|
||||
} else {
|
||||
$message = "Erreur lors de la suppression du cut-off (".$message.").";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Add or Edit cutoff
|
||||
else {
|
||||
|
||||
if ( $request->isPost() ) {
|
||||
// check values one more time
|
||||
$paramlist = array(
|
||||
'siren' => 'Siren',
|
||||
@ -2413,28 +2455,28 @@ class SaisieController extends Zend_Controller_Action
|
||||
// end checking values
|
||||
|
||||
if ( $message == '' ) {
|
||||
$message = $ws->setScoreCutoff($params['siren'], $params['encours']*1000, $params['scoreSolv'], $params['scoreDir'], $params['scoreConf'], $params['remarque'], $params['delete']);
|
||||
$message = $ws->setScoreCutoff(
|
||||
$params['siren'],
|
||||
$params['encours']*1000,
|
||||
$params['scoreSolv'],
|
||||
$params['scoreDir'],
|
||||
$params['scoreConf'],
|
||||
$params['remarque'],
|
||||
$params['delete']
|
||||
);
|
||||
if (is_int($message)){
|
||||
$message = "Cut-off mis à jour.";
|
||||
$refresh = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($message == '' && $params['delete'] == 1) {
|
||||
$message = "Cut-off est supprimé. Aucun Cut-off est défini, merci de remplir toutes les valeurs";
|
||||
$refresh = 1;
|
||||
}
|
||||
}
|
||||
$this->view->assign('mode', 'added');
|
||||
} else {
|
||||
$this->view->assign('name', "Définir un Cut-off");
|
||||
$this->view->assign('href', $this->view->url(array('controller'=>'saisie','action'=>'scorecutoff','siren'=>$siren)));
|
||||
$message = "Erreur lors de la mise à jour (".$message.").";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$getcutoff = json_decode($ws->getScoreCutoff($siren), true);
|
||||
if( !$getcutoff ) {
|
||||
if ( $message == '' ) {
|
||||
$message = "Aucun Cut-off est défini, merci de remplir toutes les valeurs";
|
||||
$refresh = 0;
|
||||
$message = "Aucun Cut-off, merci de remplir toutes les valeurs";
|
||||
}
|
||||
|
||||
$getcutoff = array(
|
||||
@ -2449,11 +2491,21 @@ class SaisieController extends Zend_Controller_Action
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//Display link
|
||||
else {
|
||||
|
||||
$this->view->assign('name', "Définir un Cut-off");
|
||||
$this->view->assign('href', $this->view->url(array('controller'=>'saisie','action'=>'scorecutoff','siren'=>$siren)));
|
||||
|
||||
}
|
||||
|
||||
$this->view->assign('getcutoff', $getcutoff);
|
||||
$this->view->assign('siren', $siren);
|
||||
$this->view->assign('typescore', $user->getTypeScore());
|
||||
$this->view->assign('message', $message);
|
||||
$this->view->assign('refresh', $refresh);
|
||||
}
|
||||
|
||||
public function citysearchAction()
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php if (empty($this->AutrePage)):?>
|
||||
<?php if ( empty($this->AutrePage) ) {?>
|
||||
<div id="center">
|
||||
<?php endif;?>
|
||||
<?php }?>
|
||||
|
||||
<?php if (empty($this->AutrePage)):?>
|
||||
<?php if ( empty($this->AutrePage) ) {?>
|
||||
<h1>INDISCORE©</h1>
|
||||
<div class="paragraph">
|
||||
<table>
|
||||
@ -35,7 +35,7 @@
|
||||
<?php }?>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php }?>
|
||||
|
||||
<h2>Dénomination sociale & coordonnées</h2>
|
||||
<div class="paragraph">
|
||||
@ -51,6 +51,7 @@
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$titre='';
|
||||
if ($this->indiscore->Enseigne!='' && $this->indiscore->Sigle!='') {
|
||||
@ -59,10 +60,9 @@
|
||||
$titre = 'Enseigne'; $lib = $this->indiscore->Enseigne;
|
||||
} elseif ($this->indiscore->Enseigne=='' && $this->indiscore->Sigle!='') {
|
||||
$titre = 'Sigle'; $lib = $this->indiscore->Sigle;
|
||||
}
|
||||
}?>
|
||||
|
||||
if (!empty($titre)) {
|
||||
?>
|
||||
<?php if ( !empty($titre) ) {?>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib"><?=$titre?></td>
|
||||
@ -131,7 +131,6 @@
|
||||
<td width="30"> </td>
|
||||
<td width="550" colspan="2" class="StyleInfoData">
|
||||
L'évaluation indiScore© est en partie basée sur les points notables suivants :<br/>
|
||||
|
||||
<h3><u>Conformité légale :</u></h3>
|
||||
<div class="stats gradiant_pic">
|
||||
<ul>
|
||||
@ -178,7 +177,7 @@
|
||||
</tr>
|
||||
|
||||
<?php $millesimeMax = date('Ymd', mktime(0, 0, 0, date('m'), date('d'), date('Y')-2));?>
|
||||
<?php if($this->indiscore->NbBilansScore > 0 && $this->indiscore->Bilans->item[0]->Millesime >= $millesimeMax):?>
|
||||
<?php if($this->indiscore->NbBilansScore > 0 && $this->indiscore->Bilans->item[0]->Millesime >= $millesimeMax) {?>
|
||||
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
@ -201,7 +200,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php else:?>
|
||||
<?php } else {?>
|
||||
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
@ -216,7 +215,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endif;?>
|
||||
<?php }?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@ -280,7 +279,7 @@
|
||||
|
||||
|
||||
|
||||
<?php if (empty($this->AutrePage)):?>
|
||||
<?php if ( empty($this->AutrePage) ) {?>
|
||||
<?=$this->render('cgu.phtml', $this->cgu);?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php }?>
|
||||
|
@ -16,52 +16,72 @@ $('a.dialog').on('click', function(e){
|
||||
$(this).html('Chargement...');
|
||||
$(this).load(href);
|
||||
},
|
||||
buttons: {'Fermer': function() { $(this).dialog('close'); }},
|
||||
buttons: {"Fermer": function() { $(this).dialog('close'); }},
|
||||
close: function() { $('#dialog').remove(); }};
|
||||
$('<div id="dialog"></div>').dialog(dialogOpts);
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php } else {?>
|
||||
<style>
|
||||
<?php } elseif ( $this->mode == 'todelete' ) {?>
|
||||
|
||||
<p>Etes vous sur de vouloir supprimer le cut-off sur le siren <?=$this->siren?> ? </p>
|
||||
|
||||
<form action="<?=$this->url(array('controller'=>'saisie', 'action'=>'scorecutoff'), null, true)?>" method="post">
|
||||
<input type="hidden" name="siren" value="<?=$this->siren?>">
|
||||
<input type="hidden" name="mode" value="delete">
|
||||
<input type="hidden" name="encours" value="<?=$this->encours?>"/>
|
||||
<input type="hidden" name="scoreConf" value="<?=$this->scoreConf?>"/>
|
||||
<input type="hidden" name="scoreDir" value="<?=$this->scoreDir?>"/>
|
||||
<input type="hidden" name="scoreSolv" value="<?=$this->scoreSolv?>"/>
|
||||
<input type="hidden" name="remarque" value="<?=$this->remarque?>"/>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{text: "Oui", click: function() {
|
||||
var values = $(this).find('form').serialize();
|
||||
var url = $(this).find('form').attr('action');
|
||||
$('#dialog').html('Chargement...');
|
||||
$.post(url, values, function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
}},
|
||||
{text: "Non", click: function() { $(this).dialog('close'); }}
|
||||
] });
|
||||
</script>
|
||||
|
||||
<?php } elseif ( $this->mode == 'delete' || $this->mode == 'added' ) {?>
|
||||
|
||||
<div class="ui-widget">
|
||||
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
|
||||
<p><?=$this->message?></p></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var windowhref = window.location.href;
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{text: "Fermer", click: function() { $(this).dialog('close'); window.location.href = windowhref; }}
|
||||
] });
|
||||
</script>
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<style>
|
||||
select, input {
|
||||
width:5em;
|
||||
}
|
||||
|
||||
.brsr {
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
border-color:red;
|
||||
}
|
||||
|
||||
.loading
|
||||
{
|
||||
background-color: silver;
|
||||
height: 450px;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
width: 720px;
|
||||
opacity: 0.3;
|
||||
display:none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 10px;
|
||||
width: 98%;
|
||||
background-color: #FFFFDD;
|
||||
border: 1px solid #FCEFA1;
|
||||
border-radius: 4px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php $getcutoff = $this->getcutoff; ?>
|
||||
|
||||
<?php if ($this->message!='') {?>
|
||||
<div class='message'><p id='<?=$this->refresh ?>'><?=$this->message; ?></p></div>
|
||||
<div class="ui-widget">
|
||||
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
|
||||
<p><?=$this->message?></p></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
<?php if ($getcutoff['dateInsert']!='') { ?>
|
||||
@ -70,7 +90,7 @@ select, input {
|
||||
<div>Date de mise à jour Cut-off</div>
|
||||
</div>
|
||||
<div class="StyleInfoData" style="float:left; margin-top:20px; ">
|
||||
<div id='dateInsert'>
|
||||
<div>
|
||||
<?php $date = new Zend_Date($getcutoff['dateInsert'], 'yyyy-MM-dd')?>
|
||||
<?=$date->toString('dd/MM/yyyy')?>
|
||||
</div>
|
||||
@ -82,9 +102,8 @@ select, input {
|
||||
<?php } ?>
|
||||
|
||||
<div style="margin-top:5em">
|
||||
<form>
|
||||
<form action="<?=$this->url(array('controller'=>'saisie', 'action'=>'scorecutoff'), null, true)?>" method="post">
|
||||
<input type="hidden" name="siren" value="<?=$this->siren?>">
|
||||
<input type="hidden" name="delete" value="0">
|
||||
|
||||
<div>
|
||||
<label>Encours</label>
|
||||
@ -121,8 +140,28 @@ foreach($select as $item => $val) {
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="loading"><center><img style="padding-top:25%" src="/themes/default/images/giant/19-1.gif" /></center></div>
|
||||
|
||||
<script type="text/javascript" src="/themes/default/scripts/scorecutoff.js" />
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
<?php if ($getcutoff['dateInsert']!='') { ?>
|
||||
{text: "Supprimer", click: function() {
|
||||
var values = $(this).find('form').serialize();
|
||||
var url = $(this).find('form').attr('action') + '/mode/todelete';
|
||||
$('#dialog').html('Chargement...');
|
||||
$.post(url, values, function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
}},
|
||||
<?php }?>
|
||||
{text: "Valider", click: function() {
|
||||
var values = $(this).find('form').serialize();
|
||||
var url = $(this).find('form').attr('action');
|
||||
$('#dialog').html('Chargement...');
|
||||
$.post(url, values, function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
}},
|
||||
{text: "Fermer", click: function() { $(this).dialog('close'); }}
|
||||
] });
|
||||
</script>
|
||||
|
||||
<?php }?>
|
@ -1,90 +0,0 @@
|
||||
function validate() {
|
||||
var allvals = true;
|
||||
$("[required]").each(function() {
|
||||
if(!$(this).val()) {
|
||||
allvals = false;
|
||||
$(this).addClass('brsr');
|
||||
}
|
||||
else { $(this).removeClass('brsr'); }
|
||||
});
|
||||
if ($('[name=encours]').val()<0 || $('[name=encours]').val()>500 || !$('[name=encours]').val()){
|
||||
allvals = false;
|
||||
$('[name=encours]').addClass('brsr');
|
||||
}
|
||||
else { $('[name=encours]').removeClass('brsr'); }
|
||||
return allvals;
|
||||
}
|
||||
|
||||
function loading() {
|
||||
if ($('.loading').css('display')=='none') {
|
||||
$('.loading').css('display', 'block');
|
||||
$('.ui-dialog-content').css('overflow','hidden');
|
||||
$(".ui-dialog-buttonpane button").button("disable");
|
||||
}
|
||||
else { $('.loading').css('display', 'none');}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
validate();
|
||||
});
|
||||
|
||||
$('[required]').blur(function(){
|
||||
validate();
|
||||
});
|
||||
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Valider", click: function() {
|
||||
var values = $(this).find('form').serialize();
|
||||
if (validate()) {
|
||||
loading();
|
||||
$.post('/saisie/scorecutoff', values, function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
}
|
||||
}},
|
||||
{ text: "Supprimer", click: function() {
|
||||
if (validate()) {
|
||||
$('<div></div>').html('<div style="line-height:25px;">Supprimer Cut-off ?</div><div style="font-size:10px; color:#999;">Toutes les valeurs seront effacées.</div>')
|
||||
.dialog({
|
||||
modal: true,
|
||||
title: 'Confirmation de suppression',
|
||||
zIndex: 10000,
|
||||
autoOpen: true,
|
||||
width: '250',
|
||||
resizable: false,
|
||||
buttons: {
|
||||
Oui: function () {
|
||||
$('#dialog [name=delete]').val('1');
|
||||
var values = $('#dialog').find('form').serialize();
|
||||
$(this).dialog("close");
|
||||
loading();
|
||||
$.post('/saisie/scorecutoff', values, function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
},
|
||||
Non: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},
|
||||
close: function (event, ui) {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
}},
|
||||
{ text: "Fermer", click: function() {
|
||||
if($(".message p").attr('id')==1) {
|
||||
loading();
|
||||
location.reload();
|
||||
}
|
||||
else {$(this).dialog('close');}
|
||||
}
|
||||
}
|
||||
] });
|
||||
|
||||
if($('#dateInsert').text()!='') {
|
||||
$(".ui-dialog-buttonpane button:contains('Supprimer')").show();
|
||||
}
|
||||
else {
|
||||
$(".ui-dialog-buttonpane button:contains('Supprimer')").hide();
|
||||
}
|
Loading…
Reference in New Issue
Block a user