import {Component, Input, OnInit} from '@angular/core';
import {NavController} from "@ionic/angular";
import {Router} from "@angular/router";
import {SessionDataProviderService} from "../../store/session-data-provider.service";
import {WrenchService} from "../../services/wrench.service";

@Component({
  selector: 'app-interest-card',
  templateUrl: './interest-card.component.html',
  styleUrls: ['./interest-card.component.scss'],
})
export class InterestCardComponent implements OnInit {
@Input() intData:any;
@Input() intResponse: any;
@Input() thisObj:any;
currData:any;
  constructor(  private navctr: NavController,
                private router: Router,
                public sessionDataProviderService: SessionDataProviderService,
                private wrenchService: WrenchService) {

  }

  ngOnInit() {
    var tt = this.intData;
    this.currData =  this.intData;
 //   debugger;

  }

 async approveStart(intDataR){

     var reqData = {
         member_id: this.thisObj.sessionDataProviderService.member_id,
         uid: this.thisObj.sessionDataProviderService.member_uid,
         sessionid: this.thisObj.sessionDataProviderService.session ,
         proc : 'ACCEPT',
         client_uid: intDataR.client_uid,
         offer_code: intDataR.offer_code,
         offer_uid: intDataR.offer_uid
     };

   //   debugger;
    this.intResponse(  this.thisObj, reqData, "APPROVED");
  }

  async rejectStart(intDataR){

      var reqData = {
          member_id: this.thisObj.sessionDataProviderService.member_id,
          uid: this.thisObj.sessionDataProviderService.member_uid,
          sessionid: this.thisObj.sessionDataProviderService.session ,
          proc : 'REJECT',
          client_uid: intDataR.client_uid,
          offer_code: intDataR.offer_code,
          offer_uid: intDataR.offer_uid
      };

      this.intResponse(this.thisObj ,reqData,"REJECT"); // "REJECT"
  }
}
