-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert revert of templated mail refactoring
- Loading branch information
Showing
15 changed files
with
426 additions
and
171 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
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
194 changes: 194 additions & 0 deletions
194
.../email/project-csv-templated-email-modal/project-csv-templated-email-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,194 @@ | ||
<div class="modal-header"> | ||
<h4 class="modal-title" data-test-id="confirmation_modal_title">Sent Mail to specific projects</h4> | ||
<button | ||
type="button" | ||
class="btn-close" | ||
style="cursor: pointer" | ||
(click)="bsModalRef.hide()" | ||
aria-label="Close" | ||
></button> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
@if (!csvFile || csvMailTemplate?.errors?.length > 0) { | ||
<div class="valid-example"> | ||
<p class="valid-example-heading"> | ||
<strong>Valid Example:</strong> | ||
</p> | ||
<pre class="valid-example-content">{{ validCSVExample }}</pre> | ||
<div class="templates-container"> | ||
<p>The following template keys would be provided by this CSV file:</p> | ||
<div class="templates-list"> | ||
<span>{VM}</span><br /> | ||
<span>{LOCATION}</span> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
</div> | ||
|
||
<div class="modal-body"> | ||
@if (csvMailTemplate?.errors?.length > 0) { | ||
<div class="alert alert-danger"> | ||
<p><strong>Error!</strong> Unable to use the CSV file "{{ csvFile.name }}". The following errors occurred:</p> | ||
|
||
<ul> | ||
<li *ngFor="let err of csvMailTemplate?.errors">{{ err }}</li> | ||
</ul> | ||
</div> | ||
} | ||
@if (csvMailTemplate?.warnings?.length > 0) { | ||
<div class="alert alert-warning"> | ||
<p> | ||
<strong>Warning!</strong> The following issues were found in the CSV file, but sending emails is still possible: | ||
</p> | ||
|
||
<ul> | ||
<li *ngFor="let war of csvMailTemplate?.warnings">{{ war }}</li> | ||
</ul> | ||
</div> | ||
} | ||
|
||
@if (csvMailTemplate?.valid_projects?.length > 0) { | ||
<div class="templates-container"> | ||
<label class="col-md-12 control-label"><strong>Send Mail to:</strong></label> | ||
<ul> | ||
<li *ngFor="let pr of csvMailTemplate?.valid_projects">{{ pr.project_application_shortname }}</li> | ||
</ul> | ||
</div> | ||
} | ||
|
||
<form class="form-horizontal" id="email_form" #f="ngForm"> | ||
@if (csvMailTemplate) { | ||
<div class="form-group row"> | ||
<div class="col-md-auto"> | ||
<div class="form-check"> | ||
<input | ||
class="form-check-input" | ||
type="checkbox" | ||
name="emailAdminsOnly" | ||
[(ngModel)]="emailAdminsOnly" | ||
id="adminOnlyCheckbox" | ||
[disabled]="csvMailTemplate?.errors?.length > 0" | ||
/> | ||
<label class="form-check-label" for="adminOnlyCheckbox"> Group administrators only </label> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
class="form-group row" | ||
[ngClass]="{ | ||
'has-danger': emailSub.invalid && (emailSub.dirty || emailSub.touched), | ||
'has-success': emailSub.valid && (emailSub.dirty || emailSub.touched) | ||
}" | ||
> | ||
<label class="col-md-12 control-label"><strong>Email subject*</strong></label> | ||
<div class="col-md-12"> | ||
<input | ||
required | ||
id="emailSubject" | ||
name="emailSub" | ||
placeholder="Subject" | ||
class="form-control" | ||
type="text" | ||
[(ngModel)]="emailSubject" | ||
[disabled]="csvMailTemplate?.errors?.length > 0" | ||
minlength="1" | ||
#emailSub="ngModel" | ||
[ngClass]="{ | ||
'is-invalid': emailSub.invalid && (emailSub.dirty || emailSub.touched), | ||
'is-valid': emailSub.valid && (emailSub.dirty || emailSub.touched) | ||
}" | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group row"> | ||
<label class="col-md-12 control-label"><strong>Reply to (optional)</strong></label> | ||
<div class="col-md-12"> | ||
<input | ||
id="reply_to" | ||
name="emailReply" | ||
placeholder="" | ||
class="form-control" | ||
type="text" | ||
[(ngModel)]="emailReply" | ||
[disabled]="csvMailTemplate?.errors.length > 0" | ||
#emailRep="ngModel" | ||
pattern="([ ]*)(?!(^[.-].*|[^@]*[.-]@|.*\.{2,}.*)|^.{254}.)([a-zA-Z0-9!#$%&'*+\/=?^_`{|}~.-]+@)(?!-.*|.*-\.)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,15}([ ]*)" | ||
[ngClass]="{ | ||
'is-invalid': emailRep.invalid && (emailRep.dirty || emailRep.touched), | ||
'is-valid': emailRep.valid && (emailRep.dirty || emailRep.touched) | ||
}" | ||
/> | ||
</div> | ||
</div> | ||
<!-- Textarea --> | ||
<div class="form-group row"> | ||
<label class="col-md-12 control-label"><strong>Email text*</strong></label> | ||
<div class="col-md-12"> | ||
<textarea | ||
minlength="1" | ||
required | ||
class="form-control" | ||
id="emailText" | ||
name="emailText" | ||
[(ngModel)]="emailText" | ||
[disabled]="csvMailTemplate?.errors?.length > 0" | ||
type="text" | ||
#emailT="ngModel" | ||
[ngClass]="{ | ||
'is-invalid': emailT.invalid && (emailT.dirty || emailT.touched), | ||
'is-valid': emailT.valid && (emailT.dirty || emailT.touched) | ||
}" | ||
></textarea> | ||
</div> | ||
</div> | ||
} | ||
</form> | ||
@if (csvFile) { | ||
<div class="templates-container"> | ||
<p> | ||
The following keys were provided by the CSV file: <strong>{{ csvFile.name }}</strong> | ||
</p> | ||
<div class="templates-list"> | ||
<span *ngFor="let template of csvMailTemplate?.keys">{{ '{' + template + '}' }} </span> | ||
</div> | ||
</div> | ||
|
||
<div class="templates-container"> | ||
<p>You can use the following keys as variables:</p> | ||
<div class="templates-list"> | ||
<span *ngFor="let template of templates">{{ '{' + template + '}' }} </span> | ||
</div> | ||
</div> | ||
|
||
<div class="alert alert-info"> | ||
Please consider: In case any dates are part of the sent E-Mails, they will be formatted in the german | ||
<strong>TT.MM.YYYY</strong>-format. | ||
</div> | ||
} | ||
|
||
<div class="modal-footer"> | ||
<input type="file" accept=".csv" style="display: none" #fileInput (change)="onCsvFileSelected($event)" /> | ||
<button type="button" class="btn btn-secondary col-md-4" (click)="fileInput.click()">Choose CSV File</button> | ||
@if (csvMailTemplate && csvFile) { | ||
<button | ||
class="btn btn-success col-md-4" | ||
[disabled]="f.invalid || csvMailTemplate?.errors?.length > 0" | ||
data-test-id="confirm_confirmation_modal_btn" | ||
(click)="sentProjectsTemplatedMail(); bsModalRef.hide()" | ||
> | ||
Send Mail | ||
</button> | ||
} | ||
<button | ||
class="btn btn-danger col-md-4" | ||
type="reset" | ||
data-test-id="close_confirmation_modal_btn" | ||
(click)="bsModalRef.hide()" | ||
> | ||
Abort & Close | ||
</button> | ||
</div> | ||
</div> |
Oops, something went wrong.