show transactions on homie click
This commit is contained in:
@@ -4,6 +4,7 @@ import './Cash.css';
|
||||
import axios from 'axios';
|
||||
import { MAKE_MONEY_MOVE } from '../RouteNames';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { formatMoney } from '../common/formatting';
|
||||
|
||||
const Cash = (props) => {
|
||||
const [homiesCash, setHomiesCash] = useState([]);
|
||||
@@ -21,17 +22,11 @@ const Cash = (props) => {
|
||||
getCashForHomies();
|
||||
}, []);
|
||||
|
||||
|
||||
const formatMoney = (amount) => {
|
||||
const formatted = Number.parseFloat(amount).toFixed(2);
|
||||
return `${formatted} KM`;
|
||||
}
|
||||
|
||||
const cashTableBody = homiesCash.map( (homieLine) => {
|
||||
return (
|
||||
<tr key={homieLine.homie.id}>
|
||||
<td className="cash-cell-left">
|
||||
{ homieLine.homie.name }
|
||||
<a href={`/homie/${homieLine.homie.id}/flow`}>{ homieLine.homie.name }</a>
|
||||
</td>
|
||||
<td className="cash-cell-right">
|
||||
{ formatMoney(homieLine.amount) }
|
||||
@@ -44,39 +39,39 @@ const Cash = (props) => {
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="container">
|
||||
<Table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Homie
|
||||
</th>
|
||||
<th>
|
||||
Cash
|
||||
</th>
|
||||
<th>
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{ cashTableBody }
|
||||
</tbody>
|
||||
</Table>
|
||||
|
||||
<Table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Homie
|
||||
</th>
|
||||
<th>
|
||||
Cash
|
||||
</th>
|
||||
<th>
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{ cashTableBody }
|
||||
</tbody>
|
||||
</Table>
|
||||
|
||||
<Button
|
||||
<Button
|
||||
floating
|
||||
large
|
||||
className="green"
|
||||
fab={{direction: 'bottom'}}
|
||||
waves="light"
|
||||
icon="add"
|
||||
icon="add"
|
||||
onClick={
|
||||
() => {
|
||||
props.history.push(MAKE_MONEY_MOVE)
|
||||
}
|
||||
}/>
|
||||
}
|
||||
/>
|
||||
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user