

<?php $__env->startSection('title', 'Create Coupon'); ?>
<?php $__env->startSection('page-title', 'Create Coupon'); ?>

<?php $__env->startSection('content'); ?>
<div class="bg-white rounded-lg shadow p-6 max-w-3xl">
    <form method="POST" action="<?php echo e(route('admin.coupons.store')); ?>">
        <?php echo csrf_field(); ?>

        <div class="space-y-6">
            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label for="code" class="block text-sm font-medium text-gray-700">Coupon Code *</label>
                    <input type="text" name="code" id="code" value="<?php echo e(old('code')); ?>" required
                           class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 font-mono">
                    <p class="mt-1 text-sm text-gray-500">Leave empty to auto-generate</p>
                    <?php $__errorArgs = ['code'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div>
                    <label for="name" class="block text-sm font-medium text-gray-700">Coupon Name *</label>
                    <input type="text" name="name" id="name" value="<?php echo e(old('name')); ?>" required
                           class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3">
                </div>
            </div>

            <div>
                <label for="description" class="block text-sm font-medium text-gray-700">Description</label>
                <textarea name="description" id="description" rows="2"
                          class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3"><?php echo e(old('description')); ?></textarea>
            </div>

            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label for="type" class="block text-sm font-medium text-gray-700">Discount Type *</label>
                    <select name="type" id="type" required
                            class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3">
                        <option value="percentage" <?php echo e(old('type') == 'percentage' ? 'selected' : ''); ?>>Percentage</option>
                        <option value="fixed" <?php echo e(old('type') == 'fixed' ? 'selected' : ''); ?>>Fixed Amount</option>
                    </select>
                </div>

                <div>
                    <label for="discount_value" class="block text-sm font-medium text-gray-700">Discount Value *</label>
                    <input type="number" step="0.01" name="discount_value" id="discount_value" value="<?php echo e(old('discount_value')); ?>" required
                           class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3">
                </div>
            </div>

            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label for="minimum_order_amount" class="block text-sm font-medium text-gray-700">Minimum Order Amount</label>
                    <input type="number" step="0.01" name="minimum_order_amount" id="minimum_order_amount" value="<?php echo e(old('minimum_order_amount', 0)); ?>"
                           class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3">
                </div>

                <div>
                    <label for="maximum_discount" class="block text-sm font-medium text-gray-700">Maximum Discount</label>
                    <input type="number" step="0.01" name="maximum_discount" id="maximum_discount" value="<?php echo e(old('maximum_discount')); ?>"
                           class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3">
                    <p class="mt-1 text-sm text-gray-500">For percentage discounts only</p>
                </div>
            </div>

            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label for="usage_limit" class="block text-sm font-medium text-gray-700">Usage Limit</label>
                    <input type="number" name="usage_limit" id="usage_limit" value="<?php echo e(old('usage_limit')); ?>"
                           class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3">
                    <p class="mt-1 text-sm text-gray-500">Leave empty for unlimited</p>
                </div>

                <div class="flex items-center pt-6">
                    <input type="checkbox" name="is_active" id="is_active" value="1" <?php echo e(old('is_active', true) ? 'checked' : ''); ?>

                           class="h-4 w-4 text-blue-600">
                    <label for="is_active" class="ml-2 block text-sm text-gray-900">Active</label>
                </div>
            </div>

            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label for="valid_from" class="block text-sm font-medium text-gray-700">Valid From *</label>
                    <input type="date" name="valid_from" id="valid_from" value="<?php echo e(old('valid_from', now()->format('Y-m-d'))); ?>" required
                           class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3">
                </div>

                <div>
                    <label for="valid_until" class="block text-sm font-medium text-gray-700">Valid Until *</label>
                    <input type="date" name="valid_until" id="valid_until" value="<?php echo e(old('valid_until')); ?>" required
                           class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3">
                </div>
            </div>

            <div class="flex justify-end space-x-4">
                <a href="<?php echo e(route('admin.coupons.index')); ?>" class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded">
                    Cancel
                </a>
                <button type="submit" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
                    Create Coupon
                </button>
            </div>
        </div>
    </form>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\laragon\www\ReactNative\grocery-api\resources\views/admin/coupons/create.blade.php ENDPATH**/ ?>