correction affichage éléments durant les étapes

This commit is contained in:
Rudy Masson 2023-05-24 15:29:33 +02:00
parent 0650f174cc
commit 84f7fd320e
4 changed files with 44 additions and 39 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/public/build/
/var/
###< symfony/framework-bundle ###

View File

@ -41,7 +41,6 @@ export default class GetEvent{
dataType: "json",
data: {'codeBarre': value},
success: function(response){
console.log(response.data)
switch(response.data.step){
case '0':
if(response.data.status == 'success'){
@ -61,6 +60,12 @@ export default class GetEvent{
}
if(response.data.status == 'init'){
$pictureTube.css('display', 'none');
$picturePoche.css('display', 'none');
let pochesImg = $('.sang');
[...pochesImg].forEach(sang=>{
sang.remove();
})
$don.html(response.data.codeBarre);
$nom.html(response.data.nom);
$prenom.html(response.data.prenom);
@ -110,27 +115,25 @@ export default class GetEvent{
case '2':
if(response.data.status == 'success'){
$typePoche.html(response.data.nbre_poche)
console.log(response.data.nbre_poche)
$current.html(response.data.nbre_poche)
console.log(response.data.nbre_poche)
$type.html('Poches');
$todo.html(response.data.nbre_poche_max)
$input.attr('max', response.data.nbre_poche_max)
$input.attr('value', response.data.nbre_poche)
if(response.data.nbre_poche !=response.data.nbre_poche_max ){
$picturePoche.append('<div class="sang"><img src="/poches/Poche_sang.png"></div>')
$picturePoche.append('<div class="sang"><img src="/poches/Poche_sang2.png"></div>')
}
saisie.focus();
}
if(response.data.status == 'final'){
$typePoche.html(response.data.nbre_poche)
console.log(response.data.nbre_poche)
$current.html(response.data.nbre_poche)
$input.attr('max', response.data.nbre_poche_max)
$input.attr('value', response.data.nbre_poche)
console.log('valider avec un scan de poche!')
$indication.html('valider avec un scan de poche!');
$indication.html('validez avec un scan de poche!');
$picturePoche.append('<div class="sang"><img src="/poches/Poche_sang.png"></div>')
$picturePoche.append('<div class="sang"><img src="/poches/Poche_sang2.png"></div>')
saisie.focus();
}
@ -168,16 +171,18 @@ export default class GetEvent{
case '3':
if(response.data.status == "success"){
$picturePoche.css('display', 'none');
let pochesImg = $('.sang');
[...pochesImg].forEach(sang=>{
sang.remove();
})
$pictureTube.css('display', 'flex');
console.log('valider avec un scan de poche!')
$indication.html('Scannez les étiquettes de tubes!');
$input.attr('max', response.data.nbre_tube_max)
$todo.html(response.data.nbre_tube_max)
$input.attr('value', response.data.nbre_tube_max)
$current.html(response.data.nbre_tube_max)
$input.attr('value', 0)
$current.html(0)
$type.html('Tubes')
console.log("on passe aux tubes");
}
if(response.data.status == "error_scan"){
@ -197,26 +202,27 @@ export default class GetEvent{
$type.html('Tubes')
$todo.html(response.data.nbre_tube_max)
$input.attr('value', response.data.nbre_tube)
$pictureTube.append('<div class="sang"><img src="/tubes/Tube1.png"></div>')
console.log( response.data.nbre_tube)
$pictureTube.append('<div class="sang"><img src="/tubes/Tube'+response.data.nbre_tube+'_check.png"></div>')
saisie.focus();
console.log(response.data.nbre_poche)
}
if(response.data.status == 'final'){
$nbreTube.html(response.data.nbre_tube)
$current.html(response.data.nbre_tube)
$current.html(response.data.nbre_tube_max)
$input.attr('max', response.data.nbre_tube_max)
$type.html('Tubes')
$todo.html(response.data.nbre_tube_max)
$input.attr('value', response.data.nbre_tube)
$pictureTube.append('<div class="sang"><img src="/tubes/Tube1.png"></div>')
$pictureTube.append('<div class="sang"><img src="/tubes/Tube'+response.data.nbre_tube+'_check.png"></div>')
$displaySuccess.html('Patient '+ response.data.prenom+' '+response.data.nom + ' traité avec succès')
$displaySuccess.css('display', 'flex')
setTimeout(() => {
location.reload();
$displaySuccess.css('display', 'none')
}, 5000);
saisie.focus();
console.log(response.data.nbre_poche)
}
if(response.data.status == 'error_scan'){
@ -243,7 +249,7 @@ export default class GetEvent{
$displayError.html('Ne correspond pas au donneur')
$displayError.css('display', "flex");
setTimeout(() => {
$displayError.css('display', 'none')
$displayError.css('display', 'none');
}, 5000);
saisie.focus();

File diff suppressed because one or more lines are too long

View File

@ -78,7 +78,7 @@ class ApiController extends AbstractController
'status'=>'init',
'step'=> '0',
'codeBarre'=>$don->GetCodeBarre(),
'nbre_tube'=>$don->getNbreTube(),
'nbre_tube'=>0,
'nbre_tubemax'=>$don->getNbreTube(),
'type_don'=> $don->getDonCat()->getName(),
'nom'=>$don->getDonneur()->getLastname(),
@ -94,7 +94,8 @@ class ApiController extends AbstractController
'step'=> '0',
'status'=>'success',
'codeBarre'=>$don->GetCodeBarre(),
'nbre_tube'=>$don->getNbreTube(),
'nbre_tube'=>0,
'nbre_tubemax'=>$don->getNbreTube(),
'type_don'=> $don->getDonCat()->getName(),
'nom'=>$don->getDonneur()->getLastname(),
'prenom'=>$don->getDonneur()->getFirstname(),
@ -112,12 +113,12 @@ class ApiController extends AbstractController
if(preg_match(self::REGEX_GROUP_POCHE, $codeBarre)){
$dmuCatNumber = $this->dmuCatRepository->findOneByCodeBarre($codeBarre)->getPocheNumber();
$session->set('step', 2);
$session->set('nbre_poche' , $dmuCatNumber);
$session->set('nbre_poche' , 0);
$session->set('nbre_poche_max' , $dmuCatNumber);
return $this->json(['data'=>[
'step'=> '1',
'status'=>'success',
'nbre_poche'=>$dmuCatNumber,
'nbre_poche'=>0,
'nbre_poche_max'=>$dmuCatNumber
]]);
}else{
@ -153,12 +154,12 @@ class ApiController extends AbstractController
'status'=>'error_doublon'
]]);
}
if($nbrePoche > 1 ){
$session->set('nbre_poche', $nbrePoche - 1);
if($nbrePoche < ($session->get('nbre_poche_max')-1) ){
$session->set('nbre_poche', $nbrePoche + 1);
return $this->json(['data'=>[
'step'=> '2',
'status'=>'success',
'nbre_poche'=>$nbrePoche - 1,
'nbre_poche'=>$nbrePoche + 1,
'nbre_poche_max'=>$session->get('nbre_poche_max')
]
]);
@ -168,7 +169,7 @@ class ApiController extends AbstractController
return $this->json(['data'=>[
'step'=> '2',
'status'=>'final',
'nbre_poche'=>$nbrePoche - 1,
'nbre_poche'=>$nbrePoche +1,
'nbre_poche_max'=>$session->get('nbre_poche_max')
]
]
@ -220,24 +221,26 @@ class ApiController extends AbstractController
'status'=>'error_doublon']
]);
}
if($nbreTube > 1){
$session->set('nbre_tube', $nbreTube - 1);
if($nbreTube < ($session->get('nbre_tube_max') -1)){
$session->set('nbre_tube', $nbreTube + 1);
return $this->json(['data'=>[
'step'=>'4',
'status'=>'success',
'nbre_tube_max'=>$session->get('nbre_tube_max'),
'nbre_tube'=>$nbreTube - 1
'nbre_tube'=>$nbreTube + 1
]
]);
}else{
$don = $this->donRepository->findOneByCodeBarre(substr($codeBarre, 0, -3));
$session->set('step', 0);
$session->set('nbre_tube', 0);
$session->clear();
return $this->json(['data'=>[
'step'=>'4',
'status'=>'final',
'nbre_tube'=>$nbreTube - 1
'nbre_tube'=>$nbreTube +1,
'nom'=>$don->getDonneur()->getLastname(),
'prenom'=>$don->getDonneur()->getFirstname(),
]
]
);
@ -261,7 +264,7 @@ class ApiController extends AbstractController
{
$session->set('don_code_barre' , $don->getCodeBarre());
$session->set('categorie_don' , $don->getDonCat()->getName());
$session->set('nbre_tube', $don->getNbreTube());
$session->set('nbre_tube', 0);
$session->set('nbre_tube_max', $don->getNbreTube());
$session->set('liste_poche', []);
$session->remove('nbre_poche');