mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-24 07:38:18 +02:00
Enhance the user interface to provide a more modern and intuitive experience
Update UI components for improved aesthetics and user experience, including new color palettes and styling. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/75b569d4-1b21-43d8-b5b1-0816d59edebd.jpg
This commit is contained in:
1 parent
1d46228fac
commit
9a901b574f
4 files changed
+416
-167
No files matched your search
@@ -158,13 +158,15 @@ export default function NewSaleForm() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card className="modern-card-elevated">
|
||||||
<CardHeader>
|
<CardHeader className="pb-6">
|
||||||
<CardTitle className="flex items-center gap-2">
|
<CardTitle className="flex items-center gap-3 text-2xl">
|
||||||
<Package className="h-5 w-5" />
|
<div className="p-2 bg-gradient-to-br from-green-500 to-emerald-600 rounded-xl">
|
||||||
|
<Package className="h-6 w-6 text-white" />
|
||||||
|
</div>
|
||||||
Nouvelle Vente
|
Nouvelle Vente
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-muted-foreground mt-2">
|
||||||
Enregistrement d'une vente de feux d'artifice
|
Enregistrement d'une vente de feux d'artifice
|
||||||
</p>
|
</p>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
@@ -172,9 +174,11 @@ export default function NewSaleForm() {
|
|||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
||||||
{/* Seller Information */}
|
{/* Seller Information */}
|
||||||
<div className="border-l-4 border-primary pl-4">
|
<div className="modern-card bg-muted/30 p-6 rounded-xl border-l-4 border-primary">
|
||||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center gap-2">
|
<h3 className="text-xl font-semibold text-foreground mb-6 flex items-center gap-3">
|
||||||
<User className="h-5 w-5 text-primary" />
|
<div className="p-2 bg-primary/10 rounded-lg">
|
||||||
|
<User className="h-5 w-5 text-primary" />
|
||||||
|
</div>
|
||||||
Informations Vendeur
|
Informations Vendeur
|
||||||
</h3>
|
</h3>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
@@ -208,9 +212,11 @@ export default function NewSaleForm() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Product Information */}
|
{/* Product Information */}
|
||||||
<div className="border-l-4 border-info pl-4">
|
<div className="modern-card bg-blue-50/50 p-6 rounded-xl border-l-4 border-blue-500">
|
||||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center gap-2">
|
<h3 className="text-xl font-semibold text-foreground mb-6 flex items-center gap-3">
|
||||||
<Package className="h-5 w-5 text-info" />
|
<div className="p-2 bg-blue-500/10 rounded-lg">
|
||||||
|
<Package className="h-5 w-5 text-blue-600" />
|
||||||
|
</div>
|
||||||
Informations Produit
|
Informations Produit
|
||||||
</h3>
|
</h3>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
@@ -308,9 +314,11 @@ export default function NewSaleForm() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Customer Information */}
|
{/* Customer Information */}
|
||||||
<div className="border-l-4 border-success pl-4">
|
<div className="modern-card bg-emerald-50/50 p-6 rounded-xl border-l-4 border-emerald-500">
|
||||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center gap-2">
|
<h3 className="text-xl font-semibold text-foreground mb-6 flex items-center gap-3">
|
||||||
<Users className="h-5 w-5 text-success" />
|
<div className="p-2 bg-emerald-500/10 rounded-lg">
|
||||||
|
<Users className="h-5 w-5 text-emerald-600" />
|
||||||
|
</div>
|
||||||
Informations Client
|
Informations Client
|
||||||
</h3>
|
</h3>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
@@ -370,11 +378,13 @@ export default function NewSaleForm() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Identity Information */}
|
{/* Identity Information */}
|
||||||
<div className="border-l-4 border-warning pl-4">
|
<div className="modern-card bg-amber-50/50 p-6 rounded-xl border-l-4 border-amber-500">
|
||||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center gap-2">
|
<h3 className="text-xl font-semibold text-foreground mb-6 flex items-center gap-3">
|
||||||
<svg className="h-5 w-5 text-warning" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<div className="p-2 bg-amber-500/10 rounded-lg">
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-4 0V5a2 2 0 114 0v1m-4 0a2 2 0 104 0m-5 8a2 2 0 100-4 2 2 0 000 4zm0 0c1.306 0 2.417.835 2.83 2M9 14a3.001 3.001 0 00-2.83 2M15 11h3m-3 4h2" />
|
<svg className="h-5 w-5 text-amber-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
</svg>
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-4 0V5a2 2 0 114 0v1m-4 0a2 2 0 104 0m-5 8a2 2 0 100-4 2 2 0 000 4zm0 0c1.306 0 2.417.835 2.83 2M9 14a3.001 3.001 0 00-2.83 2M15 11h3m-3 4h2" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
Pièce d'Identité
|
Pièce d'Identité
|
||||||
</h3>
|
</h3>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
@@ -444,9 +454,14 @@ export default function NewSaleForm() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Form Actions - Always visible */}
|
{/* Form Actions */}
|
||||||
<div className="flex justify-end space-x-4 pt-6 border-t border-gray-200 bg-white">
|
<div className="flex justify-end space-x-4 pt-8 mt-8 border-t border-border/50">
|
||||||
<Button type="button" variant="outline" onClick={() => {
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
size="lg"
|
||||||
|
className="border-2 hover:bg-muted smooth-transition"
|
||||||
|
onClick={() => {
|
||||||
form.reset({
|
form.reset({
|
||||||
vendeur: '',
|
vendeur: '',
|
||||||
dateVente: new Date().toISOString().split('T')[0],
|
dateVente: new Date().toISOString().split('T')[0],
|
||||||
@@ -464,11 +479,16 @@ export default function NewSaleForm() {
|
|||||||
dateDelivrance: '',
|
dateDelivrance: '',
|
||||||
});
|
});
|
||||||
}}>
|
}}>
|
||||||
<X className="h-4 w-4 mr-2" />
|
<X className="h-5 w-5 mr-2" />
|
||||||
Annuler
|
Réinitialiser
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit" disabled={isSubmitting || createSaleMutation.isPending} className="bg-green-600 hover:bg-green-700 text-white">
|
<Button
|
||||||
<Save className="h-4 w-4 mr-2" />
|
type="submit"
|
||||||
|
size="lg"
|
||||||
|
disabled={isSubmitting || createSaleMutation.isPending}
|
||||||
|
className="bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700 text-white border-0 shadow-lg hover:shadow-xl hover:scale-[1.02] smooth-transition"
|
||||||
|
>
|
||||||
|
<Save className="h-5 w-5 mr-2" />
|
||||||
{isSubmitting || createSaleMutation.isPending ? 'Enregistrement...' : 'Enregistrer la Vente'}
|
{isSubmitting || createSaleMutation.isPending ? 'Enregistrement...' : 'Enregistrer la Vente'}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+195
-47
@@ -3,53 +3,83 @@
|
|||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
/* Modern neutral palette */
|
||||||
--background: hsl(0, 0%, 100%);
|
--background: hsl(0, 0%, 100%);
|
||||||
--foreground: hsl(20, 14.3%, 4.1%);
|
--foreground: hsl(222, 15%, 11%);
|
||||||
--muted: hsl(60, 4.8%, 95.9%);
|
--muted: hsl(220, 13%, 96%);
|
||||||
--muted-foreground: hsl(25, 5.3%, 44.7%);
|
--muted-foreground: hsl(220, 9%, 46%);
|
||||||
--popover: hsl(0, 0%, 100%);
|
--popover: hsl(0, 0%, 100%);
|
||||||
--popover-foreground: hsl(20, 14.3%, 4.1%);
|
--popover-foreground: hsl(222, 15%, 11%);
|
||||||
--card: hsl(0, 0%, 100%);
|
--card: hsl(0, 0%, 100%);
|
||||||
--card-foreground: hsl(20, 14.3%, 4.1%);
|
--card-foreground: hsl(222, 15%, 11%);
|
||||||
--border: hsl(20, 5.9%, 90%);
|
--border: hsl(220, 13%, 91%);
|
||||||
--input: hsl(20, 5.9%, 90%);
|
--input: hsl(220, 13%, 91%);
|
||||||
--primary: hsl(217, 91%, 59%);
|
|
||||||
--primary-foreground: hsl(211, 100%, 99%);
|
/* Modern blue-purple gradient palette */
|
||||||
--secondary: hsl(60, 4.8%, 95.9%);
|
--primary: hsl(232, 97%, 59%);
|
||||||
--secondary-foreground: hsl(24, 9.8%, 10%);
|
--primary-foreground: hsl(0, 0%, 100%);
|
||||||
--accent: hsl(60, 4.8%, 95.9%);
|
--secondary: hsl(220, 14%, 96%);
|
||||||
--accent-foreground: hsl(24, 9.8%, 10%);
|
--secondary-foreground: hsl(222, 15%, 11%);
|
||||||
--destructive: hsl(0, 84.2%, 60.2%);
|
--accent: hsl(262, 100%, 97%);
|
||||||
--destructive-foreground: hsl(60, 9.1%, 97.8%);
|
--accent-foreground: hsl(222, 15%, 11%);
|
||||||
--success: hsl(142, 76%, 36%);
|
|
||||||
--success-foreground: hsl(60, 9.1%, 97.8%);
|
/* Status colors */
|
||||||
--info: hsl(217, 91%, 59%);
|
--destructive: hsl(0, 85%, 60%);
|
||||||
--info-foreground: hsl(60, 9.1%, 97.8%);
|
--destructive-foreground: hsl(0, 0%, 98%);
|
||||||
--ring: hsl(20, 14.3%, 4.1%);
|
--success: hsl(142, 71%, 45%);
|
||||||
--radius: 0.5rem;
|
--success-foreground: hsl(0, 0%, 98%);
|
||||||
|
--warning: hsl(38, 92%, 50%);
|
||||||
|
--warning-foreground: hsl(0, 0%, 98%);
|
||||||
|
--info: hsl(210, 100%, 56%);
|
||||||
|
--info-foreground: hsl(0, 0%, 98%);
|
||||||
|
|
||||||
|
/* Interactive elements */
|
||||||
|
--ring: hsl(232, 97%, 59%);
|
||||||
|
--radius: 0.75rem;
|
||||||
|
|
||||||
|
/* Gradient colors */
|
||||||
|
--gradient-from: hsl(232, 97%, 59%);
|
||||||
|
--gradient-to: hsl(262, 100%, 59%);
|
||||||
|
--gradient-accent: hsl(282, 100%, 59%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
--background: hsl(240, 10%, 3.9%);
|
/* Dark neutral palette */
|
||||||
--foreground: hsl(0, 0%, 98%);
|
--background: hsl(222, 20%, 4%);
|
||||||
--muted: hsl(240, 3.7%, 15.9%);
|
--foreground: hsl(210, 40%, 95%);
|
||||||
--muted-foreground: hsl(240, 5%, 64.9%);
|
--muted: hsl(222, 15%, 8%);
|
||||||
--popover: hsl(240, 10%, 3.9%);
|
--muted-foreground: hsl(215, 20%, 65%);
|
||||||
--popover-foreground: hsl(0, 0%, 98%);
|
--popover: hsl(222, 15%, 6%);
|
||||||
--card: hsl(240, 10%, 3.9%);
|
--popover-foreground: hsl(210, 40%, 95%);
|
||||||
--card-foreground: hsl(0, 0%, 98%);
|
--card: hsl(222, 15%, 6%);
|
||||||
--border: hsl(240, 3.7%, 15.9%);
|
--card-foreground: hsl(210, 40%, 95%);
|
||||||
--input: hsl(240, 3.7%, 15.9%);
|
--border: hsl(215, 28%, 17%);
|
||||||
--primary: hsl(217, 91%, 59%);
|
--input: hsl(215, 28%, 17%);
|
||||||
--primary-foreground: hsl(211, 100%, 99%);
|
|
||||||
--secondary: hsl(240, 3.7%, 15.9%);
|
/* Dark mode blue-purple palette */
|
||||||
--secondary-foreground: hsl(0, 0%, 98%);
|
--primary: hsl(232, 97%, 65%);
|
||||||
--accent: hsl(240, 3.7%, 15.9%);
|
--primary-foreground: hsl(222, 20%, 4%);
|
||||||
--accent-foreground: hsl(0, 0%, 98%);
|
--secondary: hsl(215, 28%, 17%);
|
||||||
--destructive: hsl(0, 62.8%, 30.6%);
|
--secondary-foreground: hsl(210, 40%, 95%);
|
||||||
|
--accent: hsl(215, 28%, 17%);
|
||||||
|
--accent-foreground: hsl(210, 40%, 95%);
|
||||||
|
|
||||||
|
/* Dark status colors */
|
||||||
|
--destructive: hsl(0, 85%, 65%);
|
||||||
--destructive-foreground: hsl(0, 0%, 98%);
|
--destructive-foreground: hsl(0, 0%, 98%);
|
||||||
--ring: hsl(240, 4.9%, 83.9%);
|
--success: hsl(142, 71%, 55%);
|
||||||
--radius: 0.5rem;
|
--success-foreground: hsl(0, 0%, 98%);
|
||||||
|
--warning: hsl(38, 92%, 60%);
|
||||||
|
--warning-foreground: hsl(0, 0%, 98%);
|
||||||
|
--info: hsl(210, 100%, 65%);
|
||||||
|
--info-foreground: hsl(0, 0%, 98%);
|
||||||
|
|
||||||
|
--ring: hsl(232, 97%, 65%);
|
||||||
|
|
||||||
|
/* Dark gradient colors */
|
||||||
|
--gradient-from: hsl(232, 97%, 65%);
|
||||||
|
--gradient-to: hsl(262, 100%, 65%);
|
||||||
|
--gradient-accent: hsl(282, 100%, 65%);
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
@@ -59,14 +89,109 @@
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
@apply font-sans antialiased bg-background text-foreground;
|
@apply font-sans antialiased bg-background text-foreground;
|
||||||
|
font-feature-settings: "rlig" 1, "calt" 1;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Smooth scrollbar */
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background: hsl(var(--muted));
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background: hsl(var(--border));
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: hsl(var(--muted-foreground));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer components {
|
@layer components {
|
||||||
|
/* Modern animations */
|
||||||
.slide-in-right {
|
.slide-in-right {
|
||||||
animation: slideInRight 0.3s ease-out;
|
animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.slide-in-left {
|
||||||
|
animation: slideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-in-up {
|
||||||
|
animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-in {
|
||||||
|
animation: fadeIn 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scale-in {
|
||||||
|
animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.smooth-transition {
|
||||||
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modern gradients */
|
||||||
|
.gradient-bg {
|
||||||
|
background: linear-gradient(135deg, var(--gradient-from) 0%, var(--gradient-to) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gradient-text {
|
||||||
|
background: linear-gradient(135deg, var(--gradient-from) 0%, var(--gradient-to) 100%);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Glass morphism */
|
||||||
|
.glass {
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modern card styles */
|
||||||
|
.modern-card {
|
||||||
|
@apply bg-card border border-border rounded-xl shadow-sm hover:shadow-lg smooth-transition backdrop-blur-sm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modern-card-elevated {
|
||||||
|
@apply modern-card shadow-lg hover:shadow-xl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Status styles */
|
||||||
|
.status-success {
|
||||||
|
@apply bg-green-50 text-green-700 border border-green-200 dark:bg-green-950 dark:text-green-300 dark:border-green-800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-warning {
|
||||||
|
@apply bg-yellow-50 text-yellow-700 border border-yellow-200 dark:bg-yellow-950 dark:text-yellow-300 dark:border-yellow-800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-error {
|
||||||
|
@apply bg-red-50 text-red-700 border border-red-200 dark:bg-red-950 dark:text-red-300 dark:border-red-800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-info {
|
||||||
|
@apply bg-blue-50 text-blue-700 border border-blue-200 dark:bg-blue-950 dark:text-blue-300 dark:border-blue-800;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Camera preview */
|
||||||
|
.camera-preview {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Animation keyframes */
|
||||||
@keyframes slideInRight {
|
@keyframes slideInRight {
|
||||||
from {
|
from {
|
||||||
transform: translateX(100%);
|
transform: translateX(100%);
|
||||||
@@ -78,8 +203,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade-in {
|
@keyframes slideInLeft {
|
||||||
animation: fadeIn 0.2s ease-in;
|
from {
|
||||||
|
transform: translateX(-100%);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: translateX(0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideInUp {
|
||||||
|
from {
|
||||||
|
transform: translateY(30px);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: translateY(0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
@@ -87,9 +230,14 @@
|
|||||||
to { opacity: 1; }
|
to { opacity: 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.camera-preview {
|
@keyframes scaleIn {
|
||||||
max-width: 100%;
|
from {
|
||||||
height: auto;
|
opacity: 0;
|
||||||
border-radius: 8px;
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+113
-65
@@ -8,7 +8,7 @@ import { StoreProvider, useStoreContext } from "@/hooks/useStoreContext";
|
|||||||
import NewSaleForm from "@/components/NewSaleForm";
|
import NewSaleForm from "@/components/NewSaleForm";
|
||||||
import SalesHistory from "@/components/SalesHistory";
|
import SalesHistory from "@/components/SalesHistory";
|
||||||
import Administration from "@/components/Administration";
|
import Administration from "@/components/Administration";
|
||||||
import { Package, History, Settings, LogOut, User, Building2 } from "lucide-react";
|
import { Package, History, Settings, LogOut, User, Building2, Shield } from "lucide-react";
|
||||||
import { useToast } from "@/hooks/use-toast";
|
import { useToast } from "@/hooks/use-toast";
|
||||||
|
|
||||||
function DashboardContent() {
|
function DashboardContent() {
|
||||||
@@ -38,31 +38,34 @@ function DashboardContent() {
|
|||||||
const isAdmin = user?.role === "admin";
|
const isAdmin = user?.role === "admin";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gray-50">
|
<div className="min-h-screen bg-background">
|
||||||
{/* Header */}
|
{/* Modern Header */}
|
||||||
<header className="bg-white shadow-sm border-b">
|
<header className="sticky top-0 z-50 border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
||||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
<div className="flex justify-between items-center h-16">
|
<div className="flex justify-between items-center h-16">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-4">
|
||||||
<div className="p-2 bg-primary/10 rounded-lg">
|
<div className="relative">
|
||||||
<Package className="h-6 w-6 text-primary" />
|
<div className="p-2 bg-gradient-to-br from-primary to-purple-600 rounded-xl shadow-sm">
|
||||||
|
<Package className="h-6 w-6 text-white" />
|
||||||
|
</div>
|
||||||
|
<div className="absolute -inset-1 bg-gradient-to-br from-primary to-purple-600 rounded-xl blur opacity-20 -z-10"></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-xl font-bold text-gray-900">Registre des Ventes</h1>
|
<h1 className="text-xl font-bold gradient-text">Registre des Ventes</h1>
|
||||||
<p className="text-sm text-gray-500">Gestion des feux d'artifice</p>
|
<p className="text-sm text-muted-foreground">Gestion moderne des feux d'artifice</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
{/* Store Selector for Admin */}
|
{/* Store Selector for Admin */}
|
||||||
{isAdmin && !isLoadingStores && (
|
{isAdmin && !isLoadingStores && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-3 p-2 bg-muted/50 rounded-lg border border-border/50">
|
||||||
<Building2 className="h-4 w-4 text-gray-500" />
|
<Building2 className="h-4 w-4 text-muted-foreground" />
|
||||||
<Select
|
<Select
|
||||||
value={selectedStoreId?.toString() || ""}
|
value={selectedStoreId?.toString() || ""}
|
||||||
onValueChange={(value) => setSelectedStoreId(parseInt(value))}
|
onValueChange={(value) => setSelectedStoreId(parseInt(value))}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="w-48">
|
<SelectTrigger className="w-48 border-0 bg-transparent focus:ring-0">
|
||||||
<SelectValue placeholder="Sélectionner un magasin" />
|
<SelectValue placeholder="Sélectionner un magasin" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
@@ -78,22 +81,32 @@ function DashboardContent() {
|
|||||||
|
|
||||||
{/* Current Store Display for Non-Admin */}
|
{/* Current Store Display for Non-Admin */}
|
||||||
{!isAdmin && selectedStore && (
|
{!isAdmin && selectedStore && (
|
||||||
<div className="flex items-center gap-2 text-sm text-gray-600">
|
<div className="flex items-center gap-2 px-3 py-2 bg-muted/50 rounded-lg border border-border/50">
|
||||||
<Building2 className="h-4 w-4" />
|
<Building2 className="h-4 w-4 text-primary" />
|
||||||
<span>{selectedStore.name}</span>
|
<span className="text-sm font-medium">{selectedStore.name}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="text-right">
|
<div className="flex items-center gap-3">
|
||||||
<p className="text-sm font-medium text-gray-900">
|
<div className="text-right">
|
||||||
{user?.firstName} {user?.lastName}
|
<p className="text-sm font-semibold text-foreground">
|
||||||
</p>
|
{user?.firstName} {user?.lastName}
|
||||||
<p className="text-xs text-gray-500 capitalize">{user?.role}</p>
|
</p>
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
{user?.role === 'admin' && <Shield className="h-3 w-3 text-primary" />}
|
||||||
|
<p className="text-xs text-muted-foreground capitalize">{user?.role}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleLogout}
|
||||||
|
className="border-2 hover:bg-destructive hover:text-destructive-foreground hover:border-destructive smooth-transition"
|
||||||
|
>
|
||||||
|
<LogOut className="h-4 w-4 mr-2" />
|
||||||
|
Déconnexion
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<Button variant="outline" size="sm" onClick={handleLogout}>
|
|
||||||
<LogOut className="h-4 w-4 mr-2" />
|
|
||||||
Déconnexion
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -102,20 +115,38 @@ function DashboardContent() {
|
|||||||
{/* Main Content */}
|
{/* Main Content */}
|
||||||
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||||
{selectedStore && (
|
{selectedStore && (
|
||||||
<div className="mb-6">
|
<div className="mb-8 slide-in-up">
|
||||||
<Card>
|
<Card className="modern-card-elevated overflow-hidden">
|
||||||
<CardContent className="pt-6">
|
<CardContent className="pt-6">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-6">
|
||||||
<div className="p-3 bg-blue-100 rounded-lg">
|
<div className="relative">
|
||||||
<Building2 className="h-6 w-6 text-blue-600" />
|
<div className="p-4 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-2xl shadow-lg">
|
||||||
|
<Building2 className="h-8 w-8 text-white" />
|
||||||
|
</div>
|
||||||
|
<div className="absolute -inset-2 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-2xl blur opacity-20 -z-10"></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div className="flex-1">
|
||||||
<h2 className="text-lg font-semibold text-gray-900">{selectedStore.name}</h2>
|
<h2 className="text-2xl font-bold text-foreground mb-2">{selectedStore.name}</h2>
|
||||||
<div className="text-sm text-gray-600">
|
<div className="space-y-1">
|
||||||
{selectedStore.address && <p>{selectedStore.address}</p>}
|
{selectedStore.address && (
|
||||||
<div className="flex gap-4">
|
<p className="text-muted-foreground flex items-center gap-2">
|
||||||
{selectedStore.phone && <span>📞 {selectedStore.phone}</span>}
|
<span className="w-4 h-4 flex items-center justify-center">📍</span>
|
||||||
{selectedStore.email && <span>✉️ {selectedStore.email}</span>}
|
{selectedStore.address}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<div className="flex gap-6 text-sm">
|
||||||
|
{selectedStore.phone && (
|
||||||
|
<span className="text-muted-foreground flex items-center gap-2">
|
||||||
|
<span className="w-4 h-4 flex items-center justify-center">📞</span>
|
||||||
|
{selectedStore.phone}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{selectedStore.email && (
|
||||||
|
<span className="text-muted-foreground flex items-center gap-2">
|
||||||
|
<span className="w-4 h-4 flex items-center justify-center">✉️</span>
|
||||||
|
{selectedStore.email}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -125,38 +156,55 @@ function DashboardContent() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Tabs value={activeTab} onValueChange={setActiveTab} className="space-y-6">
|
<div className="fade-in">
|
||||||
<TabsList className="grid w-full grid-cols-3 lg:w-auto lg:grid-cols-auto">
|
<Tabs value={activeTab} onValueChange={setActiveTab} className="space-y-8">
|
||||||
<TabsTrigger value="new-sale" className="flex items-center gap-2">
|
<TabsList className={`grid w-full ${canAccessAdmin ? 'grid-cols-3' : 'grid-cols-2'} max-w-2xl h-14 bg-muted/50 p-2 rounded-2xl border border-border/50`}>
|
||||||
<Package className="h-4 w-4" />
|
<TabsTrigger
|
||||||
Nouvelle Vente
|
value="new-sale"
|
||||||
</TabsTrigger>
|
className="h-10 rounded-xl data-[state=active]:bg-background data-[state=active]:shadow-md smooth-transition font-medium"
|
||||||
<TabsTrigger value="history" className="flex items-center gap-2">
|
>
|
||||||
<History className="h-4 w-4" />
|
<Package className="h-5 w-5 mr-2" />
|
||||||
Historique
|
Nouvelle Vente
|
||||||
</TabsTrigger>
|
|
||||||
{canAccessAdmin && (
|
|
||||||
<TabsTrigger value="admin" className="flex items-center gap-2">
|
|
||||||
<Settings className="h-4 w-4" />
|
|
||||||
Administration
|
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
)}
|
<TabsTrigger
|
||||||
</TabsList>
|
value="history"
|
||||||
|
className="h-10 rounded-xl data-[state=active]:bg-background data-[state=active]:shadow-md smooth-transition font-medium"
|
||||||
|
>
|
||||||
|
<History className="h-5 w-5 mr-2" />
|
||||||
|
Historique
|
||||||
|
</TabsTrigger>
|
||||||
|
{canAccessAdmin && (
|
||||||
|
<TabsTrigger
|
||||||
|
value="admin"
|
||||||
|
className="h-10 rounded-xl data-[state=active]:bg-background data-[state=active]:shadow-md smooth-transition font-medium"
|
||||||
|
>
|
||||||
|
<Settings className="h-5 w-5 mr-2" />
|
||||||
|
Administration
|
||||||
|
</TabsTrigger>
|
||||||
|
)}
|
||||||
|
</TabsList>
|
||||||
|
|
||||||
<TabsContent value="new-sale">
|
<TabsContent value="new-sale" className="mt-8">
|
||||||
<NewSaleForm />
|
<div className="slide-in-up">
|
||||||
</TabsContent>
|
<NewSaleForm />
|
||||||
|
</div>
|
||||||
<TabsContent value="history">
|
|
||||||
<SalesHistory canDelete={canDeleteSales} />
|
|
||||||
</TabsContent>
|
|
||||||
|
|
||||||
{canAccessAdmin && (
|
|
||||||
<TabsContent value="admin">
|
|
||||||
<Administration />
|
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
)}
|
|
||||||
</Tabs>
|
<TabsContent value="history" className="mt-8">
|
||||||
|
<div className="slide-in-up">
|
||||||
|
<SalesHistory canDelete={canDeleteSales} />
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
{canAccessAdmin && (
|
||||||
|
<TabsContent value="admin" className="mt-8">
|
||||||
|
<div className="slide-in-up">
|
||||||
|
<Administration />
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
)}
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
+62
-29
@@ -51,28 +51,43 @@ export default function Login() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-purple-50 p-4">
|
<div className="min-h-screen flex items-center justify-center gradient-bg p-4 relative overflow-hidden">
|
||||||
<Card className="w-full max-w-md shadow-lg">
|
{/* Background decoration */}
|
||||||
<CardHeader className="text-center">
|
<div className="absolute inset-0 overflow-hidden">
|
||||||
<div className="flex justify-center mb-4">
|
<div className="absolute -top-40 -right-40 w-80 h-80 bg-gradient-to-br from-white/20 to-white/5 rounded-full blur-3xl"></div>
|
||||||
<div className="p-3 bg-primary/10 rounded-full">
|
<div className="absolute -bottom-40 -left-40 w-80 h-80 bg-gradient-to-br from-white/20 to-white/5 rounded-full blur-3xl"></div>
|
||||||
<Sparkles className="h-8 w-8 text-primary" />
|
</div>
|
||||||
|
|
||||||
|
<Card className="w-full max-w-md modern-card-elevated backdrop-blur-sm bg-white/90 border-white/20 slide-in-up relative z-10">
|
||||||
|
<CardHeader className="text-center space-y-6 pb-8">
|
||||||
|
<div className="flex justify-center">
|
||||||
|
<div className="relative">
|
||||||
|
<div className="p-4 bg-gradient-to-br from-primary to-purple-600 rounded-2xl shadow-lg">
|
||||||
|
<Sparkles className="h-8 w-8 text-white" />
|
||||||
|
</div>
|
||||||
|
<div className="absolute -inset-2 bg-gradient-to-br from-primary to-purple-600 rounded-2xl blur opacity-20 -z-10"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<CardTitle className="text-2xl font-bold">Registre des Ventes</CardTitle>
|
<div className="space-y-2">
|
||||||
<p className="text-muted-foreground">Connectez-vous pour accéder à l'application</p>
|
<CardTitle className="text-3xl font-bold gradient-text">Registre des Ventes</CardTitle>
|
||||||
|
<p className="text-muted-foreground text-lg">Gestion moderne des feux d'artifice</p>
|
||||||
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent className="space-y-6">
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="username"
|
name="username"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem className="space-y-3">
|
||||||
<FormLabel>Nom d'utilisateur</FormLabel>
|
<FormLabel className="text-sm font-semibold text-foreground">Nom d'utilisateur</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder="Votre nom d'utilisateur" {...field} />
|
<Input
|
||||||
|
placeholder="Votre nom d'utilisateur"
|
||||||
|
className="h-12 text-base border-2 border-border/50 focus:border-primary bg-background/50 backdrop-blur-sm smooth-transition"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@@ -82,35 +97,53 @@ export default function Login() {
|
|||||||
control={form.control}
|
control={form.control}
|
||||||
name="password"
|
name="password"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem className="space-y-3">
|
||||||
<FormLabel>Mot de passe</FormLabel>
|
<FormLabel className="text-sm font-semibold text-foreground">Mot de passe</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input type="password" placeholder="Votre mot de passe" {...field} />
|
<Input
|
||||||
|
type="password"
|
||||||
|
placeholder="Votre mot de passe"
|
||||||
|
className="h-12 text-base border-2 border-border/50 focus:border-primary bg-background/50 backdrop-blur-sm smooth-transition"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<Button type="submit" className="w-full" disabled={isLoggingIn}>
|
<Button
|
||||||
<LogIn className="h-4 w-4 mr-2" />
|
type="submit"
|
||||||
{isLoggingIn ? "Connexion..." : "Se connecter"}
|
className="w-full h-12 text-base font-semibold bg-gradient-to-r from-primary to-purple-600 hover:from-primary/90 hover:to-purple-600/90 hover:shadow-lg hover:scale-[1.02] smooth-transition"
|
||||||
|
disabled={isLoggingIn}
|
||||||
|
>
|
||||||
|
<LogIn className="h-5 w-5 mr-2" />
|
||||||
|
{isLoggingIn ? "Connexion en cours..." : "Se connecter"}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
{credentialsStatus?.showDefaultCredentials && (
|
{credentialsStatus?.showDefaultCredentials && (
|
||||||
<Alert className="mt-6">
|
<Alert className="status-info border-2 rounded-xl backdrop-blur-sm bg-blue-50/80 fade-in">
|
||||||
<Info className="h-4 w-4" />
|
<Info className="h-5 w-5" />
|
||||||
<AlertDescription>
|
<AlertDescription>
|
||||||
<div className="space-y-2">
|
<div className="space-y-3">
|
||||||
<p className="font-medium">Compte administrateur par défaut :</p>
|
<p className="font-semibold text-blue-900">Compte administrateur par défaut</p>
|
||||||
<div className="text-sm space-y-1">
|
<div className="bg-white/60 p-3 rounded-lg border border-blue-200/50 space-y-2">
|
||||||
<p><strong>Utilisateur :</strong> admin</p>
|
<div className="flex justify-between items-center">
|
||||||
<p><strong>Mot de passe :</strong> admin123</p>
|
<span className="text-sm font-medium text-blue-700">Utilisateur :</span>
|
||||||
|
<code className="text-sm font-mono bg-blue-100 px-2 py-1 rounded text-blue-800">admin</code>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between items-center">
|
||||||
|
<span className="text-sm font-medium text-blue-700">Mot de passe :</span>
|
||||||
|
<code className="text-sm font-mono bg-blue-100 px-2 py-1 rounded text-blue-800">admin123</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-start gap-2 p-3 bg-orange-50/80 border border-orange-200/50 rounded-lg">
|
||||||
|
<div className="text-orange-500 mt-0.5">⚠️</div>
|
||||||
|
<p className="text-xs text-orange-700 leading-relaxed">
|
||||||
|
<strong>Important :</strong> Changez ce mot de passe après votre première connexion pour sécuriser l'application.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-orange-600 mt-2">
|
|
||||||
⚠️ Changez ce mot de passe après votre première connexion pour sécuriser l'application.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</AlertDescription>
|
</AlertDescription>
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|||||||
Reference in new issue
Block a user