Skip to content

Commit

Permalink
Revert "Added a warning if within email notification window"
Browse files Browse the repository at this point in the history
This reverts commit 8d1cdd8.
  • Loading branch information
jfkonecn committed Sep 26, 2024
1 parent 8d1cdd8 commit 8ae8022
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ export default function CompanyAdditionalInfo({
start: {
value: additionalInfo?.license?.activation?.split('T')[0],
},
end: {
// max date
value: new Date(8640000000000000)
.toISOString()
.split('T')[0],
},
},
}}
value={additionalInfo?.license?.termination?.date?.split('T')[0]}
Expand Down
50 changes: 4 additions & 46 deletions src/main/webapp/app/pages/companyPage/CompanyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export default class CompanyPage extends React.Component<ICompanyPage> {

@observable showModal = false;
@observable confirmLicenseChangeModalText = '';
@observable confirmTerminationNotificationChangeText = '';
@observable formValues: any;

@observable company: CompanyDTO;
Expand Down Expand Up @@ -297,50 +296,16 @@ export default class CompanyPage extends React.Component<ICompanyPage> {
@action.bound
onValidFormSubmit(event: any, value: any) {
this.formValues = value;
const termination = this.company.additionalInfo?.license?.termination;
this.confirmTerminationNotificationChangeText = '';
let terminationDate: Date | undefined = undefined;
let shouldWarnAboutTerminationEmail = false;
if (
this.selectedLicenseStatus !== LicenseStatus.TRIAL &&
termination !== undefined &&
termination.date !== undefined &&
termination.notificationDays !== undefined &&
termination.notificationDays !== null
) {
const notificationDays = +termination.notificationDays;
terminationDate = new Date(termination.date);
if (!isNaN(terminationDate.getTime())) {
const today = new Date();
today.setUTCHours(0, 0, 0, 0);
const future = new Date();
future.setDate(today.getDate() + notificationDays);
if (future >= terminationDate && terminationDate >= today) {
this.confirmTerminationNotificationChangeText = `The termination date is within the notification window of ${notificationDays} days.
An email will be sent to the OncoKB admins, notifying them of the upcoming company license expiration.
To prevent this email from being sent, either adjust the termination date or modify the notification days.`;
shouldWarnAboutTerminationEmail = true;
}
}
}

// Show warnings when license status is being changed and there are company users
let shouldWarnAboutLicenseStatus = false;
if (
this.company.licenseStatus !== this.selectedLicenseStatus &&
this.companyUsers.length > 0
) {
this.showModal = true;
this.confirmLicenseChangeModalText =
LICENSE_STATUS_UPDATE_MESSAGES[this.company.licenseStatus][
this.selectedLicenseStatus
];
shouldWarnAboutLicenseStatus = true;
} else {
this.confirmLicenseChangeModalText = '';
}

if (shouldWarnAboutLicenseStatus || shouldWarnAboutTerminationEmail) {
this.showModal = true;
this.simpleConfirmModalType = SimpleConfirmModalType.UPDATE_COMPANY;
} else {
this.onConfirmUpdateCompany();
Expand Down Expand Up @@ -440,16 +405,9 @@ export default class CompanyPage extends React.Component<ICompanyPage> {
</span>
?
</div>
{this.confirmLicenseChangeModalText && (
<Alert variant={'warning'} style={{ marginTop: '20px' }}>
Warning: {this.confirmLicenseChangeModalText}
</Alert>
)}
{this.confirmTerminationNotificationChangeText && (
<Alert variant={'warning'} style={{ marginTop: '20px' }}>
Warning: {this.confirmTerminationNotificationChangeText}
</Alert>
)}
<Alert variant={'warning'} style={{ marginTop: '20px' }}>
Warning: {this.confirmLicenseChangeModalText}
</Alert>
</>
);
} else {
Expand Down

0 comments on commit 8ae8022

Please sign in to comment.