Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
Refactor component structure and remove unnecessary div tags
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmielchen committed Feb 11, 2024
1 parent 6cef83c commit 7818776
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 100 deletions.
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function ThemeSchalter() {
function Layout() {
const [mode, setMode] = useState(modes.EINKAUF)
return (
<div>
<>
<Navbar className="bg-body-tertiary mb-4">
<Container>
<Navbar.Brand>STFT</Navbar.Brand>
Expand All @@ -67,7 +67,7 @@ function Layout() {
{mode === modes.EINKAUF && <Einkauf />}
{mode === modes.VERKAUF && <Verkauf />}

</div>
</>
);
}

Expand Down
50 changes: 24 additions & 26 deletions src/lib/artikel.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,30 @@ function Artikel({ setSumme }) {
}, [rows, setSumme]);

return (
<div>
<Table striped bordered hover>
<thead>
<tr>
<th>Nr.</th>
<th>Menge</th>
<th>Preis</th>
<th>Summe</th>
</tr>
</thead>
<tbody>
{rows.map((row, index) => (
<tr key={index}>
<td>{row.nr}</td>
<td>
<input type="number" name="menge" value={row.menge} onChange={(event) => handleInputChange(event, index)}/>
</td>
<td>
<input type="number" name="preis" value={row.preis} onChange={(event) => handleInputChange(event, index)}/>
</td>
<td>{waehrung(calculateSum(row.menge, row.preis))}</td>
</tr>
))}
</tbody>
</Table>
</div>
<Table striped bordered hover>
<thead>
<tr>
<th>Nr.</th>
<th>Menge</th>
<th>Preis</th>
<th>Summe</th>
</tr>
</thead>
<tbody>
{rows.map((row, index) => (
<tr key={index}>
<td>{row.nr}</td>
<td>
<input type="number" name="menge" value={row.menge} onChange={(event) => handleInputChange(event, index)}/>
</td>
<td>
<input type="number" name="preis" value={row.preis} onChange={(event) => handleInputChange(event, index)}/>
</td>
<td>{waehrung(calculateSum(row.menge, row.preis))}</td>
</tr>
))}
</tbody>
</Table>
);
}

Expand Down
36 changes: 17 additions & 19 deletions src/lib/buchungssaetze/buchungssatz.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@ import waehrung from "../standard/waehrung";

function Buchungssatz({dict}) {
return (
<div>
<Table striped bordered hover>
<thead>
<tr>
<th>Haben</th>
<th>Soll</th>
<th>Betrag</th>
<Table striped bordered hover>
<thead>
<tr>
<th>Haben</th>
<th>Soll</th>
<th>Betrag</th>
</tr>
</thead>
<tbody>
{dict.map((row, index) => (
<tr key={index}>
<td>{row.haben}</td>
<td>{row.soll}</td>
<td>{waehrung(row.betrag)}</td>
</tr>
</thead>
<tbody>
{dict.map((row, index) => (
<tr key={index}>
<td>{row.haben}</td>
<td>{row.soll}</td>
<td>{waehrung(row.betrag)}</td>
</tr>
))}
</tbody>
</Table>
</div>
))}
</tbody>
</Table>
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/buchungssaetze/rechnungAusgehend.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function RechnungAusgehend({rechnungsbetrag}) {
];

return (
<div>
<>
<Table striped bordered hover>
<thead>
<tr>
Expand All @@ -49,7 +49,7 @@ function RechnungAusgehend({rechnungsbetrag}) {
</Table>

<Buchungssatz dict={dict}/>
</div>
</>
);
}

Expand Down
4 changes: 1 addition & 3 deletions src/lib/buchungssaetze/rechnungEingehend.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ function RechnungEingehend({rechnungsbetrag, bezugskosten}) {
}

return (
<div>
<Buchungssatz dict={dict}/>
</div>
<Buchungssatz dict={dict}/>
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/buchungssaetze/zahlungAusgehend.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function ZahlungAusgehend({rechnungsbetrag}) {
}

return (
<div>
<>
<Table striped bordered hover>
<tbody>
<tr>
Expand All @@ -43,7 +43,7 @@ function ZahlungAusgehend({rechnungsbetrag}) {
</tbody>
</Table>
<Buchungssatz dict={dict}/>
</div>
</>
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/buchungssaetze/zahlungEingehend.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function ZahlungEingehend({rechnungsbetrag}) {
}

return (
<div>
<>
<Table striped bordered hover>
<tbody>
<tr>
Expand All @@ -43,7 +43,7 @@ function ZahlungEingehend({rechnungsbetrag}) {
</tbody>
</Table>
<Buchungssatz dict={dict}/>
</div>
</>
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/rechnungsfussAngebot.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function RechnungsfussAngebot({ summe, setRechnungsbetrag }) {
}, [summe, setRechnungsbetrag]);

return (
<div>
<>
<Table striped bordered hover>
<tbody>
<tr>
Expand Down Expand Up @@ -113,7 +113,7 @@ function RechnungsfussAngebot({ summe, setRechnungsbetrag }) {
</tr>
</tbody>
</Table>
</div>
</>
);
}

Expand Down
82 changes: 40 additions & 42 deletions src/lib/rechnungsfussBestellung.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,46 @@ function RechnungsfussBestellung({ summe, setRechnungsbetrag, setBezugskosten })
}, [summe, rabatt, versandkosten, setRechnungsbetrag]);

return (
<div>
<Table striped bordered hover>
<tbody>
<tr>
<th>Summe</th>
<td>{waehrung(summe)}</td>
<td></td>
</tr>
<tr>
<th>Rabatt</th>
<td>
{waehrung(rabattInEuro())}
</td>
<td>
<input type="number" value={rabatt} onChange={(event) => setRabatt(event.target.value)} />
</td>
</tr>
<tr>
<th>Versandkosten</th>
<td>
<input type="number" value={versandkosten} onChange={(event) => setVersandkosten(event.target.value)} />
</td>
<td></td>
</tr>
<tr>
<th>Gesamtpreis netto</th>
<td>{waehrung(gesamtPreisNetto())}</td>
<td></td>
</tr>
<tr>
<th>Umsatzsteuer</th>
<td>{waehrung(umsatzsteuer())}</td>
<td>19%</td>
</tr>
<tr>
<th>Rechnungsbetrag</th>
<td>{waehrung(rechnungsbetrag())}</td>
<td></td>
</tr>
</tbody>
</Table>
</div>
<Table striped bordered hover>
<tbody>
<tr>
<th>Summe</th>
<td>{waehrung(summe)}</td>
<td></td>
</tr>
<tr>
<th>Rabatt</th>
<td>
{waehrung(rabattInEuro())}
</td>
<td>
<input type="number" value={rabatt} onChange={(event) => setRabatt(event.target.value)} />
</td>
</tr>
<tr>
<th>Versandkosten</th>
<td>
<input type="number" value={versandkosten} onChange={(event) => setVersandkosten(event.target.value)} />
</td>
<td></td>
</tr>
<tr>
<th>Gesamtpreis netto</th>
<td>{waehrung(gesamtPreisNetto())}</td>
<td></td>
</tr>
<tr>
<th>Umsatzsteuer</th>
<td>{waehrung(umsatzsteuer())}</td>
<td>19%</td>
</tr>
<tr>
<th>Rechnungsbetrag</th>
<td>{waehrung(rechnungsbetrag())}</td>
<td></td>
</tr>
</tbody>
</Table>
);
}

Expand Down

0 comments on commit 7818776

Please sign in to comment.