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
@@ -6,6 +6,7 @@ import { Avatar, inputClass, labelClass, labelRowClass, labelTextClass } from '.
|
||||
import { STAGE_COLORS, STAGE_HINTS, STAGE_LABELS } from './opportunityUi';
|
||||
import { useToast } from '../Toast';
|
||||
import { acquisitionOptionsApi, opportunitiesApi } from '../../lib/api';
|
||||
import { useAuth } from '../../lib/auth';
|
||||
import {
|
||||
OPPORTUNITY_STAGES,
|
||||
contactFullName,
|
||||
@@ -90,7 +91,15 @@ export const OpportunityModal: React.FC<OpportunityModalProps> = ({
|
||||
onCopy,
|
||||
}) => {
|
||||
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[]>(
|
||||
() => opportunity?.contacts.map((c) => ({ lead_id: c.lead_id, role: c.role ?? '' })) ?? []
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user