Updated: add verification review detail
This commit is contained in:
@@ -5531,6 +5531,55 @@ def get_verification_details(record_id):
|
||||
'message': 'Error loading verification details'
|
||||
}), 500
|
||||
|
||||
@app.route('/verification-review/<int:record_id>')
|
||||
@login_required
|
||||
def verification_review_detail(record_id):
|
||||
"""Review a single verification photo on a dedicated page"""
|
||||
try:
|
||||
# Check permissions
|
||||
if session.get('role') not in ['admin', 'payroll', 'accounting']:
|
||||
flash('Access denied. Only administrators, payroll, and accounting staff can review verification photos.', 'error')
|
||||
return redirect(url_for('attendance_report'))
|
||||
|
||||
# Get the attendance record
|
||||
record = AttendanceData.query.get_or_404(record_id)
|
||||
|
||||
# Check if this record has verification
|
||||
if not record.verification_required:
|
||||
flash('This record does not require verification.', 'warning')
|
||||
return redirect(url_for('attendance_report'))
|
||||
|
||||
# Get the QR code information for additional context
|
||||
qr_code = QRCode.query.get(record.qr_code_id) if record.qr_code_id else None
|
||||
|
||||
# Log the access for audit trail
|
||||
logger_handler.logger.info(
|
||||
f"User {session.get('username')} ({session.get('role')}) "
|
||||
f"accessed verification review for record {record_id}"
|
||||
)
|
||||
|
||||
# Format date and time for display
|
||||
try:
|
||||
check_in_date = record.check_in_date.strftime('%m/%d/%Y') if record.check_in_date else 'N/A'
|
||||
except:
|
||||
check_in_date = str(record.check_in_date) if record.check_in_date else 'N/A'
|
||||
|
||||
try:
|
||||
check_in_time = record.check_in_time.strftime('%I:%M %p') if record.check_in_time else 'N/A'
|
||||
except:
|
||||
check_in_time = str(record.check_in_time) if record.check_in_time else 'N/A'
|
||||
|
||||
return render_template('verification_review_detail.html',
|
||||
record=record,
|
||||
qr_code=qr_code,
|
||||
check_in_date=check_in_date,
|
||||
check_in_time=check_in_time)
|
||||
|
||||
except Exception as e:
|
||||
logger_handler.logger.error(f"Error loading verification review detail: {e}")
|
||||
flash('Error loading verification details.', 'error')
|
||||
return redirect(url_for('attendance_report'))
|
||||
|
||||
@app.route('/api/attendance/stats')
|
||||
@admin_required
|
||||
def attendance_stats_api():
|
||||
|
||||
@@ -639,15 +639,15 @@ function createTableRow(record, displayIndex) {
|
||||
let locationAccuracyBadge;
|
||||
|
||||
if (record.verification_required && record.verification_status === 'pending') {
|
||||
// Show Review Needed badge for pending verification
|
||||
locationAccuracyBadge = `<span class="location-accuracy-badge badge-review-needed"
|
||||
onclick="openVerificationPhotoModal('${record.id}')"
|
||||
style="cursor: pointer;"
|
||||
// Show Review Needed badge for pending verification - LINK to review page
|
||||
locationAccuracyBadge = `<a href="/verification-review/${record.id}"
|
||||
class="location-accuracy-badge badge-review-needed"
|
||||
style="cursor: pointer; text-decoration: none;"
|
||||
title="Click to review verification photo - Distance: ${record.location_accuracy ? record.location_accuracy.toFixed(3) : 'N/A'} miles">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
Review Needed
|
||||
<small>(${record.location_accuracy ? record.location_accuracy.toFixed(3) : 'N/A'} mi)</small>
|
||||
</span>`;
|
||||
</a>`;
|
||||
} else if (record.verification_status === 'approved') {
|
||||
// Show Verified badge for approved verification
|
||||
locationAccuracyBadge = `<span class="location-accuracy-badge badge-verified"
|
||||
@@ -838,11 +838,11 @@ function createTableRow(record, displayIndex) {
|
||||
<div class="record-actions">
|
||||
${
|
||||
record.verification_required && record.verification_status === 'pending'
|
||||
? `<button onclick="openVerificationPhotoModal('${record.id}')"
|
||||
? `<a href="/verification-review/${record.id}"
|
||||
class="action-btn btn-review"
|
||||
title="Review Verification Photo">
|
||||
<i class="fas fa-camera"></i>
|
||||
</button>`
|
||||
</a>`
|
||||
: ''
|
||||
}
|
||||
${
|
||||
@@ -1177,236 +1177,3 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
console.log("Enhanced export functionality initialized");
|
||||
});
|
||||
|
||||
// ============================================
|
||||
// VERIFICATION PHOTO REVIEW FUNCTIONS
|
||||
// ============================================
|
||||
|
||||
/**
|
||||
* Open verification photo modal for review
|
||||
* @param {string} recordId - The attendance record ID
|
||||
*/
|
||||
function openVerificationPhotoModal(recordId) {
|
||||
console.log(`Opening verification photo modal for record: ${recordId}`);
|
||||
|
||||
const modal = document.getElementById("verificationPhotoModal");
|
||||
const modalBody = document.getElementById("verificationPhotoModalBody");
|
||||
|
||||
if (!modal || !modalBody) {
|
||||
console.error("Verification photo modal elements not found");
|
||||
return;
|
||||
}
|
||||
|
||||
// Show loading state
|
||||
modalBody.innerHTML = `
|
||||
<div class="verification-loading">
|
||||
<i class="fas fa-spinner fa-spin"></i>
|
||||
<p>Loading verification photo...</p>
|
||||
</div>
|
||||
`;
|
||||
|
||||
modal.style.display = "block";
|
||||
|
||||
// Fetch record details with verification photo
|
||||
fetch(`/api/attendance/${recordId}/verification-details`)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch verification details");
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((data) => {
|
||||
if (!data.success) {
|
||||
throw new Error(data.message || "Failed to load verification data");
|
||||
}
|
||||
|
||||
renderVerificationPhotoModal(data.record);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error loading verification photo:", error);
|
||||
modalBody.innerHTML = `
|
||||
<div class="verification-error">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
<p>Error loading verification photo. Please try again.</p>
|
||||
<button onclick="closeVerificationPhotoModal()" class="btn btn-secondary">Close</button>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Render verification photo modal content
|
||||
* @param {Object} record - The attendance record with verification data
|
||||
*/
|
||||
function renderVerificationPhotoModal(record) {
|
||||
const modalBody = document.getElementById("verificationPhotoModalBody");
|
||||
|
||||
const content = `
|
||||
<div class="verification-photo-review">
|
||||
<!-- Employee & Date Info -->
|
||||
<div class="verification-header-info">
|
||||
<h3>
|
||||
<i class="fas fa-user"></i>
|
||||
Employee: ${record.employee_id}
|
||||
</h3>
|
||||
<p>
|
||||
<i class="fas fa-calendar"></i>
|
||||
${record.check_in_date} at ${record.check_in_time}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Verification Photo -->
|
||||
<div class="verification-photo-container">
|
||||
${
|
||||
record.verification_photo
|
||||
? `<img src="${record.verification_photo}"
|
||||
alt="Verification Photo"
|
||||
class="verification-photo-large"
|
||||
onclick="window.open(this.src, '_blank')"
|
||||
style="cursor: zoom-in;"
|
||||
title="Click to view full size" />`
|
||||
: `<div class="no-photo">
|
||||
<i class="fas fa-image"></i>
|
||||
<p>No verification photo available</p>
|
||||
</div>`
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Location Details -->
|
||||
<div class="verification-details-grid">
|
||||
<div class="verification-detail-card">
|
||||
<h4>Location Name</h4>
|
||||
<p>${record.location_name}</p>
|
||||
</div>
|
||||
|
||||
<div class="verification-detail-card">
|
||||
<h4>Distance from QR</h4>
|
||||
<p>${parseFloat(record.location_accuracy).toFixed(3)} miles</p>
|
||||
</div>
|
||||
|
||||
<div class="verification-detail-card">
|
||||
<h4>Verification Status</h4>
|
||||
<p>
|
||||
<span class="verification-status-pending">
|
||||
<i class="fas fa-clock"></i>
|
||||
Pending Review
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="verification-detail-card">
|
||||
<h4>Device</h4>
|
||||
<p>${record.device_info || "Unknown"}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Address Information -->
|
||||
<div class="verification-detail-card" style="grid-column: 1 / -1;">
|
||||
<h4>Check-in Address</h4>
|
||||
<p>${record.checked_in_address || "No address recorded"}</p>
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="verification-actions">
|
||||
<button onclick="updateVerificationStatus(${
|
||||
record.id
|
||||
}, 'approved')" class="btn-approve">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
Approve Check-in
|
||||
</button>
|
||||
<button onclick="updateVerificationStatus(${
|
||||
record.id
|
||||
}, 'rejected')" class="btn-reject">
|
||||
<i class="fas fa-times-circle"></i>
|
||||
Reject Check-in
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
modalBody.innerHTML = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close verification photo modal
|
||||
*/
|
||||
function closeVerificationPhotoModal() {
|
||||
const modal = document.getElementById("verificationPhotoModal");
|
||||
if (modal) {
|
||||
modal.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update verification status (approve/reject)
|
||||
* @param {number} recordId - The attendance record ID
|
||||
* @param {string} status - The new status ('approved' or 'rejected')
|
||||
*/
|
||||
function updateVerificationStatus(recordId, status) {
|
||||
if (
|
||||
!confirm(
|
||||
`Are you sure you want to ${status} this verification?\n\nThis action will be logged for audit purposes.`
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Updating verification status for record ${recordId} to ${status}`);
|
||||
|
||||
// Show loading state
|
||||
const modalBody = document.getElementById("verificationPhotoModalBody");
|
||||
modalBody.innerHTML = `
|
||||
<div class="verification-loading">
|
||||
<i class="fas fa-spinner fa-spin"></i>
|
||||
<p>Updating verification status...</p>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Send update request
|
||||
fetch(`/verification-review/${recordId}/update`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
status: status,
|
||||
note: `Verification ${status} from attendance report review`,
|
||||
}),
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.success) {
|
||||
alert(
|
||||
`Verification ${status} successfully!\n\nThe page will reload to show the updated status.`
|
||||
);
|
||||
closeVerificationPhotoModal();
|
||||
// Reload the page to show updated status
|
||||
window.location.reload();
|
||||
} else {
|
||||
throw new Error(data.message || "Failed to update verification status");
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error updating verification status:", error);
|
||||
alert(`Error: ${error.message}\n\nPlease try again.`);
|
||||
// Reload modal to show previous state
|
||||
openVerificationPhotoModal(recordId);
|
||||
});
|
||||
}
|
||||
|
||||
// Close verification modal when clicking outside
|
||||
window.addEventListener("click", function (event) {
|
||||
const verificationModal = document.getElementById("verificationPhotoModal");
|
||||
|
||||
if (event.target === verificationModal) {
|
||||
closeVerificationPhotoModal();
|
||||
}
|
||||
});
|
||||
|
||||
// Keyboard shortcut for closing verification modal
|
||||
document.addEventListener("keydown", function (event) {
|
||||
if (event.key === "Escape") {
|
||||
closeVerificationPhotoModal();
|
||||
}
|
||||
});
|
||||
@@ -267,19 +267,19 @@
|
||||
</td>
|
||||
<td>
|
||||
{% if record.verification_required and record.verification_status == 'pending' %}
|
||||
<!-- Show Review Needed badge for pending verification -->
|
||||
<!-- Show Review Needed badge with link to review page -->
|
||||
<div class="location-accuracy-info">
|
||||
<span class="location-accuracy-badge badge-review-needed"
|
||||
onclick="openVerificationPhotoModal('{{ record.id }}')"
|
||||
style="cursor: pointer;"
|
||||
title="Click to review verification photo - Distance: {{ '%.3f'|format(record.location_accuracy) }} miles">
|
||||
<a href="{{ url_for('verification_review_detail', record_id=record.id) }}"
|
||||
class="location-accuracy-badge badge-review-needed"
|
||||
style="cursor: pointer; text-decoration: none;"
|
||||
title="Click to review verification photo - Distance: {{ '%.3f'|format(record.location_accuracy) }} miles">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
Review Needed
|
||||
<small>({{ '%.3f'|format(record.location_accuracy) }} mi)</small>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
{% elif record.verification_status == 'approved' %}
|
||||
<!-- Show Verified badge for approved verification -->
|
||||
<!-- Show Verified badge -->
|
||||
<div class="location-accuracy-info">
|
||||
<span class="location-accuracy-badge badge-verified"
|
||||
title="Verification approved - Distance: {{ '%.3f'|format(record.location_accuracy) }} miles">
|
||||
@@ -289,7 +289,7 @@
|
||||
</span>
|
||||
</div>
|
||||
{% elif record.verification_status == 'rejected' %}
|
||||
<!-- Show Rejected badge for rejected verification -->
|
||||
<!-- Show Rejected badge -->
|
||||
<div class="location-accuracy-info">
|
||||
<span class="location-accuracy-badge badge-rejected"
|
||||
title="Verification rejected - Distance: {{ '%.3f'|format(record.location_accuracy) }} miles">
|
||||
@@ -339,12 +339,12 @@
|
||||
<td>
|
||||
<div class="record-actions">
|
||||
{% if record.verification_required and record.verification_status == 'pending' %}
|
||||
<!-- Show Review button for pending verification -->
|
||||
<button onclick="openVerificationPhotoModal('{{ record.id }}')"
|
||||
class="action-btn btn-review"
|
||||
title="Review Verification Photo">
|
||||
<!-- Show Review button linking to review page -->
|
||||
<a href="{{ url_for('verification_review_detail', record_id=record.id) }}"
|
||||
class="action-btn btn-review"
|
||||
title="Review Verification Photo">
|
||||
<i class="fas fa-camera"></i>
|
||||
</button>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if session.role in ['admin', 'payroll', 'accounting'] %}
|
||||
@@ -399,7 +399,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Enhanced Record Details Modal -->
|
||||
<!-- Enhanced Record Details Modal - KEPT FOR OTHER FEATURES -->
|
||||
<div id="recordModal" class="modal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -417,7 +417,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Map Modal for Location Viewing -->
|
||||
<!-- Map Modal for Location Viewing - KEPT FOR OTHER FEATURES -->
|
||||
<div id="mapModal" class="modal">
|
||||
<div class="modal-content modal-large">
|
||||
<div class="modal-header">
|
||||
@@ -440,22 +440,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Verification Photo Review Modal -->
|
||||
<div id="verificationPhotoModal" class="modal">
|
||||
<div class="modal-content verification-modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>
|
||||
<i class="fas fa-camera-retro"></i>
|
||||
Verification Photo Review
|
||||
</h2>
|
||||
<button class="close-btn" onclick="closeVerificationPhotoModal()">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="verificationPhotoModalBody">
|
||||
<!-- Content will be populated by JavaScript -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
@@ -611,7 +595,7 @@ function viewRecordDetails(recordId) {
|
||||
modal.style.display = 'block';
|
||||
}
|
||||
|
||||
// OVERRIDE EDIT/DELETE FUNCTIONS WITH PROPER PERMISSION CHECKING
|
||||
// Edit and Delete functions
|
||||
function editRecord(recordId) {
|
||||
console.log('Edit function called for record:', recordId);
|
||||
|
||||
@@ -632,7 +616,7 @@ function deleteRecord(recordId, employeeId) {
|
||||
|
||||
// Check permissions before allowing delete
|
||||
if (!hasDeletePermission) {
|
||||
alert('Access denied. Only administrators and can delete attendance records.');
|
||||
alert('Access denied. Only administrators can delete attendance records.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,440 @@
|
||||
{% extends "base_authenticated.html" %}
|
||||
|
||||
{% block title %}Verification Review - QR Code Management{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
<style>
|
||||
.verification-review-page {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 30px 20px;
|
||||
}
|
||||
|
||||
.review-header {
|
||||
background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
|
||||
color: white;
|
||||
padding: 30px;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 30px;
|
||||
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
|
||||
}
|
||||
|
||||
.review-header h1 {
|
||||
margin: 0 0 10px 0;
|
||||
font-size: 2rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.review-header p {
|
||||
margin: 0;
|
||||
opacity: 0.9;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.review-content {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 30px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.review-section {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 25px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.review-section h2 {
|
||||
margin: 0 0 20px 0;
|
||||
font-size: 1.3rem;
|
||||
color: #1f2937;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding-bottom: 15px;
|
||||
border-bottom: 2px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #f3f4f6;
|
||||
}
|
||||
|
||||
.info-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
color: #6b7280;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.85rem;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #1f2937;
|
||||
font-weight: 600;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.distance-badge {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.distance-high {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
|
||||
.distance-medium {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
.distance-low {
|
||||
background: #d1fae5;
|
||||
color: #065f46;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
display: inline-block;
|
||||
padding: 8px 16px;
|
||||
border-radius: 20px;
|
||||
font-weight: 600;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
.status-approved {
|
||||
background: #d1fae5;
|
||||
color: #065f46;
|
||||
}
|
||||
|
||||
.status-rejected {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
|
||||
.photo-section {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.verification-photo {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
|
||||
display: block;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.no-photo {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
background: #f9fafb;
|
||||
border-radius: 12px;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.no-photo i {
|
||||
font-size: 4rem;
|
||||
margin-bottom: 20px;
|
||||
color: #d1d5db;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
justify-content: center;
|
||||
padding: 30px 20px;
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.action-buttons .btn {
|
||||
padding: 14px 40px;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
transition: all 0.2s;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.btn-approve {
|
||||
background: #10b981;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-approve:hover {
|
||||
background: #059669;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
|
||||
}
|
||||
|
||||
.btn-reject {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-reject:hover {
|
||||
background: #dc2626;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
.btn-back {
|
||||
background: #6b7280;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-back:hover {
|
||||
background: #4b5563;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(107, 114, 128, 0.3);
|
||||
}
|
||||
|
||||
.alert {
|
||||
padding: 15px 20px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.alert-warning {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
border-left: 4px solid #f59e0b;
|
||||
}
|
||||
|
||||
.alert-info {
|
||||
background: #dbeafe;
|
||||
color: #1e40af;
|
||||
border-left: 4px solid #3b82f6;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.review-content {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.action-buttons .btn {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.review-header h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="verification-review-page">
|
||||
<!-- Header -->
|
||||
<div class="review-header">
|
||||
<h1>
|
||||
<i class="fas fa-camera-retro"></i>
|
||||
Verification Photo Review
|
||||
</h1>
|
||||
<p>Review and approve/reject employee verification photo for off-site check-in</p>
|
||||
</div>
|
||||
|
||||
<!-- Alert for already reviewed records -->
|
||||
{% if record.verification_status != 'pending' %}
|
||||
<div class="alert alert-info">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
<span>This verification has already been {{ record.verification_status }}.</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Review Content -->
|
||||
<div class="review-content">
|
||||
<!-- Employee Information -->
|
||||
<div class="review-section">
|
||||
<h2>
|
||||
<i class="fas fa-user"></i>
|
||||
Employee Information
|
||||
</h2>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Employee ID</span>
|
||||
<span class="info-value">{{ record.employee_id }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Employee Name</span>
|
||||
<span class="info-value">{{ record.employee_name or 'Unknown' }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Check-in Date</span>
|
||||
<span class="info-value">{{ check_in_date }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Check-in Time</span>
|
||||
<span class="info-value">{{ check_in_time }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Status</span>
|
||||
<span class="info-value">
|
||||
<span class="status-badge status-{{ record.verification_status }}">
|
||||
{{ record.verification_status.upper() }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location Information -->
|
||||
<div class="review-section">
|
||||
<h2>
|
||||
<i class="fas fa-map-marker-alt"></i>
|
||||
Location Information
|
||||
</h2>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Location Name</span>
|
||||
<span class="info-value">{{ record.location_name or 'Unknown' }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Event</span>
|
||||
<span class="info-value">{{ record.location_event or 'N/A' }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Distance from QR</span>
|
||||
<span class="info-value">
|
||||
{% if record.location_accuracy %}
|
||||
{% if record.location_accuracy > 0.5 %}
|
||||
<span class="distance-badge distance-high">{{ "%.3f"|format(record.location_accuracy) }} miles</span>
|
||||
{% elif record.location_accuracy > 0.2 %}
|
||||
<span class="distance-badge distance-medium">{{ "%.3f"|format(record.location_accuracy) }} miles</span>
|
||||
{% else %}
|
||||
<span class="distance-badge distance-low">{{ "%.3f"|format(record.location_accuracy) }} miles</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">QR Address</span>
|
||||
<span class="info-value">{{ qr_code.address if qr_code else 'N/A' }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Check-in Address</span>
|
||||
<span class="info-value">{{ record.address or 'N/A' }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">Device</span>
|
||||
<span class="info-value">{{ record.device_info or 'Unknown' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Verification Photo -->
|
||||
<div class="review-section photo-section">
|
||||
<h2>
|
||||
<i class="fas fa-camera"></i>
|
||||
Verification Photo
|
||||
</h2>
|
||||
{% if record.verification_photo %}
|
||||
<img src="{{ record.verification_photo }}"
|
||||
alt="Verification Photo for {{ record.employee_id }}"
|
||||
class="verification-photo">
|
||||
{% else %}
|
||||
<div class="no-photo">
|
||||
<i class="fas fa-image"></i>
|
||||
<h3>No Photo Available</h3>
|
||||
<p>This record does not have a verification photo.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
{% if record.verification_status == 'pending' %}
|
||||
<div class="action-buttons">
|
||||
<button onclick="updateStatus('approved')" class="btn btn-approve">
|
||||
<i class="fas fa-check"></i>
|
||||
Approve Verification
|
||||
</button>
|
||||
<button onclick="updateStatus('rejected')" class="btn btn-reject">
|
||||
<i class="fas fa-times"></i>
|
||||
Reject Verification
|
||||
</button>
|
||||
<a href="{{ url_for('attendance_report') }}" class="btn btn-back">
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
Back to Attendance
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="action-buttons">
|
||||
<a href="{{ url_for('attendance_report') }}" class="btn btn-back">
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
Back to Attendance
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function updateStatus(status) {
|
||||
const confirmMessage = status === 'approved'
|
||||
? 'Are you sure you want to APPROVE this verification?'
|
||||
: 'Are you sure you want to REJECT this verification?';
|
||||
|
||||
if (!confirm(confirmMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`[LOG] Updating verification status to ${status} for record {{ record.id }}`);
|
||||
|
||||
// Send update request
|
||||
fetch('/verification-review/{{ record.id }}/update', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
status: status
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
console.log(`[LOG] Successfully updated verification status to ${status}`);
|
||||
alert(`Verification ${status} successfully!`);
|
||||
// Redirect back to attendance report
|
||||
window.location.href = '{{ url_for('attendance_report') }}';
|
||||
} else {
|
||||
throw new Error(data.message || 'Failed to update verification status');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('[ERROR] Failed to update verification status:', error);
|
||||
alert(`Error: ${error.message}`);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user