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j '  'P$a ( `D$Na L?u80e J,K˷NI'0eݷ(NI'؀ 2ipIIKp`:O'`ʤxB8Ѥx Ѥx $ $P6 :vRNb 'p,>NB 'P]-->P T+*^h& p '‰a ‰ (ĵt#u33;Nt̵'ޯ; [3W ~]0KH1q@8]O2]3*̧7# *p>us p _6]/}-4|t'|Smx= DoʾM×M_8!)6lq':l7!|4} '\ne t!=hnLn (~Dn\+‰_4k)0e@OhZ`F `.m1} 'vp{F`ON7Srx 'D˸nV`><;yMx!IS钦OM)Ե٥x 'DSD6bS8!" ODz#R >S8!7ّxEh0m$MIPHi$IvS8IN$I p$O8I,sk&I)$IN$Hi$I^Ah.p$MIN$IR8I·N "IF9Ah0m$MIN$IR8IN$I 3jIU;kO$ɳN$+ q.x* tEXtComment

Viewing File: /home/u423589436/domains/magacoin.online/public_html/resources/views/user/buy/details.blade.php

<x-user-layout>
    <main class="w-full mx-auto h-auto bg-gray-100 text-gray-900 dark:bg-gray-900 dark:text-white transition-all duration-300">
        <!-- Header -->
        <div class="flex items-center justify-between p-4">
            <a href="{{ route('dashboard') }}" class="text-gray-400 hover:text-gray-300">
                <i class="fas fa-arrow-left text-xl"></i>
            </a>
            <h1 class="text-xl font-semibold">Buy {{ $asset['name'] }}</h1>
            <div class="w-8"></div>
        </div>

        <!-- Main Content -->
        <div class="p-4 flex flex-col items-center justify-center min-h-[calc(100vh-70px)]">
            <!-- Amount Input -->
            <div class="text-center mb-8">
                <div class="flex items-center justify-center text-4xl mb-2">
                    <span class="mr-2">$</span>
                    <input 
                        type="number" 
                        value="150" 
                        id="usdAmount"
                        class="w-32 bg-transparent text-center focus:outline-none text-4xl"
                        min="0"
                    >
                </div>
                <p class="text-gray-400">
                    ≈ <span id="cryptoAmount">{{ number_format(150 / $asset['price'], 8) }}</span> {{ $asset['symbol'] }}
                </p>
            </div>

            <!-- Payment Options -->
            <div class="w-full max-w-md space-y-4">
                <button onclick="togglePaymentModal()" class="w-full bg-gray-200 dark:bg-gray-800 hover:bg-gray-300 dark:hover:bg-gray-700 text-black dark:text-white rounded-lg p-4">
                    <div class="flex items-center justify-between">
                       <div class="flex items-center">
    <div class="w-8 h-8 bg-white rounded-full flex items-center justify-center mr-3">
        <i class="fas fa-credit-card text-black"></i>
    </div>
    <div class="text-left">
        <p id="selectedProviderName" class="text-yellow-500">Choose Payment Method</p>
        <p id="selectedProviderInstruction" class="text-sm text-gray-700 dark:text-gray-400">Select provider</p>
    </div>
</div>

                        <i class="fas fa-chevron-right text-gray-400"></i>
                    </div>
                </button>

                <!-- Dynamic "Buy Now" Button -->
                <button id="buyButton" onclick="redirectToProvider()" class="w-full bg-yellow-500 hover:bg-yellow-600 text-black font-semibold py-4 rounded-lg transition-colors">
                    Buy {{ $asset['symbol'] }} Now
                </button>
            </div>
        </div>

        <!-- Payment Method Modal -->
<div id="paymentModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50" onclick="togglePaymentModal()">
    <div class="bg-gray-100 dark:bg-gray-900 w-full max-w-md rounded-lg p-6 mx-4" onclick="event.stopPropagation()">
        <!-- Modal Header -->
        <div class="flex items-center justify-between mb-6">
            <h2 class="text-xl font-semibold">Payment Method</h2>
            <button onclick="togglePaymentModal()" class="text-gray-400 hover:text-gray-300">
                <i class="fas fa-times"></i>
            </button>
        </div>

        <!-- Payment Methods -->
        <div class="space-y-4 mb-6">
            <label class="flex items-center space-x-3 cursor-pointer">
                <input type="radio" name="payment" value="binance" checked class="form-radio text-yellow-500">
                <span class="flex items-center">
                    <i class="fas fa-credit-card mr-2"></i>
                    Binance
                </span>
            </label>

            <label class="flex items-center space-x-3 cursor-pointer">
                <input type="radio" name="payment" value="transak" class="form-radio text-yellow-500">
                <span class="flex items-center">
                    <i class="fas fa-university mr-2"></i>
                    Transak
                </span>
            </label>

            <label class="flex items-center space-x-3 cursor-pointer">
                <input type="radio" name="payment" value="moonpay" class="form-radio text-yellow-500">
                <span class="flex items-center">
                    <i class="fas fa-mobile-alt mr-2"></i>
                    MoonPay
                </span>
            </label>
        </div>

        <!-- Confirm Payment Method Button -->
        <button onclick="updateSelectedProvider()" class="w-full bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 rounded-lg">
            Confirm Payment Method
        </button>
    </div>
</div>

    </main>

    @push('scripts')
    <script>
    function updateSelectedProvider() {
    // Get the selected radio button value
    const selectedRadio = document.querySelector('input[name="payment"]:checked');
    if (selectedRadio) {
        const selectedValue = selectedRadio.value;
        // Map the radio values to display names
        const providerMapping = {
            binance: 'Binance',
            transak: 'Transak',
            moonpay: 'MoonPay'
        };
        // Update the text in the main button with the selected provider
        document.getElementById('selectedProviderName').textContent = providerMapping[selectedValue] || 'Choose Payment Method';
        // Optionally update the instruction line
        document.getElementById('selectedProviderInstruction').textContent = 'Selected';
    }
    // Close the modal after updating
    togglePaymentModal();
}

        // Toggle the visibility of the payment modal
        function togglePaymentModal() {
            const modal = document.getElementById('paymentModal');
            modal.classList.toggle('hidden');
        }

        // Update crypto amount based on USD input value
        function updateCryptoAmount() {
            const usdInput = document.getElementById('usdAmount');
            const usdAmount = parseFloat(usdInput.value) || 0;
            const price = Number("{{ $asset['price'] }}");
            const cryptoAmount = (usdAmount / price).toFixed(8);
            document.getElementById('cryptoAmount').textContent = cryptoAmount;
        }

        // Initialize the calculation and attach input listener
        document.addEventListener('DOMContentLoaded', function() {
            updateCryptoAmount();
            document.getElementById('usdAmount').addEventListener('input', updateCryptoAmount);
        });

        // Redirect to the selected payment provider
        function redirectToProvider() {
            const selectedPayment = document.querySelector('input[name="payment"]:checked');
            if (!selectedPayment) {
                alert('Please select a payment provider');
                return;
            }
            const selectedProvider = selectedPayment.value;

            let providerUrl = '';

            switch (selectedProvider) {
                case 'binance':
                    providerUrl = 'https://www.binance.com/en/buy-crypto';
                    break;
                case 'transak':
                    providerUrl = 'https://transak.com/';
                    break;
                case 'moonpay':
                    providerUrl = "https://www.moonpay.com/buy/{{ strtolower($asset['symbol']) }}";
                    break;
                default:
                    alert('Invalid payment provider selected');
                    return;
            }

            window.location.href = providerUrl;
        }
    </script>
    @endpush
</x-user-layout>
Back to Directory=ceiIENDB`