This commit is contained in:
Sabda Yagra 2025-11-18 08:23:30 +07:00
commit d332fa6173
3 changed files with 19 additions and 18 deletions

View File

@ -47,7 +47,7 @@ const columns: ColumnDef<any>[] = [
{ {
accessorKey: "link", accessorKey: "link",
header: "Jumlah Amplifikasi", header: "Jumlah Amplifikasi",
cell: ({ row }) => <span>{row.getValue("link")}</span>, cell: ({ row }) => <span>{row.getValue("resultTotal")}</span>,
}, },
// { // {
// accessorKey: "status", // accessorKey: "status",
@ -55,20 +55,15 @@ const columns: ColumnDef<any>[] = [
// cell: ({ row }) => <span>{row.getValue("status")}</span>, // cell: ({ row }) => <span>{row.getValue("status")}</span>,
// }, // },
{ {
accessorKey: "status", accessorKey: "isProcessing",
header: () => <div className="text-center">Status</div>, header: () => <div className="text-center">Status</div>,
cell: ({ row }) => { cell: ({ row }) => {
const raw = row.getValue("status"); const raw = row.getValue("isProcessing");
var status = "Sedang Diproses"
let value: string | number = "-"; if (Boolean(raw) == true) {
status = "Selesai Diproses";
if (typeof raw === "string" || typeof raw === "number") {
value = raw;
} else if (raw && typeof raw === "object") {
value = JSON.stringify(raw);
} }
return <div className="text-center">{status}</div>;
return <div className="text-center">{value}</div>;
}, },
}, },
{ {

View File

@ -29,6 +29,7 @@ import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking"
import ImageBlurry from "@/components/ui/image-blurry"; import ImageBlurry from "@/components/ui/image-blurry";
import Image from "next/image"; import Image from "next/image";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { sendMediaRewriteToEmail } from "@/service/content/content";
const page = () => { const page = () => {
const [, setProfile] = useState(); const [, setProfile] = useState();
@ -175,18 +176,16 @@ const page = () => {
} }
}; };
async function shareToEmail() { async function shareToEmail(uploadId: any) {
if (Number(userRoleId) < 1 || userRoleId == undefined) { if (Number(userRoleId) < 1 || userRoleId == undefined) {
router.push("/auth/login"); router.push("/auth/login");
} else { } else {
const data = { const data = {
mediaUploadId: id?.split("-")?.[0], id: uploadId,
email: emailShareList || [emailShareInput], email: emailShareList || [emailShareInput],
message: emailMessageInput,
url: window.location.href,
}; };
loading(); loading();
const res = await sendMediaUploadToEmail(data); const res = await sendMediaRewriteToEmail(data.id, data.email);
if (res?.error) { if (res?.error) {
error(res.message); error(res.message);
return false; return false;
@ -196,6 +195,7 @@ const page = () => {
} }
} }
const handleEmailList = (e: any) => { const handleEmailList = (e: any) => {
const arrayEmail: any = []; const arrayEmail: any = [];
for (let i = 0; i < emailShareList?.length; i += 1) { for (let i = 0; i < emailShareList?.length; i += 1) {
@ -328,7 +328,7 @@ const page = () => {
</div> </div>
<Button <Button
className="bg-blue-500 text-white p-2 w-fit rounded-lg" className="bg-blue-500 text-white p-2 w-fit rounded-lg"
onClick={() => shareToEmail()} onClick={() => shareToEmail(image.id)}
> >
{t("send", { defaultValue: "Send" })} {t("send", { defaultValue: "Send" })}
</Button> </Button>

View File

@ -255,6 +255,12 @@ export async function saveContentRewrite(data: any) {
const url = "media/rewrite"; const url = "media/rewrite";
return httpPostInterceptor(url, data); return httpPostInterceptor(url, data);
} }
export async function sendMediaRewriteToEmail(id: any, email: any) {
const url = `media/rewrite/share-to-email?id=${id}&email=${email}`;
return httpPostInterceptor(url, null);
}
export async function saveUserReports(data: any) { export async function saveUserReports(data: any) {
const url = "public/users/reports"; const url = "public/users/reports";
return httpPostInterceptor(url, data); return httpPostInterceptor(url, data);