-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarque.html
161 lines (140 loc) · 8.5 KB
/
marque.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ajout de marque</title>
<meta name="title" content="France Fabrique - Découvrez le Made in France">
<meta name="description" content="France Fabrique vous permet de visualiser tout le Made in France : usines, boutiques, marques et bien plus encore. Explorez la richesse de la production française.">
<meta name="keywords" content="Made in France, usines, boutiques, marques, production française, fabriqué en France, industrie française, artisanat français, produits français">
<meta name="robots" content="index, follow">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/flowbite.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@supabase/[email protected]/dist/umd/supabase.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
}
input, textarea, select {
width: 100%;
padding: 8px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
width: 100%;
padding: 10px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
}
</style>
</head>
<body>
<nav class="bg-white border-gray-200 dark:bg-gray-900">
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<a href="/" class="flex items-center space-x-3 rtl:space-x-reverse">
<img src="fav.png" class="h-8" alt="FranceFabrique.fr Logo" />
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">FranceFabrique.fr</span>
</a>
<button data-collapse-toggle="navbar-default" type="button" class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-default" aria-expanded="false">
<span class="sr-only">Open main menu</span>
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15"/>
</svg>
</button>
<div class="hidden w-full md:block md:w-auto" id="navbar-default">
<ul class="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
<li>
<a href="marquelisting.html" class="block py-2 px-3 text-white bg-white-700 rounded md:bg-transparent md:text-white-700 md:p-0 dark:text-white md:dark:text-white-500" aria-current="page">Listing des marques</a>
</li>
<li>
<a href="form.html" class="block py-2 px-3 text-white bg-white-700 rounded md:bg-transparent md:text-white-700 md:p-0 dark:text-white md:dark:text-white-500" aria-current="page">Ajout de marker</a>
</li>
<li>
<a href="marque.html" class="block py-2 px-3 text-white bg-white-700 rounded md:bg-transparent md:text-white-700 md:p-0 dark:text-white md:dark:text-white-500" aria-current="page">Ajout d'une marque</a>
</li>
</ul>
</div>
</div>
</nav>
<h1 class="text-center text-3xl font-semibold mb-8">Ajouter une Marque</h1>
<form id="marqueForm" class="space-y-4 max-w-lg mx-auto p-6 border border-gray-300 rounded-lg shadow-md">
<div>
<label for="password" class="block text-sm font-medium text-gray-700">Mot de passe :</label>
<input type="password" id="password" name="password" required class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="nom" class="block text-sm font-medium text-gray-700">Nom :</label>
<input type="text" id="nom" name="nom" required class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="description" class="block text-sm font-medium text-gray-700">Description :</label>
<textarea id="description" name="description" required class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea>
</div>
<div>
<label for="image" class="block text-sm font-medium text-gray-700">URL de l'image :</label>
<input type="url" id="image" name="image" required class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="logo" class="block text-sm font-medium text-gray-700">Logo :</label>
<input type="url" id="logo" name="logo" required class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="link" class="block text-sm font-medium text-gray-700">Lien :</label>
<input type="url" id="link" name="link" required class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<button type="submit" class="w-full py-2 bg-indigo-600 text-white rounded-md shadow-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500">Soumettre</button>
</div>
</form>
<script type="module">
// Initialiser Supabase
import { createClient } from 'https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm';
import { SUPABASE_URL, SUPABASE_KEY } from './config.js';
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
// Fonction pour se connecter
async function signIn(password) {
const { user, error } = await supabase.auth.signInWithPassword({
email: '[email protected]', // Remplacez par votre email
password: password, // Remplacez par votre mot de passe
});
if (error) {
console.error('Erreur de connexion :', error.message);
} else {
console.log('Utilisateur connecté :', user);
// Vous pouvez ensuite rediriger l'utilisateur vers une autre page ou stocker son état
}
}
// Gérer la soumission du formulaire
const form = document.getElementById('marqueForm');
form.addEventListener('submit', async (event) => {
event.preventDefault();
const password = document.getElementById('password').value;
// Récupérer les données du formulaire
const Name = document.getElementById('nom').value;
const Description = document.getElementById('description').value;
const image = document.getElementById('image').value;
const link = document.getElementById('link').value;
const Logo = document.getElementById('logo').value;
await signIn(password);
// Insérer les données dans Supabase
const { data, error } = await supabase
.from('Marques') // Nom de la table Supabase
.insert([ { Name, Description, image, link, Logo } ]);
if (error) {
console.error('Erreur lors de l\'insertion des données :', error);
alert('Erreur lors de l\'ajout de la marque.');
} else {
alert('Marque ajouté avec succès !');
form.reset(); // Réinitialiser le formulaire
}
});
// Appel de signIn pour la connexion
// signIn();
</script>
</body>
</html>