Stok Fişi

Stok Fişi Script

(async () => {
  console.log('angus.recordService.formGroup.value: ',this.recordService.formGroup.value);
  const awaitIf = async (fn, ms = 100) => {
    await new Promise(async (resolve, reject) => {
      let result = false;
      try {
        result = fn();
      } catch (e) {
        console.error(e);
      }
  
      if (result) {
        resolve(true);
      } else {
        await rxjs.timer(ms).toPromise();
        resolve(await awaitIf(fn));
      }
    });
  };
  let StockGrid = this.allGrids['stock-fiches-details'];
  await awaitIf(() => StockGrid.grid && StockGrid.grid.agGrid && StockGrid.grid.agGridReady, 0);
    
    
  
  document.querySelector('.ang-record-stock-fiches .ang-panel-stocks').style.display = 'none';
  document.querySelector('.ang-record-stock-fiches .ang-panel-stocks').parentElement.style.display = 'none';
  document.querySelector('.ang-record-stock-fiches .dynamic-container').style.gridTemplateAreas = 
  `"P1" "P2"`;
  document.querySelector('#openStocks .mat-icon').style.transform= 'rotate(180deg)'
  
  const storeSenderControl = this.recordService.elements.storeSenderLookup.api.innerComponent.innerComponent.formControl;
  const storeRecipientControl = this.recordService.elements.storeRecipientLookup.api.innerComponent.innerComponent.formControl;
  this.allFormControls['BRANCHID'].valueChanges.pipe(
    rxjs.filter((value ,index) => index > 1 || this.mode.value === 'insert'),
    rxjs.distinctUntilChanged()
  ).subscribe((branchID) => {
    this.recordService.formGroup.controls.SENDERSTOREID.setValue(null);
    this.recordService.formGroup.controls.RECIPIENTSTOREID.setValue(null);
    storeSenderControl.setValue('abc');
    storeSenderControl.setValue('');
    storeRecipientControl.setValue('abc');
    storeRecipientControl.setValue('');
  });
 
 this.TypeIdChange = async (val)=>{
   let x = this.recordService.formGroup.controls.TYPEID.value;
   if(val){
     x=val;
   }
   if (x != 12) {
        this.allFormControls['SENDERSTOREID_NAME'].enable();
        this.allFormControls['RECIPIENTSTOREID_NAME'].disable();
      }
      else{
        this.allFormControls['SENDERSTOREID_NAME'].enable();
        this.allFormControls['RECIPIENTSTOREID_NAME'].enable();
      }
 }
    let startValue = this.recordService.formGroup.controls.TYPEID.value;
    
    this.allFormControls["TYPEID"].valueChanges.pipe(rxjs.startWith(startValue)).subscribe(async (typeId) => {
      this.TypeIdChange(typeId);
    }); 
    
    this.allFormControls["ID"].valueChanges.pipe(rxjs.startWith(startValue)).subscribe(async (typeId) => {
       this.TypeIdChange();
    });
})();

Last updated