Compare commits

..

2 Commits

Author SHA1 Message Date
Hossein Rahmani 8e66dada93 Merge branch 'Kahdooei' 2024-01-29 10:56:32 +03:30
yasaman 4763e8afbd Bugs Fixed + Cleaned Code 2024-01-28 15:19:22 +03:30
21 changed files with 79 additions and 81 deletions

View File

@ -14,9 +14,9 @@ import Footer from "@/components/Footer";
import { Swiper, SwiperSlide } from "swiper/react";
// Import Swiper styles
import "swiper/css";
import "swiper/css/pagination";
import 'swiper/css/navigation';
// import required modules
import { Autoplay, Pagination, Navigation } from "swiper/modules";
import { Autoplay, Navigation } from "swiper/modules";
import { sliderItems } from "@/constants";
import { useQuery } from "@tanstack/react-query";
import { getSliders, getNews } from "@/utils/commonApi";
@ -47,7 +47,6 @@ export default function Landing() {
queryFn: () => getSliders(),
refetchOnWindowFocus: false,
});
console.log(data);
const {
data: NewsData,
@ -66,6 +65,7 @@ export default function Landing() {
<Swiper
slidesPerView={1}
spaceBetween={0}
navigation={true}
autoplay={{
delay: 2500,
disableOnInteraction: false,
@ -74,13 +74,12 @@ export default function Landing() {
pagination={{
clickable: true,
}}
modules={[Autoplay]}
modules={[Autoplay , Navigation]}
className="mySwiper w-full h-full"
>
{data?.length > 0 ? (
<>
{data.map((item: any, index: number) => {
console.log(item);
return (
<SwiperSlide key={item.id}>
<Image

View File

@ -70,6 +70,7 @@
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
@ -91,7 +92,7 @@
}
.printPage{
.printPage {
background-color: antiquewhite;
color: black;
direction: rtl;
@ -101,6 +102,34 @@
border: 2px solid black;
}
.footer span{
.footer span {
color: white !important;
}
.swiper-button-prev,
.swiper-button-next {
width: 2em !important;
height: 2em !important;
background-color: rgba(255, 255, 255, 0.886);
color: blue !important;
/*font-size: 10px;
*/border-radius: 8px;
}
/* Optional: Adjust the position of the navigation buttons */
.swiper-button-prev {
right: 1em !important;
left: auto !important;
/* Set your desired left position */
}
.swiper-button-next {
left: 2em !important;
right: auto !important;
/* Set your desired right position */
}
.swiper-button-prev::after ,
.swiper-button-next::after {
font-size: 1em !important;
font-weight: 700;
}

View File

@ -12,7 +12,6 @@ export default function AboutUs() {
queryFn: () => getSingleWebContents(title),
refetchOnWindowFocus: false,
});
console.log(data);
useEffect(() => {
refetch();

View File

@ -54,13 +54,11 @@ export default function CitizenLogin() {
const loginMutation = useMutation({
mutationFn: logisterCitizen,
onSuccess: (res: any | string) => {
console.log(res);
router.push("/Verify");
localStorage.setItem("VerifyRole", "citizen");
localStorage.setItem("verificationToken", res);
},
onError: (err: any | string) => {
console.log(err);
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});

View File

@ -128,7 +128,7 @@ export default function ComplainsDetails({
const payload = { ...storeData, password: password };
getComplaintMutation.mutate({ Data: payload });
};
console.log(storeData);
useEffect(() => {
useData.persist.rehydrate();
if (state == "FollowResult") {

View File

@ -45,11 +45,6 @@ export default function FollowUp() {
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) });
@ -79,8 +74,6 @@ export default function FollowUp() {
// ),
// });
console.log(data);
localStorage.setItem("trackingNumber2", data.trackingNumber);
localStorage.setItem("password2", data.password);

View File

@ -15,7 +15,7 @@ export default function Footer() {
refetchOnWindowFocus: false,
});
const fetchedContent = data?.content || "";
console.log(data);
return (
// <div classNameName="flex justify-center items-center w-full bg-blue ">

View File

@ -94,7 +94,6 @@ export default function InspectorOperations({
});
function onSubmit(data: z.infer<typeof FormSchema>) {
console.log(data);
const formData = new FormData();
formData.append("text", data.text);
formData.append("trackingNumber", complaintData.trackingNumber);
@ -122,6 +121,8 @@ export default function InspectorOperations({
placeholder="متن خود را وارد نمایید"
className="resize-none bg-white lg:min-h-[20em]"
{...field}
// disabled={possibleOperations.length == 0}
readOnly={possibleOperations.length == 0}
/>
</FormControl>
{/* <FormDescription>
@ -147,10 +148,10 @@ export default function InspectorOperations({
type="file"
onChange={(e) => {
field.onChange(e.target.files ? e.target.files : null);
console.log(e.target.files);
}}
multiple
className="bg-white "
disabled={possibleOperations.length == 0}
/>
</FormControl>
<FormMessage />

View File

@ -62,7 +62,6 @@ export default function Login() {
onSuccess: (res) => {},
onError: (err: any) => {
if (err.response.status == 428) {
console.log(useData);
router.push("/Verify");
}
},

View File

@ -12,7 +12,6 @@ export default function NavbarPanel() {
setRole(userRole);
}, []);
console.log(role);
const menus = {
Admin: AdminMenuItems,
Inspector: ControllerMenuItems,

View File

@ -31,7 +31,7 @@ export default function News() {
queryKey: ["News"],
queryFn: () => getNews(),
});
console.log(data);
return (
<div className="bg-white dark:bg-gray-900 pt-8 3xl:w-[60%] w-[80%] ">

View File

@ -25,23 +25,17 @@ export default function Pagination({
// (This could be items from props; or items loaded in a local state
// from an API endpoint with useEffect and useState)
const endOffset = itemOffset + itemsPerPage;
// console.log(`Loading items from ${itemOffset} to ${endOffset}`);
const currentItems = items.slice(itemOffset, endOffset);
const pageCount = Math.ceil(items.length / itemsPerPage);
// Invoke when user click to request another page.
const handlePageClick = (event: any) => {
const newOffset = (event.selected * itemsPerPage) % items.length;
console.log(
`User requested page number ${event.selected}, which is offset ${newOffset}`
);
setItemOffset(newOffset);
// console.log(event.selected);
console.log(event);
Page(event.selected);
};
console.log(countPage);
// console.log(pageCount, "1111");
return (
<>
{/* <Items currentItems={currentItems} /> */}
@ -55,7 +49,7 @@ export default function Pagination({
previousLabel={<MdKeyboardArrowRight className="w-5 h-5 " />}
pageClassName=" w-10 h-10 grid place-content-center rounded-lg !text-blue shadow-md"
className={twMerge(
" flex flex-wrap gap-3 text-sm md:text-base w-full bottom-0 rounded-md p-1 bg-white/30 backdrop-blur-lg justify-center text-blue mt-5"
" flex flex-wrap gap-3 text-sm md:text-base w-full rounded-md p-1 bg-white/30 backdrop-blur-lg justify-center text-blue mt-5 absolute left-0 right-0 bottom-6"
)}
activeClassName=" bg-blue text-blue shadow-md shadow-main"
activeLinkClassName=" text-white w-full p-1 h-full"

View File

@ -68,6 +68,7 @@ export default function Profile() {
toast("پروفایل شما با موفقیت ویرایش شد.", {
className: "!bg-green-500 !text-white",
});
router.push("/")
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
@ -88,13 +89,9 @@ export default function Profile() {
}
}, [profileData]);
console.log(form.getValues());
function onSubmit(data: z.infer<typeof FormSchema>) {
console.log(data);
const strNationalId = String(data.nationalId);
const payload = { ...data, nationalId: strNationalId };
console.log(data);
editProfileMutation.mutate(payload);
}

View File

@ -70,7 +70,8 @@ export default function ProfileDropDown() {
<DropdownMenu dir="rtl">
<DropdownMenuTrigger className=" max-sm:-mr-8 max-sm:text-xs" asChild>
<Button variant="outline">
{profileData?.title ? profileData?.title : profileData?.userName}
{/* {profileData?.title ? profileData?.title : profileData?.userName} */}
{profileData?.firstName || profileData?.lastName ? profileData?.firstName +" "+ profileData?.lastName : profileData?.userName}
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56 sm:ml-10">

View File

@ -44,7 +44,6 @@ export default function Result() {
queryFn: () => getSingleWebContents(title),
refetchOnWindowFocus: false,
});
console.log(data);
useEffect(() => {
refetch();

View File

@ -77,7 +77,6 @@ export default function RequestStep1() {
resolver: zodResolver(FormSchema),
});
if (profileData?.firstName) {
console.log(111);
}
useEffect(() => {
if (profileData) {
@ -87,7 +86,6 @@ export default function RequestStep1() {
}
}, [profileData]);
console.log(form.getValues());
function onSubmit(data: z.infer<typeof FormSchema>) {
// toast({
// title: "You submitted the following values:",
@ -99,7 +97,6 @@ export default function RequestStep1() {
// });
const strNationalId = String(data.nationalId);
const payload = { ...data, nationalId: strNationalId };
console.log(data);
editProfileMutation.mutate(payload);
}

View File

@ -162,7 +162,6 @@ export default function RequestStep2() {
queryKey: ["Captcha"],
queryFn: () => getCaptcha(),
});
// console.log(captchaData);
const srcForImage = CaptchaData
? URL.createObjectURL(CaptchaData.data)
@ -367,18 +366,14 @@ export default function RequestStep2() {
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 (

View File

@ -23,6 +23,7 @@ import useData from "@/store/useData";
import { toast } from "sonner";
import { getComplaints } from "@/utils/citizenApi";
import Pagination from "./Pagination";
import Link from "next/link";
export default function TabController() {
const saveData = useData((state) => state.saveData);
const [selectedFile, setSelectedFile] = useState<any>(null);
@ -41,7 +42,6 @@ export default function TabController() {
refetchOnWindowFocus: false,
});
console.log(data);
useEffect(() => {
if (data) {
const headersData = JSON.parse(data.headers["x-pagination"]);
@ -55,6 +55,12 @@ export default function TabController() {
return (
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-16 pt-9">
<Link href="/RequestStep2">
<Button className=" bg-blue hover:bg-blue/90 rounded-lg max-sm:text-xs">
ثبت درخواست
</Button>
</Link>
<Search
value={search}
changeValue={(data: any) => setSearch(data)}

View File

@ -52,7 +52,7 @@ interface Complaint {
cipherKeyInspector: string;
}
export default function TableController({ data }: { data: Complaint[] }) {
console.log(data);
const saveData = useData((state) => state.saveData);
const [selectedFile, setSelectedFile] = useState<any>(null);
const [open, setOpen] = useState<boolean>(false);
@ -64,7 +64,6 @@ export default function TableController({ data }: { data: Complaint[] }) {
const contents = e?.target?.result;
// Process the contents of the file here
setSelectedFile(contents);
console.log(contents);
};
reader.readAsText(file);

View File

@ -36,7 +36,7 @@ export default function Verify() {
localStorage.setItem("Sootzani_Role", userRole);
const justLogin = localStorage.getItem("Sootzani_Login_State");
if (justLogin) {
router.push("/");
router.push("/Account/Complaints");
localStorage.removeItem("Sootzani_Login_State");
} else {
router.push("/RequestStep1");
@ -50,12 +50,10 @@ export default function Verify() {
});
const handelVerify = () => {
console.log(otp);
const payload = {
otpToken: localStorage.getItem("verificationToken"),
verificationCode: otp,
};
console.log(userData);
CitizenVerifyMutation.mutate(payload);
};

View File

@ -29,16 +29,11 @@ dEqG/38xFdYTFEekexcHnT/Vt1MW4/j76vBJHYWuAJU=
try {
const decryptor = new JSEncrypt();
decryptor.setPrivateKey(privateKey);
console.log(decryptor);
console.log(privateKey);
console.log(encryptedData);
const decrypted = decryptor.decrypt(
"FLjMFDdOUjeJDhBdTXjqkKDx81H6gWwXxvx0sQHTgDFiUoggMwCoJbn+eruMdjnppksh8zhm3rUPCIKeWe6SEuw1PX1MaKpDvZd7wNphKgWb6pLafTQTxsB0eLmTurYHkvtOyJkMHhdRravaEeoGSKmMeC9G2ahYpVYgobicBAU="
);
console.log(decrypted);
setDecryptedData(decrypted);
} catch (error) {
console.log(error);
setError(error);
}
}, [encryptedData]);