Add project management support and integrate customer-project functionality

This commit is contained in:
2025-07-15 18:23:53 +00:00
parent 2707aa48bc
commit 03f633ae52
26 changed files with 1135 additions and 43 deletions

View File

@@ -10,6 +10,7 @@ import CustomerDetailContent from "@/components/customers/details/CustomerDetail
import CustomerInformationContent from "@/components/customers/details/sub/ContactInformationContent";
import CustomerPhoneNumberContent from "@/components/customers/details/sub/CustomerPhoneNumberContent";
import CustomerNotesContent from "@/components/customers/details/sub/CustomerNotesContent";
import CustomerProjectsContent from "@/components/customers/details/sub/CustomerProjectsContent";
import {Customer} from "@/services/customers/entities/customer";
export default function CustomerDetailPage() {
@@ -51,7 +52,7 @@ export default function CustomerDetailPage() {
})
.catch((error) => {
if (!isMounted) return;
console.error('Error fetching customer:', error);
console.error("Error fetching customer:", error);
setCustomer(null);
setError("Fehler beim Laden der Kundendaten");
})
@@ -73,17 +74,17 @@ export default function CustomerDetailPage() {
const formatDate = (date: string) => {
try {
const formattedDate = new Date(date).toLocaleDateString('de-DE', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit'
const formattedDate = new Date(date).toLocaleDateString("de-DE", {
day: "2-digit",
month: "2-digit",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
});
return formattedDate === 'Invalid Date' ? '-' : formattedDate;
return formattedDate === "Invalid Date" ? "-" : formattedDate;
} catch (error) {
console.error('Error formatting date:', error);
return '-';
console.error("Error formatting date:", error);
return "-";
}
};
@@ -93,7 +94,7 @@ export default function CustomerDetailPage() {
: "Erstellt von - am -",
lastActivityInfo: customer
? `Letzte Aktivität: ${customer.updatedBy || "-"} am ${formatDate(customer.updatedAt)}`
: "Letzte Aktivität: - am -"
: "Letzte Aktivität: - am -",
};
const renderMetadata = () => {
@@ -140,26 +141,29 @@ export default function CustomerDetailPage() {
<CustomerDetailContent
loading={loading}
customer={customer}
sections={
customer
? [
<CustomerInformationContent
key="customerInformation"
customer={customer}
handleOpenDialog={handleOpenDialog}
/>,
<CustomerPhoneNumberContent
key="customerPhoneNumberInfo"
customer={customer}
handleOpenDialog={handleOpenDialog}
/>,
<CustomerNotesContent
key="customerNotes"
customer={customer}
handleOpenDialog={handleOpenDialog}
/>
]
: []
informationSection={
<CustomerInformationContent
customer={customer!}
handleOpenDialog={handleOpenDialog}
/>
}
phoneNumberSection={
<CustomerPhoneNumberContent
customer={customer!}
handleOpenDialog={handleOpenDialog}
/>
}
notesSection={
<CustomerNotesContent
customer={customer!}
handleOpenDialog={handleOpenDialog}
/>
}
projectsSection={
<CustomerProjectsContent
customer={customer!}
handleOpenDialog={handleOpenDialog}
/>
}
/>
)}
@@ -169,4 +173,4 @@ export default function CustomerDetailPage() {
</Dialog>
</div>
);
}
}