fix(receiver-table): Problem mit automatischer Anredezuweisung für den ersten hinzugefügten Empfänger behoben
- Bedingung in der Funktion `receiver_filter` aktualisiert, um den Indexwert korrekt zu überprüfen.
This commit is contained in:
parent
939ba1bb47
commit
e9d686a4c1
@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core';
|
||||
import { Component, OnInit, QueryList, ViewChildren } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule, FormControl } from '@angular/forms';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
@ -45,17 +45,19 @@ export class ReceiverTableComponent implements OnInit {
|
||||
receiver_filter: (value: string, options: string[], index?: number) => string[] = (value, options, index) => {
|
||||
const filterValue = value.toLowerCase();
|
||||
|
||||
// set the name if it is used befor
|
||||
// set the name if it is used before
|
||||
const name = this.last_used_name[value];
|
||||
if (name && index)
|
||||
|
||||
if (name && index != null && index != undefined) {
|
||||
this.receiverData.at(index)!.name = name
|
||||
}
|
||||
|
||||
// !!! do not allow email duplication !!!
|
||||
var similarMails = this.receiver_mails.filter(m => m.toLocaleLowerCase() === value.toLocaleLowerCase() && m !== value)
|
||||
if (similarMails.length > 0 && index != undefined) {
|
||||
this.receiverInputs[index].text = similarMails[0];
|
||||
}
|
||||
console.log(this.receiverInputs.length + " - " + index)
|
||||
|
||||
// if added into last row
|
||||
if (value.length > 0 && (this.receiverInputs.at(-1)?.lenght ?? 0) > 0) {
|
||||
this.receiverData.at(-1)!.accessCode = generateAccessCode();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user