Update
This commit is contained in:
1 parent
fa6db04370
commit
0c14a3acbd
5 files changed
+79
-7
No files matched your search
@@ -24,6 +24,7 @@ type ManualSessionFormState = {
|
||||
projectTeamspaceEntryId: string;
|
||||
activity: string;
|
||||
billingStatus: BillingStatus;
|
||||
createZammadArticle: boolean;
|
||||
workType: WorkType;
|
||||
day: string;
|
||||
startTime: string;
|
||||
@@ -43,6 +44,7 @@ function emptyManualSession(): ManualSessionFormState {
|
||||
projectTeamspaceEntryId: "",
|
||||
activity: "",
|
||||
billingStatus: null,
|
||||
createZammadArticle: false,
|
||||
workType: "support",
|
||||
day: currentDay(),
|
||||
startTime: "09:00",
|
||||
@@ -221,6 +223,19 @@ export function TimerPage({ timers, setTimers, selectedTimerId, setSelectedTimer
|
||||
};
|
||||
}, [manualSession.ticketNumber]);
|
||||
|
||||
useEffect(() => {
|
||||
setManualSession((current) => {
|
||||
if (current.ticketNumber || current.activity || current.organizationId || current.billingStatus || current.createZammadArticle === currentUser.zammad_session_note_default_enabled) {
|
||||
return current;
|
||||
}
|
||||
|
||||
return {
|
||||
...current,
|
||||
createZammadArticle: currentUser.zammad_session_note_default_enabled
|
||||
};
|
||||
});
|
||||
}, [currentUser.zammad_session_note_default_enabled]);
|
||||
|
||||
async function addTimer(source: "local" | "zammad" = "local") {
|
||||
const normalizedTicketNumber = ticketNumber.trim();
|
||||
|
||||
@@ -596,14 +611,16 @@ export function TimerPage({ timers, setTimers, selectedTimerId, setSelectedTimer
|
||||
durationSeconds,
|
||||
zammadLookup: Boolean(manualLookupTicket?.zammad_ticket_id),
|
||||
projectTeamspaceEntryId: requiresTeamspaceEntry(manualLookupTicket) ? manualSession.projectTeamspaceEntryId : null,
|
||||
billingStatus: manualSession.billingStatus
|
||||
billingStatus: manualSession.billingStatus,
|
||||
createZammadArticle: manualSession.createZammadArticle
|
||||
});
|
||||
toast.success("Session nachgetragen", {
|
||||
description: manualLookupTicket?.is_project ? "Der Eintrag wurde dem Projekt zugeordnet." : "Der Eintrag ist in deiner Ticketliste offen."
|
||||
});
|
||||
setManualSession({
|
||||
...emptyManualSession(),
|
||||
day: manualSession.day
|
||||
day: manualSession.day,
|
||||
createZammadArticle: currentUser.zammad_session_note_default_enabled
|
||||
});
|
||||
} catch (error) {
|
||||
toast.error("Session konnte nicht nachgetragen werden", {
|
||||
@@ -908,6 +925,16 @@ export function TimerPage({ timers, setTimers, selectedTimerId, setSelectedTimer
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<label className="flex min-h-10 items-start gap-2 rounded-md border bg-background p-3 text-sm lg:col-span-5">
|
||||
<Checkbox
|
||||
checked={manualSession.createZammadArticle}
|
||||
onCheckedChange={(checked) => setManualSession({ ...manualSession, createZammadArticle: checked === true })}
|
||||
/>
|
||||
<span>
|
||||
<span className="block font-medium">Interne Zammad-Notiz erstellen</span>
|
||||
<span className="block text-xs text-muted-foreground">Überträgt die Tätigkeit inklusive time_unit nach Zammad oder parkt sie bei Fehlern.</span>
|
||||
</span>
|
||||
</label>
|
||||
<Button type="submit" disabled={savingManualSession || manualTicketIsRecurringBilling}>
|
||||
<Upload className="size-4" />
|
||||
{savingManualSession ? "Speichert..." : "Nachtragen"}
|
||||
|
||||
Reference in new issue
Block a user