feat(employee-invite): Updated validation of email-addresses and changed text for assigned users. (TV-628)
Squashed commit of the following: commit 06df4b0cf3fd7a006287267d6bd3ce427d2ecdd7 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Wed Sep 22 09:17:24 2021 +0200 Added new text and updated validation
This commit is contained in:
@@ -42,15 +42,11 @@
|
|||||||
[afHeading]="alertTexts.heading"
|
[afHeading]="alertTexts.heading"
|
||||||
af-heading-level="h3"
|
af-heading-level="h3"
|
||||||
>
|
>
|
||||||
<ng-container *ngIf="alertTexts.variation === 'warning'">
|
<p *ngIf="alertTexts.variation === 'warning'">
|
||||||
<p>
|
Inbjudan skickades endast till vissa mottagare. Skicka inbjudningar igen till de e-postadresser där inbjudan
|
||||||
Inbjudan skickades endast till vissa mottagare. Skicka inbjudningar igen till de e-postadresser där
|
misslyckades.
|
||||||
inbjudan misslyckades.
|
</p>
|
||||||
</p>
|
<p *ngIf="alertTexts.variation === 'danger'">Något gick fel. Skicka inbjudningar igen.</p>
|
||||||
</ng-container>
|
|
||||||
<ng-container *ngIf="alertTexts.variation === 'danger'">
|
|
||||||
<p>Något gick fel. Skicka inbjudningar igen.</p>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container *ngIf="lastInvitedFailedInvites.length">
|
<ng-container *ngIf="lastInvitedFailedInvites.length">
|
||||||
<h4>Inbjudan kunde inte skickas till:</h4>
|
<h4>Inbjudan kunde inte skickas till:</h4>
|
||||||
<p>{{lastInvitedFailedInvites.join(', ')}}</p>
|
<p>{{lastInvitedFailedInvites.join(', ')}}</p>
|
||||||
@@ -59,6 +55,14 @@
|
|||||||
<h4>Inbjudan har skickats till:</h4>
|
<h4>Inbjudan har skickats till:</h4>
|
||||||
<p>{{lastInvitedNewUsers.join(', ')}}</p>
|
<p>{{lastInvitedNewUsers.join(', ')}}</p>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<ng-container *ngIf="lastInvitedAssignedUsers.length">
|
||||||
|
<h4>Inbjudan har skickats till:</h4>
|
||||||
|
<p>{{lastInvitedAssignedUsers.join(', ')}}</p>
|
||||||
|
<p>
|
||||||
|
{{lastInvitedAssignedUsers.length > 1 ? 'Användarna' : 'Användaren'}} fanns redan i systemet och är nu
|
||||||
|
tillagd i personallistan.
|
||||||
|
</p>
|
||||||
|
</ng-container>
|
||||||
<ng-container *ngIf="lastInvitedAlreadyInvitedUsers.length">
|
<ng-container *ngIf="lastInvitedAlreadyInvitedUsers.length">
|
||||||
<h4>E-postadressen har redan fått en inbjudan:</h4>
|
<h4>E-postadressen har redan fått en inbjudan:</h4>
|
||||||
<p>{{lastInvitedAlreadyInvitedUsers.join(', ')}}</p>
|
<p>{{lastInvitedAlreadyInvitedUsers.join(', ')}}</p>
|
||||||
|
|||||||
@@ -31,15 +31,17 @@ export class EmployeeInviteComponent {
|
|||||||
|
|
||||||
get emailsControlValueAsArray(): string[] {
|
get emailsControlValueAsArray(): string[] {
|
||||||
return (this.emailsControl.value as string)
|
return (this.emailsControl.value as string)
|
||||||
.trim()
|
.replaceAll(/\n|\t|\r|\s/g, '')
|
||||||
.split(',')
|
.split(',')
|
||||||
.filter(email => !!email);
|
.filter(email => !!email);
|
||||||
}
|
}
|
||||||
|
|
||||||
get lastInvitedNewUsers(): string[] {
|
get lastInvitedNewUsers(): string[] {
|
||||||
const invitedUsers = this.lastInvites?.invitedUsers || [];
|
return this.lastInvites?.invitedUsers || [];
|
||||||
|
}
|
||||||
|
get lastInvitedAssignedUsers(): string[] {
|
||||||
const assignedUsers = this.lastInvites?.assignedUsers || [];
|
const assignedUsers = this.lastInvites?.assignedUsers || [];
|
||||||
return [...invitedUsers, ...assignedUsers.map(user => user.email)];
|
return assignedUsers.map(user => user.email);
|
||||||
}
|
}
|
||||||
get lastInvitedExistingUsers(): string[] {
|
get lastInvitedExistingUsers(): string[] {
|
||||||
const existingUsersInCurrentOrg = this.lastInvites?.existingUsersInCurrentOrg || [];
|
const existingUsersInCurrentOrg = this.lastInvites?.existingUsersInCurrentOrg || [];
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ export function EmailValidator(label = 'Fältet'): ValidatorFn {
|
|||||||
export function CommaSeparatedEmailValidator(): ValidatorFn {
|
export function CommaSeparatedEmailValidator(): ValidatorFn {
|
||||||
return (control: AbstractControl): ValidationError => {
|
return (control: AbstractControl): ValidationError => {
|
||||||
if (control && control.value) {
|
if (control && control.value) {
|
||||||
const values: string[] = (control.value as string).toLowerCase().trim().split(',');
|
const values: string[] = (control.value as string)
|
||||||
|
.toLowerCase()
|
||||||
|
.replaceAll(/\n|\t|\r|\s/g, '')
|
||||||
|
.split(',');
|
||||||
const invalidEmailaddresses = [];
|
const invalidEmailaddresses = [];
|
||||||
|
|
||||||
values.forEach(value => {
|
values.forEach(value => {
|
||||||
|
|||||||
Reference in New Issue
Block a user