added the shirts form. It mostly works except for deleting shirts
doesn't work as one would expect
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
export async function load({ }) {
|
||||
console.log("shirt preorder page")
|
||||
}
|
||||
|
||||
import { SMTP_USERNAME } from '$env/static/private'
|
||||
import { transporter } from "$lib/email"
|
||||
export const actions = {
|
||||
default: async ({ request }) => {
|
||||
let data = await request.formData();
|
||||
// console.log("apply", data);
|
||||
let order = {
|
||||
name: data.get('name'),
|
||||
email: data.get('email'),
|
||||
amount: data.get('amount'),
|
||||
estimated_price: data.get('estimated_price'),
|
||||
}
|
||||
console.log("appl", order, data)
|
||||
|
||||
const shirt_string = "test"
|
||||
// const shirt_string = [
|
||||
// shirt.name,
|
||||
// shirt.city,
|
||||
// shirt.contact?.name,
|
||||
// ].map(v => {
|
||||
// // Escape for CSV safety
|
||||
// const s = String(v ?? '');
|
||||
// return s.includes(',') || s.includes('"') ? `"${s.replace(/"/g, '""')}"` : s;
|
||||
// }).join(', ');
|
||||
|
||||
console.log(shirt_string)
|
||||
// transporter.sendMail({
|
||||
// from: SMTP_USERNAME,
|
||||
// to: "farm@sludge.link",
|
||||
// subject: "Sludge Farm Shirt Preorder",
|
||||
// attachments: [{
|
||||
// filename: order.name + '-shirts.csv',
|
||||
// content: shirt_string
|
||||
// },
|
||||
// {
|
||||
// filename: order.name + '-shirts.json',
|
||||
// content: JSON.stringify(order)
|
||||
// }
|
||||
// ],
|
||||
// html: `
|
||||
// <!doctype html>
|
||||
// <html>
|
||||
// <body>
|
||||
// <h1>new order for ${order.name}!!</h1>
|
||||
// <pre> ${JSON.stringify(order, null, 2).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')} </pre>
|
||||
// </body>
|
||||
// </html
|
||||
// `
|
||||
// }, (error, info) => {
|
||||
// if (error) {
|
||||
// console.error("Error sending email:", error);
|
||||
// } else {
|
||||
// console.log("Email sent successfully:", info.response);
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user