817 lines
27 KiB
HTML
817 lines
27 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="vi">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Ghi nhận công trình hoàn thành - Worker App</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css">
|
|
<style>
|
|
:root {
|
|
--primary-color: #2563eb;
|
|
--primary-dark: #1d4ed8;
|
|
--secondary-color: #64748b;
|
|
--success-color: #10b981;
|
|
--warning-color: #f59e0b;
|
|
--danger-color: #ef4444;
|
|
--background-color: #f8fafc;
|
|
--card-background: #ffffff;
|
|
--text-primary: #1e293b;
|
|
--text-secondary: #64748b;
|
|
--border-color: #e2e8f0;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background-color: var(--background-color);
|
|
color: var(--text-primary);
|
|
line-height: 1.6;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
.header {
|
|
background: var(--card-background);
|
|
border-bottom: 1px solid var(--border-color);
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 100;
|
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.header-content {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 1rem;
|
|
max-width: 480px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.back-button {
|
|
background: none;
|
|
border: none;
|
|
color: var(--primary-color);
|
|
font-size: 1.25rem;
|
|
cursor: pointer;
|
|
padding: 0.5rem;
|
|
border-radius: 0.5rem;
|
|
transition: background-color 0.2s;
|
|
}
|
|
|
|
.back-button:hover {
|
|
background-color: #f1f5f9;
|
|
}
|
|
|
|
.header-title {
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
text-align: center;
|
|
}
|
|
|
|
.container {
|
|
max-width: 480px;
|
|
margin: 0 auto;
|
|
background: var(--card-background);
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.content {
|
|
padding: 1rem;
|
|
padding-bottom: 120px;
|
|
}
|
|
|
|
.intro-section {
|
|
background: linear-gradient(135deg, #dbeafe, #bfdbfe);
|
|
border: 1px solid var(--primary-color);
|
|
border-radius: 1rem;
|
|
padding: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.intro-icon {
|
|
width: 60px;
|
|
height: 60px;
|
|
background: var(--primary-color);
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto 1rem;
|
|
color: white;
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.intro-title {
|
|
font-size: 1.125rem;
|
|
font-weight: 600;
|
|
color: var(--primary-color);
|
|
text-align: center;
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
.intro-text {
|
|
font-size: 0.875rem;
|
|
color: #1e40af;
|
|
text-align: center;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.points-info {
|
|
background: #ecfdf5;
|
|
border: 1px solid var(--success-color);
|
|
border-radius: 0.75rem;
|
|
padding: 1rem;
|
|
margin-bottom: 2rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.points-title {
|
|
font-size: 0.875rem;
|
|
font-weight: 600;
|
|
color: var(--success-color);
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.points-text {
|
|
font-size: 0.75rem;
|
|
color: #059669;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.form-section {
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
margin-bottom: 0.5rem;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.form-label.required::after {
|
|
content: " *";
|
|
color: var(--danger-color);
|
|
}
|
|
|
|
.form-input {
|
|
width: 100%;
|
|
padding: 0.75rem;
|
|
border: 2px solid var(--border-color);
|
|
border-radius: 0.75rem;
|
|
font-size: 1rem;
|
|
background: white;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.form-input:focus {
|
|
outline: none;
|
|
border-color: var(--primary-color);
|
|
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
|
|
}
|
|
|
|
.form-textarea {
|
|
min-height: 80px;
|
|
resize: vertical;
|
|
}
|
|
|
|
.date-input {
|
|
appearance: none;
|
|
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3e%3c/rect%3e%3cline x1='16' y1='2' x2='16' y2='6'%3e%3c/line%3e%3cline x1='8' y1='2' x2='8' y2='6'%3e%3c/line%3e%3cline x1='3' y1='10' x2='21' y2='10'%3e%3c/line%3e%3c/svg%3e");
|
|
background-repeat: no-repeat;
|
|
background-position: right 0.75rem center;
|
|
background-size: 1.25rem;
|
|
padding-right: 3rem;
|
|
}
|
|
|
|
.products-section {
|
|
background: #f8fafc;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 0.75rem;
|
|
padding: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.products-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.products-title {
|
|
font-size: 0.875rem;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.add-product-btn {
|
|
background: var(--primary-color);
|
|
color: white;
|
|
border: none;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 0.5rem;
|
|
font-size: 0.75rem;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.add-product-btn:hover {
|
|
background: var(--primary-dark);
|
|
}
|
|
|
|
.products-list {
|
|
display: grid;
|
|
grid-template-columns: 1fr;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.product-item {
|
|
background: white;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 0.5rem;
|
|
padding: 0.75rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.product-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.product-name {
|
|
font-size: 0.875rem;
|
|
font-weight: 500;
|
|
color: var(--text-primary);
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.product-details {
|
|
font-size: 0.75rem;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.remove-product-btn {
|
|
background: none;
|
|
border: none;
|
|
color: var(--danger-color);
|
|
cursor: pointer;
|
|
padding: 0.25rem;
|
|
border-radius: 0.25rem;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.remove-product-btn:hover {
|
|
background: #fee2e2;
|
|
}
|
|
|
|
.empty-products {
|
|
text-align: center;
|
|
padding: 2rem;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.empty-products i {
|
|
font-size: 2rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.images-section {
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.images-upload {
|
|
border: 2px dashed var(--border-color);
|
|
border-radius: 1rem;
|
|
padding: 2rem 1rem;
|
|
text-align: center;
|
|
transition: all 0.2s;
|
|
background: #fafafa;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.images-upload:hover {
|
|
border-color: var(--primary-color);
|
|
background: #f0f8ff;
|
|
}
|
|
|
|
.images-upload.dragover {
|
|
border-color: var(--primary-color);
|
|
background: var(--primary-color);
|
|
color: white;
|
|
}
|
|
|
|
.upload-icon {
|
|
font-size: 2.5rem;
|
|
color: var(--secondary-color);
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.images-upload.dragover .upload-icon {
|
|
color: white;
|
|
}
|
|
|
|
.upload-title {
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.images-upload.dragover .upload-title {
|
|
color: white;
|
|
}
|
|
|
|
.upload-desc {
|
|
font-size: 0.875rem;
|
|
color: var(--text-secondary);
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.images-upload.dragover .upload-desc {
|
|
color: white;
|
|
}
|
|
|
|
.upload-requirements {
|
|
font-size: 0.75rem;
|
|
color: var(--text-secondary);
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.images-upload.dragover .upload-requirements {
|
|
color: white;
|
|
}
|
|
|
|
.images-preview {
|
|
display: none;
|
|
margin-top: 1rem;
|
|
}
|
|
|
|
.images-preview.show {
|
|
display: block;
|
|
}
|
|
|
|
.images-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
|
gap: 0.75rem;
|
|
margin-top: 1rem;
|
|
}
|
|
|
|
.image-item {
|
|
position: relative;
|
|
aspect-ratio: 1;
|
|
border-radius: 0.5rem;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.image-thumbnail {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.remove-image-btn {
|
|
position: absolute;
|
|
top: 0.25rem;
|
|
right: 0.25rem;
|
|
background: var(--danger-color);
|
|
color: white;
|
|
border: none;
|
|
width: 20px;
|
|
height: 20px;
|
|
border-radius: 50%;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 0.75rem;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.remove-image-btn:hover {
|
|
transform: scale(1.1);
|
|
}
|
|
|
|
.submit-button {
|
|
width: 100%;
|
|
background: linear-gradient(135deg, var(--success-color), #059669);
|
|
color: white;
|
|
border: none;
|
|
padding: 1rem;
|
|
border-radius: 0.75rem;
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.3s;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.5rem;
|
|
margin-top: 2rem;
|
|
}
|
|
|
|
.submit-button:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
|
|
}
|
|
|
|
.submit-button:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.content {
|
|
padding: 0.75rem;
|
|
padding-bottom: 120px;
|
|
}
|
|
|
|
.intro-section {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.images-upload {
|
|
padding: 1.5rem 0.75rem;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<!-- Header -->
|
|
<header class="header">
|
|
<div class="header-content">
|
|
<button class="back-button" onclick="goBack()">
|
|
<i class="fas fa-arrow-left"></i>
|
|
</button>
|
|
<h1 class="header-title">Ghi nhận công trình hoàn thành</h1>
|
|
<div style="width: 2.5rem;"></div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Content -->
|
|
<div class="content">
|
|
<!-- Introduction -->
|
|
<div class="intro-section">
|
|
<div class="intro-icon">
|
|
<i class="fas fa-building"></i>
|
|
</div>
|
|
<h2 class="intro-title">Chia sẻ thành quả của bạn</h2>
|
|
<p class="intro-text">
|
|
Gửi hình ảnh công trình đã hoàn thành để nhận thêm điểm thưởng và góp phần xây dựng
|
|
cộng đồng thầu thợ chuyên nghiệp.
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Points Information -->
|
|
<div class="points-info">
|
|
<div class="points-title">🎁 Quyền lợi khi ghi nhận công trình</div>
|
|
<div class="points-text">
|
|
• Nhận 50-200 điểm tùy theo quy mô công trình<br>
|
|
• Có cơ hội được giới thiệu trong mục "Dự án tiêu biểu"<br>
|
|
• Tăng uy tín và độ tin cậy với khách hàng
|
|
</div>
|
|
</div>
|
|
|
|
<form id="projectForm" onsubmit="submitForm(event)">
|
|
<!-- Project Basic Info -->
|
|
<div class="form-section">
|
|
<div class="form-group">
|
|
<label class="form-label required">Tên công trình</label>
|
|
<input type="text"
|
|
class="form-input"
|
|
id="projectName"
|
|
placeholder="Ví dụ: Biệt thự chị Lan - Quận 2"
|
|
required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label required">Địa chỉ công trình</label>
|
|
<input type="text"
|
|
class="form-input"
|
|
id="projectAddress"
|
|
placeholder="Nhập địa chỉ đầy đủ"
|
|
required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label required">Ngày hoàn thành</label>
|
|
<input type="date"
|
|
class="form-input date-input"
|
|
id="completionDate"
|
|
required
|
|
max="">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Products Used -->
|
|
<div class="form-section">
|
|
<div class="form-group">
|
|
<label class="form-label">Sản phẩm đã sử dụng</label>
|
|
<div class="products-section">
|
|
<div class="products-header">
|
|
<span class="products-title">Danh sách sản phẩm</span>
|
|
<button type="button" class="add-product-btn" onclick="addProduct()">
|
|
<i class="fas fa-plus"></i>
|
|
Thêm sản phẩm
|
|
</button>
|
|
</div>
|
|
|
|
<div class="products-list" id="productsList">
|
|
<div class="empty-products">
|
|
<i class="fas fa-cube"></i>
|
|
<div>Chưa có sản phẩm nào</div>
|
|
<small>Nhấn "Thêm sản phẩm" để bắt đầu</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Project Description -->
|
|
<div class="form-section">
|
|
<div class="form-group">
|
|
<label class="form-label">Mô tả công trình</label>
|
|
<textarea class="form-input form-textarea"
|
|
id="projectDescription"
|
|
placeholder="Mô tả về phong cách thiết kế, diện tích, đặc điểm nổi bật của công trình..."
|
|
rows="4"></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Images Upload -->
|
|
<div class="form-section">
|
|
<div class="form-group">
|
|
<label class="form-label required">Ảnh minh chứng công trình</label>
|
|
<div class="images-upload"
|
|
onclick="document.getElementById('imagesInput').click()"
|
|
ondrop="handleDrop(event)"
|
|
ondragover="handleDragOver(event)"
|
|
ondragenter="handleDragEnter(event)"
|
|
ondragleave="handleDragLeave(event)">
|
|
<div class="upload-icon">
|
|
<i class="fas fa-images"></i>
|
|
</div>
|
|
<div class="upload-title">Chụp ảnh hoặc chọn file</div>
|
|
<div class="upload-desc">Tải lên nhiều hình ảnh để thể hiện công trình của bạn</div>
|
|
<div class="upload-requirements">
|
|
• JPG, PNG tối đa 5MB mỗi file<br>
|
|
• Tối thiểu 3 hình ảnh, tối đa 10 hình ảnh<br>
|
|
• Nên có ảnh tổng thể và chi tiết
|
|
</div>
|
|
<input type="file"
|
|
id="imagesInput"
|
|
accept="image/*"
|
|
multiple
|
|
style="display: none;"
|
|
onchange="handleFileSelect(event)">
|
|
</div>
|
|
|
|
<div class="images-preview" id="imagesPreview">
|
|
<div class="images-grid" id="imagesGrid"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Submit Button -->
|
|
<button type="submit" class="submit-button" id="submitButton" disabled>
|
|
<i class="fas fa-paper-plane"></i>
|
|
Gửi duyệt công trình
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let selectedImages = [];
|
|
let selectedProducts = [];
|
|
|
|
// Set max date to today
|
|
document.getElementById('completionDate').max = new Date().toISOString().split('T')[0];
|
|
|
|
function goBack() {
|
|
window.history.back();
|
|
}
|
|
|
|
function addProduct() {
|
|
const productName = prompt('Nhập tên sản phẩm:');
|
|
if (productName) {
|
|
const quantity = prompt('Nhập số lượng (m² hoặc viên):');
|
|
if (quantity) {
|
|
const product = {
|
|
id: Date.now(),
|
|
name: productName,
|
|
quantity: quantity
|
|
};
|
|
|
|
selectedProducts.push(product);
|
|
updateProductsList();
|
|
validateForm();
|
|
}
|
|
}
|
|
}
|
|
|
|
function removeProduct(productId) {
|
|
selectedProducts = selectedProducts.filter(p => p.id !== productId);
|
|
updateProductsList();
|
|
validateForm();
|
|
}
|
|
|
|
function updateProductsList() {
|
|
const productsList = document.getElementById('productsList');
|
|
|
|
if (selectedProducts.length === 0) {
|
|
productsList.innerHTML = `
|
|
<div class="empty-products">
|
|
<i class="fas fa-cube"></i>
|
|
<div>Chưa có sản phẩm nào</div>
|
|
<small>Nhấn "Thêm sản phẩm" để bắt đầu</small>
|
|
</div>
|
|
`;
|
|
} else {
|
|
productsList.innerHTML = selectedProducts.map(product => `
|
|
<div class="product-item">
|
|
<div class="product-info">
|
|
<div class="product-name">${product.name}</div>
|
|
<div class="product-details">Số lượng: ${product.quantity}</div>
|
|
</div>
|
|
<button type="button" class="remove-product-btn" onclick="removeProduct(${product.id})">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
</div>
|
|
`).join('');
|
|
}
|
|
}
|
|
|
|
function handleFileSelect(event) {
|
|
const files = Array.from(event.target.files);
|
|
addImages(files);
|
|
}
|
|
|
|
function handleDrop(event) {
|
|
event.preventDefault();
|
|
const upload = document.querySelector('.images-upload');
|
|
upload.classList.remove('dragover');
|
|
|
|
const files = Array.from(event.dataTransfer.files);
|
|
addImages(files);
|
|
}
|
|
|
|
function handleDragOver(event) {
|
|
event.preventDefault();
|
|
}
|
|
|
|
function handleDragEnter(event) {
|
|
event.preventDefault();
|
|
const upload = document.querySelector('.images-upload');
|
|
upload.classList.add('dragover');
|
|
}
|
|
|
|
function handleDragLeave(event) {
|
|
event.preventDefault();
|
|
const upload = document.querySelector('.images-upload');
|
|
upload.classList.remove('dragover');
|
|
}
|
|
|
|
function addImages(files) {
|
|
files.forEach(file => {
|
|
if (file.type.startsWith('image/')) {
|
|
if (file.size <= 5 * 1024 * 1024) { // 5MB limit
|
|
if (selectedImages.length < 10) { // Max 10 images
|
|
selectedImages.push(file);
|
|
} else {
|
|
alert('Tối đa 10 hình ảnh được phép tải lên');
|
|
}
|
|
} else {
|
|
alert(`File "${file.name}" quá lớn. Vui lòng chọn file dưới 5MB.`);
|
|
}
|
|
} else {
|
|
alert(`File "${file.name}" không phải là hình ảnh hợp lệ.`);
|
|
}
|
|
});
|
|
|
|
updateImagesPreview();
|
|
validateForm();
|
|
}
|
|
|
|
function updateImagesPreview() {
|
|
const preview = document.getElementById('imagesPreview');
|
|
const grid = document.getElementById('imagesGrid');
|
|
|
|
if (selectedImages.length > 0) {
|
|
preview.classList.add('show');
|
|
grid.innerHTML = '';
|
|
|
|
selectedImages.forEach((file, index) => {
|
|
const reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
const imageItem = document.createElement('div');
|
|
imageItem.className = 'image-item';
|
|
imageItem.innerHTML = `
|
|
<img src="${e.target.result}" class="image-thumbnail" alt="Ảnh ${index + 1}">
|
|
<button type="button" class="remove-image-btn" onclick="removeImage(${index})">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
`;
|
|
grid.appendChild(imageItem);
|
|
};
|
|
reader.readAsDataURL(file);
|
|
});
|
|
} else {
|
|
preview.classList.remove('show');
|
|
}
|
|
}
|
|
|
|
function removeImage(index) {
|
|
selectedImages.splice(index, 1);
|
|
updateImagesPreview();
|
|
validateForm();
|
|
}
|
|
|
|
function validateForm() {
|
|
const projectName = document.getElementById('projectName').value;
|
|
const projectAddress = document.getElementById('projectAddress').value;
|
|
const completionDate = document.getElementById('completionDate').value;
|
|
const hasMinImages = selectedImages.length >= 3;
|
|
|
|
const isValid = projectName && projectAddress && completionDate && hasMinImages;
|
|
document.getElementById('submitButton').disabled = !isValid;
|
|
}
|
|
|
|
function submitForm(event) {
|
|
event.preventDefault();
|
|
|
|
if (selectedImages.length < 3) {
|
|
alert('Vui lòng tải lên ít nhất 3 hình ảnh của công trình.');
|
|
return;
|
|
}
|
|
|
|
const submitButton = document.getElementById('submitButton');
|
|
submitButton.disabled = true;
|
|
submitButton.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Đang gửi...';
|
|
|
|
// Simulate form submission
|
|
setTimeout(() => {
|
|
alert('Ghi nhận công trình đã được gửi thành công!\n\nChúng tôi sẽ xem xét và cập nhật điểm cho bạn trong vòng 2-3 ngày làm việc. Bạn sẽ nhận được thông báo khi có kết quả.');
|
|
window.history.back();
|
|
}, 2000);
|
|
}
|
|
|
|
// Add event listeners for validation
|
|
document.getElementById('projectName').addEventListener('input', validateForm);
|
|
document.getElementById('projectAddress').addEventListener('input', validateForm);
|
|
document.getElementById('completionDate').addEventListener('change', validateForm);
|
|
|
|
function showToast(message, type = 'info') {
|
|
const toast = document.createElement('div');
|
|
toast.className = `fixed top-20 left-1/2 transform -translate-x-1/2 px-4 py-2 rounded-lg z-50 transition-all duration-300 ${
|
|
type === 'success' ? 'bg-green-500' : 'bg-blue-500'
|
|
} text-white`;
|
|
toast.textContent = message;
|
|
document.body.appendChild(toast);
|
|
|
|
setTimeout(() => {
|
|
toast.style.opacity = '0';
|
|
setTimeout(() => {
|
|
document.body.removeChild(toast);
|
|
}, 300);
|
|
}, 3000);
|
|
}
|
|
|
|
// Animation on load
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const sections = document.querySelectorAll('.intro-section, .points-info, .form-section');
|
|
sections.forEach((section, index) => {
|
|
section.style.opacity = '0';
|
|
section.style.transform = 'translateY(20px)';
|
|
section.style.transition = 'all 0.5s ease';
|
|
|
|
setTimeout(() => {
|
|
section.style.opacity = '1';
|
|
section.style.transform = 'translateY(0)';
|
|
}, index * 100);
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |