<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Edit Diskon Toko - Raja Futsal</title>

    <!-- Tailwind CSS -->
    <script src="https://cdn.tailwindcss.com"></script>

    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">

    <!-- Inter Font -->
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">

    <style>
        body { font-family: 'Inter', sans-serif; background-color: #f9fafb; }
        ::-webkit-scrollbar { width: 8px; height: 8px; }
        ::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
        ::-webkit-scrollbar-thumb { background: #f97316; border-radius: 10px; }
        ::-webkit-scrollbar-thumb:hover { background: #ea580c; }
        select, input, textarea, button { transition: all 0.2s ease; }
        .card-shadow { box-shadow: 0 10px 40px -15px rgba(0, 0, 0, 0.1); }
    </style>
</head>
<body class="min-h-screen py-8">

    <div class="max-w-2xl mx-auto px-4">

        <div class="bg-white shadow-xl card-shadow rounded-3xl w-full p-8 border border-gray-100">

            <!-- Header -->
            <div class="text-center mb-8">
                <div class="inline-block p-4 bg-orange-50 rounded-full mb-4">
                    <i class="fas fa-tags text-4xl text-orange-500"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">
                    Pengaturan Diskon Toko
                </h2>
                <p class="text-gray-500 mt-2">Atur besaran diskon dan minimal belanja untuk toko Anda</p>
            </div>

            <!-- TOAST NOTIFICATION -->
            <?php if(session('success') || session('error')): ?>
            <div id="toast-notification"
                class="fixed bottom-6 right-6 z-50 flex items-center gap-3 bg-white border <?php echo e(session('success') ? 'border-green-200' : 'border-red-200'); ?> shadow-2xl rounded-2xl px-5 py-4 max-w-sm w-full"
                style="animation: slideInRight 0.4s ease;">
                <div class="w-10 h-10 <?php echo e(session('success') ? 'bg-green-500' : 'bg-red-500'); ?> rounded-xl flex items-center justify-center flex-shrink-0">
                    <i class="fas <?php echo e(session('success') ? 'fa-check' : 'fa-exclamation'); ?> text-white text-sm"></i>
                </div>
                <div class="flex-1 min-w-0">
                    <p class="toast-title font-semibold text-gray-800 text-sm"><?php echo e(session('success') ? 'Berhasil!' : 'Gagal!'); ?></p>
                    <p class="toast-message text-gray-500 text-xs mt-0.5 truncate"><?php echo e(session('success') ?? session('error')); ?></p>
                </div>
                <button onclick="closeToast()" class="text-gray-400 hover:text-gray-600 flex-shrink-0 ml-1">
                    <i class="fas fa-times text-xs"></i>
                </button>
                <div class="absolute bottom-0 left-0 h-1 <?php echo e(session('success') ? 'bg-green-500' : 'bg-red-500'); ?> rounded-b-2xl" id="toastProgress"
                    style="width: 100%; transition: width 5s linear;"></div>
            </div>

            <style>
            @keyframes slideInRight {
                from { opacity: 0; transform: translateX(100px); }
                to   { opacity: 1; transform: translateX(0); }
            }
            @keyframes slideOutRight {
                from { opacity: 1; transform: translateX(0); }
                to   { opacity: 0; transform: translateX(100px); }
            }
            </style>

            <script>
                setTimeout(() => {
                    const bar = document.getElementById('toastProgress');
                    if (bar) bar.style.width = '0%';
                }, 100);
                setTimeout(() => closeToast(), 5100);
                function closeToast() {
                    const toast = document.getElementById('toast-notification');
                    if (toast) {
                        toast.style.animation = 'slideOutRight 0.3s ease forwards';
                        setTimeout(() => toast.remove(), 300);
                    }
                }
            </script>
            <?php endif; ?>

            <!-- Form Edit -->
            <form method="POST" action="<?php echo e(route('penjual.diskon.update')); ?>" class="space-y-6">
                <?php echo csrf_field(); ?>

                <!-- Disklaimer -->
                <div class="bg-blue-50 border border-blue-200 rounded-xl p-4 flex items-start gap-3">
                    <i class="fas fa-info-circle text-blue-500 mt-1"></i>
                    <div>
                        <h4 class="font-semibold text-blue-800 text-sm">Informasi Diskon</h4>
                        <p class="text-blue-700 text-xs mt-1">
                            Diskon ini akan otomatis diberikan kepada pembeli jika total belanja mereka di toko Anda 
                            mencapai atau melebih angka "Minimal Belanja" yang Anda atur.
                        </p>
                    </div>
                </div>

                <!-- Minimal Belanja -->
                <div class="group">
                    <label class="block text-sm font-semibold text-gray-700 mb-2">
                        <i class="fas fa-shopping-basket mr-2 text-orange-500"></i> Minimal Belanja (Rp)
                    </label>
                    <div class="relative">
                        <div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
                            <span class="text-gray-500 font-medium">Rp</span>
                        </div>
                        <input type="number" name="min_belanja" value="<?php echo e(old('min_belanja', $toko->min_belanja)); ?>"
                               placeholder="Contoh: 200000"
                               min="0"
                               class="w-full border-2 border-gray-200 rounded-xl p-3 pl-12 focus:border-orange-400 focus:ring-2 focus:ring-orange-200 outline-none transition <?php $__errorArgs = ['min_belanja'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                               required>
                    </div>
                    <p class="text-xs text-gray-400 mt-1">Isi 0 jika mau memberikan diskon tanpa minimal belanja.</p>
                    <?php $__errorArgs = ['min_belanja'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="text-red-500 text-sm mt-1"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <!-- Nominal Diskon -->
                <div class="group">
                    <label class="block text-sm font-semibold text-gray-700 mb-2">
                        <i class="fas fa-money-bill-wave mr-2 text-orange-500"></i> Nominal Diskon (Rp)
                    </label>
                    <div class="relative">
                        <div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
                            <span class="text-gray-500 font-medium">Rp</span>
                        </div>
                        <input type="number" name="diskon_nominal" value="<?php echo e(old('diskon_nominal', $toko->diskon_nominal)); ?>"
                               placeholder="Contoh: 10000"
                               min="0"
                               class="w-full border-2 border-gray-200 rounded-xl p-3 pl-12 focus:border-orange-400 focus:ring-2 focus:ring-orange-200 outline-none transition <?php $__errorArgs = ['diskon_nominal'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-500 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                               required>
                    </div>
                    <p class="text-xs text-gray-400 mt-1">Isi 0 jika toko Anda sedang tidak mengadakan diskon.</p>
                    <?php $__errorArgs = ['diskon_nominal'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="text-red-500 text-sm mt-1"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <!-- Action Buttons -->
                <div class="flex gap-4 mt-8 pt-4 border-t border-gray-100">
                    <button type="submit"
                            class="flex-1 bg-gradient-to-r from-orange-500 to-orange-600 hover:from-orange-600 hover:to-orange-700 text-white font-semibold py-3 px-6 rounded-xl transition transform hover:scale-105 shadow-lg hover:shadow-xl flex items-center justify-center gap-2">
                        <i class="fas fa-save"></i>
                        Simpan Pengaturan
                    </button>

                    <a href="<?php echo e(route('produk.index')); ?>"
                       class="flex-1 bg-gray-100 hover:bg-gray-200 text-gray-700 font-semibold py-3 px-6 rounded-xl transition transform hover:scale-105 flex items-center justify-center gap-2">
                        Batal
                    </a>
                </div>
            </form>
        </div>
    </div>

</body>
</html>
<?php /**PATH C:\laragon\www\ecommerce\resources\views/toko/edit_diskon.blade.php ENDPATH**/ ?>