Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
satyamnaidu024 committed Apr 14, 2021
1 parent 9b3230c commit db7d997
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
33 changes: 26 additions & 7 deletions client/src/components/chatbot/Chatbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,24 @@ class Chatbot extends Component {
await this.resolveAfterXSeconds(1);
this.df_event_query('WELCOME_MF');
this.setState({mfWelcomesent:true,showBot:true})
} else if(this.props.history.location.pathname.startsWith('/product/')){



}


else if(this.props.history.location.pathname.startsWith('/product/')){

await this.resolveAfterXSeconds(1);
console.log("this.props.productDetails "+this.props.productDetails.product._id);
console.log("my order-" +this.props.myOrders.orders[0].orderItems[0].product)
this.props.myOrders.orders[0].orderItems[0].product===
this.props.productDetails.product._id ?
this.custom_query("You have already bought this product")
: this.custom_query("You havent bought this product")



this.custom_query('You are viewing the product '+this.props.productDetails.product.name+" which is of category "+this.props.productDetails.product.category);
this.custom_query("Product ID is- "+this.props.productDetails.product._id);

(this.props.productDetails.product.category==='Stocks') ?
this.df_event_query('VIEW_FAQ_PRODUCT_STOCK')
: this.df_event_query('VIEW_FAQ_PRODUCT_MF');
Expand Down Expand Up @@ -169,10 +180,17 @@ class Chatbot extends Component {
else if(this.props.history.location.pathname.startsWith('/product/'))
{
await this.resolveAfterXSeconds(1);

console.log("my order-" +this.props.myOrders.orders[0].orderItems[0].product)
this.props.myOrders.orders[0].orderItems[0].product===
this.props.productDetails.product._id ?
this.custom_query("You have already bought this product")
: this.custom_query("You havent bought this product")



this.custom_query('You are viewing the product '+this.props.productDetails.product.name+" which is of category "+this.props.productDetails.product.category);
this.custom_query("Product ID is- "+this.props.productDetails.product._id);

(this.props.productDetails.product.category==='Stocks') ?
this.df_event_query('VIEW_FAQ_PRODUCT_STOCK')
: this.df_event_query('VIEW_FAQ_PRODUCT_MF');
Expand Down Expand Up @@ -341,7 +359,8 @@ class Chatbot extends Component {
function mapStateToProps(state){
return {
auth:state.auth,
productDetails:state.productDetails
productDetails:state.productDetails,
myOrders:state.myOrders
}
}

Expand Down
3 changes: 0 additions & 3 deletions client/src/components/order/ListOrders.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React,{Fragment,useEffect} from 'react';
import {Link} from 'react-router-dom';
import MetaData from '../layout/MetaData'
import {MDBDataTable} from 'mdbreact'
import {useDispatch,useSelector} from 'react-redux'
import {myOrders} from '../../actions/orderActions'

Expand All @@ -13,7 +11,6 @@ const {orders} = useSelector(state=>state.myOrders)

useEffect(()=>{
dispatch(myOrders());
console.log("1.MY ORDERS ARE -"+orders)

},[dispatch])

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/product/OrderDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const OrderDetails = ({order}) =>{

{order.orderItems.map(orderItem =>(
<div>
<p>Product ID- {orderItem._id}</p>
<p>Product ID- {orderItem.product}</p>
<p>Product name- {orderItem.name}</p>
<p>Product Quantity- {orderItem.quantity}</p>
<p>Product Image- <img src={orderItem.imageurl}/></p>
<p>Product Image- <img alt="Not Found" src={orderItem.imageurl} /></p>
</div>
))}
</h5>
Expand Down

0 comments on commit db7d997

Please sign in to comment.