import React from 'react'; import { Checkbox, Form, Radio } from 'semantic-ui-react' import {ctx} from '../context.jsx' import SemanticDatepicker from 'react-semantic-ui-datepickers'; import 'react-semantic-ui-datepickers/dist/react-semantic-ui-datepickers.css'; class CreateSubscription extends React.Component { constructor(props) { super(props) this.state = { values: {} } } setValue(key, value) { let new_values = {...this.state.values} new_values[key] = value this.setState({ values: new_values }) } render() { const { values } = this.state const {contacts,chats} = this.context const fields = [ { type:'contacts', label:'Contact', name:'contact_id' }, { type:'chats', label:'Chat', name:'chat_id' }, { type:'radio', label:'Payment Interval', name:'interval', options:['daily','weekly','monthly'] }, { type:'checkbox', label:'Amount', name:'amount', options:[500,1000,2000,'custom'] }, { type:'multi', label:'End Rule', name:'endRule', options:[{ name:'end_number', type:'number', label:'Make Payments' },{ name:'end_date', type:'date', label:'Pay Until' }] } ] const ready = values.contact_id && //values.chat_id && values.interval && values.amount && ( (values.endRule==='date' && values.end_date) || (values.endRule==='number' && values.end_number) ) return (