-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 120 KB
/
.eslintcache
1
[{"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\index.js":"1","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\serviceWorker.js":"2","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\App.js":"3","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\productContext.js":"4","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\helpers.js":"5","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\api.js":"6","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\data.js":"7","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Default.js":"8","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Navbar.js":"9","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\ProductList.js":"10","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Details.js":"11","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Login.js":"12","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\Cart.js":"13","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Button.js":"14","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Title.js":"15","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Product.js":"16","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\CartList.js":"17","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\CartColumns.js":"18","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\EmptyCart.js":"19","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\CartTotals.js":"20","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\CartItem.js":"21","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\PayPalButton.js":"22","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\useForm.js":"23","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\userContext.js":"24","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\ConfirmBox.js":"25","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Signup.js":"26","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Dashboard.js":"27","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\listItems.js":"28","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Title.js":"29","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Order.js":"30","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\ProductModal.js":"31","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\OrderModal.js":"32","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\OrderDetails.js":"33","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\ListOrder.js":"34","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Account.js":"35","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Contact.js":"36","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Homepage.js":"37","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Carousel.js":"38","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\FooterArea.js":"39"},{"size":888,"mtime":1610030939340,"results":"40","hashOfConfig":"41"},{"size":5083,"mtime":1608437234291,"results":"42","hashOfConfig":"41"},{"size":1810,"mtime":1610339696675,"results":"43","hashOfConfig":"41"},{"size":11495,"mtime":1610441738262,"results":"44","hashOfConfig":"41"},{"size":1935,"mtime":1610298374228,"results":"45","hashOfConfig":"41"},{"size":6568,"mtime":1610303136319,"results":"46","hashOfConfig":"41"},{"size":7037,"mtime":1610352023844,"results":"47","hashOfConfig":"41"},{"size":634,"mtime":1610039887821,"results":"48","hashOfConfig":"41"},{"size":4360,"mtime":1610257956595,"results":"49","hashOfConfig":"41"},{"size":865,"mtime":1610370995977,"results":"50","hashOfConfig":"41"},{"size":2681,"mtime":1610025368144,"results":"51","hashOfConfig":"41"},{"size":6928,"mtime":1610557145322,"results":"52","hashOfConfig":"41"},{"size":1707,"mtime":1610557513493,"results":"53","hashOfConfig":"41"},{"size":1158,"mtime":1610426425475,"results":"54","hashOfConfig":"41"},{"size":361,"mtime":1608437234280,"results":"55","hashOfConfig":"41"},{"size":4120,"mtime":1610371330458,"results":"56","hashOfConfig":"41"},{"size":433,"mtime":1609901135536,"results":"57","hashOfConfig":"41"},{"size":1059,"mtime":1609779390059,"results":"58","hashOfConfig":"41"},{"size":666,"mtime":1609779305875,"results":"59","hashOfConfig":"41"},{"size":5302,"mtime":1610302795427,"results":"60","hashOfConfig":"41"},{"size":2065,"mtime":1609947346948,"results":"61","hashOfConfig":"41"},{"size":2566,"mtime":1608437234273,"results":"62","hashOfConfig":"41"},{"size":769,"mtime":1610011027335,"results":"63","hashOfConfig":"41"},{"size":7629,"mtime":1610304712711,"results":"64","hashOfConfig":"41"},{"size":2110,"mtime":1610084856845,"results":"65","hashOfConfig":"41"},{"size":10355,"mtime":1610557126485,"results":"66","hashOfConfig":"41"},{"size":5147,"mtime":1610557261084,"results":"67","hashOfConfig":"41"},{"size":2472,"mtime":1610337926234,"results":"68","hashOfConfig":"41"},{"size":356,"mtime":1610102825744,"results":"69","hashOfConfig":"41"},{"size":2517,"mtime":1610356781935,"results":"70","hashOfConfig":"41"},{"size":2699,"mtime":1610167447780,"results":"71","hashOfConfig":"41"},{"size":3718,"mtime":1610291978691,"results":"72","hashOfConfig":"41"},{"size":2817,"mtime":1610302364110,"results":"73","hashOfConfig":"41"},{"size":3808,"mtime":1610512438691,"results":"74","hashOfConfig":"41"},{"size":9760,"mtime":1610377694580,"results":"75","hashOfConfig":"41"},{"size":10191,"mtime":1610512433507,"results":"76","hashOfConfig":"41"},{"size":780,"mtime":1610558113334,"results":"77","hashOfConfig":"41"},{"size":541,"mtime":1610442959702,"results":"78","hashOfConfig":"41"},{"size":3851,"mtime":1610556146573,"results":"79","hashOfConfig":"41"},{"filePath":"80","messages":"81","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},"1r3nt6t",{"filePath":"83","messages":"84","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"85","messages":"86","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"87","usedDeprecatedRules":"82"},{"filePath":"88","messages":"89","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"90","usedDeprecatedRules":"82"},{"filePath":"91","messages":"92","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"93","messages":"94","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"95","messages":"96","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"97","messages":"98","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"99","usedDeprecatedRules":"82"},{"filePath":"100","messages":"101","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"102","usedDeprecatedRules":"82"},{"filePath":"103","messages":"104","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":"105","usedDeprecatedRules":"82"},{"filePath":"106","messages":"107","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"108","usedDeprecatedRules":"82"},{"filePath":"109","messages":"110","errorCount":0,"warningCount":11,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"111","messages":"112","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"113","messages":"114","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"115","messages":"116","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"117","messages":"118","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"119","usedDeprecatedRules":"82"},{"filePath":"120","messages":"121","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"122","messages":"123","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"124","messages":"125","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"126","messages":"127","errorCount":0,"warningCount":8,"fixableErrorCount":0,"fixableWarningCount":0,"source":"128","usedDeprecatedRules":"82"},{"filePath":"129","messages":"130","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"131","messages":"132","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"133","messages":"134","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"135","usedDeprecatedRules":"82"},{"filePath":"136","messages":"137","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"138","usedDeprecatedRules":"82"},{"filePath":"139","messages":"140","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"141","usedDeprecatedRules":"82"},{"filePath":"142","messages":"143","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"144","messages":"145","errorCount":0,"warningCount":14,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"146","messages":"147","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"148","usedDeprecatedRules":"82"},{"filePath":"149","messages":"150","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"151","messages":"152","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"153","usedDeprecatedRules":"82"},{"filePath":"154","messages":"155","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"156","usedDeprecatedRules":"82"},{"filePath":"157","messages":"158","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"159","usedDeprecatedRules":"82"},{"filePath":"160","messages":"161","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"162","usedDeprecatedRules":"82"},{"filePath":"163","messages":"164","errorCount":0,"warningCount":25,"fixableErrorCount":0,"fixableWarningCount":0,"source":"165","usedDeprecatedRules":"82"},{"filePath":"166","messages":"167","errorCount":0,"warningCount":8,"fixableErrorCount":0,"fixableWarningCount":0,"source":"168","usedDeprecatedRules":"82"},{"filePath":"169","messages":"170","errorCount":0,"warningCount":11,"fixableErrorCount":0,"fixableWarningCount":0,"source":"171","usedDeprecatedRules":"82"},{"filePath":"172","messages":"173","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"174","messages":"175","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},{"filePath":"176","messages":"177","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"82"},"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\index.js",[],["178","179"],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\serviceWorker.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\App.js",["180"],"import React, { Component } from \"react\";\r\nimport \"./App.css\";\r\nimport \"bootstrap/dist/css/bootstrap.min.css\";\r\nimport { Route, Switch, Redirect } from \"react-router-dom\";\r\nimport Navbar from \"./components/Navbar\";\r\nimport Homepage from \"./components/Homepage\";\r\nimport Details from \"./components/Details\";\r\nimport Default from \"./components/Default\";\r\nimport Cart from \"./components/Cart\";\r\nimport SignIn from \"./components/User/Login\";\r\nimport SignUp from \"./components/User/Signup\";\r\nimport Dashboard from \"./components/User/Dashboard\";\r\nimport Orders from \"./components/User/OrderDetails\";\r\nimport ProductModal from \"./components/ProductModal\";\r\nimport OrderModal from \"./components/User/OrderModal\";\r\nimport { UserConsumer } from \"./userContext\";\r\nclass App extends Component {\r\n render() {\r\n return (\r\n <UserConsumer>\r\n {(value) => {\r\n return (\r\n <React.Fragment>\r\n <Navbar />\r\n <Switch>\r\n <Route exact path=\"/\" component={Homepage} />\r\n <Route path=\"/details\" component={Details} />\r\n <Route path=\"/cart\" component={Cart} />\r\n <Route path=\"/login\">\r\n {value.loggedIn ? <Redirect to=\"/cart\" /> : <SignIn />}\r\n </Route>\r\n <Route path=\"/signup\">\r\n {value.loggedIn ? <Redirect to=\"/cart\" /> : <SignUp />}\r\n </Route>\r\n <Route path=\"/dashboard\">\r\n {value.loggedIn ? <Dashboard /> : <Homepage />}\r\n </Route>\r\n <Route component={Default} />\r\n </Switch>\r\n <ProductModal />\r\n <OrderModal />\r\n </React.Fragment>\r\n );\r\n }}\r\n </UserConsumer>\r\n );\r\n }\r\n}\r\n\r\nexport default App;\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\productContext.js",["181","182"],"import React, { Component } from \"react\";\r\nimport { detailProduct } from \"./data\";\r\nimport axios from \"axios\";\r\nimport {\r\n getProductsFromDB,\r\n getOrdersFromDB,\r\n postOrderToDB,\r\n postOrderDetailToDB,\r\n} from \"./api\";\r\nimport { autoGenerateOrder, autoGenerateOrderDetail } from \"./helpers\";\r\nconst ProductContext = React.createContext();\r\n\r\nlet storeProducts = [];\r\n\r\nconst getProducts = async () => {\r\n await getProductsFromDB(storeProducts);\r\n storeProducts.forEach((product) => {\r\n product = {\r\n ...product,\r\n };\r\n });\r\n // console.log(\"after get\", storeProducts);\r\n};\r\n\r\nclass ProductProvider extends Component {\r\n state = {\r\n products: [],\r\n detailProduct: detailProduct,\r\n cart: [],\r\n modalOpen: false,\r\n modalProduct: detailProduct,\r\n cartSubTotal: 0,\r\n cartTax: 0,\r\n cartTotal: 0,\r\n };\r\n async componentDidMount() {\r\n if (JSON.parse(window.localStorage.getItem(\"products\")) === null) {\r\n window.localStorage.setItem(\"products\", JSON.stringify([]));\r\n }\r\n if (JSON.parse(window.localStorage.getItem(\"cart\")) === null) {\r\n window.localStorage.setItem(\"cart\", JSON.stringify([]));\r\n }\r\n if (JSON.parse(window.localStorage.getItem(\"detailProduct\")) === null) {\r\n window.localStorage.setItem(\"detailProduct\", JSON.stringify([]));\r\n }\r\n if (JSON.parse(window.localStorage.getItem(\"cartSubTotal\")) === null) {\r\n window.localStorage.setItem(\"cartSubTotal\", JSON.stringify(0));\r\n }\r\n if (JSON.parse(window.localStorage.getItem(\"cartTax\")) === null) {\r\n window.localStorage.setItem(\"cartTax\", JSON.stringify(0));\r\n }\r\n if (JSON.parse(window.localStorage.getItem(\"cartTotal\")) === null) {\r\n window.localStorage.setItem(\"cartTotal\", JSON.stringify(0));\r\n }\r\n this.state.products = JSON.parse(window.localStorage.getItem(\"products\"));\r\n this.state.cart = JSON.parse(window.localStorage.getItem(\"cart\"));\r\n this.state.detailProduct = JSON.parse(\r\n window.localStorage.getItem(\"detailProduct\")\r\n );\r\n this.state.cartSubTotal = JSON.parse(\r\n window.localStorage.getItem(\"cartSubTotal\")\r\n );\r\n this.state.cartTax = JSON.parse(window.localStorage.getItem(\"cartTax\"));\r\n this.state.cartTotal = JSON.parse(window.localStorage.getItem(\"cartTotal\"));\r\n try {\r\n await getProducts();\r\n this.setProducts();\r\n } catch (error) {\r\n alert(\"error fetching product data\");\r\n }\r\n }\r\n\r\n setProducts = async () => {\r\n let productsToShow = [];\r\n //await getProductsFromDB(productsFromDB);\r\n storeProducts.forEach((item, index) => {\r\n const random = 0 + Math.floor(Math.random() * 25);\r\n item.moTa =\r\n \"Đi cùng với mức giá này, là thiết kế độc đáo, không lẫn vào đâu được. Tuy nhiên với những đặc điểm khác như camera, màn hình, công nghệ 5G hay cấu hình này, điện thoại này cũng sẽ đem lại những trải nghiệm tốt cho người dùng điện thoại phân khúc tầm trung.\";\r\n const product = item;\r\n const singleItem = {\r\n //...item,\r\n id: product.id,\r\n title: product.tenMh,\r\n img: product.hinhAnh,\r\n price: product.donGia,\r\n company: product.maNccNavigation.tenNcc,\r\n inCart: false,\r\n count: 0,\r\n total: 0,\r\n info: product.moTa,\r\n discount: random,\r\n };\r\n productsToShow = [...productsToShow, singleItem];\r\n });\r\n if (JSON.parse(window.localStorage.getItem(\"products\")).length === 0) {\r\n console.log(\"local set\");\r\n window.localStorage.setItem(\"products\", JSON.stringify(productsToShow));\r\n }\r\n this.setState(() => {\r\n return { products: JSON.parse(window.localStorage.getItem(\"products\")) };\r\n }, this.checkCartItems);\r\n console.log(\"products \", this.state.products);\r\n };\r\n\r\n getItem = (id) => {\r\n const product = this.state.products.find((item) => item.id === id);\r\n return product;\r\n };\r\n handleDetail = (id) => {\r\n const product = this.getItem(id);\r\n window.localStorage.setItem(\"detailProduct\", JSON.stringify(product));\r\n this.setState(() => {\r\n return {\r\n detailProduct: JSON.parse(window.localStorage.getItem(\"detailProduct\")),\r\n };\r\n });\r\n };\r\n addToCart = (id) => {\r\n let tempProducts = [...this.state.products];\r\n const index = tempProducts.indexOf(this.getItem(id));\r\n const product = tempProducts[index];\r\n console.log(\"add product \", product);\r\n product.inCart = true;\r\n product.count = 1;\r\n const price = product.price;\r\n product.total = price;\r\n\r\n window.localStorage.setItem(\"products\", JSON.stringify([...tempProducts]));\r\n window.localStorage.setItem(\r\n \"cart\",\r\n JSON.stringify([...this.state.cart, product])\r\n );\r\n window.localStorage.setItem(\r\n \"detailProduct\",\r\n JSON.stringify({ ...product })\r\n );\r\n\r\n this.setState(() => {\r\n //const currentCart = [...this.state.cart, product];\r\n //window.localStorage.setItem('cart',JSON.stringify(currentCart));\r\n return {\r\n products: JSON.parse(window.localStorage.getItem(\"products\")),\r\n cart: JSON.parse(window.localStorage.getItem(\"cart\")),\r\n detailProduct: JSON.parse(window.localStorage.getItem(\"detailProduct\")),\r\n };\r\n }, this.addTotals);\r\n //console.log(this.state.detailProduct)\r\n };\r\n openModal = (id) => {\r\n const product = this.getItem(id);\r\n this.setState(() => {\r\n return { modalProduct: product, modalOpen: true };\r\n });\r\n };\r\n closeModal = () => {\r\n this.setState(() => {\r\n return { modalOpen: false };\r\n });\r\n };\r\n increment = (id) => {\r\n let tempCart = [...this.state.cart];\r\n console.log(\"items add\", tempCart);\r\n const selectedProduct = tempCart.find((item) => {\r\n return item.id === id;\r\n });\r\n const index = tempCart.indexOf(selectedProduct);\r\n const product = tempCart[index];\r\n product.count = product.count + 1;\r\n product.total = product.count * product.price;\r\n window.localStorage.setItem(\"cart\", JSON.stringify([...tempCart]));\r\n this.setState(() => {\r\n return {\r\n cart: JSON.parse(window.localStorage.getItem(\"cart\")),\r\n };\r\n }, this.addTotals);\r\n };\r\n decrement = (id) => {\r\n let tempCart = [...this.state.cart];\r\n const selectedProduct = tempCart.find((item) => {\r\n return item.id === id;\r\n });\r\n const index = tempCart.indexOf(selectedProduct);\r\n const product = tempCart[index];\r\n product.count = product.count - 1;\r\n if (product.count === 0) {\r\n this.removeItem(id);\r\n } else {\r\n product.total = product.count * product.price;\r\n window.localStorage.setItem(\"cart\", JSON.stringify([...tempCart]));\r\n this.setState(() => {\r\n return { cart: JSON.parse(window.localStorage.getItem(\"cart\")) };\r\n }, this.addTotals);\r\n }\r\n };\r\n getTotals = () => {\r\n // const subTotal = this.state.cart\r\n // .map(item => item.total)\r\n // .reduce((acc, curr) => {\r\n // acc = acc + curr;\r\n // return acc;\r\n // }, 0);\r\n let subTotal = 0;\r\n this.state.cart.map((item) => (subTotal += item.total));\r\n const tempTax = subTotal * 0.05;\r\n const tax = parseFloat(tempTax.toFixed(2));\r\n const total = subTotal + tax;\r\n return {\r\n subTotal,\r\n tax,\r\n total,\r\n };\r\n };\r\n addTotals = () => {\r\n const totals = this.getTotals();\r\n window.localStorage.setItem(\r\n \"cartSubTotal\",\r\n JSON.stringify(totals.subTotal)\r\n );\r\n window.localStorage.setItem(\"cartTax\", JSON.stringify(totals.tax));\r\n window.localStorage.setItem(\"cartTotal\", JSON.stringify(totals.total));\r\n this.setState(\r\n () => {\r\n return {\r\n cartSubTotal: JSON.parse(window.localStorage.getItem(\"cartSubTotal\")),\r\n cartTax: JSON.parse(window.localStorage.getItem(\"cartTax\")),\r\n cartTotal: JSON.parse(window.localStorage.getItem(\"cartTotal\")),\r\n };\r\n },\r\n () => {\r\n // console.log(this.state);\r\n }\r\n );\r\n };\r\n removeItem = (id) => {\r\n let tempProducts = [...this.state.products];\r\n let tempCart = [...this.state.cart];\r\n\r\n const index = tempProducts.indexOf(this.getItem(id));\r\n let removedProduct = tempProducts[index];\r\n removedProduct.inCart = false;\r\n removedProduct.count = 0;\r\n removedProduct.total = 0;\r\n\r\n tempCart = tempCart.filter((item) => {\r\n return item.id !== id;\r\n });\r\n\r\n window.localStorage.setItem(\"products\", JSON.stringify([...tempProducts]));\r\n window.localStorage.setItem(\"cart\", JSON.stringify([...tempCart]));\r\n\r\n this.setState(() => {\r\n return {\r\n cart: JSON.parse(window.localStorage.getItem(\"cart\")),\r\n products: JSON.parse(window.localStorage.getItem(\"products\")),\r\n };\r\n }, this.addTotals);\r\n };\r\n resetProducts = () => {\r\n this.state.products.forEach((product) => {\r\n product.inCart = false;\r\n product.count = 0;\r\n product.total = 0;\r\n });\r\n window.localStorage.setItem(\r\n \"products\",\r\n JSON.stringify([...this.state.products])\r\n );\r\n };\r\n clearCart = () => {\r\n this.resetProducts();\r\n window.localStorage.setItem(\"cart\", JSON.stringify([]));\r\n this.setState(\r\n () => {\r\n return { cart: JSON.parse(window.localStorage.getItem(\"cart\")) };\r\n },\r\n () => {\r\n this.resetProducts();\r\n console.log(\"products reset: \", this.state.products);\r\n //this.setProducts();\r\n this.addTotals();\r\n }\r\n );\r\n };\r\n\r\n orderCart = async (address) => {\r\n let newIdOrder;\r\n await autoGenerateOrder().then((result) => (newIdOrder = result));\r\n let userId = JSON.parse(window.localStorage.getItem(\"user\")).id;\r\n const order = {\r\n id: newIdOrder,\r\n maKH: userId,\r\n ngayDat: new Date().toLocaleString(),\r\n thanhTien: this.state.cartTotal,\r\n trangThai: 0,\r\n isDeleted: false,\r\n diaChiNhan: address,\r\n // maKhNavigation: null,\r\n // ctPhieudathangs: [],\r\n // hoadons: [],\r\n };\r\n console.log(\"get order \", order);\r\n await postOrderToDB(order);\r\n let newIdOrderdetail;\r\n await autoGenerateOrderDetail().then(\r\n (result) => (newIdOrderdetail = result)\r\n );\r\n this.state.cart.forEach(async (product, index) => {\r\n const orderDetail = {\r\n id: \"CTPDH\" + (parseInt(newIdOrderdetail) + index).toString(),\r\n maPhieuDh: newIdOrder,\r\n maMh: product.id,\r\n sldat: product.count,\r\n donGia: product.price,\r\n tongTien: product.total,\r\n isDeleted: false,\r\n //maMhNavigation: null,\r\n //maPhieuDhNavigation: null,\r\n };\r\n console.log(\"detail : \", orderDetail);\r\n await postOrderDetailToDB(orderDetail);\r\n });\r\n await this.clearCart();\r\n };\r\n render() {\r\n return (\r\n <ProductContext.Provider\r\n value={{\r\n ...this.state,\r\n handleDetail: this.handleDetail,\r\n addToCart: this.addToCart,\r\n openModal: this.openModal,\r\n closeModal: this.closeModal,\r\n increment: this.increment,\r\n decrement: this.decrement,\r\n removeItem: this.removeItem,\r\n clearCart: this.clearCart,\r\n orderCart: this.orderCart,\r\n }}\r\n >\r\n {this.props.children}\r\n </ProductContext.Provider>\r\n );\r\n }\r\n}\r\n\r\nconst ProductConsumer = ProductContext.Consumer;\r\n\r\nexport { ProductProvider, ProductConsumer };\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\helpers.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\api.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\data.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Default.js",["183"],"import React from \"react\";\r\nimport { ButtonContainer } from \"./Button\";\r\n\r\nexport default function Default(props) {\r\n console.log(props);\r\n\r\n return (\r\n <div className=\"container\">\r\n <div className=\"row\">\r\n <div className=\"col-10 mx-auto text-center text-title text-uppercase pt-5\">\r\n <h1 className=\"display-5\">Something is wrong</h1>\r\n <h3>\r\n the URL{\" \"}\r\n <span className=\"text-danger\">\"{props.location.pathname}\"</span> was\r\n not found\r\n </h3>\r\n <img src=\"route-notfound.png\" alt=\"Let go\" />\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Navbar.js",["184"],"import React, { Component, useRef } from \"react\";\r\nimport { Link } from \"react-router-dom\";\r\nimport styled from \"styled-components\";\r\nimport logo from \"../logo.png\";\r\nimport { ButtonContainer } from \"./Button\";\r\nimport { UserConsumer } from \"../userContext\";\r\nimport { useToasts } from \"react-toast-notifications\";\r\nimport ConfirmDialog from \"./ConfirmBox\";\r\nexport default function Navbar() {\r\n // render() {\r\n const { addToast } = useToasts();\r\n const childRefLog = useRef();\r\n return (\r\n <UserConsumer>\r\n {(value) => {\r\n //console.log(\"log in \", value.loggedIn);\r\n const logOut = () => {\r\n value.logOut();\r\n };\r\n return (\r\n <Nav className=\"navbar navbar-expand-sm navbar-dark linear-gradient px-sm-5\">\r\n <Link to=\"/\">\r\n <img\r\n height={45}\r\n src={logo}\r\n alt=\"store\"\r\n className=\"navbar-brand\"\r\n />\r\n </Link>\r\n <ul className=\"navbar-nav align-items-center\">\r\n <li className=\"nav-item ml-5\">\r\n <Link to=\"/\" className=\"nav-link\">\r\n <span>\r\n <i className=\"fas fa-home\" />\r\n </span>\r\n <span> </span>\r\n Trang chủ\r\n </Link>\r\n </li>\r\n {value.loggedIn === true ? (\r\n <li className=\"nav-item ml-5\">\r\n <Link to=\"/dashboard\" className=\"nav-link\">\r\n <span>\r\n <i className=\"fas fa-user\" />\r\n </span>\r\n <span> </span>\r\n Người dùng\r\n </Link>\r\n </li>\r\n ) : null}\r\n </ul>\r\n <Link to=\"/cart\" className=\"ml-auto\">\r\n <ButtonContainer cart>\r\n <span className=\"mr-2\">\r\n <i className=\"fas fa-cart-plus \" />\r\n </span>\r\n Giỏ hàng\r\n </ButtonContainer>\r\n </Link>\r\n <ul className=\"navbar-nav align-items-center\">\r\n <li className=\"nav-item ml-5\">\r\n {value.loggedIn !== true ? (\r\n <Link to=\"/login\" className=\"ml-auto\">\r\n <ButtonContainer login>\r\n <span className=\"mr-2\">\r\n <i className=\"fas fa-key\" />\r\n </span>\r\n Đăng nhập\r\n </ButtonContainer>\r\n </Link>\r\n ) : (\r\n <div className=\"ml-auto\">\r\n <ButtonContainer\r\n login\r\n onClick={() => childRefLog.current.handleClickOpen()}\r\n >\r\n <span className=\"mr-2\">\r\n <i className=\"fas fa-sign-out-alt\" />\r\n </span>\r\n Đăng xuất\r\n </ButtonContainer>\r\n <ConfirmDialog\r\n ref={childRefLog}\r\n action={() => logOut()}\r\n title={\"Đăng xuất\"}\r\n addToast={() => {\r\n addToast(`Đăng xuất khỏi Master Sales thành công`, {\r\n appearance: \"success\",\r\n });\r\n }}\r\n />\r\n </div>\r\n )}\r\n </li>\r\n </ul>\r\n </Nav>\r\n );\r\n }}\r\n </UserConsumer>\r\n );\r\n // }\r\n}\r\n\r\nconst Nav = styled.nav`\r\n background: var(--mainBlue);\r\n .nav-link {\r\n color: var(--mainWhite) !important;\r\n font-size:1.3rem;\r\n text-transform:capitalize;\r\n }\r\n @media (max-width: 576px) {\r\n .navbar-nav {\r\n flex-direction: row !important;\r\n`;\r\n\r\n// const ButtonContainer = styled.button`\r\n// text-transform: capitalize;\r\n// font - size: 1.4rem;\r\n// background: transparent;\r\n// border: 0.05rem solid var(--lightBlue);\r\n// border - radius: 0.5rem;\r\n// padding: 0.2rem 0.5rem;\r\n// outline - color: red;\r\n// cursor: pointer;\r\n// display: inline - block;\r\n// margin: 0.2rem 0.5rem 0.2rem 0;\r\n// transition: all 0.5s ease -in -out;\r\n// &: hover {\r\n// background: var(--lightBlue);\r\n// color: var(--mainBlue);\r\n// }\r\n// `;\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\ProductList.js",["185","186","187","188","189"],"import React, { Component, useState } from \"react\";\r\nimport Product from \"./Product\";\r\nimport Title from \"./Title\";\r\nimport { storeProducts } from \"../data\";\r\nimport styled from \"styled-components\";\r\nimport { ProductConsumer } from \"../productContext\";\r\nexport default function ProductList() {\r\n const [filter,setFiler] = useState(\"\");\r\n return (\r\n <React.Fragment>\r\n <Title name=\"Hot\" title=\"sales\" />\r\n <div className=\"row\">\r\n {/* { console.log('product list')} */}\r\n <ProductConsumer>\r\n {(value) => {\r\n console.log(\"product list inside\");\r\n return value.products.map((product) => {\r\n return <Product key={product.id} product={product} />;\r\n });\r\n }}\r\n </ProductConsumer>\r\n </div>\r\n </React.Fragment>\r\n )\r\n}\r\n\r\nconst ProductWrapper = styled.section``;\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Details.js",["190"],"import React, { Component } from \"react\";\r\nimport { ProductConsumer } from \"../productContext\";\r\nimport { ButtonContainer } from \"./Button\";\r\nimport { Link } from \"react-router-dom\";\r\nimport { useToasts } from \"react-toast-notifications\";\r\nexport default function Details() {\r\n // render() {\r\n const { addToast } = useToasts();\r\n\r\n return (\r\n <ProductConsumer>\r\n {(value) => {\r\n const {\r\n id,\r\n company,\r\n img,\r\n info,\r\n price,\r\n title,\r\n inCart,\r\n } = value.detailProduct;\r\n\r\n return (\r\n <div className=\"container py-5\">\r\n {/* title */}\r\n <div className=\"row\">\r\n <div className=\"col-10 mx-auto text-center text-slanted text-blue my-5\">\r\n <h1>{title}</h1>\r\n </div>\r\n </div>\r\n {/* end of title */}\r\n <div className=\"row\">\r\n <div className=\"col-10 mx-auto col-md-6 my-3\">\r\n <img src={img} className=\"img-fluid\" alt=\"\" />\r\n </div>\r\n {/* product info */}\r\n <div className=\"col-10 mx-auto col-md-6 my-3 text-capitalize\">\r\n {/* <h1>{title}</h1> */}\r\n <h4 className=\"text-uppercase text-muted mt-3 mb-2\">\r\n <span className=\"text-uppercase\">{company}</span>\r\n </h4>\r\n <h4 className=\"text-title text-blue\">\r\n <strong>\r\n Giá: {price}\r\n <span> VND</span>\r\n </strong>\r\n </h4>\r\n <p className=\"text-capitalize font-weight-bold mt-3 mb-0\">\r\n Thông tin sản phẩm\r\n </p>\r\n <p className=\"text-muted lead\">{info}</p>\r\n {/* buttons */}\r\n <div>\r\n <Link to=\"/\">\r\n <ButtonContainer>Trở về</ButtonContainer>\r\n </Link>\r\n <ButtonContainer\r\n cart\r\n disabled={inCart ? true : false}\r\n onClick={() => {\r\n value.addToCart(id);\r\n value.openModal(id);\r\n addToast(`Thêm vào giỏ hàng ${title} thành công`, {\r\n appearance: \"success\",\r\n });\r\n }}\r\n >\r\n {inCart ? \"Đã thêm\" : \"Thêm vào giỏ hàng\"}\r\n </ButtonContainer>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n }}\r\n </ProductConsumer>\r\n );\r\n // }\r\n}\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Login.js",["191","192","193","194","195","196","197","198","199","200","201"],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\Cart.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Button.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Title.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Product.js",["202"],"import React, { Component } from \"react\";\r\nimport styled from \"styled-components\";\r\nimport { Link } from \"react-router-dom\";\r\nimport { ProductConsumer } from \"../productContext\";\r\n\r\nimport { useToasts } from \"react-toast-notifications\";\r\nexport default function Product(props) {\r\n // render() {\r\n const { id, title, img, price, inCart, discount } = props.product;\r\n const { addToast } = useToasts();\r\n return (\r\n <ProductWrapper className=\"col-9 mx-auto col-md-6 col-lg-3 my-3\">\r\n <div className=\"card\">\r\n <ProductConsumer>\r\n {(value) => {\r\n return (\r\n <div\r\n className=\"img-container p-5\"\r\n onClick={() => value.handleDetail(id)}\r\n >\r\n <Link to=\"/details\">\r\n <img src={img} alt=\"\" className=\"card-img-top\" />\r\n </Link>\r\n <button\r\n className=\"cart-btn\"\r\n disabled={inCart ? true : false}\r\n onClick={() => {\r\n console.log(\"you click\");\r\n value.addToCart(id);\r\n value.openModal(id);\r\n addToast(`Thêm vào giỏ hàng ${title} thành công`, {\r\n appearance: \"success\",\r\n });\r\n }}\r\n >\r\n {inCart ? (\r\n <p className=\"text-capitalize mb-0\" disabled>\r\n đã thêm\r\n </p>\r\n ) : (\r\n <i className=\"fas fa-cart-plus\" />\r\n )}\r\n </button>\r\n </div>\r\n );\r\n }}\r\n </ProductConsumer>\r\n <div className=\"card-footer d-flex justify-content-between\">\r\n <p className=\"align-self-center mb-0\">{title}</p>\r\n {/* {discount > 0 && discount < 5 ? (\r\n <p className=\"text-yellow bg-dark rounded p-1\">NEW</p>\r\n ) : discount > 20 ? (\r\n <p className=\"text-yellow bg-dark rounded p-1\">HOT</p>\r\n ) : null} */}\r\n </div>\r\n <div className=\"card-footer d-flex justify-content-between\">\r\n <h5 className=\"text-red font-italic mb-0\">\r\n {Number(price.toFixed(0)).toLocaleString()}\r\n <span className=\"mr-1\">đ</span>\r\n </h5>\r\n {discount !== 0 ? (\r\n <h6 className=\"text-lightdark font-italic mb-0 text-tiny\">\r\n <del>\r\n {Number(\r\n Math.floor(price / (100 - discount)) * 100\r\n ).toLocaleString()}\r\n <span className=\"mr-1\">đ</span>\r\n </del>\r\n </h6>\r\n ) : null}\r\n {discount > 5 ? (\r\n <h6 className=\"text-white bg-danger rounded-circle p-1 mb-0\">\r\n -{discount}\r\n <span className=\"mr-1\">%</span>\r\n </h6>\r\n ) : null}\r\n </div>\r\n </div>\r\n </ProductWrapper>\r\n );\r\n // }\r\n}\r\n\r\nconst ProductWrapper = styled.div`\r\n .card {\r\n border-color: transparent;\r\n transition: all 1s linear;\r\n }\r\n .card-footer {\r\n background: transparent;\r\n border-top: transparent;\r\n transition: all 1s linear;\r\n }\r\n &:hover {\r\n .card {\r\n border: 0.04rem solid rgba(0, 0, 0, 0.2);\r\n box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 0.2);\r\n }\r\n .card-footer {\r\n background: rgba(247, 247, 247);\r\n }\r\n }\r\n .img-container {\r\n position: relative;\r\n overflow: hidden;\r\n }\r\n .card-img-top {\r\n transition: all 1s linear;\r\n }\r\n .img-container:hover .card-img-top {\r\n transform: scale(1.2);\r\n }\r\n .cart-btn {\r\n position: absolute;\r\n bottom: 0;\r\n right: 0;\r\n padding: 0.2rem 0.4rem;\r\n background: var(--lightBlue);\r\n border: none;\r\n color: var(--mainWhite);\r\n font-size: 1.4rem;\r\n border-radius: 0.5rem 0 0 0;\r\n transform: translate(100%, 100%);\r\n transition: all 1s ease-in-out;\r\n }\r\n .img-container:hover .cart-btn {\r\n transform: translate(0, 0);\r\n }\r\n .cart-btn:hover {\r\n color: var(--mainBlue);\r\n cursor: pointer;\r\n }\r\n`;\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\CartList.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\CartColumns.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\EmptyCart.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\CartTotals.js",["203","204","205","206","207","208","209","210"],"import React, { Component, useState, useRef } from \"react\";\r\nimport PayPalButton from \"./PayPalButton\";\r\nimport { Link } from \"react-router-dom\";\r\nimport { useToasts } from \"react-toast-notifications\";\r\nimport ConfirmDialog from \"../ConfirmBox\";\r\nimport TextField from \"@material-ui/core/TextField\";\r\nimport { UserConsumer } from \"../../userContext\";\r\nimport useForm from \"../../useForm\";\r\n\r\n// const childRef = React.createRef();\r\n\r\nexport default function CartTotals(props) {\r\n // render() {\r\n const {\r\n cartSubTotal,\r\n cartTax,\r\n cartTotal,\r\n cart,\r\n clearCart,\r\n orderCart,\r\n } = props.valueProduct;\r\n const valueUser = props.valueUser;\r\n const { history } = props;\r\n const emptyCart = cart.length === 0 ? true : false;\r\n const childRefClear = useRef();\r\n const childRefOrder = useRef();\r\n const { addToast } = useToasts();\r\n\r\n const shop = () => {\r\n // dat hang o day\r\n const user = JSON.parse(window.localStorage.getItem(\"user\"));\r\n if (!(Object.keys(user).length === 0 && user.constructor === Object)) {\r\n childRefOrder.current.handleClickOpen();\r\n } else {\r\n history.push(\"/login\");\r\n }\r\n };\r\n\r\n const initialFieldValues = {\r\n address: valueUser.user.diaChi,\r\n };\r\n\r\n const validate = (fieldValues = values) => {\r\n let temp = { ...errors };\r\n if (\"address\" in fieldValues)\r\n temp.address = fieldValues.address ? \"\" : \"Hãy nhập địa chỉ\";\r\n setErrors({\r\n ...temp,\r\n });\r\n\r\n if (fieldValues == values) return Object.values(temp).every((x) => x == \"\");\r\n };\r\n\r\n const {\r\n values,\r\n setValues,\r\n errors,\r\n setErrors,\r\n handleInputChange,\r\n resetForm,\r\n } = useForm(initialFieldValues, validate);\r\n\r\n const handleSubmit = async (e) => {\r\n e.preventDefault();\r\n if (validate()) {\r\n shop();\r\n }\r\n };\r\n // const [dialogOpen, setDialogOpen] = useState(false);\r\n // const toggleDialog = () => {\r\n // setDialogOpen(!dialogOpen);\r\n // };\r\n return (\r\n <React.Fragment>\r\n {!emptyCart && (\r\n <div className=\"container\">\r\n <div className=\"row\">\r\n <div className=\"col-10 mt-2 ml-sm-5 ml-md-auto col-sm-8 text-capitalize text-right\">\r\n <Link to=\"/cart\">\r\n <button\r\n className=\"btn btn-outline-danger text-uppercase mb-3 px-5\"\r\n type=\"button\"\r\n onClick={() => {\r\n childRefClear.current.handleClickOpen();\r\n }}\r\n >\r\n Xóa toàn bộ\r\n </button>\r\n </Link>\r\n <ConfirmDialog\r\n ref={childRefClear}\r\n action={clearCart}\r\n title={\"Xóa giỏ hàng\"}\r\n addToast={() => {\r\n addToast(`Xóa toàn bộ giỏ thành công`, {\r\n appearance: \"success\",\r\n });\r\n }}\r\n />\r\n <h5>\r\n <span className=\"\"> Tạm tính :</span>{\" \"}\r\n <strong> {Number(cartSubTotal).toLocaleString()}đ </strong>\r\n </h5>\r\n <h5 className=\"\">\r\n <span className=\"\"> Phí phụ thu :</span>{\" \"}\r\n <strong> {Number(cartTax).toLocaleString()}đ </strong>\r\n </h5>\r\n <h5>\r\n <span className=\"\"> Tổng cộng :</span>{\" \"}\r\n <strong> {Number(cartTotal).toLocaleString()}đ </strong>\r\n </h5>\r\n <br />\r\n {/* <Link to=\"/cart\"> */}\r\n\r\n {/* </Link> */}\r\n <ConfirmDialog\r\n ref={childRefOrder}\r\n action={async () => {\r\n await orderCart(values.address);\r\n valueUser.setOrdersOfUser();\r\n }}\r\n title={\"Đặt hàng\"}\r\n addToast={() => {\r\n addToast(`Đặt hàng thành công`, {\r\n appearance: \"success\",\r\n });\r\n }}\r\n />\r\n {/* <PayPalButton\r\n totalAmount={cartTotal}\r\n clearCart={clearCart}\r\n history={history}\r\n /> */}\r\n </div>\r\n </div>\r\n <form\r\n // className={classes.form}\r\n noValidate\r\n onSubmit={(e) => handleSubmit(e)}\r\n >\r\n <button\r\n className=\"btn btn-outline-primary text-uppercase mb-3 px-5\"\r\n type=\"submit\"\r\n // onClick={() => shop()}\r\n >\r\n Đặt hàng\r\n </button>\r\n <TextField\r\n variant=\"outlined\"\r\n margin=\"normal\"\r\n required\r\n fullWidth\r\n id=\"address\"\r\n label=\"Địa chỉ người nhận\"\r\n name=\"address\"\r\n autoComplete=\"off\"\r\n autoFocus\r\n multiline\r\n value={values.address}\r\n onChange={handleInputChange}\r\n {...(errors.address && {\r\n error: true,\r\n helperText: errors.address,\r\n })}\r\n />\r\n </form>\r\n </div>\r\n )}\r\n </React.Fragment>\r\n );\r\n // }\r\n}\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\CartItem.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Cart\\PayPalButton.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\useForm.js",["211","212"],"import React, { useState, useEffect } from \"react\";\r\n\r\nconst useForm = (initialFieldValues, validate) => {\r\n const [values, setValues] = useState(initialFieldValues)\r\n const [errors, setErrors] = useState({})\r\n\r\n const handleInputChange = e => {\r\n const { name, value } = e.target\r\n const fieldValue = { [name]: value }\r\n setValues({\r\n ...values,\r\n ...fieldValue\r\n })\r\n validate(fieldValue)\r\n }\r\n\r\n const resetForm = () => {\r\n setValues({\r\n ...initialFieldValues\r\n })\r\n setErrors({})\r\n }\r\n\r\n return {\r\n values,\r\n setValues,\r\n errors,\r\n setErrors,\r\n handleInputChange,\r\n resetForm\r\n };\r\n}\r\n\r\nexport default useForm;","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\userContext.js",["213","214"],"import React, { Component } from \"react\";\r\nimport { detailProduct } from \"./data\";\r\nimport axios from \"axios\";\r\nimport { autoGenerateContact } from \"./helpers\";\r\nimport {\r\n getOrdersOfUserFromDB,\r\n putOrderToDB,\r\n getContactsOfUserFromDB,\r\n putContactToDB,\r\n postContactToDB,\r\n} from \"./api\";\r\nconst UserContext = React.createContext();\r\n\r\nlet ordersInUser = [];\r\nlet contactsInUser = [];\r\n\r\nconst getOrdersOfUser = async (userId) => {\r\n await getOrdersOfUserFromDB(userId, ordersInUser);\r\n ordersInUser.forEach((order) => {\r\n order = { ...order };\r\n });\r\n console.log(\"after get\", ordersInUser);\r\n};\r\n\r\nconst getContactsOfUser = async (userId) => {\r\n await getContactsOfUserFromDB(userId, contactsInUser);\r\n contactsInUser.forEach((contact) => {\r\n contact = { ...contact };\r\n });\r\n console.log(\"after get\", contactsInUser);\r\n};\r\n\r\nclass UserProvider extends Component {\r\n state = {\r\n user: null,\r\n loggedIn: false,\r\n modalOpen: false,\r\n modalOrder: {},\r\n orders: [],\r\n contacts: [],\r\n };\r\n async componentDidMount() {\r\n if (JSON.parse(window.localStorage.getItem(\"user\")) === null) {\r\n window.localStorage.setItem(\"user\", JSON.stringify({}));\r\n }\r\n if (JSON.parse(window.localStorage.getItem(\"loggedIn\")) === null) {\r\n window.localStorage.setItem(\"loggedIn\", false);\r\n }\r\n if (JSON.parse(window.localStorage.getItem(\"orders\")) === null) {\r\n window.localStorage.setItem(\"orders\", JSON.stringify([]));\r\n }\r\n if (JSON.parse(window.localStorage.getItem(\"contacts\")) === null) {\r\n window.localStorage.setItem(\"contacts\", JSON.stringify([]));\r\n }\r\n this.setState({ user: JSON.parse(window.localStorage.getItem(\"user\")) });\r\n this.setState({\r\n loggedIn: JSON.parse(window.localStorage.getItem(\"loggedIn\")),\r\n });\r\n this.state.orders = JSON.parse(window.localStorage.getItem(\"orders\"));\r\n this.state.contacts = JSON.parse(window.localStorage.getItem(\"contacts\"));\r\n\r\n try {\r\n // await getProducts();\r\n // console.log(\"abc first\");\r\n // this.setProducts();\r\n // console.log(\"abc then\");\r\n } catch (error) {\r\n alert(\"error fetching user data\");\r\n }\r\n }\r\n\r\n logIn = async (user) => {\r\n window.localStorage.setItem(\"loggedIn\", true);\r\n window.localStorage.setItem(\"user\", JSON.stringify(user));\r\n\r\n // await getOrdersOfUser(user.id);\r\n // console.log(user.id);\r\n\r\n this.setState(\r\n () => {\r\n return {\r\n user: JSON.parse(window.localStorage.getItem(\"user\")),\r\n loggedIn: JSON.parse(window.localStorage.getItem(\"loggedIn\")),\r\n };\r\n },\r\n () => {\r\n this.setOrdersOfUser();\r\n this.setContactsOfUser();\r\n },\r\n );\r\n };\r\n\r\n logOut = () => {\r\n window.localStorage.setItem(\"loggedIn\", false);\r\n window.localStorage.setItem(\"user\", JSON.stringify({}));\r\n window.localStorage.setItem(\"orders\", JSON.stringify([]));\r\n window.localStorage.setItem(\"contacts\", JSON.stringify([]));\r\n ordersInUser = [];\r\n contactsInUser = [];\r\n this.setState(() => {\r\n return {\r\n user: JSON.parse(window.localStorage.getItem(\"user\")),\r\n loggedIn: JSON.parse(window.localStorage.getItem(\"loggedIn\")),\r\n orders: JSON.parse(window.localStorage.getItem(\"orders\")),\r\n contacts: JSON.parse(window.localStorage.getItem(\"contacts\")),\r\n };\r\n });\r\n };\r\n\r\n setOrdersOfUser = async () => {\r\n ordersInUser = [];\r\n await getOrdersOfUser(this.state.user.id);\r\n console.log(\"user 1 \", this.state.user);\r\n let ordersToShow = [];\r\n //await getProductsFromDB(productsFromDB);\r\n ordersToShow.push(...ordersInUser.map((item) => item));\r\n // if (JSON.parse(window.localStorage.getItem(\"orders\")).length === 0) {\r\n window.localStorage.setItem(\"orders\", JSON.stringify(ordersToShow));\r\n console.log(\r\n \"local setorders \",\r\n JSON.parse(window.localStorage.getItem(\"orders\"))\r\n );\r\n // }\r\n this.setState(() => {\r\n return { orders: JSON.parse(window.localStorage.getItem(\"orders\")) };\r\n });\r\n console.log(\"orders \", this.state.orders);\r\n };\r\n\r\n setContactsOfUser = async () => {\r\n contactsInUser = [];\r\n await getContactsOfUser(this.state.user.id);\r\n console.log(\"user 2 \", this.state.user);\r\n let contactsToShow = [];\r\n //await getProductsFromDB(productsFromDB);\r\n contactsToShow.push(...contactsInUser.map((item) => item));\r\n // if (JSON.parse(window.localStorage.getItem(\"orders\")).length === 0) {\r\n window.localStorage.setItem(\"contacts\", JSON.stringify(contactsToShow));\r\n console.log(\r\n \"local setcontacts \",\r\n JSON.parse(window.localStorage.getItem(\"contacts\"))\r\n );\r\n // }\r\n this.setState(() => {\r\n return { contacts: JSON.parse(window.localStorage.getItem(\"contacts\")) };\r\n });\r\n console.log(\"contacts \", this.state.contacts);\r\n };\r\n\r\n deleteOrder = async (orderId) => {\r\n let orderDeleted;\r\n this.state.orders.forEach((order) => {\r\n if (order.id === orderId) {\r\n order.isDeleted = true;\r\n orderDeleted = { ...order };\r\n }\r\n });\r\n await putOrderToDB(orderId, orderDeleted);\r\n window.localStorage.setItem(\r\n \"orders\",\r\n JSON.stringify([...this.state.orders])\r\n );\r\n this.setState(() => {\r\n return { orders: JSON.parse(window.localStorage.getItem(\"orders\")) };\r\n });\r\n console.log(\"orders after delete: \", this.state.orders);\r\n };\r\n\r\n deleteContact = async (contactId) => {\r\n let contactDeleted;\r\n this.state.contacts.forEach((contact) => {\r\n if (contact.id === contactId) {\r\n contact.isDeleted = true;\r\n contactDeleted = { ...contact };\r\n }\r\n });\r\n await putContactToDB(contactId, contactDeleted);\r\n window.localStorage.setItem(\r\n \"contacts\",\r\n JSON.stringify([...this.state.contacts])\r\n );\r\n this.setState(() => {\r\n return { contacts: JSON.parse(window.localStorage.getItem(\"contacts\")) };\r\n });\r\n console.log(\"contacts after delete: \", this.state.contacts);\r\n };\r\n\r\n postContact = async (question) => {\r\n let newIdContact;\r\n await autoGenerateContact().then((result) => (newIdContact = result));\r\n let userId = JSON.parse(window.localStorage.getItem(\"user\")).id;\r\n const contact = {\r\n id: newIdContact,\r\n maKH: userId,\r\n cauHoi: question,\r\n traLoi: null,\r\n isDeleted: false,\r\n ngayDat: new Date().toLocaleString(),\r\n ngayTraLoi: null,\r\n nguoiTraLoi: null,\r\n };\r\n console.log(\"get contact \", contact);\r\n await postContactToDB(contact);\r\n };\r\n\r\n openModal = (id) => {\r\n const order = this.getItem(id);\r\n this.setState(() => {\r\n return { modalOrder: order, modalOpen: true };\r\n });\r\n };\r\n closeModal = () => {\r\n this.setState(() => {\r\n return { modalOpen: false };\r\n });\r\n };\r\n getItem = (id) => {\r\n const order = this.state.orders.find((item) => item.id === id);\r\n return order;\r\n };\r\n\r\n render() {\r\n return (\r\n <UserContext.Provider\r\n value={{\r\n ...this.state,\r\n logIn: this.logIn,\r\n setOrdersOfUser: this.setOrdersOfUser,\r\n logOut: this.logOut,\r\n deleteOrder: this.deleteOrder,\r\n openModal: this.openModal,\r\n closeModal: this.closeModal,\r\n setContactsOfUser: this.setContactsOfUser,\r\n deleteContact: this.deleteContact,\r\n postContact: this.postContact,\r\n }}\r\n >\r\n {this.props.children}\r\n </UserContext.Provider>\r\n );\r\n }\r\n}\r\n\r\nconst UserConsumer = UserContext.Consumer;\r\n\r\nexport { UserProvider, UserConsumer };\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\ConfirmBox.js",["215","216"],"import React, {\r\n useRef,\r\n useState,\r\n useEffect,\r\n useImperativeHandle,\r\n forwardRef,\r\n} from \"react\";\r\nimport Button from \"@material-ui/core/Button\";\r\nimport Dialog from \"@material-ui/core/Dialog\";\r\nimport DialogActions from \"@material-ui/core/DialogActions\";\r\nimport DialogContent from \"@material-ui/core/DialogContent\";\r\nimport DialogContentText from \"@material-ui/core/DialogContentText\";\r\nimport DialogTitle from \"@material-ui/core/DialogTitle\";\r\nimport Slide from \"@material-ui/core/Slide\";\r\n\r\nconst Transition = React.forwardRef(function Transition(props, ref) {\r\n return <Slide direction=\"up\" ref={ref} {...props} />;\r\n});\r\n\r\nconst AlertDialogSlide = forwardRef((props, ref) => {\r\n const [open, setOpen] = React.useState(false);\r\n useEffect(() => {}, [props.action, props.addToast]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n handleClickOpen() {\r\n setOpen(true);\r\n },\r\n }));\r\n\r\n const handleBack = () => {\r\n setOpen(false);\r\n };\r\n\r\n const handleSave = () => {\r\n props.action();\r\n props.addToast();\r\n setOpen(false);\r\n };\r\n\r\n return (\r\n <div>\r\n {/* <Button variant=\"outlined\" color=\"primary\" onClick={handleClickOpen}>\r\n Slide in alert dialog\r\n </Button> */}\r\n <Dialog\r\n open={open}\r\n TransitionComponent={Transition}\r\n keepMounted\r\n onClose={handleBack}\r\n aria-labelledby=\"alert-dialog-slide-title\"\r\n aria-describedby=\"alert-dialog-slide-description\"\r\n >\r\n <DialogTitle id=\"alert-dialog-slide-title\">{props.title}</DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id=\"alert-dialog-slide-description\">\r\n Bạn có chắc chắn muốn thực hiện {props.title}?\r\n </DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button onClick={handleBack} color=\"primary\">\r\n Quay lại\r\n </Button>\r\n <Button onClick={handleSave} color=\"secondary\">\r\n Đồng ý\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n </div>\r\n );\r\n});\r\n\r\nexport default AlertDialogSlide;\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Signup.js",["217","218","219","220","221","222"],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Dashboard.js",["223","224","225","226","227","228","229","230","231","232","233","234","235","236"],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\listItems.js",["237","238","239","240"],"import React from \"react\";\r\nimport ListItem from \"@material-ui/core/ListItem\";\r\nimport ListItemIcon from \"@material-ui/core/ListItemIcon\";\r\nimport ListItemText from \"@material-ui/core/ListItemText\";\r\nimport ListSubheader from \"@material-ui/core/ListSubheader\";\r\nimport DashboardIcon from \"@material-ui/icons/Dashboard\";\r\nimport ShoppingCartIcon from \"@material-ui/icons/ShoppingCart\";\r\nimport PeopleIcon from \"@material-ui/icons/People\";\r\nimport BarChartIcon from \"@material-ui/icons/BarChart\";\r\nimport LayersIcon from \"@material-ui/icons/Layers\";\r\nimport AssignmentIcon from \"@material-ui/icons/Assignment\";\r\nimport { Link } from \"react-router-dom\";\r\n\r\nexport const mainListItems = (\r\n <div>\r\n {/* <ListItem button>\r\n <ListItemIcon>\r\n <DashboardIcon />\r\n </ListItemIcon>\r\n <ListItemText primary=\"Dashboard\" />\r\n </ListItem> */}\r\n <ListItem\r\n button\r\n component={Link}\r\n to=\"/dashboard\"\r\n style={{ textDecoration: \"none\" }}\r\n >\r\n <ListItemIcon>\r\n <ShoppingCartIcon />\r\n </ListItemIcon>\r\n <ListItemText primary=\"Lịch sử mua hàng\" />\r\n </ListItem>\r\n <ListItem\r\n button\r\n component={Link}\r\n to=\"/dashboard/customer\"\r\n style={{ textDecoration: \"none\" }}\r\n >\r\n <ListItemIcon>\r\n <PeopleIcon />\r\n </ListItemIcon>\r\n <ListItemText primary=\"Tài khoản\" />\r\n </ListItem>\r\n {/* <ListItem button>\r\n <ListItemIcon>\r\n <BarChartIcon />\r\n </ListItemIcon>\r\n <ListItemText primary=\"Reports\" />\r\n </ListItem>\r\n <ListItem button>\r\n <ListItemIcon>\r\n <LayersIcon />\r\n </ListItemIcon>\r\n <ListItemText primary=\"Integrations\" />\r\n </ListItem> */}\r\n </div>\r\n);\r\n\r\nexport const secondaryListItems = (\r\n <div>\r\n {/* <ListSubheader inset>Tư vấn khách hàng</ListSubheader> */}\r\n <ListItem\r\n button\r\n component={Link}\r\n to=\"/dashboard/contact\"\r\n style={{ textDecoration: \"none\" }}\r\n >\r\n <ListItemIcon>\r\n <AssignmentIcon />\r\n </ListItemIcon>\r\n <ListItemText primary=\"Liên hệ tư vấn\" />\r\n </ListItem>\r\n {/* <ListItem button>\r\n <ListItemIcon>\r\n <AssignmentIcon />\r\n </ListItemIcon>\r\n <ListItemText primary=\"Last quarter\" />\r\n </ListItem>\r\n <ListItem button>\r\n <ListItemIcon>\r\n <AssignmentIcon />\r\n </ListItemIcon>\r\n <ListItemText primary=\"Year-end sale\" />\r\n </ListItem> */}\r\n </div>\r\n);\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Title.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Order.js",["241","242","243"],"import React, { useEffect, useRef } from \"react\";\r\nimport Link from \"@material-ui/core/Link\";\r\nimport { makeStyles } from \"@material-ui/core/styles\";\r\nimport Typography from \"@material-ui/core/Typography\";\r\nimport Title from \"./Title\";\r\nimport moment from \"moment\";\r\nimport { useToasts } from \"react-toast-notifications\";\r\nimport { DonutSmallSharp } from \"@material-ui/icons\";\r\nimport ConfirmDialog from \"../ConfirmBox\";\r\n\r\nfunction preventDefault(event) {\r\n event.preventDefault();\r\n}\r\n\r\nconst useStyles = makeStyles({\r\n orderContext: {\r\n flex: 1,\r\n },\r\n});\r\n\r\nexport default function Order(props) {\r\n const classes = useStyles();\r\n const childRefDeleteOrder = useRef();\r\n const { addToast } = useToasts();\r\n const { deleteOrder } = props.value;\r\n return (\r\n <React.Fragment>\r\n <Title>\r\n {props.order.trangThai === 0\r\n ? \"Chưa giao hàng\"\r\n : props.order.trangThai === 1\r\n ? \"Đã thanh toán\"\r\n : \"Không được duyệt\"}\r\n </Title>\r\n <Typography component=\"p\" variant=\"h4\">\r\n {Number(props.order.thanhTien).toLocaleString()}đ\r\n </Typography>\r\n <Typography color=\"textSecondary\" className={classes.orderContext}>\r\n {/* {props.order.ngayDat.slice(0,10).split('-').join('/')} */}\r\n {moment(props.order.ngayDat).format(\"DD/MM/YYYY, h:mm:ss\")}\r\n </Typography>\r\n <Typography color=\"textSecondary\" className={classes.orderContext}>\r\n {moment(props.order.ngayDat).fromNow()}\r\n </Typography>\r\n <div className=\"d-flex justify-content-between\">\r\n <Link\r\n color=\"primary\"\r\n href=\"#\"\r\n onClick={() => {\r\n props.value.openModal(props.order.id);\r\n }}\r\n >\r\n <span>\r\n <i className=\"fas fa-eye\"></i>\r\n </span>{\" \"}\r\n Xem chi tiết\r\n </Link>\r\n <Link\r\n color=\"secondary\"\r\n href=\"#\"\r\n onClick={() => childRefDeleteOrder.current.handleClickOpen()}\r\n >\r\n <span>\r\n <i className=\"fa fa-trash\" aria-hidden=\"true\"></i>\r\n </span>{\" \"}\r\n Hủy phiếu\r\n </Link>\r\n </div>\r\n <ConfirmDialog\r\n ref={childRefDeleteOrder}\r\n action={() => deleteOrder(props.order.id)}\r\n title={\"Hủy phiếu đặt hàng\"}\r\n addToast={() => {\r\n addToast(`Hủy phiếu thành công`, {\r\n appearance: \"success\",\r\n });\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\ProductModal.js",["244"],"import React, { Component } from \"react\";\r\nimport styled from \"styled-components\";\r\nimport { ProductConsumer } from \"../productContext\";\r\nimport { ButtonContainer } from \"./Button\";\r\nimport { Link } from \"react-router-dom\";\r\nimport { Button } from \"bootstrap\";\r\nexport default class ProductModal extends Component {\r\n render() {\r\n return (\r\n <ProductConsumer>\r\n {(value) => {\r\n const { modalOpen, closeModal } = value;\r\n const { img, title, price } = value.modalProduct;\r\n if (!modalOpen) {\r\n return null;\r\n } else {\r\n return (\r\n <ModalContainer>\r\n <div className=\"container\">\r\n <div className=\"row\">\r\n <div\r\n className=\"col-8 mx-auto col-md-6 col-lg-4 p-5 text-center text-capitalize\"\r\n id=\"modal\"\r\n >\r\n <h5>Sản phẩm thêm vào giỏ hàng</h5>\r\n <img src={img} className=\"img-fluid\" alt=\"\" />\r\n <h5>{title}</h5>\r\n <h5 className=\"text-muted\">\r\n Giá : {Number(price).toLocaleString()}đ\r\n </h5>\r\n <Link to=\"/\">\r\n <ButtonContainer\r\n onClick={() => {\r\n closeModal();\r\n }}\r\n >\r\n Tiếp tục Shopping\r\n </ButtonContainer>\r\n </Link>\r\n <Link to=\"/cart\">\r\n <ButtonContainer\r\n cart\r\n onClick={() => {\r\n closeModal();\r\n }}\r\n >\r\n Đến giỏ hàng\r\n </ButtonContainer>\r\n </Link>\r\n <ButtonContainer\r\n close\r\n onClick={() => {\r\n closeModal();\r\n }}\r\n >\r\n Đóng\r\n </ButtonContainer>\r\n </div>\r\n </div>\r\n </div>\r\n </ModalContainer>\r\n );\r\n }\r\n }}\r\n </ProductConsumer>\r\n );\r\n }\r\n}\r\n\r\nconst ModalContainer = styled.div`\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background: rgba(0, 0, 0, 0.3);\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n #modal {\r\n background: var(--mainWhite);\r\n }\r\n`;\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\OrderModal.js",["245","246"],"import React, { Component } from \"react\";\r\nimport styled from \"styled-components\";\r\nimport { UserConsumer } from \"../../userContext\";\r\nimport { ButtonContainer } from \"../Button\";\r\nimport { Link } from \"react-router-dom\";\r\nimport { ProductConsumer } from \"../../productContext\";\r\nimport { Button } from \"bootstrap\";\r\nimport OrderDetails from \"./OrderDetails\";\r\nexport default class OrderModal extends Component {\r\n render() {\r\n return (\r\n <ProductConsumer>\r\n {(valueProduct) => {\r\n return (\r\n <UserConsumer>\r\n {(value) => {\r\n const { modalOpen, closeModal } = value;\r\n const currentOrder = value.modalOrder;\r\n const { ctPhieudathangs, thanhTien } = value.modalOrder;\r\n const detailsToShow = ctPhieudathangs?.map((item) => {\r\n const findProduct = valueProduct.products?.find(\r\n (product) => product.id === item.maMh\r\n );\r\n return { ...item, tenMh: findProduct.title };\r\n });\r\n if (!modalOpen) {\r\n return null;\r\n } else {\r\n return (\r\n <ModalContainer>\r\n <div className=\"container\">\r\n <div className=\"row\">\r\n <div\r\n className=\"col-8 mx-auto col-md-8 col-lg-8 p-5 text-center text-capitalize\"\r\n id=\"modal\"\r\n >\r\n <OrderDetails\r\n order={currentOrder}\r\n details={detailsToShow}\r\n total={thanhTien}\r\n />\r\n {/* <h5>Sản phẩm thêm vào giỏ hàng</h5>\r\n <img src={img} className=\"img-fluid\" alt=\"\" />\r\n <h5>{title}</h5>\r\n <h5 className=\"text-muted\">\r\n Giá : {Number(price).toLocaleString()}đ\r\n </h5>\r\n <Link to=\"/\">\r\n <ButtonContainer\r\n onClick={() => {\r\n closeModal();\r\n }}\r\n >\r\n Tiếp tục Shopping\r\n </ButtonContainer>\r\n </Link>\r\n <Link to=\"/cart\">\r\n <ButtonContainer\r\n cart\r\n onClick={() => {\r\n closeModal();\r\n }}\r\n >\r\n Đến giỏ hàng\r\n </ButtonContainer>\r\n </Link> */}\r\n <ButtonContainer\r\n close\r\n onClick={() => {\r\n closeModal();\r\n }}\r\n >\r\n Đóng\r\n </ButtonContainer>\r\n </div>\r\n </div>\r\n </div>\r\n </ModalContainer>\r\n );\r\n }\r\n }}\r\n </UserConsumer>\r\n );\r\n }}\r\n </ProductConsumer>\r\n );\r\n }\r\n}\r\n\r\nconst ModalContainer = styled.div`\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background: rgba(0, 0, 0, 0.3);\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n #modal {\r\n background: var(--mainWhite);\r\n }\r\n`;\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\OrderDetails.js",["247","248","249"],"import React from \"react\";\r\nimport Link from \"@material-ui/core/Link\";\r\nimport { makeStyles } from \"@material-ui/core/styles\";\r\nimport Table from \"@material-ui/core/Table\";\r\nimport TableBody from \"@material-ui/core/TableBody\";\r\nimport TableCell from \"@material-ui/core/TableCell\";\r\nimport TableHead from \"@material-ui/core/TableHead\";\r\nimport TableRow from \"@material-ui/core/TableRow\";\r\nimport Typography from \"@material-ui/core/Typography\";\r\nimport Title from \"./Title\";\r\n\r\n// Generate Order Data\r\nfunction createData(id, date, name, shipTo, paymentMethod, amount) {\r\n return { id, date, name, shipTo, paymentMethod, amount };\r\n}\r\n\r\nfunction preventDefault(event) {\r\n event.preventDefault();\r\n}\r\n\r\nconst useStyles = makeStyles((theme) => ({\r\n seeMore: {\r\n margin: theme.spacing(3),\r\n },\r\n}));\r\n\r\nexport default function OrderDetails(props) {\r\n const classes = useStyles();\r\n const rows = props.details;\r\n const totalWithoutTax = rows\r\n ?.map((item) => item.tongTien)\r\n .reduce((acc, next) => acc + next, 0);\r\n return (\r\n <React.Fragment>\r\n <Title>Tổng tiền đơn hàng: {Number(props.total).toLocaleString()}đ</Title>\r\n <Table size=\"small\">\r\n <TableHead>\r\n <TableRow>\r\n <TableCell align=\"center\">STT</TableCell>\r\n <TableCell align=\"center\">Tên sản phẩm</TableCell>\r\n <TableCell align=\"center\">Giá bán (VND)</TableCell>\r\n <TableCell align=\"center\">Số lượng</TableCell>\r\n <TableCell align=\"center\">Tổng (VND)</TableCell>\r\n </TableRow>\r\n </TableHead>\r\n <TableBody>\r\n {rows &&\r\n rows.map((row, index) => (\r\n <TableRow key={row.id}>\r\n <TableCell align=\"center\">{index + 1}</TableCell>\r\n <TableCell align=\"center\">{row.tenMh}</TableCell>\r\n <TableCell align=\"center\">\r\n {Number(row.donGia).toLocaleString()}\r\n </TableCell>\r\n <TableCell align=\"center\">{row.sldat}</TableCell>\r\n <TableCell align=\"center\">\r\n {Number(row.tongTien).toLocaleString()}\r\n </TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <div className={classes.seeMore}>\r\n <Typography variant=\"body1\" color=\"textSecondary\" align=\"center\">\r\n Phí phụ thu: {Number(props.total - totalWithoutTax).toLocaleString()}đ\r\n </Typography>\r\n <Typography color=\"textSecondary\" className={classes.orderContext}>\r\n {/* {props.order.ngayDat.slice(0,10).split('-').join('/')} */}\r\n {props.order.diaChiNhan\r\n ? `Địa chỉ nhận: ${props.order.diaChiNhan}`\r\n : \"\"}\r\n </Typography>\r\n </div>\r\n </React.Fragment>\r\n );\r\n}\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\ListOrder.js",["250","251","252","253","254","255","256","257","258","259","260","261","262","263","264","265","266","267","268","269","270","271","272","273","274"],"import React, { useState } from \"react\";\r\nimport clsx from \"clsx\";\r\nimport { makeStyles } from \"@material-ui/core/styles\";\r\nimport CssBaseline from \"@material-ui/core/CssBaseline\";\r\nimport Drawer from \"@material-ui/core/Drawer\";\r\nimport Box from \"@material-ui/core/Box\";\r\nimport AppBar from \"@material-ui/core/AppBar\";\r\nimport Toolbar from \"@material-ui/core/Toolbar\";\r\nimport List from \"@material-ui/core/List\";\r\nimport Typography from \"@material-ui/core/Typography\";\r\nimport Divider from \"@material-ui/core/Divider\";\r\nimport IconButton from \"@material-ui/core/IconButton\";\r\nimport Badge from \"@material-ui/core/Badge\";\r\nimport Container from \"@material-ui/core/Container\";\r\nimport Grid from \"@material-ui/core/Grid\";\r\nimport Paper from \"@material-ui/core/Paper\";\r\nimport { Link, Route } from \"react-router-dom\";\r\nimport MenuIcon from \"@material-ui/icons/Menu\";\r\nimport ChevronLeftIcon from \"@material-ui/icons/ChevronLeft\";\r\nimport NotificationsIcon from \"@material-ui/icons/Notifications\";\r\nimport { mainListItems, secondaryListItems } from \"./listItems\";\r\nimport { Button } from \"@material-ui/core\";\r\n// import Chart from './Chart';\r\nimport Order from \"./Order\";\r\nimport Orders from \"./OrderDetails\";\r\nimport { UserConsumer } from \"../../userContext\";\r\nimport Title from \"./Title\";\r\n\r\nconst useStyles = makeStyles((theme) => ({\r\n root: {\r\n display: \"flex\",\r\n },\r\n toolbar: {\r\n paddingRight: 24, // keep right padding when drawer closed\r\n },\r\n toolbarIcon: {\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"flex-end\",\r\n padding: \"0 8px\",\r\n ...theme.mixins.toolbar,\r\n },\r\n menuButton: {\r\n marginRight: 36,\r\n },\r\n menuButtonHidden: {\r\n display: \"none\",\r\n },\r\n title: {\r\n flexGrow: 1,\r\n },\r\n container: {\r\n paddingTop: theme.spacing(4),\r\n paddingBottom: theme.spacing(4),\r\n },\r\n paper: {\r\n padding: theme.spacing(2),\r\n display: \"flex\",\r\n overflow: \"auto\",\r\n flexDirection: \"column\",\r\n },\r\n fixedHeight: {\r\n height: 200,\r\n },\r\n}));\r\n\r\nexport default function ListOrder(props) {\r\n const classes = useStyles();\r\n const [filter, setFilter] = useState(true);\r\n const fixedHeightPaper = clsx(classes.paper, classes.fixedHeight);\r\n const value = props.value;\r\n let sorted = value.orders\r\n .map((item) => (item.trangThai == 2 ? { ...item, trangThai: -1 } : item))\r\n .sort(function (a, b) {\r\n if (a.trangThai == b.trangThai) {\r\n return Date.parse(b.ngayDat) - Date.parse(a.ngayDat);\r\n }\r\n return a.trangThai - b.trangThai;\r\n });\r\n // sorted =\r\n // filter === true\r\n // ? sorted.filter((item) => item.thanhTien >= 100000000)\r\n // : sorted;\r\n return (\r\n <Grid container spacing={3}>\r\n {/* Chart */}\r\n <Grid\r\n container\r\n spacing={2}\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n style={{ margin: 10 }}\r\n >\r\n <Grid item xs={12} sm={3}>\r\n <Button\r\n variant=\"contained\"\r\n color=\"primary\"\r\n onClick={() => value.setOrdersOfUser()}\r\n >\r\n <span>\r\n <i className=\"fas fa-sync\">{` Refresh`}</i>\r\n </span>\r\n </Button>\r\n </Grid>\r\n <Grid item xs={12} sm={3}>\r\n <Button onClick={() => alert(\"this is\")}>Sửa</Button>\r\n </Grid>\r\n </Grid>\r\n {/* Recent Order */}\r\n\r\n {/* <UserConsumer> */}\r\n {sorted.map((order) => {\r\n return order.isDeleted === false ? (\r\n <Grid key={order.id} item xs={12} sm={6} md={4} lg={3}>\r\n <Paper className={fixedHeightPaper}>\r\n <Order value={value} order={order} />\r\n </Paper>\r\n </Grid>\r\n ) : null;\r\n })}\r\n\r\n {/* </UserConsumer> */}\r\n\r\n {/* Recent Orders */}\r\n </Grid>\r\n );\r\n}\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Account.js",["275","276","277","278","279","280","281","282"],"import React, { useState } from \"react\";\r\nimport Grid from \"@material-ui/core/Grid\";\r\nimport Typography from \"@material-ui/core/Typography\";\r\nimport TextField from \"@material-ui/core/TextField\";\r\nimport FormControlLabel from \"@material-ui/core/FormControlLabel\";\r\nimport Checkbox from \"@material-ui/core/Checkbox\";\r\nimport { makeStyles } from \"@material-ui/core/styles\";\r\nimport Paper from \"@material-ui/core/Paper\";\r\nimport List from \"@material-ui/core/List\";\r\nimport ListItem from \"@material-ui/core/ListItem\";\r\nimport { UserConsumer } from \"../../userContext\";\r\nimport ListItemText from \"@material-ui/core/ListItemText\";\r\nimport { Button } from \"@material-ui/core\";\r\nimport { useToasts } from \"react-toast-notifications\";\r\nimport useForm from \"../../useForm\";\r\nimport { getOneUserFromDB, putUserToDB } from \"../../api\";\r\n\r\nconst useStyles = makeStyles((theme) => ({\r\n listItem: {\r\n padding: theme.spacing(1, 0),\r\n },\r\n total: {\r\n fontWeight: 700,\r\n },\r\n title: {\r\n marginTop: theme.spacing(2),\r\n justifyContent: \"center\",\r\n alignSelf: \"center\",\r\n },\r\n form: {\r\n width: \"100%\", // Fix IE 11 issue.\r\n marginTop: theme.spacing(2),\r\n },\r\n paper: {\r\n padding: theme.spacing(6),\r\n display: \"flex\",\r\n overflow: \"auto\",\r\n flexDirection: \"column\",\r\n },\r\n submit: {\r\n margin: theme.spacing(3, 0, 1),\r\n },\r\n}));\r\n\r\nexport default function Account(props) {\r\n const classes = useStyles();\r\n const [isEdit, setIsEdit] = useState(false);\r\n const { addToast } = useToasts();\r\n const valueUser = props.value;\r\n\r\n const initialFieldValues = {\r\n fullname: valueUser.user.tenKh,\r\n address: valueUser.user.diaChi,\r\n phone: valueUser.user.sdt,\r\n };\r\n\r\n const validate = (fieldValues = values) => {\r\n let temp = { ...errors };\r\n if (\"fullname\" in fieldValues)\r\n temp.fullname = fieldValues.fullname ? \"\" : \"Hãy nhập họ tên\";\r\n if (\"address\" in fieldValues)\r\n temp.address = fieldValues.address ? \"\" : \"Hãy nhập địa chỉ\";\r\n if (\"phone\" in fieldValues)\r\n temp.phone = fieldValues.phone ? \"\" : \"Hãy nhập số điện thoại\";\r\n // if (\"agree\" in fieldValues)\r\n setErrors({\r\n ...temp,\r\n });\r\n\r\n if (fieldValues == values) return Object.values(temp).every((x) => x == \"\");\r\n };\r\n\r\n const {\r\n values,\r\n setValues,\r\n errors,\r\n setErrors,\r\n handleInputChange,\r\n resetForm,\r\n } = useForm(initialFieldValues, validate);\r\n\r\n const handleSubmit = async (e) => {\r\n e.preventDefault();\r\n if (validate()) {\r\n const userId = valueUser.user.id;\r\n // await getOneUserFromDB(userId, currentUser);\r\n // alert(\"user \" + JSON.stringify(valueUser.user));\r\n const user = {\r\n ...valueUser.user,\r\n tenKh: values.fullname,\r\n diaChi: values.address,\r\n sdt: values.phone,\r\n };\r\n // alert(\"new user \" + JSON.stringify(user));\r\n let res = await putUserToDB(userId, user);\r\n // alert(JSON.stringify(res));\r\n\r\n if (res !== false) {\r\n valueUser.logIn(res);\r\n setIsEdit(false);\r\n addToast(\"Sửa tài khoản thành công\", {\r\n appearance: \"success\",\r\n });\r\n // //props.history.push(\"/\");\r\n } else {\r\n addToast(\r\n \"Có lỗi hoặc là đã tồn tại số điện thoại này, cùng thử lại nhé\",\r\n {\r\n appearance: \"warning\",\r\n }\r\n );\r\n }\r\n }\r\n };\r\n\r\n const total = valueUser.orders\r\n ?.map((order) =>\r\n order.trangThai === 1 && order.isDeleted === false ? order.thanhTien : 0\r\n )\r\n .reduce((a, b) => a + b, 0);\r\n\r\n return (\r\n <Grid container direction=\"column\" alignItems=\"center\" justify=\"center\">\r\n <Grid item xs={12} sm={10} md={6} lg={6}>\r\n {/* <UserConsumer>\r\n {(valueUser) => {\r\n \r\n return ( */}\r\n <Paper className={classes.paper}>\r\n {isEdit === false ? (\r\n <React.Fragment>\r\n <Typography variant=\"h6\" gutterBottom>\r\n Thông tin cá nhân\r\n </Typography>\r\n <List>\r\n <ListItem className={classes.listItem}>\r\n <ListItemText primary=\"Tên\" />\r\n <Typography variant=\"subtitle1\" className={classes.total}>\r\n {valueUser.user.tenKh}\r\n </Typography>\r\n </ListItem>\r\n <ListItem className={classes.listItem}>\r\n <ListItemText primary=\"Địa chỉ\" />\r\n <Typography variant=\"subtitle1\" className={classes.total}>\r\n {valueUser.user.diaChi}\r\n </Typography>\r\n </ListItem>\r\n <ListItem className={classes.listItem}>\r\n <ListItemText primary=\"SĐT\" />\r\n <Typography variant=\"subtitle1\" className={classes.total}>\r\n {valueUser.user.sdt}\r\n </Typography>\r\n </ListItem>\r\n </List>\r\n <Grid\r\n container\r\n spacing={2}\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n justify=\"center\"\r\n >\r\n <Grid item xs={12} sm={6}>\r\n <Typography\r\n variant=\"h6\"\r\n gutterBottom\r\n className={classes.title}\r\n >\r\n Tổng số tiền đã thanh toán\r\n </Typography>\r\n <Typography style={{ color: \"#e12345\" }} gutterBottom>\r\n {total > 50000000 ? \"Khách hàng thân thiết\" : \"\"}\r\n </Typography>\r\n </Grid>\r\n <Grid item container direction=\"column\" xs={12} sm={6}>\r\n <Typography\r\n variant=\"h3\"\r\n gutterBottom\r\n className={classes.title}\r\n >\r\n {Number(total).toLocaleString()}đ\r\n </Typography>\r\n </Grid>\r\n </Grid>\r\n <Button onClick={() => setIsEdit(true)}>Sửa</Button>\r\n </React.Fragment>\r\n ) : (\r\n <React.Fragment>\r\n <Typography variant=\"h6\" gutterBottom>\r\n Sửa thông tin cá nhân\r\n </Typography>\r\n <Grid container spacing={1}>\r\n <form\r\n className={classes.form}\r\n noValidate\r\n onSubmit={(e) => handleSubmit(e)}\r\n >\r\n <Grid container spacing={2}>\r\n <Grid item xs={12}>\r\n <TextField\r\n variant=\"outlined\"\r\n //margin=\"normal\"\r\n required\r\n fullWidth\r\n id=\"fullname\"\r\n label=\"Họ tên\"\r\n name=\"fullname\"\r\n autoComplete=\"off\"\r\n autoFocus\r\n value={values.fullname}\r\n onChange={handleInputChange}\r\n {...(errors.fullname && {\r\n error: true,\r\n helperText: errors.fullname,\r\n })}\r\n />\r\n </Grid>\r\n <Grid item xs={12}>\r\n <TextField\r\n variant=\"outlined\"\r\n //margin=\"normal\"\r\n required\r\n fullWidth\r\n id=\"address\"\r\n label=\"Địa chỉ\"\r\n name=\"address\"\r\n autoComplete=\"off\"\r\n autoFocus\r\n value={values.address}\r\n onChange={handleInputChange}\r\n {...(errors.address && {\r\n error: true,\r\n helperText: errors.address,\r\n })}\r\n />\r\n </Grid>\r\n <Grid item xs={12}>\r\n <TextField\r\n variant=\"outlined\"\r\n //margin=\"normal\"\r\n required\r\n fullWidth\r\n id=\"phone\"\r\n label=\"Số điện thoại\"\r\n name=\"phone\"\r\n autoComplete=\"off\"\r\n autoFocus\r\n value={values.phone}\r\n onChange={handleInputChange}\r\n {...(errors.phone && {\r\n error: true,\r\n helperText: errors.phone,\r\n })}\r\n />\r\n </Grid>\r\n </Grid>\r\n <Button\r\n type=\"submit\"\r\n fullWidth\r\n // variant=\"contained\"\r\n // color=\"primary\"\r\n className={classes.submit}\r\n >\r\n Lưu thông tin\r\n </Button>\r\n <Grid container justify=\"flex-end\">\r\n <Grid item>\r\n {/* <Link href=\"#\" variant=\"body2\">\r\n Đã có tài khoản? Đăng nhập\r\n </Link> */}\r\n </Grid>\r\n </Grid>\r\n </form>\r\n </Grid>\r\n </React.Fragment>\r\n )}\r\n </Paper>\r\n {/* }}\r\n </UserConsumer> */}\r\n </Grid>\r\n </Grid>\r\n );\r\n}\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\User\\Contact.js",["283","284","285","286","287","288","289","290","291","292","293"],"import React, { useState, useRef } from \"react\";\r\nimport Grid from \"@material-ui/core/Grid\";\r\nimport Typography from \"@material-ui/core/Typography\";\r\nimport TextField from \"@material-ui/core/TextField\";\r\nimport FormControlLabel from \"@material-ui/core/FormControlLabel\";\r\nimport Checkbox from \"@material-ui/core/Checkbox\";\r\nimport { makeStyles } from \"@material-ui/core/styles\";\r\nimport Paper from \"@material-ui/core/Paper\";\r\nimport moment from \"moment\";\r\nimport List from \"@material-ui/core/List\";\r\nimport ListItem from \"@material-ui/core/ListItem\";\r\nimport { UserConsumer } from \"../../userContext\";\r\nimport ListItemText from \"@material-ui/core/ListItemText\";\r\nimport Table from \"@material-ui/core/Table\";\r\nimport TableBody from \"@material-ui/core/TableBody\";\r\nimport TableCell from \"@material-ui/core/TableCell\";\r\nimport TableHead from \"@material-ui/core/TableHead\";\r\nimport TableRow from \"@material-ui/core/TableRow\";\r\nimport { Button } from \"@material-ui/core\";\r\nimport Link from \"@material-ui/core/Link\";\r\nimport Title from \"./Title\";\r\nimport ConfirmDialog from \"../ConfirmBox\";\r\nimport { useToasts } from \"react-toast-notifications\";\r\nimport useForm from \"../../useForm\";\r\n\r\nconst useStyles = makeStyles((theme) => ({\r\n listItem: {\r\n padding: theme.spacing(1, 0),\r\n },\r\n total: {\r\n fontWeight: 700,\r\n },\r\n title: {\r\n marginTop: theme.spacing(2),\r\n justifyContent: \"center\",\r\n alignSelf: \"center\",\r\n },\r\n form: {\r\n width: \"100%\", // Fix IE 11 issue.\r\n marginTop: theme.spacing(2),\r\n },\r\n paper: {\r\n padding: theme.spacing(6),\r\n display: \"flex\",\r\n overflow: \"auto\",\r\n flexDirection: \"column\",\r\n },\r\n submit: {\r\n margin: theme.spacing(3, 0, 1),\r\n },\r\n seeMore: {\r\n margin: theme.spacing(3),\r\n },\r\n}));\r\n\r\nexport default function Contact(props) {\r\n const classes = useStyles();\r\n const [isEdit, setIsEdit] = useState(false);\r\n const { addToast } = useToasts();\r\n const rows = props.value.contacts;\r\n const valueUser = props.value;\r\n\r\n const childRef = useRef();\r\n\r\n const initialFieldValues = {\r\n question: \"\",\r\n };\r\n\r\n const validate = (fieldValues = values) => {\r\n let temp = { ...errors };\r\n if (\"question\" in fieldValues)\r\n temp.question = fieldValues.question ? \"\" : \"Hãy nhập câu hỏi\";\r\n setErrors({\r\n ...temp,\r\n });\r\n\r\n if (fieldValues == values) return Object.values(temp).every((x) => x == \"\");\r\n };\r\n\r\n const {\r\n values,\r\n setValues,\r\n errors,\r\n setErrors,\r\n handleInputChange,\r\n resetForm,\r\n } = useForm(initialFieldValues, validate);\r\n\r\n const handleSubmit = async (e) => {\r\n e.preventDefault();\r\n if (validate()) {\r\n let questionRes = await valueUser.postContact(values.question);\r\n if (questionRes !== null) {\r\n valueUser.setContactsOfUser();\r\n setIsEdit(false);\r\n addToast(\"Đặt câu hỏi khách hàng thành công\", {\r\n appearance: \"success\",\r\n });\r\n // //props.history.push(\"/\");\r\n } else {\r\n addToast(\"Có lỗi, cùng thử lại nhé\", {\r\n appearance: \"warning\",\r\n });\r\n }\r\n }\r\n };\r\n\r\n return (\r\n <Grid container direction=\"column\" alignItems=\"center\" justify=\"center\">\r\n <Grid item xs={12}>\r\n {/* <UserConsumer>\r\n {(valueUser) => {\r\n \r\n return ( */}\r\n <Paper className={classes.paper}>\r\n {isEdit === false ? (\r\n <React.Fragment>\r\n <Grid\r\n container\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n style={{ marginBottom: 10 }}\r\n >\r\n <Grid item xs={12} sm={3}>\r\n <Button\r\n variant=\"contained\"\r\n color=\"primary\"\r\n onClick={() => valueUser.setContactsOfUser()}\r\n >\r\n <span>\r\n <i className=\"fas fa-sync\">{` Refresh`}</i>\r\n </span>\r\n </Button>\r\n </Grid>\r\n <Grid item xs={12} sm={3}>\r\n {/* <Button onClick={() => alert(\"this is\")}>Sửa</Button> */}\r\n </Grid>\r\n </Grid>\r\n <Title>Bảng tư vấn</Title>\r\n <Table size=\"small\">\r\n <TableHead>\r\n <TableRow>\r\n <TableCell align=\"center\">STT</TableCell>\r\n <TableCell align=\"center\">Câu hỏi</TableCell>\r\n <TableCell align=\"center\">Trả lời</TableCell>\r\n <TableCell align=\"center\">Thời gian hỏi</TableCell>\r\n <TableCell align=\"center\">Thời gian trả lời</TableCell>\r\n </TableRow>\r\n </TableHead>\r\n <TableBody>\r\n {rows &&\r\n rows.map((row, index) =>\r\n row.isDeleted == false ? (\r\n <TableRow key={row.id}>\r\n <TableCell align=\"center\">{index + 1}</TableCell>\r\n <TableCell align=\"center\">{row.cauHoi}</TableCell>\r\n <TableCell align=\"center\">{row.traLoi}</TableCell>\r\n <TableCell align=\"center\">\r\n {moment(row.ngayDat).format(\"DD/MM/YYYY, h:mm:ss\")}\r\n </TableCell>\r\n <TableCell align=\"center\">\r\n {row.nguoiTraLoi !== null\r\n ? moment(row.ngayTraLoi).format(\r\n \"DD/MM/YYYY, h:mm:ss\"\r\n )\r\n : \"Chưa trả lời\"}\r\n </TableCell>\r\n <TableCell>\r\n <Link\r\n color=\"secondary\"\r\n href=\"#\"\r\n onClick={() => {\r\n childRef.current.handleClickOpen();\r\n }}\r\n >\r\n <span>\r\n <i\r\n className=\"fa fa-trash\"\r\n aria-hidden=\"true\"\r\n ></i>\r\n </span>\r\n </Link>\r\n <ConfirmDialog\r\n ref={childRef}\r\n action={() => valueUser.deleteContact(row.id)}\r\n title={\"Hủy câu hỏi\"}\r\n addToast={() => {\r\n addToast(`Hủy câu hỏi thành công`, {\r\n appearance: \"success\",\r\n });\r\n }}\r\n />\r\n </TableCell>\r\n </TableRow>\r\n ) : null\r\n )}\r\n </TableBody>\r\n </Table>\r\n <div className={classes.seeMore}>\r\n {/* <Typography\r\n variant=\"body1\"\r\n color=\"textSecondary\"\r\n align=\"center\"\r\n >\r\n Phí phụ thu:{\" \"}\r\n {Number(props.total - totalWithoutTax).toLocaleString()}đ\r\n </Typography> */}\r\n </div>\r\n <Button onClick={() => setIsEdit(true)}>Liên hệ</Button>\r\n </React.Fragment>\r\n ) : (\r\n <React.Fragment>\r\n <Typography variant=\"h6\" gutterBottom>\r\n Liên hệ\r\n </Typography>\r\n <Grid container spacing={1}>\r\n <form\r\n className={classes.form}\r\n noValidate\r\n onSubmit={(e) => handleSubmit(e)}\r\n >\r\n <Grid container spacing={2}>\r\n <Grid item xs={12}>\r\n <TextField\r\n variant=\"outlined\"\r\n //margin=\"normal\"\r\n required\r\n style={{ width: 500 }}\r\n id=\"question\"\r\n label=\"Nội dung\"\r\n name=\"question\"\r\n autoComplete=\"off\"\r\n autoFocus\r\n rows={3}\r\n multiline\r\n value={values.question}\r\n onChange={handleInputChange}\r\n {...(errors.question && {\r\n error: true,\r\n helperText: errors.question,\r\n })}\r\n />\r\n </Grid>\r\n </Grid>\r\n <Grid\r\n container\r\n spacing={2}\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n justify=\"center\"\r\n >\r\n <Grid item xs={12} sm={6}>\r\n <Button\r\n onClick={() => setIsEdit(false)}\r\n fullWidth\r\n // variant=\"contained\"\r\n // color=\"primary\"\r\n className={classes.submit}\r\n >\r\n Trở lại\r\n </Button>\r\n </Grid>\r\n <Grid item xs={12} sm={6}>\r\n <Button\r\n type=\"submit\"\r\n fullWidth\r\n // variant=\"contained\"\r\n // color=\"primary\"\r\n className={classes.submit}\r\n >\r\n Gửi\r\n </Button>\r\n </Grid>\r\n </Grid>\r\n </form>\r\n </Grid>\r\n </React.Fragment>\r\n )}\r\n </Paper>\r\n {/* }}\r\n </UserConsumer> */}\r\n </Grid>\r\n </Grid>\r\n );\r\n}\r\n","C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Homepage.js",["294","295","296","297"],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\Carousel.js",[],"C:\\Users\\lehoa\\Dropbox\\My Code\\schoolcode\\Nam3\\HK1\\OOAD\\mastersales-front-react\\src\\components\\FooterArea.js",[],{"ruleId":"298","replacedBy":"299"},{"ruleId":"300","replacedBy":"301"},{"ruleId":"302","severity":1,"message":"303","line":13,"column":8,"nodeType":"304","messageId":"305","endLine":13,"endColumn":14},{"ruleId":"302","severity":1,"message":"306","line":3,"column":8,"nodeType":"304","messageId":"305","endLine":3,"endColumn":13},{"ruleId":"302","severity":1,"message":"307","line":6,"column":3,"nodeType":"304","messageId":"305","endLine":6,"endColumn":18},{"ruleId":"302","severity":1,"message":"308","line":2,"column":10,"nodeType":"304","messageId":"305","endLine":2,"endColumn":25},{"ruleId":"302","severity":1,"message":"309","line":1,"column":17,"nodeType":"304","messageId":"305","endLine":1,"endColumn":26},{"ruleId":"302","severity":1,"message":"309","line":1,"column":17,"nodeType":"304","messageId":"305","endLine":1,"endColumn":26},{"ruleId":"302","severity":1,"message":"310","line":4,"column":10,"nodeType":"304","messageId":"305","endLine":4,"endColumn":23},{"ruleId":"302","severity":1,"message":"311","line":8,"column":10,"nodeType":"304","messageId":"305","endLine":8,"endColumn":16},{"ruleId":"302","severity":1,"message":"312","line":8,"column":17,"nodeType":"304","messageId":"305","endLine":8,"endColumn":25},{"ruleId":"302","severity":1,"message":"313","line":27,"column":7,"nodeType":"304","messageId":"305","endLine":27,"endColumn":21},{"ruleId":"302","severity":1,"message":"309","line":1,"column":17,"nodeType":"304","messageId":"305","endLine":1,"endColumn":26},{"ruleId":"302","severity":1,"message":"314","line":1,"column":17,"nodeType":"304","messageId":"305","endLine":1,"endColumn":25},{"ruleId":"302","severity":1,"message":"315","line":1,"column":27,"nodeType":"304","messageId":"305","endLine":1,"endColumn":37},{"ruleId":"302","severity":1,"message":"316","line":2,"column":8,"nodeType":"304","messageId":"305","endLine":2,"endColumn":14},{"ruleId":"302","severity":1,"message":"317","line":6,"column":8,"nodeType":"304","messageId":"305","endLine":6,"endColumn":24},{"ruleId":"302","severity":1,"message":"318","line":7,"column":8,"nodeType":"304","messageId":"305","endLine":7,"endColumn":16},{"ruleId":"302","severity":1,"message":"319","line":8,"column":8,"nodeType":"304","messageId":"305","endLine":8,"endColumn":14},{"ruleId":"302","severity":1,"message":"320","line":12,"column":8,"nodeType":"304","messageId":"305","endLine":12,"endColumn":24},{"ruleId":"302","severity":1,"message":"321","line":14,"column":16,"nodeType":"304","messageId":"305","endLine":14,"endColumn":24},{"ruleId":"322","severity":1,"message":"323","line":86,"column":21,"nodeType":"324","messageId":"325","endLine":86,"endColumn":23},{"ruleId":"322","severity":1,"message":"323","line":86,"column":74,"nodeType":"324","messageId":"325","endLine":86,"endColumn":76},{"ruleId":"302","severity":1,"message":"326","line":91,"column":5,"nodeType":"304","messageId":"305","endLine":91,"endColumn":14},{"ruleId":"302","severity":1,"message":"309","line":1,"column":17,"nodeType":"304","messageId":"305","endLine":1,"endColumn":26},{"ruleId":"302","severity":1,"message":"309","line":1,"column":17,"nodeType":"304","messageId":"305","endLine":1,"endColumn":26},{"ruleId":"302","severity":1,"message":"314","line":1,"column":28,"nodeType":"304","messageId":"305","endLine":1,"endColumn":36},{"ruleId":"302","severity":1,"message":"327","line":2,"column":8,"nodeType":"304","messageId":"305","endLine":2,"endColumn":20},{"ruleId":"302","severity":1,"message":"328","line":7,"column":10,"nodeType":"304","messageId":"305","endLine":7,"endColumn":22},{"ruleId":"322","severity":1,"message":"323","line":51,"column":21,"nodeType":"324","messageId":"325","endLine":51,"endColumn":23},{"ruleId":"322","severity":1,"message":"323","line":51,"column":74,"nodeType":"324","messageId":"325","endLine":51,"endColumn":76},{"ruleId":"302","severity":1,"message":"326","line":56,"column":5,"nodeType":"304","messageId":"305","endLine":56,"endColumn":14},{"ruleId":"302","severity":1,"message":"329","line":60,"column":5,"nodeType":"304","messageId":"305","endLine":60,"endColumn":14},{"ruleId":"302","severity":1,"message":"330","line":1,"column":8,"nodeType":"304","messageId":"305","endLine":1,"endColumn":13},{"ruleId":"302","severity":1,"message":"331","line":1,"column":27,"nodeType":"304","messageId":"305","endLine":1,"endColumn":36},{"ruleId":"302","severity":1,"message":"332","line":2,"column":10,"nodeType":"304","messageId":"305","endLine":2,"endColumn":23},{"ruleId":"302","severity":1,"message":"306","line":3,"column":8,"nodeType":"304","messageId":"305","endLine":3,"endColumn":13},{"ruleId":"302","severity":1,"message":"333","line":2,"column":3,"nodeType":"304","messageId":"305","endLine":2,"endColumn":9},{"ruleId":"302","severity":1,"message":"314","line":3,"column":3,"nodeType":"304","messageId":"305","endLine":3,"endColumn":11},{"ruleId":"302","severity":1,"message":"316","line":2,"column":8,"nodeType":"304","messageId":"305","endLine":2,"endColumn":14},{"ruleId":"302","severity":1,"message":"320","line":13,"column":8,"nodeType":"304","messageId":"305","endLine":13,"endColumn":24},{"ruleId":"322","severity":1,"message":"323","line":90,"column":21,"nodeType":"324","messageId":"325","endLine":90,"endColumn":23},{"ruleId":"322","severity":1,"message":"323","line":90,"column":74,"nodeType":"324","messageId":"325","endLine":90,"endColumn":76},{"ruleId":"302","severity":1,"message":"326","line":95,"column":5,"nodeType":"304","messageId":"305","endLine":95,"endColumn":14},{"ruleId":"302","severity":1,"message":"329","line":99,"column":5,"nodeType":"304","messageId":"305","endLine":99,"endColumn":14},{"ruleId":"302","severity":1,"message":"334","line":6,"column":8,"nodeType":"304","messageId":"305","endLine":6,"endColumn":11},{"ruleId":"302","severity":1,"message":"335","line":7,"column":8,"nodeType":"304","messageId":"305","endLine":7,"endColumn":14},{"ruleId":"302","severity":1,"message":"336","line":8,"column":8,"nodeType":"304","messageId":"305","endLine":8,"endColumn":15},{"ruleId":"302","severity":1,"message":"337","line":10,"column":8,"nodeType":"304","messageId":"305","endLine":10,"endColumn":18},{"ruleId":"302","severity":1,"message":"338","line":13,"column":8,"nodeType":"304","messageId":"305","endLine":13,"endColumn":13},{"ruleId":"302","severity":1,"message":"339","line":15,"column":8,"nodeType":"304","messageId":"305","endLine":15,"endColumn":12},{"ruleId":"302","severity":1,"message":"340","line":16,"column":8,"nodeType":"304","messageId":"305","endLine":16,"endColumn":13},{"ruleId":"302","severity":1,"message":"341","line":17,"column":10,"nodeType":"304","messageId":"305","endLine":17,"endColumn":14},{"ruleId":"302","severity":1,"message":"342","line":19,"column":8,"nodeType":"304","messageId":"305","endLine":19,"endColumn":23},{"ruleId":"302","severity":1,"message":"343","line":20,"column":8,"nodeType":"304","messageId":"305","endLine":20,"endColumn":25},{"ruleId":"302","severity":1,"message":"344","line":23,"column":8,"nodeType":"304","messageId":"305","endLine":23,"endColumn":13},{"ruleId":"302","severity":1,"message":"303","line":24,"column":8,"nodeType":"304","messageId":"305","endLine":24,"endColumn":14},{"ruleId":"302","severity":1,"message":"345","line":26,"column":8,"nodeType":"304","messageId":"305","endLine":26,"endColumn":13},{"ruleId":"302","severity":1,"message":"346","line":122,"column":9,"nodeType":"304","messageId":"305","endLine":122,"endColumn":25},{"ruleId":"302","severity":1,"message":"347","line":5,"column":8,"nodeType":"304","messageId":"305","endLine":5,"endColumn":21},{"ruleId":"302","severity":1,"message":"348","line":6,"column":8,"nodeType":"304","messageId":"305","endLine":6,"endColumn":21},{"ruleId":"302","severity":1,"message":"349","line":9,"column":8,"nodeType":"304","messageId":"305","endLine":9,"endColumn":20},{"ruleId":"302","severity":1,"message":"350","line":10,"column":8,"nodeType":"304","messageId":"305","endLine":10,"endColumn":18},{"ruleId":"302","severity":1,"message":"331","line":1,"column":17,"nodeType":"304","messageId":"305","endLine":1,"endColumn":26},{"ruleId":"302","severity":1,"message":"351","line":8,"column":10,"nodeType":"304","messageId":"305","endLine":8,"endColumn":25},{"ruleId":"302","severity":1,"message":"352","line":11,"column":10,"nodeType":"304","messageId":"305","endLine":11,"endColumn":24},{"ruleId":"302","severity":1,"message":"353","line":6,"column":10,"nodeType":"304","messageId":"305","endLine":6,"endColumn":16},{"ruleId":"302","severity":1,"message":"341","line":5,"column":10,"nodeType":"304","messageId":"305","endLine":5,"endColumn":14},{"ruleId":"302","severity":1,"message":"353","line":7,"column":10,"nodeType":"304","messageId":"305","endLine":7,"endColumn":16},{"ruleId":"302","severity":1,"message":"341","line":2,"column":8,"nodeType":"304","messageId":"305","endLine":2,"endColumn":12},{"ruleId":"302","severity":1,"message":"354","line":13,"column":10,"nodeType":"304","messageId":"305","endLine":13,"endColumn":20},{"ruleId":"302","severity":1,"message":"352","line":17,"column":10,"nodeType":"304","messageId":"305","endLine":17,"endColumn":24},{"ruleId":"302","severity":1,"message":"355","line":4,"column":8,"nodeType":"304","messageId":"305","endLine":4,"endColumn":19},{"ruleId":"302","severity":1,"message":"356","line":5,"column":8,"nodeType":"304","messageId":"305","endLine":5,"endColumn":14},{"ruleId":"302","severity":1,"message":"334","line":6,"column":8,"nodeType":"304","messageId":"305","endLine":6,"endColumn":11},{"ruleId":"302","severity":1,"message":"335","line":7,"column":8,"nodeType":"304","messageId":"305","endLine":7,"endColumn":14},{"ruleId":"302","severity":1,"message":"336","line":8,"column":8,"nodeType":"304","messageId":"305","endLine":8,"endColumn":15},{"ruleId":"302","severity":1,"message":"357","line":9,"column":8,"nodeType":"304","messageId":"305","endLine":9,"endColumn":12},{"ruleId":"302","severity":1,"message":"337","line":10,"column":8,"nodeType":"304","messageId":"305","endLine":10,"endColumn":18},{"ruleId":"302","severity":1,"message":"358","line":11,"column":8,"nodeType":"304","messageId":"305","endLine":11,"endColumn":15},{"ruleId":"302","severity":1,"message":"359","line":12,"column":8,"nodeType":"304","messageId":"305","endLine":12,"endColumn":18},{"ruleId":"302","severity":1,"message":"338","line":13,"column":8,"nodeType":"304","messageId":"305","endLine":13,"endColumn":13},{"ruleId":"302","severity":1,"message":"360","line":14,"column":8,"nodeType":"304","messageId":"305","endLine":14,"endColumn":17},{"ruleId":"302","severity":1,"message":"341","line":17,"column":10,"nodeType":"304","messageId":"305","endLine":17,"endColumn":14},{"ruleId":"302","severity":1,"message":"361","line":17,"column":16,"nodeType":"304","messageId":"305","endLine":17,"endColumn":21},{"ruleId":"302","severity":1,"message":"362","line":18,"column":8,"nodeType":"304","messageId":"305","endLine":18,"endColumn":16},{"ruleId":"302","severity":1,"message":"342","line":19,"column":8,"nodeType":"304","messageId":"305","endLine":19,"endColumn":23},{"ruleId":"302","severity":1,"message":"343","line":20,"column":8,"nodeType":"304","messageId":"305","endLine":20,"endColumn":25},{"ruleId":"302","severity":1,"message":"363","line":21,"column":10,"nodeType":"304","messageId":"305","endLine":21,"endColumn":23},{"ruleId":"302","severity":1,"message":"364","line":21,"column":25,"nodeType":"304","messageId":"305","endLine":21,"endColumn":43},{"ruleId":"302","severity":1,"message":"303","line":25,"column":8,"nodeType":"304","messageId":"305","endLine":25,"endColumn":14},{"ruleId":"302","severity":1,"message":"328","line":26,"column":10,"nodeType":"304","messageId":"305","endLine":26,"endColumn":22},{"ruleId":"302","severity":1,"message":"345","line":27,"column":8,"nodeType":"304","messageId":"305","endLine":27,"endColumn":13},{"ruleId":"302","severity":1,"message":"311","line":69,"column":10,"nodeType":"304","messageId":"305","endLine":69,"endColumn":16},{"ruleId":"302","severity":1,"message":"365","line":69,"column":18,"nodeType":"304","messageId":"305","endLine":69,"endColumn":27},{"ruleId":"322","severity":1,"message":"323","line":73,"column":36,"nodeType":"324","messageId":"325","endLine":73,"endColumn":38},{"ruleId":"322","severity":1,"message":"323","line":75,"column":23,"nodeType":"324","messageId":"325","endLine":75,"endColumn":25},{"ruleId":"302","severity":1,"message":"317","line":5,"column":8,"nodeType":"304","messageId":"305","endLine":5,"endColumn":24},{"ruleId":"302","severity":1,"message":"318","line":6,"column":8,"nodeType":"304","messageId":"305","endLine":6,"endColumn":16},{"ruleId":"302","severity":1,"message":"328","line":11,"column":10,"nodeType":"304","messageId":"305","endLine":11,"endColumn":22},{"ruleId":"302","severity":1,"message":"366","line":16,"column":10,"nodeType":"304","messageId":"305","endLine":16,"endColumn":26},{"ruleId":"322","severity":1,"message":"323","line":70,"column":21,"nodeType":"324","messageId":"325","endLine":70,"endColumn":23},{"ruleId":"322","severity":1,"message":"323","line":70,"column":74,"nodeType":"324","messageId":"325","endLine":70,"endColumn":76},{"ruleId":"302","severity":1,"message":"326","line":75,"column":5,"nodeType":"304","messageId":"305","endLine":75,"endColumn":14},{"ruleId":"302","severity":1,"message":"329","line":79,"column":5,"nodeType":"304","messageId":"305","endLine":79,"endColumn":14},{"ruleId":"302","severity":1,"message":"317","line":5,"column":8,"nodeType":"304","messageId":"305","endLine":5,"endColumn":24},{"ruleId":"302","severity":1,"message":"318","line":6,"column":8,"nodeType":"304","messageId":"305","endLine":6,"endColumn":16},{"ruleId":"302","severity":1,"message":"357","line":10,"column":8,"nodeType":"304","messageId":"305","endLine":10,"endColumn":12},{"ruleId":"302","severity":1,"message":"367","line":11,"column":8,"nodeType":"304","messageId":"305","endLine":11,"endColumn":16},{"ruleId":"302","severity":1,"message":"328","line":12,"column":10,"nodeType":"304","messageId":"305","endLine":12,"endColumn":22},{"ruleId":"302","severity":1,"message":"368","line":13,"column":8,"nodeType":"304","messageId":"305","endLine":13,"endColumn":20},{"ruleId":"322","severity":1,"message":"323","line":77,"column":21,"nodeType":"324","messageId":"325","endLine":77,"endColumn":23},{"ruleId":"322","severity":1,"message":"323","line":77,"column":74,"nodeType":"324","messageId":"325","endLine":77,"endColumn":76},{"ruleId":"302","severity":1,"message":"326","line":82,"column":5,"nodeType":"304","messageId":"305","endLine":82,"endColumn":14},{"ruleId":"302","severity":1,"message":"329","line":86,"column":5,"nodeType":"304","messageId":"305","endLine":86,"endColumn":14},{"ruleId":"322","severity":1,"message":"323","line":153,"column":37,"nodeType":"324","messageId":"325","endLine":153,"endColumn":39},{"ruleId":"302","severity":1,"message":"309","line":1,"column":17,"nodeType":"304","messageId":"305","endLine":1,"endColumn":26},{"ruleId":"302","severity":1,"message":"341","line":3,"column":10,"nodeType":"304","messageId":"305","endLine":3,"endColumn":14},{"ruleId":"302","severity":1,"message":"369","line":7,"column":10,"nodeType":"304","messageId":"305","endLine":7,"endColumn":19},{"ruleId":"302","severity":1,"message":"337","line":8,"column":10,"nodeType":"304","messageId":"305","endLine":8,"endColumn":20},"no-native-reassign",["370"],"no-negated-in-lhs",["371"],"no-unused-vars","'Orders' is defined but never used.","Identifier","unusedVar","'axios' is defined but never used.","'getOrdersFromDB' is defined but never used.","'ButtonContainer' is defined but never used.","'Component' is defined but never used.","'storeProducts' is defined but never used.","'filter' is assigned a value but never used.","'setFiler' is assigned a value but never used.","'ProductWrapper' is assigned a value but never used.","'useState' is defined but never used.","'useContext' is defined but never used.","'Avatar' is defined but never used.","'FormControlLabel' is defined but never used.","'Checkbox' is defined but never used.","'LinkMU' is defined but never used.","'LockOutlinedIcon' is defined but never used.","'Redirect' is defined but never used.","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","'setValues' is assigned a value but never used.","'PayPalButton' is defined but never used.","'UserConsumer' is defined but never used.","'resetForm' is assigned a value but never used.","'React' is defined but never used.","'useEffect' is defined but never used.","'detailProduct' is defined but never used.","'useRef' is defined but never used.","'Box' is defined but never used.","'AppBar' is defined but never used.","'Toolbar' is defined but never used.","'Typography' is defined but never used.","'Badge' is defined but never used.","'Grid' is defined but never used.","'Paper' is defined but never used.","'Link' is defined but never used.","'ChevronLeftIcon' is defined but never used.","'NotificationsIcon' is defined but never used.","'Order' is defined but never used.","'Title' is defined but never used.","'fixedHeightPaper' is assigned a value but never used.","'ListSubheader' is defined but never used.","'DashboardIcon' is defined but never used.","'BarChartIcon' is defined but never used.","'LayersIcon' is defined but never used.","'DonutSmallSharp' is defined but never used.","'preventDefault' is defined but never used.","'Button' is defined but never used.","'createData' is defined but never used.","'CssBaseline' is defined but never used.","'Drawer' is defined but never used.","'List' is defined but never used.","'Divider' is defined but never used.","'IconButton' is defined but never used.","'Container' is defined but never used.","'Route' is defined but never used.","'MenuIcon' is defined but never used.","'mainListItems' is defined but never used.","'secondaryListItems' is defined but never used.","'setFilter' is assigned a value but never used.","'getOneUserFromDB' is defined but never used.","'ListItem' is defined but never used.","'ListItemText' is defined but never used.","'useToasts' is defined but never used.","no-global-assign","no-unsafe-negation"]