Issue #0001634: Modifie

This commit is contained in:
Aram HARUTYUNYAN 2013-06-07 13:40:00 +00:00
parent e42377c601
commit c223da5fd2
2 changed files with 77 additions and 102 deletions

View File

@ -2293,24 +2293,6 @@ class SaisieController extends Zend_Controller_Action
$request = $this->getRequest();
$siren = $request->getParam('siren');
$getcutoff = json_decode($ws->getScoreCutoff($siren), true);
if(!$getcutoff) {
$getcutoff = array(
'siren' => '',
'encours' => '',
'scoreSolv' => '',
'scoreDir' => '',
'scoreConf' => '',
'remarque' => '',
'dateInsert' => '',
'dateUpdate' => ''
);
}
$this->view->assign('siren', $siren);
$this->view->assign('getcutoff', $getcutoff);
$this->view->assign('typescore', $user->getTypeScore());
if ( $request->isXmlHttpRequest() ) {
$this->_helper->layout()->disableLayout();
@ -2348,5 +2330,23 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('name', "Définir un Cut-off");
$this->view->assign('href', $this->view->url(array('controller'=>'saisie','action'=>'scorecutoff','siren'=>$siren)));
}
$getcutoff = json_decode($ws->getScoreCutoff($siren), true);
if(!$getcutoff) {
$getcutoff = array(
'siren' => '',
'encours' => '',
'scoreSolv' => '',
'scoreDir' => '',
'scoreConf' => '',
'remarque' => '',
'dateInsert' => '',
'dateUpdate' => ''
);
}
$this->view->assign('getcutoff', $getcutoff);
$this->view->assign('siren', $siren);
$this->view->assign('typescore', $user->getTypeScore());
}
}

View File

@ -16,39 +16,13 @@ $('a.dialog').on('click', function(e){
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
'Fermer': function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
buttons: {'Fermer': function() { $(this).dialog('close'); }},
close: function() { $('#dialog').remove(); }};
$('<div id="dialog"></div>').dialog(dialogOpts);
return false;
});
</script>
<?php } elseif ($this->message) {?>
<style>
.message {
font-size: 10px;
width: 98%;
background-color: #FFFFDD;
border: 1px solid #FCEFA1;
border-radius: 4px;
padding-left: 15px;
}
</style>
<div class='message'><p><?=$this->message; ?></p></div>
<script>
$('#dialog').dialog({ buttons: [
{ text: "Fermer", click: function() {
location.reload();
$(this).dialog('close');
}
}
] });
</script>
<?php } else {?>
<style>
@ -67,74 +41,69 @@ select, input {
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;
$wdate = new WDate();
?>
<?php if ($this->message!='') {?>
<div class='message'><p><?=$this->message; ?></p></div>
<?php }?>
<p>
<div class="paragraph">
<div class="StyleInfoLib" style="float:left; margin-left:40em;">Date de création Cut-off - </div>
<div class="StyleInfoData" style="float:left; "> <?=$wdate->dateT('Y-m-d', 'd/m/Y', $getcutoff['dateInsert']); ?></div>
<div class="StyleInfoLib" style="float:left; margin-left:40em; margin-top:20px; width:170px">
<div>Date de création Cut-off</div>
<div>Date de mise à jour Cut-off</div>
</div>
</p>
<div class="paragraph">
<div class="StyleInfoLib" style="float:left; margin-left:40em;">Date de mise à jour Cut-off - </div>
<div class="StyleInfoData" style="float:left;"> <?=$wdate->dateT('Y-m-d', 'd/m/Y', $getcutoff['dateUpdate']); ?></div>
<div class="StyleInfoData" style="float:left; margin-top:20px; ">
<div> <?=$wdate->dateT('Y-m-d', 'd/m/Y', $getcutoff['dateInsert']); ?></div>
<div> <?=$wdate->dateT('Y-m-d', 'd/m/Y', $getcutoff['dateUpdate']); ?></div>
</div>
<div class="paragraph">
<div style="margin-top:5em">
<form>
<input type="hidden" name="siren" value="<?=$this->siren?>">
<div>
<label>Encours</label>
<input type="text" name="encours" value="<?=$getcutoff['encours']/1000 ?>" required pattern="([0-9]{0,2})|([0-4]{1}[0-9]{0,2})|500" maxlength="3"/> K€ (de 0 à 500 K€)
<input type="text" name="encours" value="<?=$getcutoff['encours']/1000 ?>" required pattern="([0-9]{0,2})|([0-4]{1}[0-9]{0,2})|500" maxlength="3"/>
</div>
<div style="float:left">K€ (de 0 à 500 K€)</div>
<?php
$select = array('scoreSolv' => 'IndiScore', 'scoreDir' => 'Score dirigeance', 'scoreConf' => 'Score de conformité');
foreach($select as $item => $val) {
?>
<div>
<label>IndiScore</label>
<select name="scoreSolv" required>
<label><?=$val?></label>
<select name="<?=$item ?>" required>
<option value=''>---</option>
<?php
for($i=0; $i<=$this->typescore; $i++) {
$selected = '';
if ($i == $getcutoff['scoreSolv']) {
$selected = 'selected';
}
echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
}
?>
</select>
</div>
<div>
<label>Score dirigeance</label>
<select name="scoreDir" required>
<option value=''>---</option>
<?php
for($i=0; $i<=$this->typescore; $i++) {
$selected = '';
if ($i == $getcutoff['scoreDir']) {
$selected = 'selected';
}
echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
}
?>
</select>
</div>
<div>
<label>Score de conformité</label>
<select name="scoreConf" required>
<option value=''>---</option>
<?php
for($i=0; $i<=$this->typescore; $i++) {
$selected = '';
if ($i == $getcutoff['scoreConf']) {
if ($i == $getcutoff[$item]) {
$selected = 'selected';
}
echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
@ -142,6 +111,7 @@ $wdate = new WDate();
?>
</select>
</div>
<?php } ?>
<div>
<label>Remarque</label>
@ -151,9 +121,9 @@ $wdate = new WDate();
</form>
</div>
<script>
<div class="loading"><center><img style="padding-top:25%" src="/themes/default/images/giant/19-1.gif" /></center></div>
// validating the correct values and range
<script>
function validate() {
var allvals = true;
$("[required]").each(function() {
@ -161,17 +131,13 @@ function validate() {
allvals = false;
$(this).addClass('brsr');
}
else {
$(this).removeClass('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');
}
else { $('[name=encours]').removeClass('brsr'); }
return allvals;
}
@ -182,17 +148,26 @@ $(document).ready(function(){
$('[required]').blur(function(){
validate();
});
$('#dialog').dialog({ buttons: [
{ text: "Valider", click: function() {
var values = $(this).find('form').serialize();
if (validate()) {
if ($('.loading').css('display')=='none') {
$('.loading').css('display', 'block');
$('.ui-dialog-content').css('overflow','hidden');
$(".ui-dialog-buttonpane button:contains('Valider')").button("disable");
}
else { $('.loading').css('display', 'none');}
$.post('<?=$this->url(array('controller'=>'saisie','action'=>'scorecutoff'),null,true)?>', values, function(data) {
$('#dialog').html(data);
});
}
}},
{ text: "Fermer", click: function() { $(this).dialog('close'); }}
{ text: "Fermer", click: function() {
if($(".message p").text()) { location.reload(); }
$(this).dialog('close');
}
}
] });
</script>