Merge branch 'Kahdooei'
commit
fc5c0a4f76
|
|
@ -2,7 +2,6 @@ import ReportsController from '@/components/ReportsController'
|
|||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
const a = useMut
|
||||
return (
|
||||
<ReportsController />
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,31 +10,55 @@ import Link from "next/link";
|
|||
import bgimg from "../../public/img/bg.png";
|
||||
import Footer from "@/components/Footer";
|
||||
|
||||
// Import Swiper React components
|
||||
import { Swiper, SwiperSlide } from "swiper/react";
|
||||
// Import Swiper styles
|
||||
import "swiper/css";
|
||||
import "swiper/css/pagination";
|
||||
// import required modules
|
||||
import { Autoplay, Pagination, Navigation} from "swiper/modules";
|
||||
import { sliderItems } from "@/constants";
|
||||
|
||||
export default function Landing() {
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
// backgroundSize: "cover",
|
||||
// backgroundSize: "100%"
|
||||
}}
|
||||
className="w-full bg-top lg:bg-center bg-no-repeat h-[13rem] sm:h-[20rem] md:h-[24rem] xl:h-[33rem]"
|
||||
>
|
||||
<Image
|
||||
alt="bg"
|
||||
src={bgimg}
|
||||
// width={20}
|
||||
// height={20}
|
||||
quality={100}
|
||||
className=" w-full h-full bg-cover"
|
||||
/>
|
||||
{/* <Navbar /> */}
|
||||
</div>
|
||||
<div className="w-screen bg-top lg:bg-center bg-no-repeat h-[13rem] sm:h-[20rem] md:h-[24rem] xl:h-[33rem]">
|
||||
<Swiper
|
||||
slidesPerView={1}
|
||||
spaceBetween={0}
|
||||
autoplay={{
|
||||
delay: 2500,
|
||||
disableOnInteraction: false,
|
||||
}}
|
||||
loop={false}
|
||||
pagination={{
|
||||
clickable: true,
|
||||
}}
|
||||
modules={[Autoplay]}
|
||||
|
||||
className="mySwiper w-full h-full"
|
||||
>
|
||||
{sliderItems.map((item) => {
|
||||
return (
|
||||
<SwiperSlide key={item.id}>
|
||||
<Image
|
||||
alt="bg"
|
||||
src={bgimg}
|
||||
// width={20}
|
||||
// height={20}
|
||||
quality={100}
|
||||
className=" w-full h-full bg-cover"
|
||||
/>
|
||||
</SwiperSlide>
|
||||
);
|
||||
})}
|
||||
</Swiper>
|
||||
</div>
|
||||
|
||||
<div className="3xl:w-[60%] w-[75%] mx-auto max-md:mt-5">
|
||||
<div className="flex justify-between gap-6 w-full mx-auto -mt-24 max-md:mt-0 max-sm:flex-wrap max-sm:justify-around ">
|
||||
{boxItems.map((item, index) => {
|
||||
return (
|
||||
|
||||
<Link
|
||||
className="group bg-white shadow-md rounded-lg p-10 h-64 w-64 flex items-end justify-center z-10 relative
|
||||
hover:bg-blue transition-all duration-700 ease-in-out text-center
|
||||
|
|
@ -76,7 +100,6 @@ export default function Landing() {
|
|||
className=" w-[45%] h-[45%] hidden group-hover:flex"
|
||||
/>
|
||||
</Link>
|
||||
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
|
@ -155,13 +178,11 @@ export default function Landing() {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Counter */}
|
||||
<Counter />
|
||||
|
||||
{/*SubmitRequest */}
|
||||
<SubmitRequest />
|
||||
|
||||
{/* Footer */}
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -88,4 +88,6 @@
|
|||
.leaflet-container {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export default function RootLayout({
|
|||
<Navbar />
|
||||
<NavbarSm />
|
||||
|
||||
<div className="flex justify-center ">{children}</div>
|
||||
<div className="flex justify-center overflow-x-hidden">{children}</div>
|
||||
|
||||
<Toaster />
|
||||
</Provider>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import React from "react";
|
||||
"use client";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Image from "next/image";
|
||||
import Resultimg from "../public/img/followResult.png";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ThreeDots } from "react-loader-spinner";
|
||||
|
||||
import {
|
||||
AlertDialog,
|
||||
|
|
@ -16,18 +19,66 @@ import {
|
|||
} from "@/components/ui/alert-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { IoMdClose } from "react-icons/io";
|
||||
import { postComplaintTracking } from "@/utils/citizenApi";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
|
||||
export default function FollowResult() {
|
||||
const router = useRouter();
|
||||
const [trackingNumber, setTrackingNumber] = useState<any>();
|
||||
const [password, setPassword] = useState<any>();
|
||||
const [complaintData, setComplaintData] = useState<any>();
|
||||
|
||||
useEffect(() => {
|
||||
setTrackingNumber(localStorage.getItem("trackingNumber2"));
|
||||
setPassword(localStorage.getItem("password2"));
|
||||
}, []);
|
||||
|
||||
const complaintPrintMutation = useMutation({
|
||||
mutationKey: ["complaintPrint"],
|
||||
mutationFn: postComplaintTracking,
|
||||
|
||||
onSuccess: (res) => {
|
||||
console.log(res);
|
||||
// alert("SuccessPrint");
|
||||
console.log("Success Folllow Result");
|
||||
console.log(res);
|
||||
|
||||
setComplaintData(res);
|
||||
console.log(complaintData);
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error);
|
||||
console.log(error?.message);
|
||||
},
|
||||
});
|
||||
|
||||
function onSubmit() {
|
||||
console.log("SuccessPrinttttttttttt");
|
||||
|
||||
complaintPrintMutation.mutate({
|
||||
Data: { trackingNumber: trackingNumber, password: password },
|
||||
});
|
||||
}
|
||||
|
||||
function handlePrint() {
|
||||
var prtContent = document.getElementById("details");
|
||||
// document.body.innerHTML= printContents;
|
||||
// window.document.write(prtContent?.innerHTML);
|
||||
window.print();
|
||||
}
|
||||
return (
|
||||
<div className="w-full h-full sm:w-2/3 md:w-3/4 lg:w-1/2 max-sm:p-8 pt-12">
|
||||
<div className="h-full flex flex-col justify-center">
|
||||
<p
|
||||
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||
3xl:text-base 3xl:font-bold "
|
||||
3xl:text-base 3xl:font-bold"
|
||||
>
|
||||
درخواست شما با کد رهگیری 1243230783 و رمز عبور 12422 در دست بررسی و
|
||||
اقدام می باشد. در صورت تمایل می توانید با شماره تلفن 0353286545 جهت
|
||||
پشتیبانی تماس حاصل کنید.
|
||||
درخواست شما با کد رهگیری
|
||||
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>و
|
||||
رمز عبور
|
||||
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
||||
در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن
|
||||
0353286545 جهت پشتیبانی تماس حاصل کنید.
|
||||
</p>
|
||||
|
||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
||||
|
|
@ -36,34 +87,82 @@ export default function FollowResult() {
|
|||
<Button
|
||||
variant="outline"
|
||||
type="submit"
|
||||
onClick={() => onSubmit()}
|
||||
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-2 rounded-xl text-center"
|
||||
>
|
||||
پرینت درخواست
|
||||
پرینت درخواست
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
<p className="text-[#464646] text-base font-bold">گزارش شکایات</p>
|
||||
|
||||
<AlertDialogCancel className="p-0 border-0 h-auto"><IoMdClose /></AlertDialogCancel>
|
||||
<p className="text-[#464646] text-base font-bold">
|
||||
گزارش شکایات
|
||||
</p>
|
||||
|
||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
||||
<AlertDialogDescription>
|
||||
<p className="text-[#464646] text-sm font-medium"> موضوع شکایت: <span className="text-[#7C838A] text-sm font-medium">متن تستی</span></p>
|
||||
<p className="text-[#464646] text-sm font-medium"> موضوع شکایت: <span className="text-[#7C838A] text-sm font-medium">متن تستی</span></p>
|
||||
<p className="text-[#464646] text-sm font-medium"> موضوع شکایت: <span className="text-[#7C838A] text-sm font-medium">متن تستی</span></p>
|
||||
<p className="text-[#464646] text-sm font-medium"> موضوع شکایت:</p>
|
||||
<br/>
|
||||
<p className="text-[#464646] text-sm font-medium">درخواست شما با کد رهگیری 1243230783 و رمز عبور 12422 در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن 0353286545 جهت پشتیبانی تماس حاصل کنید. </p>
|
||||
<AlertDialogDescription className="h-full">
|
||||
{complaintPrintMutation.isPending ? (
|
||||
<div className="felx justify-center items-center self-center h-full">
|
||||
<ThreeDots
|
||||
visible={true}
|
||||
height="80"
|
||||
width="100"
|
||||
color="#003778"
|
||||
radius="9"
|
||||
ariaLabel="three-dots-loading"
|
||||
wrapperStyle={{}}
|
||||
wrapperClass=""
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div id="details">
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
{" "}
|
||||
موضوع شکایت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{`${complaintData?.title}`}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
{" "}
|
||||
متن شکایت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{`${complaintData?.contents[0]?.text}`}
|
||||
</span>
|
||||
</p>
|
||||
<br />
|
||||
|
||||
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
{" "}
|
||||
جزئیات شکایت:
|
||||
</p>
|
||||
<br />
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
درخواست شما با کد رهگیری
|
||||
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>
|
||||
و رمز عبور
|
||||
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
||||
در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با
|
||||
شماره تلفن 0353286545 جهت پشتیبانی تماس حاصل کنید.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
{/* <AlertDialogCancel>Cancel</AlertDialogCancel> */}
|
||||
<AlertDialogAction className="bg-blue text-white w-1/2 sm:w-1/6">پرینت گزارش</AlertDialogAction>
|
||||
<Button
|
||||
className="bg-blue text-white w-1/2 sm:w-1/6"
|
||||
onClick={handlePrint}
|
||||
>
|
||||
پرینت گزارش
|
||||
</Button>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import React from "react";
|
|||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import * as z from "zod";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
|
|
@ -22,10 +24,11 @@ import { Textarea } from "@/components/ui/textarea";
|
|||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import FollowResult from "./FollowResult";
|
||||
import { postComplaintTracking } from "@/utils/citizenApi";
|
||||
|
||||
const FormSchema = z.object({
|
||||
fllowCode: z.string().min(2, {
|
||||
message: "fllowCode must be at least 2 characters.",
|
||||
trackingNumber: z.string().min(2, {
|
||||
message: "trackingNumber must be at least 2 characters.",
|
||||
}),
|
||||
password: z.string().min(4, {
|
||||
message: "Password must be at least 4 characters.",
|
||||
|
|
@ -33,10 +36,49 @@ const FormSchema = z.object({
|
|||
});
|
||||
|
||||
export default function FollowUp() {
|
||||
const router = useRouter();
|
||||
|
||||
const complaintTrackingMutation = useMutation({
|
||||
mutationKey: ["complaintTracking"],
|
||||
mutationFn: postComplaintTracking,
|
||||
|
||||
onSuccess: (res) => {
|
||||
const result = res;
|
||||
console.log(res);
|
||||
console.log(result);
|
||||
|
||||
// alert("Success");
|
||||
console.log("Success FollowUp");
|
||||
|
||||
// router.push("/FollowResult");
|
||||
router.push("/FollowResult", {data: JSON.stringify( result ) });
|
||||
|
||||
// router.push(
|
||||
// "/FollowResult",
|
||||
// {
|
||||
// data: JSON.stringify(result),
|
||||
// },
|
||||
// );
|
||||
|
||||
// router.push({
|
||||
// pathname : '/FollowResult',
|
||||
// query : {
|
||||
// data: JSON.stringify( result ) ;
|
||||
// },
|
||||
// });
|
||||
|
||||
// return (res)
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error);
|
||||
console.log(error?.message);
|
||||
},
|
||||
});
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
defaultValues: {
|
||||
fllowCode: "",
|
||||
trackingNumber: "",
|
||||
password: "",
|
||||
},
|
||||
});
|
||||
|
|
@ -50,7 +92,15 @@ export default function FollowUp() {
|
|||
</pre>
|
||||
),
|
||||
});
|
||||
|
||||
console.log(data);
|
||||
|
||||
localStorage.setItem("trackingNumber2", data.trackingNumber);
|
||||
localStorage.setItem("password2", data.password);
|
||||
|
||||
complaintTrackingMutation.mutate({
|
||||
Data: { trackingNumber: data.trackingNumber, password: data.password },
|
||||
});
|
||||
}
|
||||
return (
|
||||
<div className="w-full h-full sm:w-2/3 md:w-2/4 max-sm:p-8 pt-12">
|
||||
|
|
@ -68,7 +118,7 @@ export default function FollowUp() {
|
|||
<div className="flex flex-row flex-wrap justify-between">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="fllowCode"
|
||||
name="trackingNumber"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full lg:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||
|
|
@ -106,13 +156,13 @@ export default function FollowUp() {
|
|||
</div>
|
||||
|
||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
||||
<Link href="/FollowResult"
|
||||
<Button
|
||||
// href="/FollowResult"
|
||||
type="submit"
|
||||
className="bg-blue text-white min-w-max w-1/2 sm:w-1/3 lg:w-1/4 p-2 rounded-xl text-center"
|
||||
>
|
||||
پیگیری درخواست
|
||||
</Link>
|
||||
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export default function Navbar() {
|
|||
const pathname = usePathname()
|
||||
|
||||
return (
|
||||
<div className={`max-md:hidden left-0 right-0 top-0 ${pathname === "/" ? "absolute" : "sticky"}`}>
|
||||
<div className={`max-md:hidden left-0 right-0 top-0 z-10 ${pathname === "/" ? "absolute" : "sticky"}`}>
|
||||
|
||||
<TopNav />
|
||||
<div className=" bg-white h-20 shadow-md flex items-center justify-between py-2 px-8">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import React from 'react'
|
||||
import { Button } from './ui/button'
|
||||
|
||||
export default function PrintPage() {
|
||||
function handlePrint() {
|
||||
window.print()
|
||||
//the window.print() command is what is telling the browser to print the page
|
||||
}
|
||||
return (
|
||||
<Button onClick={handlePrint}> Print </Button>
|
||||
//the onClick function is built into React to look for a click event!
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1,23 +1,51 @@
|
|||
import React from "react";
|
||||
"use client";
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import Image from "next/image";
|
||||
import Resultimg from "../public/img/result.png";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Result() {
|
||||
const trackingNumber = localStorage.getItem("trackingNumber");
|
||||
const password = localStorage.getItem("password");
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.removeItem("trackingNumber")
|
||||
localStorage.removeItem("password")
|
||||
}, [router]);
|
||||
|
||||
return (
|
||||
<div className="w-full h-full sm:w-2/3 md:w-3/4 lg:w-1/2 max-sm:p-8 pt-12 ">
|
||||
<div className="h-full flex flex-col justify-center">
|
||||
|
||||
<p className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||
3xl:text-base 3xl:font-bold " >با تشکر از شما</p>
|
||||
|
||||
<p className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||
<p
|
||||
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||
3xl:text-base 3xl:font-bold ">
|
||||
درخواست شما با کد پیگیری 258945885 و رمز عبور 5845 در سامانه سوت زنی
|
||||
ثبت شده و شما می توانید نتیجه درخواست خود را از صفحه پیگیری درخواست،
|
||||
با استفاده از کد رهگیری و رمز عبور مشاهده کنید.
|
||||
با تشکر از شما
|
||||
</p>
|
||||
|
||||
<Image alt="icon" src={Resultimg} className="self-center w-3/5 mt-5 sm:w-[23em] sm:h-[20em] 3xl:w-3/5 3xl:h-[30em] object-contain" />
|
||||
<p
|
||||
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||
3xl:text-base 3xl:font-bold ">
|
||||
درخواست شما با کد پیگیری
|
||||
<span className="text-slate-500 mx-2">
|
||||
{`${trackingNumber}`}
|
||||
</span>
|
||||
و رمز عبور
|
||||
<span className="text-slate-500 mx-2">
|
||||
{`${password}`}
|
||||
</span>
|
||||
در سامانه سوت زنی ثبت شده و شما می توانید نتیجه درخواست خود را از صفحه
|
||||
پیگیری درخواست، با استفاده از کد رهگیری و رمز عبور مشاهده کنید.
|
||||
</p>
|
||||
|
||||
<Image
|
||||
alt="icon"
|
||||
src={Resultimg}
|
||||
className="self-center w-3/5 mt-5 sm:w-[23em] sm:h-[20em] 3xl:w-3/5 3xl:h-[30em] object-contain"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"use client";
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
|
@ -15,12 +15,38 @@ import {
|
|||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@/components/ui/form";
|
||||
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectLabel,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { toast } from "@/components/ui/use-toast";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
|
||||
import { Label } from "@/components/ui/label";
|
||||
import Link from "next/link";
|
||||
import RequestResult from "./RequestResult";
|
||||
import Image from "next/image";
|
||||
import Img1 from "../public/img/logo.png";
|
||||
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { postComplaintSubmit } from "@/utils/citizenApi";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { getCaptcha, getCategory } from "@/utils/commonApi";
|
||||
|
||||
const MAX_IMAGE_SIZE = 5242880; // 5 MB
|
||||
const ALLOWED_IMAGE_TYPES = [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/webp",
|
||||
"image/jpg",
|
||||
];
|
||||
|
||||
const FormSchema = z.object({
|
||||
subject: z.string().min(2, {
|
||||
|
|
@ -40,9 +66,73 @@ const FormSchema = z.object({
|
|||
.max(200, {
|
||||
message: "description must not be longer than 200 characters.",
|
||||
}),
|
||||
uploadFile: z
|
||||
.custom<FileList>((val) => val instanceof FileList, "Required")
|
||||
.refine((files) => files.length > 0, `Required`)
|
||||
.refine((files) => files.length <= 5, `Maximum of 5 File are allowed.`)
|
||||
.refine(
|
||||
(files) => Array.from(files).every((file) => file.size <= MAX_IMAGE_SIZE),
|
||||
`Each file size should be less than 5 MB.`
|
||||
)
|
||||
.refine(
|
||||
(files) =>
|
||||
Array.from(files).every((file) =>
|
||||
ALLOWED_IMAGE_TYPES.includes(file.type)
|
||||
),
|
||||
"Only these types are allowed .jpg, .jpeg, .png and .webp"
|
||||
),
|
||||
categoryId: z.string({
|
||||
required_error: "Please select an category to display.",
|
||||
}),
|
||||
captchaValue: z.string().min(4, {
|
||||
message: "captcha must be at least 4 characters.",
|
||||
}),
|
||||
});
|
||||
|
||||
// Form Hook
|
||||
export default function RequestStep2() {
|
||||
// const [trackingComplaint, setTrackingComplaint] = useState({});
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const complaintSubmitMutation = useMutation({
|
||||
mutationKey: ["complaintSubmit"],
|
||||
mutationFn: postComplaintSubmit,
|
||||
|
||||
onSuccess: (res) => {
|
||||
console.log(res);
|
||||
localStorage.setItem("trackingNumber", res.trackingNumber);
|
||||
localStorage.setItem("password", res.password);
|
||||
|
||||
// alert("Success");
|
||||
console.log("Success Step2");
|
||||
router.push("/RequestResult");
|
||||
// router.push("/RequestResult", { data: trackingComplaint });
|
||||
// return (res)
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error);
|
||||
console.log(error?.message);
|
||||
},
|
||||
});
|
||||
|
||||
// All Category
|
||||
const { data: categoryData } = useQuery({
|
||||
queryKey: ["Category"],
|
||||
queryFn: () => getCategory(),
|
||||
});
|
||||
|
||||
// Captcha
|
||||
const { data: CaptchaData, isLoading } = useQuery({
|
||||
queryKey: ["Captcha"],
|
||||
queryFn: () => getCaptcha(),
|
||||
});
|
||||
// console.log(captchaData);
|
||||
|
||||
const srcForImage = CaptchaData
|
||||
? URL.createObjectURL(CaptchaData.data)
|
||||
: null;
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
defaultValues: {
|
||||
|
|
@ -50,34 +140,56 @@ export default function RequestStep2() {
|
|||
organisation: "",
|
||||
person: "",
|
||||
description: "",
|
||||
captchaValue: "",
|
||||
// uploadFile: null,
|
||||
},
|
||||
});
|
||||
|
||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||
toast({
|
||||
title: "You submitted the following values:",
|
||||
description: (
|
||||
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
||||
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
||||
</pre>
|
||||
),
|
||||
// toast({
|
||||
// title: "You submitted the following values:",
|
||||
// description: (
|
||||
// <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
||||
// <code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
||||
// </pre>
|
||||
// ),
|
||||
// });
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("Title", data.subject);
|
||||
formData.append("Text", data.description);
|
||||
formData.append("CategoryId", data.categoryId);
|
||||
formData.append("Medias", data.uploadFile[0]);
|
||||
formData.append("Captcha.Value", data.captchaValue);
|
||||
formData.append("Captcha.Key", CaptchaData?.headers["captcha-key"]);
|
||||
|
||||
complaintSubmitMutation.mutate({
|
||||
Data: formData,
|
||||
});
|
||||
resetField("Title");
|
||||
resetField("Text");
|
||||
resetField("Medias");
|
||||
resetField("CategoryId");
|
||||
resetField("Captcha.Value");
|
||||
|
||||
console.log("submited");
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
const { resetField } = useForm();
|
||||
|
||||
return (
|
||||
<div className="w-full h-full sm:w-2/3 md:w-2/4 max-sm:p-8 pt-12">
|
||||
<div className="space-y-3 md:space-y-4 h-full flex flex-col justify-center">
|
||||
<p className="text-sm md:text-base font-bold leading-tight tracking-tight text-blue dark:text-white">
|
||||
لطفا جهت ارسال درخواست فرم زیر را تکمیل نمایید.
|
||||
</p>
|
||||
|
||||
|
||||
<Form {...form}>
|
||||
<form
|
||||
onSubmit={form.handleSubmit(onSubmit)}
|
||||
className="w-full flex flex-col mt-6"
|
||||
>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="subject"
|
||||
|
|
@ -147,7 +259,7 @@ export default function RequestStep2() {
|
|||
<FormControl>
|
||||
<Textarea
|
||||
placeholder="متن توضیحات خود را بنویسید"
|
||||
className="resize-none"
|
||||
className="resize-none mb-3"
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
|
|
@ -156,16 +268,150 @@ export default function RequestStep2() {
|
|||
)}
|
||||
/>
|
||||
|
||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
||||
{/* <Button> */}
|
||||
<Link
|
||||
href="/RequestResult"
|
||||
<div className="flex flex-row flex-wrap justify-between">
|
||||
{/* Select Option */}
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="categoryId"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full sm:w-[48%] flex-row-reverse">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
انتخاب دسته بندی
|
||||
</FormLabel>
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="bg-slate-200">
|
||||
<SelectValue placeholder=" دسته بندی ها" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{categoryData?.map((catItems: any, index: any) => (
|
||||
<SelectItem key={index} value={catItems.id}>
|
||||
{catItems.title}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* uploadFile */}
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="uploadFile"
|
||||
render={({ field: { onChange }, ...field }) => {
|
||||
// Get current uploadFile value (always watched updated)
|
||||
const uploadFile = form.watch("uploadFile");
|
||||
{
|
||||
console.log(uploadFile);
|
||||
}
|
||||
var filenames: string[] | undefined = undefined;
|
||||
if (uploadFile) {
|
||||
// 1. covert to File[] using Array.from
|
||||
const files: File[] = Array.from(uploadFile);
|
||||
// 2. now you can use array methods on files;
|
||||
filenames = files.map((file) => file?.name);
|
||||
{
|
||||
console.log(filenames);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<FormItem className="w-full sm:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
آپلود تصویر
|
||||
</FormLabel>
|
||||
{/* File Upload */}
|
||||
<FormControl>
|
||||
<Input
|
||||
type="file"
|
||||
className="mb-3"
|
||||
accept="image/*"
|
||||
multiple={true}
|
||||
disabled={form.formState.isSubmitting}
|
||||
{...field}
|
||||
onChange={(event) => {
|
||||
// Triggered when user uploaded a new file
|
||||
// FileList is immutable, so we need to create a new one
|
||||
const dataTransfer = new DataTransfer();
|
||||
|
||||
// Add old images
|
||||
// if (images) {
|
||||
// Array.from(images).forEach((image) =>
|
||||
// dataTransfer.items.add(image)
|
||||
// );
|
||||
// }
|
||||
|
||||
// Add newly uploaded images
|
||||
Array.from(event.target.files!).forEach((image) =>
|
||||
dataTransfer.items.add(image)
|
||||
);
|
||||
|
||||
// Validate and update uploaded file
|
||||
const newFiles = dataTransfer.files;
|
||||
onChange(newFiles);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
{/* Show File Name */}
|
||||
{/* <FormDescription>{`${filenames}`}</FormDescription> */}
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/* Captcha */}
|
||||
<div className="flex flex-row flex-wrap justify-between">
|
||||
<div className="w-full sm:w-[48%] flex items-center justify-start">
|
||||
{!isLoading && (
|
||||
<Image
|
||||
alt="icon"
|
||||
src={srcForImage as string}
|
||||
className="w-3/5 h-12 rounded-md shadow-md"
|
||||
width={150}
|
||||
height={20}
|
||||
quality={100}
|
||||
/>
|
||||
)}
|
||||
{/* <Image src={Img1} alt="1" width={50} height={50} /> */}
|
||||
</div>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="captchaValue"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full sm:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
*کد امنیتی
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="کد تصویر روبرو را وارد کنید "
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-4">
|
||||
{/* <Link> */}
|
||||
<Button
|
||||
// href="/RequestResult"
|
||||
type="submit"
|
||||
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-2 rounded-xl text-center"
|
||||
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-2 rounded-xl text-center mb-4"
|
||||
>
|
||||
ارسال درخواست
|
||||
</Link>
|
||||
{/* </Button> */}
|
||||
</Button>
|
||||
{/* </Link> */}
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,164 @@
|
|||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import {
|
||||
CaretSortIcon,
|
||||
CheckIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronUpIcon,
|
||||
} from "@radix-ui/react-icons"
|
||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const Select = SelectPrimitive.Root
|
||||
|
||||
const SelectGroup = SelectPrimitive.Group
|
||||
|
||||
const SelectValue = SelectPrimitive.Value
|
||||
|
||||
const SelectTrigger = React.forwardRef<
|
||||
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
||||
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
||||
>(({ className, children, ...props }, ref) => (
|
||||
<SelectPrimitive.Trigger
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<SelectPrimitive.Icon asChild>
|
||||
<CaretSortIcon className="h-4 w-4 opacity-50" />
|
||||
</SelectPrimitive.Icon>
|
||||
</SelectPrimitive.Trigger>
|
||||
))
|
||||
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
||||
|
||||
const SelectScrollUpButton = React.forwardRef<
|
||||
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
||||
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<SelectPrimitive.ScrollUpButton
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"flex cursor-default items-center justify-center py-1",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronUpIcon />
|
||||
</SelectPrimitive.ScrollUpButton>
|
||||
))
|
||||
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
||||
|
||||
const SelectScrollDownButton = React.forwardRef<
|
||||
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
||||
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<SelectPrimitive.ScrollDownButton
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"flex cursor-default items-center justify-center py-1",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronDownIcon />
|
||||
</SelectPrimitive.ScrollDownButton>
|
||||
))
|
||||
SelectScrollDownButton.displayName =
|
||||
SelectPrimitive.ScrollDownButton.displayName
|
||||
|
||||
const SelectContent = React.forwardRef<
|
||||
React.ElementRef<typeof SelectPrimitive.Content>,
|
||||
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
||||
>(({ className, children, position = "popper", ...props }, ref) => (
|
||||
<SelectPrimitive.Portal>
|
||||
<SelectPrimitive.Content
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
||||
position === "popper" &&
|
||||
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
||||
className
|
||||
)}
|
||||
position={position}
|
||||
{...props}
|
||||
>
|
||||
<SelectScrollUpButton />
|
||||
<SelectPrimitive.Viewport
|
||||
className={cn(
|
||||
"p-1",
|
||||
position === "popper" &&
|
||||
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</SelectPrimitive.Viewport>
|
||||
<SelectScrollDownButton />
|
||||
</SelectPrimitive.Content>
|
||||
</SelectPrimitive.Portal>
|
||||
))
|
||||
SelectContent.displayName = SelectPrimitive.Content.displayName
|
||||
|
||||
const SelectLabel = React.forwardRef<
|
||||
React.ElementRef<typeof SelectPrimitive.Label>,
|
||||
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<SelectPrimitive.Label
|
||||
ref={ref}
|
||||
className={cn("px-2 py-1.5 text-sm font-semibold", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
||||
|
||||
const SelectItem = React.forwardRef<
|
||||
React.ElementRef<typeof SelectPrimitive.Item>,
|
||||
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
||||
>(({ className, children, ...props }, ref) => (
|
||||
<SelectPrimitive.Item
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||
<SelectPrimitive.ItemIndicator>
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
</SelectPrimitive.ItemIndicator>
|
||||
</span>
|
||||
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
||||
</SelectPrimitive.Item>
|
||||
))
|
||||
SelectItem.displayName = SelectPrimitive.Item.displayName
|
||||
|
||||
const SelectSeparator = React.forwardRef<
|
||||
React.ElementRef<typeof SelectPrimitive.Separator>,
|
||||
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<SelectPrimitive.Separator
|
||||
ref={ref}
|
||||
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
||||
|
||||
export {
|
||||
Select,
|
||||
SelectGroup,
|
||||
SelectValue,
|
||||
SelectTrigger,
|
||||
SelectContent,
|
||||
SelectLabel,
|
||||
SelectItem,
|
||||
SelectSeparator,
|
||||
SelectScrollUpButton,
|
||||
SelectScrollDownButton,
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|||
className={cn(
|
||||
`flex w-full rounded-md border border-input px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50
|
||||
text-black text-opacity-50 text-xs font-normal bg-slate-200
|
||||
3xl:min-h-[198px] min-h-[150px]`,
|
||||
3xl:min-h-[150px] min-h-[100px]`,
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@radix-ui/react-label": "^2.0.2",
|
||||
"@radix-ui/react-select": "^2.0.0",
|
||||
"@radix-ui/react-slot": "^1.0.2",
|
||||
"@radix-ui/react-tabs": "^1.0.4",
|
||||
"@radix-ui/react-toast": "^1.1.5",
|
||||
|
|
@ -501,6 +502,14 @@
|
|||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/number": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.0.1.tgz",
|
||||
"integrity": "sha512-T5gIdVO2mmPW3NNhjNgEP3cqMXjXL9UbO0BzWcXfvdBs+BohbQxvd/K5hSVKmn9/lbTdsQVKbUcP5WLCwvUbBg==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/primitive": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.0.1.tgz",
|
||||
|
|
@ -993,6 +1002,49 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-select": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.0.0.tgz",
|
||||
"integrity": "sha512-RH5b7af4oHtkcHS7pG6Sgv5rk5Wxa7XI8W5gvB1N/yiuDGZxko1ynvOiVhFM7Cis2A8zxF9bTOUVbRDzPepe6w==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@radix-ui/number": "1.0.1",
|
||||
"@radix-ui/primitive": "1.0.1",
|
||||
"@radix-ui/react-collection": "1.0.3",
|
||||
"@radix-ui/react-compose-refs": "1.0.1",
|
||||
"@radix-ui/react-context": "1.0.1",
|
||||
"@radix-ui/react-direction": "1.0.1",
|
||||
"@radix-ui/react-dismissable-layer": "1.0.5",
|
||||
"@radix-ui/react-focus-guards": "1.0.1",
|
||||
"@radix-ui/react-focus-scope": "1.0.4",
|
||||
"@radix-ui/react-id": "1.0.1",
|
||||
"@radix-ui/react-popper": "1.1.3",
|
||||
"@radix-ui/react-portal": "1.0.4",
|
||||
"@radix-ui/react-primitive": "1.0.3",
|
||||
"@radix-ui/react-slot": "1.0.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.0.1",
|
||||
"@radix-ui/react-use-controllable-state": "1.0.1",
|
||||
"@radix-ui/react-use-layout-effect": "1.0.1",
|
||||
"@radix-ui/react-use-previous": "1.0.1",
|
||||
"@radix-ui/react-visually-hidden": "1.0.3",
|
||||
"aria-hidden": "^1.1.1",
|
||||
"react-remove-scroll": "2.5.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-slot": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz",
|
||||
|
|
@ -1145,6 +1197,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-use-previous": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.0.1.tgz",
|
||||
"integrity": "sha512-cV5La9DPwiQ7S0gf/0qiD6YgNqM5Fk97Kdrlc5yBcrF3jyEZQwm7vYFqMo4IfeHgJXsRaMvLABFtd0OVEmZhDw==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-use-rect": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.0.1.tgz",
|
||||
|
|
@ -2148,21 +2217,6 @@
|
|||
"hyphenate-style-name": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/css-mediaquery": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/css-mediaquery/-/css-mediaquery-0.1.2.tgz",
|
||||
"integrity": "sha512-COtn4EROW5dBGlE/4PiKnh6rZpAPxDeFLaEEwt4i10jpDMFt2EhQGS79QmmrO+iKCHv0PU/HrOWEhijFd1x99Q=="
|
||||
},
|
||||
"node_modules/css-to-react-native": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz",
|
||||
"integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==",
|
||||
"dependencies": {
|
||||
"camelize": "^1.0.0",
|
||||
"css-color-keywords": "^1.0.0",
|
||||
"postcss-value-parser": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/css-tree": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz",
|
||||
|
|
@ -7904,16 +7958,6 @@
|
|||
"node": ">=6.9"
|
||||
}
|
||||
},
|
||||
"node_modules/shallow-equal": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.1.tgz",
|
||||
"integrity": "sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA=="
|
||||
},
|
||||
"node_modules/shallowequal": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz",
|
||||
"integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ=="
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
|
|
@ -8120,51 +8164,6 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/styled-components": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.3.tgz",
|
||||
"integrity": "sha512-kLerFjTAABuEZ870O4q4dyT/VCOJC/HA08+VeIGhkiOKkwJLP17HAWHCiqZWnUMV19m3axlOKR/+/EbCbuJAZg==",
|
||||
"dependencies": {
|
||||
"@emotion/is-prop-valid": "1.2.1",
|
||||
"@emotion/unitless": "0.8.0",
|
||||
"@types/stylis": "4.2.0",
|
||||
"css-to-react-native": "3.2.0",
|
||||
"csstype": "3.1.2",
|
||||
"postcss": "8.4.31",
|
||||
"shallowequal": "1.1.0",
|
||||
"stylis": "4.3.0",
|
||||
"tslib": "2.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/styled-components"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">= 16.8.0",
|
||||
"react-dom": ">= 16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/styled-components/node_modules/@emotion/is-prop-valid": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.1.tgz",
|
||||
"integrity": "sha512-61Mf7Ufx4aDxx1xlDeOm8aFFigGHE4z+0sKCa+IHCeZKiyP9RLD0Mmx7m8b9/Cf37f7NAvQOOJAbQQGVr5uERw==",
|
||||
"dependencies": {
|
||||
"@emotion/memoize": "^0.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/styled-components/node_modules/@emotion/memoize": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz",
|
||||
"integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA=="
|
||||
},
|
||||
"node_modules/styled-components/node_modules/tslib": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
|
||||
"integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
|
||||
},
|
||||
"node_modules/styled-jsx": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz",
|
||||
|
|
@ -8188,9 +8187,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/stylis": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.0.tgz",
|
||||
"integrity": "sha512-E87pIogpwUsUwXw7dNyU4QDjdgVMy52m+XEOPEKUn161cCzWjjhPSQhByfd1CcNvrOLnXQ6OnnZDwnJrz/Z4YQ=="
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.1.tgz",
|
||||
"integrity": "sha512-EQepAV+wMsIaGVGX1RECzgrcqRRU/0sYOHkeLsZ3fzHaHXZy4DaOOX0vOlGQdlsjkh3mFHAIlVimpwAs4dslyQ=="
|
||||
},
|
||||
"node_modules/sucrase": {
|
||||
"version": "3.34.0",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@radix-ui/react-label": "^2.0.2",
|
||||
"@radix-ui/react-select": "^2.0.0",
|
||||
"@radix-ui/react-slot": "^1.0.2",
|
||||
"@radix-ui/react-tabs": "^1.0.4",
|
||||
"@radix-ui/react-toast": "^1.1.5",
|
||||
|
|
|
|||
|
|
@ -6,54 +6,30 @@ axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
|||
|
||||
|
||||
// Post Complaints
|
||||
export async function postComplaintSubmit( {token , Data} : {
|
||||
token: CookieValueTypes;
|
||||
Data: { Title: string; Text: string ; CategoryId:string ; Medias?: any ; 'Captcha.Key': string ; 'Captcha.Value':string ; relevantDevice : number , relevantPerson:string};
|
||||
}) {
|
||||
export async function postComplaintSubmit( {Data} : {Data: FormData;}) {
|
||||
const data = await axios.post(
|
||||
`api/Citizen`,
|
||||
Data,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
"Content-Type": "multipart/form-data"
|
||||
},
|
||||
}
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Post 1 Complaints
|
||||
export async function postComplaintTracking({token , Data} : {
|
||||
token: CookieValueTypes;
|
||||
export async function postComplaintTracking({Data} : {
|
||||
Data: { trackingNumber: string; password :string;}
|
||||
}) {
|
||||
const data = await axios.post(
|
||||
`api/Citizen/Get`,
|
||||
Data,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Post Complaints Details "citizen / Oprate"
|
||||
export async function postComplaintsDetails( {token , Data} : {
|
||||
token: CookieValueTypes;
|
||||
Data: { TrackingNumber: string; Text: string ; Medias?: any ; Operation: number ; Password:string};
|
||||
}) {
|
||||
export async function postComplaintsDetails( {Data} : {Data: FormData;}) {
|
||||
const data = await axios.post(
|
||||
`api/Citizen`,
|
||||
`api/Citizen/Operate`,
|
||||
Data,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
"Content-Type": "multipart/form-data"
|
||||
},
|
||||
}
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
|
@ -1,20 +1,22 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes } from "cookies-next";
|
||||
|
||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||
|
||||
// Get Category
|
||||
export async function getCategory() {
|
||||
const data = await axios.get(
|
||||
"api/Common/Categories",
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
|
||||
// Get Category
|
||||
export async function getCategory({ token }: { token: CookieValueTypes }) {
|
||||
const data = await axios.get("api/Common/Categories", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Get Captcha
|
||||
// Get Captcha
|
||||
export async function getCaptcha() {
|
||||
const data = await axios.get("api/Common/Captcha", { responseType: "blob" });
|
||||
return data;
|
||||
}
|
||||
const data = await axios.get(
|
||||
"api/Common/Captcha", {responseType:'blob'}
|
||||
);
|
||||
console.log(data)
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue