fix betrag not updating correctly on delete
This commit is contained in:
		@ -4,7 +4,7 @@ import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined
 | 
			
		||||
import Posten from "../../data/Posten.ts";
 | 
			
		||||
import Zahlungsart from "../../data/Zahlungsart.ts";
 | 
			
		||||
import dayjs from "dayjs";
 | 
			
		||||
import {useState} from "react";
 | 
			
		||||
import {useEffect, useState} from "react";
 | 
			
		||||
 | 
			
		||||
const styles = {
 | 
			
		||||
    textfield: {
 | 
			
		||||
@ -21,14 +21,9 @@ const styles = {
 | 
			
		||||
const PostenInput = ({thisPosten, posten, setPosten}: { thisPosten: Posten, posten: Posten[], setPosten: any }) => {
 | 
			
		||||
    const [betragDisplay, setBetragDisplay] = useState('');
 | 
			
		||||
 | 
			
		||||
    // useEffect(() => {
 | 
			
		||||
    //     // Format the initial posten betrag for display
 | 
			
		||||
    //     if (posten.getBetrag()) {
 | 
			
		||||
    //         const formattedValue = posten.getBetrag().toString().padStart(3, '0');
 | 
			
		||||
    //         const initialDisplayValue = formattedValue.slice(0, -2) + ',' + formattedValue.slice(-2);
 | 
			
		||||
    //         setBetragDisplay(initialDisplayValue);
 | 
			
		||||
    //     }
 | 
			
		||||
    // }, [posten]);
 | 
			
		||||
    useEffect(() => {
 | 
			
		||||
        setBetragDisplay(thisPosten.getBetragString().slice(0, -2));
 | 
			
		||||
    }, [thisPosten]);
 | 
			
		||||
 | 
			
		||||
    const handleBetragChange = (event: React.ChangeEvent<HTMLInputElement>, isBlurred: boolean) => {
 | 
			
		||||
        const originalValue = event.target.value;
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user