first commit

This commit is contained in:
Phuoc Nguyen
2025-10-17 15:37:58 +07:00
commit 2125e85d40
123 changed files with 27633 additions and 0 deletions

941
html/khong-gian-detail.html Normal file
View File

@@ -0,0 +1,941 @@
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chi tiết không gian - 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: 1.125rem;
font-weight: 600;
color: var(--text-primary);
}
.header-actions {
display: flex;
gap: 0.5rem;
}
.action-button {
background: none;
border: none;
color: var(--secondary-color);
font-size: 1.25rem;
cursor: pointer;
padding: 0.5rem;
border-radius: 0.5rem;
transition: all 0.2s;
}
.action-button:hover {
background-color: #f1f5f9;
color: var(--primary-color);
}
.container {
max-width: 480px;
margin: 0 auto;
background: var(--card-background);
min-height: 100vh;
}
.hero-section {
position: relative;
}
.hero-image {
width: 100%;
height: 200px;
object-fit: cover;
}
.hero-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
padding: 1.5rem 1rem 1rem;
color: white;
}
.space-title {
font-size: 1.25rem;
font-weight: 700;
margin-bottom: 0.25rem;
}
.space-subtitle {
font-size: 0.875rem;
opacity: 0.9;
}
.content {
padding: 1.5rem;
padding-bottom: 100px;
}
.summary-section {
background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
border: 1px solid var(--primary-color);
border-radius: 1rem;
padding: 1.5rem;
margin-bottom: 1.5rem;
}
.summary-title {
font-size: 1rem;
font-weight: 600;
color: var(--primary-color);
margin-bottom: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.summary-stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
}
.stat-item {
text-align: center;
}
.stat-number {
font-size: 1.25rem;
font-weight: 700;
color: var(--primary-color);
margin-bottom: 0.25rem;
}
.stat-label {
font-size: 0.75rem;
color: #1e40af;
}
.products-section {
margin-bottom: 1.5rem;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.section-title {
font-size: 1.125rem;
font-weight: 600;
color: var(--text-primary);
display: flex;
align-items: center;
gap: 0.5rem;
}
.add-product-btn {
background: var(--primary-color);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 2rem;
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
display: flex;
align-items: center;
gap: 0.5rem;
box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.add-product-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}
.products-grid {
display: grid;
grid-template-columns: 1fr;
gap: 1rem;
}
.product-card {
background: var(--card-background);
border: 1px solid var(--border-color);
border-radius: 0.75rem;
overflow: hidden;
transition: all 0.2s;
position: relative;
}
.product-card:hover {
border-color: var(--primary-color);
box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}
.product-content {
display: flex;
gap: 1rem;
padding: 1rem;
}
.product-image {
width: 80px;
height: 80px;
border-radius: 0.5rem;
object-fit: cover;
flex-shrink: 0;
}
.product-info {
flex: 1;
min-width: 0;
}
.product-title {
font-size: 0.875rem;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 0.25rem;
line-height: 1.3;
}
.product-code {
font-size: 0.75rem;
color: var(--text-secondary);
margin-bottom: 0.5rem;
font-family: monospace;
}
.product-details {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5rem;
}
.product-quantity {
font-size: 0.875rem;
color: var(--text-primary);
font-weight: 500;
}
.product-unit {
font-size: 0.75rem;
color: var(--text-secondary);
}
.product-actions {
display: flex;
gap: 0.5rem;
}
.action-btn {
background: none;
border: 1px solid var(--border-color);
color: var(--text-secondary);
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
font-size: 0.75rem;
cursor: pointer;
transition: all 0.2s;
}
.action-btn:hover {
border-color: var(--primary-color);
color: var(--primary-color);
}
.delete-btn {
position: absolute;
top: 0.75rem;
right: 0.75rem;
background: var(--danger-color);
color: white;
border: none;
width: 24px;
height: 24px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
transition: all 0.2s;
opacity: 0.8;
}
.delete-btn:hover {
opacity: 1;
transform: scale(1.1);
}
.empty-products {
text-align: center;
padding: 3rem 1rem;
background: #f8fafc;
border: 2px dashed var(--border-color);
border-radius: 1rem;
color: var(--text-secondary);
}
.empty-icon {
font-size: 3rem;
margin-bottom: 1rem;
color: var(--border-color);
}
.empty-title {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: 0.5rem;
color: var(--text-primary);
}
.empty-desc {
font-size: 0.875rem;
margin-bottom: 1.5rem;
}
.categories-section {
margin-bottom: 1.5rem;
}
.categories-tabs {
display: flex;
gap: 0.5rem;
overflow-x: auto;
padding-bottom: 0.5rem;
-webkit-overflow-scrolling: touch;
margin-bottom: 1rem;
}
.category-tab {
flex-shrink: 0;
padding: 0.5rem 1rem;
background: #f1f5f9;
color: var(--text-secondary);
border: none;
border-radius: 1.5rem;
font-size: 0.75rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
}
.category-tab.active {
background: var(--primary-color);
color: white;
}
.category-tab:hover:not(.active) {
background: #e2e8f0;
}
.action-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: var(--card-background);
border-top: 1px solid var(--border-color);
padding: 1rem;
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
z-index: 50;
}
.action-bar-content {
max-width: 480px;
margin: 0 auto;
display: flex;
gap: 0.75rem;
}
.secondary-action-btn {
flex: 1;
background: var(--card-background);
color: var(--secondary-color);
border: 2px solid var(--border-color);
padding: 0.75rem;
border-radius: 0.75rem;
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
.secondary-action-btn:hover {
border-color: var(--primary-color);
color: var(--primary-color);
}
.primary-action-btn {
flex: 2;
background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
color: white;
border: none;
padding: 0.75rem;
border-radius: 0.75rem;
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
.primary-action-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}
@media (max-width: 480px) {
.content {
padding: 1rem;
padding-bottom: 100px;
}
.summary-stats {
grid-template-columns: repeat(2, 1fr);
gap: 0.75rem;
}
.product-content {
gap: 0.75rem;
padding: 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" id="headerTitle">Phòng khách</h1>
<div class="header-actions">
<button class="action-button" onclick="editSpace()">
<i class="fas fa-edit"></i>
</button>
<button class="action-button" onclick="shareSpace()">
<i class="fas fa-share-alt"></i>
</button>
</div>
</div>
</header>
<!-- Hero Section -->
<div class="hero-section">
<img src="https://images.unsplash.com/photo-1586023492125-27b2c045efd7?w=800&h=300&fit=crop"
alt="Phòng khách"
class="hero-image" id="heroImage">
<div class="hero-overlay">
<h1 class="space-title" id="spaceTitle">Phòng khách</h1>
<p class="space-subtitle">Biệt thự chị Lan - Quận 2</p>
</div>
</div>
<!-- Content -->
<div class="content">
<!-- Summary Section -->
<div class="summary-section">
<h3 class="summary-title">
<i class="fas fa-chart-bar"></i>
Tổng quan không gian
</h3>
<div class="summary-stats">
<div class="stat-item">
<div class="stat-number" id="totalProducts">24</div>
<div class="stat-label">Sản phẩm</div>
</div>
<div class="stat-item">
<div class="stat-number" id="totalArea">45.2</div>
<div class="stat-label">m² gạch</div>
</div>
<div class="stat-item">
<div class="stat-number" id="totalValue">85.5</div>
<div class="stat-label">Triệu VNĐ</div>
</div>
</div>
</div>
<!-- Categories Filter -->
<div class="categories-section">
<div class="categories-tabs">
<button class="category-tab active" onclick="filterProducts('all')">Tất cả</button>
<button class="category-tab" onclick="filterProducts('gach-lat')">Gạch lát</button>
<button class="category-tab" onclick="filterProducts('gach-op')">Gạch ốp</button>
<button class="category-tab" onclick="filterProducts('phu-kien')">Phụ kiện</button>
<button class="category-tab" onclick="filterProducts('keo-dan')">Keo dán</button>
</div>
</div>
<!-- Products Section -->
<div class="products-section">
<div class="section-header">
<h2 class="section-title">
<i class="fas fa-cube"></i>
Sản phẩm đã ráp
</h2>
<button class="add-product-btn" onclick="addNewProduct()">
<i class="fas fa-plus"></i>
Thêm sản phẩm
</button>
</div>
<div class="products-grid" id="productsGrid">
<!-- Sample Products -->
<div class="product-card" data-category="gach-lat">
<button class="delete-btn" onclick="removeProduct(this)">
<i class="fas fa-times"></i>
</button>
<div class="product-content">
<img src="https://images.unsplash.com/photo-1586023492125-27b2c045efd7?w=80&h=80&fit=crop"
alt="Gạch granite"
class="product-image">
<div class="product-info">
<h3 class="product-title">Gạch granite Viglacera UB6606</h3>
<div class="product-code">Mã SP: UB6606</div>
<div class="product-details">
<span class="product-quantity">32.5 m²</span>
<span class="product-unit">60x60cm</span>
</div>
<div class="product-actions">
<button class="action-btn" onclick="editQuantity(this)">
<i class="fas fa-edit"></i> Sửa
</button>
<button class="action-btn" onclick="viewProduct(this)">
<i class="fas fa-eye"></i> Xem
</button>
</div>
</div>
</div>
</div>
<div class="product-card" data-category="gach-op">
<button class="delete-btn" onclick="removeProduct(this)">
<i class="fas fa-times"></i>
</button>
<div class="product-content">
<img src="https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?w=80&h=80&fit=crop"
alt="Gạch ốp tường"
class="product-image">
<div class="product-info">
<h3 class="product-title">Gạch ốp tường Eurotile EUR-W3012</h3>
<div class="product-code">Mã SP: EUR-W3012</div>
<div class="product-details">
<span class="product-quantity">18.4 m²</span>
<span class="product-unit">30x60cm</span>
</div>
<div class="product-actions">
<button class="action-btn" onclick="editQuantity(this)">
<i class="fas fa-edit"></i> Sửa
</button>
<button class="action-btn" onclick="viewProduct(this)">
<i class="fas fa-eye"></i> Xem
</button>
</div>
</div>
</div>
</div>
<div class="product-card" data-category="keo-dan">
<button class="delete-btn" onclick="removeProduct(this)">
<i class="fas fa-times"></i>
</button>
<div class="product-content">
<img src="https://images.unsplash.com/photo-1545558014-8692077e9b5c?w=80&h=80&fit=crop"
alt="Keo dán gạch"
class="product-image">
<div class="product-info">
<h3 class="product-title">Keo dán gạch Sakrete Premium</h3>
<div class="product-code">Mã SP: SAK-PR25</div>
<div class="product-details">
<span class="product-quantity">12 bao</span>
<span class="product-unit">25kg/bao</span>
</div>
<div class="product-actions">
<button class="action-btn" onclick="editQuantity(this)">
<i class="fas fa-edit"></i> Sửa
</button>
<button class="action-btn" onclick="viewProduct(this)">
<i class="fas fa-eye"></i> Xem
</button>
</div>
</div>
</div>
</div>
<div class="product-card" data-category="phu-kien">
<button class="delete-btn" onclick="removeProduct(this)">
<i class="fas fa-times"></i>
</button>
<div class="product-content">
<img src="https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=80&h=80&fit=crop"
alt="Nẹp inox"
class="product-image">
<div class="product-info">
<h3 class="product-title">Nẹp inox viền gạch T10</h3>
<div class="product-code">Mã SP: NEP-T10</div>
<div class="product-details">
<span class="product-quantity">45 m</span>
<span class="product-unit">10mm</span>
</div>
<div class="product-actions">
<button class="action-btn" onclick="editQuantity(this)">
<i class="fas fa-edit"></i> Sửa
</button>
<button class="action-btn" onclick="viewProduct(this)">
<i class="fas fa-eye"></i> Xem
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Empty State (hidden by default) -->
<div class="empty-products" id="emptyProducts" style="display: none;">
<div class="empty-icon">
<i class="fas fa-cube"></i>
</div>
<h3 class="empty-title">Chưa có sản phẩm nào</h3>
<p class="empty-desc">
Thêm sản phẩm đầu tiên để bắt đầu thiết kế không gian này
</p>
<button class="add-product-btn" onclick="addNewProduct()">
<i class="fas fa-plus"></i>
Thêm sản phẩm đầu tiên
</button>
</div>
</div>
</div>
</div>
<!-- Action Bar -->
<div class="action-bar">
<div class="action-bar-content">
<button class="secondary-action-btn" onclick="saveAsDraft()">
<i class="fas fa-save"></i>
Lưu nháp
</button>
<button class="primary-action-btn" onclick="createQuote()">
<i class="fas fa-file-alt"></i>
Tạo báo giá từ không gian này
</button>
</div>
</div>
<script>
function goBack() {
window.history.back();
}
function editSpace() {
alert('Tính năng chỉnh sửa thông tin không gian đang được phát triển');
}
function shareSpace() {
if (navigator.share) {
navigator.share({
title: 'Phòng khách - Biệt thự chị Lan',
text: 'Xem thiết kế không gian này',
url: window.location.href
}).catch(console.error);
} else {
navigator.clipboard.writeText(window.location.href).then(() => {
showToast('Đã sao chép link chia sẻ!');
});
}
}
function addNewProduct() {
// Navigate to products page in selection mode
const currentSpace = new URLSearchParams(window.location.search).get('space') || 'phong-khach';
const nhaMau = new URLSearchParams(window.location.search).get('nha_mau') || 'villa-chi-lan';
// In real app, would navigate to products with return context
alert('Sẽ chuyển đến trang sản phẩm để chọn thêm sản phẩm cho không gian này');
// window.location.href = `products.html?mode=select&return_space=${currentSpace}&nha_mau=${nhaMau}`;
}
function removeProduct(button) {
const card = button.closest('.product-card');
const productTitle = card.querySelector('.product-title').textContent;
if (confirm(`Bạn có chắc chắn muốn xóa "${productTitle}" khỏi không gian này?`)) {
card.style.animation = 'slideOut 0.3s ease-out';
setTimeout(() => {
card.remove();
updateSummary();
checkEmptyState();
}, 300);
showToast('Đã xóa sản phẩm khỏi không gian');
}
}
function editQuantity(button) {
const card = button.closest('.product-card');
const quantityElement = card.querySelector('.product-quantity');
const currentQuantity = quantityElement.textContent;
const newQuantity = prompt(`Nhập số lượng mới:`, currentQuantity);
if (newQuantity && newQuantity !== currentQuantity) {
quantityElement.textContent = newQuantity;
updateSummary();
showToast('Đã cập nhật số lượng sản phẩm');
}
}
function viewProduct(button) {
const card = button.closest('.product-card');
const productCode = card.querySelector('.product-code').textContent.replace('Mã SP: ', '');
// Navigate to product detail
alert(`Xem chi tiết sản phẩm: ${productCode}`);
// In real app: window.location.href = `product-detail.html?code=${productCode}`;
}
function filterProducts(category) {
// Update active tab
document.querySelectorAll('.category-tab').forEach(tab => {
tab.classList.remove('active');
});
event.target.classList.add('active');
// Filter products
const products = document.querySelectorAll('.product-card');
let visibleCount = 0;
products.forEach(product => {
const productCategory = product.getAttribute('data-category');
if (category === 'all' || productCategory === category) {
product.style.display = 'block';
visibleCount++;
} else {
product.style.display = 'none';
}
});
// Show empty state if no products match filter
const emptyState = document.getElementById('emptyProducts');
if (visibleCount === 0) {
emptyState.style.display = 'block';
emptyState.innerHTML = `
<div class="empty-icon">
<i class="fas fa-search"></i>
</div>
<h3 class="empty-title">Không có sản phẩm trong danh mục này</h3>
<p class="empty-desc">
Thêm sản phẩm ${getCategoryName(category)} để hiển thị tại đây
</p>
<button class="add-product-btn" onclick="addNewProduct()">
<i class="fas fa-plus"></i>
Thêm sản phẩm
</button>
`;
} else {
emptyState.style.display = 'none';
}
showToast(`Đã lọc theo: ${getCategoryName(category)}`);
}
function getCategoryName(category) {
const names = {
'all': 'Tất cả',
'gach-lat': 'Gạch lát',
'gach-op': 'Gạch ốp',
'phu-kien': 'Phụ kiện',
'keo-dan': 'Keo dán'
};
return names[category] || 'Tất cả';
}
function updateSummary() {
// Demo function to update summary stats
const products = document.querySelectorAll('.product-card:not([style*="display: none"])');
document.getElementById('totalProducts').textContent = products.length;
// In real app, would calculate actual area and value from product data
const area = (products.length * 2.1).toFixed(1);
const value = (products.length * 3.5).toFixed(1);
document.getElementById('totalArea').textContent = area;
document.getElementById('totalValue').textContent = value;
}
function checkEmptyState() {
const products = document.querySelectorAll('.product-card');
const emptyState = document.getElementById('emptyProducts');
if (products.length === 0) {
emptyState.style.display = 'block';
} else {
emptyState.style.display = 'none';
}
}
function saveAsDraft() {
showToast('Đã lưu không gian vào nháp');
}
function createQuote() {
const spaceTitle = document.getElementById('spaceTitle').textContent;
alert(`Tạo báo giá từ "${spaceTitle}" với ${document.getElementById('totalProducts').textContent} sản phẩm`);
// In real app: window.location.href = 'quote-create.html?space=' + encodeURIComponent(spaceTitle);
}
function showToast(message) {
const toast = document.createElement('div');
toast.className = 'fixed top-20 left-1/2 transform -translate-x-1/2 bg-green-500 text-white px-4 py-2 rounded-lg z-50 transition-all duration-300';
toast.textContent = message;
document.body.appendChild(toast);
setTimeout(() => {
toast.style.opacity = '0';
setTimeout(() => {
document.body.removeChild(toast);
}, 300);
}, 2000);
}
// Initialize page based on URL parameters
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
const spaceId = urlParams.get('space') || 'phong-khach';
// Update space info based on ID (demo)
const spaceInfo = {
'phong-khach': {
title: 'Phòng khách',
image: 'https://images.unsplash.com/photo-1586023492125-27b2c045efd7?w=800&h=300&fit=crop'
},
'phong-bep': {
title: 'Phòng bếp',
image: 'https://images.unsplash.com/photo-1556909114-f6e7ad7d3136?w=800&h=300&fit=crop'
},
'phong-ngu-master': {
title: 'Phòng ngủ master',
image: 'https://images.unsplash.com/photo-1560448204-61dc36dc98c8?w=800&h=300&fit=crop'
},
'phong-tam-master': {
title: 'Phòng tắm master',
image: 'https://images.unsplash.com/photo-1503387762-592deb58ef4e?w=800&h=300&fit=crop'
}
};
const info = spaceInfo[spaceId] || spaceInfo['phong-khach'];
document.getElementById('headerTitle').textContent = info.title;
document.getElementById('spaceTitle').textContent = info.title;
document.getElementById('heroImage').src = info.image;
// Add CSS for animations
const style = document.createElement('style');
style.textContent = `
@keyframes slideOut {
0% {
opacity: 1;
transform: translateX(0);
}
100% {
opacity: 0;
transform: translateX(100%);
}
}
`;
document.head.appendChild(style);
// Animate products on load
const products = document.querySelectorAll('.product-card');
products.forEach((product, index) => {
product.style.opacity = '0';
product.style.transform = 'translateY(20px)';
product.style.transition = 'all 0.5s ease';
setTimeout(() => {
product.style.opacity = '1';
product.style.transform = 'translateY(0)';
}, index * 100);
});
});
</script>
</body>
</html>