Bugs after test fixed

Kahdooie
Hossein Rahmani 2024-01-07 20:45:40 +03:30
parent b5dde6be4d
commit ead91d08ea
11 changed files with 107 additions and 75 deletions

View File

@ -5,7 +5,7 @@ export default function page({ params }: { params: any }) {
const id = params.id;
return (
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] mt-16 sm:mt-8 pt-9 mx-auto mb-10">
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] mt-10 sm:mt-8 pt-9 mx-auto mb-10">
<ComplainsDetails role="Inspector" id={id} />
</div>
);

View File

@ -16,15 +16,16 @@ import secureLocalStorage from "react-secure-storage";
import { Checkbox } from "./ui/checkbox";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { Input } from "./ui/input";
import { toast } from "sonner";
import { useRouter } from "next/navigation";
@ -175,24 +176,25 @@ export default function ComplainsDetails({
data = getComplaintMutation?.data;
return (
<>
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent dir="rtl" className="">
<DialogHeader dir="rtl">
<DialogTitle dir="rtl">بارگذاری کلید خصوصی</DialogTitle>
<DialogDescription>
<AlertDialog open={open} onOpenChange={setOpen}>
<AlertDialogContent dir="rtl" className="">
<AlertDialogHeader dir="rtl">
<AlertDialogTitle dir="rtl">بارگذاری کلید خصوصی</AlertDialogTitle>
<AlertDialogDescription>
برای مشاهده شکایت لطفا کلید خود را آپلود نمایید.
</DialogDescription>
</DialogHeader>
<div className="grid w-full max-w-sm items-center gap-1.5">
</AlertDialogDescription>
</AlertDialogHeader>
<div className="grid w-full max-w-sm items-center gap-1.5 px-8">
<Input
dir="rtl"
id="picture"
onChange={handleFileChange}
type="file"
accept=".txt"
className=" bg-white hover:bg-white focus:bg-white"
/>
</div>
<div className="flex items-center space-x-2">
<div className="flex items-center space-x-2 px-8">
<Checkbox
checked={check}
onCheckedChange={setCheck}
@ -206,14 +208,15 @@ export default function ComplainsDetails({
ذخیره کلید برای دفعات بعد
</label>
</div>
<DialogFooter className=" flex !justify-between">
<AlertDialogFooter className=" gap-y-2 max-md:w-full max-md:flex max-md:flex-col">
{/* <DialogClose asChild></DialogClose> */}
<Button
variant="outline"
onClick={() => {
router.push("/UserPanel/Complaints");
router.push("/UserPanel/ControllerDashboard/Complaints");
}}
type="submit"
className=" md:ml-2"
>
بازگشت
</Button>
@ -226,13 +229,15 @@ export default function ComplainsDetails({
>
ذخیره
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
{getComplaintMutation.data && !getComplaintMutation.isPending ? (
<>
<button
onClick={() => router.push("/UserPanel/Complaints")}
onClick={() =>
router.push("/UserPanel/ControllerDashboard/Complaints")
}
className=" my-2 flex gap-1 cursor-pointer text-blue "
>
<span>

View File

@ -76,7 +76,6 @@ export default function InspectorOperations({
possibleOperations.length == 1
? String(possibleOperations[0].value)
: undefined,
text: "",
},
});
@ -88,7 +87,10 @@ export default function InspectorOperations({
className: "!bg-green-500 !text-white",
});
const tk = localStorage.getItem("trackingNumber");
updateData({ trackingNumber: tk, password: key2 });
updateData({
trackingNumber: tk,
password: key2 ? key2 : (localStorage.getItem("privateKey") as string),
});
},
onError: (err) => {},
});
@ -107,7 +109,10 @@ export default function InspectorOperations({
if (data.type) {
formData.append("IsPublic", data.type == "public" ? "true" : "false");
}
formData.append("EncodedKey", key2);
formData.append(
"EncodedKey",
key2 ? key2 : (localStorage.getItem("privateKey") as string)
);
if (data?.media && data?.media?.length > 0) {
for (let i = 0; i < data.media.length; i++) {
formData.append("Medias", data.media[i]);

View File

@ -27,6 +27,7 @@ import { Oval, ThreeDots } from "react-loader-spinner";
import useData from "@/store/useData";
import { toast } from "sonner";
import { errorMessages } from "@/constants";
import { RefreshCcw } from "lucide-react";
const FormSchema = z.object({
username: z.string().min(1, {
message: "لطفا نام کاربری را وارد نمایید.",
@ -101,7 +102,7 @@ export default function Login() {
className="w-full sm:[20rem] md:[20rem] xl:w-[30rem] bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
h-fit"
>
<div className="space-y-3 md:space-y-4 flex flex-col md:py-10 md:px-12 lg:px-16 h-full justify-center">
<div className="space-y-3 md:space-y-4 flex flex-col md:py-10 p-10 md:px-12 lg:px-16 h-full justify-center">
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
@ -157,7 +158,7 @@ export default function Login() {
</FormItem>
)}
/>
<div className="flex gap-4 mt-4 items-center">
<div className="flex gap-3 mt-4 items-center">
<FormField
control={form.control}
name="captcha"
@ -188,7 +189,7 @@ export default function Login() {
/>
</div>
) : (
<div className=" flex justify-center text-center">
<div className=" flex items-center justify-center text-center gap-2">
<Image
alt="icon"
src={srcForImage as string}
@ -197,6 +198,11 @@ export default function Login() {
height={20}
quality={100}
/>
<RefreshCcw
className=" cursor-pointer"
onClick={() => refetch()}
color="#003778"
/>
</div>
)}
</div>

View File

@ -132,6 +132,7 @@ export default function NavbarPanel() {
<LogOut
onClick={() => {
deleteCookie("Sootzani_Token");
localStorage.removeItem("privateKey");
router.push("/");
}}
className=" text-white cursor-pointer"

View File

@ -101,6 +101,7 @@ export default function TableController({
<TableRow>
<TableHead>ردیف</TableHead>
<TableHead>تاریخ</TableHead>
<TableHead>کد پیگیری</TableHead>
<TableHead>موضوع</TableHead>
<TableHead>دستگاه مربوطه</TableHead>
</TableRow>
@ -128,10 +129,11 @@ export default function TableController({
<TableCell className="w-2/12">
{convertDate(item.registeredAt)}
</TableCell>
<TableCell className="w-2/12">{item.trackingNumber}</TableCell>
<TableCell className="w-2/12">
{item?.title ? item.title : "-"}
</TableCell>
<TableCell className="w-7/12">
<TableCell className="w-5/12">
{item?.complaintOrganization
? item?.complaintOrganization.title
: "-"}

View File

@ -11,6 +11,7 @@ import useData from "@/store/useData";
import { JwtPayload, jwtDecode } from "jwt-decode";
import { setCookie } from "cookies-next";
import { Oval } from "react-loader-spinner";
import { toast } from "sonner";
export default function Verify() {
const [otp, setOtp] = useState("");
@ -36,7 +37,11 @@ export default function Verify() {
router.push("/UserPanel/CitizenDashboard");
}
},
onError: (err: any) => {},
onError: (err: any) => {
toast("کد تایید شما صحیح نمیباشد.", {
className: "!bg-red-500 !text-white",
});
},
});
const CitizenVerifyMutation = useMutation({
mutationFn: verifyCitizen,
@ -68,6 +73,14 @@ export default function Verify() {
useData.persist.rehydrate();
}, []);
useEffect(() => {
if (otp.length == 6) {
const payload = { ...userData, verificationCode: otp };
console.log(userData);
verifyMutation.mutate(payload);
}
}, [otp]);
return (
<div className=" w-screen h-screen grid place-content-center bg-gray-200">
<div
@ -86,11 +99,7 @@ export default function Verify() {
numInputs={6}
renderSeparator={<span>{space}</span>}
renderInput={(props, idx) => (
<input
autoFocus={idx == 0}
pattern="[0-9]*"
{...props}
/>
<input autoFocus={idx == 0} pattern="[0-9]*" {...props} />
)}
containerStyle=" flex justify-center"
inputStyle=" !w-10 rounded-md h-10 bg-[#F5F5F5] border border-blue/30 text-black"
@ -101,7 +110,7 @@ export default function Verify() {
کد دریافت شده توسط پیامک را وارد نمایید.
</span>
</label>
<div className="flex justify-end gap-2 w-full mt-14">
{/* <div className="flex justify-end gap-2 w-full mt-14">
<Button
disabled={verifyMutation.isPending}
onClick={handelVerify}
@ -119,13 +128,12 @@ export default function Verify() {
wrapperStyle={{}}
wrapperClass=""
/>
{/* <p>در حال انجام ...</p> */}
</div>
) : (
"تایید"
)}
</Button>
</div>
</div> */}
</div>
</div>
</div>

View File

@ -1,16 +1,16 @@
"use client"
"use client";
import * as React from "react"
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
import * as React from "react";
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
import { cn } from "@/lib/utils";
import { buttonVariants } from "@/components/ui/button";
const AlertDialog = AlertDialogPrimitive.Root
const AlertDialog = AlertDialogPrimitive.Root;
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
const AlertDialogPortal = AlertDialogPrimitive.Portal
const AlertDialogPortal = AlertDialogPrimitive.Portal;
const AlertDialogOverlay = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
@ -24,8 +24,8 @@ const AlertDialogOverlay = React.forwardRef<
{...props}
ref={ref}
/>
))
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
));
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
const AlertDialogContent = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
@ -36,11 +36,10 @@ const AlertDialogContent = React.forwardRef<
<AlertDialogPrimitive.Content
ref={ref}
className={cn(
`fixed left-[50%] top-[50%] z-50 grid w-full max-w-4xl translate-x-[-50%] translate-y-[-50%] gap-4 border duration-200
`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border duration-200
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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2
data-[state=open]:slide-in-from-top-[48%] rounded-lg
h-full max-h-[32em] content-between p-0 bg-opacity-30 bg-[#FFFFF999] filter
data-[state=open]:slide-in-from-top-[48%] rounded-lg content-between p-0 bg-opacity-30 bg-[#FFFFF999] filter
shadow-[0px_0px_30px_0px_rgba(0,0,0,0.3)]
`,
className
@ -48,8 +47,8 @@ const AlertDialogContent = React.forwardRef<
{...props}
/>
</AlertDialogPortal>
))
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
));
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
const AlertDialogHeader = ({
className,
@ -62,8 +61,8 @@ const AlertDialogHeader = ({
)}
{...props}
/>
)
AlertDialogHeader.displayName = "AlertDialogHeader"
);
AlertDialogHeader.displayName = "AlertDialogHeader";
const AlertDialogFooter = ({
className,
@ -76,8 +75,8 @@ const AlertDialogFooter = ({
)}
{...props}
/>
)
AlertDialogFooter.displayName = "AlertDialogFooter"
);
AlertDialogFooter.displayName = "AlertDialogFooter";
const AlertDialogTitle = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Title>,
@ -85,11 +84,14 @@ const AlertDialogTitle = React.forwardRef<
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Title
ref={ref}
className={cn("text-lg font-semibold bg-white flex justify-between items-center px-6 py-3 rounded-t-lg border-b-[0.5px] border-[#8F8F8F] border-solid", className)}
className={cn(
"text-lg font-semibold bg-white flex justify-between items-center px-6 py-3 rounded-t-lg border-b-[0.5px] border-[#8F8F8F] border-solid",
className
)}
{...props}
/>
))
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
));
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
const AlertDialogDescription = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Description>,
@ -97,12 +99,15 @@ const AlertDialogDescription = React.forwardRef<
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground flex flex-col items-start text-justify px-10 py-4 sm:px-28 sm:pt-9 ", className)}
className={cn(
"text-sm text-muted-foreground flex flex-col items-start text-justify px-10 py-4 ",
className
)}
{...props}
/>
))
));
AlertDialogDescription.displayName =
AlertDialogPrimitive.Description.displayName
AlertDialogPrimitive.Description.displayName;
const AlertDialogAction = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Action>,
@ -113,8 +118,8 @@ const AlertDialogAction = React.forwardRef<
className={cn(buttonVariants(), className)}
{...props}
/>
))
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
));
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
const AlertDialogCancel = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
@ -129,8 +134,8 @@ const AlertDialogCancel = React.forwardRef<
)}
{...props}
/>
))
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
));
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
export {
AlertDialog,
@ -144,4 +149,4 @@ export {
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
}
};

View File

@ -13,7 +13,7 @@ const Checkbox = React.forwardRef<
<CheckboxPrimitive.Root
ref={ref}
className={cn(
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue data-[state=checked]:text-primary-foreground",
className
)}
{...props}

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "sootzani",
"version": "0.2.0",
"version": "0.2.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sootzani",
"version": "0.2.0",
"version": "0.2.1",
"dependencies": {
"@hookform/resolvers": "^3.3.2",
"@radix-ui/react-alert-dialog": "^1.0.5",

View File

@ -1,6 +1,6 @@
{
"name": "sootzani",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"scripts": {
"dev": "next dev",