diff --git a/erd-stuff.txt b/erd-stuff.txt new file mode 100644 index 0000000..5b89508 --- /dev/null +++ b/erd-stuff.txt @@ -0,0 +1,6 @@ +lastPurchaseID integer + locationIDLastPurchasedFrom integer + mostPurchasedLocationID integer + productTypesLastPurchased integer + productsIDLastPurchased integer + productsMostPurchasedID integer diff --git a/src/componets/KandyKorner.js b/src/componets/KandyKorner.js index 20243f8..da91645 100644 --- a/src/componets/KandyKorner.js +++ b/src/componets/KandyKorner.js @@ -1,4 +1,5 @@ import { LocationsList } from "./locations/Locations" +import { ProductList } from "./products/Products" export const KandyKorner = () => { return( @@ -6,6 +7,8 @@ export const KandyKorner = () => {

Kandy Korner

Locations

+

Products

+ ) } \ No newline at end of file diff --git a/src/componets/auth/Login.css b/src/componets/auth/Login.css new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/auth/Login.js b/src/componets/auth/Login.js new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/auth/Register.js b/src/componets/auth/Register.js new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/customers/Customers.js b/src/componets/customers/Customers.js new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/employees/EmployeeForm.js b/src/componets/employees/EmployeeForm.js new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/employees/Employees.js b/src/componets/employees/Employees.js new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/locations/Locations.js b/src/componets/locations/Locations.js new file mode 100644 index 0000000..c1c0d7c --- /dev/null +++ b/src/componets/locations/Locations.js @@ -0,0 +1,27 @@ +import React, {useEffect,useState} from "react"; + +export const LocationsList = () => { + const [locations, setLocationList] = useState([]) + + useEffect( + () => { + fetch("http://localhost:8088/locations") + .then(res => res.json()) + .then(setLocationList) + }, + [] + ) + return ( + <> + + { + locations.map( + (locationObject) => { + return

{locationObject.name}

+ } + ) + + } + + ) + } \ No newline at end of file diff --git a/src/componets/locations/locations.css b/src/componets/locations/locations.css new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/nav/navbar.css b/src/componets/nav/navbar.css new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/nav/navbar.js b/src/componets/nav/navbar.js new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/products/ProductTypes.js b/src/componets/products/ProductTypes.js new file mode 100644 index 0000000..e69de29 diff --git a/src/componets/products/Products.js b/src/componets/products/Products.js new file mode 100644 index 0000000..569ec49 --- /dev/null +++ b/src/componets/products/Products.js @@ -0,0 +1,29 @@ +import React, {useEffect,useState} from "react"; + +export const ProductList = () => { + const [products, setProductList] = useState([]) + const [totalProducts, totalProductAmounts] = useState("") + + useEffect( + () => { + // table call must be singular in the fetch link in order to properly retrieve objects + fetch("http://localhost:8088/products?_expand=productType&_sort=productTypeId&_order=asc") + .then(res => res.json()) + .then(setProductList) + }, + [] + ) + return ( + <> +
{totalProducts}
+ { + products.map( + (productObject) => { + return

{productObject.candyName} - Price - ${productObject.price} - Candy Type - {productObject.productType.candyType}

; + } + ) + + } + + ) + } \ No newline at end of file