Skip to content

Commit

Permalink
fix form bug
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainCapo committed Apr 21, 2020
1 parent 1052ea7 commit d765b43
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions SitNBeer/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#spring.datasource.url=jdbc:mysql://157.26.83.83:3306/spring_db_2020
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/sitnbeer
spring.datasource.url=jdbc:mysql://157.26.83.83:3306/spring_db_2020
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/sitnbeer
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=
spring.datasource.password=root
spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
Expand All @@ -11,4 +11,4 @@ spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.type=trace
spring.jpa.show-sql=true
server.port=8181
server.port=80
2 changes: 1 addition & 1 deletion SitNBeer/src/main/resources/templates/createBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1>Add a bar</h1>
<div class="row">
<div class="input-field col s12">
<label for="bar-available-table" class="activate">Number of table available in the bar : </label>
<input type="number" th:field="*{availableTable}" id="bar-available-table" name="bar-available-table" class="validate" required/>
<input type="number" th:field="*{availableTable}" id="bar-available-table" name="bar-available-table" class="validate" required max="255"/>
</div>
<div th:if="${#fields.hasErrors('availableTable')}" th:errors="*{availableTable}" class="invalid-feedback">Available table Error</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions SitNBeer/src/main/resources/templates/createBeer.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ <h1>Add a beer</h1>
<div class="row">
<div class="input-field col s12">
<label for="beer-price" class="active">Beer price : </label>
<input type="number" th:field="*{price}" id="beer-price" name="beer-price" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{price}" id="beer-price" name="beer-price" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('price')}" th:errors="*{price}" style="color:red;"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<label for="beer-volume" class="active">Beer volume : </label>
<input type="number" th:field="*{volume}" id="beer-volume" name="beer-volume" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{volume}" id="beer-volume" name="beer-volume" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('volume')}" th:errors="*{volume}" style="color:red;"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<label for="beer-stockQuantity" class="active">Stock quantity : </label>
<input type="number" th:field="*{stockQuantity}" id="beer-stockQuantity" name="beer-stockQuantity" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{stockQuantity}" id="beer-stockQuantity" name="beer-stockQuantity" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('stockQuantity')}" th:errors="*{stockQuantity}" style="color:red;"></span>
</div>
</div>
Expand Down
7 changes: 3 additions & 4 deletions SitNBeer/src/main/resources/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ <h1>Your profile</h1>
<ul>
<li>Name : <span th:text="${user.getUsername()}"></span></li>
<li>Email : <span th:text="${user.getEmail()}"></span></li>
</ul>
<br>
<p>You can order a beer by going to <a href="/bar/create">this page</a> !</p>

</ul>

<h2>Access to :</h2>
<span th:if="${user.getRole().getRoleName()=='USER'}">
<p>You can order a beer by going to <a href="/bar/create">this page</a> !</p>
<br>
<ul>
<li><a th:href="@{/orders/client/} + ${user.getId()}">Commands history</a></li>
<br>
Expand Down
3 changes: 2 additions & 1 deletion SitNBeer/src/main/resources/templates/updateBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ <h1>Update a bar</h1>
<div class="row">
<div class="input-field col s12">
<label for="bar-available-table" class="activate">Number of table available in the bar : </label>
<input type="number" th:field="*{availableTable}" id="bar-available-table" name="bar-available-table" class="validate" required/>
<input type="number" th:field="*{availableTable}" id="bar-available-table" name="bar-available-table" class="validate" required max="255"/>
<span th:if="${#fields.hasErrors('availableTable')}" th:errors="*{availableTable}" style="color:red;"></span>
</div>
</div>
<input type="hidden" th:field="*{user}">
<input type="hidden" th:field="*{beers}">
<input type="submit" class="waves-effect waves-light btn" value="Add a bar">
</form>
</main>
Expand Down
6 changes: 3 additions & 3 deletions SitNBeer/src/main/resources/templates/updateBeer.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ <h1>Update a beer</h1>
<div class="row">
<div class="input-field col s12">
<label for="beer-price" class="active">Beer price : </label>
<input type="number" th:field="*{price}" id="beer-price" name="beer-price" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{price}" id="beer-price" name="beer-price" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('price')}" th:errors="*{price}" style="color:red;"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<label for="beer-volume" class="active">Beer volume : </label>
<input type="number" th:field="*{volume}" id="beer-volume" name="beer-volume" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{volume}" id="beer-volume" name="beer-volume" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('volume')}" th:errors="*{volume}" style="color:red;"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<label for="beer-stockQuantity" class="active">Stock quantity : </label>
<input type="number" th:field="*{stockQuantity}" id="beer-stockQuantity" name="beer-stockQuantity" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{stockQuantity}" id="beer-stockQuantity" name="beer-stockQuantity" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('stockQuantity')}" th:errors="*{stockQuantity}" style="color:red;"></span>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions SitNBeer/target/classes/application.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#spring.datasource.url=jdbc:mysql://157.26.83.83:3306/spring_db_2020
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/sitnbeer
spring.datasource.url=jdbc:mysql://157.26.83.83:3306/spring_db_2020
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/sitnbeer
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=
spring.datasource.password=root
spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
Expand All @@ -11,4 +11,4 @@ spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.type=trace
spring.jpa.show-sql=true
server.port=8181
server.port=80
2 changes: 1 addition & 1 deletion SitNBeer/target/classes/templates/createBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1>Add a bar</h1>
<div class="row">
<div class="input-field col s12">
<label for="bar-available-table" class="activate">Number of table available in the bar : </label>
<input type="number" th:field="*{availableTable}" id="bar-available-table" name="bar-available-table" class="validate" required/>
<input type="number" th:field="*{availableTable}" id="bar-available-table" name="bar-available-table" class="validate" required max="255"/>
</div>
<div th:if="${#fields.hasErrors('availableTable')}" th:errors="*{availableTable}" class="invalid-feedback">Available table Error</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions SitNBeer/target/classes/templates/createBeer.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ <h1>Add a beer</h1>
<div class="row">
<div class="input-field col s12">
<label for="beer-price" class="active">Beer price : </label>
<input type="number" th:field="*{price}" id="beer-price" name="beer-price" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{price}" id="beer-price" name="beer-price" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('price')}" th:errors="*{price}" style="color:red;"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<label for="beer-volume" class="active">Beer volume : </label>
<input type="number" th:field="*{volume}" id="beer-volume" name="beer-volume" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{volume}" id="beer-volume" name="beer-volume" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('volume')}" th:errors="*{volume}" style="color:red;"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<label for="beer-stockQuantity" class="active">Stock quantity : </label>
<input type="number" th:field="*{stockQuantity}" id="beer-stockQuantity" name="beer-stockQuantity" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{stockQuantity}" id="beer-stockQuantity" name="beer-stockQuantity" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('stockQuantity')}" th:errors="*{stockQuantity}" style="color:red;"></span>
</div>
</div>
Expand Down
7 changes: 3 additions & 4 deletions SitNBeer/target/classes/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ <h1>Your profile</h1>
<ul>
<li>Name : <span th:text="${user.getUsername()}"></span></li>
<li>Email : <span th:text="${user.getEmail()}"></span></li>
</ul>
<br>
<p>You can order a beer by going to <a href="/bar/create">this page</a> !</p>

</ul>

<h2>Access to :</h2>
<span th:if="${user.getRole().getRoleName()=='USER'}">
<p>You can order a beer by going to <a href="/bar/create">this page</a> !</p>
<br>
<ul>
<li><a th:href="@{/orders/client/} + ${user.getId()}">Commands history</a></li>
<br>
Expand Down
3 changes: 2 additions & 1 deletion SitNBeer/target/classes/templates/updateBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ <h1>Update a bar</h1>
<div class="row">
<div class="input-field col s12">
<label for="bar-available-table" class="activate">Number of table available in the bar : </label>
<input type="number" th:field="*{availableTable}" id="bar-available-table" name="bar-available-table" class="validate" required/>
<input type="number" th:field="*{availableTable}" id="bar-available-table" name="bar-available-table" class="validate" required max="255"/>
<span th:if="${#fields.hasErrors('availableTable')}" th:errors="*{availableTable}" style="color:red;"></span>
</div>
</div>
<input type="hidden" th:field="*{user}">
<input type="hidden" th:field="*{beers}">
<input type="submit" class="waves-effect waves-light btn" value="Add a bar">
</form>
</main>
Expand Down
6 changes: 3 additions & 3 deletions SitNBeer/target/classes/templates/updateBeer.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ <h1>Update a beer</h1>
<div class="row">
<div class="input-field col s12">
<label for="beer-price" class="active">Beer price : </label>
<input type="number" th:field="*{price}" id="beer-price" name="beer-price" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{price}" id="beer-price" name="beer-price" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('price')}" th:errors="*{price}" style="color:red;"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<label for="beer-volume" class="active">Beer volume : </label>
<input type="number" th:field="*{volume}" id="beer-volume" name="beer-volume" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{volume}" id="beer-volume" name="beer-volume" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('volume')}" th:errors="*{volume}" style="color:red;"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<label for="beer-stockQuantity" class="active">Stock quantity : </label>
<input type="number" th:field="*{stockQuantity}" id="beer-stockQuantity" name="beer-stockQuantity" class="validate" required min="0" step="0.01"/>
<input type="number" th:field="*{stockQuantity}" id="beer-stockQuantity" name="beer-stockQuantity" class="validate" required min="0" step="0.01" max="255"/>
<span th:if="${#fields.hasErrors('stockQuantity')}" th:errors="*{stockQuantity}" style="color:red;"></span>
</div>
</div>
Expand Down

0 comments on commit d765b43

Please sign in to comment.