fix:dashboard filter

This commit is contained in:
Rama Priyanto 2025-06-17 23:55:17 +07:00
parent f0bd7e2513
commit 77178d87fe
3 changed files with 84 additions and 86 deletions

View File

@ -93,7 +93,7 @@ export default function Login() {
}
// login tanpa otp
// loading();
loading();
// const response = await postSignIn(data);
// if (response?.error) {
// error("Username / Password Tidak Sesuai");

View File

@ -189,7 +189,7 @@ export default function DashboardContainer() {
useEffect(() => {
fetchPostCount();
}, [postContentDate]);
}, [postContentDate, selectedCategory]);
async function fetchPostCount() {
const getDate = (data: any) => {
@ -205,7 +205,8 @@ export default function DashboardContainer() {
)}:00`,
`${getTime(postContentDate.end.hour)}:${getTime(
postContentDate.end.minute
)}:00`
)}:00`,
selectedCategory === "polda" ? "" : selectedCategory
);
setPostCount(getTableNumberStats(res?.data?.data));
}
@ -294,9 +295,10 @@ export default function DashboardContainer() {
`${getTime(postContentDate.start.hour)}:${getTime(
postContentDate.start.minute
)}:00`,
`${getTime(postContentDate.end.hour)}-${getTime(
`${getTime(postContentDate.end.hour)}:${getTime(
postContentDate.end.minute
)}:00`,
"",
id
);
const polresNowData = getTableNumberStats(res?.data?.data);
@ -459,8 +461,7 @@ export default function DashboardContainer() {
</div>
</div>
<div className="flex flex-col gap-1 lg:h-[500px] overflow-y-auto">
{roleId && Number(roleId) < 3 ? (
selectedCategory === "polda" ? (
{roleId && Number(roleId) < 3 && selectedCategory == "polda" ? (
<Accordion
selectedKeys={selectedAccordion}
onSelectionChange={(e) => handleSelectionChange(e)}
@ -529,24 +530,6 @@ export default function DashboardContainer() {
</AccordionItem>
))}
</Accordion>
) : (
<div className="flex flex-row gap-1 py-1">
<div className="w-[5%]">-</div>
<div className="w-[85%]">Article Seluruh Polres</div>
<div className={`w-[10%] text-center `}>
<a
onClick={() => {
setSelectedUnit("Seluruh Polres");
openModalArticle();
}}
className="flex flex-row gap-1 items-center cursor-pointer"
>
122
<EyeIconMdi size={12} />
</a>
</div>
</div>
)
) : (
postCount?.map((list) => (
<div
@ -559,8 +542,22 @@ export default function DashboardContainer() {
className={`w-[10%] text-center ${
list?.totalArticle === 0 && "bg-red-600 text-white"
}`}
>
<a
onClick={() => {
if (list?.totalArticle !== 0) {
setSelectedUnit(list?.userLevelName);
openModalArticle();
}
}}
className={`w-[10%] text-start cursor-pointer flex flex-row gap-1 items-center justify-end ${
list?.totalArticle === 0 &&
"bg-red-600 text-white cursor-default "
}`}
>
{list?.totalArticle}
<EyeIconMdi />
</a>
</div>
</div>
))

View File

@ -193,6 +193,7 @@ export async function getUserLevelDataStat(
endDate: string,
startTime: string,
endTime: string,
levelType: string,
levelId?: number
) {
// const headers = {
@ -200,7 +201,7 @@ export async function getUserLevelDataStat(
// Authorization: `Bearer ${token}`,
// };
return await httpGetInterceptor(
`/articles/statistic/user-levels?startDate=${startDate}&endDate=${endDate}&startTime=${startTime}&endTime=${endTime}&userLevelId=${
`/articles/statistic/user-levels?startDate=${startDate}&endDate=${endDate}&startTime=${startTime}&endTime=${endTime}&levelType=${levelType}&userLevelId=${
levelId || ""
}`
);