feat: update approval article
This commit is contained in:
parent
5a9ab0b127
commit
3c4f831703
|
|
@ -186,7 +186,7 @@ const usePendingApprovalColumns = () => {
|
||||||
View
|
View
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</Link>
|
</Link>
|
||||||
{canApprove && (
|
{/* {canApprove && (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
className="p-2 border-b text-green-700 bg-green-50 group rounded-none"
|
className="p-2 border-b text-green-700 bg-green-50 group rounded-none"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -197,7 +197,7 @@ const usePendingApprovalColumns = () => {
|
||||||
<CheckCircle className="w-4 h-4 me-1.5" />
|
<CheckCircle className="w-4 h-4 me-1.5" />
|
||||||
Approve
|
Approve
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
)} */}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ const usePendingApprovalColumns = () => {
|
||||||
View
|
View
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</Link>
|
</Link>
|
||||||
{canApprove && (
|
{/* {canApprove && (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
className="p-2 border-b text-green-700 bg-green-50 group rounded-none"
|
className="p-2 border-b text-green-700 bg-green-50 group rounded-none"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -197,7 +197,7 @@ const usePendingApprovalColumns = () => {
|
||||||
<CheckCircle className="w-4 h-4 me-1.5" />
|
<CheckCircle className="w-4 h-4 me-1.5" />
|
||||||
Approve
|
Approve
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
)} */}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ const usePendingApprovalColumns = () => {
|
||||||
View
|
View
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</Link>
|
</Link>
|
||||||
{canApprove && (
|
{/* {canApprove && (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
className="p-2 border-b text-green-700 bg-green-50 group rounded-none"
|
className="p-2 border-b text-green-700 bg-green-50 group rounded-none"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -197,7 +197,7 @@ const usePendingApprovalColumns = () => {
|
||||||
<CheckCircle className="w-4 h-4 me-1.5" />
|
<CheckCircle className="w-4 h-4 me-1.5" />
|
||||||
Approve
|
Approve
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
)} */}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ const usePendingApprovalColumns = () => {
|
||||||
View
|
View
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</Link>
|
</Link>
|
||||||
{canApprove && (
|
{/* {canApprove && (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
className="p-2 border-b text-green-700 bg-green-50 group rounded-none"
|
className="p-2 border-b text-green-700 bg-green-50 group rounded-none"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -203,7 +203,7 @@ const usePendingApprovalColumns = () => {
|
||||||
<CheckCircle className="w-4 h-4 me-1.5" />
|
<CheckCircle className="w-4 h-4 me-1.5" />
|
||||||
Approve
|
Approve
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
)} */}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -294,31 +294,19 @@ export default function FormVideoDetail() {
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const data = {
|
const data = {
|
||||||
mediaUploadId: id,
|
action: status == "2" ? "approve" : status == "3" ? "revision" : "reject",
|
||||||
statusId: status,
|
|
||||||
message: description,
|
message: description,
|
||||||
files: isUserMabesApprover ? getPlacement() : [],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setModalOpen(false);
|
setModalOpen(false);
|
||||||
loading();
|
loading();
|
||||||
const response = await submitApproval(data);
|
const response = await submitApproval(id, data);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
error(response.message);
|
error(response.message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataReject = {
|
|
||||||
listFiles: rejectedFiles,
|
|
||||||
};
|
|
||||||
|
|
||||||
const resReject = await rejectFiles(dataReject);
|
|
||||||
|
|
||||||
if (resReject?.error) {
|
|
||||||
error(resReject.message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
close();
|
close();
|
||||||
submitApprovalSuccesss();
|
submitApprovalSuccesss();
|
||||||
|
|
||||||
|
|
@ -403,7 +391,7 @@ export default function FormVideoDetail() {
|
||||||
confirmButtonText: "OK",
|
confirmButtonText: "OK",
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
router.push("/contributor/content/video");
|
router.push("/admin/content/video");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -366,32 +366,19 @@ export default function FormAudioDetail() {
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const data = {
|
const data = {
|
||||||
mediaUploadId: id,
|
action: status == "2" ? "approve" : status == "3" ? "revision" : "reject",
|
||||||
statusId: status,
|
|
||||||
message: description,
|
message: description,
|
||||||
// files: [],
|
|
||||||
files: isUserMabesApprover ? getPlacement() : [],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setModalOpen(false);
|
setModalOpen(false);
|
||||||
loading();
|
loading();
|
||||||
const response = await submitApproval(data);
|
const response = await submitApproval(id, data);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
error(response.message);
|
error(response.message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataReject = {
|
|
||||||
listFiles: rejectedFiles,
|
|
||||||
};
|
|
||||||
|
|
||||||
const resReject = await rejectFiles(dataReject);
|
|
||||||
|
|
||||||
if (resReject?.error) {
|
|
||||||
error(resReject.message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
close();
|
close();
|
||||||
submitApprovalSuccesss();
|
submitApprovalSuccesss();
|
||||||
|
|
||||||
|
|
@ -471,7 +458,7 @@ export default function FormAudioDetail() {
|
||||||
confirmButtonColor: "#3085d6",
|
confirmButtonColor: "#3085d6",
|
||||||
confirmButtonText: "OK",
|
confirmButtonText: "OK",
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
router.push("/in/contributor/content/audio");
|
router.push("/admin/content/audio");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -321,32 +321,19 @@ export default function FormTeksDetail() {
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const data = {
|
const data = {
|
||||||
mediaUploadId: id,
|
action: status == "2" ? "approve" : status == "3" ? "revision" : "reject",
|
||||||
statusId: status,
|
|
||||||
message: description,
|
message: description,
|
||||||
files: isUserMabesApprover ? getPlacement() : [],
|
|
||||||
};
|
};
|
||||||
setModalOpen(false);
|
|
||||||
|
|
||||||
|
setModalOpen(false);
|
||||||
loading();
|
loading();
|
||||||
const response = await submitApproval(data);
|
const response = await submitApproval(id, data);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
error(response.message);
|
error(response.message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataReject = {
|
|
||||||
listFiles: rejectedFiles,
|
|
||||||
};
|
|
||||||
|
|
||||||
const resReject = await rejectFiles(dataReject);
|
|
||||||
|
|
||||||
if (resReject?.error) {
|
|
||||||
error(resReject.message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
close();
|
close();
|
||||||
submitApprovalSuccesss();
|
submitApprovalSuccesss();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -452,34 +452,19 @@ export default function FormImageDetail() {
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const data = {
|
const data = {
|
||||||
mediaUploadId: id,
|
action: status == "2" ? "approve" : status == "3" ? "revision" : "reject",
|
||||||
statusId: status,
|
|
||||||
message: description,
|
message: description,
|
||||||
files: isUserMabesApprover ? getPlacement() : [],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setModalOpen(false);
|
setModalOpen(false);
|
||||||
loading();
|
loading();
|
||||||
const response = await submitApproval(data);
|
const response = await submitApproval(id, data);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
error(response.message);
|
error(response.message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataReject = {
|
|
||||||
listFiles: rejectedFiles,
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("reject", dataReject);
|
|
||||||
|
|
||||||
const resReject = await rejectFiles(dataReject);
|
|
||||||
|
|
||||||
if (resReject?.error) {
|
|
||||||
error(resReject.message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
close();
|
close();
|
||||||
submitApprovalSuccesss();
|
submitApprovalSuccesss();
|
||||||
|
|
||||||
|
|
@ -551,7 +536,7 @@ export default function FormImageDetail() {
|
||||||
confirmButtonText: "OK",
|
confirmButtonText: "OK",
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
router.push("/contributor/content/image");
|
router.push("/admin/content/image");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ const nextConfig = {
|
||||||
{ protocol: "https", hostname: "avatars.githubusercontent.com" },
|
{ protocol: "https", hostname: "avatars.githubusercontent.com" },
|
||||||
{ protocol: "https", hostname: "i.pravatar.cc" },
|
{ protocol: "https", hostname: "i.pravatar.cc" },
|
||||||
{ protocol: "https", hostname: "dev.mikulnews.com" },
|
{ protocol: "https", hostname: "dev.mikulnews.com" },
|
||||||
|
{ protocol: "https", hostname: "kontenhumas.com" },
|
||||||
{ protocol: "https", hostname: "netidhub.com" },
|
{ protocol: "https", hostname: "netidhub.com" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -285,8 +285,8 @@ export async function convertSPIT(data: any) {
|
||||||
return httpPostInterceptor(url, data);
|
return httpPostInterceptor(url, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function submitApproval(data: any) {
|
export async function submitApproval(id: string, data: any) {
|
||||||
const url = "media/approval";
|
const url = `article-approval-flows/articles/${id}/approve`;
|
||||||
return httpPostInterceptor(url, data);
|
return httpPostInterceptor(url, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ export async function listArticles(
|
||||||
categoryId?: string,
|
categoryId?: string,
|
||||||
sortBy = "createdAt"
|
sortBy = "createdAt"
|
||||||
) {
|
) {
|
||||||
let url = `articles?page=${page}&totalPage=${totalPage}`;
|
let url = `articles?page=${page}&totalPage=${totalPage}&isPublish=true`;
|
||||||
|
|
||||||
if (typeId !== undefined) url += `&typeId=${typeId}`;
|
if (typeId !== undefined) url += `&typeId=${typeId}`;
|
||||||
if (search) url += `&title=${encodeURIComponent(search)}`;
|
if (search) url += `&title=${encodeURIComponent(search)}`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue