feat(opportunities): Neue Opportunity auf den angemeldeten Benutzer
Beim Anlegen stand als Zustaendiger bisher der erste Benutzer der Liste (in der Praxis "Administrator"). Jetzt ist es - wie im Kontaktformular - der angemeldete Benutzer, mit users[0] als Rueckfallebene. Beim Bearbeiten bleibt die gespeicherte Zustaendigkeit unangetastet. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c8eaaa1947
commit
86aa7468af
@@ -408,6 +408,10 @@ Spalte steht ihr Volumen; eine Karte wird per Maus in die nächste Phase gezogen
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
Beim Anlegen einer neuen Opportunity steht **Zuständig** schon auf dem
|
||||||
|
angemeldeten Benutzer; beim Bearbeiten bleibt die gespeicherte Zuständigkeit
|
||||||
|
unverändert.
|
||||||
|
|
||||||
### Für einen anderen Berater kopieren
|
### Für einen anderen Berater kopieren
|
||||||
|
|
||||||
Eine Opportunity läuft immer für **einen** Berater. Passt dasselbe Projekt auch
|
Eine Opportunity läuft immer für **einen** Berater. Passt dasselbe Projekt auch
|
||||||
|
|||||||
@@ -375,6 +375,7 @@ Warum genau diese Konstanten festgelegt sind, steht in
|
|||||||
|
|
||||||
| Datei | Inhalt |
|
| Datei | Inhalt |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
|
| `components/opportunities/OpportunityModal.tsx` | Formular der Opportunity. Beim Neuanlegen ist der angemeldete Benutzer *Zuständig* (`useAuth()`, Rückfallebene `users[0]`) - beim Bearbeiten bleibt die gespeicherte Zuständigkeit stehen. Beraterliste kommt aus der Akquise (`acquisitionOptionsApi`) |
|
||||||
| `components/opportunities/OpportunityCopyDialog.tsx` | Kopie für andere Berater: Auswahl aus der Beraterliste der Akquise (ohne den eigenen), Phase der Kopie |
|
| `components/opportunities/OpportunityCopyDialog.tsx` | Kopie für andere Berater: Auswahl aus der Beraterliste der Akquise (ohne den eigenen), Phase der Kopie |
|
||||||
| `components/opportunities/OpportunityTrash.tsx` | Papierkorb der Opportunities: wiederherstellen, leeren, Restlaufzeit je Eintrag |
|
| `components/opportunities/OpportunityTrash.tsx` | Papierkorb der Opportunities: wiederherstellen, leeren, Restlaufzeit je Eintrag |
|
||||||
| `components/opportunities/opportunityUi.tsx` | `STAGE_LABELS` (Anzeige, mit Umlaut), `STAGE_HINTS` (Erläuterung als Titelhinweis), `STAGE_STYLES`, `STAGE_COLORS`, `StageBadge` |
|
| `components/opportunities/opportunityUi.tsx` | `STAGE_LABELS` (Anzeige, mit Umlaut), `STAGE_HINTS` (Erläuterung als Titelhinweis), `STAGE_STYLES`, `STAGE_COLORS`, `StageBadge` |
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Avatar, inputClass, labelClass, labelRowClass, labelTextClass } from '.
|
|||||||
import { STAGE_COLORS, STAGE_HINTS, STAGE_LABELS } from './opportunityUi';
|
import { STAGE_COLORS, STAGE_HINTS, STAGE_LABELS } from './opportunityUi';
|
||||||
import { useToast } from '../Toast';
|
import { useToast } from '../Toast';
|
||||||
import { acquisitionOptionsApi, opportunitiesApi } from '../../lib/api';
|
import { acquisitionOptionsApi, opportunitiesApi } from '../../lib/api';
|
||||||
|
import { useAuth } from '../../lib/auth';
|
||||||
import {
|
import {
|
||||||
OPPORTUNITY_STAGES,
|
OPPORTUNITY_STAGES,
|
||||||
contactFullName,
|
contactFullName,
|
||||||
@@ -90,7 +91,15 @@ export const OpportunityModal: React.FC<OpportunityModalProps> = ({
|
|||||||
onCopy,
|
onCopy,
|
||||||
}) => {
|
}) => {
|
||||||
const { addToast } = useToast();
|
const { addToast } = useToast();
|
||||||
const [form, setForm] = useState<FormState>(() => toFormState(opportunity, users[0]?.id ?? null));
|
const { user: currentUser } = useAuth();
|
||||||
|
/*
|
||||||
|
* Beim Neuanlegen ist der angemeldete Benutzer zustaendig - das trifft fast
|
||||||
|
* immer zu und laesst sich im Feld "Zustaendig" aendern. Beim Bearbeiten
|
||||||
|
* bleibt die gespeicherte Zustaendigkeit unangetastet.
|
||||||
|
*/
|
||||||
|
const [form, setForm] = useState<FormState>(() =>
|
||||||
|
toFormState(opportunity, currentUser?.id ?? users[0]?.id ?? null)
|
||||||
|
);
|
||||||
const [contacts, setContacts] = useState<ContactEntry[]>(
|
const [contacts, setContacts] = useState<ContactEntry[]>(
|
||||||
() => opportunity?.contacts.map((c) => ({ lead_id: c.lead_id, role: c.role ?? '' })) ?? []
|
() => opportunity?.contacts.map((c) => ({ lead_id: c.lead_id, role: c.role ?? '' })) ?? []
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user