<form action="<?php echo e($stat ? route('admin.stats.update', $stat) : route('admin.stats.store')); ?>" method="POST" enctype="multipart/form-data">
    <?php echo csrf_field(); ?>
    <?php if($stat): ?> <?php echo method_field('PUT'); ?> <?php endif; ?>
    <div class="mb-3">
        <label class="form-label">Label <span class="text-danger">*</span></label>
        <input type="text" name="label" class="form-control" value="<?php echo e(old('label', $stat->label ?? '')); ?>" required>
        <div class="form-text">e.g. Established in KSA</div>
    </div>
    <div class="mb-3">
        <label class="form-label">Value <span class="text-danger">*</span></label>
        <input type="text" name="value" class="form-control" value="<?php echo e(old('value', $stat->value ?? '')); ?>" required>
        <div class="form-text">e.g. 2023</div>
    </div>
    <div class="mb-3">
        <label class="form-label">Country Flag (small image)</label>
        <input type="file" name="flag" class="form-control" accept="image/*">
        <div class="form-text">Small flag image. Clicking it on the website opens the popup below.</div>
        <?php if($stat && $stat->flag): ?>
            <img src="<?php echo e(\App\Services\FileUploadService::url($stat->flag)); ?>" class="mt-2 border rounded" style="height:40px">
        <?php endif; ?>
    </div>
    <div class="mb-3">
        <label class="form-label">Popup Title</label>
        <input type="text" name="popup_title" class="form-control" value="<?php echo e(old('popup_title', $stat->popup_title ?? '')); ?>" placeholder="e.g. Oman Company Certification">
        <div class="form-text">Optional heading shown at the top of the certification popup.</div>
    </div>
    <div class="mb-3">
        <label class="form-label">Certification Image (shown in popup)</label>
        <input type="file" name="popup_image" class="form-control" accept="image/*">
        <div class="form-text">Image of your company certification for this country, shown when the flag is clicked.</div>
        <?php if($stat && $stat->popup_image): ?>
            <img src="<?php echo e(\App\Services\FileUploadService::url($stat->popup_image)); ?>" class="img-fluid mt-2 border rounded" style="max-height:140px">
        <?php endif; ?>
    </div>
    <div class="mb-3">
        <label class="form-label">Sort Order</label>
        <input type="number" name="sort_order" class="form-control" value="<?php echo e(old('sort_order', $stat->sort_order ?? 0)); ?>" min="0">
    </div>
    <div class="form-check mb-3">
        <input type="checkbox" class="form-check-input" id="is_active" name="is_active" value="1" <?php echo e(old('is_active', $stat->is_active ?? true) ? 'checked' : ''); ?>>
        <label class="form-check-label" for="is_active">Active</label>
    </div>
    <button type="submit" class="btn btn-primary"><?php echo e($stat ? 'Update' : 'Create'); ?> Statistic</button>
    <a href="<?php echo e(route('admin.stats.index')); ?>" class="btn btn-outline-secondary">Cancel</a>
</form>
<?php /**PATH C:\xampp\htdocs\skyline\resources\views/admin/stats/_form.blade.php ENDPATH**/ ?>