fix:button approver
This commit is contained in:
parent
3a12d7baa7
commit
3716fa3cd8
|
|
@ -48,10 +48,14 @@ export default function PromoDetailDialog({
|
|||
|
||||
const router = useRouter();
|
||||
|
||||
const [userRoleId, setUserRoleId] = useState<string | null>(null);
|
||||
|
||||
const MySwal = withReactContent(Swal);
|
||||
|
||||
// 🔹 Ambil userlevelId dari cookies
|
||||
useEffect(() => {
|
||||
const ulne = Cookies.get("ulne"); // contoh: "3"
|
||||
setUserLevelId(ulne ?? null);
|
||||
const urie = Cookies.get("urie"); // contoh: "3"
|
||||
setUserRoleId(urie ?? null);
|
||||
}, []);
|
||||
|
||||
// FORMAT TANGGAL → DD-MM-YYYY
|
||||
|
|
@ -325,7 +329,7 @@ export default function PromoDetailDialog({
|
|||
<p className="text-center text-gray-600">Data tidak ditemukan</p>
|
||||
)}
|
||||
</div>
|
||||
{userLevelId !== "2" && promo && (
|
||||
{userRoleId !== "2" && promo && (
|
||||
<div className="flex justify-between items-center gap-3 px-6 py-4 border-t bg-[#F2F7FA]">
|
||||
{promo.status_id === 1 ? (
|
||||
<>
|
||||
|
|
@ -351,7 +355,7 @@ export default function PromoDetailDialog({
|
|||
Reject
|
||||
</Button>
|
||||
|
||||
{userLevelId === "1" && (
|
||||
{userRoleId === "1" && (
|
||||
<Button
|
||||
// variant="ghost"
|
||||
size="sm"
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ export default function DetailAgentForm(props: { isDetail: boolean }) {
|
|||
const id = params?.id;
|
||||
const [data, setData] = useState<any>(null);
|
||||
const [openApproverHistory, setOpenApproverHistory] = useState(false);
|
||||
const [userLevelId, setUserLevelId] = useState<string | null>(null);
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const [openCommentModal, setOpenCommentModal] = useState(false);
|
||||
|
|
@ -115,11 +115,17 @@ export default function DetailAgentForm(props: { isDetail: boolean }) {
|
|||
setOpenCommentModal(false);
|
||||
};
|
||||
|
||||
// 🔹 Ambil userlevelId dari cookies
|
||||
const [userRoleId, setUserRoleId] = useState<string | null>(null);
|
||||
|
||||
const MySwal = withReactContent(Swal);
|
||||
|
||||
// 🔹 Ambil userlevelId dari cookies
|
||||
useEffect(() => {
|
||||
const ulne = Cookies.get("ulne"); // contoh: "3"
|
||||
setUserLevelId(ulne ?? null);
|
||||
const urie = Cookies.get("urie"); // contoh: "3"
|
||||
setUserRoleId(urie ?? null);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, []);
|
||||
|
|
@ -313,7 +319,7 @@ export default function DetailAgentForm(props: { isDetail: boolean }) {
|
|||
<p>Jaecoo - Approver | 10/11/2026</p>
|
||||
</div>
|
||||
</div>
|
||||
{userLevelId !== "2" && data && (
|
||||
{userRoleId !== "2" && data && (
|
||||
<div className="flex justify-between items-center gap-3 px-6 py-4 border-t bg-[#F2F7FA] mt-10">
|
||||
{data.status_id === 1 ? (
|
||||
<>
|
||||
|
|
@ -333,7 +339,7 @@ export default function DetailAgentForm(props: { isDetail: boolean }) {
|
|||
Reject
|
||||
</Button>
|
||||
|
||||
{userLevelId === "1" && (
|
||||
{userRoleId === "1" && (
|
||||
<Button
|
||||
className="bg-green-600 hover:bg-green-700 text-white w-[180px]"
|
||||
onClick={() => handleApproveAgent(data.id)}
|
||||
|
|
|
|||
Loading…
Reference in New Issue