-
-
-
- {(column) => (
- {column.name}
- )}
-
- }
- >
- {(item) => (
-
- {(columnKey) => (
- {renderCell(item, columnKey)}
- )}
-
- )}
-
-
-
+ switch (columnKey) {
+ case "status":
+ return (
+
+
+ {cellValue}
+
+ );
- >
- );
+ case "actions":
+ return (
+
+
+
+
+
+
+
+
+
+ Detail
+
+
+
+
+
+ Edit
+
+
+ handleDelete(article.id)}>
+
+ Delete
+
+
+
+
+ );
+
+ default:
+ return cellValue;
+ }
+ }, []);
+
+ let typingTimer: NodeJS.Timeout;
+ const doneTypingInterval = 1500;
+
+ const handleKeyUp = () => {
+ clearTimeout(typingTimer);
+ typingTimer = setTimeout(doneTyping, doneTypingInterval);
+ };
+
+ const handleKeyDown = () => {
+ clearTimeout(typingTimer);
+ };
+
+ async function doneTyping() {
+ initState();
+ }
+
+ return (
+ <>
+
+
+
+
+
Search
+
+ }
+ type="text"
+ onChange={(e) => setSearch(e.target.value)}
+ onKeyUp={handleKeyUp}
+ onKeyDown={handleKeyDown}
+ />
+
+
+
Show
+
+
+
+
Category
+
+
+
+
Date
+
setStartDateValue(e)}
+ inputClassName="z-50 w-full text-sm bg-transparent border-1 border-gray-200 px-2 py-[6px] rounded-xl h-[40px]"
+ />
+
+
+
+
+ {(column) => (
+ {column.name}
+ )}
+
+ }
+ >
+ {(item) => (
+
+ {(columnKey) => (
+ {renderCell(item, columnKey)}
+ )}
+
+ )}
+
+
+
+
+
+ >
+ );
}
diff --git a/config/site.ts b/config/site.ts
index d52edc5..f16113b 100644
--- a/config/site.ts
+++ b/config/site.ts
@@ -1,133 +1,139 @@
export type SiteConfig = typeof siteConfig;
export const siteConfig = {
- name: "DIVISI HUMAS POLRI - Pengelola Informasi dan Dokumentasi Polri",
- description: "DIVISI HUMAS POLRI - Pengelola Informasi dan Dokumentasi Polri.",
- navItems: [
- {
- label: "Home",
- href: "/",
- },
- {
- label: "Docs",
- href: "/docs",
- },
- {
- label: "Pricing",
- href: "/pricing",
- },
- {
- label: "Blog",
- href: "/blog",
- },
- {
- label: "About",
- href: "/about",
- }
- ],
- humasMenuItems: [
- {
- key: "home",
- label: "Beranda",
- href: "/",
- },
- {
- key: "about",
- label: "Tentang",
- submenu: [
- {
- label: "Tentang Humas POLRI",
- href: "/tentang-humas-polri"
- },
- {
- label: "Profile Pimpinan POLRI",
- href: "/profile-pimpinan-polri"
- },
- {
- label: "Struktur Organisasi",
- href: "/struktur-organisasi"
- },
- {
- label: "Visi dan Misi",
- href: "/visi-misi"
- },
- {
- label: "Tugas dan Fungsi",
- href: "/tugas-dan-fungsi"
- },
- {
- label: "Logo",
- href: "#"
- }
- ]
- },
- {
- key: "ppid",
- label: "Portal PPID",
- href: "/portal-ppid",
- },
- {
- key: "service",
- label: "Pelayanan Masyarakat",
- submenu: [
- {
- label: "Formulir Permohonan Informasi",
- href: "/form-permohonan-informasi"
- },
- {
- label: "Pelayanan SIM",
- href: "https://www.digitalkorlantas.id/sim/"
- },
- {
- label: "Pelayanan e-Rikkes SIM",
- href: "https://erikkes.id/"
- },
- {
- label: "Pelayanan Tes Psikologi SIM",
- href: "https://eppsi.id/"
- },
- {
- label: "Pelayanan e-Avis",
- href: "https://e-avis.korlantas.polri.go.id/"
- },
- {
- label: "Pelayanan Samsat Digital",
- href: "https://samsatdigital.id/"
- },
- {
- label: "Pelayanan SKCK",
- href: "https://play.google.com/store/apps/details?id=superapps.polri.presisi.presisi&hl=en_US"
- },
- {
- label: "Pelayanan Propam Presisi",
- href: "https://play.google.com/store/apps/details?id=com.stk.pengaduanpropam"
- },
- {
- label: "Pelayanan Dumas Presisi",
- href: "https://dumaspresisi.polri.go.id/"
- },
- {
- label: "Pelayanan Binmas",
- href: "https://bos.polri.go.id/login"
- },
- {
- label: "Wistle Blower System",
- href: "https://play.google.com/store/apps/details?id=id.go.ssdmpolri.pengaduanappsbarupolri2"
- },
- ]
- },
- {
- key: "contact",
- label: "Kontak",
- href: "/kontak-kami",
- },
- ],
+ name: "DIVISI HUMAS POLRI - Pengelola Informasi dan Dokumentasi Polri",
+ description:
+ "DIVISI HUMAS POLRI - Pengelola Informasi dan Dokumentasi Polri.",
+ navItems: [
+ {
+ label: "Home",
+ href: "/",
+ },
+ {
+ label: "Docs",
+ href: "/docs",
+ },
+ {
+ label: "Pricing",
+ href: "/pricing",
+ },
+ {
+ label: "Blog",
+ href: "/blog",
+ },
+ {
+ label: "About",
+ href: "/about",
+ },
+ ],
+ humasMenuItems: [
+ {
+ key: "home",
+ label: "Beranda",
+ href: "/",
+ },
+ {
+ key: "about",
+ label: "Tentang",
+ submenu: [
+ {
+ label: "Tentang Humas POLRI",
+ href: "/tentang-humas-polri",
+ },
+ {
+ label: "Profile Pimpinan POLRI",
+ href: "/profile-pimpinan-polri",
+ },
+ {
+ label: "Struktur Organisasi",
+ href: "/struktur-organisasi",
+ },
+ {
+ label: "Visi dan Misi",
+ href: "/visi-misi",
+ },
+ {
+ label: "Tugas dan Fungsi",
+ href: "/tugas-dan-fungsi",
+ },
+ {
+ label: "Logo",
+ href: "#",
+ },
+ ],
+ },
+ {
+ key: "ppid",
+ label: "Portal PPID",
+ href: "/portal-ppid",
+ },
+ {
+ key: "service",
+ label: "Pelayanan Masyarakat",
+ submenu: [
+ {
+ label: "Formulir Permohonan Informasi",
+ href: "/form-permohonan-informasi",
+ },
+ {
+ label: "Pelayanan SIM",
+ href: "https://www.digitalkorlantas.id/sim/",
+ },
+ {
+ label: "Pelayanan e-Rikkes SIM",
+ href: "https://erikkes.id/",
+ },
+ {
+ label: "Pelayanan Tes Psikologi SIM",
+ href: "https://eppsi.id/",
+ },
+ {
+ label: "Pelayanan e-Avis",
+ href: "https://e-avis.korlantas.polri.go.id/",
+ },
+ {
+ label: "Pelayanan Samsat Digital",
+ href: "https://samsatdigital.id/",
+ },
+ {
+ label: "Pelayanan SKCK",
+ href: "https://play.google.com/store/apps/details?id=superapps.polri.presisi.presisi&hl=en_US",
+ },
+ {
+ label: "Pelayanan Propam Presisi",
+ href: "https://play.google.com/store/apps/details?id=com.stk.pengaduanpropam",
+ },
+ {
+ label: "Pelayanan Dumas Presisi",
+ href: "https://dumaspresisi.polri.go.id/",
+ },
+ {
+ label: "Pelayanan Binmas",
+ href: "https://bos.polri.go.id/login",
+ },
+ {
+ label: "Wistle Blower System",
+ href: "https://play.google.com/store/apps/details?id=id.go.ssdmpolri.pengaduanappsbarupolri2",
+ },
+ ],
+ },
+ {
+ key: "contact",
+ label: "Kontak",
+ href: "/kontak-kami",
+ },
+ {
+ key: "login",
+ label: "Login",
+ href: "/auth",
+ },
+ ],
- links: {
- github: "https://github.com/nextui-org/nextui",
- twitter: "https://twitter.com/getnextui",
- docs: "https://nextui.org",
- discord: "https://discord.gg/9b6yyZKmH4",
- sponsor: "https://patreon.com/jrgarciadev"
- },
+ links: {
+ github: "https://github.com/nextui-org/nextui",
+ twitter: "https://twitter.com/getnextui",
+ docs: "https://nextui.org",
+ discord: "https://discord.gg/9b6yyZKmH4",
+ sponsor: "https://patreon.com/jrgarciadev",
+ },
};
diff --git a/package-lock.json b/package-lock.json
index 650d92f..665b4ce 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -39,6 +39,7 @@
"html-react-parser": "^5.1.10",
"intl-messageformat": "^10.5.0",
"jodit-react": "^4.0.25",
+ "js-cookie": "^3.0.5",
"next": "14.0.2",
"next-themes": "^0.2.1",
"postcss": "8.4.31",
@@ -4887,6 +4888,14 @@
"react-dom": "~0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
}
},
+ "node_modules/js-cookie": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz",
+ "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/js-tokens": {
"version": "4.0.0",
"license": "MIT"
diff --git a/package.json b/package.json
index 4651baf..0b91ace 100644
--- a/package.json
+++ b/package.json
@@ -40,6 +40,7 @@
"html-react-parser": "^5.1.10",
"intl-messageformat": "^10.5.0",
"jodit-react": "^4.0.25",
+ "js-cookie": "^3.0.5",
"next": "14.0.2",
"next-themes": "^0.2.1",
"postcss": "8.4.31",
diff --git a/service/article.ts b/service/article.ts
index e7fbab1..734a761 100644
--- a/service/article.ts
+++ b/service/article.ts
@@ -1,35 +1,45 @@
-import { httpDeleteInterceptor, httpGet, httpPost, httpPut } from "./http-config/axios-base-service";
+import { PaginationRequest } from "@/types/globals";
+import {
+ httpDeleteInterceptor,
+ httpGet,
+ httpPost,
+ httpPut,
+} from "./http-config/axios-base-service";
-export async function getListArticle() {
- const headers = {
- "content-type": "application/json",
- };
- return await httpGet(`/articles`, headers);
+export async function getListArticle(props: PaginationRequest) {
+ const { page, limit, search } = props;
+ const headers = {
+ "content-type": "application/json",
+ };
+ return await httpGet(
+ `/articles?limit=${limit}&page=${page}&title=${search}`,
+ headers
+ );
}
export async function createArticle(data: any) {
- const headers = {
- "content-type": "application/json",
- };
- const pathUrl = `/articles`;
- return await httpPost(pathUrl, headers, data);
+ const headers = {
+ "content-type": "application/json",
+ };
+ const pathUrl = `/articles`;
+ return await httpPost(pathUrl, headers, data);
}
export async function updateArticle(id: any) {
- const headers = {
- "content-type": "application/json",
- };
- const pathUrl = `/articles/${id}`;
- return await httpPut(pathUrl, headers);
+ const headers = {
+ "content-type": "application/json",
+ };
+ const pathUrl = `/articles/${id}`;
+ return await httpPut(pathUrl, headers);
}
export async function getArticleById(id: any) {
- const headers = {
- "content-type": "application/json",
- };
- return await httpGet(`/articles/${id}`, headers);
+ const headers = {
+ "content-type": "application/json",
+ };
+ return await httpGet(`/articles/${id}`, headers);
}
export async function deleteArticle(id: string) {
- return await httpDeleteInterceptor(`articles/${id}`);
-}
\ No newline at end of file
+ return await httpDeleteInterceptor(`articles/${id}`);
+}
diff --git a/service/master-user.ts b/service/master-user.ts
index a39bf77..a85c8f8 100644
--- a/service/master-user.ts
+++ b/service/master-user.ts
@@ -1,20 +1,39 @@
-import { httpDeleteInterceptor, httpGet, httpPost } from "./http-config/axios-base-service";
+import {
+ httpDeleteInterceptor,
+ httpGet,
+ httpPost,
+} from "./http-config/axios-base-service";
export async function listMasterUsers() {
- const headers = {
- "content-type": "application/json",
- };
- return await httpGet(`/users`, headers);
+ const headers = {
+ "content-type": "application/json",
+ };
+ return await httpGet(`/users`, headers);
}
export async function createMasterUser(data: any) {
- const headers = {
- "content-type": "application/json",
- };
- const pathUrl = `/users`;
- return await httpPost(pathUrl, headers, data);
+ const headers = {
+ "content-type": "application/json",
+ };
+ const pathUrl = `/users`;
+ return await httpPost(pathUrl, headers, data);
}
export async function deleteMasterUser(id: string) {
- return await httpDeleteInterceptor(`/users/${id}`);
-}
\ No newline at end of file
+ return await httpDeleteInterceptor(`/users/${id}`);
+}
+
+export async function postSignIn(data: any) {
+ const headers = {
+ "content-type": "application/json",
+ };
+ const pathUrl = `/users/login`;
+ return await httpPost(pathUrl, headers, data);
+}
+
+export async function getProfile() {
+ const headers = {
+ "content-type": "application/json",
+ };
+ return await httpGet(`/users/info`, headers);
+}
diff --git a/types/globals.tsx b/types/globals.tsx
index 67dfea2..c423b63 100644
--- a/types/globals.tsx
+++ b/types/globals.tsx
@@ -1,56 +1,62 @@
import { SVGProps } from "react";
export type IconSvgProps = SVGProps
& {
- size?: number;
+ size?: number;
};
export type SidebarMenuTask = {
- childMenu: any[];
- name: string;
- id: number;
- parentId: number;
- position: number;
- statusId: number;
- statusName: string;
+ childMenu: any[];
+ name: string;
+ id: number;
+ parentId: number;
+ position: number;
+ statusId: number;
+ statusName: string;
};
export type Article = {
- id: number;
- title: string;
- articleCategory: string;
- updated_at: string;
- creator: string;
- source: string;
- status: string;
- actions: string;
+ id: number;
+ title: string;
+ articleCategory: string;
+ updated_at: string;
+ creator: string;
+ source: string;
+ status: string;
+ actions: string;
};
export type MasterUser = {
- id: number;
- address: string,
- dateOfBirth: string,
- email: string,
- fullname: string,
- genderType: string,
- identityNumber: string,
- identityType: string,
- lastEducation: string,
- phoneNumber: string,
- userLevelsId: number,
- userRoleId: number,
- username: string,
- workType: string
+ id: number;
+ address: string;
+ dateOfBirth: string;
+ email: string;
+ fullname: string;
+ genderType: string;
+ identityNumber: string;
+ identityType: string;
+ lastEducation: string;
+ phoneNumber: string;
+ userLevelsId: number;
+ userRoleId: number;
+ username: string;
+ workType: string;
};
export type MasterUserRole = {
- id: number,
- name: string,
- description: string,
- code: string,
- level_number: number,
- status_id: number,
- created_by_id: string | number,
- is_active: true,
- created_at: string,
- updated_at: string
+ id: number;
+ name: string;
+ description: string;
+ code: string;
+ level_number: number;
+ status_id: number;
+ created_by_id: string | number;
+ is_active: true;
+ created_at: string;
+ updated_at: string;
+};
+
+export type PaginationRequest = {
+ limit: string;
+ page: number;
+ search: string;
};