Issue #0001652: Add delete Cut-off function

This commit is contained in:
Aram HARUTYUNYAN 2013-07-25 06:06:04 +00:00
parent 9e8928ce2d
commit d9e0074c29
5 changed files with 104 additions and 14 deletions

View File

@ -2297,6 +2297,7 @@ class SaisieController extends Zend_Controller_Action
$request = $this->getRequest();
$siren = $request->getParam('siren');
$refresh = 0;
if ( $request->isXmlHttpRequest() ) {
$this->_helper->layout()->disableLayout();
@ -2326,6 +2327,7 @@ class SaisieController extends Zend_Controller_Action
$message = $ws->setScoreCutoff($params['siren'], $params['encours']*1000, $params['scoreSolv'], $params['scoreDir'], $params['scoreConf'], $params['remarque']);
if (is_int($message)){
$message = "Cut-off mis à jour.";
$refresh = 1;
}
}
}
@ -2336,7 +2338,13 @@ class SaisieController extends Zend_Controller_Action
$getcutoff = json_decode($ws->getScoreCutoff($siren), true);
if(!$getcutoff) {
$message = "Aucun Cut-off est défini, merci de remplir toutes les valeurs";
if ($request->getParam('delmessage', NULL)){
$message = $request->getParam('delmessage', NULL)."Aucun Cut-off est défini, merci de remplir toutes les valeurs";
$refresh = 1;
} else {
$message = "Aucun Cut-off est défini, merci de remplir toutes les valeurs";
}
$getcutoff = array(
'siren' => '',
'encours' => '',
@ -2344,8 +2352,8 @@ class SaisieController extends Zend_Controller_Action
'scoreDir' => '',
'scoreConf' => '',
'remarque' => '',
'dateInsert' => '0000-00-00',
'dateUpdate' => '0000-00-00'
'dateInsert' => '',
'dateUpdate' => ''
);
}
@ -2353,5 +2361,28 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('siren', $siren);
$this->view->assign('typescore', $user->getTypeScore());
$this->view->assign('message', $message);
$this->view->assign('refresh', $refresh);
}
/**
* Supprimer Cut-off
*/
public function scorecutoffdelAction()
{
$ws = new WsScores();
$message = '';
$request = $this->getRequest();
$siren = $request->getParam('siren');
if ( $request->isXmlHttpRequest() ) {
$this->_helper->layout()->disableLayout();
if ( $request->isPost() && isset($siren)) {
$message = $ws->delScoreCutoff($siren);
if ($message){
$message = "Cut-off est supprimé. ";
}
}
}
$this->_redirect('/saisie/scorecutoff/siren/'.$siren.'/delmessage/'.$message);
}
}

View File

@ -64,17 +64,19 @@ $getcutoff = $this->getcutoff;
$wdate = new WDate();
?>
<?php if ($this->message!='') {?>
<div class='message'><p><?=$this->message; ?></p></div>
<div class='message'><p id='<?=$this->refresh ?>'><?=$this->message; ?></p></div>
<?php }?>
<?php if ($getcutoff['dateInsert']!='') { ?>
<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>
<div class="StyleInfoData" style="float:left; margin-top:20px; ">
<div> <?=$wdate->dateT('Y-m-d', 'd/m/Y', $getcutoff['dateInsert']); ?></div>
<div id='dateInsert'> <?=$wdate->dateT('Y-m-d', 'd/m/Y', $getcutoff['dateInsert']); ?></div>
<div> <?=$wdate->dateT('Y-m-d', 'd/m/Y', $getcutoff['dateUpdate']); ?></div>
</div>
<?php } ?>
<div style="margin-top:5em">
<form>
@ -115,6 +117,8 @@ foreach($select as $item => $val) {
</form>
</div>
<div id="confirm" title="Confirmation de suppression">Supprimer Cut-off ?</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" />

View File

@ -321,6 +321,25 @@ class WsScores
return $fault->faultstring;
}
}
/**
* Delete Score Cut Off
* @param string $siren
* @return boolean
*/
public function delScoreCutoff($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('saisie');
try {
$reponse = $client->delScoreCutoff($params); //change name when webservice is ready
return $reponse->delScoreCutoffResult; //change name when webservice is ready
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function searchLogin($idClient, $query)
{

View File

@ -15,6 +15,15 @@ function validate() {
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();
});
@ -23,24 +32,51 @@ $('[required]').blur(function(){
validate();
});
$("#confirm").dialog({
autoOpen: false,
modal: true,
buttons : {
"Oui" : function() {
var siren = $('[name=siren]').serialize();
$(this).dialog("close");
loading();
$.post('/saisie/scorecutoffdel', siren, function(data) {
$('#dialog').html(data);
});
},
"Non" : function() {
$(this).dialog("close");
}
}
});
$('#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');}
loading();
$.post('/saisie/scorecutoff', values, function(data) {
$('#dialog').html(data);
});
}
}},
{ text: "Supprimer",
click: function() {
$("#confirm").dialog("open");
}},
{ text: "Fermer", click: function() {
if($(".message p").text()=='Cut-off mis à jour.') { location.reload(); }
$(this).dialog('close');
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(); // change to show() when webservice will be ready
}