gestock / index.html
elsecond's picture
Add 1 files
ae1d430 verified
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gestion de Stock - CIMENTERIE</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.sidebar {
transition: all 0.3s;
}
.sidebar.collapsed {
width: 70px;
}
.sidebar.collapsed .sidebar-text {
display: none;
}
.sidebar.collapsed .sidebar-icon {
margin-right: 0;
}
.main-content {
transition: all 0.3s;
}
.sidebar.collapsed+.main-content {
margin-left: 70px;
}
.stock-low {
background-color: rgba(239, 68, 68, 0.1);
border-left: 4px solid #ef4444;
}
.stock-critical {
background-color: rgba(239, 68, 68, 0.2);
border-left: 4px solid #ef4444;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}
.stock-ok {
border-left: 4px solid #10b981;
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<div class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-blue-800 text-white w-64 flex flex-col">
<div class="p-4 flex items-center justify-between border-b border-blue-700">
<div class="flex items-center">
<i class="fas fa-industry text-2xl sidebar-icon mr-3"></i>
<span class="sidebar-text font-bold text-xl">CIMENTERIE</span>
</div>
<button id="toggleSidebar" class="text-white focus:outline-none">
<i class="fas fa-bars"></i>
</button>
</div>
<div class="flex-1 overflow-y-auto">
<nav class="p-4">
<div class="mb-6">
<p class="sidebar-text uppercase text-xs font-semibold text-blue-300 mb-2">Menu Principal</p>
<ul>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 bg-blue-700">
<i class="fas fa-tachometer-alt sidebar-icon mr-3"></i>
<span class="sidebar-text">Tableau de bord</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
<i class="fas fa-boxes sidebar-icon mr-3"></i>
<span class="sidebar-text">Gestion des stocks</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
<i class="fas fa-exchange-alt sidebar-icon mr-3"></i>
<span class="sidebar-text">Mouvements</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
<i class="fas fa-truck sidebar-icon mr-3"></i>
<span class="sidebar-text">Fournisseurs</span>
</a>
</li>
</ul>
</div>
<div class="mb-6">
<p class="sidebar-text uppercase text-xs font-semibold text-blue-300 mb-2">Rapports</p>
<ul>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
<i class="fas fa-chart-line sidebar-icon mr-3"></i>
<span class="sidebar-text">Statistiques</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
<i class="fas fa-file-pdf sidebar-icon mr-3"></i>
<span class="sidebar-text">Exporter PDF</span>
</a>
</li>
</ul>
</div>
<div>
<p class="sidebar-text uppercase text-xs font-semibold text-blue-300 mb-2">Administration</p>
<ul>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
<i class="fas fa-users sidebar-icon mr-3"></i>
<span class="sidebar-text">Utilisateurs</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
<i class="fas fa-cog sidebar-icon mr-3"></i>
<span class="sidebar-text">Paramètres</span>
</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="p-4 border-t border-blue-700">
<div class="flex items-center">
<img src="https://ui-avatars.com/api/?name=Admin+User&background=random" class="w-8 h-8 rounded-full mr-3" alt="User">
<div class="sidebar-text">
<p class="text-sm font-semibold">Admin User</p>
<p class="text-xs text-blue-300">Administrateur</p>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="main-content flex-1 overflow-auto ml-64">
<header class="bg-white shadow-sm p-4 flex justify-between items-center">
<h1 class="text-2xl font-bold text-gray-800">Tableau de bord</h1>
<div class="flex items-center space-x-4">
<div class="relative">
<i class="fas fa-bell text-gray-500 text-xl"></i>
<span class="absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center">3</span>
</div>
<div class="relative">
<input type="text" placeholder="Rechercher..." class="pl-8 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
</div>
</header>
<main class="p-6">
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-blue-100 text-blue-600 mr-4">
<i class="fas fa-box-open text-xl"></i>
</div>
<div>
<p class="text-gray-500">Produits en stock</p>
<h3 class="text-2xl font-bold">1,248</h3>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-green-100 text-green-600 mr-4">
<i class="fas fa-arrow-down text-xl"></i>
</div>
<div>
<p class="text-gray-500">Entrées ce mois</p>
<h3 class="text-2xl font-bold">342</h3>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-red-100 text-red-600 mr-4">
<i class="fas fa-arrow-up text-xl"></i>
</div>
<div>
<p class="text-gray-500">Sorties ce mois</p>
<h3 class="text-2xl font-bold">287</h3>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-yellow-100 text-yellow-600 mr-4">
<i class="fas fa-exclamation-triangle text-xl"></i>
</div>
<div>
<p class="text-gray-500">Alertes stock</p>
<h3 class="text-2xl font-bold">12</h3>
</div>
</div>
</div>
</div>
<!-- Charts and Forms -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
<!-- Stock Chart -->
<div class="bg-white rounded-lg shadow p-6 lg:col-span-2">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold">Niveaux de stock par catégorie</h2>
<select class="border rounded px-3 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
<option>7 derniers jours</option>
<option>30 derniers jours</option>
<option selected>Cette année</option>
</select>
</div>
<div class="h-64">
<canvas id="stockChart"></canvas>
</div>
</div>
<!-- Movement Form -->
<div class="bg-white rounded-lg shadow p-6">
<h2 class="text-lg font-semibold mb-4">Nouveau mouvement</h2>
<form id="movementForm" class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Type de mouvement</label>
<select name="type" class="w-full border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
<option value="">Sélectionner...</option>
<option value="entree">Entrée de stock</option>
<option value="sortie">Sortie de stock</option>
<option value="inventaire">Inventaire</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Produit</label>
<select name="produit_id" class="w-full border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
<option value="">Sélectionner un produit...</option>
<option value="1">Ciment 32.5 (CIM-001)</option>
<option value="2">Ciment 42.5 (CIM-002)</option>
<option value="3">Adjuvant SuperPlast (CIM-003)</option>
<option value="4">Bétonnière 500L (CIM-004)</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Quantité</label>
<input type="number" name="quantite" min="1" class="w-full border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Commentaire</label>
<textarea name="commentaire" rows="2" class="w-full border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
</div>
<button type="submit" class="w-full bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
Enregistrer le mouvement
</button>
</form>
</div>
</div>
<!-- Stock Alerts and Recent Movements -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- Stock Alerts -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="bg-red-600 text-white px-6 py-3">
<h2 class="font-semibold">Alertes de stock critique</h2>
</div>
<div class="divide-y">
<div class="p-4 stock-critical">
<div class="flex items-center justify-between">
<div>
<p class="font-medium">Ciment 32.5 (CIM-001)</p>
<p class="text-sm text-gray-600">Stock: 12 tonnes (seuil: 50)</p>
</div>
<button class="text-red-600 hover:text-red-800">
<i class="fas fa-ellipsis-v"></i>
</button>
</div>
</div>
<div class="p-4 stock-low">
<div class="flex items-center justify-between">
<div>
<p class="font-medium">Adjuvant SuperPlast (CIM-003)</p>
<p class="text-sm text-gray-600">Stock: 32 litres (seuil: 40)</p>
</div>
<button class="text-red-600 hover:text-red-800">
<i class="fas fa-ellipsis-v"></i>
</button>
</div>
</div>
<div class="p-4 stock-low">
<div class="flex items-center justify-between">
<div>
<p class="font-medium">Bétonnière 500L (CIM-004)</p>
<p class="text-sm text-gray-600">Stock: 3 unités (seuil: 5)</p>
</div>
<button class="text-red-600 hover:text-red-800">
<i class="fas fa-ellipsis-v"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Recent Movements -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="bg-blue-600 text-white px-6 py-3">
<h2 class="font-semibold">Derniers mouvements</h2>
</div>
<div class="divide-y">
<div class="p-4">
<div class="flex items-center justify-between">
<div>
<p class="font-medium">Entrée - Ciment 42.5</p>
<p class="text-sm text-gray-600">+50 tonnes - Aujourd'hui 09:23</p>
</div>
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded">Entrée</span>
</div>
</div>
<div class="p-4">
<div class="flex items-center justify-between">
<div>
<p class="font-medium">Sortie - Adjuvant SuperPlast</p>
<p class="text-sm text-gray-600">-15 litres - Hier 16:45</p>
</div>
<span class="bg-red-100 text-red-800 text-xs px-2 py-1 rounded">Sortie</span>
</div>
</div>
<div class="p-4">
<div class="flex items-center justify-between">
<div>
<p class="font-medium">Inventaire - Bétonnière 500L</p>
<p class="text-sm text-gray-600">Ajustement: +1 unité - Hier 10:12</p>
</div>
<span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded">Inventaire</span>
</div>
</div>
</div>
</div>
</div>
<!-- Products Table -->
<div class="bg-white rounded-lg shadow mt-6 overflow-hidden">
<div class="px-6 py-4 border-b flex justify-between items-center">
<h2 class="font-semibold">Liste des produits</h2>
<div class="flex space-x-2">
<button class="bg-blue-600 text-white px-3 py-1 rounded text-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500">
<i class="fas fa-plus mr-1"></i> Ajouter
</button>
<button class="bg-gray-200 text-gray-700 px-3 py-1 rounded text-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-500">
<i class="fas fa-download mr-1"></i> Exporter
</button>
</div>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Référence
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Catégorie
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Stock</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Seuil</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Prix</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">CIM-001</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Ciment 32.5</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Ciment</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">12 tonnes</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">50 tonnes</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">850 DH</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-blue-600 hover:text-blue-900 mr-3">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-900">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">CIM-002</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Ciment 42.5</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Ciment</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">78 tonnes</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">50 tonnes</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">950 DH</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-blue-600 hover:text-blue-900 mr-3">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-900">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">CIM-003</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Adjuvant SuperPlast</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Adjuvant</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">32 litres</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">40 litres</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">120 DH</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-blue-600 hover:text-blue-900 mr-3">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-900">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">CIM-004</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Bétonnière 500L</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Matériel</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">3 unités</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">5 unités</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">12,500 DH</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-blue-600 hover:text-blue-900 mr-3">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-900">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="px-6 py-4 border-t flex items-center justify-between">
<div class="text-sm text-gray-500">
Affichage <span class="font-medium">1</span> à <span class="font-medium">4</span> sur
<span class="font-medium">12</span> produits
</div>
<div class="flex space-x-2">
<button class="px-3 py-1 border rounded text-sm text-gray-700 hover:bg-gray-50">
Précédent
</button>
<button class="px-3 py-1 border rounded text-sm text-gray-700 hover:bg-gray-50">
Suivant
</button>
</div>
</div>
</div>
</main>
</div>
</div>
<script>
// Toggle sidebar
document.getElementById('toggleSidebar').addEventListener('click', function() {
document.querySelector('.sidebar').classList.toggle('collapsed');
});
// Initialize charts
document.addEventListener('DOMContentLoaded', function() {
// Stock Chart
const stockCtx = document.getElementById('stockChart').getContext('2d');
const stockChart = new Chart(stockCtx, {
type: 'bar',
data: {
labels: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Déc'],
datasets: [
{
label: 'Ciment 32.5',
data: [1200, 1100, 950, 800, 750, 700, 650, 600, 550, 500, 450, 400],
backgroundColor: '#3b82f6',
},
{
label: 'Ciment 42.5',
data: [900, 850, 800, 750, 700, 650, 600, 550, 500, 450, 400, 350],
backgroundColor: '#10b981',
},
{
label: 'Adjuvants',
data: [300, 280, 260, 240, 220, 200, 180, 160, 140, 120, 100, 80],
backgroundColor: '#f59e0b',
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Quantité (tonnes/litres)'
}
},
x: {
title: {
display: true,
text: 'Mois'
}
}
},
plugins: {
legend: {
position: 'bottom',
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
if (context.parsed.y !== null) {
label += context.parsed.y + ' ' +
(context.dataset.label.includes('Ciment') ? 'tonnes' : 'litres');
}
return label;
}
}
}
}
}
});
// Movement Form Submission
document.getElementById('movementForm').addEventListener('submit', function(e) {
e.preventDefault();
// Simulate form submission
Swal.fire({
title: 'Mouvement enregistré!',
text: 'Le mouvement de stock a été enregistré avec succès.',
icon: 'success',
confirmButtonText: 'OK'
}).then(() => {
// Reset form
e.target.reset();
});
});
});
// Simulate real-time updates
setInterval(() => {
const alerts = document.querySelectorAll('.stock-low, .stock-critical');
alerts.forEach(alert => {
if (alert.classList.contains('stock-critical')) {
alert.classList.remove('stock-critical');
alert.classList.add('stock-low');
} else {
alert.classList.remove('stock-low');
alert.classList.add('stock-critical');
}
});
}, 3000);
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=elsecond/gestock" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>