diff --git a/app/dashboard/spesific-target-mapping/page.tsx b/app/dashboard/spesific-target-mapping/page.tsx new file mode 100644 index 0000000..3a09cd6 --- /dev/null +++ b/app/dashboard/spesific-target-mapping/page.tsx @@ -0,0 +1,16 @@ +"use client" +import SpesificTargetMappingTable from "@/components/table/spesific-target-mapping/spesific-target-mapping-table" +import dynamic from "next/dynamic" + +const Navbar = dynamic(() => import("@/components/ui/navbar"), { + ssr: false, +}) + +export default function SpesificTargetMapping() { + return ( +
+ + +
+ ) +} diff --git a/components/table/spesific-target-mapping/spesific-target-mapping-table.tsx b/components/table/spesific-target-mapping/spesific-target-mapping-table.tsx new file mode 100644 index 0000000..0e94f8f --- /dev/null +++ b/components/table/spesific-target-mapping/spesific-target-mapping-table.tsx @@ -0,0 +1,370 @@ +"use client" + +import { ReloadIcon } from "@/components/icons" +import { Button } from "@/components/ui/button" +import { Checkbox } from "@/components/ui/checkbox" +import { Input } from "@/components/ui/input" +import { + InputGroup, + InputGroupAddon, + InputGroupInput, +} from "@/components/ui/input-group" +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select" +import { + Table, + TableBody, + TableCell, + TableFooter, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { ChevronLeft, ChevronRight, SearchIcon } from "lucide-react" +import { useEffect, useState } from "react" + +const dummyProxy = [ + { id: 1, value: "Jakarta" }, + { id: 2, value: "Bandung" }, + { id: 3, value: "Surabaya" }, + { id: 4, value: "Medan" }, +] + +const dummyStatus = [ + { id: 1, value: "Negative" }, + { id: 2, value: "Positive" }, + { id: 3, value: "Neutral" }, +] + +const dummyData = [ + { + id: "1", + identifier: "MyUsername123", + proxy: "Jakarta", + sentiment: 1, + }, + { + id: "2", + identifier: "MyUsername12223", + proxy: "Bandung", + sentiment: 2, + }, + { + id: "3", + identifier: "MyUsername1132123", + proxy: "Jakarta", + sentiment: 3, + }, + { + id: "4", + identifier: "MyUsername422123", + proxy: "Medan", + sentiment: 4, + }, + { + id: "5", + identifier: "12MyUsername422123", + proxy: "Surabaya", + sentiment: 1, + }, +] + +const dummyDataTarget = [ + { + id: "1", + name: "POLRI - DIV Humas", + status: 1, + }, + { + id: "2", + name: "POLRI - Korlantas", + status: 2, + }, + { + id: "3", + name: "TNI", + status: 3, + }, + { + id: "4", + name: "DPR", + status: 3, + }, +] + +export default function SpesificTargetMappingTable() { + const [selectedStatus, setSelectedStatus] = useState("") + const [selectedLocation, setSelectedLocation] = useState("") + const [search, setSearch] = useState("") + const [limit, setLimit] = useState("5") + const [page, setPage] = useState(1) + // const [totalPage, setTotalPage] = useState(1) + const [selectedDataTable, setSelectedDataTable] = useState([]) + + const getData = async () => { + const req = { + search: search, + sentiment: selectedStatus, + proxy: selectedLocation, + page: page, + limit: limit, + } + console.log("request", req) + } + useEffect(() => { + getData() + }, [page, limit]) + + const resetFilter = () => { + setSelectedLocation("") + setSelectedStatus("") + setSearch("") + setPage(1) + getData() + } + + return ( +
+
+

Spesific Target Mapping

+

+ Manage your Spesific Target Mapping +

+ +
+
+

Search

+ + setSearch(e.target.value)} + id="inline-end-input" + type="text" + placeholder="Search e.g username, email or ID" + /> + + setViewPassword(!viewPassword)} + > + + + + +
+
+

Proxy Location

+ +
+ + + +
+
+
+

Accounts

+ + + + + Identifier + Proxy Location + Action + + + + {dummyData.map((invoice, index) => ( + + {index + 1} + {invoice.identifier} + {invoice.proxy} + + + + + ))} + + + + +
+

ROWS PER PAGE:

+ + + + + + + +
+
+
+
+
+
+

+ Spesific Targets Mapping +

+ + setSearch(e.target.value)} + id="inline-end-input" + type="text" + placeholder="Search" + /> + + setViewPassword(!viewPassword)} + > + + + + +
+ + + + NO + Name + Sentiment + + Selected + + + + {dummyDataTarget.map((target, index) => ( + + {index + 1} + {target.name} + + + + + { + if (e) { + setSelectedDataTable([...selectedDataTable, target.id]) + } else { + const temp = [] + for (const element of selectedDataTable) { + if (element !== target.id) { + temp.push(element) + } + } + setSelectedDataTable(temp) + } + }} + className="border-gray-300" + /> + + + ))} + + + + +
+

ROWS PER PAGE:

+ + + + + + + +
+
+
+
+
+
+
+ ) +} diff --git a/components/ui/app-sidebar.tsx b/components/ui/app-sidebar.tsx index b2bbeff..a59118c 100644 --- a/components/ui/app-sidebar.tsx +++ b/components/ui/app-sidebar.tsx @@ -63,7 +63,7 @@ export function AppSidebar() { {item.icon}