Skip to content

Commit f7c2c7f

Browse files
authored
Merge branch 'develop' into dependabot/npm_and_yarn/web-backend/src/main/frontend/npm_and_yarn-289f08b78c
2 parents 518210f + 5225aaa commit f7c2c7f

6 files changed

Lines changed: 548 additions & 389 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.statusneo.vms.enums;
2+
3+
public enum VisitPurpose {
4+
VENDOR("Vendor"),
5+
CLIENT_MEETING("Client Meeting"),
6+
INTERVIEW("Interview"),
7+
BUSINESS_MEETING("Business Meeting"),
8+
DELIVERY("Delivery");
9+
10+
private final String displayName;
11+
12+
VisitPurpose(String displayName) {
13+
this.displayName = displayName;
14+
}
15+
16+
public String getDisplayName() {
17+
return displayName;
18+
}
19+
20+
public String getFormValue() {
21+
return this.name().toLowerCase().replace('_', '-');
22+
}
23+
}

web-backend/src/main/java/com/statusneo/vms/model/Visitor.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ public class Visitor {
103103
@Column(name = "laptop_number")
104104
private String laptop;
105105

106+
@Column(name = "valid_govt_id")
107+
private String validGovtId;
108+
109+
110+
@Column(name = "visit_purpose")
111+
private String visitPurpose;
112+
106113
@ManyToOne
107114
@JoinColumn(name = "host_id", referencedColumnName = "id")
108115
private Employee host;
@@ -220,6 +227,14 @@ public void setLaptop(String laptop) {
220227
this.laptop = laptop;
221228
}
222229

230+
public String getValidGovtId() { return validGovtId; }
231+
232+
public void setValidGovtId(String validGovtId) { this.validGovtId = validGovtId; }
233+
234+
public String getVisitPurpose() { return visitPurpose; }
235+
236+
public void setVisitPurpose(String visitPurpose) { this.visitPurpose = visitPurpose; }
237+
223238

224239
@Override
225240
public String toString() {
@@ -232,6 +247,8 @@ public String toString() {
232247
", company='" + company + '\'' +
233248
", picturePath='" + picturePath + '\'' +
234249
", laptop_number='" + laptop + '\'' +
250+
", valid_govt_id='" + validGovtId + '\'' +
251+
", visit_purpose='" + visitPurpose + '\'' +
235252
'}';
236253
}
237254

web-backend/src/main/jte/employees.jte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
@import java.util.List
22

3-
@param List<com.statusneo.vms.model.Employee> employees
3+
@param List<com.statusneo.vms.model.Employee> hosts
44

5-
@if(employees != null)
6-
@if(employees.isEmpty())
5+
@if(hosts != null)
6+
@if(hosts.isEmpty())
77
<li class="px-4 py-2 text-gray-500">No employee found</li>
88
@else
9-
@for(com.statusneo.vms.model.Employee employee : employees)
9+
@for(com.statusneo.vms.model.Employee employee : hosts)
1010
<li class="px-4 py-2 hover:bg-gray-100 cursor-pointer" data-id="${employee.getId()}" data-name="${employee.getName()}" onclick="selectEmployee(this.dataset.name, this.dataset.id)">${employee.getName()}</li>
1111
@endfor
1212
@endif

web-backend/src/main/jte/index.jte

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@import com.statusneo.vms.enums.VisitPurpose
12
<!DOCTYPE html>
23
<html lang="en">
34
<head>
@@ -6,39 +7,33 @@
67
<title>Visitor Check-in</title>
78
<link href="/main.css" rel="stylesheet">
89
<script src="/webjars/htmx.org/2.0.7/dist/htmx.min.js"></script>
10+
<style>
11+
html { height: 100%; **overflow: hidden;** }
12+
body { height: 100vh; **overflow: hidden;** }
13+
</style>
914
</head>
10-
<body class="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100">
11-
12-
<!-- Top-level modal container so HTMX swaps can render full-screen overlays without being clipped -->
15+
<body class="bg-gradient-to-br from-blue-50 to-indigo-100 h-screen w-screen overflow-hidden">
1316
<div id="modal-container"></div>
14-
15-
<div class="container mx-auto px-4 py-8 max-w-4xl">
16-
<!-- Header -->
17-
<div class="text-center mb-8">
17+
<div class="container mx-auto px-4 py-8 max-w-3xl h-full flex flex-col justify-center">
18+
<div class="text-center mb-6 flex-shrink-0">
1819
<div class="flex justify-center mb-4">
1920
<img id="site-logo" src="/images/StatusNeo-logo.png" alt="StatusNeo Logo" style="height:36px !important; max-height:36px !important; width:auto !important;" class="mx-auto">
2021
</div>
2122
<h1 class="text-3xl font-bold text-gray-800 mb-2">Visitor Check-in</h1>
2223
<p class="text-gray-600">Please fill in your details to register your visit</p>
2324
</div>
2425

25-
<!-- Main Form -->
2626
<div class="bg-white rounded-2xl shadow-xl p-6 md:p-8">
27-
<!-- Modal Container -->
28-
<div id="modal-container"></div>
2927

3028
<form id="visitor-form"
3129
hx-post="/register"
3230
hx-target="#modal-container"
3331
hx-swap="innerHTML"
3432
hx-trigger="submit"
35-
class="space-y-6">
33+
class="space-y-6 h-full flex flex-col">
3634
<input type="hidden" name="_csrf" value="">
37-
3835
<div id="form-content">
39-
<!-- Two Column Grid for Tablet/Desktop -->
4036
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
41-
4237
<div class="space-y-2">
4338
<label for="name" class="block text-sm font-medium text-gray-700 flex items-center">
4439
<svg class="inline w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -68,7 +63,6 @@
6863
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"
6964
placeholder="Enter your email address">
7065
</div>
71-
7266
<div class="space-y-2">
7367
<label for="phone" class="block text-sm font-medium text-gray-700 flex items-center">
7468
<svg class="inline w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -83,7 +77,6 @@
8377
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"
8478
placeholder="Enter your phone number">
8579
</div>
86-
8780
<div class="space-y-2">
8881
<label for="company" class="block text-sm font-medium text-gray-700 flex items-center">
8982
<svg class="inline w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -98,7 +91,6 @@
9891
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"
9992
placeholder="Enter your company name">
10093
</div>
101-
10294
<div class="space-y-2">
10395
<label for="laptop" class="block text-sm font-medium text-gray-700 flex items-center">
10496
<svg class="inline w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -112,8 +104,21 @@
112104
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"
113105
placeholder="Enter your laptop number (optional)">
114106
</div>
115-
116-
<div class="md:col-span-2 space-y-2">
107+
<div class="space-y-2">
108+
<label for="govtId" class="block text-sm font-medium text-gray-700 flex items-center">
109+
<svg class="inline w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
110+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-7 0V4a2 2 0 012-2h4a2 2 0 012 2v2M7 12h10m-10 4h10"/>
111+
</svg>
112+
<span class="align-middle">Valid Govt ID (DL / PAN / Aadhaar) *</span>
113+
</label>
114+
<input type="text"
115+
id="govtId"
116+
name="govtId"
117+
required
118+
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"
119+
placeholder="Enter your government ID number">
120+
</div>
121+
<div class="space-y-2">
117122
<label for="host-search" class="block text-sm font-medium text-gray-700 flex items-center">
118123
<svg class="inline w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
119124
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
@@ -142,20 +147,37 @@
142147
</svg>
143148
</div>
144149

145-
<!-- Dropdown Results -->
146150
<div id="host-results"
147151
class="absolute z-10 w-full mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-48 overflow-y-auto hidden">
148-
<!-- Results will be populated by HTMX -->
149152
</div>
150153
</div>
151154
</div>
155+
156+
<div class="space-y-2">
157+
<label for="visit-purpose" class="block text-sm font-medium text-gray-700">
158+
<svg class="inline w-4 h-4 mr-1 text-gray-500 align-middle" fill="none" stroke="currentColor" viewBox="0 0 24 24">
159+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
160+
</svg>
161+
<span class="align-middle">Visit Purpose <span class="text-gray-700">*</span></span>
162+
</label>
163+
164+
<select id="visit-purpose" name="visit-purpose"
165+
required
166+
class="mt-1 block w-full pl-3 pr-10 py-3 text-base border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md shadow-sm transition-colors">
167+
<option value="">-- Select purpose --</option>
168+
169+
@for (VisitPurpose purpose : VisitPurpose.values())
170+
<option value="${purpose.getFormValue()}">${purpose.getDisplayName()}</option>
171+
@endfor
172+
</select>
173+
</div>
152174
</div>
153175

154-
<!-- Submit Button -->
155176
<div class="flex justify-center pt-4">
156177
<button type="submit"
157178
id="send-otp-btn"
158-
disabled class="px-8 py-4 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed transition-colors min-w-48 text-lg relative flex items-center justify-center"> <span class="htmx-indicator:hidden">Send OTP</span>
179+
disabled class="px-8 py-4 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed transition-colors min-w-48 text-lg relative flex items-center justify-center">
180+
<span class="htmx-indicator:hidden">Send OTP</span>
159181
<span class="htmx-indicator absolute inset-0 flex items-center justify-center">
160182
<svg class="inline animate-spin h-5 w-5 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
161183
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
@@ -166,33 +188,31 @@
166188
</button>
167189
</div>
168190
</div>
191+
<div class="mt-6 text-center text-sm text-gray-500">
192+
By checking in, you agree to our visitor policies and terms of service.
193+
</div>
169194
</form>
170-
171-
<!-- Footer -->
172-
<div class="mt-6 text-center text-sm text-gray-500">
173-
By checking in, you agree to our visitor policies and terms of service.
174-
</div>
175195
</div>
176196
</div>
177197

178-
<!-- Removed a small duplicate autocomplete handler here in favor of the more complete handlers below -->
179-
180198
<script>
181199
// Form validation (host is not mandatory)
182200
function validateForm() {
183201
const name = document.getElementById('name').value;
184202
const email = document.getElementById('email').value;
185203
const phone = document.getElementById('phone').value;
186204
const company = document.getElementById('company').value;
205+
const govtId = document.getElementById('govtId').value;
206+
const visitPurpose = document.getElementById('visit-purpose').value;
187207
188-
const isValid = name && email && phone && company;
208+
const isValid = name && email && phone && company && govtId && visitPurpose;
189209
document.getElementById('send-otp-btn').disabled = !isValid;
190210
}
191211
192212
document.querySelectorAll('input[required]').forEach(input => {
193213
input.addEventListener('input', validateForm);
194214
});
195-
215+
document.getElementById('visit-purpose').addEventListener('change', validateForm);
196216
validateForm();
197217
</script>
198218

0 commit comments

Comments
 (0)