ngOnInit()

in frontend/src/app/customer/checkout-page/checkout-page.component.ts [105:158]


  ngOnInit() {
    this.userSubscription = this.user$.subscribe((aUser: User | null) => {
      //handle user state changes here. Note, that user will be null if there is no currently logged in user
      if (aUser) {
        this.userId = aUser.uid;
        this.userEmail = aUser.email;
        if (this.products.length > 0 && this.userId) {
          this.recommend();
        }
        if (aUser.photoURL) {
          this.photoURL = aUser.photoURL;
        }
      }
      else {
        this.photoURL = null;
      }
    });
    this.totalPrice = 0;
    let futureDate: Date = new Date();
    futureDate = new Date(this.today.setDate(this.today.getDate() + 2));
    this.purchaseEndDate = new Date(this.today.setDate(this.today.getDate() + 4));
    this.purchaseStartDate = futureDate;
    this.minDate = futureDate
    if (this.products.length > 0) {
      this.showOrderSuccess = false;
    }
    this.products!.map((product: any) => {
      this.totalPrice += product.price;
    });

    this.responsiveOptions = [
      {
        breakpoint: '1400px',
        numVisible: 4,
        numScroll: 1
      },

      {
        breakpoint: '1199px',
        numVisible: 2,
        numScroll: 1
      },
      {
        breakpoint: '991px',
        numVisible: 1,
        numScroll: 1
      },
      {
        breakpoint: '767px',
        numVisible: 1,
        numScroll: 1
      }
    ];
  }