Compare commits
2 Commits
4e46c0e6eb
...
2a6e6fffaf
| Author | SHA1 | Date |
|---|---|---|
|
|
2a6e6fffaf | |
|
|
4249e8004f |
|
|
@ -356,59 +356,71 @@ export default function ComplainsDetails({
|
||||||
>
|
>
|
||||||
{data.contents?.map((item: any, index: any, array: any) => {
|
{data.contents?.map((item: any, index: any, array: any) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<>
|
||||||
key={item.id}
|
<div className="flex flex-row gap-2 ">
|
||||||
className="p-4 bg-white rounded-lg shadow-md "
|
<div className="flex">
|
||||||
>
|
<span className=" flex items-center justify-center w-7 h-7 mt-1 mr-1 bg-blue-100 rounded-md -start-4 ring-2 ring-blue bg-blue2 text-white bg-blue">
|
||||||
<div className="flex items-center gap-4 justify-between">
|
|
||||||
<div>
|
|
||||||
<span className=" flex items-center justify-center w-8 h-8 bg-blue-100 rounded-full -start-4 ring-2 ring-blue bg-blue2 text-black">
|
|
||||||
{array.length - index}
|
{array.length - index}
|
||||||
</span>
|
</span>
|
||||||
<p className="">
|
|
||||||
<Badge>
|
|
||||||
{item.operationWithDescription.description}{" "}
|
|
||||||
توسط {item.sender == 0 ? "شهروند" : "بازرس"}
|
|
||||||
</Badge>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
key={item.id}
|
||||||
|
className="p-4 bg-white rounded-lg shadow-md w-full relative"
|
||||||
|
>
|
||||||
|
<div className="flex items-center sm:gap-4 justify-between flex-col sm:flex-row gap-1">
|
||||||
|
<div>
|
||||||
|
{/* <span className="absolute -top-5 right-0 flex items-center justify-center w-7 h-7 mt-1 mr-1 bg-blue-100 rounded-md -start-4 shadow-md bg-blue2 text-blue bg-white">
|
||||||
|
{array.length - index}
|
||||||
|
</span> */}
|
||||||
|
<p className="">
|
||||||
|
<Badge>
|
||||||
|
{
|
||||||
|
item.operationWithDescription
|
||||||
|
.description
|
||||||
|
}{" "}
|
||||||
|
توسط{" "}
|
||||||
|
{item.sender == 0 ? "شهروند" : "بازرس"}
|
||||||
|
</Badge>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p className="">
|
<p className="">
|
||||||
<span className="text-[#7C838A] text-sm">
|
<span className="text-[#7C838A] text-sm">
|
||||||
{convertFullTime(item.dateTime)}
|
{convertFullTime(item.dateTime)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className=" text-[#464646] mt-2">
|
<div className=" text-[#464646] mt-2">
|
||||||
<span className="text-[#7C838A] text-sm">
|
<span className="text-[#7C838A] text-sm">
|
||||||
{item.text ? item.text : "-"}
|
{item.text ? item.text : "-"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{/* {item.media.length !== 0 && (
|
{/* {item.media.length !== 0 && (
|
||||||
<Separator className="mt-2 mb-1 " />
|
<Separator className="mt-2 mb-1 " />
|
||||||
)} */}
|
)} */}
|
||||||
<div className=" text-[#464646] mt-2">
|
<div className=" text-[#464646] mt-2">
|
||||||
<div className="flex flex-wrap items-center w-full gap-2 mt-2 text-xs max-md:flex-col">
|
<div className="flex flex-wrap items-center w-full gap-2 mt-2 text-xs max-md:flex-col">
|
||||||
{item?.media.map((item: any, index: number) => {
|
{item?.media.map(
|
||||||
return (
|
(item: any, index: number) => {
|
||||||
<div
|
return (
|
||||||
key={index}
|
<div
|
||||||
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"
|
key={index}
|
||||||
onClick={() =>
|
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"
|
||||||
openFileInNewTab(
|
onClick={() =>
|
||||||
item.data,
|
openFileInNewTab(
|
||||||
item.mimeType,
|
item.data,
|
||||||
item.title
|
item.mimeType,
|
||||||
)
|
item.title
|
||||||
}
|
)
|
||||||
>
|
}
|
||||||
<a className="flex items-center gap-2 truncate cursor-pointer ">
|
>
|
||||||
<File className="w-6 h-6 " />
|
<a className="flex items-center gap-2 truncate cursor-pointer ">
|
||||||
<p className=" max-w-full truncate">
|
<File className="w-6 h-6 " />
|
||||||
{item.title}
|
<p className=" max-w-full truncate">
|
||||||
</p>
|
{item.title}
|
||||||
</a>
|
</p>
|
||||||
{/* <ArrowDownToLine
|
</a>
|
||||||
|
{/* <ArrowDownToLine
|
||||||
className="cursor-pointer "
|
className="cursor-pointer "
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
downloadFile(
|
downloadFile(
|
||||||
|
|
@ -418,12 +430,15 @@ export default function ComplainsDetails({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/> */}
|
/> */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
}
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -166,10 +166,10 @@ export default function InspectorOperations({
|
||||||
const withDot = split?.map((item: string) => "." + item);
|
const withDot = split?.map((item: string) => "." + item);
|
||||||
const newAllowedExtensions = withDot?.join(",");
|
const newAllowedExtensions = withDot?.join(",");
|
||||||
const formatSize = (size: number) => {
|
const formatSize = (size: number) => {
|
||||||
const string = formatBytes(size);
|
const string = formatBytes(size);
|
||||||
return (
|
return (
|
||||||
<span className="" dir="ltr">
|
<span className="" >
|
||||||
{string}
|
{string[0]} {string[1]}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
33
lib/utils.ts
33
lib/utils.ts
|
|
@ -47,37 +47,18 @@ export function isAuthorized() {
|
||||||
export function bytesToMB(bytes: number) {
|
export function bytesToMB(bytes: number) {
|
||||||
return Math.floor(bytes / (1024 * 1024));
|
return Math.floor(bytes / (1024 * 1024));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatBytes(bytes: number, decimals = 2) {
|
export function formatBytes(bytes: number, decimals = 2) {
|
||||||
console.log(bytes);
|
|
||||||
if (!+bytes) return "0 Bytes";
|
if (!+bytes) return "0 Bytes";
|
||||||
|
|
||||||
const k = 1024;
|
const k = 1024;
|
||||||
const dm = decimals < 0 ? 0 : decimals;
|
const dm = decimals < 0 ? 0 : decimals;
|
||||||
const sizes = [
|
const sizes = ["بایت", "کیلوبایت", "مگابایت", "گیگابایت", "ترابایت", "PiB", "EiB", "ZiB", "YiB"];
|
||||||
"بایت",
|
|
||||||
"کیلوبایت",
|
|
||||||
"مگابایت",
|
|
||||||
"گیگابایت",
|
|
||||||
"TiB",
|
|
||||||
"PiB",
|
|
||||||
"EiB",
|
|
||||||
"ZiB",
|
|
||||||
"YiB",
|
|
||||||
];
|
|
||||||
// const sizes = [
|
|
||||||
// "Bytes",
|
|
||||||
// "KB",
|
|
||||||
// "MB",
|
|
||||||
// "GiB",
|
|
||||||
// "TiB",
|
|
||||||
// "PiB",
|
|
||||||
// "EiB",
|
|
||||||
// "ZiB",
|
|
||||||
// "YiB",
|
|
||||||
// ];
|
|
||||||
|
|
||||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||||
|
const psFloaat = parseFloat((bytes / Math.pow(k, i)).toFixed(dm))
|
||||||
|
const sz = sizes[i]
|
||||||
|
|
||||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
// return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
||||||
}
|
return [psFloaat , sz]
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue