Vous êtes sur la page 1sur 7

import { Component, OnInit } from '@angular/core';

import { Router, NavigationExtras } from '@angular/router';


import { ToastController, LoadingController,AlertController } from
'@ionic/angular';
import { HttpClient,HttpHeaders } from '@angular/common/http';
import { DataService } from '../../services/data.service';
import { Storage } from '@ionic/storage';
import { UserService } from '../../Modal/user.service';
@Component({
selector: 'app-employer-livejob',
templateUrl: './employer-livejob.page.html',
styleUrls: ['./employer-livejob.page.scss'],
})
export class EmployerLivejobPage implements OnInit {
access_token:any;
result:any;
name:any;
profile:any;

position:any;
data:UserService;
postjobsArray:any[];
constructor(private router:Router,private toastController:ToastController,public
httpClient: HttpClient, private dataService: DataService,private
alertCtrl:AlertController,private storage:Storage,private
loadingController:LoadingController) {
storage.get('access_token').then((val) => {
console.log('Your accessToken is', val);
this.access_token = val;
this.data = new UserService();
this.get_profile(this.access_token);
this.getAllJob(this.access_token);
});
}

ngOnInit() { }

back()
{
this.router.navigate(['post-job']);
}

public getAllJob(access_token){
console.log('getjobslist accesss /////// '+access_token);
this.dataService.getAlljob(access_token).subscribe((response) => {
console.log("getAlljobs Response",response);
this.result = response;
this.postjobsArray=[];

if(this.result.code == 200){
console.log("Jobs Data ",this.result.data);
var jobArray = this.result.data;
if(jobArray.length>0){
for(let i=0;i<jobArray.length; i++)
{
this.data = new UserService();
this.data.job_id=jobArray[i].job_id;
this.data.user_id=jobArray[i].user_id;
this.data.deadline=jobArray[i].deadline;
this.data.deadline=jobArray[i].deadline;
this.data.position=jobArray[i].position;
this.data.duration=jobArray[i].duration;
this.data.salary=jobArray[i].salary;
this.data.job_type = jobArray[i].job_type;
this.postjobsArray.push(this.data);
console.log("postjobsArray size ",this.postjobsArray.length);

}
}
else{
console.log("postjobsArray is empty");
}

}else if(this.result.code == 0){


console.log("Error",this.result.message);
this.presentToast(this.result.message);

}else{
console.log("Error",this.result.message);
this.presentToast(this.result.message);
}

});
}
async presentToast(messageStr) {
const toast = await this.toastController.create({
message: messageStr,
color:'dark',
duration: 2000
});
toast.present();
}

editmyjobs(job_id:number,access_token:any){
console.log("Edit My Jobs",job_id);
console.log("Edit My Jobs",access_token);
this.data.job_id = job_id;
this.data.job_type = 'edit';
this.data.access_token=this.access_token;
let navigationExtras: NavigationExtras = {
queryParams: {
special: JSON.stringify(this.data)
}
};
this.router.navigate(['post-job'], navigationExtras);
}

get_profile(access_token){
console.log('getProfile '+access_token);
this.dataService.getprofile_web(access_token).subscribe((response) => {
console.log("getProfile Response",response);
this.result = response;
if(this.result.code == 200){
console.log("getProfile Response Data ",this.result.data);
var josObj = this.result.data;
this.name = josObj.name;
this.profile=josObj.profile;
this.position=josObj.position;

}
else
{
this.dataService.hideLoader();

this.dataService.toast(this.result.message);

},err => {
this.dataService.hideLoader();

this.dataService.toast(this.dataService.Webservice_error);

});

}
}
http://project.rayaztech.com/matchtie/webservices/updateProfile/1
Pass User Access token)

Param:
-----------
{
"user_type": "Employer", // or Employee
"name":"TestUser",
"mobile":"8888888888",
"email": "test@gmail.com",
"address" : "Kk nagar, Madurai",
"password" : "test123",
"expertise" : "test123!@#",

"degree" : "B.E",
"school" : "St.Joseph",
"school_period_from" : "",

http://project.rayaztech.com/matchtie/webservices/updateProfile/1

(Pass User Access token)

Param:
-----------
{
"user_type": "Employer", // or Employee
"name":"TestUser",
"mobile":"8888888888",
"email": "test@gmail.com",
"address" : "Kk nagar, Madurai",
"password" : "test123",
"expertise" : "test123!@#",

"degree" : "B.E",
"school" : "St.Joseph",
"school_period_from" : "",
"school_period_to" : "",
"degree_period_from" : "",
"degree_period_to" : "",

"position1" : "Developer",
"company1" : "Rayaz",
"experience_period_from1":"",
"experience_period_to1":"",

"position2" : "Developer",
"company2" : "Rayaz",
"experience_period_from2":"",
"experience_period_to2":"",

"language1": "",
"level1":"",
"reference1":"",

"language2": "",
"level2":"",
"reference2":"",

"license": "",
"software":"",
"dob":"",
"website": "",
"linked_in":"",
"instagram":"",
"facebook": "",
"summary":"",
"range":"",
"profile":"",
"responsibilities": "",
"experience":"",
"industry":"",
"salary":"",
}
http://project.rayaztech.com/matchtie/webservices/apply_job/1

(Pass User Access token & Job id)

Param:
-----------
{
"name": "Testuser",
"email":"test@gmail.com",
"gender":"Female",
"age": "25",
"address" : "Kk nagar, Madurai",
"qualification" : "B.E",
"experience" : "1 year",
"current_salary" : "15000",
"resume" : "",
}
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ToastController, LoadingController,AlertController } from
'@ionic/angular';
import { HttpClient,HttpHeaders } from '@angular/common/http';
import { DataService } from '../../services/data.service';
import { Storage } from '@ionic/storage';
import { UserService } from '../../Modal/user.service';
@Component({
selector: 'app-post-job',
templateUrl: './post-job.page.html',
styleUrls: ['./post-job.page.scss'],
})
export class PostJobPage implements OnInit {

name:String;
email:String;
gender:String;
age:String;
address:String;
qualification:String;
experience:String;
result:any;
data:UserService;
access_token:any;
job_id:number =0;
constructor(private route: ActivatedRoute,private router:Router,private
toastController:ToastController,public httpClient: HttpClient, private dataService:
DataService,private alertCtrl:AlertController,private storage:Storage,private
loadingController:LoadingController) {
this.data = new UserService();
storage.get('access_token').then((val) => {
console.log('Your accessToken is', val);
this.access_token = val;

});

ngOnInit() {
}
ApplyJobs(){
console.log("Apply Job Button Click ");
if(this.name ==undefined){
console.log("name is empty "+this.name);
this.presentToast("name is empty");
}else if(this.email == undefined){
this.presentToast("Email is empty");
}else if(this.gender==undefined){
this.presentToast("Gender is Empty");
}else if(this.age== undefined){
this.presentToast("Age is Empty");
}else if(this.address == undefined){
this.presentToast("Address is empty");
}else if(this.qualification == undefined){
this.presentToast("Qualification is empty");
}else if(this.experience == undefined){
this.presentToast("Experience is empty");
}else if(this.current_salary == undefined){
this.presentToast("Current Salary is empty");
}else if(this.resume == undefined){
this.presentToast("resume is empty");
}else{
this.data.name=this.name;
this.data.email = this.email;
this.data.gender = this.gender;
this.data.age = this.age;
this.data.address = this.address;
this.data.qualification = this.qualification;
this.data.experience= this.experience;
this.data.current_salary = this.current_salary;
this.data.resume = this.resume;
this.data.job_id=this.job_id;
console.log("Apply Jobs Params ",JSON.stringify(this.name));
this.dataService.showLoader(this.dataService.postJobs_loading);

this.dataService.ApplyJobs(this.job_id,JSON.stringify(this.data),this.access_token)
.subscribe((response) => {
console.log("Apply Jobs Response",response);
this.result = response;
if(this.result.code == 200){

this.dataService.hideLoader();
this.dataService.toast(this.dataService.postjob_success);
this.router.navigate(['employer-livejob']);
}
else
{
this.dataService.hideLoader();
this.dataService.toast(this.result.message);
}
},err => {
this.dataService.hideLoader();

this.dataService.toast(this.dataService.Webservice_error);
});

}
}
}
async presentToast(messageStr) {
const toast = await this.toastController.create({
message: messageStr,
color:'dark',
duration: 2000
});
toast.present();
}

get_profile(access_token){
console.log('getProfile '+access_token);
this.dataService.getprofile_web(access_token).subscribe((response) => {
console.log("getProfile Response",response);
this.result = response;
if(this.result.code == 200){
console.log("getProfile Response Data ",this.result.data);
var josObj = this.result.data;
this.name = josObj.name;
this.profile=josObj.profile;
this.position=josObj.position;

}
else
{
this.dataService.hideLoader();

this.dataService.toast(this.result.message);

},err => {
this.dataService.hideLoader();

this.dataService.toast(this.dataService.Webservice_error);

});

}
}

Vous aimerez peut-être aussi