import React from 'react';
import { Row, Col, Button } from 'react-bootstrap';
import { Card, Profile } from '../../components/index';
import Form from '../../forms/form';
import moment from 'moment';
/**
* Initial page that declare all routes of the module
*/
export default class TableFormExample extends React.Component {
constructor(props) {
super(props);
this.state = { doc: {} };
this.validate = this.validate.bind(this);
this.clearIt = this.clearIt.bind(this);
this.onChangeDoc = this.onChangeDoc.bind(this);
}
validate() {
const self = this;
const errors = self.refs.form.validate();
this.setState({ errors: errors });
if (errors) {
return;
}
alert('form is valid');
}
clearIt() {
this.setState({ doc: {} });
this.forceUpdate();
}
onChangeDoc(doc) {
this.forceUpdate();
// display object in the console
console.log(doc);
}
render() {
// the columns of the table
const readOnlyColumns = [
{
title: 'iniDate',
content: item => {moment(item.iniDate).format('L LT')},
size: { sm: 6 }
},
{
title: 'userName',
content: item =>