Fakultas Ilmu Komputer UI

Commit 2ddb00e5 authored by Wan Muhammad Rayhan Arwindra's avatar Wan Muhammad Rayhan Arwindra 🤸🏽
Browse files

Pbi 3 batch transaksi

parent 19cee5be
...@@ -4,13 +4,16 @@ import { css } from "@emotion/core"; ...@@ -4,13 +4,16 @@ import { css } from "@emotion/core";
import ArrowBackIcon from "@material-ui/icons/ArrowBack"; import ArrowBackIcon from "@material-ui/icons/ArrowBack";
import { navigate } from "@reach/router"; import { navigate } from "@reach/router";
import { stringToCurrency, stringToDateNoTime } from "../../component/TableUtils"; import { stringToCurrency, stringToDateNoTime } from "../../component/TableUtils";
import { ErrorDiv } from "../../component/html/html"; import { ErrorDiv, ButtonDeleteStyled } from "../../component/html/html";
import LinkYellow from "../../component/LinkYellow"; import LinkYellow from "../../component/LinkYellow";
import useDelete from "../../utils/useDelete";
const DetailBatch = ({ batchId }) => { const DetailBatch = ({ batchId }) => {
const url = `${process.env.REACT_APP_BASE_URL}/batch/${batchId}/`; const url = `${process.env.REACT_APP_BASE_URL}/batch/${batchId}/`;
// const url = `http://localhost:8000/batch/${batchId}/`; // for local testing purposes // const url = `http://localhost:8000/batch/${batchId}/`; // for local testing purposes
const [batch, error] = useFetchSingleData(url); const [batch, error] = useFetchSingleData(url);
const [deleteBatch, errorDelete] = useDelete(url);
if (Object.keys(batch).length === 0) if (Object.keys(batch).length === 0)
return ( return (
...@@ -39,6 +42,12 @@ const DetailBatch = ({ batchId }) => { ...@@ -39,6 +42,12 @@ const DetailBatch = ({ batchId }) => {
`} `}
> >
{error && <ErrorDiv>Something error</ErrorDiv>} {error && <ErrorDiv>Something error</ErrorDiv>}
{errorDelete && (
<ErrorDiv>
Tidak dapat menghapus batch, mohon periksa apakah ada transaksi
didalam batch ini.
</ErrorDiv>
)}
<div> <div>
<button <button
css={css` css={css`
...@@ -103,6 +112,18 @@ const DetailBatch = ({ batchId }) => { ...@@ -103,6 +112,18 @@ const DetailBatch = ({ batchId }) => {
UBAH UBAH
</LinkYellow> </LinkYellow>
</div> </div>
<div
css={css`
flex-grow: 1;
`}
>
<ButtonDeleteStyled
data-testid="button-delete-category-modal"
onClick={() => deleteBatch()}
>
HAPUS
</ButtonDeleteStyled>
</div>
</div> </div>
</div> </div>
</div> </div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment