From e8fa9bd7bba125a339f11876eb5ea99d0cd301b6 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Thu, 25 May 2023 19:11:31 -0600 Subject: Añade historial de órdenes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/forms/login_form.tsx | 3 +- src/components/order_table.tsx | 56 +++++++++++++++++++++++++++ src/components/product_cart.tsx | 2 +- src/components/user_account_dropdown_menu.tsx | 2 +- 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 src/components/order_table.tsx (limited to 'src/components') diff --git a/src/components/forms/login_form.tsx b/src/components/forms/login_form.tsx index 44c3da5..b1a2296 100644 --- a/src/components/forms/login_form.tsx +++ b/src/components/forms/login_form.tsx @@ -7,9 +7,8 @@ import "../stylesheets/shared.css" export function LoginForm() { const [error_message, setErrorMessage] = useState(''); - // const [modal, setModal] = useState(new Modal()); - // Error rendering useEffecT + // Error rendering useEffect useEffect(() => { document.getElementById("errorMessage").innerHTML = error_message; }, [error_message]); diff --git a/src/components/order_table.tsx b/src/components/order_table.tsx new file mode 100644 index 0000000..207b3e4 --- /dev/null +++ b/src/components/order_table.tsx @@ -0,0 +1,56 @@ +import Order from "../models/order"; +import "./stylesheets/shared.css"; + +function getRows(orders: Array) { + const rows = orders.map(order => ( + + + {order.id} + + + {order.public_id} + + + {order.created_at.toLocaleString().split('T')[0]} + + + {order.total} + + + )); + + return rows; +} + +export default function OrderTable({ orders }) { + const rows = getRows(orders); + + return( +
+

+ Historial de órdenes +

+ + + + + + + + + + + {rows} + +
+ Número de orden + + Identificador + + Fecha + + Total +
+
+ ); +} \ No newline at end of file diff --git a/src/components/product_cart.tsx b/src/components/product_cart.tsx index 4e78d1a..14710d1 100644 --- a/src/components/product_cart.tsx +++ b/src/components/product_cart.tsx @@ -3,7 +3,7 @@ import "./stylesheets/product_listing.css"; export default function ProductCart({ product }) { return ( -
+
diff --git a/src/components/user_account_dropdown_menu.tsx b/src/components/user_account_dropdown_menu.tsx index b70aa4e..495f3c8 100644 --- a/src/components/user_account_dropdown_menu.tsx +++ b/src/components/user_account_dropdown_menu.tsx @@ -10,7 +10,7 @@ export default function UserAccountDropdownMenu() {
  • - Historial de pedidos + Historial de órdenes
  • -- cgit v1.2.3