a bug fixed
parent
7bb9b1a621
commit
bb50eabb35
|
|
@ -65,6 +65,7 @@ interface Organization {
|
||||||
export default function RequestStep2() {
|
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);
|
||||||
|
|
||||||
// Queries
|
// Queries
|
||||||
const { data: optionsData, isLoading: isLoadingData } = useQuery({
|
const { data: optionsData, isLoading: isLoadingData } = useQuery({
|
||||||
|
|
@ -86,7 +87,7 @@ export default function RequestStep2() {
|
||||||
.min(1, {
|
.min(1, {
|
||||||
message: "لطفا توضیحات خود را بنویسید.",
|
message: "لطفا توضیحات خود را بنویسید.",
|
||||||
})
|
})
|
||||||
.max(300, {
|
.max(1024, {
|
||||||
message: "تعداد کاراکترها بیشتر از حد مجاز میباشد.",
|
message: "تعداد کاراکترها بیشتر از حد مجاز میباشد.",
|
||||||
}),
|
}),
|
||||||
uploadFile: z
|
uploadFile: z
|
||||||
|
|
@ -133,7 +134,7 @@ export default function RequestStep2() {
|
||||||
mutationFn: postAuthorizedComplaintSubmit,
|
mutationFn: postAuthorizedComplaintSubmit,
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
const formattedDate = currentDate.toISOString()
|
const formattedDate = currentDate.toISOString();
|
||||||
|
|
||||||
localStorage.setItem("trackingNumber", res.trackingNumber);
|
localStorage.setItem("trackingNumber", res.trackingNumber);
|
||||||
localStorage.setItem("password", res.password);
|
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>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
@ -260,11 +266,11 @@ export default function RequestStep2() {
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
*موضوع شکایت
|
*موضوع گزارش
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="موضوع شکایت خود را بنویسید"
|
placeholder="موضوع گزارش خود را بنویسید"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
@ -279,7 +285,7 @@ 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">
|
||||||
*دستگاه مربوطه
|
*واحد مورد گزارش
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<Select
|
<Select
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
|
|
@ -293,7 +299,7 @@ export default function RequestStep2() {
|
||||||
>
|
>
|
||||||
<SelectValue
|
<SelectValue
|
||||||
className=""
|
className=""
|
||||||
placeholder="دستگاه مربوطه را انتخاب نمایید."
|
placeholder="واحد مورد گزارش را انتخاب نمایید."
|
||||||
/>
|
/>
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
@ -340,11 +346,11 @@ export default function RequestStep2() {
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
توضیحات
|
توضیحات ({charCount}/1024)
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder="متن توضیحات خود را بنویسید"
|
placeholder=" توضیحات خود را بنویسید"
|
||||||
className="mb-3 resize-none"
|
className="mb-3 resize-none"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue