From 36b0e5da834647d9878a078242d2f02eda096f22 Mon Sep 17 00:00:00 2001 From: Tobias Petrich Date: Mon, 25 Mar 2024 14:11:47 +0100 Subject: [PATCH] Add Anhangsverzeichnis and ToDos --- README.md | 47 ++++++++++++++++----- src/components/pdf/MyDocument.tsx | 2 + src/components/pdf/Verzeichnis.tsx | 67 ++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 11 deletions(-) create mode 100644 src/components/pdf/Verzeichnis.tsx diff --git a/README.md b/README.md index 0d6babe..ac07764 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,34 @@ +# ToDos + +- [ ] Add checkboxes to the Inhaltsverzeichnis +- [ ] Link to Podio Tutorial +- [ ] Add General ToDo section + - [ ] Kassenbons getackert, nicht geklebt? + - [ ] Bons die länge als das Blatt sind, so gefaltet, dass sowohl Gesamtsumme als auch Posten sichbar sind? + - [ ] Anhänge mit Postennummer nummeriert? + - [ ] Rechnungen haben alle Rechnungssteller/in als Rechnungsaddresse? + - [ ] Haben alle Rechnungen eine Rechnungsnummer? + - [ ] Haben alle Rechnungen eine Steuer ausgewiesen? + - [ ] Sind alle Rechnungen "echte" Rechnungen? (Keine Proforma, keine Angebote, keine Lieferscheine) + - [ ] Rechnungen in Auslandswährung haben entweder Umrechnungsfaktor auf Zahlungsbeleg oder auf link von Oskar + - [ ] Ist Pfand und Alkohol aus Bewirtungsrechnungen per Nebenrechnung herausgerechnet? + - [ ] Alles ausgedruckt und Deckblatt NUR oben links handschriftlich unterschrieben? + - [ ] Alle Blätter mit Büroklammer zusammengeheftet und bei Finanzleitung abgegeben? +- [ ] Multiple Kostenstellen -> multiple pages +- [ ] Kostenstelle Tanken -> Start / Ziel + Kilometer +- [ ] Toggle Nebenrechnung erforderlich? +- [ ] Toggle single Kontoauszug + # React + TypeScript + Vite This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. Currently, two official plugins are available: -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) + uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast + Refresh ## Expanding the ESLint configuration @@ -15,16 +38,18 @@ If you are developing a production application, we recommend updating the config ```js export default { - // other rules... - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - project: ['./tsconfig.json', './tsconfig.node.json'], - tsconfigRootDir: __dirname, - }, + // other rules... + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + project: ['./tsconfig.json', './tsconfig.node.json'], + tsconfigRootDir: __dirname, + }, } ``` -- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` +- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` + or `plugin:@typescript-eslint/strict-type-checked` - Optionally add `plugin:@typescript-eslint/stylistic-type-checked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and + add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list diff --git a/src/components/pdf/MyDocument.tsx b/src/components/pdf/MyDocument.tsx index b4a045e..b4a63ca 100644 --- a/src/components/pdf/MyDocument.tsx +++ b/src/components/pdf/MyDocument.tsx @@ -2,11 +2,13 @@ import {Document} from '@react-pdf/renderer'; import Person from "../../data/Person.ts"; import AuszahlungPage from "./AuszahlungPage.tsx"; import Posten from "../../data/Posten.ts"; +import Verzeichnis from "./Verzeichnis.tsx"; const MyDocument = ({person, bankdaten, posten}: { person: Person, bankdaten: any, posten: Posten[] }) => { return ( + ); } diff --git a/src/components/pdf/Verzeichnis.tsx b/src/components/pdf/Verzeichnis.tsx new file mode 100644 index 0000000..7765af5 --- /dev/null +++ b/src/components/pdf/Verzeichnis.tsx @@ -0,0 +1,67 @@ +import Posten from "../../data/Posten.ts"; +import {StyleSheet, Page, View, Text} from "@react-pdf/renderer"; + +const styles = StyleSheet.create({ + page: { + flexDirection: 'column', + backgroundColor: '#ffffff', + paddingLeft: '2cm', + paddingRight: '2cm', + paddingTop: '1.5cm', + paddingBottom: '1.5cm', + fontFamily: 'Helvetica', + fontSize: 11, + }, + section: {}, + h1: { + fontSize: 24, + marginBottom: 10, + }, + postenGroup: { + marginBottom: 10, + }, + posten: { + marginBottom: 2, + }, +}); + +const Verzeichnis = ({posten}: { posten: Posten[] }) => { + let index = 1; + const verzeichnisList = posten.map((posten) => { + if (posten.getZahlungsart() === "Bar") { + return ( + + {index++}. Originalrechnung für Posten Nr. {posten.getNummer()} + + ) + } else if (posten.getZahlungsart() === "PayPal") { + return ( + + {index++}. Originalrechnung für Posten Nr. {posten.getNummer()} + {index++}. PayPal Beleg für Posten Nr. {posten.getNummer()} + {index++}. Bankauszug für Posten Nr. {posten.getNummer()} + + ) + } else { + return ( + + {index++}. Originalrechnung für Posten Nr. {posten.getNummer()} + {index++}. Bankauszug für Posten Nr. {posten.getNummer()} + + ) + } + }); + + return ( + + + Inhaltsverzeichnis der Anhänge + + {verzeichnisList} + + + + ); +} + +export default Verzeichnis; \ No newline at end of file