first commit
This commit is contained in:
725
html/nha-mau-list.html
Normal file
725
html/nha-mau-list.html
Normal file
@@ -0,0 +1,725 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="vi">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Quản lý Nhà mẫu - 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);
|
||||
}
|
||||
|
||||
.add-button {
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.25rem;
|
||||
transition: all 0.3s;
|
||||
box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
|
||||
}
|
||||
|
||||
.add-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 480px;
|
||||
margin: 0 auto;
|
||||
background: var(--card-background);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.stats-section {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 1rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
background: var(--card-background);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 0.75rem;
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.stat-card:hover {
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
|
||||
}
|
||||
|
||||
.stat-number {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--primary-color);
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.search-section {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem 0.75rem 2.5rem;
|
||||
border: 2px solid var(--border-color);
|
||||
border-radius: 0.75rem;
|
||||
font-size: 1rem;
|
||||
background: white;
|
||||
transition: all 0.2s;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.search-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
|
||||
}
|
||||
|
||||
.search-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
position: absolute;
|
||||
left: 0.75rem;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: var(--text-secondary);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.filter-tabs {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 0.5rem;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.filter-tab {
|
||||
flex-shrink: 0;
|
||||
padding: 0.5rem 1rem;
|
||||
background: #f1f5f9;
|
||||
color: var(--text-secondary);
|
||||
border: none;
|
||||
border-radius: 1.5rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.filter-tab.active {
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.filter-tab:hover:not(.active) {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.nha-mau-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.nha-mau-card {
|
||||
background: var(--card-background);
|
||||
border-radius: 1rem;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
border: 1px solid var(--border-color);
|
||||
transition: all 0.3s ease;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nha-mau-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.nha-mau-image {
|
||||
width: 100%;
|
||||
height: 180px;
|
||||
object-fit: cover;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nha-mau-badge {
|
||||
position: absolute;
|
||||
top: 0.75rem;
|
||||
right: 0.75rem;
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 1rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nha-mau-content {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.nha-mau-title {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.nha-mau-desc {
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 1rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.nha-mau-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.meta-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.nha-mau-actions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
flex: 1;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background: var(--primary-dark);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: var(--card-background);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
border-color: var(--primary-color);
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 3rem 1rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
font-size: 4rem;
|
||||
color: var(--border-color);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.empty-desc {
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.create-first-btn {
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.75rem 2rem;
|
||||
border-radius: 0.75rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.create-first-btn:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
|
||||
}
|
||||
|
||||
.floating-create-btn {
|
||||
position: fixed;
|
||||
bottom: 80px;
|
||||
right: 1rem;
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.5rem;
|
||||
box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
|
||||
transition: all 0.3s;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.floating-create-btn:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.content {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.stats-section {
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.nha-mau-content {
|
||||
padding: 1rem;
|
||||
}
|
||||
}
|
||||
</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">Quản lý Nhà mẫu</h1>
|
||||
<button class="add-button" onclick="createNewNhaMau()">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="content">
|
||||
<!-- Statistics -->
|
||||
<div class="stats-section">
|
||||
<div class="stat-card">
|
||||
<div class="stat-number">12</div>
|
||||
<div class="stat-label">Tổng nhà mẫu</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-number">45</div>
|
||||
<div class="stat-label">Không gian</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-number">8</div>
|
||||
<div class="stat-label">Đã chia sẻ</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Search -->
|
||||
<div class="search-section">
|
||||
<div class="search-wrapper">
|
||||
<i class="fas fa-search search-icon"></i>
|
||||
<input type="text"
|
||||
class="search-input"
|
||||
placeholder="Tìm kiếm nhà mẫu..."
|
||||
oninput="searchNhaMau(this.value)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filter Tabs -->
|
||||
<div class="filter-tabs">
|
||||
<button class="filter-tab active" onclick="filterNhaMau('all')">Tất cả</button>
|
||||
<button class="filter-tab" onclick="filterNhaMau('active')">Đang sử dụng</button>
|
||||
<button class="filter-tab" onclick="filterNhaMau('shared')">Đã chia sẻ</button>
|
||||
<button class="filter-tab" onclick="filterNhaMau('draft')">Nháp</button>
|
||||
<button class="filter-tab" onclick="filterNhaMau('archived')">Lưu trữ</button>
|
||||
</div>
|
||||
|
||||
<!-- Nhà mẫu Grid -->
|
||||
<div class="nha-mau-grid" id="nhaMauGrid">
|
||||
<!-- Sample Nhà mẫu Cards -->
|
||||
<div class="nha-mau-card" onclick="openNhaMauDetail('villa-chi-lan')">
|
||||
<img src="https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?w=400&h=180&fit=crop"
|
||||
alt="Biệt thự chị Lan"
|
||||
class="nha-mau-image">
|
||||
<div class="nha-mau-badge">Hoàn thành</div>
|
||||
<div class="nha-mau-content">
|
||||
<h3 class="nha-mau-title">Biệt thự chị Lan - Quận 2</h3>
|
||||
<p class="nha-mau-desc">Biệt thự hiện đại 3 tầng với phong cách tối giản, sử dụng gạch men cao cấp nhập khẩu.</p>
|
||||
<div class="nha-mau-meta">
|
||||
<div class="meta-item">
|
||||
<i class="fas fa-home"></i>
|
||||
<span>8 không gian</span>
|
||||
</div>
|
||||
<div class="meta-item">
|
||||
<i class="fas fa-calendar"></i>
|
||||
<span>15/10/2024</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nha-mau-actions">
|
||||
<button class="action-btn btn-primary" onclick="event.stopPropagation(); createQuote('villa-chi-lan')">
|
||||
<i class="fas fa-file-alt"></i>
|
||||
Tạo báo giá
|
||||
</button>
|
||||
<button class="action-btn btn-secondary" onclick="event.stopPropagation(); shareNhaMau('villa-chi-lan')">
|
||||
<i class="fas fa-share-alt"></i>
|
||||
Chia sẻ
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nha-mau-card" onclick="openNhaMauDetail('nha-ong-anh-duc')">
|
||||
<img src="https://images.unsplash.com/photo-1570129477492-45c003edd2be?w=400&h=180&fit=crop"
|
||||
alt="Nhà ống anh Đức"
|
||||
class="nha-mau-image">
|
||||
<div class="nha-mau-badge">Đang thiết kế</div>
|
||||
<div class="nha-mau-content">
|
||||
<h3 class="nha-mau-title">Nhà ống anh Đức - Quận 1</h3>
|
||||
<p class="nha-mau-desc">Nhà phố 4 tầng với thiết kế thông minh, tối ưu không gian sống và làm việc.</p>
|
||||
<div class="nha-mau-meta">
|
||||
<div class="meta-item">
|
||||
<i class="fas fa-home"></i>
|
||||
<span>6 không gian</span>
|
||||
</div>
|
||||
<div class="meta-item">
|
||||
<i class="fas fa-calendar"></i>
|
||||
<span>12/10/2024</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nha-mau-actions">
|
||||
<button class="action-btn btn-primary" onclick="event.stopPropagation(); createQuote('nha-ong-anh-duc')">
|
||||
<i class="fas fa-file-alt"></i>
|
||||
Tạo báo giá
|
||||
</button>
|
||||
<button class="action-btn btn-secondary" onclick="event.stopPropagation(); shareNhaMau('nha-ong-anh-duc')">
|
||||
<i class="fas fa-share-alt"></i>
|
||||
Chia sẻ
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nha-mau-card" onclick="openNhaMauDetail('chung-cu-thao-dien')">
|
||||
<img src="https://images.unsplash.com/photo-1562663474-6cbb3eaa4d14?w=400&h=180&fit=crop"
|
||||
alt="Chung cư Thảo Điền"
|
||||
class="nha-mau-image">
|
||||
<div class="nha-mau-badge">Hoàn thành</div>
|
||||
<div class="nha-mau-content">
|
||||
<h3 class="nha-mau-title">Chung cư Thảo Điền - Quận 2</h3>
|
||||
<p class="nha-mau-desc">Căn hộ 3PN với phong cách Scandinavian, sử dụng gạch men tone màu sáng.</p>
|
||||
<div class="nha-mau-meta">
|
||||
<div class="meta-item">
|
||||
<i class="fas fa-home"></i>
|
||||
<span>5 không gian</span>
|
||||
</div>
|
||||
<div class="meta-item">
|
||||
<i class="fas fa-calendar"></i>
|
||||
<span>08/10/2024</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nha-mau-actions">
|
||||
<button class="action-btn btn-primary" onclick="event.stopPropagation(); createQuote('chung-cu-thao-dien')">
|
||||
<i class="fas fa-file-alt"></i>
|
||||
Tạo báo giá
|
||||
</button>
|
||||
<button class="action-btn btn-secondary" onclick="event.stopPropagation(); shareNhaMau('chung-cu-thao-dien')">
|
||||
<i class="fas fa-share-alt"></i>
|
||||
Chia sẻ
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Empty State (hidden by default) -->
|
||||
<div class="empty-state" id="emptyState" style="display: none;">
|
||||
<div class="empty-icon">
|
||||
<i class="fas fa-home"></i>
|
||||
</div>
|
||||
<h3 class="empty-title">Chưa có nhà mẫu nào</h3>
|
||||
<p class="empty-desc">
|
||||
Tạo nhà mẫu đầu tiên để bắt đầu quản lý các dự án thiết kế của bạn
|
||||
</p>
|
||||
<button class="create-first-btn" onclick="createNewNhaMau()">
|
||||
<i class="fas fa-plus"></i>
|
||||
Tạo nhà mẫu đầu tiên
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Floating Create Button -->
|
||||
<button class="floating-create-btn" onclick="createNewNhaMau()">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
|
||||
<script>
|
||||
function goBack() {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
function createNewNhaMau() {
|
||||
// Navigate to create new nhà mẫu page
|
||||
alert('Tính năng tạo nhà mẫu mới đang được phát triển');
|
||||
// In real app: window.location.href = 'nha-mau-create.html';
|
||||
}
|
||||
|
||||
function openNhaMauDetail(nhaMauId) {
|
||||
window.location.href = `nha-mau-detail.html?id=${nhaMauId}`;
|
||||
}
|
||||
|
||||
function createQuote(nhaMauId) {
|
||||
alert(`Tạo báo giá cho nhà mẫu: ${nhaMauId}`);
|
||||
// In real app: window.location.href = `quote-create.html?nha_mau=${nhaMauId}`;
|
||||
}
|
||||
|
||||
function shareNhaMau(nhaMauId) {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: 'Chia sẻ nhà mẫu',
|
||||
text: 'Xem nhà mẫu thiết kế này',
|
||||
url: `${window.location.origin}/nha-mau-detail.html?id=${nhaMauId}`
|
||||
}).catch(console.error);
|
||||
} else {
|
||||
const url = `${window.location.origin}/nha-mau-detail.html?id=${nhaMauId}`;
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
showToast('Đã sao chép link chia sẻ!');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function searchNhaMau(query) {
|
||||
const cards = document.querySelectorAll('.nha-mau-card');
|
||||
const emptyState = document.getElementById('emptyState');
|
||||
let visibleCount = 0;
|
||||
|
||||
cards.forEach(card => {
|
||||
const title = card.querySelector('.nha-mau-title').textContent.toLowerCase();
|
||||
const desc = card.querySelector('.nha-mau-desc').textContent.toLowerCase();
|
||||
const searchQuery = query.toLowerCase();
|
||||
|
||||
if (title.includes(searchQuery) || desc.includes(searchQuery) || searchQuery === '') {
|
||||
card.style.display = 'block';
|
||||
visibleCount++;
|
||||
} else {
|
||||
card.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// Show empty state if no results
|
||||
if (visibleCount === 0 && query !== '') {
|
||||
emptyState.style.display = 'block';
|
||||
emptyState.innerHTML = `
|
||||
<div class="empty-icon">
|
||||
<i class="fas fa-search"></i>
|
||||
</div>
|
||||
<h3 class="empty-title">Không tìm thấy nhà mẫu</h3>
|
||||
<p class="empty-desc">
|
||||
Không có nhà mẫu nào phù hợp với từ khóa "${query}"
|
||||
</p>
|
||||
`;
|
||||
} else {
|
||||
emptyState.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function filterNhaMau(type) {
|
||||
// Update active tab
|
||||
document.querySelectorAll('.filter-tab').forEach(tab => {
|
||||
tab.classList.remove('active');
|
||||
});
|
||||
event.target.classList.add('active');
|
||||
|
||||
// Filter cards based on type (demo implementation)
|
||||
const cards = document.querySelectorAll('.nha-mau-card');
|
||||
cards.forEach((card, index) => {
|
||||
// Simple demo filter - in real app, would check actual status
|
||||
if (type === 'all') {
|
||||
card.style.display = 'block';
|
||||
} else if (type === 'active') {
|
||||
// Show first 2 cards as active
|
||||
card.style.display = index < 2 ? 'block' : 'none';
|
||||
} else if (type === 'shared') {
|
||||
// Show cards with "Hoàn thành" badge as shared
|
||||
const badge = card.querySelector('.nha-mau-badge');
|
||||
card.style.display = badge && badge.textContent === 'Hoàn thành' ? 'block' : 'none';
|
||||
} else {
|
||||
// For other filters, hide all for demo
|
||||
card.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
showToast(`Đã lọc theo: ${getFilterName(type)}`);
|
||||
}
|
||||
|
||||
function getFilterName(type) {
|
||||
const names = {
|
||||
'all': 'Tất cả',
|
||||
'active': 'Đang sử dụng',
|
||||
'shared': 'Đã chia sẻ',
|
||||
'draft': 'Nháp',
|
||||
'archived': 'Lưu trữ'
|
||||
};
|
||||
return names[type] || 'Tất cả';
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// Animation on load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const cards = document.querySelectorAll('.nha-mau-card');
|
||||
cards.forEach((card, index) => {
|
||||
card.style.opacity = '0';
|
||||
card.style.transform = 'translateY(20px)';
|
||||
card.style.transition = 'all 0.5s ease';
|
||||
|
||||
setTimeout(() => {
|
||||
card.style.opacity = '1';
|
||||
card.style.transform = 'translateY(0)';
|
||||
}, index * 100);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user