Fakultas Ilmu Komputer UI

Commit caad2f6c authored by Michael Wiryadinata Halim's avatar Michael Wiryadinata Halim
Browse files

Merge branch 'coldfix-sprint_3' into 'staging'

Resolve "Coldfix sprint 3"

See merge request !45
parents 58a48841 1cd569d8
Pipeline #43499 passed with stages
in 8 minutes and 31 seconds
import React from "react";
import { css } from "@emotion/core";
const Status = ({ status, label }) => {
let color;
switch (status) {
case "001":
color = "#EAC435";
break;
case "002":
color = "#FB4D3D";
break;
case "003":
color = "#FC766AFF";
break;
case "004":
color = "#03CEA4";
break;
case "005":
color = "#27496d";
break;
case "006":
color = "#CA1551";
break;
case "007":
color = "#CA1551";
break;
default:
color = "black";
break;
}
return (
<div
css={css`
color: ${color};
`}
>
{label}
</div>
);
};
export default Status;
......@@ -251,7 +251,9 @@ const TableComponent = ({
return (
<TableCell key={`${pairs[0]}r${indexR}c${indexC}`}>
{pairs[2] !== undefined && pairs[2] !== null
? pairs[2](u[pairs[0]])
? pairs[0] !== ""
? pairs[2](u[pairs[0]])
: pairs[2](u)
: u[pairs[0]]}
</TableCell>
);
......
......@@ -2,6 +2,7 @@ import React from "react";
import Moment from "react-moment";
import NumberFormat from "react-number-format";
import "moment-timezone";
import Status from "./Status";
export const stringToDate = (date) => {
const dateFormat = new Date(date);
return (
......@@ -20,3 +21,10 @@ export const stringToCurrency = (currency) => (
prefix={"Rp"}
/>
);
export const transactionToColoredStatus = (transaction) => (
<Status
status={transaction.transaction_status}
label={transaction.readable_transaction_status}
/>
);
import React from "react";
import { css } from "@emotion/core";
const Status = ({ status, label }) => {
switch (status) {
case "001":
return (
<div
css={css`
color: darkgoldenrod;
`}
>
{label}
</div>
);
case "002":
return (
<div
css={css`
color: red;
`}
>
{label}
</div>
);
case "003":
return (
<div
css={css`
color: #004444;
`}
>
{label}
</div>
);
case "004":
return (
<div
css={css`
color: #660066;
`}
>
{label}
</div>
);
case "005":
return <div>{label}</div>;
case "006":
return <div>{label}</div>;
case "007":
return (
<div
css={css`
color: darkred;
`}
>
{label}
</div>
);
}
};
export default Status;
......@@ -11,7 +11,7 @@ import TableContainer from "@material-ui/core/TableContainer";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import Paper from "@material-ui/core/Paper";
import Status from "../../component/status";
import Status from "../../component/Status";
import { stringToCurrency, stringToDate } from "../../component/TableUtils";
import { ErrorDiv } from "../../component/html/html";
import Button from "@material-ui/core/Button";
......@@ -102,13 +102,16 @@ const DetailTransaksi = ({ idTransaksi }) => {
</div>
<div>{transaction.transaction_number}</div>
</div>
<FormStatus
{...{
idTransaksi,
defaultStatus: transaction.transaction_status,
paymentMethod: transaction.payment_method,
}}
/>
{transaction.transaction_status !== "006" &&
transaction.transaction_status !== "007" && (
<FormStatus
{...{
idTransaksi,
defaultStatus: transaction.transaction_status,
paymentMethod: transaction.payment_method,
}}
/>
)}
</div>
<div
css={css`
......
......@@ -2,7 +2,11 @@ import React from "react";
import TableComponent from "../../component/TableComponent";
import { css } from "@emotion/core";
import LinkYellow from "../../component/LinkYellow";
import { stringToCurrency, stringToDate } from "../../component/TableUtils";
import {
stringToCurrency,
stringToDate,
transactionToColoredStatus,
} from "../../component/TableUtils";
const ListTransaksi = () => {
const data = {
......@@ -15,13 +19,13 @@ const ListTransaksi = () => {
["user_username", "Username"],
["created_at", "Tanggal Pembuatan", stringToDate],
["updated_at", "Tanggal Update", stringToDate],
["readable_transaction_status", "Status"],
["", "Status", transactionToColoredStatus],
["subtotal", "Total", stringToCurrency],
],
link: "/transaksi/",
filter: [
["updated_at_date_range_before", "Updated At Before"],
["updated_at_date_range_after", "Updated At After"],
["updated_at_date_range_after", "Updated from"],
["updated_at_date_range_before", "Updated before"],
{
transaction_status: {
label: "Status transaksi",
......
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