@@ -2,187 +2,51 @@ import React from 'react';
22import PropTypes from 'prop-types' ;
33import { withStyles } from '@material-ui/core/styles' ;
44import Button from '@material-ui/core/Button' ;
5- import Grid from '@material-ui/core/Grid' ;
6- import axios from 'axios' ;
7- import FormGroup from '@material-ui/core/FormGroup' ;
8- import FormControl from '@material-ui/core/FormControl' ;
9- import { DropzoneArea } from 'material-ui-dropzone'
10- import FormLabel from '@material-ui/core/FormLabel' ;
11- import Paper from '../ReviewPaper' ;
12-
5+ import FileUpload from "../common/FileUpload" ;
6+ import Divider from '@material-ui/core/Divider' ;
137
148const styles = theme => ( {
159 container : {
1610 display : 'flex' ,
1711 flexWrap : 'wrap' ,
1812 } ,
19- textField : {
20- marginLeft : theme . spacing . unit ,
21- marginRight : theme . spacing . unit ,
22- width : 200 ,
23- } ,
24- dense : {
25- marginTop : 19 ,
26- } ,
27- menu : {
28- width : 200 ,
29- } ,
30- button : {
31- margin : theme . spacing . unit ,
32- } ,
33- input : {
34- display : 'none' ,
35- } ,
36- label : {
37- marginLeft : theme . spacing . unit ,
38- } ,
39- fileUpload : {
40- marginLeft : theme . spacing . unit * 115 ,
41- width : 200 ,
42- marginTop : - 5 ,
43-
44- } ,
45- customlable : {
46- width : 1500 ,
47- marginTop : 15 ,
48-
4913
50- } ,
51- formControl : {
52- margin : theme . spacing . unit * 10 ,
53- } ,
54- FormGroup : {
55- margin : theme . spacing . unit ,
56- // width: theme.spacing.unit * 150,
57- // height: theme.spacing.unit,
58-
59- } ,
60-
6114} ) ;
6215
6316
6417class TextFields extends React . Component {
6518
66- constructor ( props ) {
19+ constructor ( props ) {
6720 super ( props ) ;
68- this . state = {
69- // filesToBeSent:[],
70- files : [ ]
71- }
72- }
73-
74- // onDrop(acceptedFiles, rejectedFiles) {
75- // console.log('Accepted files: ', acceptedFiles);
76- // var filesToBeSent=this.state.filesToBeSent;
77- // filesToBeSent.push({acceptedFiles});
78- // this.setState(acceptedFiles);
79- // console.log('filesToBeSent : ', this.state);
21+ this . state = { }
22+ }
8023
81- // }
82- handleChange ( files ) {
24+ handleChange ( files ) {
8325 this . setState ( {
8426 files : files
8527 } ) ;
86- console . log ( "==========" , this . state )
87- }
88-
89- // handleClick(event){
90- // // console.log("handleClick",event);
91- // var self = this;
92- // if(this.state.filesToBeSent.length>0){
93- // var filesArray = this.state.filesToBeSent;
94- // var req = request.post('upload'+'fileupload');
95-
96- // axios({
97- // method: 'post',
98- // headers: {
99- // 'Accept': 'application/json',
100- // 'Content-Type': 'application/json',
101- // },
102- // url: 'nominations/candidates',
103- // data: this.state
104- // })
105- // req.attach(filesArray[0].name,filesArray[0])
106-
107- // req.end(function(err,res){
108- // if(err){
109- // console.log("error ocurred");
110- // }
111- // console.log("res",res);
112- // alert("File printing completed")
113- // });
114- // }
115- // else{
116- // alert("Please upload some files first");
117- // }
118- // }
119-
28+ }
12029
12130
122- handleUpload = ( event ) => {
123- const data = new FormData ( )
124- const config = { headers : { 'Content-Type' : 'multipart/form-data' } } ;
31+ handleUpload = ( event ) => {
32+ const data = new FormData ( ) ;
33+ const config = { headers : { 'Content-Type' : 'multipart/form-data' } } ;
12534 var filesArray = this . state . files ;
126-
127- console . log ( "======sddd========" , filesArray [ 0 ] . name ) ;
128- // console.log(data);
129-
130- data . append ( 'file' , filesArray [ 0 ] , filesArray [ 0 ] . name ) ;
131- // console.log("==============", data.get('File'));
132- axios
133- . post ( 'upload' , data , config , {
134- // onUploadProgress: ProgressEvent => {
135- // this.setState({
136- // loaded: (ProgressEvent.loaded / ProgressEvent.total*100),
137- // })
138- // },
139- } )
140- . then ( res => {
141- console . log ( res . statusText )
142- } )
143- }
35+ } ;
14436
14537 render ( ) {
14638 const { classes} = this . props ;
14739 var names = [ 'Jake' , 'Jon' , 'Thruster' ] ;
148- return (
149- < form className = { classes . container } noValidate autoComplete = "off" >
150- < Grid container direction = "row" justify = "flex-start" alignItems = "stretch" spacing = { 8 } >
151- < Grid container spacing = { 8 } >
152- < Paper > </ Paper >
153- </ Grid >
154- </ Grid >
155-
156- < Grid container direction = "row" justify = "flex-start" alignItems = "stretch" spacing = { 8 } >
157- < FormControl component = "fieldset" className = { classes . formControl } >
158-
159- { names . map ( ( name ) => (
160- < div >
161- < form onSubmit = { this . handleUpload } >
162- < Grid container spacing = { 8 } >
163- < FormGroup className = { classes . FormGroup } row >
164- < FormLabel component = "legend" > Upload { name } Down Below :</ FormLabel >
165- < DropzoneArea onChange = { this . handleChange . bind ( this ) } > </ DropzoneArea >
166- { /* <input type="hidden" onChange={ this.fileSelectHandler } name="supportDocConfDataId" value={name}
167- ref={(input) => { this.actionInput = input }} /> */ }
168- </ FormGroup >
169- </ Grid >
170- < Grid container spacing = { 8 } >
171- < Grid className = { classes . label } item lg = { 3 } >
172- < Button onClick = { this . handleUpload } variant = "contained" value = "Submit" color = "secondary" className = { classes . submit } >
173- Upload
174- </ Button >
175- </ Grid >
176- </ Grid >
177- </ form >
178- </ div >
179- ) ) }
180- { /* <input type="hidden" onChange={ this.fileSelectHandler } name="nominationId" value="1"
181- ref={(input) => { this.actionInput = input }} /> */ }
182- </ FormControl >
183- </ Grid >
184- </ form >
185- ) ;
40+ return (
41+ < div >
42+
43+ < span > Download form : </ span > < a download = { "nomination.pdf" } > nomination.pdf</ a > < br />
44+ < span > Signed form : </ span > < FileUpload /> < br />
45+ < Divider variant = "middle" />
46+ < br />
47+ < span > Supporting doc 1 : </ span > < FileUpload /> < br />
48+ < span > Supporting doc 1 : </ span > < FileUpload /> < br />
49+ </ div > ) ;
18650 }
18751}
18852
0 commit comments