stocksync-pro-tracker / clients.html
pendejo1234's picture
pero los btones del menu pricipal inventario prodcutos estoy en uno y no puedo volver atras
fd1f71e verified
Raw History Blame Contribute Delete
18.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Clients | StockSync Pro</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<link rel="stylesheet" href="style.css">
</head>
<body class="bg-gray-50 text-gray-800">
<div class="min-h-screen flex flex-col">
<header class="bg-primary-500 text-white p-4 shadow-md">
<div class="flex items-center justify-between">
<a href="index.html" class="p-2">
<i data-feather="home"></i>
</a>
<h1 class="text-xl font-bold">Clients</h1>
<a href="sales.html" class="p-2">
<i data-feather="dollar-sign"></i>
</a>
</div>
</header>
<main class="flex-1 overflow-y-auto p-4">
<div class="flex items-center mb-4">
<a href="index.html" class="mr-3 text-gray-500 hover:text-primary-500">
<i data-feather="home"></i>
</a>
<div class="flex justify-between items-center w-full">
<h2 class="text-lg font-semibold">Client Management</h2>
<button onclick="document.getElementById('addClientModal').classList.remove('hidden')"
class="bg-primary-500 text-white px-4 py-2 rounded-lg flex items-center">
<i data-feather="plus" class="mr-2"></i> Add Client
</button>
</div>
</div>
<!-- Add Client Modal -->
<div id="addClientModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
<div class="bg-white rounded-lg shadow-lg p-6 w-full max-w-md">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">Add New Client</h3>
<button onclick="document.getElementById('addClientModal').classList.add('hidden')" class="text-gray-500 hover:text-gray-700">
<i data-feather="x"></i>
</button>
</div>
<form id="addClientForm">
<div class="mb-4">
<label for="clientName" class="block text-sm font-medium text-gray-700 mb-1">Full Name</label>
<input type="text" id="clientName" class="w-full px-3 py-2 border border-gray-300 rounded-md" required>
</div>
<div class="mb-4">
<label for="clientEmail" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" id="clientEmail" class="w-full px-3 py-2 border border-gray-300 rounded-md" required>
</div>
<div class="mb-4">
<label for="clientPhone" class="block text-sm font-medium text-gray-700 mb-1">Phone</label>
<input type="tel" id="clientPhone" class="w-full px-3 py-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="clientType" class="block text-sm font-medium text-gray-700 mb-1">Client Type</label>
<select id="clientType" class="w-full px-3 py-2 border border-gray-300 rounded-md">
<option value="Regular Client">Regular</option>
<option value="Premium Client">Premium</option>
<option value="Business Client">Business</option>
</select>
</div>
<div class="flex justify-end">
<button type="button" onclick="document.getElementById('addClientModal').classList.add('hidden')"
class="mr-2 px-4 py-2 border border-gray-300 rounded-md text-gray-700 bg-white hover:bg-gray-50">
Cancel
</button>
<button type="submit" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-white bg-primary-500 hover:bg-primary-600">
Save Client
</button>
</div>
</form>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm border border-gray-100 overflow-hidden">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Client</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Contact</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Total Orders</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Last Purchase</th>
<th scope="col" class="relative px-6 py-3"><span class="sr-only">Actions</span></th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200" id="clientsTableBody">
<!-- Sample client data will be loaded here -->
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 rounded-full bg-primary-50 flex items-center justify-center text-primary-500">
<i data-feather="user"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">John Doe</div>
<div class="text-sm text-gray-500">Regular Client</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">john@example.com</div>
<div class="text-sm text-gray-500">+1 (555) 123-4567</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">5</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">$299.95</div>
<div class="text-sm text-gray-500">3 days ago</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button onclick="editClient(1)" class="text-primary-500 hover:text-primary-700 mr-3">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button onclick="deleteClient(1)" class="text-gray-500 hover:text-red-500">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 rounded-full bg-primary-50 flex items-center justify-center text-primary-500">
<i data-feather="user"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Sarah Smith</div>
<div class="text-sm text-gray-500">Premium Client</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">sarah@example.com</div>
<div class="text-sm text-gray-500">+1 (555) 987-6543</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">12</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">$899.88</div>
<div class="text-sm text-gray-500">1 week ago</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button onclick="editClient(2)" class="text-primary-500 hover:text-primary-700 mr-3">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button onclick="deleteClient(2)" class="text-gray-500 hover:text-red-500">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 rounded-full bg-primary-50 flex items-center justify-center text-primary-500">
<i data-feather="user"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Mike Johnson</div>
<div class="text-sm text-gray-500">Business Client</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">mike@example.com</div>
<div class="text-sm text-gray-500">+1 (555) 456-7890</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">8</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">$599.92</div>
<div class="text-sm text-gray-500">2 days ago</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button onclick="editClient(3)" class="text-primary-500 hover:text-primary-700 mr-3">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button onclick="deleteClient(3)" class="text-gray-500 hover:text-red-500">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</td>
</tr>
</tbody>
</table>
<div class="bg-gray-50 px-6 py-3 flex items-center justify-between border-t border-gray-200">
<div class="flex-1 flex justify-between sm:hidden">
<button id="prevPage" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
Previous
</button>
<button id="nextPage" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
Next
</button>
</div>
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
<div>
<p class="text-sm text-gray-700">
Showing <span class="font-medium" id="startItem">1</span> to <span class="font-medium" id="endItem">5</span> of <span class="font-medium" id="totalItems">25</span> clients
</p>
</div>
<div>
<nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination">
<button id="prevPage" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<span class="sr-only">Previous</span>
<i data-feather="chevron-left" class="h-4 w-4"></i>
</button>
<button aria-current="page" class="z-10 bg-primary-50 border-primary-500 text-primary-600 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
1
</button>
<button class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
2
</button>
<button class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
3
</button>
<button id="nextPage" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<span class="sr-only">Next</span>
<i data-feather="chevron-right" class="h-4 w-4"></i>
</button>
</nav>
</div>
</div>
</div>
</div>
</main>
</div>
<script>
// Client management functions
function editClient(clientId) {
// In a real app, this would open a modal or redirect to edit page
alert(`Editing client with ID: ${clientId}`);
// Example: window.location.href = `edit-client.html?id=${clientId}`;
}
function deleteClient(clientId) {
if (confirm('Are you sure you want to delete this client?')) {
// In a real app, this would make an API call
const row = document.querySelector(`tr[data-client-id="${clientId}"]`);
if (row) {
row.remove();
}
alert(`Client with ID: ${clientId} deleted`);
}
}
// Form handling for adding new clients
document.getElementById('addClientForm')?.addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('clientName').value;
const email = document.getElementById('clientEmail').value;
const phone = document.getElementById('clientPhone').value;
const type = document.getElementById('clientType').value;
// Create new client row
const tbody = document.getElementById('clientsTableBody');
const newRow = document.createElement('tr');
newRow.innerHTML = `
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 rounded-full bg-primary-50 flex items-center justify-center text-primary-500">
<i data-feather="user"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">${name}</div>
<div class="text-sm text-gray-500">${type}</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">${email}</div>
<div class="text-sm text-gray-500">${phone}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">0</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">$0.00</div>
<div class="text-sm text-gray-500">Just added</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button onclick="editClient(${Date.now()})" class="text-primary-500 hover:text-primary-700 mr-3">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button onclick="deleteClient(${Date.now()})" class="text-gray-500 hover:text-red-500">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</td>
`;
tbody.insertBefore(newRow, tbody.firstChild);
feather.replace();
// Reset form
this.reset();
alert('New client added successfully!');
});
</script>
<script src="script.js"></script>
<script>
feather.replace();
</script>
</body>
</html>