fix: button approve in detail conten admin

This commit is contained in:
Sabda Yagra 2025-10-21 11:19:04 +07:00
parent a60e661a6e
commit ecf4a64b03
4 changed files with 174 additions and 101 deletions

View File

@ -1864,14 +1864,47 @@ export default function FormAudioDetail() {
</Dialog>
</Card>
{Number(roleId) === 14 ? (
// 🔹 Jika roleId = 14, langsung tampilkan tombol tanpa pengecekan lain
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />{" "}
<Icon icon="fa:check" className="mr-3" />
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
onClick={() => actionApproval("3")}
className="bg-orange-400 hover:bg-orange-300"
type="button"
>
<Icon icon="fa:comment-o" className="mr-3" />{" "}
{t("revision", { defaultValue: "Revision" })}
</Button>
<Button
onClick={() => actionApproval("4")}
color="destructive"
type="button"
>
<Icon icon="fa:times" className="mr-3" />
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
) : (Number(detail?.needApprovalFromLevel) ===
Number(userLevelId) ||
(detail?.isInternationalMedia === true &&
detail?.isForwardFromNational === true &&
Number(detail?.statusId) === 1)) &&
(Number(detail?.uploadedById) === Number(userId) ||
Number(detail?.needApprovalFromLevel) ===
Number(userLevelId)) ? (
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
@ -1891,38 +1924,6 @@ export default function FormAudioDetail() {
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
) : Number(detail?.needApprovalFromLevel) ===
Number(userLevelId) ? (
Number(detail?.uploadedById) === Number(userId) ? (
""
) : (
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />{" "}
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
onClick={() => actionApproval("3")}
className="bg-orange-400 hover:bg-orange-300"
type="button"
>
<Icon icon="fa:comment-o" className="mr-3" />{" "}
{t("revision", { defaultValue: "Revision" })}
</Button>
<Button
onClick={() => actionApproval("4")}
color="destructive"
type="button"
>
<Icon icon="fa:times" className="mr-3" />
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
)
) : (
""
)}

View File

@ -2126,7 +2126,74 @@ export default function FormImageDetail() {
</DialogContent>
</Dialog>
</Card>
{Number(roleId) === 14 ? (
// 🔹 Jika roleId = 14 → selalu tampilkan tombol tanpa pengecekan tambahan
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
onClick={() => actionApproval("3")}
className="bg-orange-400 hover:bg-orange-300"
type="button"
>
<Icon icon="fa:comment-o" className="mr-3" />{" "}
{t("revision", { defaultValue: "Revision" })}
</Button>
<Button
onClick={() => actionApproval("4")}
color="destructive"
type="button"
>
<Icon icon="fa:times" className="mr-3" />
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
) : (Number(detail?.needApprovalFromLevel) ===
Number(userLevelId) ||
(detail?.isInternationalMedia === true &&
detail?.isForwardFromNational === true &&
Number(detail?.statusId) === 1)) &&
(Number(detail?.uploadedById) === Number(userId) ||
Number(detail?.needApprovalFromLevel) ===
Number(userLevelId)) ? (
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
onClick={() => actionApproval("3")}
className="bg-orange-400 hover:bg-orange-300"
type="button"
>
<Icon icon="fa:comment-o" className="mr-3" />{" "}
{t("revision", { defaultValue: "Revision" })}
</Button>
<Button
onClick={() => actionApproval("4")}
color="destructive"
type="button"
>
<Icon icon="fa:times" className="mr-3" />
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
) : (
""
)}
{/* {Number(roleId) === 14 ? (
// 🔹 Jika roleId = 14 → tampilkan tombol tanpa pengecekan tambahan
<div className="flex flex-col gap-2 p-3">
<Button
@ -2190,7 +2257,7 @@ export default function FormImageDetail() {
)
) : (
""
)}
)} */}
{/* {Number(detail?.needApprovalFromLevel) == Number(userLevelId) ||
(detail?.isInternationalMedia == true &&

View File

@ -1865,14 +1865,47 @@ export default function FormTeksDetail() {
</Dialog>
</Card>
{Number(roleId) === 14 ? (
// 🔹 Jika roleId = 14 → tampilkan tombol langsung tanpa pengecekan tambahan
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />{" "}
<Icon icon="fa:check" className="mr-3" />
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
onClick={() => actionApproval("3")}
className="bg-orange-400 hover:bg-orange-300"
type="button"
>
<Icon icon="fa:comment-o" className="mr-3" />{" "}
{t("revision", { defaultValue: "Revision" })}
</Button>
<Button
onClick={() => actionApproval("4")}
color="destructive"
type="button"
>
<Icon icon="fa:times" className="mr-3" />
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
) : (Number(detail?.needApprovalFromLevel) ===
Number(userLevelId) ||
(detail?.isInternationalMedia === true &&
detail?.isForwardFromNational === true &&
Number(detail?.statusId) === 1)) &&
(Number(detail?.uploadedById) === Number(userId) ||
Number(detail?.needApprovalFromLevel) ===
Number(userLevelId)) ? (
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
@ -1892,37 +1925,6 @@ export default function FormTeksDetail() {
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
) : Number(detail?.needApprovalFromLevel) == Number(userLevelId) ? (
Number(detail?.uploadedById) == Number(userId) ? (
""
) : (
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />{" "}
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
onClick={() => actionApproval("3")}
className="bg-orange-400 hover:bg-orange-300"
type="button"
>
<Icon icon="fa:comment-o" className="mr-3" />{" "}
{t("revision", { defaultValue: "Revision" })}
</Button>
<Button
onClick={() => actionApproval("4")}
color="destructive"
type="button"
>
<Icon icon="fa:times" className="mr-3" />
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
)
) : (
""
)}

View File

@ -1865,14 +1865,48 @@ export default function FormVideoDetail() {
</Dialog>
</Card>
{Number(roleId) === 14 ? (
// 🔹 Jika roleId = 14 → tampilkan tombol langsung tanpa pengecekan lain
// 🔹 Jika roleId = 14 → selalu tampilkan tombol tanpa pengecekan tambahan
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />{" "}
<Icon icon="fa:check" className="mr-3" />
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
onClick={() => actionApproval("3")}
className="bg-orange-400 hover:bg-orange-300"
type="button"
>
<Icon icon="fa:comment-o" className="mr-3" />{" "}
{t("revision", { defaultValue: "Revision" })}
</Button>
<Button
onClick={() => actionApproval("4")}
color="destructive"
type="button"
>
<Icon icon="fa:times" className="mr-3" />
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
) : (Number(detail?.needApprovalFromLevel) ===
Number(userLevelId) ||
(detail?.isInternationalMedia === true &&
detail?.isForwardFromNational === true &&
Number(detail?.statusId) === 1)) &&
(Number(detail?.uploadedById) === Number(userId) ||
Number(detail?.needApprovalFromLevel) ===
Number(userLevelId)) ? (
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
@ -1892,37 +1926,6 @@ export default function FormVideoDetail() {
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
) : Number(detail?.needApprovalFromLevel) == Number(userLevelId) ? (
Number(detail?.uploadedById) == Number(userId) ? (
""
) : (
<div className="flex flex-col gap-2 p-3">
<Button
onClick={() => actionApproval("2")}
color="primary"
type="button"
>
<Icon icon="fa:check" className="mr-3" />{" "}
{t("accept", { defaultValue: "Accept" })}
</Button>
<Button
onClick={() => actionApproval("3")}
className="bg-orange-400 hover:bg-orange-300"
type="button"
>
<Icon icon="fa:comment-o" className="mr-3" />{" "}
{t("revision", { defaultValue: "Revision" })}
</Button>
<Button
onClick={() => actionApproval("4")}
color="destructive"
type="button"
>
<Icon icon="fa:times" className="mr-3" />
{t("reject", { defaultValue: "Reject" })}
</Button>
</div>
)
) : (
""
)}