ИНН и описание
This commit is contained in:
@@ -9,6 +9,7 @@ import { useRouter } from "next/navigation"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Textarea } from "@/components/ui/textarea"
|
||||
import { Checkbox } from "@/components/ui/checkbox"
|
||||
import {
|
||||
Form,
|
||||
@@ -32,6 +33,9 @@ const registerSchema = z.object({
|
||||
isCompany: z.boolean(),
|
||||
companyName: z.string().optional(),
|
||||
inn: z.string().optional(),
|
||||
description: z.string()
|
||||
.max(2048, "Описание не может превышать 2048 символов")
|
||||
.optional(),
|
||||
password: z.string().min(6, "Пароль должен быть не менее 6 символов"),
|
||||
confirmPassword: z.string().min(6),
|
||||
}).refine((data) => data.password === data.confirmPassword, {
|
||||
@@ -60,6 +64,7 @@ export function RegisterForm() {
|
||||
isCompany: false,
|
||||
companyName: "",
|
||||
inn: "",
|
||||
description: "",
|
||||
password: "",
|
||||
confirmPassword: "",
|
||||
},
|
||||
@@ -88,6 +93,11 @@ export function RegisterForm() {
|
||||
}
|
||||
}
|
||||
|
||||
// Добавляем описание
|
||||
if (values.description) {
|
||||
submitData.description = values.description;
|
||||
}
|
||||
|
||||
await register(submitData)
|
||||
router.push("/auth/login")
|
||||
} catch (error) {
|
||||
@@ -115,7 +125,11 @@ export function RegisterForm() {
|
||||
<FormItem>
|
||||
<FormLabel>Имя</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="Иван" {...field} />
|
||||
<Input
|
||||
placeholder="Иван"
|
||||
value={field.value || ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -128,7 +142,11 @@ export function RegisterForm() {
|
||||
<FormItem>
|
||||
<FormLabel>Фамилия</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="Иванов" {...field} />
|
||||
<Input
|
||||
placeholder="Иванов"
|
||||
value={field.value || ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -143,7 +161,11 @@ export function RegisterForm() {
|
||||
<FormItem>
|
||||
<FormLabel>Телефон</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="+7 (999) 000-00-00" {...field} />
|
||||
<Input
|
||||
placeholder="+7 (999) 000-00-00"
|
||||
value={field.value || ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -177,7 +199,11 @@ export function RegisterForm() {
|
||||
<FormItem>
|
||||
<FormLabel>Название компании</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="ООО 'Ромашка'" {...field} />
|
||||
<Input
|
||||
placeholder="ООО 'Ромашка'"
|
||||
value={field.value || ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -190,7 +216,12 @@ export function RegisterForm() {
|
||||
<FormItem>
|
||||
<FormLabel>ИНН</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="1234567890" maxLength={10} {...field} />
|
||||
<Input
|
||||
placeholder="1234567890"
|
||||
maxLength={10}
|
||||
value={field.value || ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -199,6 +230,30 @@ export function RegisterForm() {
|
||||
</>
|
||||
)}
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="description"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Описание (необязательно)</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea
|
||||
placeholder={isCompany ? "Расскажите о вашей компании... Вы можете использовать переносы строк для структурирования текста." : "Расскажите о себе и вашем опыте... Вы можете использовать переносы строк для структурирования текста."}
|
||||
maxLength={2048}
|
||||
rows={4}
|
||||
className="whitespace-pre-wrap"
|
||||
value={field.value || ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<p className="text-xs text-muted-foreground mt-1">
|
||||
Поддерживаются переносы строк. Максимум 2048 символов.
|
||||
</p>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="password"
|
||||
@@ -206,7 +261,12 @@ export function RegisterForm() {
|
||||
<FormItem>
|
||||
<FormLabel>Пароль</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" placeholder="******" {...field} />
|
||||
<Input
|
||||
type="password"
|
||||
placeholder="******"
|
||||
value={field.value || ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -219,7 +279,12 @@ export function RegisterForm() {
|
||||
<FormItem>
|
||||
<FormLabel>Подтвердите пароль</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" placeholder="******" {...field} />
|
||||
<Input
|
||||
type="password"
|
||||
placeholder="******"
|
||||
value={field.value || ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
||||
Reference in New Issue
Block a user