Skip to content

Commit

Permalink
fix sign up and organisation sign up
Browse files Browse the repository at this point in the history
  • Loading branch information
Fullstack Mechanic authored and Fullstack Mechanic committed Jul 25, 2024
1 parent f08cf99 commit ae1fa9a
Show file tree
Hide file tree
Showing 5 changed files with 280 additions and 111 deletions.
5 changes: 5 additions & 0 deletions src/app/(auth-routes)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import Footer from "~/components/layouts/footer";
import Navbar from "~/components/layouts/navbar";

function Layout({ children }: { children: React.ReactNode }) {
return (
<>
<Navbar />
<div className="mx-auto w-5/6">{children}</div>
<Footer />
</>
);
}
Expand Down
177 changes: 132 additions & 45 deletions src/app/(auth-routes)/register/organisation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,37 @@ const formSchema = z.object({
fullname: z.string().min(2, {
message: "Fullname must be at least 2 characters.",
}),
email: z.string().min(2, {
message: "Email must be at least 2 characters.",
email: z.string().email({
message: "Email must be a valid email address.",
}),
password: z.string().min(2, {
message: "Password must be at least 2 characters.",
}),
companyName: z.string().min(2, {
message: "Company name must be at least 2 characters.",
}),
companyEmail: z.string().email({
message: "Company email must be a valid email address.",
}),
industry: z.string().min(1, {
message: "Please select an industry.",
}),
organizationType: z.string().min(1, {
message: "Please select an organization type.",
}),
country: z.string().min(1, {
message: "Please select a country.",
}),
state: z.string().min(1, {
message: "Please select a state.",
}),
address: z.string().min(1, {
message: "Please enter company address.",
}),
});

type FormData = z.infer<typeof formSchema>;

// Updated onSubmit function with unused parameter prefixed

function Organisation() {
const form = useForm<FormData>({
resolver: zodResolver(formSchema),
Expand All @@ -56,10 +75,10 @@ function Organisation() {

<div className="mx-auto w-2/4">
<Form {...form}>
<form className="space-y-8">
<form className="space-y-6">
<FormField
control={form.control}
name="fullname"
name="companyName"
render={({ field }) => (
<FormItem className="flex flex-col gap-2">
<div>
Expand All @@ -72,6 +91,14 @@ function Organisation() {
</FormControl>
<FormMessage />
</div>
</FormItem>
)}
/>
<FormField
control={form.control}
name="companyEmail"
render={({ field }) => (
<FormItem className="flex flex-col gap-2">
<div>
<FormLabel>Company Email Address</FormLabel>
<FormControl>
Expand All @@ -82,62 +109,123 @@ function Organisation() {
</FormControl>
<FormMessage />
</div>
<div className="flex gap-4">
</FormItem>
)}
/>
<div className="flex gap-4">
<FormField
control={form.control}
name="industry"
render={({ field }) => (
<FormItem className="flex w-full flex-col gap-2">
<div className="w-full">
<FormLabel>Industry</FormLabel>
<Select>
<SelectTrigger className="">
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectItem value="light">Technology</SelectItem>
</SelectContent>
</Select>
<FormControl>
<Select
onValueChange={field.onChange}
value={field.value || ""}
>
<SelectTrigger>
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectItem value="Technology">
Technology
</SelectItem>
</SelectContent>
</Select>
</FormControl>
<FormMessage />
</div>

</FormItem>
)}
/>
<FormField
control={form.control}
name="organizationType"
render={({ field }) => (
<FormItem className="flex w-full flex-col gap-2">
<div className="w-full">
<FormLabel>Organization Type</FormLabel>
<Select>
<SelectTrigger className="">
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectItem value="light">Entertainment</SelectItem>
</SelectContent>
</Select>
<FormControl>
<Select
onValueChange={field.onChange}
value={field.value || ""}
>
<SelectTrigger>
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectItem value="Entertainment">
Entertainment
</SelectItem>
</SelectContent>
</Select>
</FormControl>
<FormMessage />
</div>
</div>

<div className="flex flex-col gap-2">
<h1 className="text-md">Company Address</h1>
<div className="flex gap-4">
<div className="w-full">
<FormLabel>Country</FormLabel>
<Select>
<SelectTrigger className="">
</FormItem>
)}
/>
</div>
<div className="flex flex-col gap-2">
<h1 className="text-md">Company Address</h1>
<div className="flex gap-4">
<FormField
control={form.control}
name="country"
render={({ field }) => (
<div className="w-full">
<FormLabel>Country</FormLabel>
<FormControl>
<Select
onValueChange={field.onChange}
value={field.value || ""}
>
<SelectTrigger>
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectItem value="light">Nigeria</SelectItem>
<SelectItem value="Nigeria">Nigeria</SelectItem>
</SelectContent>
</Select>
</div>

<div className="w-full">
<FormLabel>State</FormLabel>
<Select>
<SelectTrigger className="">
</FormControl>
<FormMessage />
</div>
)}
/>
<FormField
control={form.control}
name="state"
render={({ field }) => (
<div className="w-full">
<FormLabel>State</FormLabel>
<FormControl>
<Select
onValueChange={field.onChange}
value={field.value || ""}
>
<SelectTrigger>
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectItem value="light">Lagos</SelectItem>
<SelectItem value="Lagos">Lagos</SelectItem>
</SelectContent>
</Select>
</div>
</FormControl>
<FormMessage />
</div>
</div>
)}
/>
</div>
</div>
<FormField
control={form.control}
name="address"
render={({ field }) => (
<FormItem className="flex flex-col gap-2">
<div>
<FormLabel>Address</FormLabel>
<FormLabel>Company Address</FormLabel>
<FormControl>
<Input
placeholder="Enter your company address"
Expand All @@ -152,7 +240,6 @@ function Organisation() {
<Button type="submit" className="w-full">
Create Account
</Button>

<div className="flex justify-center gap-2">
<p className="text-sm">Already Have An Account?</p>
<Link className="text-sm text-orange-500" href={"#"}>
Expand Down
Loading

0 comments on commit ae1fa9a

Please sign in to comment.