Files
sodino/admin/views/rule-form.php

54 lines
3.1 KiB
PHP

<?php
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
?>
<div class="wrap">
<h1><?php echo $rule->id ? __('ویرایش قانون', 'sodino') : __('افزودن قانون جدید', 'sodino'); ?></h1>
<form method="post">
<?php wp_nonce_field('gheymatyar_save_rule', 'gheymatyar_rule_nonce'); ?>
<table class="form-table">
<tr>
<th scope="row"><label for="name"><?php _e('عنوان قانون', 'sodino'); ?></label></th>
<td><input type="text" name="name" id="name" value="<?php echo esc_attr($rule->name); ?>" class="regular-text" required></td>
</tr>
<tr>
<th scope="row"><label for="condition_type"><?php _e('نوع شرط', 'sodino'); ?></label></th>
<td>
<select name="condition_type" id="condition_type" class="regular-text" required>
<option value="user_type" <?php selected($rule->condition_type, 'user_type'); ?>><?php _e('نوع کاربر', 'sodino'); ?></option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="condition_value"><?php _e('نوع کاربر', 'sodino'); ?></label></th>
<td>
<select name="condition_value" id="condition_value" class="regular-text" required>
<option value="new" <?php selected($rule->condition_value, 'new'); ?>><?php _e('کاربر جدید', 'sodino'); ?></option>
<option value="returning" <?php selected($rule->condition_value, 'returning'); ?>><?php _e('کاربر بازگشتی', 'sodino'); ?></option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="action_type"><?php _e('نوع عملیات', 'sodino'); ?></label></th>
<td>
<select name="action_type" id="action_type" class="regular-text" required>
<option value="discount_percent" <?php selected($rule->action_type, 'discount_percent'); ?>><?php _e('درصد تخفیف', 'sodino'); ?></option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="action_value"><?php _e('درصد تخفیف', 'sodino'); ?></label></th>
<td><input type="number" name="action_value" id="action_value" value="<?php echo esc_attr($rule->action_value); ?>" min="0" max="100" step="0.01" class="small-text" required> %</td>
</tr>
<tr>
<th scope="row"><label for="enabled"><?php _e('وضعیت', 'sodino'); ?></label></th>
<td><label><input type="checkbox" name="enabled" id="enabled" value="1" <?php checked($rule->enabled, 1); ?>> <?php _e('فعال باشد', 'sodino'); ?></label></td>
</tr>
</table>
<?php submit_button($rule->id ? __('به‌روزرسانی قانون', 'sodino') : __('افزودن قانون', 'sودino'), 'primary'); ?>
</form>
</div>