diff --git a/src/app/(app)/repairs/[id]/page.tsx b/src/app/(app)/repairs/[id]/page.tsx
index 8fe569b..8345fe0 100644
--- a/src/app/(app)/repairs/[id]/page.tsx
+++ b/src/app/(app)/repairs/[id]/page.tsx
@@ -48,31 +48,12 @@ import {
documentStageStyle,
type DocumentStageTone,
} from "@/lib/repair-document-stage";
+import {
+ REPAIR_STATUS_LABEL,
+ REPAIR_STATUS_VARIANT,
+} from "@/lib/repair-status";
import type { Customer, Supplier, Repair } from "@/lib/types";
-const statusColors: Record<
- string,
- "default" | "secondary" | "destructive" | "outline"
-> = {
- new: "outline",
- assessing: "secondary",
- quoted: "secondary",
- approved: "default",
- in_progress: "secondary",
- completed: "default",
- cancelled: "destructive",
-};
-
-const statusLabels: Record = {
- new: "New",
- assessing: "Sent to supplier",
- quoted: "Quote received",
- approved: "Approved",
- in_progress: "In progress",
- completed: "Completed",
- cancelled: "Cancelled",
-};
-
const ALL_STATUSES = [
"new",
"assessing",
@@ -123,6 +104,7 @@ export default function RepairDetailPage({
serial_no: "",
item_description: "",
fault_description: "",
+ supplier_scope: "",
notes: "",
status: "new" as (typeof ALL_STATUSES)[number],
});
@@ -188,6 +170,7 @@ export default function RepairDetailPage({
serial_no: data.serial_no ?? "",
item_description: data.item_description ?? "",
fault_description: data.fault_description ?? "",
+ supplier_scope: data.supplier_scope ?? "",
notes: data.notes ?? "",
status: (data.status ?? "new") as (typeof ALL_STATUSES)[number],
});
@@ -234,6 +217,7 @@ export default function RepairDetailPage({
serial_no: edit.serial_no || null,
item_description: edit.item_description,
fault_description: edit.fault_description,
+ supplier_scope: edit.supplier_scope,
notes: edit.notes,
status: edit.status,
}),
@@ -580,8 +564,8 @@ export default function RepairDetailPage({
{repair.repair_number}
-
- {statusLabels[repair.status] || repair.status}
+
+ {REPAIR_STATUS_LABEL[repair.status] || repair.status}
{repair.item_description}
@@ -718,6 +702,19 @@ export default function RepairDetailPage({
}
/>
+
+
+
)}
diff --git a/src/app/(app)/repairs/page.tsx b/src/app/(app)/repairs/page.tsx
index 8ca0fa4..069645b 100644
--- a/src/app/(app)/repairs/page.tsx
+++ b/src/app/(app)/repairs/page.tsx
@@ -22,6 +22,10 @@ import { CustomerSearch } from "@/components/ui/customer-search";
import { SupplierSearch } from "@/components/ui/supplier-search";
import { OrderSearch } from "@/components/ui/order-search";
import { Camera, X as XIcon } from "lucide-react";
+import {
+ REPAIR_STATUS_LABEL,
+ REPAIR_STATUS_VARIANT,
+} from "@/lib/repair-status";
import type { Customer, Supplier, Repair } from "@/lib/types";
const ALLOWED_PHOTO_TYPES = [
@@ -32,29 +36,6 @@ const ALLOWED_PHOTO_TYPES = [
];
const MAX_PHOTO_BYTES = 8 * 1024 * 1024;
-const statusColors: Record<
- string,
- "default" | "secondary" | "destructive" | "outline"
-> = {
- new: "outline",
- assessing: "secondary",
- quoted: "secondary",
- approved: "default",
- in_progress: "secondary",
- completed: "default",
- cancelled: "destructive",
-};
-
-const statusLabels: Record = {
- new: "New",
- assessing: "Sent to supplier",
- quoted: "Quote received",
- approved: "Approved",
- in_progress: "In progress",
- completed: "Completed",
- cancelled: "Cancelled",
-};
-
type RepairsListItem = Repair & {
expand?: {
customer?: Customer;
@@ -103,6 +84,7 @@ export default function RepairsPage() {
serial_no: "",
item_description: "",
fault_description: "",
+ supplier_scope: "",
notes: "",
});
const [photoPreviews, setPhotoPreviews] = useState([]);
@@ -204,6 +186,7 @@ export default function RepairsPage() {
serial_no: "",
item_description: "",
fault_description: "",
+ supplier_scope: "",
notes: "",
});
setPhotoPreviews((prev) => {
@@ -232,6 +215,7 @@ export default function RepairsPage() {
serial_no: form.serial_no || null,
item_description: form.item_description.trim(),
fault_description: form.fault_description.trim(),
+ supplier_scope: form.supplier_scope.trim(),
notes: form.notes.trim(),
}),
});
@@ -331,8 +315,8 @@ export default function RepairsPage() {
key: "status",
label: "Status",
render: (item: RepairsListItem) => (
-
- {statusLabels[item.status] || item.status}
+
+ {REPAIR_STATUS_LABEL[item.status] || item.status}
),
},
@@ -406,8 +390,8 @@ export default function RepairsPage() {
) : null}
-
- {statusLabels[item.status] || item.status}
+
+ {REPAIR_STATUS_LABEL[item.status] || item.status}
{item.item_description}
@@ -502,6 +486,20 @@ export default function RepairsPage() {
rows={3}
/>
+
+
+