diff --git a/backend/__pycache__/config.cpython-312.pyc b/backend/__pycache__/config.cpython-312.pyc index 632b101..36d4222 100644 Binary files a/backend/__pycache__/config.cpython-312.pyc and b/backend/__pycache__/config.cpython-312.pyc differ diff --git a/backend/__pycache__/models.cpython-312.pyc b/backend/__pycache__/models.cpython-312.pyc index 9d4f5f9..0e0e66e 100644 Binary files a/backend/__pycache__/models.cpython-312.pyc and b/backend/__pycache__/models.cpython-312.pyc differ diff --git a/backend/config.py b/backend/config.py index 8348ffe..c74902b 100644 --- a/backend/config.py +++ b/backend/config.py @@ -22,8 +22,8 @@ app.config["SESSION_PERMANENT"] = False app.config["SESSION_USE_SIGNER"] = True app.config["SESSION_REDIS"] = redis.from_url("redis://192.168.50.107:6379") # upload directory -app.config["UPLOAD_DIRECTORY"] = 'uploads/' -# app.config["UPLOAD_DIRECTORY"] = '../frontend/public/Group_1' +# app.config["UPLOAD_DIRECTORY"] = 'uploads/' +app.config["UPLOAD_DIRECTORY"] = '../frontend/public/batch1' # app.config["REDIS_PASSWORD"] = os.environ["REDIS_PASSWORD"] # File value limit diff --git a/backend/main.py b/backend/main.py index 65b99da..89dfffd 100644 --- a/backend/main.py +++ b/backend/main.py @@ -16,6 +16,12 @@ def index(): images.append(file) return render_template('index.html', images=images) +@app.route('/list') +def orderList(): + orders = Orders.query.all() + all_orders = list(map(lambda x : x.to_json(), orders)) + return render_template('orders.html', orders=all_orders) + @app.route('/upload', methods=["POST"]) def upload(): try: @@ -55,11 +61,12 @@ def mail(): "id": user.id, "email": user.email }) - + # Handle Images @app.route('/serve-image/', methods=['GET']) def serve_image(filename): + return send_from_directory(app.config['UPLOAD_DIRECTORY'], filename) diff --git a/backend/static/styles.css b/backend/static/styles.css index c8da789..9944d1d 100644 --- a/backend/static/styles.css +++ b/backend/static/styles.css @@ -61,7 +61,7 @@ width: 100%; height: 100%; border-radius: 4px; - object-fit: cover; + object-fit: contain; display: block; } diff --git a/backend/templates/orders.html b/backend/templates/orders.html new file mode 100644 index 0000000..381b40e --- /dev/null +++ b/backend/templates/orders.html @@ -0,0 +1,50 @@ + + + + + + + Kevos orders + + + +
+ +
+ + + + + + + {% for order in orders %} + + + + + + {% endfor %} +
IDEmailOrder
{{ order.id }}{{ order.email }}{{ order.order }}
+
+ +
+ + \ No newline at end of file diff --git a/frontend/public/Group_1/Mockup_97.jpg b/frontend/public/Group_1/Mockup_97.jpg deleted file mode 100644 index 4f7092a..0000000 Binary files a/frontend/public/Group_1/Mockup_97.jpg and /dev/null differ diff --git a/frontend/public/Group_1/design_4-01.png b/frontend/public/Group_1/design_4-01.png deleted file mode 100644 index 00ef35d..0000000 Binary files a/frontend/public/Group_1/design_4-01.png and /dev/null differ diff --git a/frontend/public/Group_1/design_7_update-01.png b/frontend/public/Group_1/design_7_update-01.png deleted file mode 100644 index b55a2a0..0000000 Binary files a/frontend/public/Group_1/design_7_update-01.png and /dev/null differ diff --git a/frontend/public/Group_1/design_8_update-01.png b/frontend/public/Group_1/design_8_update-01.png deleted file mode 100644 index d814c11..0000000 Binary files a/frontend/public/Group_1/design_8_update-01.png and /dev/null differ diff --git a/frontend/public/Group_1/design_update.png b/frontend/public/Group_1/design_update.png deleted file mode 100644 index a8af868..0000000 Binary files a/frontend/public/Group_1/design_update.png and /dev/null differ diff --git a/frontend/public/Group_1/files_list.json b/frontend/public/Group_1/files_list.json deleted file mode 100644 index 7fb68c0..0000000 --- a/frontend/public/Group_1/files_list.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "id": 1, - "name": "files_list", - "photo": "/files_list.json", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 2, - "name": "design_8_update-01", - "photo": "/design_8_update-01.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 3, - "name": "Mockup_97", - "photo": "/Mockup_97.jpg", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 4, - "name": "json_sorter", - "photo": "/json_sorter.py", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 5, - "name": "design_update", - "photo": "/design_update.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 6, - "name": "design_4-01", - "photo": "/design_4-01.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 7, - "name": "design_7_update-01", - "photo": "/design_7_update-01.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 8, - "name": "test_design_never_give_up-01", - "photo": "/test_design_never_give_up-01.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 9, - "name": "mockup_1", - "photo": "/mockup_1.jpg", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - } -] \ No newline at end of file diff --git a/frontend/public/Group_1/mockup_1.jpg b/frontend/public/Group_1/mockup_1.jpg deleted file mode 100644 index c4f346e..0000000 Binary files a/frontend/public/Group_1/mockup_1.jpg and /dev/null differ diff --git a/frontend/public/Group_1/test_design_never_give_up-01.png b/frontend/public/Group_1/test_design_never_give_up-01.png deleted file mode 100644 index fba9f22..0000000 Binary files a/frontend/public/Group_1/test_design_never_give_up-01.png and /dev/null differ diff --git a/frontend/public/Mockup 13.jpg b/frontend/public/Mockup 13.jpg deleted file mode 100644 index f61f17e..0000000 Binary files a/frontend/public/Mockup 13.jpg and /dev/null differ diff --git a/frontend/public/Mockup 72.jpg b/frontend/public/Mockup 72.jpg deleted file mode 100644 index a6cd68a..0000000 Binary files a/frontend/public/Mockup 72.jpg and /dev/null differ diff --git a/frontend/public/Mockup 74.jpg b/frontend/public/Mockup 74.jpg deleted file mode 100644 index 779a9c2..0000000 Binary files a/frontend/public/Mockup 74.jpg and /dev/null differ diff --git a/frontend/public/files_list.json b/frontend/public/files_list.json deleted file mode 100644 index a8c937b..0000000 --- a/frontend/public/files_list.json +++ /dev/null @@ -1,82 +0,0 @@ -[ - { - "id": 1, - "name": "files_list", - "photo": "./files_list.json", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 2, - "name": "design_8_update-01", - "photo": "./design_8_update-01.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 3, - "name": "Mockup_97", - "photo": "./Mockup_97.jpg", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 4, - "name": "design_update", - "photo": "./design_update.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 5, - "name": "design_4-01", - "photo": "./design_4-01.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 6, - "name": "design_7_update-01", - "photo": "./design_7_update-01.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 7, - "name": "test_design_never_give_up-01", - "photo": "./test_design_never_give_up-01.png", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, - { - "id": 8, - "name": "mockup_1", - "photo": "./mockup_1.jpg", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - } -] \ No newline at end of file diff --git a/frontend/src/app/actions/sendEmail.ts b/frontend/src/app/actions/sendEmail.ts index 98daa03..47cac1c 100644 --- a/frontend/src/app/actions/sendEmail.ts +++ b/frontend/src/app/actions/sendEmail.ts @@ -16,12 +16,12 @@ export const sendEmail = async (formData: FormData) => { //only allow authenticated user as well const senderEmail = formData.get('senderEmail'); - const message = formData.get('message'); + const order = formData.get('order'); if (!validateString(senderEmail, 500)){ return{ error: "Invalid sender Email",}; } - if (!validateString(message, 5000)){ + if (!validateString(order, 5000)){ return{ error: "Invalid message",}; } @@ -36,7 +36,7 @@ export const sendEmail = async (formData: FormData) => { subject: "New Order", reply_to: senderEmail as string, // text: message as string, - react: React.createElement(OrderFormEmail, {message: message as string, senderEmail: senderEmail as string}), + react: React.createElement(OrderFormEmail, {order: order as string, senderEmail: senderEmail as string}), }); } catch (error: unknown){ return console.log(error) diff --git a/frontend/src/app/emailTemplates/order-form-email.tsx b/frontend/src/app/emailTemplates/order-form-email.tsx index 7f6c6b7..4e16c0d 100644 --- a/frontend/src/app/emailTemplates/order-form-email.tsx +++ b/frontend/src/app/emailTemplates/order-form-email.tsx @@ -13,11 +13,11 @@ import { import { Tailwind } from "@react-email/tailwind"; type OrderFormEmailProps = { - message: string; + order: string; senderEmail: string; }; -export default function OrderFormEmail({ message, senderEmail }: OrderFormEmailProps) { +export default function OrderFormEmail({ order, senderEmail }: OrderFormEmailProps) { return ( @@ -27,7 +27,7 @@ export default function OrderFormEmail({ message, senderEmail }: OrderFormEmailP
You received a new order from the order form. - {message} + {order}
The sender's email is: {senderEmail}
diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 603de1d..ab5ed77 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -15,6 +15,9 @@ const Popp = Poppins({ weight: "400", subsets: ["latin"] }); // improve to drag & drop side cart for more fun export default function Home() { + const [email, setEmail] = React.useState(""); + const [order, setOrder] = React.useState(""); + const [isOpen, setIsOpen] = React.useState(false); const [showPortal, setShowPortal] = React.useState(false); const handleModal = () => { @@ -69,6 +72,7 @@ export default function Home() {