Commit 3f59154c authored by Janik Münzenberger's avatar Janik Münzenberger
Browse files

FixedEmail sending

parent 3384b8f5
<form [formGroup]="emailForm">
<div class="alert alert-success" *ngIf="sent" role="alert"><i class="fas fa-check"></i>{{"EMAIL.SUCCESS" | translate}}</div>
<form [formGroup]="emailForm" *ngIf="!sent">
<div class="form-group row">
<label for="email_sender" class="col-sm-2 col-form-label">{{"EMAIL.SENDER" | translate}}:</label>
<div class="col-sm-10">
<input type="email" class="form-control" formControlName="email_sender" id="email_sender" placeholder="Sender email" required>
<input type="email" autocomplete="email" class="form-control" formControlName="email_sender" id="email_sender" placeholder="Sender email" required>
</div>
</div>
<div class="form-group row">
<label for="email_receiver" class="col-sm-2 col-form-label">{{"EMAIL.RECEIVER" | translate}}:</label>
<div class="col-sm-10">
<select *ngIf="receivers" type="email" class="form-control" formControlName="email_receiver" id="email_receiver" placeholder="Receiver email" required>
<select *ngIf="receivers" type="email" autocomplete="email" class="form-control" formControlName="email_receiver" id="email_receiver" placeholder="Receiver email" required>
<option *ngFor="let recv of receivers" [value]="recv.email">{{recv.name}}</option>
</select>
<input *ngIf="!receivers || receivers.length == 0" type="email" class="form-control" formControlName="email_receiver" id="email_receiver" placeholder="Receiver email">
<input *ngIf="!receivers || receivers.length == 0" type="email" autocomplete="email" class="form-control" formControlName="email_receiver" id="email_receiver" placeholder="Receiver email">
</div>
</div>
<div class="form-group row">
......
......@@ -15,6 +15,8 @@ export class EmailComponent implements OnInit {
@Input() receivers: {email: string, name: string}[];
@Input() message: string = "";
emailForm: FormGroup;
sent: boolean = false;
constructor(private emailService: EmailService,
private userService: UserService) { }
......@@ -35,10 +37,11 @@ export class EmailComponent implements OnInit {
let email: IEmail = {
sender: this.emailForm.get('email_sender').value,
receiver: this.emailForm.get('email_receiver').value,
text: this.emailForm.get('email_message').value + "\n\n" + this.message
subject: "Email von PSE HDA app",
message: this.emailForm.get('email_message').value + "\n\n" + this.message
};
this.emailService.sendEmail(email)
.then(x => console.log("sucessfully sent"))
.then(x => this.sent = true)
.catch(err => console.log(err));
}
}
......
......@@ -2,5 +2,5 @@ export interface IEmail {
sender: string,
receiver: string,
subject?: string,
text: string
message: string
}
\ No newline at end of file
......@@ -5,4 +5,12 @@
.modal-dialog {
width: 100%;
max-width: 85%;
}
button {
height: auto;
word-break: normal;
white-space: normal;
max-width: 100%;
}
\ No newline at end of file
......@@ -66,7 +66,9 @@
"SENDER": "Sender",
"RECEIVER": "Empfänger",
"MESSAGE": "Nachricht",
"ATTACHMENT": "Anhang"
"ATTACHMENT": "Anhang",
"SUCCESS": "Email wurde erfolgreich versendet!",
"FAILED": "Email konnte nicht versendet werden!"
},
"RESULT": {
"FOR": "Ergebnis für",
......
......@@ -66,7 +66,9 @@
"SENDER": "Sender",
"RECEIVER": "Receiver",
"MESSAGE": "Message",
"ATTACHMENT": "Attachment"
"ATTACHMENT": "Attachment",
"SUCCESS": "Successfully sent your email!",
"FAILED": "Failed to send your email!"
},
"RESULT": {
"FOR": "Result for",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment