Park Rezervasyonu BeforeSave Script

Park Rezervasyonu BeforeSave Script

let adult = this.allFormControls.ADULT.value;
let child1 = this.allFormControls.CHD1.value;
let child2 = this.allFormControls.CHD2.value;
let baby = this.allFormControls.BABY.value;
this.recordService.grids.parkguest.grid.agGrid.api.forEachNode((node)=>{
  if(node.data.GUESTTYPE===1){
     adult--;  
  }
  if(node.data.GUESTTYPE===2){
     child1--;  
  }
  if(node.data.GUESTTYPE===3){
     child2--;  
  }
  if(node.data.GUESTTYPE===4){
     baby--;  
  }
});
 if(adult!==0 || child1!==0 || child2!==0 || baby!==0){
   this.allFormControls.ADULT.setValue(this.allFormControls.ADULT.value - adult);
   this.allFormControls.CHD1.setValue(this.allFormControls.CHD1.value - child1);
   this.allFormControls.CHD2.setValue(this.allFormControls.CHD2.value - child2);
   this.allFormControls.BABY.setValue(this.allFormControls.BABY.value - baby);
 }

Last updated