'use client'
import colors from '@/con/colors';
import {
Box,
Button,
Center,
Pagination,
Paper,
Skeleton,
Stack,
Table,
TableTbody,
TableTd,
TableTh,
TableThead,
TableTr,
Text,
Title
} from '@mantine/core';
import { useShallowEffect } from '@mantine/hooks';
import { IconDeviceImac, IconSearch } from '@tabler/icons-react';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { useProxy } from 'valtio/utils';
import HeaderSearch from '../../_com/header';
import ajukanIdeInovatifState from '../../_state/inovasi/ajukan-ide-inovatif';
function AjukanIdeInovatif() {
const [search, setSearch] = useState("");
return (
}
value={search}
onChange={(e) => setSearch(e.currentTarget.value)}
/>
);
}
function ListAjukanIdeInovatif({ search }: { search: string }) {
const state = useProxy(ajukanIdeInovatifState)
const router = useRouter()
const {
data,
page,
totalPages,
loading,
load,
} = state.findMany;
useShallowEffect(() => {
load(page, 10, search)
}, [page, search])
const filteredData = data || []
if (loading || !data) {
return (
)
}
return (
Daftar Ide Inovatif
Nama
Alamat
Nama Ide Inovatif
Aksi
{filteredData.length > 0 ? (
filteredData.map((item) => (
{item.name}
}
onClick={() => router.push(`/admin/inovasi/ajukan-ide-inovatif/${item.id}`)}
>
Detail
))
) : (
Tidak ada ide inovatif yang cocok
)}
{
load(newPage, 10);
window.scrollTo({ top: 0, behavior: 'smooth' });
}}
total={totalPages}
mt="md"
mb="md"
color="blue"
radius="md"
/>
);
}
export default AjukanIdeInovatif;