A bug fixed
parent
1f932149d9
commit
a5a3c48a61
|
|
@ -124,6 +124,7 @@ export default function FollowUp() {
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
|
type="password"
|
||||||
placeholder="رمز عبور خود را وارد کنید"
|
placeholder="رمز عبور خود را وارد کنید"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,9 @@ export default function RequestStep0() {
|
||||||
{RequestItems.map((item, index) => {
|
{RequestItems.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
className="group bg-white border shadow-md rounded-lg p-10 h-64 w-64 flex items-end justify-center z-10 relative
|
className="group bg-white border shadow-md rounded-lg p-10 h-64 w-64 flex z-10 relative
|
||||||
hover:bg-blue transition-all duration-700 ease-in-out text-center
|
hover:bg-blue transition-all duration-700 ease-in-out text-center
|
||||||
|
flex-col items-center justify-end gap-2
|
||||||
hover:flex-col-reverse hover:justify-evenly hover:items-center hover:cursor-pointer
|
hover:flex-col-reverse hover:justify-evenly hover:items-center hover:cursor-pointer
|
||||||
max-lg:w-52 max-lg:h-52 max-md:w-40 max-md:h-40
|
max-lg:w-52 max-lg:h-52 max-md:w-40 max-md:h-40
|
||||||
max-lg:p-8 max-md:p-5 max-sm:p-2 hover:max-lg:p-2
|
max-lg:p-8 max-md:p-5 max-sm:p-2 hover:max-lg:p-2
|
||||||
|
|
@ -37,6 +38,9 @@ export default function RequestStep0() {
|
||||||
<p className=" z-10 text-base text-black group-hover:text-white max-md:text-sm">
|
<p className=" z-10 text-base text-black group-hover:text-white max-md:text-sm">
|
||||||
{item.name}
|
{item.name}
|
||||||
</p>
|
</p>
|
||||||
|
<p className=" z-10 text-xs text-center font-medium group-hover:hidden">
|
||||||
|
{item.description}
|
||||||
|
</p>
|
||||||
|
|
||||||
<Image
|
<Image
|
||||||
alt="icon"
|
alt="icon"
|
||||||
|
|
@ -46,7 +50,7 @@ export default function RequestStep0() {
|
||||||
quality={100}
|
quality={100}
|
||||||
key={index}
|
key={index}
|
||||||
className={cn(
|
className={cn(
|
||||||
" w-[80%] h-[80%] absolute left-8 top-6 group-hover:hidden max-md:h-[60%] max-md:w-[60%] max-md:left-auto",
|
" w-[60%] h-[60%] absolute left-12 top-6 group-hover:hidden max-md:h-[60%] max-md:w-[60%] max-md:left-auto",
|
||||||
item.id == 3 && "left-2"
|
item.id == 3 && "left-2"
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ export default function RequestStep2() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [file, setFile] = useState<File[]>([]);
|
const [file, setFile] = useState<File[]>([]);
|
||||||
const [charCount, setCharCount] = useState(0);
|
const [charCount, setCharCount] = useState(0);
|
||||||
|
const [charCountPerson, setCharCountPerson] = useState(0);
|
||||||
|
|
||||||
// Queries
|
// Queries
|
||||||
const { data: optionsData, isLoading: isLoadingData } = useQuery({
|
const { data: optionsData, isLoading: isLoadingData } = useQuery({
|
||||||
|
|
@ -81,7 +82,13 @@ export default function RequestStep2() {
|
||||||
OrganizationId: z.string({
|
OrganizationId: z.string({
|
||||||
required_error: "لطفا دستگاه مربوطه را انتخاب نمایید.",
|
required_error: "لطفا دستگاه مربوطه را انتخاب نمایید.",
|
||||||
}),
|
}),
|
||||||
person: z.string().optional(),
|
person: z.string()
|
||||||
|
.min(1, {
|
||||||
|
message: "لطفا نام فرد مورد نظر را بنویسید.",
|
||||||
|
})
|
||||||
|
.max(50, {
|
||||||
|
message: "تعداد کاراکترها بیشتر از حد مجاز میباشد.",
|
||||||
|
}),
|
||||||
description: z
|
description: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, {
|
.min(1, {
|
||||||
|
|
@ -197,19 +204,21 @@ export default function RequestStep2() {
|
||||||
setCharCount(newCharCount);
|
setCharCount(newCharCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handlePersonCharCountChange(
|
||||||
|
event: React.ChangeEvent<HTMLInputElement>
|
||||||
|
) {
|
||||||
|
const newCharCount = event.target.value.length;
|
||||||
|
// Update charCount only when the user types or removes characters
|
||||||
|
if (newCharCount <= 50) {
|
||||||
|
setCharCountPerson(newCharCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Add the useEffect hook to monitor changes in the description field
|
// Add the useEffect hook to monitor changes in the description field
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCharCount(form.watch("description").length);
|
setCharCount(form.watch("description").length);
|
||||||
}, [form.watch("description")]);
|
}, [form.watch("description")]);
|
||||||
|
|
||||||
function handleDescriptionChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
|
|
||||||
const newCharCount = event.target.value.length;
|
|
||||||
// Update charCount only when the user types or removes characters
|
|
||||||
if (newCharCount <= optionsData?.maxTextLength) {
|
|
||||||
setCharCount(newCharCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
@ -351,12 +360,27 @@ export default function RequestStep2() {
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full sm:w-[48%]">
|
<FormItem className=" w-full sm:w-[48%]">
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
فرد مربوطه
|
فرد مرتبط({charCountPerson}/{50})
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="نام فرد مورد نظر خود را بنویسید"
|
placeholder="نام فرد مورد نظر خود را بنویسید"
|
||||||
{...field}
|
{...field}
|
||||||
|
onChange={(e) => {
|
||||||
|
const currentValue = e.target.value;
|
||||||
|
if (currentValue.length <= 50) {
|
||||||
|
field.onChange(e);
|
||||||
|
handlePersonCharCountChange(e);
|
||||||
|
} else {
|
||||||
|
// Truncate the value to the allowed limit
|
||||||
|
field.onChange(
|
||||||
|
currentValue.substring(
|
||||||
|
0,
|
||||||
|
50
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export const boxItems = [
|
||||||
name: " گزارش فساد",
|
name: " گزارش فساد",
|
||||||
icon: "/img/box1.svg",
|
icon: "/img/box1.svg",
|
||||||
icon2: "/img/box1-hover.svg",
|
icon2: "/img/box1-hover.svg",
|
||||||
description: "ارسال گزارش با احراز هویت",
|
description: "ارسال گزارش ",
|
||||||
link: "/RequestStep0",
|
link: "/RequestStep0",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue