-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Create rejection modal * fix lint and tests * fix placeholders and lint * remove title * integrate api * check undefined title and body * fix trailing white spaces * fix whitespace * change error message * re-add account request table on home page * replace support email
- Loading branch information
1 parent
50c87bc
commit a36ecf7
Showing
10 changed files
with
214 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...unt-requests-table/admin-reject-with-reason-modal/admin-reject-with-reason-modal-model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface RejectWithReasonModalComponentResult { | ||
rejectionReasonTitle: string; | ||
rejectionReasonBody: string; | ||
} |
26 changes: 26 additions & 0 deletions
26
...quests-table/admin-reject-with-reason-modal/admin-reject-with-reason-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<div class="modal-header bg-warning"> | ||
<h5 class="modal-title"> | ||
<div>Reject Account Request for {{ accountRequestName }} With Reason</div> | ||
</h5> | ||
<button type="button" class="btn-close" (click)="activeModal.dismiss()"></button> | ||
</div> | ||
<div id="reject-account-request-modal" class="modal-body"> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<div> | ||
<label><b>Rejection Message Title:</b></label> | ||
</div> | ||
<div class="form-group"> | ||
<input id="rejection-reason-title" type="text" class="form-control" rows="5" value="{{ rejectionReasonTitle }}" (input)="rejectionReasonTitle = $event.target.value"> | ||
</div> | ||
<div> | ||
<label><b>Rejection Message Body:</b></label> | ||
</div> | ||
<tm-rich-text-editor id="rejection-reason-body" [richText]="rejectionReasonBody" (richTextChange)="onRejectionReasonBodyChange($event)"></tm-rich-text-editor> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-light" (click)="activeModal.dismiss()">Cancel</button> | ||
<button id="btn-confirm-reject-request" type="button" class="btn btn-warning" (click)="reject()"> | ||
Reject | ||
</button> | ||
</div> |
Empty file.
76 changes: 76 additions & 0 deletions
76
...requests-table/admin-reject-with-reason-modal/admin-reject-with-reason-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { RejectWithReasonModalComponentResult } from './admin-reject-with-reason-modal-model'; | ||
import { environment } from '../../../../environments/environment'; | ||
import { StatusMessageService } from '../../../../services/status-message.service'; | ||
|
||
/** | ||
* Modal to select reject account requests with reason. | ||
*/ | ||
@Component({ | ||
selector: 'tm-reject-with-reason-modal', | ||
templateUrl: './admin-reject-with-reason-modal.component.html', | ||
styleUrls: ['./admin-reject-with-reason-modal.component.scss'], | ||
}) | ||
|
||
export class RejectWithReasonModalComponent implements OnInit { | ||
|
||
@Input() | ||
accountRequestName: string = ''; | ||
|
||
@Input() | ||
accountRequestEmail: string = ''; | ||
|
||
rejectionReasonBody: string = '<p>Hi, {accountRequestName} </p>\n\n' | ||
+ '<p>Thanks for your interest in using TEAMMATES. ' | ||
+ 'We are unable to create a TEAMMATES instructor account for you.</p>' | ||
+ '<p><strong>Reason:</strong> The email address you provided is not an 'official' ' | ||
+ 'email address provided by your institution.<br />' | ||
+ '<strong>Remedy:</strong> Please re-submit an account request with your 'official' ' | ||
+ 'institution email address.</p>\n\n' | ||
+ '<p><strong>Reason:</strong> The email address you have provided does seems like it belongs to a student ' | ||
+ '(i.e., not a staff member) of your institution.<br />' | ||
+ '<strong>Remedy:</strong> If you are a student but you still need an instructor account, ' | ||
+ 'please send your justification to {supportEmail}</p>\n\n' | ||
+ '<p><strong>Reason:</strong> You already have an account for this email address and this institution.<br />' | ||
+ '<strong>Remedy:</strong> You can login to TEAMMATES using your Google account {existingEmail} </p>\n\n' | ||
+ '<p>If you need further clarification or would like to appeal this decision, please ' | ||
+ 'feel free to contact us at {supportEmail}</p>' | ||
+ '<p>Regards,<br />TEAMMATES Team.</p>'; | ||
rejectionReasonTitle: string = 'We are Unable to Create an Account for you'; | ||
|
||
constructor(public activeModal: NgbActiveModal, public statusMessageService: StatusMessageService) {} | ||
|
||
ngOnInit(): void { | ||
this.rejectionReasonBody = this.rejectionReasonBody.replace('{accountRequestName}', this.accountRequestName); | ||
this.rejectionReasonBody = this.rejectionReasonBody.replace('{existingEmail}', this.accountRequestEmail); | ||
this.rejectionReasonBody = this.rejectionReasonBody.replaceAll('{supportEmail}', environment.supportEmail); | ||
} | ||
|
||
onRejectionReasonBodyChange(updatedText: string): void { | ||
this.rejectionReasonBody = updatedText; | ||
} | ||
|
||
/** | ||
* Fires the reject event. | ||
*/ | ||
reject(): void { | ||
|
||
if (!this.rejectionReasonBody) { | ||
this.statusMessageService.showErrorToast('Please provide an email body for the rejection email.'); | ||
return; | ||
} | ||
|
||
if (!this.rejectionReasonTitle) { | ||
this.statusMessageService.showErrorToast('Please provide a title for the rejection email.'); | ||
return; | ||
} | ||
|
||
const result: RejectWithReasonModalComponentResult = { | ||
rejectionReasonTitle: this.rejectionReasonTitle, | ||
rejectionReasonBody: this.rejectionReasonBody, | ||
}; | ||
|
||
this.activeModal.close(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters