feat(Rule): add new rules
This commit is contained in:
@@ -5,20 +5,28 @@ if (!defined('ABSPATH')) {
|
||||
}
|
||||
|
||||
$current_page = sanitize_text_field($_GET['page'] ?? 'sodino-add-rule');
|
||||
$form_condition_type = function_exists('sodino_old_input') ? sodino_old_input('condition_type', $rule->condition_type) : $rule->condition_type;
|
||||
$form_action_type = function_exists('sodino_old_input') ? sodino_old_input('action_type', $rule->action_type) : $rule->action_type;
|
||||
$conditions = function_exists('sodino_old_input') ? sodino_old_input('conditions', $rule->conditions) : $rule->conditions;
|
||||
$actions = function_exists('sodino_old_input') ? sodino_old_input('actions', $rule->actions) : $rule->actions;
|
||||
$conditions = is_array($conditions) && $conditions ? array_values($conditions) : [['type' => 'user_type', 'operator' => 'is', 'value' => 'new']];
|
||||
$actions = is_array($actions) && $actions ? array_values($actions) : [['type' => 'discount_percent', 'value' => 10]];
|
||||
$product_categories = get_terms(['taxonomy' => 'product_cat', 'hide_empty' => false]);
|
||||
$product_tags = get_terms(['taxonomy' => 'product_tag', 'hide_empty' => false]);
|
||||
$weekdays = [
|
||||
'1' => __('دوشنبه', 'sodino'),
|
||||
'2' => __('سهشنبه', 'sodino'),
|
||||
'3' => __('چهارشنبه', 'sodino'),
|
||||
'4' => __('پنجشنبه', 'sodino'),
|
||||
'5' => __('جمعه', 'sodino'),
|
||||
'6' => __('شنبه', 'sodino'),
|
||||
'7' => __('یکشنبه', 'sodino'),
|
||||
];
|
||||
?>
|
||||
<div id="sodino-app" class="min-h-screen bg-gray-50" dir="rtl">
|
||||
<!-- Header -->
|
||||
<div class="bg-white border-b border-gray-200">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="py-6">
|
||||
<div class="flex items-center justify-between">
|
||||
<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>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -26,151 +34,118 @@ $form_action_type = function_exists('sodino_old_input') ? sodino_old_input('acti
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
<?php if (function_exists('sodino_render_admin_notice')) { sodino_render_admin_notice(); } ?>
|
||||
<div class="flex gap-8">
|
||||
<!-- Sidebar -->
|
||||
<aside class="w-64 flex-shrink-0">
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
||||
<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-md 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-md 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-add-rule'); ?>" class="block px-3 py-2 rounded-md text-sm font-medium <?php echo $current_page === 'sodino-add-rule' ? '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-upsells'); ?>" class="block px-3 py-2 rounded-md text-sm font-medium <?php echo $current_page === 'sodino-upsells' ? '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-add-upsell'); ?>" class="block px-3 py-2 rounded-md text-sm font-medium <?php echo $current_page === 'sodino-add-upsell' ? '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-md 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-add-banner'); ?>" class="block px-3 py-2 rounded-md text-sm font-medium <?php echo $current_page === 'sodino-add-banner' ? '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-tools'); ?>" class="block px-3 py-2 rounded-md text-sm font-medium <?php echo $current_page === 'sodino-tools' ? '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-md 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>
|
||||
</div>
|
||||
</aside>
|
||||
<?php include SODINO_PLUGIN_DIR . 'admin/components/sidebar.php'; ?>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="flex-1 min-w-0">
|
||||
<!-- Page Header -->
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6 mb-8">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6 mb-6">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<h2 class="text-2xl font-semibold text-gray-900"><?php echo $rule->id ? __('ویرایش قانون', 'sodino') : __('افزودن قانون جدید', 'sodino'); ?></h2>
|
||||
<p class="mt-2 text-gray-600"><?php _e('قانون قیمتگذاری پویا ایجاد یا ویرایش کنید.', 'sodino'); ?></p>
|
||||
<h2 class="text-2xl font-semibold text-gray-900"><?php echo $rule->id ? __('ویرایش قانون پیشرفته', 'sodino') : __('افزودن قانون پیشرفته', 'sodino'); ?></h2>
|
||||
<p class="mt-2 text-gray-600"><?php _e('چند شرط را با هم ترکیب کنید و چند عملیات قیمتگذاری را به ترتیب اعمال کنید.', 'sodino'); ?></p>
|
||||
</div>
|
||||
<a href="<?php echo admin_url('admin.php?page=sodino-rules'); ?>" class="inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-lg text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200">
|
||||
<svg class="-ml-1 mr-2 h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<a href="<?php echo esc_url(admin_url('admin.php?page=sodino-rules')); ?>" class="inline-flex items-center justify-center rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50">
|
||||
<?php _e('بازگشت به قوانین', 'sodino'); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form -->
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
||||
<form method="post">
|
||||
<?php wp_nonce_field('sodino_save_rule', 'sodino_rule_nonce'); ?>
|
||||
<form method="post" class="space-y-6" id="sodino-rule-form">
|
||||
<?php wp_nonce_field('sodino_save_rule', 'sodino_rule_nonce'); ?>
|
||||
|
||||
<section class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-5"><?php _e('اطلاعات اصلی', 'sodino'); ?></h3>
|
||||
<div class="grid gap-6 md:grid-cols-2">
|
||||
<!-- Rule Name -->
|
||||
<div class="md:col-span-2">
|
||||
<label for="name" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('عنوان قانون', 'sodino'); ?></label>
|
||||
<input type="text" name="name" id="name" value="<?php echo esc_attr(function_exists('sodino_old_input') ? sodino_old_input('name', $rule->name) : $rule->name); ?>" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100" required>
|
||||
<p class="mt-2 text-sm text-gray-500"><?php _e('نامی کوتاه و قابل فهم برای قانون انتخاب کنید.', 'sodino'); ?></p>
|
||||
</div>
|
||||
|
||||
<!-- Priority -->
|
||||
<div>
|
||||
<label for="priority" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('اولویت', 'sodino'); ?></label>
|
||||
<input type="number" name="priority" id="priority" value="<?php echo esc_attr(function_exists('sodino_old_input') ? sodino_old_input('priority', $rule->priority ?: 10) : ($rule->priority ?: 10)); ?>" min="1" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100">
|
||||
<p class="mt-2 text-sm text-gray-500"><?php _e('عدد بالاتر، اولویت بیشتری دارد.', 'sodino'); ?></p>
|
||||
<input type="number" name="priority" id="priority" value="<?php echo esc_attr(function_exists('sodino_old_input') ? sodino_old_input('priority', $rule->priority ?: 10) : ($rule->priority ?: 10)); ?>" min="1" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm">
|
||||
</div>
|
||||
|
||||
<!-- Usage Limit -->
|
||||
<div>
|
||||
<label for="usage_limit" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('محدودیت تعداد استفاده', 'sodino'); ?></label>
|
||||
<input type="number" name="usage_limit" id="usage_limit" value="<?php echo esc_attr(function_exists('sodino_old_input') ? sodino_old_input('usage_limit', $rule->usage_limit ?? 0) : ($rule->usage_limit ?? 0)); ?>" min="0" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100">
|
||||
<p class="mt-2 text-sm text-gray-500"><?php _e('0 به معنی بدون محدودیت است.', 'sodino'); ?></p>
|
||||
<label for="usage_limit" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('محدودیت استفاده', 'sodino'); ?></label>
|
||||
<input type="number" name="usage_limit" id="usage_limit" value="<?php echo esc_attr(function_exists('sodino_old_input') ? sodino_old_input('usage_limit', $rule->usage_limit ?? 0) : ($rule->usage_limit ?? 0)); ?>" min="0" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="start_date" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('شروع', 'sodino'); ?></label>
|
||||
<input type="datetime-local" name="start_date" id="start_date" value="<?php echo esc_attr($rule->start_date ? date('Y-m-d\TH:i', strtotime($rule->start_date)) : ''); ?>" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="end_date" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('پایان', 'sodino'); ?></label>
|
||||
<input type="datetime-local" name="end_date" id="end_date" value="<?php echo esc_attr($rule->end_date ? date('Y-m-d\TH:i', strtotime($rule->end_date)) : ''); ?>" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm">
|
||||
</div>
|
||||
|
||||
<!-- User Roles -->
|
||||
<div class="md:col-span-2">
|
||||
<label for="user_roles" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('محدودیت نقش کاربری', 'sodino'); ?></label>
|
||||
<select name="user_roles[]" id="user_roles" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100" multiple size="4">
|
||||
<label for="user_roles" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('نقشهای مجاز', 'sodino'); ?></label>
|
||||
<select name="user_roles[]" id="user_roles" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm" multiple size="4">
|
||||
<?php foreach (wp_roles()->roles as $role_key => $role_data) : ?>
|
||||
<option value="<?php echo esc_attr($role_key); ?>" <?php echo in_array($role_key, (array) $rule->user_roles, true) ? 'selected' : ''; ?>><?php echo esc_html($role_data['name']); ?></option>
|
||||
<option value="<?php echo esc_attr($role_key); ?>" <?php selected(in_array($role_key, (array) $rule->user_roles, true)); ?>><?php echo esc_html($role_data['name']); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<p class="mt-2 text-sm text-gray-500"><?php _e('نقشهایی که این قانون باید برای آنها اعمال شود.', 'sodino'); ?></p>
|
||||
<p class="mt-2 text-sm text-gray-500"><?php _e('خالی بماند یعنی برای همه نقشها.', 'sodino'); ?></p>
|
||||
</div>
|
||||
|
||||
<!-- Condition Type -->
|
||||
<div>
|
||||
<label for="condition_type" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('نوع شرط', 'sodino'); ?></label>
|
||||
<select name="condition_type" id="condition_type" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100" required>
|
||||
<option value="user_type" <?php selected($form_condition_type, 'user_type'); ?>><?php _e('نوع کاربر', 'sodino'); ?></option>
|
||||
<option value="product_category" <?php selected($form_condition_type, 'product_category'); ?>><?php _e('دستهبندی محصول', 'sodino'); ?></option>
|
||||
<option value="product_ids" <?php selected($form_condition_type, 'product_ids'); ?>><?php _e('محصولات خاص', 'sodino'); ?></option>
|
||||
</select>
|
||||
<p class="mt-2 text-sm text-gray-500"><?php _e('نوع شرطی که باید قبل از اعمال قانون بررسی شود.', 'sodino'); ?></p>
|
||||
</div>
|
||||
|
||||
<!-- Condition Value -->
|
||||
<div>
|
||||
<label for="condition_value" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('مقدار شرط', 'sodino'); ?></label>
|
||||
<input type="text" name="condition_value" id="condition_value" value="<?php echo esc_attr(function_exists('sodino_old_input') ? sodino_old_input('condition_value', $rule->condition_value) : $rule->condition_value); ?>" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100" required>
|
||||
<p class="mt-2 text-sm text-gray-500"><?php _e('برای کاربر جدید/بازگشتی: new یا returning. برای دستهبندی: شناسه دستهبندی، برای محصولات: شناسه محصول.', 'sodino'); ?></p>
|
||||
</div>
|
||||
|
||||
<!-- Action Type -->
|
||||
<div>
|
||||
<label for="action_type" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('نوع عملیات', 'sodino'); ?></label>
|
||||
<select name="action_type" id="action_type" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100" required>
|
||||
<option value="discount_percent" <?php selected($form_action_type, 'discount_percent'); ?>><?php _e('درصد تخفیف', 'sodino'); ?></option>
|
||||
<option value="discount_fixed" <?php selected($form_action_type, 'discount_fixed'); ?>><?php _e('تخفیف ثابت', 'sodino'); ?></option>
|
||||
<option value="free_shipping" <?php selected($form_action_type, 'free_shipping'); ?>><?php _e('ارسال رایگان', 'sodino'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Action Value -->
|
||||
<div>
|
||||
<label for="action_value" class="block text-sm font-medium text-gray-700 mb-2"><?php _e('مقدار عملیات', 'sodino'); ?></label>
|
||||
<input type="number" name="action_value" id="action_value" value="<?php echo esc_attr(function_exists('sodino_old_input') ? sodino_old_input('action_value', $rule->action_value) : $rule->action_value); ?>" min="0" step="0.01" class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-gray-700 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100">
|
||||
<p class="mt-2 text-sm text-gray-500"><?php _e('برای درصد یا مقدار ثابت وارد کنید.', 'sodino'); ?></p>
|
||||
</div>
|
||||
|
||||
<!-- Status -->
|
||||
<div class="md:col-span-2">
|
||||
<label class="flex items-center gap-3 text-gray-700">
|
||||
<input type="checkbox" name="enabled" id="enabled" value="1" <?php checked($rule->enabled, 1); ?> class="h-5 w-5 rounded border-gray-300 text-blue-600 focus:ring-blue-500">
|
||||
<span><?php _e('فعال باشد', 'sodino'); ?></span>
|
||||
<input type="checkbox" name="enabled" value="1" <?php checked($rule->enabled, 1); ?> class="h-5 w-5 rounded border-gray-300 text-blue-600">
|
||||
<span><?php _e('قانون فعال باشد', 'sodino'); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="mt-8 flex justify-end">
|
||||
<button type="submit" class="inline-flex items-center px-6 py-3 border border-transparent text-sm font-medium rounded-lg text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200">
|
||||
<?php echo $rule->id ? __('بهروزرسانی قانون', 'sodino') : __('افزودن قانون', 'sodino'); ?>
|
||||
</button>
|
||||
<section class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
||||
<div class="flex items-center justify-between mb-5">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-gray-900"><?php _e('شرطها', 'sodino'); ?></h3>
|
||||
<p class="mt-1 text-sm text-gray-500"><?php _e('همه شرطهای زیر باید برقرار باشند تا قانون اعمال شود.', 'sodino'); ?></p>
|
||||
</div>
|
||||
<button type="button" class="sodino-add-row rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50" data-target="conditions"><?php _e('افزودن شرط', 'sodino'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="sodino-conditions" class="space-y-4">
|
||||
<?php foreach ($conditions as $index => $condition) : ?>
|
||||
<?php include SODINO_PLUGIN_DIR . 'admin/views/partials/rule-condition-row.php'; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
||||
<div class="flex items-center justify-between mb-5">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-gray-900"><?php _e('عملیاتها', 'sodino'); ?></h3>
|
||||
<p class="mt-1 text-sm text-gray-500"><?php _e('عملیاتها به ترتیب روی قیمت اعمال میشوند.', 'sodino'); ?></p>
|
||||
</div>
|
||||
<button type="button" class="sodino-add-row rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50" data-target="actions"><?php _e('افزودن عملیات', 'sodino'); ?></button>
|
||||
</div>
|
||||
|
||||
<div id="sodino-actions" class="space-y-4">
|
||||
<?php foreach ($actions as $index => $action) : ?>
|
||||
<?php include SODINO_PLUGIN_DIR . 'admin/views/partials/rule-action-row.php'; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<button type="submit" class="inline-flex items-center justify-center rounded-lg bg-blue-600 px-6 py-3 text-sm font-semibold text-white hover:bg-blue-700">
|
||||
<?php echo $rule->id ? __('ذخیره تغییرات قانون', 'sodino') : __('ایجاد قانون', 'sodino'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template id="sodino-condition-template">
|
||||
<?php $index = '__INDEX__'; $condition = ['type' => 'user_type', 'operator' => 'is', 'value' => 'new']; include SODINO_PLUGIN_DIR . 'admin/views/partials/rule-condition-row.php'; ?>
|
||||
</template>
|
||||
|
||||
<template id="sodino-action-template">
|
||||
<?php $index = '__INDEX__'; $action = ['type' => 'discount_percent', 'value' => 10]; include SODINO_PLUGIN_DIR . 'admin/views/partials/rule-action-row.php'; ?>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user