route handler + backend api

This commit is contained in:
2025-05-22 11:45:25 +03:00
parent 5ad12c34cd
commit 5ba9121f33
7 changed files with 220 additions and 36 deletions

View File

@@ -8,6 +8,7 @@ import Button from '@/components/ui/Button'
import TextAreaInput from '@/components/ui/TextAreaInput'
import CheckboxInput from '@/components/ui/CheckboxInput'
import { useForm } from '@/app/hooks/useForm'
import useUserStore from '@/app/store/userStore'
import showToast from '@/components/ui/Toast'
import { SenderPageProps, SelectOption } from '@/app/types'
import {
@@ -41,7 +42,7 @@ const validationRules = {
required: true,
pattern: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/,
},
contact_number: {
phone_number: {
required: true,
minLength: 11,
pattern: /^\+?[0-9]{11,}$/,
@@ -51,6 +52,7 @@ const validationRules = {
}
const SenderPage = () => {
const { user, setUser } = useUserStore()
const today = formatDateToHTML(new Date())
const initialValues: SenderPageProps = {
@@ -62,7 +64,7 @@ const SenderPage = () => {
cargo_type: '',
departure: '',
arrival: '',
contact_number: '',
phone_number: user?.phone_number || '',
comment: '',
email_notification: false,
}
@@ -240,7 +242,7 @@ const SenderPage = () => {
<h2 className="mb-2 text-xl font-medium text-gray-900">Контактная информация</h2>
<div className="space-y-6">
<PhoneInput
value={values.contact_number}
value={values.phone_number}
handleChange={handleChange}
label="Контактный телефон"
operatorsInfo={false}