html presentation of admin menu for emails

This commit is contained in:
asus
2024-04-03 10:31:27 +02:00
parent 1d36093d9f
commit 1553490444
2 changed files with 94 additions and 18 deletions

View File

@@ -15,7 +15,7 @@
width: 100%;
}
form .vertical_wrapper {
form .vertical_wrapper_cipf {
display: flex;
flex-direction: column;
}
@@ -23,17 +23,55 @@
resize: vertical;
height: 120px;
}
/*
* form emails
*
*/
form.emails_form_cipf {
margin: 0px;
border: none;
padding: 0px;
details.set_email_options_cipf {
margin: 15px;
padding: 0px 20px;
border: 1px solid black;
summary {
padding: 20px 0px;
cursor: grab;
h2 {
display: inline;
}
}
.email_type_wrapper_cipf {
margin-bottom: 50px;
.send_or_not_cipf {
margin-bottom: 20px;
}
.send_or_not_cipf:has(input:not(:checked)) + .email_options_cipf {
display: none;
}
.email_options_cipf {
padding-left: 20px;
border-left: 1px solid black;
label {
margin: 10px 0px;
}
}
}
}
}
</style>
<!-- https://developer.wordpress.org/reference/hooks/admin_post_action/ -->
<h1>paypal credentials</h1>
<?php echo Plgntls::open_form_option($option_paypal_name); ?>
<div class="define_paypal_credentials_cipf define_paypal_client_id_cipf vertical_wrapper">
<div class="define_paypal_credentials_cipf define_paypal_client_id_cipf vertical_wrapper_cipf">
<label for="paypal_client_id_cipf">client id : </label>
<input type="text" id="paypal_client_id_cipf" name="client_id" value="<?php echo $option_paypal['client_id']; ?>" />
</div>
<div class="define_paypal_credentials_cipf define_paypal_secret_id_cipf vertical_wrapper">
<div class="define_paypal_credentials_cipf define_paypal_secret_id_cipf vertical_wrapper_cipf">
<label for="paypal_client_secret_cipf">client secret : </label>
<input type="text" id="paypal_client_secret_cipf" name="client_secret" value="<?php echo $option_paypal['client_secret']; ?>" />
</div>
@@ -57,17 +95,17 @@
-->
<h1>messages apres paiement, avant redirection</h1>
<?php echo Plgntls::open_form_option($option_payment_name); ?>
<div class="define_payment_message_cipf vertical_wrapper">
<div class="define_payment_message_cipf vertical_wrapper_cipf">
<label for="define_payment_message_success_cipf">paiement réussi : </label>
<textarea id="define_payment_message_success_cipf" name="message_success"><?php echo esc_html($option_payment['success']); ?></textarea>
</div>
<div class="define_payment_message_cipf vertical_wrapper">
<div class="define_payment_message_cipf vertical_wrapper_cipf">
<label for="define_payment_message_failure_cipf">paiement echec : </label>
<textarea id="define_payment_message_failure_cipf" name="message_failure"><?php echo esc_html($option_payment['failure']); ?></textarea>
</div>
<div class="define_payment_message_cipf vertical_wrapper">
<div class="define_payment_message_cipf vertical_wrapper_cipf">
<label for="define_payment_message_problem_cipf">paiement problem (dans le cas où le paiement est réussi, mais il y eu une erreur dans son traitement sur le site) : </label>
<textarea id="define_payment_message_problem_cipf" name="message_problem"><?php echo esc_html($option_payment['problem']); ?></textarea>
</div>
@@ -91,22 +129,60 @@
'confirmation_message'=>"donne l'argent",
-->
<h1>emails :</h1>
<?php echo Plgntls::open_form_option($option_emails_name); ?>
<?php echo Plgntls::open_form_option($option_emails_name, 'POST', 'emails_form_cipf'); ?>
<?php foreach($option_emails as $name => $email_options) { ?>
<div class="set_email_options_cipf vertical_wrapper">
<details class="set_email_options_cipf">
<summary><h2><?php echo esc_html($name); ?> :</h2></summary>
<div class="email_type_wrapper_cipf email_type_notification_wrapper_cipf">
<div class="send_or_not_cipf">
<input type="checkbox" id="<?php echo esc_html($name); ?>_notification_cipf" name="<?php echo esc_html($name); ?>_notification_send" <?php if ($email_options['notification_send'] === true) {echo 'checked';} ?> />
<label for="<?php echo esc_html($name); ?>_notification_cipf">envoyer une notification ?</label>
</div>
<div class="email_options_cipf">
<div class="vertical_wrapper_cipf">
<label for="<?php echo esc_html($name); ?>_notification_to_cipf">destinataire : </label>
<input type="text" id="<?php echo esc_html($name); ?>_notification_to_cipf" name="<?php echo esc_html($name); ?>_notification_to" value="<?php echo esc_html($email_options['notification_to']); ?>" />
</div>
<div class="vertical_wrapper_cipf">
<label for="<?php echo esc_html($name); ?>_notification_subject_cipf">sujet : </label>
<textarea id="<?php echo esc_html($name); ?>_notification_subject_cipf" name="<?php echo esc_html($name); ?>_notification_subject"><?php echo esc_html($email_options['notification_subject']); ?></textarea>
</div>
<div class="vertical_wrapper_cipf">
<label for="<?php echo esc_html($name); ?>_notification_message_cipf">message : </label>
<textarea id="<?php echo esc_html($name); ?>_notification_message_cipf" name="<?php echo esc_html($name); ?>_notification_message"><?php echo esc_html($email_options['notification_message']); ?></textarea>
</div>
</div>
<h2><?php echo esc_html($name); ?> :</h2>
<div>
<input type="checkbox" id="<?php echo esc_html($name); ?>_notification" name="<?php echo esc_html($name); ?>_notification_send" <?php if ($email_options['notification_send'] === true) {echo 'checked';} ?> />
<label for="<?php echo esc_html($name); ?>_notification">envoyer une notification ?</label>
</div>
<div>
<input type="checkbox" id="<?php echo esc_html($name); ?>_confirmation" name="<?php echo esc_html($name); ?>_confirmation_send" <?php if ($email_options['confirmation_send'] === true) {echo 'checked';} ?> />
<label for="<?php echo esc_html($name); ?>_confirmation">envoyer une confirmation ?</label>
<div class="email_type_wrapper_cipf email_type_confirmation_wrapper_cipf">
<div class="send_or_not_cipf">
<input type="checkbox" id="<?php echo esc_html($name); ?>_confirmation_cipf" name="<?php echo esc_html($name); ?>_confirmation_send" <?php if ($email_options['confirmation_send'] === true) {echo 'checked';} ?> />
<label for="<?php echo esc_html($name); ?>_confirmation_cipf">envoyer une confirmation ?</label>
</div>
<div class="email_options_cipf">
<div class="vertical_wrapper_cipf">
<label for="<?php echo esc_html($name); ?>_confirmation_subject_cipf">sujet : </label>
<textarea id="<?php echo esc_html($name); ?>_confirmation_subject_cipf" name="<?php echo esc_html($name); ?>_confirmation_subject"><?php echo esc_html($email_options['confirmation_subject']); ?></textarea>
</div>
<div class="vertical_wrapper_cipf">
<label for="<?php echo esc_html($name); ?>_confirmation_message_cipf">message : </label>
<textarea id="<?php echo esc_html($name); ?>_confirmation_message_cipf" name="<?php echo esc_html($name); ?>_confirmation_message"><?php echo esc_html($email_options['confirmation_message']); ?></textarea>
</div>
</div>
</div>
</div>
</details>
<?php } ?>
<input type="submit" value="send"/>

View File

@@ -1134,13 +1134,13 @@ class Plgntls {
* and add 3 hidden inputs fields for form action and nonce
*
*/
public static function open_form_option($option_name, $method = "post") {
public static function open_form_option($option_name, $method = "post", $class = '') {
$option_data = self::_get_option_data($option_name);
if (false === $option_data) {
return null;
}
ob_start();
echo '<form method="'.$method.'" action="'.admin_url('admin-post.php').'">';
echo '<form method="'.$method.'" class="'.$class.'" action="'.admin_url('admin-post.php').'">';
echo '<input type="hidden" name="action" value="'.$option_data['_action'].'">';
echo '<input type="hidden" name="option_name" value="'.$option_data['_name'].'">';
wp_nonce_field($option_data["_nonce_action"], $option_data["_nonce_name"], true, true);