From 17a1d49bdddd938f8543c2507abf19e8a69e8f09 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 13:56:48 +0000 Subject: [PATCH 1/7] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- src/components/PlansSection.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PlansSection.tsx b/src/components/PlansSection.tsx index dd1ad13..99b9068 100644 --- a/src/components/PlansSection.tsx +++ b/src/components/PlansSection.tsx @@ -24,13 +24,13 @@ const formSchema = z.object({ företag: z.string().trim().min(1, "Fyll i företagsnamn").max(100), epost: z.string().trim().email("Ange en giltig e-postadress").max(255), telefon: z.string().trim().max(30).optional(), - adress: z.string().trim().max(200).optional(), + adress: z.string().trim().min(1, "Fyll i leveransadress").max(200), postnummer: z .string() .trim() .min(1, "Fyll i postnummer") .refine(isStockholmPostalCode, "Vi levererar endast inom Storstockholm (100 00 – 199 99)"), - stad: z.string().trim().max(100).optional(), + stad: z.string().trim().min(1, "Fyll i stad").max(100), kommentarer: z.string().trim().max(1000).optional(), }); From c0cd46bfe4d8342fbbc0eae07e62939f297afa59 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 13:56:55 +0000 Subject: [PATCH 2/7] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- src/components/PlansSection.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PlansSection.tsx b/src/components/PlansSection.tsx index 99b9068..7587160 100644 --- a/src/components/PlansSection.tsx +++ b/src/components/PlansSection.tsx @@ -118,9 +118,9 @@ const PlansSection = () => { company: result.data.företag, email: result.data.epost, phone: result.data.telefon ?? "", - address: result.data.adress ?? "", + address: result.data.adress, postal_code: result.data.postnummer, - city: "Storstockholm", + city: result.data.stad, comments: result.data.kommentarer ?? "", return_url: `${window.location.origin}/order-confirmation?session_id={CHECKOUT_SESSION_ID}&method=card&kg=${recommendedKg}&email=${encodeURIComponent(result.data.epost)}`, environment: getStripeEnvironment(), From 68df7df7b6aa20a88f90a2eb491be51f55e1b5b9 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 13:57:07 +0000 Subject: [PATCH 3/7] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- src/components/PlansSection.tsx | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/components/PlansSection.tsx b/src/components/PlansSection.tsx index 7587160..69bbc27 100644 --- a/src/components/PlansSection.tsx +++ b/src/components/PlansSection.tsx @@ -371,16 +371,23 @@ const PlansSection = () => {
- + + {errors.adress && ( +

{errors.adress}

+ )}
-
+
+
+ + + {errors.stad && ( +

{errors.stad}

+ )} +
From 88a29680734a2507a4d31483bf54306ced0d8aa5 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 13:57:20 +0000 Subject: [PATCH 4/7] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- src/components/PlansSection.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/PlansSection.tsx b/src/components/PlansSection.tsx index 69bbc27..0f2147b 100644 --- a/src/components/PlansSection.tsx +++ b/src/components/PlansSection.tsx @@ -67,7 +67,7 @@ const PlansSection = () => { (async () => { const { data } = await supabase .from("profiles") - .select("company_name, phone, street_address, postal_code") + .select("company_name, phone, street_address, postal_code, city") .eq("user_id", user.id) .maybeSingle(); setForm((prev) => ({ @@ -77,6 +77,7 @@ const PlansSection = () => { telefon: prev.telefon || data?.phone || "", adress: prev.adress || data?.street_address || "", postnummer: prev.postnummer || data?.postal_code || "", + stad: prev.stad || data?.city || "", })); })(); }, [user, showForm]); From 952798d00803c978c83201c00b17e24fa1ba7191 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 13:57:25 +0000 Subject: [PATCH 5/7] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- supabase/functions/create-checkout/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supabase/functions/create-checkout/index.ts b/supabase/functions/create-checkout/index.ts index 43f7782..c204b28 100644 --- a/supabase/functions/create-checkout/index.ts +++ b/supabase/functions/create-checkout/index.ts @@ -100,9 +100,9 @@ const BodySchema = z.object({ company: z.string().trim().min(1).max(200), email: z.string().trim().email().max(255), phone: z.string().trim().max(30).optional().default(""), - address: z.string().trim().max(200).optional().default(""), + address: z.string().trim().min(1).max(200), postal_code: z.string().trim().min(1).max(20), - city: z.string().trim().max(100).optional().default(""), + city: z.string().trim().min(1).max(100), comments: z.string().trim().max(1000).optional().default(""), return_url: z.string().url(), environment: z.enum(["sandbox", "live"]), From 8b554bb16c358434a5a2af74d560174206dbce5e Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 13:57:29 +0000 Subject: [PATCH 6/7] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- supabase/functions/create-checkout/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supabase/functions/create-checkout/index.ts b/supabase/functions/create-checkout/index.ts index c204b28..11eb29a 100644 --- a/supabase/functions/create-checkout/index.ts +++ b/supabase/functions/create-checkout/index.ts @@ -56,7 +56,7 @@ async function insertOrder(row: { leverans: { adress: b.address, postnummer: cleaned, - stad: "Storstockholm", + stad: b.city, }, telefon: b.phone, kommentarer: b.comments, From 3c79784ff4b4f8295b7e269d8137c49d42792c80 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 13:57:43 +0000 Subject: [PATCH 7/7] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- src/components/admin/OrdersTable.tsx | 71 +++++++++++++++++++--------- 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/src/components/admin/OrdersTable.tsx b/src/components/admin/OrdersTable.tsx index d1b0613..e268030 100644 --- a/src/components/admin/OrdersTable.tsx +++ b/src/components/admin/OrdersTable.tsx @@ -93,6 +93,7 @@ export function OrdersTable() { Ordernummer Kund + Leveransadress Datum Status Belopp @@ -101,33 +102,57 @@ export function OrdersTable() { {filteredOrders?.length === 0 ? ( - + Inga ordrar hittades ) : ( - filteredOrders?.map((order) => ( - - {order.order_number} - -
-
{order.customer_name || "—"}
-
{order.customer_email}
-
-
- - {format(new Date(order.created_at), "d MMM yyyy, HH:mm", { locale: sv })} - - - - {statusLabels[order.status] || order.status} - - - - {Number(order.total_amount).toLocaleString("sv-SE")} {order.currency} - -
- )) + filteredOrders?.map((order) => { + const item = Array.isArray(order.items) ? order.items[0] : null; + const lev = item?.leverans; + const phone = item?.telefon; + const comments = item?.kommentarer; + return ( + + {order.order_number} + +
+
{order.customer_name || "—"}
+
{order.customer_email}
+ {phone &&
{phone}
} +
+
+ + {lev ? ( +
+
{lev.adress || "—"}
+
+ {[lev.postnummer, lev.stad].filter(Boolean).join(" ")} +
+ {comments && ( +
+ "{comments}" +
+ )} +
+ ) : ( + + )} +
+ + {format(new Date(order.created_at), "d MMM yyyy, HH:mm", { locale: sv })} + + + + {statusLabels[order.status] || order.status} + + + + {Number(order.total_amount).toLocaleString("sv-SE")} {order.currency} + +
+ ); + }) )}