Skip to content
Snippets Groups Projects
Select Git revision
  • ad83b93eff163e0ba47b97e84b008236d62a3e66
  • master default protected
  • 2023-ujoncdelutan
  • 2023-update
  • 1.4.7 protected
  • 1.4.6 protected
  • 1.4.5 protected
  • 1.4.4 protected
  • 1.4.3 protected
  • 1.4.2 protected
  • 1.4.1 protected
  • 1.4.0 protected
  • 1.3.19 protected
  • 1.3.18 protected
  • 1.3.17 protected
  • 1.3.16 protected
  • 1.3.15 protected
  • 1.3.14 protected
  • 1.3.13 protected
  • 1.3.12 protected
  • 1.3.10 protected
  • 1.3.11 protected
  • 1.3.9 protected
  • 1.3.8 protected
24 results

EditEventForm.js

Blame
  • EditEventForm.js 3.22 KiB
    import React, { Component } from 'react';
    import { Modal, Button, Form, Input, Icon } from 'semantic-ui-react';
    import { connect } from 'react-redux';
    import moment from 'moment';
    import { DateTimeInput } from 'semantic-ui-calendar-react';
    import {
      writeEditEvent,
      editEvent,
    } from '../../actions/statistics'
    import { clearWrite } from '../../actions/news'
    
    class EditEventForm extends Component {
      constructor(props) {
        super(props);
        this.state = {
          showModal: false,
          date: '',
        };
      }
    
      // Handling change in redux action creator throws an exception
      // Temporal solotion using the components state to display, instead redux state
      handleChange = (event, {name, value}) => {
        if (this.state.hasOwnProperty(name)) {
          this.setState({ [name]: value });
        }
        this.props.writeEditEvent({target: {name: name, value: value}})
      }
    
      render() {
        const { name, date, description } = this.props.editedEvent;
        return (
          <Modal
            open={this.state.showModal}
            trigger={
              <Button
                compact
                onClick={() => { this.props.onClick();
                                 this.setState({ showModal: true }); }}
                size='mini'
              >
                Szerkeszt
              </Button>
            }
          >
            <Modal.Header>Alkalom szerkesztése:</Modal.Header>
            <Modal.Content
              style={{
                paddingTop: '20px',
              }}
            >
              <Form>
                <Form.Field
                  control={Input}
                  label='Név'
                  name='name'
                  onChange={e => this.props.writeEditEvent(e)}
                  value={name}
                  style={{
                    marginBottom: '20px',
                  }}
                  placeholder='Név'
                />
                <Form.TextArea
                  name='description'
                  label='Leírás:'
                  placeholder='Rövid leírás'
                  value={description}
                  onChange={e => this.props.writeEditEvent(e)}
                />