feat: Add banner management functionality
- Implemented a new Banner model to represent banner data. - Created a BannerRepository for database interactions related to banners. - Developed a BannerService to handle business logic for banners. - Added admin views for listing and adding banners. - Integrated banner hooks for frontend rendering and click tracking. - Created frontend styles and scripts for banner display and interaction. - Updated database migrations to include a new banners table. - Enhanced AdminController to manage banner actions and pages.
This commit is contained in:
66
admin/views/banner-list.php
Normal file
66
admin/views/banner-list.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
// Prevent direct access
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$current_page = sanitize_text_field($_GET['page'] ?? 'sodino-banners');
|
||||
?>
|
||||
<div id="sodino-app" class="min-h-screen bg-gray-50" dir="rtl">
|
||||
<div class="bg-white border-b border-gray-200 shadow-sm">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-gray-900"><?php _e('بنرهای هوشمند', 'sodino'); ?></h1>
|
||||
<p class="mt-1 text-sm text-gray-500"><?php _e('مدیریت بنرهای زمانبندی شده و هدفمند سایت.', 'sodino'); ?></p>
|
||||
</div>
|
||||
<a href="<?php echo admin_url('admin.php?page=sodino-add-banner'); ?>" class="inline-flex items-center gap-2 rounded-full bg-blue-600 px-5 py-3 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">
|
||||
<?php _e('افزودن بنر جدید', 'sodino'); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
<div class="grid gap-8 lg:grid-cols-[280px_1fr]">
|
||||
<aside class="bg-white rounded-2xl border border-gray-200 p-6 shadow-sm">
|
||||
<h2 class="text-lg font-semibold text-gray-900 mb-4"><?php _e('منوی سودینو', 'sodino'); ?></h2>
|
||||
<nav class="space-y-2">
|
||||
<a href="<?php echo admin_url('admin.php?page=sodino-dashboard'); ?>" class="block px-3 py-2 rounded-xl text-sm font-medium <?php echo $current_page === 'sodino-dashboard' ? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?>">
|
||||
<?php _e('داشبورد', 'sodino'); ?>
|
||||
</a>
|
||||
<a href="<?php echo admin_url('admin.php?page=sodino-rules'); ?>" class="block px-3 py-2 rounded-xl text-sm font-medium <?php echo $current_page === 'sodino-rules' ? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?>">
|
||||
<?php _e('قوانین', 'sodino'); ?>
|
||||
</a>
|
||||
<a href="<?php echo admin_url('admin.php?page=sodino-banners'); ?>" class="block px-3 py-2 rounded-xl text-sm font-medium <?php echo $current_page === 'sodino-banners' ? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?>">
|
||||
<?php _e('بنرهای هوشمند', 'sodino'); ?>
|
||||
</a>
|
||||
<a href="<?php echo admin_url('admin.php?page=sodino-settings'); ?>" class="block px-3 py-2 rounded-xl text-sm font-medium <?php echo $current_page === 'sodino-settings' ? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?>">
|
||||
<?php _e('تنظیمات', 'sodino'); ?>
|
||||
</a>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
<main class="space-y-6">
|
||||
<div class="bg-white rounded-2xl border border-gray-200 p-6 shadow-sm">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<h2 class="text-xl font-semibold text-gray-900"><?php _e('لیست بنرها', 'sodino'); ?></h2>
|
||||
<p class="mt-1 text-sm text-gray-500"><?php _e('نمایش، ویرایش، فعال/غیرفعال و حذف گروهی بنرها.', 'sodino'); ?></p>
|
||||
</div>
|
||||
<span class="inline-flex items-center rounded-full bg-blue-50 px-4 py-2 text-sm font-medium text-blue-700">
|
||||
<?php _e('حداکثر ۲ بنر همزمان نمایش داده میشوند', 'sodino'); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl border border-gray-200 p-6 shadow-sm">
|
||||
<form method="post">
|
||||
<?php wp_nonce_field('bulk-sodino_banners'); ?>
|
||||
<?php $bannerTable->display(); ?>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user