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 23, 2018
1 parent 9de9235 commit 9ba8427
Show file tree
Hide file tree
Showing 10 changed files with 2,490 additions and 2,491 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
18 changes: 8 additions & 10 deletions 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 Expand Up @@ -36,7 +36,7 @@ class LiveCart extends Component {
var { transactions, liveTransactions } = this.state;
var renderRecentTransactions = () => {
if (transactions.length === 0) {
return <p>No recent transactions available</p>;
return <tr><td>No recent transactions available</td></tr>;
} else {
return transactions.map(transaction => (
<RecentTransactions {...transaction} />
Expand All @@ -49,15 +49,13 @@ class LiveCart extends Component {
var renderLiveTransactions = () => {
if (liveTransactions.length === 0) {
return (
<div>
<div className="col-md-5 pull-right">
<div>
<div className="alert alert-warning text-center" role="alert">
<strong>Not Active:</strong> No items added at the moment.
</div>
<tr>
<td colSpan="3">
<div className="alert alert-warning text-center" role="alert">
<strong>Not Active:</strong> No items added at the moment.
</div>
</div>
</div>
</td>
</tr>
);
} else {
return liveTransactions.map(liveTransaction => (
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
Loading

0 comments on commit 9ba8427

Please sign in to comment.