Skip to content

Commit

Permalink
FE: add bonds currency
Browse files Browse the repository at this point in the history
  • Loading branch information
andreipradan committed Feb 25, 2025
1 parent bb02ebe commit db12f43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ $container-max-widths: (
}

.sticky-table {
max-height: 20vw;
max-height: 50vw;
overflow-y: auto;
display: block;
}
Expand Down
17 changes: 15 additions & 2 deletions frontend/src/app/finances/Investments/Bonds.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const Bonds = () => {
const [maturity, setMaturity] = useState(null)
const [notes, setNotes] = useState("")
const [net, setNet] = useState("")
const [currency, setCurrency] = useState("")
const [quantity, setQuantity] = useState("")
const [pnl, setPnl] = useState("")
const [price, setPrice] = useState("")
Expand All @@ -43,6 +44,7 @@ const Bonds = () => {

const clearModal = () => {
setCommission("")
setCurrency("")
setDate(null)
setInterest("")
setMaturity(null)
Expand Down Expand Up @@ -76,6 +78,7 @@ const Bonds = () => {
const data = {
date: date.toISOString(),
net,
currency,
notes,
quantity,
pnl,
Expand All @@ -98,6 +101,7 @@ const Bonds = () => {
useEffect(() => {
if (state.selectedItem) {
setCommission(state.selectedItem.commission)
setCurrency(state.selectedItem.currency)
setDate(new Date(state.selectedItem.date))
if (state.selectedItem.interest)
setInterest(state.selectedItem.interest)
Expand Down Expand Up @@ -238,6 +242,9 @@ const Bonds = () => {
{state.results[0].quantity && <ListItem label={"Quantity"} value={state.results[0].quantity} textType={"warning"} className="mr-3" />}
{state.results[0].ticker && <ListItem label={"Ticker"} value={state.results[0].ticker} textType={"warning"} className="mr-3" />}
{state.results[0].price && <ListItem label={"Price"} value={state.results[0].price} textType={"warning"} className="mr-3" />}
{state.results[0].net && <ListItem label={"Net"} value={
`${state.results[0].net} ${state.results[0].currency ? state.results[0].currency : ''}`
} textType={"warning"} className="mr-3" />}
{state.results[0].commission && <ListItem label={"Commission"} value={state.results[0].commission} textType={"warning"} className="mr-3" />}
{state.results[0].tax && <ListItem label={"Tax"} value={state.results[0].tax} textType={"success"} className="mr-3" />}
{state.results[0].interest && <ListItem label={"Interest"} value={state.results[0].interest} textType={"success"} className="mr-3" />}
Expand Down Expand Up @@ -488,8 +495,6 @@ const Bonds = () => {
scrollableYearDropdown
selected={maturity}
showIcon
// showYearDropdown
// showMonthYearPicker
/>
</div>
</Form.Group>
Expand Down Expand Up @@ -538,6 +543,14 @@ const Bonds = () => {
onChange={e => setNet(e.target.value)}
/>
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Currency</Form.Label>
<Form.Control
type="text"
value={currency}
onChange={e => setCurrency(e.target.value)}
/>
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Interest</Form.Label>
<Form.Control
Expand Down

0 comments on commit db12f43

Please sign in to comment.