diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss index 7ad814b7ed26..7efb7c681fa9 100755 --- a/src/app/home/home.component.scss +++ b/src/app/home/home.component.scss @@ -3351,6 +3351,7 @@ img { align-items: center; justify-content: center; gap: 6px; + padding-bottom: 18px; } .hqb-footer-link { diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 3a9ded135823..294197c7bfa0 100755 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -242,7 +242,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { tokens_limit = 0; project_limits: any; - + quotes: any; conversationsRunnedOut: boolean = false; emailsRunnedOut: boolean = false; tokensRunnedOut: boolean = false; @@ -471,6 +471,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { getQuotes() { this.quotesService.getAllQuotes(this.projectId).subscribe((resp: any) => { this.logger.log("[HOME] getAllQuotes response: ", resp) + this.quotes = resp this.logger.log("[HOME] project_limits: ", this.project_limits) this.logger.log("[HOME] resp.quotes: ", resp.quotes) @@ -510,35 +511,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { this.logger.log('[HOME] used tokens', resp.quotes.tokens.quote) this.logger.log('[HOME] tokens_limit', this.tokens_limit) - if (resp.quotes.requests.quote >= this.requests_limit) { - this.conversationsRunnedOut = true; - this.logger.log('[HOME] conversationsRunnedOut', this.conversationsRunnedOut) - // this.quotesService.hasReachedQuotasLimitInHome(true) - } else { - this.conversationsRunnedOut = false; - // this.quotesService.hasReachedQuotasLimitInHome(false) - this.logger.log('[HOME] conversationsRunnedOut', this.conversationsRunnedOut) - } - - if (resp.quotes.email.quote >= this.email_limit) { - this.emailsRunnedOut = true; - this.logger.log('[HOME] emailsRunnedOut', this.emailsRunnedOut) - // this.quotesService.hasReachedQuotasLimitInHome(true) - } else { - this.emailsRunnedOut = false; - // this.quotesService.hasReachedQuotasLimitInHome(false) - this.logger.log('[HOME] emailsRunnedOut', this.emailsRunnedOut) - } - - if (resp.quotes.tokens.quote >= this.tokens_limit) { - this.tokensRunnedOut = true; - this.logger.log('[HOME] tokensRunnedOut', this.tokensRunnedOut) - // this.quotesService.hasReachedQuotasLimitInHome(true) - } else { - this.tokensRunnedOut = false; - // this.quotesService.hasReachedQuotasLimitInHome(false) - this.logger.log('[HOME] tokensRunnedOut', this.tokensRunnedOut) - } + this.requests_perc = Math.min(100, Math.floor((resp.quotes.requests.quote / this.requests_limit) * 100)); this.messages_perc = Math.min(100, Math.floor((resp.quotes.messages.quote / this.messages_limit) * 100)); @@ -554,15 +527,50 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { }, (error) => { this.logger.error("[HOME] get all quotes error: ", error) this.displayQuotaSkeleton = false + + }, () => { this.logger.log("[HOME] get all quotes *COMPLETE*"); setTimeout(() => { this.displayQuotaSkeleton = false + this.getRunnedOutQuotes( this.quotes) }, 1000); }) } + getRunnedOutQuotes(resp) { + if (resp.quotes.requests.quote >= this.requests_limit) { + this.conversationsRunnedOut = true; + this.logger.log('[HOME] conversationsRunnedOut', this.conversationsRunnedOut) + // this.quotesService.hasReachedQuotasLimitInHome(true) + } else { + this.conversationsRunnedOut = false; + // this.quotesService.hasReachedQuotasLimitInHome(false) + this.logger.log('[HOME] conversationsRunnedOut', this.conversationsRunnedOut) + } + + if (resp.quotes.email.quote >= this.email_limit) { + this.emailsRunnedOut = true; + this.logger.log('[HOME] emailsRunnedOut', this.emailsRunnedOut) + // this.quotesService.hasReachedQuotasLimitInHome(true) + } else { + this.emailsRunnedOut = false; + // this.quotesService.hasReachedQuotasLimitInHome(false) + this.logger.log('[HOME] emailsRunnedOut', this.emailsRunnedOut) + } + + if (resp.quotes.tokens.quote >= this.tokens_limit) { + this.tokensRunnedOut = true; + this.logger.log('[HOME] tokensRunnedOut', this.tokensRunnedOut) + // this.quotesService.hasReachedQuotasLimitInHome(true) + } else { + this.tokensRunnedOut = false; + // this.quotesService.hasReachedQuotasLimitInHome(false) + this.logger.log('[HOME] tokensRunnedOut', this.tokensRunnedOut) + } + } + contacUsViaEmail() { window.open(`mailto:${this.salesEmail}?subject=Resource increase request for project ${this.projectName} (${this.projectId}) &body=Dear Sales team, some of my monthly resource quota reached his limit for this month, I need some help!`); }