route handlers for account/main
This commit is contained in:
7
frontend/app/(urls)/account/create_as_deliveler/page.tsx
Normal file
7
frontend/app/(urls)/account/create_as_deliveler/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
const page = () => {
|
||||
return <div>page</div>
|
||||
}
|
||||
|
||||
export default page
|
||||
7
frontend/app/(urls)/account/create_as_sender/page.tsx
Normal file
7
frontend/app/(urls)/account/create_as_sender/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
const page = () => {
|
||||
return <div>page</div>
|
||||
}
|
||||
|
||||
export default page
|
||||
@@ -1,7 +1,115 @@
|
||||
import React from 'react'
|
||||
'use client'
|
||||
|
||||
const page = () => {
|
||||
return <div>page</div>
|
||||
import React from 'react'
|
||||
import { useForm } from '@/app/hooks/useForm'
|
||||
import Button from '@/components/ui/Button'
|
||||
import showToast from '@/components/ui/Toast'
|
||||
import useUserStore from '@/app/store/userStore'
|
||||
import ContactUs from '@/components/ContactUs'
|
||||
import TextInput from '@/components/ui/TextInput'
|
||||
import PhoneInput from '@/components/ui/PhoneInput'
|
||||
|
||||
const validationRules = {
|
||||
firstName: { required: true },
|
||||
lastName: { required: false },
|
||||
phone_number: { required: true },
|
||||
email: { required: true },
|
||||
}
|
||||
|
||||
export default page
|
||||
const AccountPage = () => {
|
||||
const { user } = useUserStore()
|
||||
|
||||
const { values, handleChange, handleSubmit } = useForm(
|
||||
{
|
||||
firstName: user?.name || '',
|
||||
lastName: user?.surname || '',
|
||||
phone_number: user?.phone_number || '',
|
||||
email: user?.email || '',
|
||||
country: user?.country || '',
|
||||
city: user?.city || '',
|
||||
},
|
||||
validationRules,
|
||||
async (values) => {
|
||||
try {
|
||||
// await updateMainTab(values)
|
||||
showToast({ type: 'success', message: 'Данные успешно обновлены!' })
|
||||
} catch {
|
||||
showToast({ type: 'error', message: 'Ой, что то пошло не так..' })
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
if (!user) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<div className="rounded-2xl shadow overflow-hidden">
|
||||
<div className="p-6 bg-white sm:p-8">
|
||||
<div className="space-y-4">
|
||||
<h1 className="text-2xl">Личные данные</h1>
|
||||
<form className="space-y-4" onSubmit={handleSubmit}>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<TextInput
|
||||
name="firstName"
|
||||
value={values.firstName}
|
||||
handleChange={handleChange}
|
||||
label="Имя"
|
||||
placeholder="Ваше имя"
|
||||
style="register"
|
||||
/>
|
||||
<TextInput
|
||||
name="lastName"
|
||||
value={values.lastName}
|
||||
handleChange={handleChange}
|
||||
label="Фамилия"
|
||||
placeholder="Ваша фамилия"
|
||||
style="register"
|
||||
/>
|
||||
<TextInput
|
||||
name="email"
|
||||
value={values.email}
|
||||
handleChange={handleChange}
|
||||
label="Email"
|
||||
placeholder="Ваш email"
|
||||
style="register"
|
||||
/>
|
||||
<PhoneInput
|
||||
value={values.phone_number}
|
||||
handleChange={handleChange}
|
||||
operatorsInfo={false}
|
||||
/>
|
||||
<TextInput
|
||||
name="country"
|
||||
value={values.country}
|
||||
handleChange={handleChange}
|
||||
label="Страна"
|
||||
placeholder="Ваша страна проживания"
|
||||
style="register"
|
||||
/>
|
||||
<TextInput
|
||||
name="city"
|
||||
value={values.city}
|
||||
handleChange={handleChange}
|
||||
label="Город"
|
||||
placeholder="Ваш город проживания"
|
||||
style="register"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
text="Сохранить изменения"
|
||||
className="text-sm font-semibold py-4 px-6 bg-orange text-white flex items-center rounded-2xl whitespace-nowrap"
|
||||
type="submit"
|
||||
/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ContactUs />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AccountPage
|
||||
|
||||
7
frontend/app/(urls)/account/payments/page.tsx
Normal file
7
frontend/app/(urls)/account/payments/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
const page = () => {
|
||||
return <div>page</div>
|
||||
}
|
||||
|
||||
export default page
|
||||
7
frontend/app/(urls)/account/routes/page.tsx
Normal file
7
frontend/app/(urls)/account/routes/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
const page = () => {
|
||||
return <div>page</div>
|
||||
}
|
||||
|
||||
export default page
|
||||
@@ -2,10 +2,10 @@ import React from 'react'
|
||||
import { useForm } from '@/app/hooks/useForm'
|
||||
import Button from '@/components/ui/Button'
|
||||
// import LoginButton from '@/app/components/ui/LoginButton'
|
||||
import { HiOutlineEye, HiOutlineEyeOff } from 'react-icons/hi'
|
||||
import showToast from '@/components/ui/Toast'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { signIn } from 'next-auth/react'
|
||||
import TextInput from '@/components/ui/TextInput'
|
||||
// import PasswordRecovery from '@/app/components/ui/PasswordRecovery'
|
||||
|
||||
const validationRules = {
|
||||
@@ -52,50 +52,32 @@ const ClientView = () => {
|
||||
return (
|
||||
<>
|
||||
<form className="flex flex-col gap-1" onSubmit={handleSubmit}>
|
||||
<div className="mb-2">
|
||||
<label className="block mb-2 text-gray-700" htmlFor="email">
|
||||
Ваш email:
|
||||
</label>
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
placeholder="my_email@gmail.com"
|
||||
value={values.email}
|
||||
onChange={handleChange}
|
||||
className="w-full px-3 py-2 border text-black rounded-xl focus:outline-none focus:ring-2 focus:ring-mainblocks"
|
||||
autoComplete="true"
|
||||
/>
|
||||
</div>
|
||||
<TextInput
|
||||
value={values.email}
|
||||
name="email"
|
||||
handleChange={handleChange}
|
||||
placeholder="my_email@gmail.com"
|
||||
style="register"
|
||||
label="Ваш еmail"
|
||||
/>
|
||||
|
||||
<div className="mb-4">
|
||||
<label className="block mb-2 text-gray-700" htmlFor="email">
|
||||
Ваш пароль:
|
||||
</label>
|
||||
<div className="relative">
|
||||
<input
|
||||
type={isVisible ? 'text' : 'password'}
|
||||
id="password"
|
||||
placeholder="Пароль"
|
||||
value={values.password}
|
||||
onChange={handleChange}
|
||||
className="w-full px-3 py-2 border text-black rounded-xl focus:outline-none focus:ring-2 focus:ring-mainblocks"
|
||||
autoComplete="true"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => togglePasswordVisibility()}
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700"
|
||||
>
|
||||
{isVisible ? <HiOutlineEye /> : <HiOutlineEyeOff />}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<TextInput
|
||||
value={values.password}
|
||||
name="password"
|
||||
handleChange={handleChange}
|
||||
placeholder="Не менее 8 символов"
|
||||
style="register"
|
||||
label="Ваш пароль"
|
||||
isPassword={true}
|
||||
isVisible={isVisible}
|
||||
togglePasswordVisibility={togglePasswordVisibility}
|
||||
/>
|
||||
{/* <div className="flex flex-row-reverse text-sm justify-between pb-2">
|
||||
<PasswordRecovery />
|
||||
</div> */}
|
||||
<Button
|
||||
text="Войти"
|
||||
className="flex items-center justify-center bg-black rounded-2xl text-white text-base font-semibold py-3"
|
||||
className="flex items-center justify-center bg-orange rounded-2xl text-white text-base font-semibold py-3 mt-3"
|
||||
type="submit"
|
||||
/>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user