RED-7858: Remove Email Report button in License Information screen

This commit is contained in:
Adina Țeudan 2023-11-01 01:36:07 +02:00 committed by Dan Percic
parent db294fc909
commit 9e6c466c4b
2 changed files with 1 additions and 33 deletions

View File

@ -1,6 +1,5 @@
<iqser-page-header
(closeAction)="routerHistoryService.navigateToLastDossiersScreen()"
[buttonConfigs]="buttonConfigs"
[pageLabel]="'license-information' | translate"
[showCloseButton]="currentUser.isUser && permissionsService.has$(roles.dossiers.read) | async"
></iqser-page-header>

View File

@ -1,9 +1,6 @@
import { Component } from '@angular/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { List } from '@common-ui/utils';
import { ButtonConfig, getConfig, IconButtonTypes, IqserPermissionsService } from '@iqser/common-ui';
import { getConfig, IqserPermissionsService } from '@iqser/common-ui';
import { getCurrentUser } from '@iqser/common-ui/lib/users';
import { TranslateService } from '@ngx-translate/core';
import type { AppConfig, User } from '@red/domain';
import { LicenseService } from '@services/license.service';
import { RouterHistoryService } from '@services/router-history.service';
@ -18,38 +15,10 @@ export class LicenseScreenComponent {
protected readonly roles = Roles;
protected readonly currentUser = getCurrentUser<User>();
protected readonly currentYear = new Date().getFullYear();
protected readonly buttonConfigs: List<ButtonConfig> = [
{
label: _('license-info-screen.email-report'),
action: (): void => this.sendMail(),
type: IconButtonTypes.primary,
helpModeKey: 'license_information',
hide: !this.permissionsService.has(Roles.license.readReport),
},
];
constructor(
readonly licenseService: LicenseService,
readonly permissionsService: IqserPermissionsService,
readonly routerHistoryService: RouterHistoryService,
private readonly _translateService: TranslateService,
) {}
sendMail(): void {
const licenseCustomer = this.licenseService.selectedLicense.licensedTo;
const subject = this._translateService.instant('license-info-screen.email.title', {
licenseCustomer,
}) as string;
const lineBreak = '%0D%0A';
const body = [
this._translateService.instant('license-info-screen.email.body.analyzed', {
pages: this.licenseService.selectedLicenseReport.numberOfAnalyzedPages,
}),
this._translateService.instant('license-info-screen.email.body.licensed', {
pages: this.licenseService.totalLicensedNumberOfPages,
}),
].join(lineBreak);
const mail = this.licenseService.selectedLicense.licensedToEmail;
window.location.href = `mailto:${mail}?subject=${subject}&body=${body}`;
}
}