Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d270d0d

Browse files
RICKRICK
RICK
authored and
RICK
committed
lll
0 parents  commit d270d0d

29 files changed

+51588
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
node_modules/

.idea/jsLibraryMappings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/v3.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/watcherTasks.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 731 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app.jsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import { Router,Route,IndexRoute,hashHistory } from 'react-router';
4+
import Layout from './components/common.comp';
5+
import HomeComponent from './components/home.comp';
6+
import ClientComponent from './components/client.comp.jsx';
7+
import ContactComponent from './components/contact.comp.jsx';
8+
import ServiceComponent from './components/service.comp.jsx';
9+
import GetPrice from './components/product.comp';
10+
import DLComponent from './components/driveLicence.comp';
11+
12+
ReactDOM.render(
13+
<Router history={hashHistory}>
14+
<Route path="/" component={Layout} >
15+
<IndexRoute component={HomeComponent}/>
16+
<Route path="/services" components={ServiceComponent}>
17+
<Route path="/services/Driver's Licence Check" component={DLComponent}/>
18+
</Route>
19+
<Route path="/services/:doc" component={GetPrice} />
20+
<Route path="/client" component={ClientComponent}/>
21+
<Route path="/contact" component={ContactComponent}/>
22+
</Route>
23+
</Router>,
24+
document.getElementById('app')
25+
);

components/alert.comp.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {Alert} from 'react-bootstrap';
2+
3+
import React from 'react';
4+
5+
class MyAlert extends React.Component{
6+
7+
render() {
8+
return(
9+
<Alert bsStyle="info">
10+
<strong>Reminder..</strong> Some information will be here
11+
</Alert>
12+
)
13+
}
14+
}
15+
16+
export default MyAlert;

components/cart.comp.jsx

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import { hashHistory } from 'react-router';
4+
import { Panel,Button,ListGroup,ListGroupItem,Badge ,Modal,Table,InputGroup} from 'react-bootstrap';
5+
6+
7+
class Cart extends React.Component{
8+
constructor(props){
9+
super(props)
10+
this.state = {
11+
cart:{
12+
items: props.cartData.items,
13+
totalPrice: props.cartData.totalPrice
14+
},
15+
showCart: false
16+
}
17+
this.show = this.show.bind(this);
18+
this.hideCart = this.hideCart.bind(this);
19+
this.addMoreDoc = this.addMoreDoc.bind(this);
20+
this.edit = this.edit.bind(this);
21+
this.test = this.test.bind(this);
22+
23+
}
24+
25+
addMoreDoc(event){
26+
event.stopPropagation();
27+
hashHistory.push('/services');
28+
}
29+
show(){
30+
this.setState({
31+
showCart: true
32+
});
33+
34+
35+
console.log(this.state.cart);
36+
37+
}
38+
hideCart(){
39+
this.setState({
40+
showCart:false
41+
})
42+
43+
}
44+
test(e){
45+
e.stopPropagation();
46+
hashHistory.push('/');
47+
localStorage.clear();
48+
}
49+
delete(item){
50+
const newState = this.state.cart.items;
51+
if (newState.indexOf(item) > -1) {
52+
newState.splice(newState.indexOf(item), 1);
53+
this.setState({cart: {items: newState} })
54+
localStorage.cart = JSON.stringify(this.state.cart.items);
55+
}
56+
57+
}
58+
59+
edit(item,event){
60+
const args = event.target.id.split(':');
61+
const elementId = args[0];
62+
const action = args[1];
63+
let updatedCart = this.state.cart.items;
64+
// let itemIndex = updatedCart.indexOf(item);
65+
// let sumOfPrice = 0;
66+
let currentQty = ReactDOM.findDOMNode(this.refs[elementId+':qty']);
67+
if(action === 'add'){
68+
currentQty.value = (parseInt(currentQty.value) + 1);
69+
}else if(action === 'subs'){
70+
if(parseInt(currentQty.value) <= 0){
71+
return;
72+
}
73+
currentQty.value = (parseInt(currentQty.value) - 1);
74+
}
75+
76+
}
77+
78+
componentWillReceiveProps(nextProps){
79+
this.setState({
80+
cart: nextProps.cartData,
81+
});
82+
console.log((nextProps.cartData));
83+
}
84+
render(){
85+
const cartItemRow = this.state.cart.items.map((item) => {
86+
return (
87+
<tr key={item.id} id={item.id}>
88+
<td>{item.id}</td>
89+
<td>{item.doc}</td>
90+
<td>{item.dir}</td>
91+
<td>{item.lang}</td>
92+
<td>
93+
<InputGroup bsSize="small">
94+
<InputGroup.Button>
95+
<Button bsStyle="info" onClick={this.edit.bind(this,item)} id={'item-'+item.id+':add'}>+</Button>
96+
</InputGroup.Button>
97+
<input className="form-control" readOnly type="text" ref={'item-'+item.id+':qty'} defaultValue={item.extraCop}/>
98+
<InputGroup.Button>
99+
<Button bsStyle="info" onClick={this.edit.bind(this,item)} id={'item-'+item.id+':subs'}>-</Button>
100+
</InputGroup.Button>
101+
</InputGroup>
102+
</td>
103+
<td>${item.subTotal}</td>
104+
<td><Button bsStyle="danger" onClick={this.delete.bind(this,item)} id={'btn-'+item.id}>remove</Button></td>
105+
</tr>
106+
)
107+
});
108+
return(
109+
110+
<div >
111+
<Panel style={this.props.panelStyle.tab} header="Shopping Cart" bsStyle="info" >
112+
<ListGroup fill>
113+
<ListGroupItem><Button bsStyle="success" onClick={this.show} >ViewCart <Badge>{this.state.cart.items.length}</Badge></Button></ListGroupItem>
114+
<ListGroupItem><Button onClick={this.test} >CheckOut</Button></ListGroupItem>
115+
</ListGroup>
116+
</Panel>
117+
118+
<Modal show={this.state.showCart} bsSize="large" onHide={this.hideCart}>
119+
<Modal.Header closeButton>
120+
<Modal.Title>Your Orders</Modal.Title>
121+
</Modal.Header>
122+
<Modal.Body>
123+
<Table responsive>
124+
<thead>
125+
<tr>
126+
<th>Id</th>
127+
<th>Document</th>
128+
<th>Direction</th>
129+
<th>Language</th>
130+
<th>Extra Copy</th>
131+
<th>Sub-Total</th>
132+
<th>Action</th>
133+
</tr>
134+
</thead>
135+
<tbody>
136+
{this.state.cart.items.length?cartItemRow :null}
137+
<tr>
138+
<td colSpan="6" className="text-right">Total Price $:</td>
139+
<td >{this.state.cart.totalPrice}</td>
140+
</tr>
141+
</tbody>
142+
</Table>
143+
144+
</Modal.Body>
145+
<Modal.Footer>
146+
<Button bsStyle="success" onClick={this.hideCart}>Close</Button>
147+
<Button bsStyle="success" onClick={this.addMoreDoc}>Continue Shopping</Button>
148+
</Modal.Footer>
149+
</Modal>
150+
151+
</div>
152+
);
153+
}
154+
}
155+
156+
export default Cart;

components/cartItem.comp.jsx

Whitespace-only changes.

components/checkOut.comp.jsx

Whitespace-only changes.

components/client.comp.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import store from 'cache-store';
3+
class ClientComponent extends React.Component{
4+
5+
6+
render() {
7+
return (
8+
<div><h1>Client</h1></div>
9+
)
10+
}
11+
}
12+
13+
14+
export default ClientComponent;

components/common.comp.jsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React from 'react';
2+
import { Link } from 'react-router';
3+
4+
class Layout extends React.Component{
5+
6+
7+
render() {
8+
9+
return (
10+
<div>
11+
<nav className="navbar navbar-default navbar-transparent">
12+
<div className="container-fluid">
13+
<div className="navbar-header">
14+
<button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
15+
<span className="sr-only">Toggle navigation</span>
16+
<span className="icon-bar"></span>
17+
<span className="icon-bar"></span>
18+
<span className="icon-bar"></span>
19+
</button>
20+
<Link className="navbar-brand brand-name " to="/">Ethnolink</Link>
21+
</div>
22+
<div className="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
23+
<ul className="nav navbar-nav menu">
24+
25+
<li>
26+
<Link to="/services">Services</Link>
27+
</li>
28+
<li>
29+
<Link to="/client">Client</Link>
30+
</li>
31+
<li>
32+
<Link to="/contact">Contact</Link>
33+
</li>
34+
</ul>
35+
</div>
36+
37+
</div>
38+
</nav>
39+
<div className="container">
40+
{this.props.children}
41+
</div>
42+
</div>
43+
44+
45+
);
46+
}
47+
48+
49+
}
50+
51+
export default Layout;

components/contact.comp.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
3+
class ContactComponent extends React.Component{
4+
5+
render() {
6+
return (
7+
<div><h1>Contact</h1></div>
8+
)
9+
}
10+
}
11+
12+
13+
export default ContactComponent;

0 commit comments

Comments
 (0)