From 43bb0d5911e79a3bc18656ec50a8e2cf9d7bd387 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Sun, 9 Mar 2025 11:55:42 -0400 Subject: [PATCH] style --- src/components/Vehicle.js | 3 +-- src/components/Vehicles.js | 50 ++++++++++++++++++-------------------- src/styles/App.css | 9 ++++++- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/components/Vehicle.js b/src/components/Vehicle.js index 2e2d4d5..b2cc917 100644 --- a/src/components/Vehicle.js +++ b/src/components/Vehicle.js @@ -48,8 +48,7 @@ const Vehicle = (props) => {

- Price: - {`$${formatNums(price / 100)}.00`} + PVR Price: ${formatNums(price)}

ISDM: diff --git a/src/components/Vehicles.js b/src/components/Vehicles.js index 1776ab3..b878ba3 100644 --- a/src/components/Vehicles.js +++ b/src/components/Vehicles.js @@ -27,7 +27,7 @@ const Vehicles = () => { "Prod Year", "Category", "Mileage", - "Pre-QRV-Price", + "Price", "Date Received", "Purchase Order No.", "Purchase Order Date", @@ -56,9 +56,9 @@ const Vehicles = () => { const format = (e) => { e.preventDefault(); const formatMiles = parseFloat(inputs.mileage.replace(/,/g, "")); - const formatPrice = parseFloat(inputs.price.replace(/,/g, "") * 100); + const formatPrice = parseFloat(inputs["Price"].replace(/,/g, "") * 100); inputs.Mileage = formatMiles; - inputs["Pre-QRV-Price"] = formatPrice; + inputs["Price"] = formatPrice; }; useEffect(() => { @@ -88,7 +88,7 @@ const Vehicles = () => { if (docSnap.exists()) { const newcar = docSnap.data(); newcar.id = docSnap._key.path.segments[1]; - setfetchedVeh([newcar]); + setfetchedVeh(newcar); } else { console.log("DB item does not exist"); } @@ -106,7 +106,7 @@ const Vehicles = () => { const year = inputs["Prod Year"]; const cat = inputs.Category; const miles = inputs.Mileage; - const price = inputs["Pre-QRV-Price"]; + const price = inputs["Price"]; const date = inputs["Date Received"]; const poNo = inputs["Purchase Order No."]; const poDate = inputs["Purchase Order Date"]; @@ -139,7 +139,7 @@ const Vehicles = () => { if (!valid) { return; } - console.log("inputs~~~~~~~~~~", inputs); + setSavedVehicles([...savedVehicles, inputs]); try { const docRef = await addDoc(collection(db, "hdepot"), inputs); @@ -159,10 +159,8 @@ const Vehicles = () => { console.log(`Error deleteing vehicle from db: ${error}`); } } - console.log("~~~~~~~~~~~~~savedVehicles", savedVehicles); - savedVehicles.forEach((el) => { - console.log("~~~~~~~~~~~~~el", el); - }); + console.log("~~~~~~~~~~~~~~~fetchedVehicle", fetchedVeh); + return ( <>

@@ -252,22 +250,22 @@ const Vehicles = () => { />
- {fetchedVeh && - fetchedVeh.map((el, i) => ( - - ))} + {fetchedVeh ? ( + + ) : ( + <> + )}
diff --git a/src/styles/App.css b/src/styles/App.css index af30ff9..829f654 100644 --- a/src/styles/App.css +++ b/src/styles/App.css @@ -45,12 +45,19 @@ body { .veh-col { display: flex; - flex-direction: column; + flex-direction: row; + align-items: center; + justify-content: center; + margin: auto; } .veh-row { display: flex; flex-direction: row; + text-align: center; + align-items: center; + justify-content: center; + margin: auto; } .veh-row-price {