fix:dashboard filter
This commit is contained in:
parent
f0bd7e2513
commit
77178d87fe
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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,94 +461,75 @@ 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" ? (
|
||||
<Accordion
|
||||
selectedKeys={selectedAccordion}
|
||||
onSelectionChange={(e) => handleSelectionChange(e)}
|
||||
selectionMode="multiple"
|
||||
className="w-full"
|
||||
>
|
||||
{postCount?.map((list) => (
|
||||
<AccordionItem
|
||||
key={list.userLevelId}
|
||||
aria-label={list.userLevelName}
|
||||
title={
|
||||
{roleId && Number(roleId) < 3 && selectedCategory == "polda" ? (
|
||||
<Accordion
|
||||
selectedKeys={selectedAccordion}
|
||||
onSelectionChange={(e) => handleSelectionChange(e)}
|
||||
selectionMode="multiple"
|
||||
className="w-full"
|
||||
>
|
||||
{postCount?.map((list) => (
|
||||
<AccordionItem
|
||||
key={list.userLevelId}
|
||||
aria-label={list.userLevelName}
|
||||
title={
|
||||
<div
|
||||
key={list.userLevelId}
|
||||
className="flex flex-row gap-1 py-1"
|
||||
>
|
||||
<div className="w-[5%]">{list?.no}</div>
|
||||
<div className="w-[85%]">{list?.userLevelName}</div>
|
||||
<div
|
||||
key={list.userLevelId}
|
||||
className="flex flex-row gap-1 py-1"
|
||||
className={`w-[10%] text-center ${
|
||||
list?.totalArticle === 0 &&
|
||||
"bg-red-600 text-white "
|
||||
}`}
|
||||
>
|
||||
<div className="w-[5%]">{list?.no}</div>
|
||||
<div className="w-[85%]">{list?.userLevelName}</div>
|
||||
{list?.totalArticle}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{polresData[list?.userLevelId] ? (
|
||||
polresData[list?.userLevelId]?.map(
|
||||
(child: any, index: number) => (
|
||||
<div
|
||||
className={`w-[10%] text-center ${
|
||||
list?.totalArticle === 0 &&
|
||||
"bg-red-600 text-white "
|
||||
key={child.userLevelId}
|
||||
className={`flex flex-row gap-1 py-1 ${
|
||||
index ===
|
||||
polresData[list?.userLevelId].length - 1
|
||||
? ""
|
||||
: "border-b-1"
|
||||
}`}
|
||||
>
|
||||
{list?.totalArticle}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{polresData[list?.userLevelId] ? (
|
||||
polresData[list?.userLevelId]?.map(
|
||||
(child: any, index: number) => (
|
||||
<div
|
||||
key={child.userLevelId}
|
||||
className={`flex flex-row gap-1 py-1 ${
|
||||
index ===
|
||||
polresData[list?.userLevelId].length - 1
|
||||
? ""
|
||||
: "border-b-1"
|
||||
<div className="w-[5%]"></div>
|
||||
<div className="w-[85%]">
|
||||
{child?.userLevelName}
|
||||
</div>
|
||||
<a
|
||||
onClick={() => {
|
||||
if (list?.totalArticle !== 0) {
|
||||
setSelectedUnit(child?.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 "
|
||||
}`}
|
||||
>
|
||||
<div className="w-[5%]"></div>
|
||||
<div className="w-[85%]">
|
||||
{child?.userLevelName}
|
||||
</div>
|
||||
<a
|
||||
onClick={() => {
|
||||
if (list?.totalArticle !== 0) {
|
||||
setSelectedUnit(child?.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 "
|
||||
}`}
|
||||
>
|
||||
{child?.totalArticle}
|
||||
<EyeIconMdi size={12} />
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
{child?.totalArticle}
|
||||
<EyeIconMdi size={12} />
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
) : (
|
||||
<Skeleton className="h-3 w-full rounded-lg" />
|
||||
)}
|
||||
</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>
|
||||
)
|
||||
)
|
||||
) : (
|
||||
<Skeleton className="h-3 w-full rounded-lg" />
|
||||
)}
|
||||
</AccordionItem>
|
||||
))}
|
||||
</Accordion>
|
||||
) : (
|
||||
postCount?.map((list) => (
|
||||
<div
|
||||
|
|
@ -560,7 +543,21 @@ export default function DashboardContainer() {
|
|||
list?.totalArticle === 0 && "bg-red-600 text-white"
|
||||
}`}
|
||||
>
|
||||
{list?.totalArticle}
|
||||
<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>
|
||||
))
|
||||
|
|
|
|||
|
|
@ -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 || ""
|
||||
}`
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue