<?php $__env->startSection('title', 'Push Notifications'); ?>

<?php $__env->startSection('content'); ?>
<div class="max-w-[1200px] mx-auto p-6">
    <div class="flex items-center justify-between mb-8">
        <div>
            <h1 class="text-3xl font-extrabold tracking-tight">Push Notifications</h1>
            <p class="text-sm text-gray-500 mt-1">Send web push to all subscribers via OneSignal</p>
        </div>
        <a href="<?php echo e(route('admin.settings.index')); ?>#notifications" class="text-sm font-bold text-emerald-600 hover:underline">Configure OneSignal</a>
    </div>

    <?php if(session('success')): ?>
        <div class="bg-green-50 border border-green-200 text-green-800 p-4 rounded-xl mb-6">
            <?php echo e(session('success')); ?>

        </div>
    <?php endif; ?>

    <?php if($errors->any()): ?>
        <div class="bg-red-50 border border-red-200 text-red-800 p-4 rounded-xl mb-6">
            <ul class="list-disc list-inside text-sm">
                <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li><?php echo e($error); ?></li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
        </div>
    <?php endif; ?>

    <?php if(!$hasConfig): ?>
        <div class="bg-amber-50 border border-amber-200 text-amber-800 p-4 rounded-xl mb-6">
            OneSignal App ID or API Key is missing. Please configure them in Settings → Notifications.
        </div>
    <?php endif; ?>

    <form action="<?php echo e(route('admin.notifications.store')); ?>" method="POST" enctype="multipart/form-data" class="bg-white border border-gray-100 rounded-2xl p-6 space-y-6">
        <?php echo csrf_field(); ?>
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
            <div>
                <label class="block text-sm font-semibold text-gray-700 mb-2">Title</label>
                <input type="text" name="title" value="<?php echo e(old('title')); ?>" class="w-full border rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-emerald-200" placeholder="Sale is Live!">
            </div>
            <div>
                <label class="block text-sm font-semibold text-gray-700 mb-2">Target URL (optional)</label>
                <input type="url" name="url" value="<?php echo e(old('url')); ?>" class="w-full border rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-emerald-200" placeholder="https://example.com/special-offers">
            </div>
        </div>
        <div>
            <label class="block text-sm font-semibold text-gray-700 mb-2">Message</label>
            <textarea name="message" rows="3" class="w-full border rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-emerald-200" placeholder="Get 20% off on fresh vegetables this weekend."></textarea>
        </div>
        <div>
            <label class="block text-sm font-semibold text-gray-700 mb-2">Image</label>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                <div>
                    <input type="file" name="image_file" accept="image/*" class="w-full border rounded-xl px-4 py-3">
                    <p class="text-xs text-gray-400 mt-2">Upload an image to send with notification.</p>
                </div>
                <div>
                    <input type="url" name="image" value="<?php echo e(old('image')); ?>" class="w-full border rounded-xl px-4 py-3" placeholder="Or paste Image URL">
                    <p class="text-xs text-gray-400 mt-2">If both provided, uploaded image will be used.</p>
                </div>
            </div>
        </div>
        <div class="flex justify-end">
            <button type="submit" class="px-6 py-3 rounded-xl bg-emerald-600 text-white font-extrabold hover:bg-emerald-700 transition">Send Notification</button>
        </div>
    </form>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/burhjijr/adminprovendorx.burhanstore.online/resources/views/admin/notifications/create.blade.php ENDPATH**/ ?>