145 lines
5.0 KiB
PHP
Executable File
145 lines
5.0 KiB
PHP
Executable File
<?php
|
|
require("../../include/variables.php");
|
|
require("../../include/init.php");
|
|
require("../../include/main-functions.php");
|
|
require("../../include/objects.php");
|
|
require("../../include/panels.php");
|
|
|
|
if (isset($_SESSION['userID']) == false || empty($_SESSION['userID'])) {
|
|
header("Location: /login?p=don");
|
|
die('Veuillez vous connecter dans <a href="/login">/login</a>');
|
|
}
|
|
|
|
$pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass);
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
<?php fillHead($rootPageURL, "Faire un don - " . $pageTitle, $darkTheme, $lightTheme);?>
|
|
<style>
|
|
#donationRange {
|
|
-webkit-appearance: none;
|
|
margin: 3em;
|
|
width: 40%;
|
|
height: 8px;
|
|
background: #aaa;
|
|
opacity: 0.9;
|
|
transition: opacity .2s;
|
|
border-radius: 5px;
|
|
}
|
|
#donationRange:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* Style du curseur */
|
|
#donationRange::-webkit-slider-thumb {
|
|
-webkit-appearance: none;
|
|
appearance: none;
|
|
width: 30px;
|
|
height: 30px;
|
|
border-radius: 50%;
|
|
background: #fff; /* Cercle blanc */
|
|
border: 4px solid #000; /* Bord noir */
|
|
cursor: pointer;
|
|
}
|
|
|
|
#donationRange::-moz-range-thumb {
|
|
width: 30px;
|
|
height: 30px;
|
|
border-radius: 50%;
|
|
background: #fff; /* Cercle blanc */
|
|
border: 4px solid #000; /* Bord noir */
|
|
cursor: pointer;
|
|
}
|
|
#donationAmountEuros {
|
|
font-size: 2em;
|
|
font-family: cfont;
|
|
margin-top: 2em;
|
|
}
|
|
#payButton {
|
|
margin: 2em;
|
|
font-size: 1.1em;
|
|
}
|
|
#value-input {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin-top: 1em;
|
|
}
|
|
@media(max-width: 750px) {
|
|
#donationRange {
|
|
width: 100%;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body class="body">
|
|
|
|
<header>
|
|
<div class="panel-content">
|
|
<?php fillHeader($rootPageURL, $headerTitle, $headerSubtitle, $social);?>
|
|
</div>
|
|
<meta name="description" content="Rassembler les étudiants dans des projets innovants.">
|
|
<meta name="author" content="E59">
|
|
|
|
<meta property="og:locale" content="fr_FR">
|
|
<meta property="og:site_name" content="e59.fr">
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:title" content="Association E59">
|
|
<meta property="og:description" content="Faire un don">
|
|
<meta property="og:url" content="https://e59.fr">
|
|
<meta property="og:image" content="https://e59.fr/src/img/e59-pp.png">
|
|
<meta property="og:image:width" content="500">
|
|
<meta property="og:image:height" content="500">
|
|
<meta property="og:image:type" content="image/png">
|
|
</header>
|
|
|
|
<nav>
|
|
<div class="panel-content">
|
|
<?php fillNav($rootPageURL);?>
|
|
</div>
|
|
</nav>
|
|
|
|
<main>
|
|
<div class="content">
|
|
<div id="value-input">
|
|
<h2>Sélectionnez le montant de votre don</h2>
|
|
<div id="donationAmountEuros"><span id="donationAmount">10</span>€</div>
|
|
<input type="range" id="donationRange" min="1" max="7" value="3" step="1" oninput="updateDonationAmount()">
|
|
<button id="payButton" onclick="payDonation()">Continuer</button>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<footer>
|
|
<div class="panel-content">
|
|
<?php fillFooter($footerText);?>
|
|
</div>
|
|
</footer>
|
|
<script>
|
|
// Liste des montants disponibles
|
|
var donationAmounts = [1, 2, 5, 10, 20, 50, 100];
|
|
|
|
// Mettre à jour le montant affiché
|
|
function updateDonationAmount() {
|
|
var index = document.getElementById("donationRange").value - 1;
|
|
var amount = donationAmounts[index];
|
|
document.getElementById("donationAmount").textContent = amount;
|
|
}
|
|
|
|
// Rediriger vers la page de paiement en fonction du montant sélectionné
|
|
function payDonation() {
|
|
var index = document.getElementById("donationRange").value - 1;
|
|
var amount = donationAmounts[index];
|
|
window.open("/pay?type=1&amount=" + amount, '_blank');
|
|
}
|
|
|
|
// Initialiser l'affichage du montant au chargement de la page
|
|
updateDonationAmount();
|
|
</script>
|
|
</body>
|
|
</html>
|