diff --git a/memberflow-api/src/main/java/com/denniseckerskorn/dtos/finance_management_dtos/InvoiceDTO.java b/memberflow-api/src/main/java/com/denniseckerskorn/dtos/finance_management_dtos/InvoiceDTO.java
index 0edf1bb..b3410ef 100644
--- a/memberflow-api/src/main/java/com/denniseckerskorn/dtos/finance_management_dtos/InvoiceDTO.java
+++ b/memberflow-api/src/main/java/com/denniseckerskorn/dtos/finance_management_dtos/InvoiceDTO.java
@@ -1,5 +1,6 @@
package com.denniseckerskorn.dtos.finance_management_dtos;
+import com.denniseckerskorn.dtos.user_managment_dtos.UserDTO;
import com.denniseckerskorn.entities.finance.Invoice;
import com.denniseckerskorn.enums.StatusValues;
import jakarta.validation.constraints.NotNull;
@@ -16,6 +17,9 @@ public class InvoiceDTO {
@NotNull
private Integer userId;
+ private UserDTO user;
+
+
@NotNull
private LocalDateTime date;
@@ -35,6 +39,7 @@ public class InvoiceDTO {
public InvoiceDTO(Invoice invoice) {
this.id = invoice.getId();
this.userId = invoice.getUser() != null ? invoice.getUser().getId() : null;
+ this.user = invoice.getUser() != null ? new UserDTO(invoice.getUser()) : null;
this.date = invoice.getDate();
this.total = invoice.getTotal();
this.status = invoice.getStatus();
@@ -77,6 +82,14 @@ public class InvoiceDTO {
this.userId = userId;
}
+ public UserDTO getUser() {
+ return user;
+ }
+
+ public void setUser(UserDTO user) {
+ this.user = user;
+ }
+
public LocalDateTime getDate() {
return date;
}
diff --git a/memberflow-api/src/main/java/com/denniseckerskorn/dtos/user_managment_dtos/UserDTO.java b/memberflow-api/src/main/java/com/denniseckerskorn/dtos/user_managment_dtos/UserDTO.java
index f58c83c..0e7473d 100644
--- a/memberflow-api/src/main/java/com/denniseckerskorn/dtos/user_managment_dtos/UserDTO.java
+++ b/memberflow-api/src/main/java/com/denniseckerskorn/dtos/user_managment_dtos/UserDTO.java
@@ -42,6 +42,19 @@ public class UserDTO {
this.status = status;
}
+ public UserDTO(User user) {
+ this.id = user.getId();
+ this.name = user.getName();
+ this.surname = user.getSurname();
+ this.email = user.getEmail();
+ this.phoneNumber = user.getPhoneNumber();
+ this.address = user.getAddress();
+ this.registerDate = user.getRegisterDate();
+ this.roleName = user.getRole() != null ? user.getRole().getName() : null;
+ this.status = user.getStatus();
+ }
+
+
// Getters y Setters
public Integer getId() {
return id;
diff --git a/memberflow-frontend/src/components/layout/MainLayout.jsx b/memberflow-frontend/src/components/layout/MainLayout.jsx
index 04aaf23..feda04b 100644
--- a/memberflow-frontend/src/components/layout/MainLayout.jsx
+++ b/memberflow-frontend/src/components/layout/MainLayout.jsx
@@ -23,6 +23,7 @@ import ViewTimetable from '../forms/ViewTimetable';
import MembershipForm from '../forms/MembershipCreateForm';
import MembershipList from '../lists/MembershipList';
import InvoiceForm from '../forms/InvoiceForm';
+import InvoiceList from '../lists/InvoiceList';
import '../styles/MainLayout.css';
@@ -66,9 +67,8 @@ const MainLayout = () => {
Cargando facturas...
+| ID | +Cliente | +Fecha | +Estado | +Total (€) | +Acciones | +|
|---|---|---|---|---|---|---|
| {inv.id} | +{inv.user?.name} {inv.user?.surname} | +{inv.user?.email} | +{new Date(inv.date).toLocaleString()} | +{inv.status} | +{inv.total?.toFixed(2)} | ++ + + | +