summaryrefslogtreecommitdiff
path: root/src/components/order_table.tsx
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-05-25 19:11:31 -0600
committerHombreLaser <sebastian-440@live.com>2023-05-25 19:11:31 -0600
commite8fa9bd7bba125a339f11876eb5ea99d0cd301b6 (patch)
tree5d8211221680a3c214b3a16b5d179722a8add085 /src/components/order_table.tsx
parentda2631822f902094e691143302d6fc6b68e1cf56 (diff)
Añade historial de órdenes
Diffstat (limited to 'src/components/order_table.tsx')
-rw-r--r--src/components/order_table.tsx56
1 files changed, 56 insertions, 0 deletions
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<Order>) {
+ const rows = orders.map(order => (
+ <tr className="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
+ <td scope="row" className="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
+ {order.id}
+ </td>
+ <td className="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
+ {order.public_id}
+ </td>
+ <td className="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
+ {order.created_at.toLocaleString().split('T')[0]}
+ </td>
+ <td className="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
+ {order.total}
+ </td>
+ </tr>
+ ));
+
+ return rows;
+}
+
+export default function OrderTable({ orders }) {
+ const rows = getRows(orders);
+
+ return(
+ <div className="my-4 w-4/5 relative overflow-x-auto">
+ <h1 className="text-2xl my-2">
+ Historial de órdenes
+ </h1>
+ <table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
+ <thead className="bg-blue-arma text-xs text-white uppercase dark:bg-gray-700 dark:text-gray-400">
+ <tr>
+ <th scope="col" className="px-6 py-3">
+ Número de orden
+ </th>
+ <th scope="col" className="px-6 py-3">
+ Identificador
+ </th>
+ <th scope="col" className="px-6 py-3">
+ Fecha
+ </th>
+ <th scope="col" className="px-6 py-3">
+ Total
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {rows}
+ </tbody>
+ </table>
+ </div>
+ );
+} \ No newline at end of file