34 lines
2.3 KiB
PHP
34 lines
2.3 KiB
PHP
<?php
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
$action_type = $action['type'] ?? 'discount_percent';
|
|
$action_value = $action['value'] ?? 0;
|
|
?>
|
|
<div class="sodino-rule-row rounded-lg border border-gray-200 bg-gray-50 p-4" data-row>
|
|
<div class="grid gap-4 lg:grid-cols-[1.5fr_1fr_auto]">
|
|
<div>
|
|
<label class="block text-xs font-semibold text-gray-500 mb-2"><?php _e('نوع عملیات', 'sodino'); ?></label>
|
|
<select name="actions[<?php echo esc_attr($index); ?>][type]" class="w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-gray-700">
|
|
<option value="discount_percent" <?php selected($action_type, 'discount_percent'); ?>><?php _e('تخفیف درصدی', 'sodino'); ?></option>
|
|
<option value="discount_fixed" <?php selected($action_type, 'discount_fixed'); ?>><?php _e('تخفیف ثابت', 'sodino'); ?></option>
|
|
<option value="set_price" <?php selected($action_type, 'set_price'); ?>><?php _e('تنظیم قیمت ثابت', 'sodino'); ?></option>
|
|
<option value="increase_percent" <?php selected($action_type, 'increase_percent'); ?>><?php _e('افزایش درصدی قیمت', 'sodino'); ?></option>
|
|
<option value="increase_fixed" <?php selected($action_type, 'increase_fixed'); ?>><?php _e('افزایش ثابت قیمت', 'sodino'); ?></option>
|
|
<option value="free_shipping" <?php selected($action_type, 'free_shipping'); ?>><?php _e('ارسال رایگان', 'sodino'); ?></option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-xs font-semibold text-gray-500 mb-2"><?php _e('مقدار', 'sodino'); ?></label>
|
|
<input type="number" name="actions[<?php echo esc_attr($index); ?>][value]" value="<?php echo esc_attr($action_value); ?>" min="0" step="0.01" class="w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-gray-700">
|
|
<p class="mt-2 text-xs text-gray-500"><?php _e('برای ارسال رایگان میتواند 0 بماند.', 'sodino'); ?></p>
|
|
</div>
|
|
|
|
<div class="flex items-end">
|
|
<button type="button" class="sodino-remove-row rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm font-semibold text-red-700 hover:bg-red-100"><?php _e('حذف', 'sodino'); ?></button>
|
|
</div>
|
|
</div>
|
|
</div>
|