a bug fixed

Kahdooei
yasaman 2024-02-13 15:10:05 +03:30
parent 7bb9b1a621
commit bb50eabb35
1 changed files with 14 additions and 8 deletions

View File

@ -65,6 +65,7 @@ interface Organization {
export default function RequestStep2() {
const router = useRouter();
const [file, setFile] = useState<File[]>([]);
const [charCount, setCharCount] = useState(0);
// Queries
const { data: optionsData, isLoading: isLoadingData } = useQuery({
@ -86,7 +87,7 @@ export default function RequestStep2() {
.min(1, {
message: "لطفا توضیحات خود را بنویسید.",
})
.max(300, {
.max(1024, {
message: "تعداد کاراکترها بیشتر از حد مجاز میباشد.",
}),
uploadFile: z
@ -133,7 +134,7 @@ export default function RequestStep2() {
mutationFn: postAuthorizedComplaintSubmit,
onSuccess: (res) => {
const currentDate = new Date();
const formattedDate = currentDate.toISOString()
const formattedDate = currentDate.toISOString();
localStorage.setItem("trackingNumber", res.trackingNumber);
localStorage.setItem("password", res.password);
@ -187,6 +188,11 @@ export default function RequestStep2() {
},
});
// Add the useEffect hook to monitor changes in the description field
useEffect(() => {
setCharCount(form.watch("description").length);
}, [form.watch("description")]);
function onSubmit(data: z.infer<typeof FormSchema>) {
console.log(data);
const formData = new FormData();
@ -260,11 +266,11 @@ export default function RequestStep2() {
render={({ field }) => (
<FormItem>
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
*موضوع شکایت
*موضوع گزارش
</FormLabel>
<FormControl>
<Input
placeholder="موضوع شکایت خود را بنویسید"
placeholder="موضوع گزارش خود را بنویسید"
{...field}
/>
</FormControl>
@ -279,7 +285,7 @@ export default function RequestStep2() {
render={({ field }) => (
<FormItem className=" w-full sm:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
*دستگاه مربوطه
*واحد مورد گزارش
</FormLabel>
<Select
onValueChange={field.onChange}
@ -293,7 +299,7 @@ export default function RequestStep2() {
>
<SelectValue
className=""
placeholder="دستگاه مربوطه را انتخاب نمایید."
placeholder="واحد مورد گزارش را انتخاب نمایید."
/>
</SelectTrigger>
</FormControl>
@ -340,11 +346,11 @@ export default function RequestStep2() {
render={({ field }) => (
<FormItem>
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
توضیحات
توضیحات ({charCount}/1024)
</FormLabel>
<FormControl>
<Textarea
placeholder="متن توضیحات خود را بنویسید"
placeholder=" توضیحات خود را بنویسید"
className="mb-3 resize-none"
{...field}
/>