feat: Absender-Zuordnung kann nach Waehrung unterscheiden
Revolut verschickt fuer eine Zahlung in Euro und eine in Franken dieselbe Mail vom selben Absender. Ohne die Waehrung als Kriterium landete alles auf demselben Konto. Die Erkennung liest die Waehrung ohnehin aus; sie wird jetzt VOR der Zuordnung ausgewertet und ist ein optionales Filterkriterium. Zuordnungen mit Waehrung werden zuerst geprueft – wer neben ein allgemeines "revolut" ein genaues "revolut + EUR" stellt, meint das genaue, unabhaengig von der Anlagereihenfolge. Uebergangene Mails melden ausserdem die erkannte Waehrung mit, damit beim Einrichten sichtbar ist, welcher Wert zu filtern waere. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,9 @@ import { useConfirm } from "../../confirm";
|
||||
import Icon from "../../components/Icon";
|
||||
import Modal from "../../components/Modal";
|
||||
|
||||
// Reicht für den Alltag; wer eine andere braucht, sagt Bescheid.
|
||||
const WAEHRUNGEN = ["CHF", "EUR", "USD", "GBP"];
|
||||
|
||||
const LEER = {
|
||||
name: "", host: "", port: 993, security: "ssl", username: "", password: "",
|
||||
folder: "INBOX", done_folder: "", mark_seen: true, is_active: true, poll_minutes: 15,
|
||||
@@ -276,14 +279,20 @@ export default function Postfaecher() {
|
||||
function SenderRow({ absender, konten, t, onSave, onDelete }) {
|
||||
const [text, setText] = useState(absender.from_contains || "");
|
||||
const [konto, setKonto] = useState(absender.account_id ? String(absender.account_id) : "");
|
||||
const [waehrung, setWaehrung] = useState(absender.currency || "");
|
||||
const geaendert =
|
||||
text !== (absender.from_contains || "") ||
|
||||
waehrung !== (absender.currency || "") ||
|
||||
konto !== (absender.account_id ? String(absender.account_id) : "");
|
||||
|
||||
return (
|
||||
<div className="sender-row">
|
||||
<input value={text} onChange={(e) => setText(e.target.value)}
|
||||
placeholder={t("mailbox.fromPlaceholder")} />
|
||||
<select value={waehrung} onChange={(e) => setWaehrung(e.target.value)}>
|
||||
<option value="">{t("mailbox.anyCurrency")}</option>
|
||||
{WAEHRUNGEN.map((w) => <option key={w} value={w}>{w}</option>)}
|
||||
</select>
|
||||
<select value={konto} onChange={(e) => setKonto(e.target.value)}>
|
||||
<option value="">{t("mailbox.noAccount")}</option>
|
||||
{konten.map((k) => <option key={k.id} value={k.id}>{k.name}</option>)}
|
||||
@@ -292,6 +301,7 @@ function SenderRow({ absender, konten, t, onSave, onDelete }) {
|
||||
{geaendert && (
|
||||
<button type="button" className="btn sm primary"
|
||||
onClick={() => onSave({ from_contains: text.trim() || null,
|
||||
currency: waehrung || null,
|
||||
account_id: konto ? Number(konto) : null })}>
|
||||
{t("common.save")}
|
||||
</button>
|
||||
@@ -308,10 +318,16 @@ function SenderRow({ absender, konten, t, onSave, onDelete }) {
|
||||
function SenderForm({ konten, onAdd, t }) {
|
||||
const [von, setVon] = useState("");
|
||||
const [konto, setKonto] = useState("");
|
||||
const [waehrung, setWaehrung] = useState("");
|
||||
return (
|
||||
<div style={{ marginTop: "var(--sp-2)" }}>
|
||||
<input style={{ width: "100%" }} placeholder={t("mailbox.fromPlaceholder")} value={von}
|
||||
onChange={(e) => setVon(e.target.value)} />
|
||||
<select style={{ width: "100%", marginTop: 4 }} value={waehrung}
|
||||
onChange={(e) => setWaehrung(e.target.value)}>
|
||||
<option value="">{t("mailbox.anyCurrency")}</option>
|
||||
{WAEHRUNGEN.map((w) => <option key={w} value={w}>{w}</option>)}
|
||||
</select>
|
||||
<select style={{ width: "100%", marginTop: 4 }} value={konto}
|
||||
onChange={(e) => setKonto(e.target.value)}>
|
||||
<option value="">{t("mailbox.noAccount")}</option>
|
||||
@@ -319,7 +335,11 @@ function SenderForm({ konten, onAdd, t }) {
|
||||
</select>
|
||||
<p className="muted small" style={{ margin: "4px 0 0" }}>{t("mailbox.senderHint")}</p>
|
||||
<button type="button" className="btn sm" style={{ marginTop: 4 }} disabled={!von.trim()}
|
||||
onClick={() => { onAdd({ from_contains: von.trim(), account_id: konto ? Number(konto) : null }); setVon(""); }}>
|
||||
onClick={() => {
|
||||
onAdd({ from_contains: von.trim(), currency: waehrung || null,
|
||||
account_id: konto ? Number(konto) : null });
|
||||
setVon("");
|
||||
}}>
|
||||
<Icon name="plus" size={14} /> {t("mailbox.addSender")}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user