import * as React from 'react' import Dialog from '@mui/material/Dialog'; import DialogContent from '@mui/material/DialogContent'; import Button from '@mui/material/Button'; import DialogActions from '@mui/material/DialogActions'; import { DialogTitle } from '@mui/material'; import FormControl from '@mui/material/FormControl'; import Select from '@mui/material/Select'; import MenuItem from '@mui/material/MenuItem'; import Komunikaty from '../../komunikaty'; import axios from "axios"; import KomponentModyfikujKontrahentaSub from './komponent_modyfikuj_kontrahenta_sub'; export default class KomponentModyfikujKontrahenta extends React.Component { constructor(props) { super(props); this.state = { pobierz_kontrahentow: [], wybrany_kontrahent: -1, otworz_komponent_modyfkuj_kontrahenta_sub: false, imie: props.imie, komunikat_pokaz1: false, nazwisko: '', telefon: '', } } Przycisk_komponent_modyfikuj_kontrahenta_sub_ukryj = () => { this.setState({ otworz_komponent_modyfkuj_kontrahenta_sub: false }) } Baza_kontrahentow_Aktualizacja() { fetch(`http://192.168.1.4:3333/kontrahent_pobierz`) .then(res => res.json()) .then(json => this.setState({ pobierz_kontrahentow: json })); } componentDidMount() { this.aktualizuj_baze_kontrahentow = setInterval(() => this.Baza_kontrahentow_Aktualizacja(), 5000); } componentDidUpdate(prevProps, prevState) { if (this.state.wybrany_kontrahent != -1) { axios.get('http://192.168.1.4:3333/pobierz_dane_kontrahenta_szczegolowe/?id=' + this.state.wybrany_kontrahent) .then((dane2) => { this.setState({ imie: dane2.data[0].nazwisko }); this.setState({ nazwisko: dane2.data[0].nazwisko }); this.setState({ telefon: dane2.data[0].telefon }); }) } } Przycisk_Anuluj = () => { this.props.anuluj(); } komunikat_ukryj = () => { this.setState({ komunikat_pokaz1: true }); } Przycisk_Modyfikuj = () => { if (this.state.wybrany_kontrahent === -1) { this.setState({ komunikat_pokaz1: false }); } else { this.setState({ otworz_komponent_modyfkuj_kontrahenta_sub: true }); } } Wybierz_Kontrahenta(event) { this.setState({ wybrany_kontrahent: event.target.value }); } render() { const { wyswietl } = this.props; return ( <> MODYFIKOWANIE KONTRAHENTA: ) } }