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