import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';



@IonicPage()
@Component({
  selector: 'page-bodysection',
  templateUrl: 'bodysection.html',
})
export class BodysectionPage {

	body_parts=[];
	service_id:any;
	service:any;
	
	constructor(public navCtrl: NavController, public navParams: NavParams) {
		this.service_id = this.navParams.get('service_id');
		this.service = this.navParams.get('service');
		console.log(this.service);
	}

	ionViewDidLoad() {
		console.log('ionViewDidLoad BodysectionPage');
	}
	
	back(){
		this.navCtrl.pop();
	}
	
	damagephoto(){
		if(this.body_parts.length>0)
			this.navCtrl.push('DamagephotoPage',{'body_parts':this.body_parts,'service_id':this.service_id,'service' : this.service});
	}
	
	body_part(body_parts,evt){
		 if(evt.target.classList.contains('fm_body_part')){
		console.log(evt)
		
		if(this.body_parts.indexOf(body_parts) != -1)
			{  
					evt.target.classList.remove('selected_part'); 
			
				
				this.body_parts.splice(this.body_parts.indexOf(body_parts), 1);
			}
			else{
				 evt.target.classList.add('selected_part'); 
				this.body_parts.push(body_parts);
			}
		console.log(this.body_parts)
		 }
	}
	skip(){
		
			this.navCtrl.push('DamagephotoPage',{'body_parts':'','service_id':this.service_id,'service' : this.service});
	}

}
