2018-07-02 23:09:53 +02:00
|
|
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
2019-03-21 18:11:40 +01:00
|
|
|
import { ActivatedRoute } from "@angular/router";
|
2018-07-02 23:09:53 +02:00
|
|
|
|
2021-10-15 00:59:43 +02:00
|
|
|
import { first } from "rxjs/operators";
|
|
|
|
|
2021-06-07 20:13:58 +02:00
|
|
|
import { PlanType } from "jslib-common/enums/planType";
|
|
|
|
import { ProductType } from "jslib-common/enums/productType";
|
2021-01-15 20:46:25 +01:00
|
|
|
|
2019-03-21 18:11:40 +01:00
|
|
|
import { OrganizationPlansComponent } from "./organization-plans.component";
|
2018-07-02 23:09:53 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "app-create-organization",
|
|
|
|
templateUrl: "create-organization.component.html",
|
|
|
|
})
|
2018-07-20 16:29:40 +02:00
|
|
|
export class CreateOrganizationComponent implements OnInit {
|
2020-08-17 16:04:38 +02:00
|
|
|
@ViewChild(OrganizationPlansComponent, { static: true })
|
|
|
|
orgPlansComponent: OrganizationPlansComponent;
|
2018-07-02 23:09:53 +02:00
|
|
|
|
2019-03-21 18:11:40 +01:00
|
|
|
constructor(private route: ActivatedRoute) {}
|
2018-07-02 23:09:53 +02:00
|
|
|
|
2018-07-20 16:29:40 +02:00
|
|
|
ngOnInit() {
|
2021-10-15 00:59:43 +02:00
|
|
|
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
|
2021-01-15 20:46:25 +01:00
|
|
|
if (qParams.plan === "families") {
|
|
|
|
this.orgPlansComponent.plan = PlanType.FamiliesAnnually;
|
|
|
|
this.orgPlansComponent.product = ProductType.Families;
|
|
|
|
} else if (qParams.plan === "teams") {
|
|
|
|
this.orgPlansComponent.plan = PlanType.TeamsAnnually;
|
|
|
|
this.orgPlansComponent.product = ProductType.Teams;
|
|
|
|
} else if (qParams.plan === "enterprise") {
|
|
|
|
this.orgPlansComponent.plan = PlanType.EnterpriseAnnually;
|
|
|
|
this.orgPlansComponent.product = ProductType.Enterprise;
|
2018-07-20 16:29:40 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2018-07-02 23:09:53 +02:00
|
|
|
}
|