Compare commits

...

4 Commits

Author SHA1 Message Date
Hossein Rahmani bb86584422 Bugs of meeting fixed 2024-07-17 13:15:09 +03:30
Hossein Rahmani e6194009d5 packages v updated 2024-07-07 15:39:42 +03:30
Hossein Rahmani 73371b5aa3 packages v updated 2024-07-07 11:43:29 +03:30
Hossein Rahmani 37feebe4f4 Bugs in meeting fixed 2024-07-07 11:41:44 +03:30
15 changed files with 195 additions and 140 deletions

View File

@ -9,7 +9,6 @@ import { getContents } from "@/utils/commonApi";
import { toast } from "sonner";
export default function AdminWebContents() {
const [contentValueCall, setContentValueCall] = useState("");
const [contentValueAbout, setContentValueAbout] = useState("");
const [contentValueAfter, setContentValueAfter] = useState("");
@ -76,7 +75,6 @@ export default function AdminWebContents() {
refetchOnWindowFocus: false,
});
useEffect(() => {
// if (isInitialRender2 && isSuccess1) {
if (isSuccess1) {
@ -107,8 +105,7 @@ export default function AdminWebContents() {
}
});
}
}, [isSuccess1 , refetch1]);
}, [isSuccess1, refetch1]);
// Add
// ............'Mutation' Change Key Submit
@ -131,7 +128,6 @@ export default function AdminWebContents() {
className: "!bg-red-500 !text-white",
});
refetch1();
},
});
@ -140,7 +136,6 @@ export default function AdminWebContents() {
mutationKey: ["EditWebContents"],
mutationFn: UpdateWebContents,
onSuccess: (res) => {
toast("عملیات ویرایش شما با موفقیت انجام شد . ", {
className: "!bg-green-500 !text-white",
});
@ -229,7 +224,7 @@ export default function AdminWebContents() {
return (
<div className="w-full min-h-[85vh] flex justify-center">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 pb-6 ">
{/* Cull Us */}
<div className="flex flex-col w-full">
<div className="my-4 text-base font-bold text-right text-neutral-600">
@ -288,34 +283,6 @@ export default function AdminWebContents() {
</Button>
</div>
{/* AfterRegistration */}
<div className="flex flex-col w-full">
<div className="my-4 text-base font-bold text-right text-neutral-600">
محتوای بعد از ثبت گزارش
</div>
<ReactQuill
modules={modules}
theme="snow"
value={contentValueAfter}
onChange={setContentValueAfter}
style={editorStyles}
/>
<Button
type="submit"
onClick={() => {
if (afterBtn === "Add") {
onSubmitAddَAfterText();
} else if (afterBtn === "Edit") {
onEditAfterText();
}
}}
className="self-end w-1/6 my-2"
>
ثبت
</Button>
</div>
{/* BeforeRegistration*/}
<div className="flex flex-col w-full">
<div className="my-4 text-base font-bold text-right text-neutral-600">
@ -343,6 +310,34 @@ export default function AdminWebContents() {
ثبت
</Button>
</div>
{/* AfterRegistration */}
<div className="flex flex-col w-full">
<div className="my-4 text-base font-bold text-right text-neutral-600">
محتوای بعد از ثبت گزارش
</div>
<ReactQuill
modules={modules}
theme="snow"
value={contentValueAfter}
onChange={setContentValueAfter}
style={editorStyles}
/>
<Button
type="submit"
onClick={() => {
if (afterBtn === "Add") {
onSubmitAddَAfterText();
} else if (afterBtn === "Edit") {
onEditAfterText();
}
}}
className="self-end w-1/6 my-2"
>
ثبت
</Button>
</div>
</div>
</div>
);

View File

@ -7,27 +7,52 @@ import {
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { X } from "lucide-react";
import { Button } from "./ui/button";
export default function AttachmentsDialog({
children,
attachments,
deleteFile,
deleteAllAttachmentsFiles,
}: {
children: React.ReactNode;
attachments: File[] | [];
deleteFile: (file: any) => void;
deleteAllAttachmentsFiles: () => void;
}) {
return (
<Dialog>
{children}
<DialogContent>
<DialogContent className=" max-h-[95vh] overflow-y-auto max-sm:p-0">
<AlertDialog>
<DialogHeader>
<DialogTitle>پیوست‌ها</DialogTitle>
<DialogDescription>
<DialogTitle className=" mt-7">پیوست‌ها</DialogTitle>
<DialogDescription className="max-md:px-2 py-5 w-full">
{attachments.length != 0 && (
<AlertDialogTrigger>
<Button className=" mb-2 absolute right-3 top-1 p-1 bg-white hover:bg-white text-red-600 ">
حذف همه
</Button>{" "}
</AlertDialogTrigger>
)}
{attachments.length == 0 ? (
<div className=" text-center my-5">هیج پیوستی وجود ندارد.</div>
) : (
<div className=" flex flex-col gap-2 mt-2">
<div className=" flex flex-col gap-2 mt-2 h-full mx-2">
{attachments?.map((item, index) => {
return (
<div
@ -39,7 +64,9 @@ export default function AttachmentsDialog({
</div>
<div className="bg-gray-200 p-2 rounded-lg max-w-full justify-between flex flex-1">
<div className="">
<p className=" truncate">{item.name}</p>
<p className=" truncate max-w-[16rem]">
{item.name}
</p>
</div>
<X
@ -52,8 +79,29 @@ export default function AttachmentsDialog({
})}
</div>
)}
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
آیا میخواهید همه ی فایل ها را حذف کنید؟
</AlertDialogTitle>
<AlertDialogDescription></AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter className=" gap-2">
<AlertDialogCancel className=" flex-1">
لغو
</AlertDialogCancel>
<AlertDialogAction
className=" flex-1"
onClick={() => deleteAllAttachmentsFiles()}
>
تایید
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</DialogDescription>
</DialogHeader>
</AlertDialog>
</DialogContent>
</Dialog>
);

View File

@ -90,7 +90,11 @@ export default function ComplainsDetails({
data = getComplaintMutation.data;
}
const openFileInNewTab = (base64Data: any, fileType: any) => {
const openFileInNewTab = (
base64Data: any,
fileType: any,
fileName?: string
) => {
const blob = b64toBlob(base64Data, fileType);
const blobUrl = URL.createObjectURL(blob);
const newTab = window.open();
@ -109,9 +113,7 @@ export default function ComplainsDetails({
`<iframe width="100%" height="100%" src="${blobUrl}"></iframe>`
);
} else {
newTab.document.write(
`<a href="${blobUrl}" target="_blank">Open in New Tab</a>`
);
downloadFile(base64Data, fileName, fileType);
}
newTab.document.write("</body></html>");
@ -261,7 +263,7 @@ export default function ComplainsDetails({
<div className="flex items-start w-full gap-2 mt-2 max-lg:flex-col lg:h-[80vh] mb-10">
{/* 1 */}
<div className="flex flex-col w-full lg:w-1/3 gap-3 lg:sticky top-28 lg:h-[80vh] max-lg:order-3">
<div className=" bg-[#E9E9E9] rounded-md p-4 px-10 flex flex-col lg:h-full">
<div className=" bg-[#E9E9E9] rounded-md p-4 px-6 flex flex-col lg:h-full">
<p className="text-[#464646] text-base font-bold mb-1">
انجام عملیات
</p>
@ -276,7 +278,7 @@ export default function ComplainsDetails({
</div>
{/* 2 */}
<div className="flex flex-col self-stretch w-full gap-2 rounded-lg lg:w-2/3 ">
<div className=" bg-[#E9E9E9] rounded-md py-5 px-10 flex flex-col md:flex-row gap-2 min-h-56 items-stretch justify-center">
<div className=" bg-[#E9E9E9] rounded-md py-5 px-6 flex flex-col md:flex-row gap-2 min-h-56 items-stretch justify-center">
{data.user == null ? (
<>
<div className="relative flex flex-col w-full p-5 mt-2 border border-gray-400 rounded-md gap-y-1">
@ -290,7 +292,7 @@ export default function ComplainsDetails({
</span>
</p>
<p className="text-[#464646] text-sm font-medium">
دستگاه مربوطه:{" "}
دستگاه مرتبط:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{data?.complaintOrganization
? data?.complaintOrganization.title
@ -298,7 +300,7 @@ export default function ComplainsDetails({
</span>
</p>
<p className="text-[#464646] text-sm font-medium">
فرد مربوطه:{" "}
فرد مرتبط:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{data.complaining ? data.complaining : "-"}
</span>
@ -338,7 +340,7 @@ export default function ComplainsDetails({
</span>
</p>
<p className="text-[#464646] text-sm font-medium">
دستگاه مربوطه:{" "}
دستگاه مرتبط:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{data?.complaintOrganization
? data?.complaintOrganization.title
@ -346,7 +348,7 @@ export default function ComplainsDetails({
</span>
</p>
<p className="text-[#464646] text-sm font-medium">
فرد مربوطه:{" "}
فرد مرتبط:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{data.complaining ? data.complaining : "-"}
</span>
@ -419,9 +421,9 @@ export default function ComplainsDetails({
)}
</div>
<div className="h-[calc(80vh-12.8em)] max-h-[calc(80vh-12.8em)] overflow-hidden">
<div className="bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col h-full ">
<div className="bg-[#E9E9E9] rounded-md py-4 px-6 flex flex-col h-full ">
<p className="text-[#464646] text-base font-bold">
روند شکایت
روند رسیدگی گزارش{" "}
</p>
<div
className="flex flex-col mt-4 gap-y-4 overflow-y-auto
@ -458,23 +460,22 @@ export default function ComplainsDetails({
return (
<div
key={index}
className=" bg-gray-100 text-[#7C838A] w-full md:w-[30%] rounded-md h-12 p-2 flex justify-between gap-3 items-center"
>
<a
className=" bg-gray-100 text-[#7C838A] w-full md:w-[30%] rounded-md h-12 p-2 flex justify-between gap-3 items-center cursor-pointer"
onClick={() =>
openFileInNewTab(
item.data,
item.mimeType
item.mimeType,
item.title
)
}
className="flex items-center gap-2 truncate cursor-pointer "
>
<a className="flex items-center gap-2 truncate cursor-pointer ">
<File className="w-6 h-6 " />
<p className=" max-w-[5rem] truncate">
<p className=" max-w-full truncate">
{item.title}
</p>
</a>
<ArrowDownToLine
{/* <ArrowDownToLine
className="cursor-pointer "
onClick={() =>
downloadFile(
@ -483,7 +484,7 @@ export default function ComplainsDetails({
item.mimeType
)
}
/>
/> */}
</div>
);
})}

View File

@ -154,6 +154,11 @@ export default function InspectorOperations({
}
OperationMutation.mutate(formData);
}
const deleteAllAttachmentsFiles = () => {
setFile([]);
// @ts-expect-error
form.setValue("media", []);
};
const deleteFileFromAttachments = (File: any) => {
const filtered = file?.filter((item) => item.name !== File);
@ -187,7 +192,7 @@ export default function InspectorOperations({
<FormControl>
<Textarea
// placeholder="متن خود را وارد نمایید"
className="resize-none bg-white lg:min-h-[20em]"
className="resize-none bg-white lg:min-h-[18em]"
{...field}
disabled={possibleOperations.length == 0}
/>
@ -214,6 +219,7 @@ export default function InspectorOperations({
<AttachmentsDialog
attachments={file}
deleteFile={(item) => deleteFileFromAttachments(item)}
deleteAllAttachmentsFiles={deleteAllAttachmentsFiles}
>
<DialogTrigger className=" bg-white rounded-md h-9 text-xs flex-1 flex gap-2 items-center justify-center">
<Eye className=" w-4 h-4" />
@ -243,8 +249,13 @@ export default function InspectorOperations({
const fileArray1 = Array.from(file);
const fileArray2 = Array.from(e.target.files);
const mergedArray = fileArray1.concat(fileArray2);
setFile(mergedArray);
field.onChange(mergedArray);
const uniqueFiles = Array.from(
new Map(
mergedArray.map((file: any) => [file.name, file])
).values()
);
setFile(uniqueFiles);
field.onChange(uniqueFiles);
} else if (!file && e.target.files) {
const fileArray2 = Array.from(e.target.files);
setFile(fileArray2);
@ -257,7 +268,7 @@ export default function InspectorOperations({
<FormDescription className=" text-xs my-1 ">
<span>
حجم هر فایل حداکثر می بایست {formatSize(data?.maxFileSize)}{" "}
مگابایت باشد
باشد
</span>{" "}
و{" "}
{`تعداد فایل های پیوست شده می بایست حداکثر ${data?.maxFileCount} تا باشد.`}
@ -308,7 +319,7 @@ export default function InspectorOperations({
disabled={possibleOperations.length == 0}
/>
</FormControl>
<FormLabel className="font-normal">عمومی</FormLabel>
<FormLabel className="font-normal">گزارشگر</FormLabel>
</FormItem>
</RadioGroup>
</FormControl>
@ -352,7 +363,7 @@ export default function InspectorOperations({
</FormControl>
<SelectContent dir="rtl">
<SelectGroup>
<SelectLabel>عملیات</SelectLabel>
<SelectLabel>نوع عملیات</SelectLabel>
{possibleOperations.map((item: any) => {
return (
<SelectItem

View File

@ -95,7 +95,7 @@ export default function Login() {
: null;
return (
<div className="grid w-screen h-screen bg-gray-200 place-content-center">
<div className="grid w-screen h-screen bg-left-top bg-repeat bg-[url('/img/login-pattern.png')] place-content-center">
<div
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"

View File

@ -175,7 +175,7 @@ export default function TabController() {
{" "}
{data?.data.length == 0 && (
<p className="flex justify-center mx-auto mt-10 text-blue/50">
درخواستی وجود ندارد
گزارشی وجود ندارد
</p>
)}
</>
@ -332,7 +332,7 @@ export default function TabController() {
{" "}
{data?.data.length == 0 && (
<p className="flex justify-center mx-auto mt-10 text-blue/50">
درخواستی وجود ندارد
گزارشی وجود ندارد
</p>
)}
</>

View File

@ -74,7 +74,7 @@ export default function TableController({
<TableHead> تاریخ ثبت</TableHead>
<TableHead>تاریخ آخرین تغییر</TableHead>
<TableHead>موضوع</TableHead>
<TableHead>دستگاه مربوطه</TableHead>
<TableHead>دستگاه مرتبط</TableHead>
</TableRow>
</TableHeader>
<TableBody className="bg-[#F5F5F5] min-h-[20rem] ">

View File

@ -58,7 +58,7 @@ export default function Verify() {
}, [otp]);
return (
<div className="grid w-screen h-screen bg-gray-200 place-content-center">
<div className="grid w-screen h-screen bg-left-top bg-repeat bg-[url('/img/login-pattern.png')] place-content-center">
<div
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 relative"

View File

@ -115,7 +115,7 @@ const AlertDialogAction = React.forwardRef<
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Action
ref={ref}
className={cn(buttonVariants(), className)}
className={cn(buttonVariants(), "mt-2 sm:mt-0", className)}
{...props}
/>
));

View File

@ -24,7 +24,7 @@ export const boxItems = [
name: "ثبت شکایت",
icon: "/img/box1.svg",
icon2: "/img/box1-hover.svg",
description: "ارسال درخواست نارضایتی از پرسنل",
description: "ارسال گزارش نارضایتی از پرسنل",
link: "/RequestStep1",
},
{
@ -32,7 +32,7 @@ export const boxItems = [
name: "پیگیری شکایت",
icon: "/img/box2.svg",
icon2: "/img/box2-hover.svg",
description: "پیگیری درخواست ارسال شده",
description: "پیگیری گزارش ارسال شده",
link: "/FollowUp",
},
{
@ -40,7 +40,7 @@ export const boxItems = [
name: "ثبت شکایت(شناس)",
icon: "/img/box1.svg",
icon2: "/img/box1-hover.svg",
description: "ارسال درخواست نارضایتی از پرسنل",
description: "ارسال گزارش نارضایتی از پرسنل",
link: "/CitizenLogin",
},
// {

View File

@ -36,7 +36,7 @@ const useSignalR = () => {
postConnectionIdMutation.mutate(connection.connectionId);
connection.on("Created", (message) => {
queryClient.invalidateQueries(["ComplaintsList"]);
toast.info("یک درخواست جدید دارید.");
toast.info("یک گزارش جدید دارید.");
});
connection.on("Updated", (message, id) => {
toast.info(`${message}`);

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "sootzani",
"version": "0.2.18",
"version": "0.2.20",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sootzani",
"version": "0.2.18",
"version": "0.2.20",
"dependencies": {
"@hookform/resolvers": "^3.3.2",
"@microsoft/signalr": "^8.0.0",

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

BIN
public/img/logo2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB