feat(repairs): add status timeline and public link preparation
This commit is contained in:
parent
e9ec207617
commit
09cce1f2b6
22 changed files with 1027 additions and 28 deletions
|
|
@ -12,6 +12,7 @@ import {
|
|||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { priorityLabels, statusLabels } from "@/components/repairs/RepairStatusBadge";
|
||||
import { api } from "@/lib/api";
|
||||
import type { Customer } from "@/types/customer";
|
||||
import type { Repair, RepairPayload, RepairPriority, RepairSource, RepairStatus } from "@/types/repair";
|
||||
|
|
@ -180,10 +181,10 @@ export default function RepairFormDialog({ open, repair, pending, serverError, o
|
|||
<h3 className="font-semibold text-slate-950">Vorgang</h3>
|
||||
<div className="grid gap-3 md:grid-cols-3">
|
||||
<label className="grid gap-1 text-sm">Status<select className="h-8 rounded-lg border px-2 text-sm" value={payload.status} onChange={(event) => update("status", event.target.value as RepairStatus)}>
|
||||
{["new", "accepted", "diagnosis", "estimate", "waiting_for_customer", "approved", "repair", "final_test", "ready_for_pickup", "shipped", "completed", "cancelled"].map((status) => <option key={status} value={status}>{status}</option>)}
|
||||
{(["new", "accepted", "diagnosis", "estimate", "waiting_for_customer", "approved", "repair", "final_test", "ready_for_pickup", "shipped", "completed", "cancelled"] as RepairStatus[]).map((status) => <option key={status} value={status}>{statusLabels[status]}</option>)}
|
||||
</select></label>
|
||||
<label className="grid gap-1 text-sm">Priorität<select className="h-8 rounded-lg border px-2 text-sm" value={payload.priority} onChange={(event) => update("priority", event.target.value as RepairPriority)}>
|
||||
{["low", "normal", "high", "urgent"].map((priority) => <option key={priority} value={priority}>{priority}</option>)}
|
||||
{(["low", "normal", "high", "urgent"] as RepairPriority[]).map((priority) => <option key={priority} value={priority}>{priorityLabels[priority]}</option>)}
|
||||
</select></label>
|
||||
<label className="grid gap-1 text-sm">Quelle<select className="h-8 rounded-lg border px-2 text-sm" value={payload.source} onChange={(event) => update("source", event.target.value as RepairSource)}>
|
||||
{["manual", "website", "customer_portal", "email", "phone"].map((source) => <option key={source} value={source}>{source}</option>)}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const statusLabels: Record<RepairStatus, string> = {
|
|||
repair: "Reparatur",
|
||||
final_test: "Endprüfung",
|
||||
ready_for_pickup: "Abholbereit",
|
||||
shipped: "Versendet",
|
||||
shipped: "Versand",
|
||||
completed: "Abgeschlossen",
|
||||
cancelled: "Storniert",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { useState } from "react";
|
|||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import { statusLabels } from "@/components/repairs/RepairStatusBadge";
|
||||
import type { Repair, RepairStatus } from "@/types/repair";
|
||||
|
||||
type Props = {
|
||||
|
|
@ -18,7 +19,7 @@ type Props = {
|
|||
const statuses: RepairStatus[] = ["new", "accepted", "diagnosis", "estimate", "waiting_for_customer", "approved", "repair", "final_test", "ready_for_pickup", "shipped", "completed", "cancelled"];
|
||||
|
||||
export default function RepairStatusDialog({ open, repair, pending, serverError, onOpenChange, onSubmit }: Props) {
|
||||
const [status, setStatus] = useState<RepairStatus>("new");
|
||||
const [status, setStatus] = useState<RepairStatus>(repair?.status ?? "new");
|
||||
const [note, setNote] = useState("");
|
||||
|
||||
return (
|
||||
|
|
@ -30,7 +31,7 @@ export default function RepairStatusDialog({ open, repair, pending, serverError,
|
|||
</DialogHeader>
|
||||
<div className="grid gap-3">
|
||||
<label className="grid gap-1 text-sm">Neuer Status<select className="h-8 rounded-lg border px-2 text-sm" value={status} onChange={(event) => setStatus(event.target.value as RepairStatus)}>
|
||||
{statuses.map((item) => <option key={item} value={item}>{item}</option>)}
|
||||
{statuses.map((item) => <option key={item} value={item}>{statusLabels[item]}</option>)}
|
||||
</select></label>
|
||||
<label className="grid gap-1 text-sm">Notiz<textarea className="min-h-24 rounded-lg border p-2 text-sm" value={note} onChange={(event) => setNote(event.target.value)} /></label>
|
||||
{serverError && <p className="text-sm text-red-600">{serverError}</p>}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue