anycoder-fa97cfd1 / index.html
dev110de's picture
Upload folder using huggingface_hub
7ff6297 verified
Raw History Blame Contribute Delete
45.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ARIA COSMETIC | CMS</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap"
rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Chart.js -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
brand: {
red: '#D90429',
dark: '#2B2D42',
light: '#EDF2F4',
gray: '#8D99AE'
}
},
fontFamily: {
serif: ['"Playfair Display"', 'serif'],
sans: ['"DM Sans"', 'sans-serif'],
}
}
}
}
</script>
<style>
body {
font-family: 'DM Sans', sans-serif;
background-color: #f8f9fa;
}
h1,
h2,
h3,
h4,
h5,
h6,
.font-serif {
font-family: 'Playfair Display', serif;
}
.glass-panel {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.nav-item.active {
background-color: #D90429;
color: white;
box-shadow: 0 4px 6px -1px rgba(217, 4, 41, 0.3);
}
.fade-in {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #D90429;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #b10322;
}
.loader {
border-top-color: #D90429;
-webkit-animation: spinner 1.5s linear infinite;
animation: spinner 1.5s linear infinite;
}
@keyframes spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.company-card {
transition: all 0.3s ease;
}
.company-card:hover {
transform: translateY(-4px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.tab-active {
border-bottom: 2px solid #D90429;
color: #D90429;
}
.animate-pulse-slow {
animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: .7;
}
}
</style>
</head>
<body class="text-gray-800 h-screen flex overflow-hidden">
<!-- Sidebar -->
<aside class="w-64 bg-white border-r border-gray-200 flex-col hidden md:flex z-20 shadow-lg">
<div class="h-20 flex items-center justify-center border-b border-gray-100">
<div class="flex items-center gap-2">
<div
class="w-8 h-8 bg-brand-red rounded-full flex items-center justify-center text-white font-serif font-bold text-xl">
A</div>
<span class="font-serif text-2xl font-bold text-gray-900 tracking-tight">ARIA <span class="text-brand-red">CMS</span></span>
</div>
</div>
<nav class="flex-1 py-6 px-3 space-y-1 overflow-y-auto">
<button onclick="router('dashboard')" id="nav-dashboard" class="nav-item active w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-xl transition-all duration-200 text-gray-600 hover:bg-gray-50 hover:text-brand-red">
<i class="fa-solid fa-chart-pie w-5"></i> Dashboard
</button>
<button onclick="router('products')" id="nav-products" class="nav-item w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-xl transition-all duration-200 text-gray-600 hover:bg-gray-50 hover:text-brand-red">
<i class="fa-solid fa-pump-soap w-5"></i> Products
</button>
<button onclick="router('add-product')" id="nav-add-product" class="nav-item w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-xl transition-all duration-200 text-gray-600 hover:bg-gray-50 hover:text-brand-red">
<i class="fa-solid fa-plus-circle w-5"></i> Add Product
</button>
<button onclick="router('companies')" id="nav-companies" class="nav-item w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-xl transition-all duration-200 text-gray-600 hover:bg-gray-50 hover:text-brand-red">
<i class="fa-solid fa-building w-5"></i> Companies
</button>
<button onclick="router('certificates')" id="nav-certificates" class="nav-item w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-xl transition-all duration-200 text-gray-600 hover:bg-gray-50 hover:text-brand-red">
<i class="fa-solid fa-certificate w-5"></i> Certificates
</button>
<button onclick="router('support')" id="nav-support" class="nav-item w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-xl transition-all duration-200 text-gray-600 hover:bg-gray-50 hover:text-brand-red">
<i class="fa-solid fa-headset w-5"></i> Support
</button>
</nav>
<div class="p-4 border-t border-gray-100">
<div class="flex items-center gap-3">
<img src="https://ui-avatars.com/api/?name=Admin+User&background=D90429&color=fff" class="w-10 h-10 rounded-full border-2 border-white shadow-sm" alt="Admin">
<div>
<p class="text-sm font-bold text-gray-900">Admin User</p>
<p class="text-xs text-gray-500">Regulatory Manager</p>
</div>
</div>
</div>
</aside>
<!-- Main Content -->
<main class="flex-1 flex flex-col h-screen overflow-hidden relative">
<!-- Top Header -->
<header class="h-20 bg-white border-b border-gray-200 flex items-center justify-between px-6 lg:px-10 z-10">
<div class="flex items-center gap-4 md:hidden">
<button class="text-gray-600 hover:text-brand-red"><i class="fa-solid fa-bars text-xl"></i></button>
<span class="font-serif font-bold text-xl">ARIA</span>
</div>
<div
class="hidden md:flex items-center text-gray-400 bg-gray-50 px-4 py-2 rounded-full w-96 border border-gray-200 focus-within:border-brand-red focus-within:ring-1 focus-within:ring-brand-red transition-all">
<i class="fa-solid fa-search mr-3"></i>
<input type="text" id="global-search" placeholder="Search products, companies, ingredients..." class="bg-transparent border-none outline-none text-sm w-full text-gray-700 placeholder-gray-400">
</div>
<div class="flex items-center gap-4">
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank"
class="hidden lg:block text-xs font-medium text-gray-500 hover:text-brand-red transition-colors">
Built with anycoder
</a>
<button class="relative p-2 text-gray-400 hover:text-brand-red transition-colors">
<i class="fa-solid fa-bell text-xl"></i>
<span class="absolute top-1 right-1 w-2 h-2 bg-brand-red rounded-full border border-white"></span>
</button>
</div>
</header>
<!-- Dynamic Content Area -->
<div id="app-content" class="flex-1 overflow-y-auto p-6 lg:p-10 bg-gray-50 relative">
<!-- Views will be injected here -->
</div>
</main>
<!-- Toast Notification -->
<div id="toast"
class="fixed bottom-5 right-5 bg-gray-900 text-white px-6 py-4 rounded-lg shadow-2xl transform translate-y-20 opacity-0 transition-all duration-300 z-50 flex items-center gap-3">
<i class="fa-solid fa-check-circle text-green-400"></i>
<span id="toast-msg">Operation successful</span>
</div>
<!-- Company Modal -->
<div id="company-modal" class="fixed inset-0 bg-black/50 backdrop-blur-sm z-50 hidden items-center justify-center p-4">
<div class="bg-white rounded-2xl shadow-2xl w-full max-w-4xl max-h-[90vh] overflow-y-auto">
<div class="sticky top-0 bg-white border-b border-gray-100 p-6 flex justify-between items-center">
<h3 class="text-2xl font-serif font-bold text-gray-900" id="modal-title">Add New Company</h3>
<button onclick="closeCompanyModal()" class="text-gray-400 hover:text-gray-600 transition">
<i class="fa-solid fa-xmark text-2xl"></i>
</button>
</div>
<div class="p-6" id="modal-content">
<!-- Form content injected here -->
</div>
</div>
</div>
<!-- JavaScript Application Logic -->
<script>
// --- Mock Data & State ---
const state = {
currentView: 'dashboard',
products: [
{
id: 1,
name: "Angel's Liquid Red Serum",
brand: "ARIA",
series: "Premium",
category: "Serum",
skinType: "All",
price: 45.00,
stock: 120,
inci: "Water, Niacinamide, Hyaluronic Acid, Red Ginseng Extract",
cpnp: "CPNP-2023-001",
rp: "ARIA Cosmetic EU GmbH",
image: "https://images.unsplash.com/photo-1620916566398-39f1143ab7be?ixlib=rb-4.0.3&auto=format&fit=crop&w=600&q=80",
expiry: "2025-12-01",
pao: "12M"
},
{
id: 2,
name: "Hydra Glow Moisturizer",
brand: "ARIA",
series: "Daily",
category: "Moisturizer",
skinType: "Dry",
price: 32.50,
stock: 85,
inci: "Aqua, Glycerin, Ceramide NP, Squalane",
cpnp: "CPNP-2023-042",
rp: "ARIA Cosmetic EU GmbH",
image: "https://images.unsplash.com/photo-1556228720-19875c4b84b2?ixlib=rb-4.0.3&auto=format&fit=crop&w=600&q=80",
expiry: "2026-05-15",
pao: "6M"
},
{
id: 3,
name: "Pure Clean Foaming Wash",
brand: "ARIA",
series: "Daily",
category: "Cleanser",
skinType: "Oily",
price: 24.00,
stock: 200,
inci: "Water, Coco-Glucoside, Salicylic Acid, Tea Tree Oil",
cpnp: "CPNP-2023-089",
rp: "ARIA Cosmetic EU GmbH",
image: "https://images.unsplash.com/photo-1556228578-0d85b1a4d571?ixlib=rb-4.0.3&auto=format&fit=crop&w=600&q=80",
expiry: "2025-08-20",
pao: "12M"
},
{
id: 4,
name: "Midnight Repair Cream",
brand: "ARIA",
series: "Night",
category: "Cream",
skinType: "Mature",
price: 58.00,
stock: 45,
inci: "Retinol, Peptides, Shea Butter, Jojoba Oil",
cpnp: "CPNP-2024-010",
rp: "ARIA Cosmetic EU GmbH",
image: "https://images.unsplash.com/photo-1616683693504-3ea7e9ad6fec?ixlib=rb-4.0.3&auto=format&fit=crop&w=600&q=80",
expiry: "2025-11-30",
pao: "6M"
}
],
certificates: [
{ id: 1, name: "ISO 22716 (GMP)", authority: "Bureau Veritas", date: "2023-01-15", type: "pdf" },
{ id: 2, name: "Vegan Society Certified", authority: "The Vegan Society", date: "2023-06-20", type: "img" },
{ id: 3, name: "Leaping Bunny Approved", authority: "CCIC", date: "2023-03-10", type: "pdf" },
{ id: 4, name: "ECOCERT Organic", authority: "ECOCERT", date: "2022-11-05", type: "img" }
],
companies: [
{
id: 1,
name: "ARIA Cosmetic EU GmbH",
legalName: "ARIA Cosmetic Europe GmbH",
type: "Responsible Person",
registrationNumber: "HRB 123456",
vatNumber: "DE123456789",
establishedDate: "2018-03-15",
website: "https://aria-cosmetic.eu",
email: "regulatory@aria-cosmetic.eu",
phone: "+49 30 12345678",
address: {
street: "Friedrichstraße 123",
city: "Berlin",
postalCode: "10117",
country: "Germany"
},
regulatoryContact: {
name: "Dr. Sarah Mueller",
email: "s.mueller@aria-cosmetic.eu",
phone: "+49 30 12345679"
},
certifications: ["ISO 22716", "GMP Certified"],
status: "active",
logo: "https://ui-avatars.com/api/?name=ARIA+EU&background=D90429&color=fff&size=128",
description: "European headquarters and Responsible Person for ARIA Cosmetic products in the EU market.",
documents: [
{ name: "Business Registration", type: "pdf", date: "2018-03-15" },
{ name: "ISO 22716 Certificate", type: "pdf", date: "2023-01-15" }
]
},
{
id: 2,
name: "ARIA Cosmetic Korea Ltd.",
legalName: "아리아 코스메틱 주식회사",
type: "Manufacturer",
registrationNumber: "123-45-67890",
vatNumber: "KR1234567890",
establishedDate: "2015-06-20",
website: "https://aria-cosmetic.kr",
email: "info@aria-cosmetic.kr",
phone: "+82 2 1234 5678",
address: {
street: "Gangnam-daero 123",
city: "Seoul",
postalCode: "06234",
country: "South Korea"
},
regulatoryContact: {
name: "Kim Min-jae",
email: "minjae.kim@aria-cosmetic.kr",
phone: "+82 2 1234 5679"
},
certifications: ["KFDA", "CGMP", "ISO 22716"],
status: "active",
logo: "https://ui-avatars.com/api/?name=ARIA+KR&background=2B2D42&color=fff&size=128",
description: "Primary manufacturing facility and R&D center for ARIA Cosmetic products.",
documents: [
{ name: "KFDA Registration", type: "pdf", date: "2023-06-20" },
{ name: "Manufacturing License", type: "pdf", date: "2023-01-10" }
]
},
{
id: 3,
name: "ARIA Cosmetic USA Inc.",
legalName: "ARIA Cosmetic USA Inc.",
type: "Distributor",
registrationNumber: "DE1234567",
vatNumber: "US12-3456789",
establishedDate: "2020-01-10",
website: "https://aria-cosmetic.us",
email: "contact@aria-cosmetic.us",
phone: "+1 212 555 0123",
address: {
street: "5th Avenue 789",
city: "New York",
postalCode: "10001",
country: "United States"
},
regulatoryContact: {
name: "Jennifer Walsh",
email: "j.walsh@aria-cosmetic.us",
phone: "+1 212 555 0124"
},
certifications: ["FDA Registered", "cGMP"],
status: "active",
logo: "https://ui-avatars.com/api/?name=ARIA+US&background=8D99AE&color=fff&size=128",
description: "US distribution center handling North American market operations.",
documents: [
{ name: "FDA Registration", type: "pdf", date: "2023-03-15" },
{ name: "US Agent Agreement", type: "pdf", date: "2020-01-10" }
]
}
],
editingCompany: null
};
// --- Router ---
function router(view) {
state.currentView = view;
document.querySelectorAll('.nav-item').forEach(el => el.classList.remove('active', 'bg-brand-red', 'text-white', 'shadow-lg'));
document.querySelectorAll('.nav-item').forEach(el => el.classList.add('text-gray-600'));
const activeNav = document.getElementById(`nav-${view}`);
if(activeNav) {
activeNav.classList.add('active');
activeNav.classList.remove('text-gray-600');
}
const content = document.getElementById('app-content');
content.innerHTML = '';
content.classList.remove('fade-in');
void content.offsetWidth;
content.classList.add('fade-in');
switch(view) {
case 'dashboard': renderDashboard(); break;
case 'products': renderProducts(); break;
case 'add-product': renderAddProduct(); break;
case 'companies': renderCompanies(); break;
case 'certificates': renderCertificates(); break;
case 'support': renderSupport(); break;
default: renderDashboard();
}
}
// --- Render Functions ---
function renderDashboard() {
const totalProducts = state.products.length;
const lowStock = state.products.filter(p => p.stock < 50).length;
const totalCompanies = state.companies.length;
const activeCompanies = state.companies.filter(c => c.status === 'active').length;
const html = `
<div class="space-y-8">
<div class="flex justify-between items-end">
<div>
<h2 class="text-3xl font-serif font-bold text-gray-900">Dashboard</h2>
<p class="text-gray-500 mt-1">Welcome back, here's what's happening today.</p>
</div>
<button onclick="router('add-product')" class="bg-brand-red hover:bg-red-700 text-white px-6 py-2.5 rounded-lg shadow-lg shadow-red-200 transition-all flex items-center gap-2">
<i class="fa-solid fa-plus"></i> New Product
</button>
</div>
<!-- Stats Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
<div class="bg-white p-6 rounded-2xl shadow-sm border border-gray-100 flex items-center justify-between">
<div>
<p class="text-sm text-gray-500 font-medium">Total Products</p>
<h3 class="text-3xl font-bold text-gray-900 mt-1">${totalProducts}</h3>
</div>
<div class="w-12 h-12 bg-red-50 rounded-full flex items-center justify-center text-brand-red text-xl">
<i class="fa-solid fa-box-open"></i>
</div>
</div>
<div class="bg-white p-6 rounded-2xl shadow-sm border border-gray-100 flex items-center justify-between">
<div>
<p class="text-sm text-gray-500 font-medium">Companies</p>
<h3 class="text-3xl font-bold text-blue-600 mt-1">${totalCompanies}</h3>
</div>
<div class="w-12 h-12 bg-blue-50 rounded-full flex items-center justify-center text-blue-600 text-xl">
<i class="fa-solid fa-building"></i>
</div>
</div>
<div class="bg-white p-6 rounded-2xl shadow-sm border border-gray-100 flex items-center justify-between">
<div>
<p class="text-sm text-gray-500 font-medium">Low Stock Alerts</p>
<h3 class="text-3xl font-bold text-brand-red mt-1">${lowStock}</h3>
</div>
<div class="w-12 h-12 bg-red-50 rounded-full flex items-center justify-center text-brand-red text-xl">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
</div>
<div class="bg-white p-6 rounded-2xl shadow-sm border border-gray-100 flex items-center justify-between">
<div>
<p class="text-sm text-gray-500 font-medium">Active Certs</p>
<h3 class="text-3xl font-bold text-green-600 mt-1">${state.certificates.length}</h3>
</div>
<div class="w-12 h-12 bg-green-50 rounded-full flex items-center justify-center text-green-600 text-xl">
<i class="fa-solid fa-shield-check"></i>
</div>
</div>
</div>
<!-- Charts Section -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div class="bg-white p-6 rounded-2xl shadow-sm border border-gray-100 lg:col-span-2">
<h3 class="font-serif font-bold text-lg mb-4">Inventory Distribution</h3>
<canvas id="inventoryChart" height="100"></canvas>
</div>
<div class="bg-white p-6 rounded-2xl shadow-sm border border-gray-100">
<h3 class="font-serif font-bold text-lg mb-4">Companies Overview</h3>
<div class="space-y-4">
${state.companies.slice(0, 3).map(c => `
<div class="flex items-center gap-3 p-3 rounded-xl hover:bg-gray-50 transition cursor-pointer" onclick="router('companies')">
<img src="${c.logo}" class="w-10 h-10 rounded-lg" alt="${c.name}">
<div class="flex-1 min-w-0">
<p class="text-sm font-bold text-gray-900 truncate">${c.name}</p>
<p class="text-xs text-gray-500">${c.type} • ${c.address.country}</p>
</div>
<span class="px-2 py-1 text-xs font-medium rounded-full ${c.status === 'active' ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-600'}">
${c.status}
</span>
</div>
`).join('')}
<button onclick="router('companies')" class="w-full py-2 text-sm text-brand-red border border-brand-red/20 rounded-lg hover:bg-brand-red hover:text-white transition-colors">
View All Companies
</button>
</div>
</div>
</div>
</div>
`;
document.getElementById('app-content').innerHTML = html;
setTimeout(() => {
const ctx = document.getElementById('inventoryChart').getContext('2d');
new Chart(ctx, {
type: 'bar',
data: {
labels: state.products.map(p => p.name),
datasets: [{
label: 'Stock Level',
data: state.products.map(p => p.stock),
backgroundColor: '#D90429',
borderRadius: 6,
}]
},
options: {
responsive: true,
scales: {
y: { beginAtZero: true, grid: { display: false } },
x: { grid: { display: false } }
},
plugins: { legend: { display: false } }
}
});
}, 100);
}
function renderProducts() {
let html = `
<div class="space-y-6">
<div class="flex flex-col md:flex-row justify-between items-center gap-4">
<h2 class="text-3xl font-serif font-bold text-gray-900">Product Inventory</h2>
<div class="flex gap-3 w-full md:w-auto">
<select id="filter-category" onchange="filterProducts()" class="bg-white border border-gray-300 text-gray-700 text-sm rounded-lg focus:ring-brand-red focus:border-brand-red block p-2.5">
<option value="All">All Categories</option>
<option value="Serum">Serum</option>
<option value="Moisturizer">Moisturizer</option>
<option value="Cleanser">Cleanser</option>
</select>
<button onclick="router('add-product')" class="bg-brand-red text-white px-4 py-2 rounded-lg hover:bg-red-700 transition shadow-md">
<i class="fa-solid fa-plus"></i> Add
</button>
</div>
</div>
<div id="product-grid" class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6">
</div>
</div>
`;
document.getElementById('app-content').innerHTML = html;
renderProductGrid(state.products);
}
function renderProductGrid(products) {
const grid = document.getElementById('product-grid');
if(products.length === 0) {
grid.innerHTML = `<div class="col-span-full text-center py-20 text-gray-500">No products found matching your criteria.</div>`;
return;
}
grid.innerHTML = products.map(p => `
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden hover:shadow-xl transition-all duration-300 group">
<div class="h-48 overflow-hidden relative">
<img src="${p.image}" alt="${p.name}" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
<div class="absolute top-3 right-3 bg-white/90 backdrop-blur px-2 py-1 rounded-md text-xs font-bold text-gray-800 shadow-sm">
${p.category}
</div>
</div>
<div class="p-5">
<div class="flex justify-between items-start mb-2">
<div>
<p class="text-xs text-brand-red font-bold uppercase tracking-wider">${p.brand}</p>
<h3 class="font-serif text-xl font-bold text-gray-900 leading-tight">${p.name}</h3>
</div>
<span class="font-sans font-bold text-gray-900">$${p.price.toFixed(2)}</span>
</div>
<div class="flex flex-wrap gap-2 my-3">
<span class="px-2 py-1 bg-gray-100 text-gray-600 text-xs rounded-md">${p.skinType} Skin</span>
<span class="px-2 py-1 bg-gray-100 text-gray-600 text-xs rounded-md">PAO: ${p.pao}</span>
</div>
<div class="border-t border-gray-100 pt-4 mt-2">
<div class="flex justify-between items-center text-xs text-gray-500 mb-2">
<span>Stock: <b class="${p.stock < 50 ? 'text-brand-red' : 'text-green-600'}">${p.stock} units</b></span>
<span>CPNP: ${p.cpnp}</span>
</div>
<button onclick="alert('View details for ${p.name}')" class="w-full py-2 border border-gray-200 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-brand-red transition-colors">
View Details
</button>
</div>
</div>
</div>
`).join('');
}
function filterProducts() {
const cat = document.getElementById('filter-category').value;
const filtered = cat === 'All' ? state.products : state.products.filter(p => p.category === cat);
renderProductGrid(filtered);
}
function renderAddProduct() {
const html = `
<div class="max-w-4xl mx-auto">
<h2 class="text-3xl font-serif font-bold text-gray-900 mb-6">Add New Product</h2>
<form id="product-form" onsubmit="handleProductSubmit(event)" class="bg-white rounded-2xl shadow-sm border border-gray-100 p-8 space-y-6">
<div class="bg-blue-50 border border-blue-100 rounded-xl p-4 flex items-start gap-4 mb-6">
<div class="bg-blue-100 p-2 rounded-lg text-blue-600">
<i class="fa-solid fa-wand-magic-sparkles"></i>
</div>
<div class="flex-1">
<h4 class="font-bold text-blue-900 text-sm">AI Assistant</h4>
<p class="text-xs text-blue-700 mb-2">Enter the product name below and click "Generate" to auto-create SEO title, description, and regulatory warnings.</p>
<div class="flex gap-2">
<input type="text" id="ai-input" placeholder="e.g. Vitamin C Brightening Serum" class="flex-1 text-sm border-blue-200 rounded-md px-3 py-1.5 focus:ring-2 focus:ring-blue-400 outline-none">
<button type="button" onclick="generateAIContent()" class="bg-blue-600 text-white text-xs px-4 py-1.5 rounded-md hover:bg-blue-700 transition">Generate</button>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">Product Name</label>
<input type="text" name="name" required class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red focus:ring-1 focus:ring-brand-red outline-none transition">
</div>
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">Company/Brand</label>
<select name="brand" class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none bg-white">
${state.companies.map(c => `<option value="${c.name}">${c.name}</option>`).join('')}
<option value="ARIA">ARIA (Default)</option>
</select>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">Category</label>
<select name="category" class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none bg-white">
<option>Serum</option>
<option>Moisturizer</option>
<option>Cleanser</option>
<option>Cream</option>
</select>
</div>
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">Skin Type</label>
<select name="skinType" class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none bg-white">
<option>All</option>
<option>Dry</option>
<option>Oily</option>
<option>Sensitive</option>
<option>Mature</option>
</select>
</div>
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">Price ($)</label>
<input type="number" name="price" step="0.01" required class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none">
</div>
</div>
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">INCI Ingredients (Comma separated)</label>
<textarea name="inci" rows="2" class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none text-sm"></textarea>
</div>
<div class="border-t border-gray-100 pt-6 mt-6">
<h3 class="font-serif font-bold text-lg mb-4 text-gray-800">Regulatory Information</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">Responsible Person (Company)</label>
<select name="rp" class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none bg-white">
${state.companies.filter(c => c.type === 'Responsible Person').map(c => `<option value="${c.name}">${c.name}</option>`).join('')}
</select>
</div>
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">CPNP Number</label>
<input type="text" name="cpnp" placeholder="e.g. CPNP-2024-XXX" class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none">
</div>
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">Expiry Date</label>
<input type="date" name="expiry" class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none">
</div>
<div class="space-y-2">
<label class="text-sm font-bold text-gray-700">Period After Opening (PAO)</label>
<select name="pao" class="w-full border border-gray-300 rounded-lg px-4 py-2.5 focus:border-brand-red outline-none bg-white">
<option>6M</option>
<option>12M</option>
<option>24M</option>
</select>
</div>
</div>
</div>
<div class="pt-6 flex justify-end gap-4">
<button type="button" onclick="router('products')" class="px-6 py-2.5 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 font-medium transition">Cancel</button>
<button type="submit" class="px-6 py-2.5 bg-brand-red text-white rounded-lg hover:bg-red-700 font-medium shadow-lg shadow-red-200 transition transform active:scale-95">Save Product</button>
</div>
</form>
</div>
`;
document.getElementById('app-content').innerHTML = html;
}
function generateAIContent() {
const input = document.getElementById('ai-input').value;
if(!input) return showToast('Please enter a product name first', 'error');
const btn = document.querySelector('button[onclick="generateAIContent()"]');
const originalText = btn.innerText;
btn.innerHTML = '<i class="fa-solid fa-circle-notch fa-spin"></i>';
btn.disabled = true;
setTimeout(() => {
const form = document.getElementById('product-form');
form.name.value = input;
form.inci.value = "Aqua, Glycerin, Niacinamide, Hyaluronic Acid, [AI Generated Base]";
showToast('AI generated content applied!');
btn.innerText = originalText;
btn.disabled = false;
}, 1500);
}
function handleProductSubmit(e) {
e.preventDefault();
const formData = new FormData(e.target);
const newProduct = {
id: Date.now(),
name: formData.get('name'),
brand: formData.get('brand'),
category: formData.get('category'),
skinType: formData.get('skinType'),
price: parseFloat(formData.get('price')),
stock: 0,
inci: formData.get('inci'),
cpnp: formData.get('cpnp'),
rp: formData.get('rp'),
image: "https://images.unsplash.com/photo-1608248597279-f99d160bfbc8?ixlib=rb-4.0.3&auto=format&fit=crop&w=600&q=80",
expiry: formData.get('expiry'),
pao: formData.get('pao')
};
state.products.unshift(newProduct);
showToast('Product added successfully!');
router('products');
}
// --- Companies Management ---
function renderCompanies() {
const html = `
<div class="space-y-6">
<div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-4">
<div>
<h2 class="text-3xl font-serif font-bold text-gray-900">Companies</h2>
<p class="text-gray-500 mt-1">Manage your business entities, manufacturers, and responsible persons.</p>
</div>
<button onclick="openCompanyModal()" class="bg-brand-red text-white px-6 py-2.5 rounded-lg hover:bg-red-700 transition shadow-lg shadow-red-200 flex items-center gap-2">
<i class="fa-solid fa-plus"></i> Add Company
</button>
</div>
<!-- Company Stats -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div class="bg-white p-4 rounded-xl shadow-sm border border-gray-100">
<p class="text-xs text-gray-500 uppercase tracking-wider font-medium">Total Companies</p>
<p class="text-2xl font-bold text-gray-900 mt-1">${state.companies.length}</p>
</div>
<div class="bg-white p-4 rounded-xl shadow-sm border border-gray-100">
<p class="text-xs text-gray-500 uppercase tracking-wider font-medium">Responsible Persons</p>
<p class="text-2xl font-bold text-blue-600 mt-1">${state.companies.filter(c => c.type === 'Responsible Person').length}</p>
</div>
<div class="bg-white p-4 rounded-xl shadow-sm border border-gray-100">
<p class="text-xs text-gray-500 uppercase tracking-wider font-medium">Manufacturers</p>
<p class="text-2xl font-bold text-purple-600 mt-1">${state.companies.filter(c => c.type === 'Manufacturer').length}</p>
</div>
<div class="bg-white p-4 rounded-xl shadow-sm border border-gray-100">
<p class="text-xs text-gray-500 uppercase tracking-wider font-medium">Active</p>
<p class="text-2xl font-bold text-green-600 mt-1">${state.companies.filter(c => c.status === 'active').length}</p>
</div>
</div>
<!-- Filters -->
<div class="flex flex-wrap gap-3">
<button onclick="filterCompanies('all')" class="filter-btn active px-4 py-2 rounded-lg text-sm font-medium transition-all bg-brand-red text-white" data-filter="all">
All Companies
</button>
<button onclick="filterCompanies('Responsible Person')" class="filter-btn px-4 py-2 rounded-lg text-sm font-medium transition-all bg-white text-gray-600 hover:bg-gray-50" data-filter="Responsible Person">
Responsible Persons
</button>
<button onclick="filterCompanies('Manufacturer')" class="filter-btn px-4 py-2 rounded-lg text-sm font-medium transition-all bg-white text-gray-600 hover:bg-gray-50" data-filter="Manufacturer">
Manufacturers
</button>
<button onclick="filterCompanies('Distributor')" class="filter-btn px-4 py-2 rounded-lg text-sm font-medium transition-all bg-white text-gray-600 hover:bg-gray-50" data-filter="Distributor">
Distributors
</button>
</div>
<!-- Companies Grid -->
<div id="companies-grid" class="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6">
${renderCompanyCards(state.companies)}
</div>
</div>
`;
document.getElementById('app-content').innerHTML = html;
}
function renderCompanyCards(companies) {
if(companies.length === 0) {
return `<div class="col-span-full text-center py-20 text-gray-500">
<i class="fa-solid fa-building text-4xl mb-4 text-gray-300"></i>
<p>No companies found matching your criteria.</p>
</div>`;
}
return companies.map(c => `
<div class="company-card bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="p-6">
<div class="flex items-start justify-between mb-4">
<div class="flex items-center gap-4">
<img src="${c.logo}" class="w-16 h-16 rounded-xl shadow-sm" alt="${c.name}">
<div>
<h3 class="font-serif font-bold text-lg text-gray-900 leading-tight">${c.name}</h3>
<p class="text-xs text-gray-500">${c.legalName}</p>
</div>
</div>
<div class="flex gap-2