diff --git a/src/routes/shirts/+page.server.ts b/src/routes/shirts/+page.server.ts new file mode 100644 index 0000000..9f77f65 --- /dev/null +++ b/src/routes/shirts/+page.server.ts @@ -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: ` + // + // + // + //

new order for ${order.name}!!

+ //
 ${JSON.stringify(order, null, 2).replace(/&/g, '&').replace(//g, '>')} 
+ // + // { + // if (error) { + // console.error("Error sending email:", error); + // } else { + // console.log("Email sent successfully:", info.response); + // } + // }) + } +} + + diff --git a/src/routes/shirts/+page.svelte b/src/routes/shirts/+page.svelte new file mode 100644 index 0000000..39f6cf5 --- /dev/null +++ b/src/routes/shirts/+page.svelte @@ -0,0 +1,212 @@ + + +
+
+ Shirt Styles +

+ All these shirts are 6.1 ounce, 100% cotton (unless you get the heather or + safety colors). It makes them a little heavier; but they actually survive + active wear as a work shirt. Of course with the resplendent pocket. +

+ +
+
+ Request +
+ + +
+
+ + +
+
+ + {shirts.length} shirt{shirts.length > 1 ? "s" : ""} for roughly ≈ + {USD.format(estimated_price)} + + + +
+ +
+
    + {#each shirts as shirt, i} +
  • +

    Shirt #{i + 1}

    +
    + + +
    +
    + + +
    +
    + + +
    + +
  • + {/each} +
+
+ +
+
+ +