diff --git a/package.json b/package.json
index 95ff8a01..5b708480 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "desa-darmasaba",
- "version": "0.1.52",
+ "version": "0.1.53",
"private": true,
"scripts": {
"dev": "next dev",
diff --git a/src/app/admin/(dashboard)/kesehatan/posyandu/_com/layoutTabs.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/_com/layoutTabs.tsx
new file mode 100644
index 00000000..7f317cdf
--- /dev/null
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/_com/layoutTabs.tsx
@@ -0,0 +1,161 @@
+/* eslint-disable react-hooks/exhaustive-deps */
+'use client'
+import colors from '@/con/colors';
+import { Box, ScrollArea, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
+import { IconBabyCarriage, IconCategory, IconClipboard, IconClipboardText, IconGenderDemigirl, IconNews } from '@tabler/icons-react';
+import { usePathname, useRouter } from 'next/navigation';
+import React, { useEffect, useState } from 'react';
+
+function LayoutTabsPosyandu({ children }: { children: React.ReactNode }) {
+ const router = useRouter();
+ const pathname = usePathname();
+
+ const tabs = [
+ {
+ label: "List Posyandu",
+ value: "list_posyandu",
+ href: "/admin/kesehatan/posyandu/list-posyandu",
+ icon:
+ },
+ {
+ label: "Balita",
+ value: "balita",
+ href: "/admin/kesehatan/posyandu/balita",
+ icon:
+ },
+ {
+ label: "Ibu Hamil",
+ value: "ibu_hamil",
+ href: "/admin/kesehatan/posyandu/ibu-hamil",
+ icon:
+ },
+ {
+ label: "Ringkasan Kesehatan",
+ value: "ringkasan_kesehatan",
+ href: "/admin/kesehatan/posyandu/ringkasan-kesehatan",
+ icon:
+ }
+ ];
+
+ const currentTab = tabs.find(tab => tab.href === pathname)
+ const [activeTab, setActiveTab] = useState(currentTab?.value || tabs[0].value);
+
+ const handleTabChange = (value: string | null) => {
+ const tab = tabs.find(t => t.value === value)
+ if (tab) {
+ router.push(tab.href)
+ }
+ setActiveTab(value)
+ }
+
+ useEffect(() => {
+ const match = tabs.find(tab => tab.href === pathname)
+ if (match) {
+ setActiveTab(match.value)
+ }
+ }, [pathname])
+
+ return (
+
+ Layanan
+
+ {/* ✅ Scroll horizontal wrapper */}
+
+
+
+ {tabs.map((tab, i) => (
+
+ {tab.label}
+
+ ))}
+
+
+
+
+
+
+
+
+ {tabs.map((tab, i) => (
+
+ {tab.label}
+
+ ))}
+
+
+
+
+ {tabs.map((tab, i) => (
+
+ {/* Konten dummy, bisa diganti sesuai routing */}
+ <>{children}>
+
+ ))}
+
+
+ );
+}
+
+export default LayoutTabsPosyandu;
diff --git a/src/app/admin/(dashboard)/kesehatan/balita/create/page.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/balita/create/page.tsx
similarity index 97%
rename from src/app/admin/(dashboard)/kesehatan/balita/create/page.tsx
rename to src/app/admin/(dashboard)/kesehatan/posyandu/balita/create/page.tsx
index 480f41f8..cdb365c5 100644
--- a/src/app/admin/(dashboard)/kesehatan/balita/create/page.tsx
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/balita/create/page.tsx
@@ -1,5 +1,6 @@
'use client';
+import balitaState from '@/app/admin/(dashboard)/_state/kesehatan/balita/balita';
import colors from '@/con/colors';
import {
Box,
@@ -19,7 +20,7 @@ import {
import { IconArrowBack } from '@tabler/icons-react';
import { useRouter } from 'next/navigation';
import { useProxy } from 'valtio/utils';
-import balitaState from '../../../_state/kesehatan/balita/balita';
+
export default function BalitaCreatePage() {
const router = useRouter();
@@ -30,7 +31,7 @@ export default function BalitaCreatePage() {
const ok = await balitaState.create.submit();
if (ok) {
balitaState.create.reset();
- router.push('/admin/kesehatan/balita');
+ router.push('/admin/kesehatan/posyandu/balita');
}
};
diff --git a/src/app/admin/(dashboard)/kesehatan/balita/edit/[id]/page.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/balita/edit/[id]/page.tsx
similarity index 97%
rename from src/app/admin/(dashboard)/kesehatan/balita/edit/[id]/page.tsx
rename to src/app/admin/(dashboard)/kesehatan/posyandu/balita/edit/[id]/page.tsx
index 5423519e..11674c45 100644
--- a/src/app/admin/(dashboard)/kesehatan/balita/edit/[id]/page.tsx
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/balita/edit/[id]/page.tsx
@@ -1,5 +1,6 @@
'use client';
+import balitaState from '@/app/admin/(dashboard)/_state/kesehatan/balita/balita';
import colors from '@/con/colors';
import {
Box,
@@ -20,7 +21,7 @@ import { IconArrowBack } from '@tabler/icons-react';
import { useParams, useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { useProxy } from 'valtio/utils';
-import balitaState from '../../../../_state/kesehatan/balita/balita';
+
export default function BalitaEditPage() {
const router = useRouter();
@@ -35,7 +36,7 @@ export default function BalitaEditPage() {
const handleSubmit = async () => {
const ok = await balitaState.edit.update();
- if (ok) router.push('/admin/kesehatan/balita');
+ if (ok) router.push('/admin/kesehatan/posyandu/balita');
};
return (
diff --git a/src/app/admin/(dashboard)/kesehatan/balita/page.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/balita/page.tsx
similarity index 95%
rename from src/app/admin/(dashboard)/kesehatan/balita/page.tsx
rename to src/app/admin/(dashboard)/kesehatan/posyandu/balita/page.tsx
index 5de9bc7b..029efd2e 100644
--- a/src/app/admin/(dashboard)/kesehatan/balita/page.tsx
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/balita/page.tsx
@@ -20,7 +20,8 @@ import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';
import { useProxy } from 'valtio/utils';
-import balitaState from '../../_state/kesehatan/balita/balita';
+import balitaState from '../../../_state/kesehatan/balita/balita';
+
const STUNTING_COLORS: Record = {
NORMAL: 'green',
@@ -81,7 +82,7 @@ export default function BalitaPage() {
router.push(`/admin/kesehatan/balita/edit/${d.id}`)}
+ onClick={() => router.push(`/admin/kesehatan/posyandu/balita/edit/${d.id}`)}
>
@@ -104,7 +105,7 @@ export default function BalitaPage() {
Balita Terdaftar
}
- onClick={() => router.push('/admin/kesehatan/balita/create')}
+ onClick={() => router.push('/admin/kesehatan/posyandu/balita/create')}
radius="md"
style={{
background: `linear-gradient(135deg, ${colors['blue-button']}, #4facfe)`,
diff --git a/src/app/admin/(dashboard)/kesehatan/ibu-hamil/create/page.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/create/page.tsx
similarity index 96%
rename from src/app/admin/(dashboard)/kesehatan/ibu-hamil/create/page.tsx
rename to src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/create/page.tsx
index 17bef600..2a25098d 100644
--- a/src/app/admin/(dashboard)/kesehatan/ibu-hamil/create/page.tsx
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/create/page.tsx
@@ -1,5 +1,6 @@
'use client';
+import ibuHamilState from '@/app/admin/(dashboard)/_state/kesehatan/ibu-hamil/ibuHamil';
import colors from '@/con/colors';
import {
Box,
@@ -17,7 +18,7 @@ import {
import { IconArrowBack } from '@tabler/icons-react';
import { useRouter } from 'next/navigation';
import { useProxy } from 'valtio/utils';
-import ibuHamilState from '../../../_state/kesehatan/ibu-hamil/ibuHamil';
+
export default function IbuHamilCreatePage() {
const router = useRouter();
@@ -28,7 +29,7 @@ export default function IbuHamilCreatePage() {
const ok = await ibuHamilState.create.submit();
if (ok) {
ibuHamilState.create.reset();
- router.push('/admin/kesehatan/ibu-hamil');
+ router.push('/admin/kesehatan/posyandu/ibu-hamil');
}
};
diff --git a/src/app/admin/(dashboard)/kesehatan/ibu-hamil/edit/[id]/page.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/edit/[id]/page.tsx
similarity index 96%
rename from src/app/admin/(dashboard)/kesehatan/ibu-hamil/edit/[id]/page.tsx
rename to src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/edit/[id]/page.tsx
index 13fc5bec..efb2f554 100644
--- a/src/app/admin/(dashboard)/kesehatan/ibu-hamil/edit/[id]/page.tsx
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/edit/[id]/page.tsx
@@ -1,5 +1,6 @@
'use client';
+import ibuHamilState from '@/app/admin/(dashboard)/_state/kesehatan/ibu-hamil/ibuHamil';
import colors from '@/con/colors';
import {
Box,
@@ -18,7 +19,6 @@ import { IconArrowBack } from '@tabler/icons-react';
import { useParams, useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { useProxy } from 'valtio/utils';
-import ibuHamilState from '../../../../_state/kesehatan/ibu-hamil/ibuHamil';
export default function IbuHamilEditPage() {
const router = useRouter();
@@ -33,7 +33,7 @@ export default function IbuHamilEditPage() {
const handleSubmit = async () => {
const ok = await ibuHamilState.edit.update();
- if (ok) router.push('/admin/kesehatan/ibu-hamil');
+ if (ok) router.push('/admin/kesehatan/posyandu/ibu-hamil');
};
return (
diff --git a/src/app/admin/(dashboard)/kesehatan/ibu-hamil/page.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/page.tsx
similarity index 95%
rename from src/app/admin/(dashboard)/kesehatan/ibu-hamil/page.tsx
rename to src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/page.tsx
index 358f56cf..110e4775 100644
--- a/src/app/admin/(dashboard)/kesehatan/ibu-hamil/page.tsx
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/ibu-hamil/page.tsx
@@ -20,7 +20,8 @@ import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';
import { useProxy } from 'valtio/utils';
-import ibuHamilState from '../../_state/kesehatan/ibu-hamil/ibuHamil';
+import ibuHamilState from '../../../_state/kesehatan/ibu-hamil/ibuHamil';
+
const STATUS_COLORS: Record = {
AKTIF: 'green',
@@ -64,7 +65,7 @@ export default function IbuHamilPage() {
router.push(`/admin/kesehatan/ibu-hamil/edit/${d.id}`)}
+ onClick={() => router.push(`/admin/kesehatan/posyandu/ibu-hamil/edit/${d.id}`)}
>
@@ -87,7 +88,7 @@ export default function IbuHamilPage() {
Ibu Hamil
}
- onClick={() => router.push('/admin/kesehatan/ibu-hamil/create')}
+ onClick={() => router.push('/admin/kesehatan/posyandu/ibu-hamil/create')}
radius="md"
style={{
background: `linear-gradient(135deg, ${colors['blue-button']}, #4facfe)`,
diff --git a/src/app/admin/(dashboard)/kesehatan/posyandu/layout.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/layout.tsx
new file mode 100644
index 00000000..4c30286e
--- /dev/null
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/layout.tsx
@@ -0,0 +1,35 @@
+'use client'
+import { Box } from '@mantine/core';
+import { usePathname } from 'next/navigation';
+import React from 'react';
+import LayoutTabsPosyandu from './_com/layoutTabs';
+
+function Layout({ children }: { children: React.ReactNode }) {
+ const pathname = usePathname();
+
+ // Contoh path:
+ // - /darmasaba/desa/berita/semua → panjang 5 → list
+ // - /darmasaba/desa/berita/Pemerintahan → panjang 5 → list
+ // - /darmasaba/desa/berita/Pemerintahan/123 → panjang 6 → detail
+
+ const segments = pathname.split('/').filter(Boolean);
+ const isDetailPage = segments.length >= 5;
+
+ if (isDetailPage) {
+ // Tampilkan tanpa tab menu
+ return (
+
+ {children}
+
+ );
+ }
+
+
+ return (
+
+ {children}
+
+ );
+}
+
+export default Layout;
diff --git a/src/app/admin/(dashboard)/kesehatan/posyandu/[id]/edit/page.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/list-posyandu/[id]/edit/page.tsx
similarity index 98%
rename from src/app/admin/(dashboard)/kesehatan/posyandu/[id]/edit/page.tsx
rename to src/app/admin/(dashboard)/kesehatan/posyandu/list-posyandu/[id]/edit/page.tsx
index 69b7e102..5734b83b 100644
--- a/src/app/admin/(dashboard)/kesehatan/posyandu/[id]/edit/page.tsx
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/list-posyandu/[id]/edit/page.tsx
@@ -1,6 +1,5 @@
/* eslint-disable react-hooks/exhaustive-deps */
'use client';
-
import EditEditor from '@/app/admin/(dashboard)/_com/editEditor';
import posyandustate from '@/app/admin/(dashboard)/_state/kesehatan/posyandu/posyandu';
import colors from '@/con/colors';
@@ -145,7 +144,7 @@ function EditPosyandu() {
await statePosyandu.edit.update();
toast.success('Posyandu berhasil diperbarui!');
- router.push('/admin/kesehatan/posyandu');
+ router.push('/admin/kesehatan/posyandu/list-posyandu');
} catch (error) {
console.error('Error updating posyandu:', error);
toast.error('Terjadi kesalahan saat memperbarui posyandu');
@@ -168,7 +167,7 @@ function EditPosyandu() {
};
return (
-
+
{/* Tombol Back */}
{/* Desktop Table */}
-
-
+
+
Nama Posyandu
@@ -130,7 +132,7 @@ function ListPosyandu({ search }: { search: string }) {
variant="light"
color="blue"
leftSection={}
- onClick={() => router.push(`/admin/kesehatan/posyandu/${item.id}`)}
+ onClick={() => router.push(`/admin/kesehatan/posyandu/list-posyandu/${item.id}`)}
>
Detail
@@ -192,7 +194,7 @@ function ListPosyandu({ search }: { search: string }) {
variant="light"
color="blue"
leftSection={}
- onClick={() => router.push(`/admin/kesehatan/posyandu/${item.id}`)}
+ onClick={() => router.push(`/admin/kesehatan/posyandu/list-posyandu/${item.id}`)}
fullWidth
>
Detail
diff --git a/src/app/admin/(dashboard)/kesehatan/ringkasan-kesehatan/page.tsx b/src/app/admin/(dashboard)/kesehatan/posyandu/ringkasan-kesehatan/page.tsx
similarity index 95%
rename from src/app/admin/(dashboard)/kesehatan/ringkasan-kesehatan/page.tsx
rename to src/app/admin/(dashboard)/kesehatan/posyandu/ringkasan-kesehatan/page.tsx
index 7953dffe..afab982f 100644
--- a/src/app/admin/(dashboard)/kesehatan/ringkasan-kesehatan/page.tsx
+++ b/src/app/admin/(dashboard)/kesehatan/posyandu/ringkasan-kesehatan/page.tsx
@@ -26,7 +26,8 @@ import {
import { useRouter } from 'next/navigation';
import { useEffect, useCallback } from 'react';
import { useProxy } from 'valtio/utils';
-import ringkasanKesehatanState from '../../_state/kesehatan/ringkasan-kesehatan/ringkasanKesehatan';
+import ringkasanKesehatanState from '../../../_state/kesehatan/ringkasan-kesehatan/ringkasanKesehatan';
+
type StatCardProps = {
label: string;
@@ -197,7 +198,7 @@ export default function RingkasanKesehatanPage() {
color="pink"
radius="md"
rightSection={}
- onClick={() => router.push('/admin/kesehatan/ibu-hamil')}
+ onClick={() => router.push('/admin/kesehatan/posyandu/ibu-hamil')}
>
Kelola Ibu Hamil
@@ -206,7 +207,7 @@ export default function RingkasanKesehatanPage() {
color="blue"
radius="md"
rightSection={}
- onClick={() => router.push('/admin/kesehatan/balita')}
+ onClick={() => router.push('/admin/kesehatan/posyandu/balita')}
>
Kelola Balita
diff --git a/src/app/admin/_com/list_PageAdmin.tsx b/src/app/admin/_com/list_PageAdmin.tsx
index 5c5541e4..7b9ab159 100644
--- a/src/app/admin/_com/list_PageAdmin.tsx
+++ b/src/app/admin/_com/list_PageAdmin.tsx
@@ -135,7 +135,7 @@ export const devBar = [
{
id: "Kesehatan_1",
name: "Posyandu",
- path: "/admin/kesehatan/posyandu"
+ path: "/admin/kesehatan/posyandu/list-posyandu"
},
{
id: "Kesehatan_2",
@@ -166,21 +166,6 @@ export const devBar = [
id: "Kesehatan_7",
name: "Info Wabah/Penyakit",
path: "/admin/kesehatan/info-wabah-penyakit"
- },
- {
- id: "Kesehatan_8",
- name: "Ringkasan Kesehatan",
- path: "/admin/kesehatan/ringkasan-kesehatan"
- },
- {
- id: "Kesehatan_9",
- name: "Ibu Hamil",
- path: "/admin/kesehatan/ibu-hamil"
- },
- {
- id: "Kesehatan_10",
- name: "Balita",
- path: "/admin/kesehatan/balita"
}
]
},
@@ -586,7 +571,7 @@ export const navBar = [
{
id: "Kesehatan_1",
name: "Posyandu",
- path: "/admin/kesehatan/posyandu"
+ path: "/admin/kesehatan/posyandu/list-posyandu/list_posyandu"
},
{
id: "Kesehatan_2",
@@ -617,21 +602,6 @@ export const navBar = [
id: "Kesehatan_7",
name: "Info Wabah/Penyakit",
path: "/admin/kesehatan/info-wabah-penyakit"
- },
- {
- id: "Kesehatan_8",
- name: "Ringkasan Kesehatan",
- path: "/admin/kesehatan/ringkasan-kesehatan"
- },
- {
- id: "Kesehatan_9",
- name: "Ibu Hamil",
- path: "/admin/kesehatan/ibu-hamil"
- },
- {
- id: "Kesehatan_10",
- name: "Balita",
- path: "/admin/kesehatan/balita"
}
]
},
@@ -1228,7 +1198,7 @@ export const role1 = [
}
]
},
- {
+ {
id: "Kependudukan",
name: "Kependudukan",
path: "",
@@ -1271,7 +1241,7 @@ export const role2 = [
{
id: "Kesehatan_1",
name: "Posyandu",
- path: "/admin/kesehatan/posyandu"
+ path: "/admin/kesehatan/posyandu/list-posyandu/list_posyandu"
},
{
id: "Kesehatan_2",
@@ -1302,21 +1272,6 @@ export const role2 = [
id: "Kesehatan_7",
name: "Info Wabah/Penyakit",
path: "/admin/kesehatan/info-wabah-penyakit"
- },
- {
- id: "Kesehatan_8",
- name: "Ringkasan Kesehatan",
- path: "/admin/kesehatan/ringkasan-kesehatan"
- },
- {
- id: "Kesehatan_9",
- name: "Ibu Hamil",
- path: "/admin/kesehatan/ibu-hamil"
- },
- {
- id: "Kesehatan_10",
- name: "Balita",
- path: "/admin/kesehatan/balita"
}
]
},