| 1 |
<?php |
| 2 |
/** |
| 3 |
* Setup Wizard — Email identity, notifications, payment safety. |
| 4 |
* |
| 5 |
* @package Yatra |
| 6 |
*/ |
| 7 |
|
| 8 |
defined('ABSPATH') || exit; |
| 9 |
|
| 10 |
use Yatra\Services\SettingsService; |
| 11 |
|
| 12 |
$company_name = (string) SettingsService::get('company_name', ''); |
| 13 |
$company_email = (string) SettingsService::get('company_email', ''); |
| 14 |
$email_from_name = (string) SettingsService::get('from_name', ''); |
| 15 |
$email_from_address = (string) SettingsService::get('from_email', ''); |
| 16 |
if ($email_from_name === '') { |
| 17 |
$email_from_name = $company_name; |
| 18 |
} |
| 19 |
if ($email_from_address === '') { |
| 20 |
$email_from_address = $company_email; |
| 21 |
} |
| 22 |
$payment_test_mode = SettingsService::get('payment_test_mode', true); |
| 23 |
?> |
| 24 |
|
| 25 |
<form method="post" class="wizard-step"> |
| 26 |
<?php wp_nonce_field('yatra-setup'); ?> |
| 27 |
<input type="hidden" name="save_step" value="communications"> |
| 28 |
|
| 29 |
<div class="wizard-header wizard-header--task"> |
| 30 |
<p class="wizard-header-kicker"><?php echo esc_html($this->get_wizard_progress_label()); ?></p> |
| 31 |
<h1><?php esc_html_e('Emails & payment safety', 'yatra'); ?></h1> |
| 32 |
<p class="wizard-header-lead"><?php esc_html_e('Fix the two most common launch issues: emails that look wrong, and accidental live charges.', 'yatra'); ?></p> |
| 33 |
</div> |
| 34 |
|
| 35 |
<div class="wizard-content"> |
| 36 |
<div class="wizard-card"> |
| 37 |
<h3 class="wizard-card-title"><?php esc_html_e('“From” on outgoing mail', 'yatra'); ?></h3> |
| 38 |
<p class="wizard-card-intro"><?php esc_html_e('Should match a domain you control so fewer messages land in spam.', 'yatra'); ?></p> |
| 39 |
<div class="form-row" style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;"> |
| 40 |
<div class="form-group" style="margin-bottom: 0;"> |
| 41 |
<label class="form-label" for="email_from_name"><?php esc_html_e('From name', 'yatra'); ?></label> |
| 42 |
<input type="text" id="email_from_name" name="email_from_name" value="<?php echo esc_attr($email_from_name); ?>" class="form-control" autocomplete="off"> |
| 43 |
</div> |
| 44 |
<div class="form-group" style="margin-bottom: 0;"> |
| 45 |
<label class="form-label" for="email_from_address"><?php esc_html_e('From email', 'yatra'); ?></label> |
| 46 |
<input type="email" id="email_from_address" name="email_from_address" value="<?php echo esc_attr($email_from_address); ?>" class="form-control" autocomplete="off"> |
| 47 |
</div> |
| 48 |
</div> |
| 49 |
</div> |
| 50 |
|
| 51 |
<div class="wizard-card"> |
| 52 |
<h3 class="wizard-card-title"><?php esc_html_e('Which emails send?', 'yatra'); ?></h3> |
| 53 |
<p class="wizard-card-intro"><?php esc_html_e('After setup, open Yatra → Email → Templates to turn individual messages on or off (booking, payment, cancellation, admin copies, and more).', 'yatra'); ?></p> |
| 54 |
</div> |
| 55 |
|
| 56 |
<div class="wizard-card wizard-card--highlight"> |
| 57 |
<h3 class="wizard-card-title"><?php esc_html_e('Payment gateways', 'yatra'); ?></h3> |
| 58 |
<label class="wizard-check-row"> |
| 59 |
<input type="checkbox" name="payment_test_mode" value="true" <?php checked($payment_test_mode, true); ?>> |
| 60 |
<span> |
| 61 |
<strong><?php esc_html_e('Keep gateways in test mode for now', 'yatra'); ?></strong> |
| 62 |
<span class="wizard-check-desc"><?php esc_html_e('Turn this off in Settings when you are ready to accept real payments.', 'yatra'); ?></span> |
| 63 |
</span> |
| 64 |
</label> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
|
| 68 |
<div class="wizard-footer"> |
| 69 |
<a href="<?php echo esc_url($this->get_step_url('bookings')); ?>" class="btn btn-secondary wizard-footer-back"> |
| 70 |
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg> |
| 71 |
<?php esc_html_e('Back', 'yatra'); ?> |
| 72 |
</a> |
| 73 |
<div class="wizard-footer-actions"> |
| 74 |
<a href="<?php echo esc_url($this->get_next_step_link()); ?>" class="btn btn-secondary btn-skip"><?php esc_html_e('Skip', 'yatra'); ?></a> |
| 75 |
<button type="submit" class="btn btn-primary"> |
| 76 |
<?php esc_html_e('Continue', 'yatra'); ?> |
| 77 |
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg> |
| 78 |
</button> |
| 79 |
</div> |
| 80 |
</div> |
| 81 |
</form> |
| 82 |
|