From a13a6112f9efe9c1c8cacbc6464c94eff1428648 Mon Sep 17 00:00:00 2001 From: Naytitorn Chaovirachot Date: Mon, 14 Oct 2024 01:04:50 +0700 Subject: [PATCH] finalize json format, still not put to database --- src/app/business/apply/page.tsx | 52 ++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/app/business/apply/page.tsx b/src/app/business/apply/page.tsx index 96a7ce0..66ad4b1 100644 --- a/src/app/business/apply/page.tsx +++ b/src/app/business/apply/page.tsx @@ -19,12 +19,14 @@ export default function Apply() { const [companyName, setCompanyName] = useState(""); const [selectedIndustry, setSelectedIndustry] = useState(""); - const [industry, setIndustry] = useState([]); - + const [moneyRaisedToDate, setMoneyRaisedToDate] = useState(""); const [isInUS, setIsInUS] = useState(""); const [isForSale, setIsForSale] = useState(""); - const [isGenerating, setIsGenerating] = useState(""); - const [pitch, setPitch] = useState(""); + const [isGeneratingRevenue, setIsGeneratingRevenue] = useState(""); + const [businessPitch, setBusinessPitch] = useState(""); + const [selectedCommunitySize, setSelectedCommunitySize] = useState(""); + + const [industry, setIndustry] = useState([]); const communitySize = [ "N/A", "0-5K", @@ -35,9 +37,10 @@ export default function Apply() { "100K+", ]; + // move to lib? const fetchIndustry = async () => { let { data: BusinessType, error } = await supabase - .from("BusinessType") + .from("business_type") .select("value"); if (!BusinessType) { @@ -50,14 +53,22 @@ export default function Apply() { fetchIndustry(); }, []); - /* temp */ - let format = { + const createFormat = () => ({ "Company Name: ": companyName, "Industry": selectedIndustry, - } + "Money Raised to Date": moneyRaisedToDate, + "Is in USA": isInUS, + "Is for sale": isForSale, + "Is generating revenue": isGeneratingRevenue, + "Business Pitch": businessPitch, + "Community Size": selectedCommunitySize, + "Created At": new Date().toString() + }); - /* TEMP log */ - const submitApplication = () => alert(JSON.stringify(format)); + const submitApplication = () => { + let format = createFormat(); + alert(JSON.stringify(format)); + } return (
@@ -126,6 +137,7 @@ export default function Apply() {
setMoneyRaisedToDate(event.target.value)} type="text" id="companyName" className="w-96" @@ -210,15 +222,15 @@ export default function Apply() {
community?
- setSelectedCommunitySize(value)}>