correction affichage éléments durant les étapes

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

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();