Skip to content

Commit

Permalink
mess
Browse files Browse the repository at this point in the history
  • Loading branch information
AliElsebaie committed May 4, 2019
1 parent 5b38f82 commit 717188e
Show file tree
Hide file tree
Showing 9 changed files with 320 additions and 548 deletions.
2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
"react-router-dom": "^5.0.0",
"react-scripts": "2.1.8",
"react-scroll": "^1.7.11",
"react-select": "^2.0.0-beta.7",
"react-simple-animate": "^2.6.5",
"react-stepper-horizontal": "^1.0.11",
"react-tap-event-plugin": "^3.0.3",
"react-validation": "^3.0.7",
"react-virtualized-select": "^3.1.3",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"semantic-ui-react": "^0.86.0",
Expand Down
4 changes: 2 additions & 2 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import ForgotPassword from './containers/ForgotPassword';
import ResetPassword from './containers/ResetPassword';
import About from './components/pages/about';
import ApprovedCompanies from './components/pages/ApprovedCompanies';
import companyPDF from './components/pages/companyPdf';
import CompanyPDF from './components/pages/companyPdf';
import CreateANewCompany from './components/pages/CreateANewCompany';
import AttributeArray from './components/pages/AttributeArray';
import InProgressInvestorCases from './components/pages/inProgressInvestorCases';
Expand Down Expand Up @@ -187,7 +187,7 @@ class App extends Component {
<Route
exact
path="/companyPdf"
render={(props) => <companyPDF {...props} lang={this.state.lang} />}
render={(props) => <CompanyPDF {...props} lang={this.state.lang} />}
/>

<Route
Expand Down
Binary file added client/src/back.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/back2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added client/src/components/form/Auto
Empty file.
164 changes: 0 additions & 164 deletions client/src/components/form/Autocomplete.js

This file was deleted.

131 changes: 75 additions & 56 deletions client/src/components/form/GetFormByCompanyName.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { Button } from "react-bootstrap";
import html2canvas from "html2canvas";
import styled, { css } from "styled-components";
import trans from "../translations/searchCompanyTranslation";
import Autocomplete from "Autocomplete";
import Select from "react-select";
import {components} from "react-select"
import options from "react-select"
import search from '../../back.jpg';

//import { Dropdown } from 'semantic-ui-react';
import axios from "axios";
Expand All @@ -24,7 +27,7 @@ class MyCompany extends Component {
state = {
companyName: "",
companies: [],
viewedComp: []
viewedComp: [] ,
};

componentDidMount = () => {
Expand All @@ -36,11 +39,18 @@ class MyCompany extends Component {
this.setState({
companies: res.data.data
});
{
this.state.companies.map((nat,index) =>{
var o = {label:nat.companyName,value:index}
this.state.viewedComp.push(o)
}
);
}
// console.log(this.state.companies)
console.log(this.state.viewedComp);
});
};

//do you mean get all forms?

tabRow() {
return this.state.companies.map(function(company, i) {
return (
Expand All @@ -55,29 +65,28 @@ class MyCompany extends Component {
this.setState({ [event.target.name]: { value: event.target.value } });
};

handleClick(event) {
axios.defaults.headers.common["Authorization"] =
"Bearer " + localStorage.getItem("jwtToken");
var apiBaseUrl = "/routes/api/admins/getByCompanyName/";

axios
.get(apiBaseUrl + this.state.companyName.value, {
headers: { Authorization: localStorage.getItem("jwtToken") }
})
.then(res => {
this.setState({ viewedComp: res.data.data });
});
handleClick=(opt)=> {
this.setState({value:opt.label})
}

getAttributes = () => {
return this.state.viewedComp.map((Form, index) => {
var Form;
console.log(this.state.companies)
for(let i=0;i<this.state.companies.length;i++){
if(this.state.companies[i].companyName===this.state.value)
Form = this.state.companies[i]
}
console.log(Form)
console.log("hi")
var KEYS = [];
// console.log(Form)
for (var key in Form) {
KEYS.push(key);
}
if(Form)
return (
<Card>
// <div style={{marginRight:"100px"}}>
<Card >
<Card.Body>
{KEYS.map((key, index) => {
if (
Expand All @@ -87,7 +96,7 @@ class MyCompany extends Component {
key !== "investorId" &&
key !== "lawyerId" &&
key !== "reviewerId" &&
key !== "__v"
key !== "__v"
) {
var constraints = Form[key];
if (Array.isArray(constraints)) {
Expand All @@ -114,53 +123,63 @@ class MyCompany extends Component {
})}
</Card.Body>
</Card>
//</div>
);
});
};


render() {
trans.setLanguage(this.props.lang);
return (
// <div style={{paddingLeft:"60px"}}>
<div>
<MDBCol>
<MDBRow style={{ paddingLeft: "41%", paddingTop: "5%" }}>
<MDBInput
icon="search"
label={trans.label}
value={this.state.companyName.value}
name="companyName"
onChange={this.changeHandler}
type="text"
id="materialFormRegisterNameEx"
required
/>
</MDBRow>
</MDBCol>
<div style={{ paddingLeft: "44%", paddingBottom: "70px" }}>
<Button
variant="omar"
style={{
width: "100px",
height: "40px",
backgroundColor: "#a3dbf1"
}}
onClick={event => this.handleClick(event)}
type="submit"
>
{trans.search}
</Button>
const { Option } = components;
const IconOption = (props) => (
<Option {...props}>
<i class="fas fa-building"></i>
{props.data.label}
</Option>
);
// var n = (
// <div style={{paddingTop :"110px" ,fontSize:"1.7em"}}>
// <i class="fas fa-search" ></i>
// </div>
// )
return (

<div >

<div >
<section style={{paddingRight:"100px", display:"flex", justifyContent: 'center',width:"100%" ,height:"700px", backgroundImage:"url("+search+")",backgroundRepeat:"no-repeat",backgroundSize:"100% 100%",alignItems:"center"}}>

<div >

<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>

<div className="app" >

<div className="container" style={{width:"400px" ,marginLeft:"120px" }}>
<Select options={this.state.viewedComp} onChange={this.handleClick}
components={{Option: IconOption }} selected={options} >
</Select>
<br />

<div style={{paddingRiht:"100px",width:"800px" }}>{this.getAttributes()} </div>

</div>
</div>
<br />
<div>{this.getAttributes()}\ </div>

<Autocomplete suggestions={this.state.companies} />

</div>
</section>
</div>
</div>


);
}
}

// ReactDOM.render(<MyCompany />, document.getElementById('root'));
export default MyCompany;
export default MyCompany;
Loading

0 comments on commit 717188e

Please sign in to comment.