diff --git a/src/css/Components/notinbdd.css b/src/css/Components/notinbdd.css new file mode 100644 index 0000000..afaed25 --- /dev/null +++ b/src/css/Components/notinbdd.css @@ -0,0 +1,33 @@ +#warningBlock{ + height:30vh; + display:flex; + justify-content: space-around; + align-items: center; + flex-direction: column; +} + +#warningBox{ + color:white; + font-family: 'Wellfleet',cursive; + font-size:2vw +} + +#warningAdvice{ + color:rgb(65, 65, 65);; + font-family: 'Wellfleet',cursive; + font-size:2vw +} + + +#returningButton{ + font-family: 'Wellfleet', cursive; + display:block; + color:white; + font-size:2vw; + background-image:linear-gradient(#057B26,#044616); + border: 0.3vw solid black; + border-radius: 2.2vw; + padding:0.7vw 1.5vw 0.7vw 1.5vw; + cursor:pointer; +} + diff --git a/src/css/Components/sort.css b/src/css/Components/sort.css index 18700cd..6e02fbf 100644 --- a/src/css/Components/sort.css +++ b/src/css/Components/sort.css @@ -26,7 +26,7 @@ } #sortOrder:hover { - animation: rotate180 2s forwards + animation: rotate180 2s forwards022314015174 } .letter { diff --git a/src/css/Views/ticket.css b/src/css/Views/ticket.css index a390386..1eba4f4 100644 --- a/src/css/Views/ticket.css +++ b/src/css/Views/ticket.css @@ -87,7 +87,6 @@ font-family: 'Wellfleet', cursive; display:block; color:white; - font-family: 'Wellfleet', cursive; font-size:2vw; background-image:linear-gradient(#057B26,#044616); border: 0.3vw solid black; diff --git a/src/js/Components/NotInBdd.js b/src/js/Components/NotInBdd.js new file mode 100644 index 0000000..bd51398 --- /dev/null +++ b/src/js/Components/NotInBdd.js @@ -0,0 +1,43 @@ +import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; +import '../../css/Components/notinbdd.css' + +class NotInBdd extends Component { + + constructor(props){ + super(props) + this.state = { + + } + + } + + componentDidMount() { + + } + + + + render() { + + return ( +
+
+
+
+ Cette article n'est pas dans le stock ! +
+
+ Ajoute le depuis la page Stock ! +
+
+ Ok +
+
+
+
+ ); + } +} + +export default NotInBdd; \ No newline at end of file diff --git a/src/js/Views/Ticket.js b/src/js/Views/Ticket.js index 0e0f9a3..e6afad6 100644 --- a/src/js/Views/Ticket.js +++ b/src/js/Views/Ticket.js @@ -9,6 +9,7 @@ import BarcodeReader from 'react-barcode-reader'; import axios from 'axios'; import ArticleDetails from '../Components/ArticleDetails'; import { Link } from 'react-router-dom'; +import NotInBdd from '../Components/NotInBdd'; export default class Stock extends React.Component { @@ -21,7 +22,8 @@ export default class Stock extends React.Component { empty:true, totalPrice:0, totalQuantity:0, - redirect:false + redirect:false, + onNotInBdd:false } this.handleScan = this.handleScan.bind(this); @@ -49,14 +51,18 @@ export default class Stock extends React.Component { let i=0; let current = this.state.articles[i]; let trouve = current.code === code ? true : false; - while(!trouve) { + while(!trouve && i < this.state.articles.length-1) { i++; current = this.state.articles[i]; if (current.code === code) { trouve = !trouve; } } - // current.quantity = 1 + + // Gestion d'erreur si le code n'est pas dans la BDD + if (!trouve){ + this.setState({onNotInBdd:true}) + } else { console.log(current); @@ -96,7 +102,7 @@ export default class Stock extends React.Component { this.calculateTotaux() }) - + } } calculateTotaux = () => { @@ -141,6 +147,12 @@ export default class Stock extends React.Component { } } + closeNotInBdd = () => { + + this.setState({onNotInBdd:false}) + + } + render() { if (!sessionStorage.getItem('token')){ return (
ERREUR

Vous n'êtes pas connecté

Retourner à l'Accueil
) @@ -151,6 +163,9 @@ export default class Stock extends React.Component { + {this.state.onNotInBdd && + + } {!this.state.empty ?
{this.state.articlesJamalette.map((article) =>