Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

fix add customer field null #170

Merged
merged 5 commits into from
Mar 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 52 additions & 17 deletions src/main/webapp/view/jsp/management/customer/add-customer.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<link rel="icon" type="image/png" sizes="512x512" href="<%=request.getContextPath()%>/view/assets/images/favicon/favicon.png">

<link rel="stylesheet" href="<%=request.getContextPath()%>/view/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i&amp;display=swap">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/line-awesome/1.3.0/line-awesome/css/line-awesome.min.css">
<link rel="stylesheet" href="https://f...content-available-to-author-only...s.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i&amp;display=swap">
<link rel="stylesheet" href="https://c...content-available-to-author-only...e.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link rel="stylesheet" href="https://c...content-available-to-author-only...e.com/ajax/libs/line-awesome/1.3.0/line-awesome/css/line-awesome.min.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/view/assets/css/animate.min.css">

</head>
Expand All @@ -40,40 +40,59 @@
<p class="text-primary m-0 fw-bold">Thêm khách hàng mới</p>
</div>
<div class="card-body">
<form action="./add-customer" method="post">
<form action="./add-customer" method="post" id="form-add-customer">
<div class="row">
<div class="col">
<div class="mb-3">
<div class="mb-3 form-group">
<label class="form-label" for="name">
<strong>Tên khách hàng</strong>
</label>
<input class="form-control" type="text" id="name" placeholder="Nhập tên khách hàng" name="name" value="<%= (error != null && customer != null) ? customer.getName() : ""%>">
<div class="mb-3 form-group">
<input class="form-control" type="text" id="name-customer" placeholder="Nhập tên khách hàng" name="name" value="<%= (error != null && customer != null) ? customer.getName() : ""%>">
<span class="form-message text-danger"></span>
</div>
</div>
</div>
<div class="col">
<div class="mb-3">
<label class="form-label" for="code">
<strong>Mã khách hàng</strong>
</label>
<input class="form-control" type="text" id="code" placeholder="Mã khách hàng" name="code">
<div class="mb-3 form-group">
<input class="form-control" type="text" id="code-customer" placeholder="Mã khách hàng" name="code" >
<span class="form-message text-danger"></span>
</div>
</div>
</div>

</div>
<div class="mb-3">
<div class="mb-3">
<div class="mb-3">
<label class="form-label" for="address">
<strong>Địa chỉ</strong>
</label>
<input class="form-control" type="text" id="address" placeholder="Nhập địa chỉ của khách hàng" name="address" value="<%= (error != null && customer != null) ? customer.getAddress() : ""%>"></div>
<div class="mb-3"><label class="form-label" for="email"><strong>Email</strong></label><input class="form-control" type="email" id="email" placeholder="Nhập email khách hàng" name="email"></div>
<% if(error != null) {
<label class="form-label" for="address">
<strong>Địa chỉ</strong>
</label>
<div class="mb-3 form-group">
<input class="form-control" type="text" id="address-customer" placeholder="Nhập địa chỉ của khách hàng" name="address" >
<span class="form-message text-danger"></span>
</div>
</div>
<div class="mb-3">
<label class="form-label" for="email">
<strong>Email</strong>
</label>
<div class="mb-3 form-group">
<input class="form-control" type="email" id="email-customer" placeholder="Nhập email khách hàng" name="email" >
<span class="form-message text-danger"></span>
</div>
</div>
<%
if(error != null) {
%>
<span class="form-message text-danger"><%=error%></span>
<%
}
%>
<span class="form-message text-danger"><%=error%></span>
<%
}
%>
</div>
<a class="btn btn-primary btn-sm" href="customer">Quay lại</a>
<button class="btn btn-primary btn-sm" type="submit">Lưu lại</button>
Expand All @@ -94,7 +113,23 @@
<script src="<%=request.getContextPath()%>/view/assets/js/bootstrap.min.js"></script>
<script src="<%=request.getContextPath()%>/view/assets/js/bs-init.js"></script>
<script src="<%=request.getContextPath()%>/view/assets/js/theme.js"></script>
<script src="<%=request.getContextPath()%>/view/assets/js/validate/validator.js"></script>

<script>
Validator({
form: '#form-add-customer',
errorSelector: '.form-message',
formGroupSelector: '.form-group',
rules: [
Validator.isRequired('#name-customer', 'Vui lòng nhập tên khách hàng!'),
Validator.isRequired('#code-customer', 'Vui lòng nhập mã khách hàng!'),
Validator.isRequired('#address-customer', 'Vui lòng nhập địa chỉ khách hàng!'),
Validator.isRequired('#email-customer', 'Vui lòng nhập email khách hàng!')


]
});
</script>
</body>

</html>
Loading