yazid138 3 년 전
부모
커밋
3895efc874

+ 47 - 0
components/DocPerbaikan/Riwayat.js

@@ -0,0 +1,47 @@
+import Datatable from "@/components/Tables/Datatable";
+import moment from "moment";
+import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
+
+function Riwayat({ data }) {
+	console.log(data);
+	return (
+		<Card className="card-default">
+			<CardHeader>
+				<CardTitle>Riwayat</CardTitle>
+			</CardHeader>
+			<CardBody>
+				<Datatable options={{ responsive: true }}>
+					<table className="table table-striped my-4 w-100">
+						<thead>
+							<tr>
+								<th>Tanggal</th>
+								<th>Dokumen</th>
+							</tr>
+						</thead>
+						<tbody>
+							{data.length
+								? data.map((value) => (
+										<tr>
+											<td>{moment(value.createAt).format("DD MMMM YYYY")}</td>
+											<td>
+												{value.files.map((e) => (
+													<>
+														<em className="fa-lg far fa-file-code"></em>
+														<a className="text-muted" href={`data:${e.type};base64, ${Buffer.from(e.data).toString("base64")}`} download={e.name}>
+															{e.name}
+														</a>
+													</>
+												))}
+											</td>
+										</tr>
+								  ))
+								: ""}
+						</tbody>
+					</table>
+				</Datatable>
+			</CardBody>
+		</Card>
+	);
+}
+
+export default Riwayat;

+ 1 - 1
components/Main/PermohonanPT.js

@@ -12,7 +12,7 @@ function PermohonanPT({ data }) {
 						<Scrollable height="120px" className="list-group">
 							<table className="table table-bordered bg-transparent">
 								<tbody>
-									{data.sanksi.keberatan.files.map((e) => (
+									{data.files.map((e) => (
 										<tr>
 											<td>
 												<em className="fa-lg far fa-file-code"></em>

+ 48 - 0
components/PT/CabutSanksi/Riwayat.js

@@ -0,0 +1,48 @@
+import Datatable from "@/components/Tables/Datatable";
+import moment from "moment";
+import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
+
+function Riwayat({ data }) {
+	const { cabut_sanksi } = data.sanksi;
+	console.log(data);
+	return (
+		<Card className="card-default">
+			<CardHeader>
+				<CardTitle>Riwayat</CardTitle>
+			</CardHeader>
+			<CardBody>
+				<Datatable options={{ responsive: true }}>
+					<table className="table table-striped my-4 w-100">
+						<thead>
+							<tr>
+								<th>Tanggal</th>
+								<th>Dokumen</th>
+							</tr>
+						</thead>
+						<tbody>
+							{cabut_sanksi ? (
+								<tr>
+									<td>{moment(data.createAt).format("DD MMMM YYYY")}</td>
+									<td>
+										{cabut_sanksi.files.map((e) => (
+											<>
+												<em className="fa-lg far fa-file-code"></em>
+												<a className="text-muted" href={`data:${e.type};base64, ${Buffer.from(e.data).toString("base64")}`} download={e.name}>
+													{e.name}
+												</a>
+											</>
+										))}
+									</td>
+								</tr>
+							) : (
+								""
+							)}
+						</tbody>
+					</table>
+				</Datatable>
+			</CardBody>
+		</Card>
+	);
+}
+
+export default Riwayat;

+ 47 - 0
components/PT/DocPerbaikan/Riwayat.js

@@ -0,0 +1,47 @@
+import Datatable from "@/components/Tables/Datatable";
+import moment from "moment";
+import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
+
+function Riwayat({ data }) {
+	console.log(data);
+	return (
+		<Card className="card-default">
+			<CardHeader>
+				<CardTitle>Riwayat</CardTitle>
+			</CardHeader>
+			<CardBody>
+				<Datatable options={{ responsive: true }}>
+					<table className="table table-striped my-4 w-100">
+						<thead>
+							<tr>
+								<th>Tanggal</th>
+								<th>Dokumen</th>
+							</tr>
+						</thead>
+						<tbody>
+							{data.length
+								? data.map((value) => (
+										<tr>
+											<td>{moment(value.createAt).format("DD MMMM YYYY")}</td>
+											<td>
+												{value.files.map((e) => (
+													<>
+														<em className="fa-lg far fa-file-code"></em>
+														<a className="text-muted" href={`data:${e.type};base64, ${Buffer.from(e.data).toString("base64")}`} download={e.name}>
+															{e.name}
+														</a>
+													</>
+												))}
+											</td>
+										</tr>
+								  ))
+								: ""}
+						</tbody>
+					</table>
+				</Datatable>
+			</CardBody>
+		</Card>
+	);
+}
+
+export default Riwayat;

+ 0 - 17
components/PT/Riwayat.js

@@ -52,23 +52,6 @@ function Riwayat({ data }) {
 							) : (
 								""
 							)}
-							{/* {data ? (
-								<tr>
-									<td>{moment(data.createAt).format("DD MMMM YYYY")}</td>
-									<td>
-										{data.files.map((e) => (
-											<>
-												<em className="fa-lg far fa-file-code"></em>
-												<a className="text-muted" href={`data:${e.type};base64, ${Buffer.from(e.data).toString("base64")}`} download={e.name}>
-													{e.name}
-												</a>
-											</>
-										))}
-									</td>
-								</tr>
-							) : (
-								""
-							)} */}
 						</tbody>
 					</table>
 				</Datatable>

+ 63 - 0
components/Sanksi/TableLaporan.js

@@ -0,0 +1,63 @@
+import Datatable from "@/components/Tables/Datatable";
+import { Button } from "reactstrap";
+import Link from "next/link";
+import moment from "moment";
+
+function TableLaporan({ listData }) {
+	return (
+		<div className="card b">
+			<div className="card-body">
+				<Datatable options={{ responsive: true }}>
+					<table className="table w-100">
+						<thead>
+							<tr>
+								<th>#ID</th>
+								<th>Deskripsi Laporan</th>
+								<th>Status</th>
+								<th>Created</th>
+								<th></th>
+							</tr>
+						</thead>
+						<tbody>
+							{listData.map((data) => {
+								return (
+									<tr key={data._id}>
+										<td>{data._number}</td>
+										<td className="text-nowrap">
+											<div className="media align-items-center">
+												<div className="media-body d-flex">
+													<div>
+														<h4 className="m-0">Universitas Satyagama</h4>
+														<p>{data.description}</p>
+													</div>
+												</div>
+											</div>
+										</td>
+										<td>{data.status}</td>
+										<td>{moment(data.createdAt).fromNow()}</td>
+										<td>
+											<div className="ml-auto">
+												<Link
+													href={{
+														pathname: data.sanksi ? "/app/sanksi/detail" : "/app/sanksi/proses",
+														query: { ptId: data.pt_id, number: data._number },
+													}}
+												>
+													<Button color="primary" size="sm">
+														{data.sanksi ? "Detail" : "Proses Sanksi"}
+													</Button>
+												</Link>
+											</div>
+										</td>
+									</tr>
+								);
+							})}
+						</tbody>
+					</table>
+				</Datatable>
+			</div>
+		</div>
+	);
+}
+
+export default TableLaporan;

+ 1 - 1
pages/app/pemantauan-perbaikan/detail.js

@@ -3,7 +3,7 @@ import DetailSanksi from "@/components/Main/DetailSanksi";
 import Link from "next/link";
 import Header from "@/components/Main/Header";
 import DetailPT from "@/components/Main/DetailPT";
-import Riwayat from "@/components/PT/Riwayat";
+import Riwayat from "@/components/DocPerbaikan/Riwayat";
 import { getSanksi } from "@/actions/sanksi";
 import ContentWrapper from "@/components/Layout/ContentWrapper";
 import { Row, Col, Card, CardBody } from "reactstrap";

+ 1 - 1
pages/app/pencabutan-sanksi/detail.js

@@ -132,7 +132,7 @@ class JawabanPencabutanSanksi extends Component {
 									<Row>
 										<Col lg={12}>
 											<DetailSanksi data={sanksi.data[0]} />
-											<PermohonanPT data={sanksi.data[0]} />
+											<PermohonanPT data={sanksi.data[0].sanksi.cabut_sanksi} />
 											<p className="lead bb">Jawaban</p>
 											<form className="form-horizontal" method="get" action="/" onSubmit={this.onSubmit}>
 												<FormGroup>

+ 1 - 1
pages/app/pt/dokumen-perbaikan/detail.js

@@ -6,7 +6,7 @@ import Link from "next/link";
 import Header from "@/components/Main/Header";
 import DetailPT from "@/components/Main/DetailPT";
 import DetailSanksi from "@/components/Main/DetailSanksi";
-import Riwayat from "@/components/PT/Riwayat";
+import Riwayat from "@/components/PT/DocPerbaikan/Riwayat";
 import ContentWrapper from "@/components/Layout/ContentWrapper";
 import { Row, Col, Card, CardBody, FormGroup, Button } from "reactstrap";
 

+ 2 - 2
pages/app/pt/pencabutan-sanksi/detail.js

@@ -5,7 +5,7 @@ import { getSanksi } from "@/actions/sanksi";
 import Header from "@/components/Main/Header";
 import DetailPT from "@/components/Main/DetailPT";
 import DetailSanksi from "@/components/Main/DetailSanksi";
-import Riwayat from "@/components/PT/Riwayat";
+import Riwayat from "@/components/PT/CabutSanksi/Riwayat";
 import ContentWrapper from "@/components/Layout/ContentWrapper";
 import { Row, Col, Card, CardBody, FormGroup, Button } from "reactstrap";
 import { addCabutSanksi } from "@/actions/cabutSanksi";
@@ -158,7 +158,7 @@ class DetailPencabutanSanksi extends Component {
 					</Row>
 					<Row>
 						<Col>
-							<Riwayat data={sanksi.data[0].sanksi.cabut_sanksi} />
+							<Riwayat data={sanksi.data[0]} />
 						</Col>
 					</Row>
 				</div>

+ 2 - 2
pages/app/sanksi/index.js

@@ -3,7 +3,7 @@ import ContentWrapper from "@/components/Layout/ContentWrapper";
 import { Row, Col } from "reactstrap";
 import { getPelaporan } from "@/actions/pelaporan";
 import CaseProgress from "@/components/Main/CaseProgress";
-import TableLaporan from "@/components/Main/TableLaporan";
+import TableLaporan from "@/components/Sanksi/TableLaporan";
 
 class Sanksi extends Component {
 	constructor(props) {
@@ -25,7 +25,7 @@ class Sanksi extends Component {
 						<CaseProgress />
 					</Col>
 					<Col lg="8">
-						<TableLaporan listData={pelaporan.data} to={pelaporan.data[0].sanksi ? "/app/sanksi/detail" : "/app/sanksi/proses"} linkName={pelaporan.data[0].sanksi ? "Detail" : "Proses Sanksi"} status />
+						<TableLaporan listData={pelaporan.data} />
 					</Col>
 				</Row>
 			</ContentWrapper>