Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aditiapras committed Oct 25, 2023
1 parent ca90e79 commit 20dcd65
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 78 deletions.
206 changes: 153 additions & 53 deletions app/dashboard/drums/[cleaningId]/page.js

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions components/data-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import { useMemo, useState } from "react";
import { BiLastPage, BiFirstPage } from "react-icons/bi";
import { Button } from "./ui/button";

export default function DataTable({ data: datas, columns, page }) {
const data = useMemo(() => datas, []);

export default function DataTable({ data, columns, page }) {
const [sorting, setSorting] = useState([]);
const [filter, setFilter] = useState([]);
const [filter, setFilter] = useState("");

const table = useReactTable({
data,
Expand All @@ -34,21 +32,23 @@ export default function DataTable({ data: datas, columns, page }) {

state: {
sorting: sorting,
// globalFilter: filter,
globalFilter: filter,
},
onSortingChange: setSorting,
// onGlobalFilterChange: setFilter,
onGlobalFilterChange: setFilter,
});

return (
<div className="flex flex-col gap-5">
{/* <input
type="text"
placeholder="Search"
className="w-1/5 p-2 rounded-md border"
value={filter}
onChange={(e) => setFilter(e.target.value)}
/> */}
<div>
<input
type="text"
placeholder="Search"
className="w-1/5 p-2 rounded-md border"
value={filter}
onChange={(e) => setFilter(e.target.value)}
/>
</div>
<Table>
<TableHeader>
{table.getHeaderGroups().map((headerGroup) => (
Expand Down
2 changes: 1 addition & 1 deletion components/page/ccdrum/ccdrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default function CcDrum() {
: "bg-white hover:bg-zinc-100"
} relative flex justify-between h-12 items-center p-2 border rounded-md text-xs transition duration-200`}
>
<p className="absolute top-0 left-1 text-[7px] text-green-500 animate-pulse">
<p className="absolute -top-1 -left-1 text-[20px] text-emerald-500 animate-pulse">
</p>
<p className="">{drum.id_drum}</p>
Expand Down
45 changes: 36 additions & 9 deletions components/page/monitoring/monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,48 @@ export default function Monitoring() {

return (
<main className="flex flex-col h-full">
<div className="flex items-center gap-5 w-full px-5 py-2 border-b bg-zinc-50">
<p className="font-semibold text-xl">Monitoring</p>
<Button onClick={phase1} variant={phase == "Phase 1" ? "" : "outline"}>
Phase 1
</Button>
<Button onClick={phase2} variant={phase == "Phase 2" ? "" : "outline"}>
Phase 2
</Button>
<div className="flex items-center justify-between w-full px-5 py-2 border-b bg-zinc-50">
<div className="flex items-center gap-5">
<p className="font-semibold text-xl">Monitoring</p>
<Button
onClick={phase1}
variant={phase == "Phase 1" ? "" : "outline"}
>
Phase 1
</Button>
<Button
onClick={phase2}
variant={phase == "Phase 2" ? "" : "outline"}
>
Phase 2
</Button>
</div>
<p className="px-2 bg-emerald-500 text-white font-medium">OE Size</p>
</div>
<div className="grid grid-cols-5 gap-5 w-full p-5 bg-zinc-100 h-full">
{data
.filter((drum) => drum.phase == phase)
.map((drum) => (
<div key={drum.building_mc} className="flex flex-col gap-2">
<p className="font-semibold">{drum.building_mc}</p>
<p
className={`${
drum.building_mc == "H1305" ||
drum.building_mc == "H1502" ||
drum.building_mc == "H1601" ||
drum.building_mc == "H1603" ||
drum.building_mc == "H1701" ||
drum.building_mc == "H1703" ||
drum.building_mc == "H1704" ||
drum.building_mc == "H1705" ||
drum.building_mc == "H1801" ||
drum.building_mc == "H1804" ||
drum.building_mc == "H1805"
? "bg-emerald-500 font-medium w-fit px-2 text-white"
: "font-semibold"
}`}
>
{drum.building_mc}
</p>
<div className="flex flex-col gap-1">
<CarcassDrum drum={drum.id_left} mesin={drum.building_mc} />
<CarcassDrum drum={drum.id_right} mesin={drum.building_mc} />
Expand Down
4 changes: 3 additions & 1 deletion components/page/request/requestChange.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import { Label } from "@/components/ui/label";
import Spinner from "../../ui/spinner";
import { useState } from "react";
import axios from "axios";
import { useSWRConfig } from "swr";

export default function RequestChange() {
const { mutate } = useSWRConfig();
const [machine, setMachine] = useState("");
const [drum, setDrum] = useState("");
const [team, setTeam] = useState("");
Expand Down Expand Up @@ -48,7 +50,7 @@ export default function RequestChange() {
data: query,
}).then((res) => res.data);
console.log(await data);
window.location.reload();
mutate(`${process.env.NEXT_PUBLIC_API_URL}/requests`);
}
};

Expand Down
4 changes: 3 additions & 1 deletion components/page/request/requestCleaning.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import { Label } from "@/components/ui/label";
import Spinner from "../../ui/spinner";
import { useState } from "react";
import axios from "axios";
import { useSWRConfig } from "swr";

export default function RequestCleaning() {
const { mutate } = useSWRConfig();
const [drum, setDrum] = useState("");
const [team, setTeam] = useState("");
const [type, setType] = useState("Cleaning C/C Drum");
Expand All @@ -44,7 +46,7 @@ export default function RequestCleaning() {
data: query,
}).then((res) => res.data);
console.log(await data);
window.location.reload();
mutate(`${process.env.NEXT_PUBLIC_API_URL}/requests`);
}
};

Expand Down
24 changes: 24 additions & 0 deletions prisma/migrations/20231025090717_initial_migrations/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Warnings:
- You are about to alter the column `date_cleaning` on the `cleaning` table. The data in that column could be lost. The data in that column will be cast from `DateTime(0)` to `DateTime`.
- You are about to alter the column `date_naik` on the `drum` table. The data in that column could be lost. The data in that column will be cast from `DateTime(0)` to `DateTime`.
- You are about to alter the column `date_turun` on the `drum` table. The data in that column could be lost. The data in that column will be cast from `DateTime(0)` to `DateTime`.
- You are about to alter the column `date` on the `history` table. The data in that column could be lost. The data in that column will be cast from `DateTime(0)` to `DateTime`.
- You are about to alter the column `request_date` on the `request` table. The data in that column could be lost. The data in that column will be cast from `DateTime(0)` to `DateTime`.
- You are about to alter the column `complete_date` on the `request` table. The data in that column could be lost. The data in that column will be cast from `DateTime(0)` to `DateTime`.
*/
-- AlterTable
ALTER TABLE `cleaning` MODIFY `date_cleaning` DATETIME NOT NULL;

-- AlterTable
ALTER TABLE `drum` MODIFY `date_naik` DATETIME NULL,
MODIFY `date_turun` DATETIME NULL;

-- AlterTable
ALTER TABLE `history` MODIFY `date` DATETIME NOT NULL;

-- AlterTable
ALTER TABLE `request` MODIFY `request_date` DATETIME NOT NULL,
MODIFY `complete_date` DATETIME NULL;

0 comments on commit 20dcd65

Please sign in to comment.