Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeinum committed Dec 22, 2018
1 parent 9de9235 commit 96c603a
Show file tree
Hide file tree
Showing 10 changed files with 2,480 additions and 2,479 deletions.
3,956 changes: 1,978 additions & 1,978 deletions react-pos/package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion react-pos/src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import Header from "./js/components/Header";
import Main from "./js/components/Main";

const App = () => (
Expand Down
34 changes: 17 additions & 17 deletions react-pos/src/js/components/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ class Checkout extends Component {
return (
<div>
<button
class="btn btn-success lead"
className="btn btn-success lead"
id="checkoutButton"
ng-click="focusPayment()"
ng-disabled="cartTotal === 0"
data-toggle="modal"
data-target="#checkoutModal"
>
<i class="glyphicon glyphicon-shopping-cart" />
<i className="glyphicon glyphicon-shopping-cart" />
<br />
<br />
C<br />
Expand All @@ -32,26 +32,26 @@ class Checkout extends Component {
<Modal.Title>Checkout</Modal.Title>
</Modal.Header>
<Modal.Body>
<div ng-hide="transactionComplete" class="lead">
<div ng-hide="transactionComplete" className="lead">
<h3>
Total: <span class="text-danger"> {total} </span>
Total: <span className="text-danger"> {total} </span>
</h3>
<h3>
Change Due:
<span class="text-success">getChangeDue() | currency </span>
<span className="text-success">getChangeDue() | currency </span>
</h3>

<form class="form-horizontal" name="checkoutForm">
<form className="form-horizontal" name="checkoutForm">
<div
class="form-group"
ng-class="{ 'has-error': checkoutForm.payment.$error.required }"
className="form-group"
ng-className="{ 'has-error': checkoutForm.payment.$error.required }"
>
<div class="input-group">
<div class="input-group-addon">$</div>
<div className="input-group">
<div className="input-group-addon">$</div>
<input
type="number"
id="checkoutPaymentAmount"
class="form-control input-lg"
className="form-control input-lg"
name="payment"
step="any"
min="0"
Expand All @@ -61,35 +61,35 @@ class Checkout extends Component {
</div>
</div>

<p class="text-danger">Enter payment amount.</p>
<p className="text-danger">Enter payment amount.</p>

<button type="submit" class="btn btn-primary btn-lg lead">
<button type="submit" className="btn btn-primary btn-lg lead">
Print Receipt
</button>
</form>
</div>

<div
ng-show="transactionComplete"
class="lead"
className="lead"
ng-if="checkoutForm.payment"
>
<h3>
Total:
<span class="text-danger">
<span className="text-danger">
previousCartInfo.total | currency
</span>
</h3>
<h3>
Change Due:
<span class="text-success">
<span className="text-success">
previousCartInfo.paymentAmount - previousCartInfo.total |
currency
</span>
</h3>
<button
ng-click="closeModal()"
class="btn btn-default btn-lg"
className="btn btn-default btn-lg"
type="button"
>
Close
Expand Down
68 changes: 34 additions & 34 deletions react-pos/src/js/components/Inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Product from "./Product";
import axios from "axios";
import { Modal, Button } from "react-bootstrap";

const HOST = "http://localhost:80";
const HOST = "http://localhost:8001";

class Inventory extends Component {
constructor(props) {
Expand Down Expand Up @@ -45,13 +45,13 @@ class Inventory extends Component {
.then(
response =>
this.setState({ snackMessage: "Product Added Successfully!" }),
this.handleSnackbar()
this.handleSnackbar()
)
.catch(err => {
.catch(err =>
console.log(err),
this.setState({ snackMessage: "Product failed to save" }),
this.handleSnackbar();
});
this.handleSnackbar()
);
};
handleEditProduct = editProduct => {
axios
Expand All @@ -63,8 +63,8 @@ class Inventory extends Component {
})
.catch(err => {
console.log(err);
this.setState({ snackMessage: "Product Update Failed!" }),
this.handleSnackbar();
this.setState({ snackMessage: "Product Update Failed!" });
this.handleSnackbar();
return false;
});
};
Expand All @@ -91,10 +91,10 @@ class Inventory extends Component {

var renderProducts = () => {
if (products.length === 0) {
return <p>{products}</p>;
return <tr><td>No products</td></tr>;
} else {
return products.map(product => (
<Product {...product} onEditProduct={this.handleEditProduct} />
return products.map((product, index) => (
<Product key={index} {...product} onEditProduct={this.handleEditProduct} />
));
}
};
Expand All @@ -103,17 +103,17 @@ class Inventory extends Component {
<div>
<Header />

<div class="container">
<div className="container">
<a
class="btn btn-success pull-right"
className="btn btn-success pull-right"
onClick={() => this.setState({ productFormModal: true })}
>
<i class="glyphicon glyphicon-plus" /> Add New Item
<i className="glyphicon glyphicon-plus" /> Add New Item
</a>
<br />
<br />

<table class="table">
<table className="table">
<thead>
<tr>
<th scope="col">Name</th>
Expand All @@ -131,67 +131,67 @@ class Inventory extends Component {
<Modal.Title>Add Product</Modal.Title>
</Modal.Header>
<Modal.Body>
<form class="form-horizontal" name="newProductForm">
<div class="form-group">
<label class="col-md-4 control-label" for="barcode">
<form className="form-horizontal" name="newProductForm">
<div className="form-group">
<label className="col-md-4 control-label" htmlFor="barcode">
Barcode
</label>
<div class="col-md-4">
<div className="col-md-4">
<input
id="barcode"
name="barcode"
placeholder="Barcode"
class="form-control"
className="form-control"
/>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="name">
<div className="form-group">
<label className="col-md-4 control-label" htmlFor="name">
Name
</label>
<div class="col-md-4">
<div className="col-md-4">
<input
name="name"
placeholder="Name"
class="form-control"
className="form-control"
onChange={this.handleName}
/>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="price">
<div className="form-group">
<label className="col-md-4 control-label" htmlFor="price">
Price
</label>
<div class="col-md-4">
<div className="col-md-4">
<input
name="price"
placeholder="Price"
class="form-control"
className="form-control"
onChange={this.handlePrice}
type="number"
step="any"
min="0"
/>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="quantity_on_hand">
<div className="form-group">
<label className="col-md-4 control-label" htmlFor="quantity_on_hand">
Quantity On Hand
</label>
<div class="col-md-4">
<div className="col-md-4">
<input
name="quantity_on_hand"
placeholder="Quantity On Hand"
onChange={this.handleQuantity}
class="form-control"
className="form-control"
/>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="image">
<div className="form-group">
<label className="col-md-4 control-label" htmlFor="image">
Upload Image
</label>
<div class="col-md-4">
<div className="col-md-4">
<input type="file" name="image" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion react-pos/src/js/components/LiveCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import RecentTransactions from "./RecentTransactions";
import LiveTransactions from "./LiveTransactions";
import moment from "moment";

const HOST = "http://localhost:80";
const HOST = "http://localhost:8001";
var url = HOST + `/api/all`;
var socket = io.connect(HOST);
class LiveCart extends Component {
Expand Down
4 changes: 2 additions & 2 deletions react-pos/src/js/components/LiveTransactions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from "react";
import "./App.css";
import Header from "./Header";

class LiveTransactions extends Component {
render() {
var { quantity, name, price } = this.props;
Expand All @@ -13,7 +13,7 @@ class LiveTransactions extends Component {
<td>
<span>{price}</span>
<br />
<small class="small-text">
<small className="small-text">
<em>(${price} each)</em>
</small>
</td>
Expand Down
21 changes: 12 additions & 9 deletions react-pos/src/js/components/Pos.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import moment from "moment";
import { Modal, Button } from "react-bootstrap";
import LivePos from "./LivePos";

const HOST = "http://localhost:80";
const HOST = "http://localhost:8001";
let socket = io.connect(HOST);

class Pos extends Component {
Expand Down Expand Up @@ -42,15 +42,18 @@ class Pos extends Component {
handleSubmit = e => {
this.setState({ addItemModal: false });

const id = this.state.id + 1;

const currentItem = {
id: this.state.id++,
id: id,
name: this.state.name,
price: this.state.price,
quantity: this.state.quantity
};
var items = this.state.items;
items.push(currentItem);
this.setState({ items: items });

const items = [ ...this.state.items, currentItem ];

this.setState({ items, id });
};
handleName = e => {
this.setState({ name: e.target.value });
Expand Down Expand Up @@ -110,7 +113,7 @@ class Pos extends Component {
});
};
render() {
var { quantity, modal, items } = this.state;
var { items } = this.state;

var renderAmountDue = () => {
return (
Expand Down Expand Up @@ -198,7 +201,7 @@ class Pos extends Component {
u<br />
t
</button>
<div classNameName="modal-body">
<div className="modal-body">
<Modal show={this.state.checkOutModal}>
<Modal.Header closeButton>
<Modal.Title>Checkout</Modal.Title>
Expand Down Expand Up @@ -283,7 +286,7 @@ class Pos extends Component {
className="form-horizontal"
>
<div className="form-group">
<label className="col-md-2 lead" for="name">
<label className="col-md-2 lead" htmlFor="name">
Name
</label>
<div className="col-md-8 input-group">
Expand All @@ -296,7 +299,7 @@ class Pos extends Component {
</div>
</div>
<div className="form-group">
<label className="col-md-2 lead" for="price">
<label className="col-md-2 lead" htmlFor="price">
Price
</label>
<div className="col-md-8 input-group">
Expand Down
Loading

0 comments on commit 96c603a

Please sign in to comment.