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

@Component({
  selector: 'app-pendingoffers',
  templateUrl: './pendingoffers.page.html',
  styleUrls: ['./pendingoffers.page.scss'],
})
export class PendingoffersPage implements OnInit {

  tabs = 'about';
  session_image_server:string='';
  curr_session:string="";
  constructor(
      private navctr: NavController,
      private router: Router,
      public sessionDataProviderService: SessionDataProviderService,
      private wrenchService: WrenchService
  ) { }

  ngOnInit() {
    this.getPendingOffersData();
  }

  onBack() {
    this.navctr.back();
  }


  usrData: {
    action:number, member_id: number, uid: string, sessionid: string, limit:20, page:1,offset: 0
  };

  jobManagerOffersTotalData:any;
  jobManagerOffersData: [];
  getPendingOffersData(){
    this.curr_session =  this.sessionDataProviderService.session;
    this.usrData = {action:11309,
      member_id: this.sessionDataProviderService.member_id,
      uid: this.sessionDataProviderService.member_uid,
      sessionid: this.sessionDataProviderService.session ,
      limit:20, page:1,offset: 0}

    this.wrenchService.jobmanageroffers(this.usrData).subscribe(
        jobManagerOffersTotalData => {
          this.jobManagerOffersTotalData = jobManagerOffersTotalData;
          console.log("jobManagerOffersTotalData  RETURN->", this.jobManagerOffersTotalData);
          this.jobManagerOffersData = this.jobManagerOffersTotalData.result_list;
          this.session_image_server = this.jobManagerOffersTotalData.session_image_server;

          // debugger;
          console.log("jobManagerOffersData RETURN DATA->", this.jobManagerOffersTotalData);
        }
    );

  }

}
