Skip to content

Commit

Permalink
Merge pull request #7107 from Walkover-Web-Solution/gst-composition-i…
Browse files Browse the repository at this point in the history
…ssue-prod

fix: GIDK-#218ckk | Prateek | PROD | GST composition not visible
  • Loading branch information
the-prateek-mishra authored Jan 20, 2021
2 parents a30bc96 + c81ee66 commit cbd8dd9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,6 @@ export class ContentFilterComponent implements OnInit, OnChanges, OnDestroy {

this.sessionId$ = this.store.pipe(select(p => p.session.user.session.id), takeUntil(this.destroyed$));
this.companyUniqueName$ = this.store.pipe(select(p => p.session.companyUniqueName), takeUntil(this.destroyed$));

this.companyUniqueName$.pipe(take(1)).subscribe(activeCompanyUniqueName => {
if (companies) {
companies.forEach(company => {
if (company.uniqueName === activeCompanyUniqueName) {
if (company.country === "India") {
this.showGstComposition = true;
}
}
});
}
});
}

/**
Expand All @@ -89,6 +77,13 @@ export class ContentFilterComponent implements OnInit, OnChanges, OnDestroy {
* @memberof ContentFilterComponent
*/
public ngOnInit(): void {
this.store.pipe(select(state => state.session.activeCompany), take(1)).subscribe(activeCompany => {
if (activeCompany?.countryV2?.countryName) {
this.showGstComposition = activeCompany.countryV2.countryName === 'India';
} else {
this.showGstComposition = false;
}
});
this.store.pipe(select(appState => appState.company), takeUntil(this.destroyed$)).subscribe((companyData: CurrentCompanyState) => {
if (companyData) {
this.isTcsTdsApplicable = companyData.isTcsTdsApplicable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,8 @@ export class OutTemplateComponent implements OnInit, OnDestroy, OnChanges {
companies = ss.companies;
this.companyUniqueName = ss.companyUniqueName;
});

this.companyUniqueName$ = this.store.pipe(select(state => state.session.companyUniqueName), takeUntil(this.destroyed$));

this.companyUniqueName$.pipe(take(1)).subscribe(activeCompanyUniqueName => {
if (companies) {
companies.forEach(company => {
if (company.uniqueName === activeCompanyUniqueName) {
if (company.country === "India") {
this.showGstComposition = true;
}
}
});
}
});
this.companyUniqueName$ = this.store.pipe(select(state => state.session.companyUniqueName), takeUntil(this.destroyed$));

this.store.pipe(select(s => s.invoiceTemplate), take(1)).subscribe(ss => {
defaultTemplate = ss.defaultTemplate;
Expand All @@ -72,7 +60,13 @@ export class OutTemplateComponent implements OnInit, OnDestroy, OnChanges {
}

public ngOnInit() {

this.store.pipe(select(state => state.session.activeCompany), take(1)).subscribe(activeCompany => {
if (activeCompany?.countryV2?.countryName) {
this.showGstComposition = activeCompany.countryV2.countryName === 'India';
} else {
this.showGstComposition = false;
}
});
this._activatedRoute.params.pipe(takeUntil(this.destroyed$)).subscribe(a => {
if (!a) {
return;
Expand Down

0 comments on commit cbd8dd9

Please sign in to comment.