linax / settings.html
mamifortune's picture
conserte o menu e deixe ele alinhado - Initial Deployment
2798096 verified
Raw History Blame Contribute Delete
30 kB
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lina X - Configurações</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Poppins', sans-serif;
background-color: #f8fafc;
color: #0f172a;
}
.sidebar {
transition: all 0.3s ease;
}
.active-nav-item {
background-color: #e0e7ff;
color: #1d4ed8;
}
.config-card {
transition: all 0.3s ease;
}
.config-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
</style>
</head>
<body class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-white w-0 md:w-64 border-r border-gray-200 flex flex-col fixed md:relative h-full z-10 transition-all duration-300 overflow-hidden" id="sidebar">
<div class="p-4 border-b border-gray-200">
<h1 class="text-xl font-bold text-blue-800">Lina X</h1>
<p class="text-sm text-gray-500">Gestão de Lava Jato</p>
</div>
<nav class="flex-1 p-4">
<div class="space-y-1">
<a href="dashboard.html" class="flex items-center px-4 py-3 rounded-lg font-medium text-gray-600 hover:bg-gray-100">
<i data-feather="home" class="w-5 h-5 mr-3"></i>
Dashboard
</a>
<a href="#" class="flex items-center px-4 py-3 rounded-lg font-medium text-gray-600 hover:bg-gray-100">
<i data-feather="dollar-sign" class="w-5 h-5 mr-3"></i>
Financeiro
</a>
<a href="clientes.html" class="flex items-center px-4 py-3 rounded-lg font-medium text-gray-600 hover:bg-gray-100">
<i data-feather="users" class="w-5 h-5 mr-3"></i>
Clientes
</a>
<a href="funcionarios.html" class="极速赛车开奖号码查询官网 items-center px-4 py-3 rounded-lg font-medium text-gray-600 hover:bg-gray-100">
<i data-feather="users" class="w-5 h-5 mr-3"></i>
Funcionários
</a>
<a href="settings.html" class="flex items-center px-4 py-3 rounded-lg font-medium active-nav-item">
<i data-feather="settings" class="w-5 h-5 mr-3"></i>
Configurações
</a>
</div>
</nav>
<div class="p-4 border-t border-gray-200">
<div class="flex items-center">
<div class="w-9 h-9 rounded-full bg-blue-100 flex items-center justify-center mr-3">
<i data-feather="user" class="w-4 h-4 text-blue-600"></i>
</div>
<div>
<p class="text-sm font-medium" id="userEmail">user@email.com</p>
<button class="text-xs text-gray-500 hover:text-gray-700">Sair</button>
</div>
</div>
</div>
</div>
<!-- Mobile Menu Button -->
<button id="menuToggle" class="md:hidden fixed top-4 left-4 z-20 bg-white p-2 rounded-lg shadow-lg">
<i data-feather="menu"></i>
</button>
<!-- Main Content -->
<div class="flex-1 overflow-auto md:ml-0 pt-16 md:pt-0">
<header class="bg-white border-b border-gray-200 p-4">
<h2 class="text-xl font-semibold">Configurações</h2>
</header>
<main class="p-6">
<!-- Washers Section -->
<div class="mb-8">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium">Lavadores</h3>
<button id="addWasherBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded-lg text-sm flex items-center">
<i data-feather="plus" class="w-4 h-4 mr-1"></i>
Adicionar
</button>
</div>
<div id="washersList" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
<!-- Washer cards will be added here dynamically -->
</div>
<!-- Add Washer Modal -->
<div id="washerModal" class="hidden fixed inset-0 bg-black bg-opacity-50 z-30 flex items-center justify-center p-4">
<div class="bg-white rounded-xl max-w-md w-full">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold" id="washerModalTitle">Adicionar Lavador</h3>
<button id="closeWasherModal" class="text-gray-500 hover:text-gray-700">
<i data-feather="x" class="w-5 h-5"></i>
</button>
</div>
<form id="washerForm">
<input type="hidden" id="washerId">
<div class="mb-4">
<label class="block text-sm font-medium mb-1" for="washerName">Nome do Lavador*</label>
<input type="text" id="washerName" class="w-full border border-gray-300 rounded-lg py-2 px-4 focus:outline-none focus:ring-2 focus:ring-blue-400" required>
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-1" for="washerPercentage">% de Ganho*</label>
<input type="number" id="washerPercentage" min="1" max="100" class="w-full border border-gray-300 rounded-lg py-2 px-4 focus:outline-none focus:ring-2 focus:ring-blue-400" required>
</div>
<div class="flex justify-end space-x-2">
<button type="button" id="cancelWasherBtn" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-100">
Cancelar
</button>
<button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
Salvar
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Services Section -->
<div class="mb-8">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium">Serviços</h3>
<button id="addServiceBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded-lg text-sm flex items-center">
<i data-feather="plus" class="w-4 h-4 mr-1"></i>
Adicionar
</button>
</div>
<div id="servicesList" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
<!-- Service cards will be added here dynamically -->
</div>
<!-- Add Service Modal -->
<div id="serviceModal" class="hidden fixed inset-0 bg-black bg-opacity-50 z-30 flex items-center justify-center p-4">
<div class="bg-white rounded-xl max-w-md w-full">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold" id="serviceModalTitle">Adicionar Serviço</h3>
<button id="closeServiceModal" class="text-gray-500 hover:text-gray-700">
<i data-feather="x" class="w-5 h-5"></i>
</button>
</div>
<form id="serviceForm">
<input type="hidden" id="serviceId">
<div class="mb-4">
<label class="block text-sm font-medium mb-1" for="serviceName">Nome do Serviço*</label>
<input type="text" id="serviceName" class="w-full border border-gray-300 rounded-lg py-2 px-4 focus:outline-none focus:ring-2 focus:ring-blue-400" required>
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-1" for="servicePrice">Preço (R$)*</label>
<input type="number" id="servicePrice" min="0" step="0.01" class="w-full border border-gray-300 rounded-lg py-2 px-4 focus:outline-none focus:ring-2 focus:ring-blue-400" required>
</div>
<div class="flex justify-end space-x-2">
<button type="button" id="cancelServiceBtn" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-100">
Cancelar
</button>
<button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
Salvar
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Extras Section -->
<div>
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium">Adicionais</h3>
<button id="addExtraBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded-lg text-sm flex items-center">
<i data-feather="plus" class="w-4 h-4 mr-1"></i>
Adicionar
</button>
</div>
<div id="extrasList" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
<!-- Extra cards will be added here dynamically -->
</div>
<!-- Add Extra Modal -->
<div id="extraModal" class="hidden fixed inset-0 bg-black bg-opacity-50 z-30 flex items-center justify-center p-4">
<div class="bg-white rounded-xl max-w-md w-full">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold" id="extraModalTitle">Adicionar Adicional</h3>
<button id="closeExtraModal" class="text-gray-500 hover:text-gray-700">
<i data-feather="x" class="w-5 h-5"></i>
</button>
</div>
<form id="extraForm">
<input type="hidden" id="extraId">
<div class="mb-4">
<label class="block text-sm font-medium mb-1" for="extraName">Nome do Adicional*</label>
<input type="text" id="extraName" class="w-full border border-gray-300 rounded-lg py-2 px-4 focus:outline-none focus:ring-2 focus:ring-blue-400" required>
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-1" for="extraPrice">Preço (R$)*</label>
<input type="number" id="extraPrice" min="0" step="0.01" class="w-full border border-gray-300 rounded-lg py-2 px-4 focus:outline-none focus:ring-2 focus:ring-blue-400" required>
</div>
<div class="flex justify-end space-x-2">
<button type="button" id="cancelExtraBtn" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-100">
Cancelar
</button>
<button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
Salvar
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</main>
</div>
<script>
feather.replace();
// Load user data
const companyData = JSON.parse(localStorage.getItem('linaX_company'));
if(companyData) {
document.getElementById('userEmail').textContent = companyData.name || companyData.email;
} else {
window.location.href = 'index.html';
}
// Mobile menu toggle
const sidebar = document.getElementById('sidebar');
const menuToggle = document.getElementById('menuToggle');
menuToggle.addEventListener('click', () => {
sidebar.classList.toggle('w-64');
sidebar.classList.toggle('shadow-lg');
});
// Close sidebar when clicking outside on mobile
document.addEventListener('click', (e) => {
if (window.innerWidth < 768 &&
!sidebar.contains(e.target) &&
e.target !== menuToggle &&
!menuToggle.contains(e.target)) {
sidebar.classList.remove('w-64');
sidebar.classList.remove('shadow-lg');
}
});
// Initialize data in localStorage if not exists
if (!localStorage.getItem('linaX_washers')) {
localStorage.setItem('linaX_washers', JSON.stringify([]));
}
if (!localStorage.getItem('linaX_services')) {
localStorage.setItem('linaX_services', JSON.stringify([
{ id: 1, name: 'Lavagem Simples', price: 30 },
{ id: 2, name: 'Lavagem Completa', price: 60 },
{ id: 3, name: 'Polimento', price: 120 }
]));
}
if (!localStorage.getItem('linaX_extras')) {
localStorage.setItem('linaX_extras', JSON.stringify([
{ id: 1, name: 'Aspiração Interna', price: 15 },
{ id: 2, name: 'Limpeza de Motor', price: 25 },
{ id: 3, name: 'Lavagem de Estofados', price: 40 }
]));
}
// Load and display washers
function loadWashers() {
const washers = JSON.parse(localStorage.getItem('linaX_washers'));
const washersList = document.getElementById('washersList');
washersList.innerHTML = '';
washers.forEach(washer => {
const washerCard = document.createElement('div');
washerCard.className = 'config-card bg-white rounded-xl border border-gray-200 p-4';
washerCard.innerHTML = `
<div class="flex justify-between items-start mb-2">
<h3 class="font-medium">${washer.name}</h3>
<div class="flex space-x-2">
<button class="edit-washer text-blue-600 hover:text-blue-800" data-id="${washer.id}">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="delete-washer text-red-600 hover:text-red-800" data-id="${washer.id}">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</div>
<p class="text-sm text-gray-600">Ganho: ${washer.percentage}%</p>
`;
washersList.appendChild(washerCard);
});
feather.replace();
}
// Load and display services
function loadServices() {
const services = JSON.parse(localStorage.getItem('linaX_services'));
const servicesList = document.getElementById('servicesList');
servicesList.innerHTML = '';
services.forEach(service => {
const serviceCard = document.createElement('div');
serviceCard.className = 'config-card bg-white rounded-xl border border-gray-200 p-4';
serviceCard.innerHTML = `
<div class="flex justify-between items-start mb-2">
<h3 class="font-medium">${service.name}</h3>
<div class="flex space-x-2">
<button class="edit-service text-blue-600 hover:text-blue-800" data-id="${service.id}">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="delete-service text-red-600 hover:text-red-800" data-id="${service.id}">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</div>
<p class="text-sm text-gray-600">R$ ${service.price.toFixed(2)}</p>
`;
servicesList.appendChild(serviceCard);
});
feather.replace();
}
// Load and display extras
function loadExtras() {
const extras = JSON.parse(localStorage.getItem('linaX_extras'));
const extrasList = document.getElementById('extrasList');
extrasList.innerHTML = '';
extras.forEach(extra => {
const extraCard = document.createElement('div');
extraCard.className = 'config-card bg-white rounded-xl border border-gray-200 p-4';
extraCard.innerHTML = `
<div class="flex justify-between items-start mb-2">
<h3 class="font-medium">${extra.name}</h3>
<div class="flex space-x-2">
<button class="edit-extra text-blue-600 hover:text-blue-800" data-id="${extra.id}">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="delete-extra text-red-600 hover:text-red-800" data-id="${extra.id}">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</div>
<p class="text-sm text-gray-600">R$ ${extra.price.toFixed(2)}</p>
`;
extrasList.appendChild(extraCard);
});
feather.replace();
}
// Initial load
loadWashers();
loadServices();
loadExtras();
// Washer Modal Functions
const washerModal = document.getElementById('washerModal');
const addWasherBtn = document.getElementById('addWasherBtn');
const closeWasherModal = document.getElementById('closeWasherModal');
const cancelWasherBtn = document.getElementById('cancelWasherBtn');
const washerForm = document.getElementById('washerForm');
addWasherBtn.addEventListener('click', () => {
document.getElementById('washerModalTitle').textContent = 'Adicionar Lavador';
document.getElementById('washerId').value = '';
washerForm.reset();
washerModal.classList.remove('hidden');
});
closeWasherModal.addEventListener('click', () => {
washerModal.classList.add('hidden');
});
cancelWasherBtn.addEventListener('click', () => {
washerModal.classList.add('hidden');
});
// Edit Washer
document.addEventListener('click', (e) => {
if (e.target.closest('.edit-washer')) {
const washerId = parseInt(e.target.closest('.edit-washer').getAttribute('data-id'));
const washers = JSON.parse(localStorage.getItem('linaX_washers'));
const washer = washers.find(w => w.id === washerId);
document.getElementById('washerModalTitle').textContent = 'Editar Lavador';
document.getElementById('washerId').value = washer.id;
document.getElementById('washerName').value = washer.name;
document.getElementById('washerPercentage').value = washer.percentage;
washerModal.classList.remove('hidden');
}
});
// Delete Washer
document.addEventListener('click', (e) => {
if (e.target.closest('.delete-washer')) {
if (confirm('Tem certeza que deseja excluir este lavador?')) {
const washerId = parseInt(e.target.closest('.delete-washer').getAttribute('data-id'));
let washers = JSON.parse(localStorage.getItem('linaX_washers'));
washers = washers.filter(w => w.id !== washerId);
localStorage.setItem('linaX_washers', JSON.stringify(washers));
loadWashers();
}
}
});
// Save Washer
washerForm.addEventListener('submit', (e) => {
e.preventDefault();
const washerId = document.getElementById('washerId').value;
const name = document.getElementById('washerName').value;
const percentage = parseInt(document.getElementById('washerPercentage').value);
let washers = JSON.parse(localStorage.getItem('linaX_washers'));
if (washerId) {
// Update existing washer
const index = washers.findIndex(w => w.id === parseInt(washerId));
washers[index] = { id: parseInt(washerId), name, percentage };
} else {
// Add new washer
const newId = washers.length > 0 ? Math.max(...washers.map(w => w.id)) + 1 : 1;
washers.push({ id: newId, name, percentage });
}
localStorage.setItem('linaX_washers', JSON.stringify(washers));
washerModal.classList.add('hidden');
loadWashers();
});
// Service Modal Functions
const serviceModal = document.getElementById('serviceModal');
const addServiceBtn = document.getElementById('addServiceBtn');
const closeServiceModal = document.getElementById('closeServiceModal');
const cancelServiceBtn = document.getElementById('cancelServiceBtn');
const serviceForm = document.getElementById('serviceForm');
addServiceBtn.addEventListener('click', () => {
document.getElementById('serviceModalTitle').textContent = 'Adicionar Serviço';
document.getElementById('serviceId').value = '';
serviceForm.reset();
serviceModal.classList.remove('hidden');
});
closeServiceModal.addEventListener('click', () => {
serviceModal.classList.add('hidden');
});
cancelServiceBtn.addEventListener('click', () => {
serviceModal.classList.add('hidden');
});
// Edit Service
document.addEventListener('click', (e) => {
if (e.target.closest('.edit-service')) {
const serviceId = parseInt(e.target.closest('.edit-service').getAttribute('data-id'));
const services = JSON.parse(localStorage.getItem('linaX_services'));
const service = services.find(s => s.id === serviceId);
document.getElementById('serviceModalTitle').textContent = 'Editar Serviço';
document.getElementById('serviceId').value = service.id;
document.getElementById('serviceName').value = service.name;
document.getElementById('servicePrice').value = service.price;
serviceModal.classList.remove('hidden');
}
});
// Delete Service
document.addEventListener('click', (e) => {
if (e.target.closest('.delete-service')) {
if (confirm('Tem certeza que deseja excluir este serviço?')) {
const serviceId = parseInt(e.target.closest('.delete-service').getAttribute('data-id'));
let services = JSON.parse(localStorage.getItem('linaX_services'));
services = services.filter(s => s.id !== serviceId);
localStorage.setItem('linaX_services', JSON.stringify(services));
loadServices();
}
}
});
// Save Service
serviceForm.addEventListener('submit', (e) => {
e.preventDefault();
const serviceId = document.getElementById('serviceId').value;
const name = document.getElementById('serviceName').value;
const price = parseFloat(document.getElementById('servicePrice').value);
let services = JSON.parse(localStorage.getItem('linaX_services'));
if (serviceId) {
// Update existing service
const index = services.findIndex(s => s.id === parseInt(serviceId));
services[index] = { id: parseInt(serviceId), name, price };
} else {
// Add new service
const newId = services.length > 0 ? Math.max(...services.map(s => s.id)) + 1 : 1;
services.push({ id: newId, name, price });
}
localStorage.setItem('linaX_services', JSON.stringify(services));
serviceModal.classList.add('hidden');
loadServices();
});
// Extra Modal Functions
const extraModal = document.getElementById('extraModal');
const addExtraBtn = document.getElementById('addExtraBtn');
const closeExtraModal = document.getElementById('closeExtraModal');
const cancelExtraBtn = document.getElementById('cancelExtraBtn');
const extraForm = document.getElementById('extraForm');
addExtraBtn.addEventListener('click', () => {
document.getElementById('extraModalTitle').textContent = 'Adicionar Adicional';
document.getElementById('extraId').value = '';
extraForm.reset();
extraModal.classList.remove('hidden');
});
closeExtraModal.addEventListener('click', () => {
extraModal.classList.add('hidden');
});
cancelExtraBtn.addEventListener('click', () => {
extraModal.classList.add('hidden');
});
// Edit Extra
document.addEventListener('click', (e) => {
if (e.target.closest('.edit-extra')) {
const extraId = parseInt(e.target.closest('.edit-extra').getAttribute('data-id'));
const extras = JSON.parse(localStorage.getItem('linaX_extras'));
const extra = extras.find(ex => ex.id === extraId);
document.getElementById('extraModalTitle').textContent = 'Editar Adicional';
document.getElementById('extraId').value = extra.id;
document.getElementById('extraName').value = extra.name;
document.getElementById('extraPrice').value = extra.price;
extraModal.classList.remove('hidden');
}
});
// Delete Extra
document.addEventListener('click', (e) => {
if (e.target.closest('.delete-extra')) {
if (confirm('Tem certeza que deseja excluir este adicional?')) {
const extraId = parseInt(e.target.closest('.delete-extra').getAttribute('data-id'));
let extras = JSON.parse(localStorage.getItem('linaX_extras'));
extras = extras.filter(ex => ex.id !== extraId);
localStorage.setItem('linaX_extras', JSON.stringify(extras));
loadExtras();
}
}
});
// Save Extra
extraForm.addEventListener('submit', (e) => {
e.preventDefault();
const extraId = document.getElementById('extraId').value;
const name = document.getElementById('extraName').value;
const price = parseFloat(document.getElementById('extraPrice').value);
let extras = JSON.parse(localStorage.getItem('linaX_extras'));
if (extraId) {
// Update existing extra
const index = extras.findIndex(ex => ex.id === parseInt(extraId));
extras[index] = { id: parseInt(extraId), name, price };
} else {
// Add new extra
const newId = extras.length > 0 ? Math.max(...extras.map(ex => ex.id)) + 1 : 1;
extras.push({ id: newId, name, price });
}
localStorage.setItem('linaX_extras', JSON.stringify(extras));
extraModal.classList.add('hidden');
loadExtras();
});
</script>
</body>
</html>