Commit 52bccd92 authored by Xiyang Lu's avatar Xiyang Lu

Merge branch 'show-out-of-stock-for-products-with-no-available-stock' into 'master'

Show out of stock for products with no available stock

See merge request !17
parents 59df5e39 a85fecf1
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
.header-nav { .header-nav {
padding-left: 20px; padding-left: 20px;
box-shadow: 0px 1px 10px;
} }
/* #nav-home-link { /* #nav-home-link {
......
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Checkout from './checkout'; import Checkout from './checkout.js';
const mSTP = state => ({ const mSTP = state => ({
...@@ -8,5 +8,4 @@ const mSTP = state => ({ ...@@ -8,5 +8,4 @@ const mSTP = state => ({
const mDTP = dispatch => ({ const mDTP = dispatch => ({
}); });
export default connect(mSTP, mDTP)(Checkout); export default connect(mSTP, mDTP)(Checkout);
\ No newline at end of file
...@@ -85,15 +85,18 @@ export default class ProductDetails extends Component { ...@@ -85,15 +85,18 @@ export default class ProductDetails extends Component {
<form className="details-add-cart-and-quantity" onSubmit={ e => this.handleSubmit(e, this.props.product) }> <form className="details-add-cart-and-quantity" onSubmit={ e => this.handleSubmit(e, this.props.product) }>
<input <input
type="number" type="number"
className="prod-details-quantity" className="prod-details-quantity"
id={ this.props.user?.currentUser ? "" : "disabled" }
disabled={ !this.props.user?.currentUser } disabled={ !this.props.user?.currentUser }
onChange={this.handleChange("orderItemQuantity")} onChange={this.handleChange("orderItemQuantity")}
placeholder="Quantity" placeholder="Quantity"
value={ this.state.orderItemQuantity } value={ this.state.orderItemQuantity }
/> />
<button className="prod-details-add-to-cart" disabled={ !this.props.user?.currentUser }> <button
Add to Cart className="prod-details-add-to-cart"
</button> id={ this.props.user?.currentUser ? "" : "disabled" }
disabled={ !this.props.user?.currentUser
}>Add to Cart</button>
{ this.props.user?.currentUser ? "" :<p id="details-please-log-in-notice">Log in to Add to Cart</p>} { this.props.user?.currentUser ? "" :<p id="details-please-log-in-notice">Log in to Add to Cart</p>}
</form> </form>
</div> </div>
......
...@@ -83,33 +83,45 @@ export default class ProductItem extends Component { ...@@ -83,33 +83,45 @@ export default class ProductItem extends Component {
} }
</div> </div>
<p id="prod-name">{ this.props.item.productName }</p> <p id="prod-name">{ this.props.item.productName }</p>
<div id="prod-price"> <div className="product-price-promo-quantity-add-cart">
{ this.props.item.promo ? <div className="price-and-promo">
<div id="promo-show"> <div id="prod-price">
<p id="promo-show-text-original"> { this.props.item.promo ?
${ this.props.item.price } <div id="promo-show">
</p> <p id="promo-show-text-original">
<p id="promo-show-text"> ${ this.props.item.price }
${ discount } </p>
</p> <p id="promo-show-text">
</div> : "$" + this.props.item.price } ${ discount }
</p>
</div> : "$" + this.props.item.price }
</div>
{ this.props.item.promo ?
<p id="prod-promotion">
{ "Save " + this.props.item.promo + "%!"}
</p> : ""}
</div>
<form onSubmit={ e => this.handleSubmit(e, this.props.item) } className="add-cart-and-quantity">
{ this.props.user?.currentUser ? "" :<p id="please-log-in-notice">Log in to <br /> Add to Cart</p>}
<p id="quantity-text">Qty</p>
<input
className="order-quantity"
id={ this.props.user?.currentUser ? "" : "disabled" }
type="number"
placeholder="Qty"
disabled={ !this.props.user?.currentUser }
onChange={ this.handleChange("orderItemQuantity") }
value = { this.state.orderItemQuantity }
min="1"
max="99"
/>
<button
disabled={ !this.props.user?.currentUser }
className="add-to-cart-button"
id={ this.props.user?.currentUser ? "" : "disabled" }
>Add to Cart</button>
</form>
</div> </div>
{ this.props.item.promo ?
<p id="prod-promotion">
{ "Save " + this.props.item.promo + "% on this item!"}
</p> : ""}
<form onSubmit={ e => this.handleSubmit(e, this.props.item) } className="add-cart-and-quantity">
{ this.props.user?.currentUser ? "" :<p id="please-log-in-notice">Log in to Add to Cart</p>}
<input
className="order-quantity"
type="number"
placeholder="Qty"
disabled={ !this.props.user?.currentUser }
onChange={ this.handleChange("orderItemQuantity") }
value = { this.state.orderItemQuantity }
/>
<button disabled={ !this.props.user?.currentUser } className="add-to-cart-button">Add to Cart</button>
</form>
<Modal <Modal
id="product-details-modal" id="product-details-modal"
......
...@@ -38,7 +38,8 @@ export default class ProductMarket extends Component { ...@@ -38,7 +38,8 @@ export default class ProductMarket extends Component {
<div className="products-container"> <div className="products-container">
{this.props.products.map(prod => { {this.props.products.map(prod => {
return ( return (
<div className={prod.productName ? "product-item-container" : "no-item"} key={ prod.sku }> <div className={prod.availableStock >= 0 ? "product-item-container" : "no-item"} key={ prod.sku }>
{ prod.availableStock >= 0 ? "" : <p id="out-of-stock">- Out of Stock -</p> }
{ prod.productName ? { prod.productName ?
<ProductItem <ProductItem
item={ prod } item={ prod }
...@@ -46,7 +47,7 @@ export default class ProductMarket extends Component { ...@@ -46,7 +47,7 @@ export default class ProductMarket extends Component {
user={ this.props.user } user={ this.props.user }
addToCart={ this.props.addCartItem } addToCart={ this.props.addCartItem }
/> />
: :
<div className="product-item"> <div className="product-item">
<p id="prod-not-available">This Product is No Longer Available</p> <p id="prod-not-available">This Product is No Longer Available</p>
</div> </div>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
background-color: rgb(231, 228, 228);
} }
#product-market-title { #product-market-title {
...@@ -34,7 +35,23 @@ ...@@ -34,7 +35,23 @@
} }
.no-item { .no-item {
display: none; pointer-events: none;
position: relative;
width: 330px;
height: 335px;
margin: 8px;
opacity: 0.6;
}
#out-of-stock {
background: white;
position: absolute;
width: 100%;
text-align: center;
font-size: 35px;
top: 80px;
opacity: 0.5;
z-index: 50;
} }
.product-item { .product-item {
...@@ -42,14 +59,19 @@ ...@@ -42,14 +59,19 @@
height: 100%; height: 100%;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
box-shadow: 3px 4px 6px;
border-radius: 8px;
background-color: white;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border: 1px solid gray; border: 1px solid lightgray;
transition: all 0.5s; transition: all 0.5s;
} }
.product-item:hover { .product-item:hover {
transform: scale(1.03); transform: scale(1.03);
box-shadow: 5px 6px 10px;
border-color: gray;
} }
#prod-img { #prod-img {
...@@ -109,10 +131,20 @@ ...@@ -109,10 +131,20 @@
#prod-price { #prod-price {
font-size: 18px; font-size: 18px;
font-size: 18px;
display: flex;
justify-content: center;
align-items: center;
} }
#prod-promotion { #prod-promotion {
font-size: 17px;
color: red; color: red;
padding-bottom: 6px;
}
#quantity-text {
padding-top: 4px;
} }
.add-to-cart-button { .add-to-cart-button {
...@@ -139,6 +171,9 @@ ...@@ -139,6 +171,9 @@
#promo-show { #promo-show {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 5px;
padding-top: 2px;
height: 24px;
} }
#promo-show-text, #promo-show-text-original { #promo-show-text, #promo-show-text-original {
...@@ -166,7 +201,7 @@ ...@@ -166,7 +201,7 @@
outline: none; outline: none;
height: 30px; height: 30px;
padding: 6px; padding: 6px;
width: 42px; width: 47px;
transition: all 0.5s; transition: all 0.5s;
} }
.order-quantity:focus { .order-quantity:focus {
...@@ -176,15 +211,20 @@ ...@@ -176,15 +211,20 @@
.add-cart-and-quantity { .add-cart-and-quantity {
display: flex; display: flex;
position: relative; position: relative;
flex-wrap: wrap;
width: 50%;
justify-content: center;
} }
#please-log-in-notice { #please-log-in-notice {
display: none; display: none;
position: absolute; position: absolute;
bottom: 47px; text-align: center;
left: 22px; bottom: 50px;
width: 80%;
padding: 3px 10px; padding: 3px 10px;
border-radius: 5px; border-radius: 5px;
cursor: default;
background-color: rgb(248, 76, 76); background-color: rgb(248, 76, 76);
animation: fadeInUp; animation: fadeInUp;
...@@ -408,8 +448,27 @@ ...@@ -408,8 +448,27 @@
color: red; color: red;
} }
input::-webkit-outer-spin-button, .product-price-promo-quantity-add-cart {
width: 100%;
display: flex;
background-color: rgba(202, 202, 202, 0.6);
padding-top: 9px;
margin-bottom: -4px;
border-radius: 0px 0px 7px 7px;
}
.price-and-promo {
width: 50%;
display: flex;
flex-wrap: wrap;
}
#disabled {
pointer-events: none;
}
/* input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { input::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} } */
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment