1 2 3 4 5 6 7
   |     <input
      type="number"
      [(ngModel)]="targetRevenue"
      (ngModelChange)="calcul()"
      placeholder="Revenu Cible"
      value="{{prixMin}}"
    /> | 
 
	
	1 2 3 4
   | calcul() {
   this.calculRecette(); 
   this.calculPrixMin()
} | 
 ** (1)
il y a une confusion sur: targetRevenue
il est utilisé pour le ngModel et pour recevoir le resultat de la recette
** (2)
	
	1 2
   |        this.targetRevenue= this.prixMax * this.nbOfRooms * (this.occupancyRate / 100);
       this.prixMin = this.recette / this.nbOfRooms; | 
 si dans un calcul tu multiplie par nbOfRooms  et qu'ensuite tu divises par: nbOfRooms 
ça ne sert à rien !
** (3)
utilise cette fonction avant chaque calcul car ça ne sert à rien de faire un calcul si les valeurs ne sont pas bonnes
	
	1 2 3 4 5 6
   |   checkValues() {
    if (this.targetRevenue >= 0 && this.nbOfRooms >= 0 && this.occupancyRate >= 0 && this.prixMax >= 0) {
      return true;
    }
    return;
  } | 
 ** 4
astuce:
	
	<span>Le Prix Min sera de </span><span *ngIf="prixMin">{{prixMin | currency:'EUR'}}</span>
 
						
					
Partager