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