import { Component, OnInit } from '@angular/core'; import { ITaxSettings } from '../../core/tax/ITaxSettings'; import { CookieService } from 'ngx-cookie-service'; import { TaxService } from '../../services/tax/tax.service'; import { IShippingProfileInfo } from '../../core/shipping/IShippingProfileInfo'; import { GeneralService } from '../../services/general/general.service'; import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-taxed', templateUrl: './taxed.component.html', styleUrls: ['./taxed.component.scss'] }) export class TaxedComponent implements OnInit { taxSettings : ITaxSettings; companyId:number; shippingProfile: IShippingProfileInfo[] = []; showEdit : boolean =false; editId:number=0; cols:any; constructor(private cookieService:CookieService, private taxService:TaxService, private generalService:GeneralService) { } ngOnInit() { this.companyId = +this.cookieService.get('CompanyId') // initialize this.taxSettings = {Id:0,AllPricesWithTax:false,TaxesOnShippingRates:false,VatTaxesOnDigitalProducts:false} // get tax settings this.getTaxSettings(); // get shipping profiles this.getShippingProfiles(); } // get tax settings getTaxSettings(){ this.taxService.GetTaxSettings(this.companyId).subscribe(data=>{ this.taxSettings = data; }) } // set tax settings setTaxSettings(){ this.taxService.SetTaxSettings(this.companyId,this.taxSettings).subscribe(data=>{ }) } // change setting checkboxes changeTaxSettings(){ this.setTaxSettings(); } // get shipping profiles getShippingProfiles() { this.generalService.GetShippingProfileList(this.companyId, 0, "ALL").subscribe(data => { this.shippingProfile = data; }) } // showEditPopup(id:number){ this.editId = id this.showEdit = true; } }