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

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

  constructor(
      private navctr: NavController,
      private router: Router,
      public sessionDataProviderService: SessionDataProviderService,
      private wrenchService: WrenchService
  ) {


  }

  ngOnInit() {
    this.getNotificationData();
  }

  onBack() {
    this.navctr.back();
  }
  usrData: {
    action:11205, member_id: number, uid: string, sessionid: string, limit:20, page:1
  };
  notificationTotalData:any;
  notificationData: [];
  getNotificationData(){
    this.usrData = {action:11205,
      member_id: this.sessionDataProviderService.member_id,
      uid: this.sessionDataProviderService.member_uid,
      sessionid: this.sessionDataProviderService.session ,
      limit:20, page:1}

    this.wrenchService.getMyNotifications(this.usrData).subscribe(
        notificationTotalData => {
          this.notificationTotalData = notificationTotalData;
          console.log("NOTIFICATION  RETURN->", this.notificationTotalData);
          this.notificationData = this.notificationTotalData.result_list;
          // debugger;
          console.log("JOBS RETURN DATA->", this.notificationData);
        }
    );

  }

}
