-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateProduct.html
93 lines (86 loc) · 4.91 KB
/
createProduct.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lappy Store</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-8 mx-auto rounded border p-4 m-4">
<h2 class="text-center mb-5">
New Product
</h2>
<form method="post" enctype="multipart/form-data" th:object="${productDto}">
<div class="row mb-3">
<label class="col-sm-4 col-form-label">Name</label>
<div class="col-sm-8">
<input class="form-control" th:field="${productDto.name}">
<p th:if="${#fields.hasErrors('name')}" th:errorclass="text-danger"
th:errors="${productDto.name}"></p>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-4 col-form-label">Brand</label>
<div class="col-sm-8">
<input class="form-control" th:field="${productDto.brand}">
<p th:if="${#fields.hasErrors('brand')}" th:errorclass="text-danger"
th:errors="${productDto.brand}"></p>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-4 col-form-label">Category</label>
<div class="col-sm-8">
<select class="form-select" th:field="${productDto.category}">
<option value="Other">Other</option>
<option value="Phones">Phones</option>
<option value="Computers">Computers</option>
<option value="Accessories">Accessories</option>
<option value="Printers">Printers</option>
<option value="Cameras">Cameras</option>
</select>
<p th:if="${#fields.hasErrors('category')}" th:errorclass="text-danger"
th:errors="${productDto.category}"></p>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-4 col-form-label">Price</label>
<div class="col-sm-8">
<input class="form-control" type="number" step="0.01" min="0" th:field="${productDto.price}">
<p th:if="${#fields.hasErrors('price')}" th:errorclass="text-danger"
th:errors="${productDto.price}"></p>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-4 col-form-label">Description</label>
<div class="col-sm-8">
<textarea class="form-control" th:field="${productDto.description}"></textarea>
<p th:if="${#fields.hasErrors('description')}" th:errorclass="text-danger"
th:errors="${productDto.description}"></p>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-4 col-form-label">Image</label>
<div class="col-sm-8">
<input class="form-control" type="file" th:field="${productDto.imageFile}">
<p th:if="${#fields.hasErrors('imageFile')}" th:errorclass="text-danger"
th:errors="${productDto.imageFile}"></p>
</div>
</div>
<div class="row">
<div class="offset-sm-4 col-sm-4 d-grid">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
<div class="col-sm-4 d-grid">
<a class="btn btn-outline-primary" href="/products" role="button">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>