| 1 |
<?php |
| 2 |
/** |
| 3 |
* Subscription settings admin view. |
| 4 |
* |
| 5 |
* @package SpringDevs\Subscription\Admin |
| 6 |
*/ |
| 7 |
|
| 8 |
// Exit if accessed directly. |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
// Add admin settings styles. |
| 14 |
wp_enqueue_style( 'wp-subscription-admin-settings', SUBSCRPT_ASSETS . '/css/admin-settings.css', [], SUBSCRPT_VERSION ); |
| 15 |
|
| 16 |
// Add admin settings scripts. |
| 17 |
wp_enqueue_script( 'wp-subscription-admin-settings', SUBSCRPT_ASSETS . '/js/admin-settings.js', [ 'jquery' ], SUBSCRPT_VERSION, true ); |
| 18 |
|
| 19 |
?> |
| 20 |
<div class="wp-subscription-admin-content list-page wpsubs-tw-root"> |
| 21 |
<h1 class="wp-heading-inline" style="margin-top: 0;"><?php esc_html_e( 'Subscription Settings', 'subscription' ); ?></h1> |
| 22 |
<hr class="wp-header-end"><br/> |
| 23 |
|
| 24 |
<form method="post" action="options.php" class="border border-gray-200 rounded-lg p-5"> |
| 25 |
<!-- Settings nonce and other requirements --> |
| 26 |
<?php settings_fields( 'wp_subscription_settings' ); ?> |
| 27 |
<?php do_settings_sections( 'wp_subscription_settings' ); ?> |
| 28 |
|
| 29 |
<!-- Settings Fields --> |
| 30 |
<?php |
| 31 |
foreach ( $settings_fields as $group_id => $group ) { |
| 32 |
foreach ( ( $group['fields'] ?? [] ) as $field ) { |
| 33 |
$field_type = $field['type'] ?? 'input'; |
| 34 |
$field_data = $field['field_data'] ?? []; |
| 35 |
|
| 36 |
SpringDevs\Subscription\Admin\SettingsHelper::render_settings_field( $field_type, $field_data ); |
| 37 |
|
| 38 |
echo wp_kses_post( '<div class="my-5 border-t border-gray-100"></div>' ); |
| 39 |
} |
| 40 |
} |
| 41 |
?> |
| 42 |
|
| 43 |
<!-- Submit Button --> |
| 44 |
<div> |
| 45 |
<input |
| 46 |
type="submit" |
| 47 |
value="<?php esc_attr_e( 'Save changes', 'subscription' ); ?>" |
| 48 |
class="button button-primary px-3! py-1! rounded-md!" |
| 49 |
/> |
| 50 |
</div> |
| 51 |
</form> |
| 52 |
</div> |
| 53 |
|
| 54 |
<?php return; ?> |
| 55 |
|
| 56 |
<?php |
| 57 |
/** |
| 58 |
* TODO: Refactor this section later |
| 59 |
* |
| 60 |
* phpcs:disable |
| 61 |
*/ |
| 62 |
?> |
| 63 |
<!-- Pro Gimmicks --> |
| 64 |
<?php if ( ! class_exists( 'Sdevs_Wc_Subscription_Pro' ) ) : ?> |
| 65 |
<!-- PRO Features (subtle, grayed out) --> |
| 66 |
<tr class="wp-subscription-pro-setting-row" style="opacity:0.55;pointer-events:none;"> |
| 67 |
<th scope="row"> |
| 68 |
<label><?php esc_html_e( 'Variable Product Options', 'subscription' ); ?></label> |
| 69 |
</th> |
| 70 |
<td> |
| 71 |
<input type="text" disabled placeholder="Available in PRO" style="width:220px;" /> |
| 72 |
<p class="description">Set flexible options for variable subscription products <span style="color:#2196f3;font-weight:600;">PRO</span></p> |
| 73 |
</td> |
| 74 |
</tr> |
| 75 |
<tr class="wp-subscription-pro-setting-row" style="opacity:0.55;pointer-events:none;"> |
| 76 |
<th scope="row"> |
| 77 |
<label><?php esc_html_e( 'Delivery Schedule', 'subscription' ); ?></label> |
| 78 |
</th> |
| 79 |
<td> |
| 80 |
<select disabled><option><?php esc_html_e( 'Available in PRO', 'subscription' ); ?></option></select> |
| 81 |
<p class="description">Custom delivery intervals for subscriptions <span style="color:#2196f3;font-weight:600;">PRO</span></p> |
| 82 |
</td> |
| 83 |
</tr> |
| 84 |
<tr class="wp-subscription-pro-setting-row" style="opacity:0.55;pointer-events:none;"> |
| 85 |
<th scope="row"> |
| 86 |
<label><?php esc_html_e( 'Subscription History', 'subscription' ); ?></label> |
| 87 |
</th> |
| 88 |
<td> |
| 89 |
<input type="text" disabled placeholder="Available in PRO" style="width:220px;" /> |
| 90 |
<p class="description">View detailed subscription change history <span style="color:#2196f3;font-weight:600;">PRO</span></p> |
| 91 |
</td> |
| 92 |
</tr> |
| 93 |
<tr class="wp-subscription-pro-setting-row" style="opacity:0.55;pointer-events:none;"> |
| 94 |
<th scope="row"> |
| 95 |
<label><?php esc_html_e( 'More Subscription Durations', 'subscription' ); ?></label> |
| 96 |
</th> |
| 97 |
<td> |
| 98 |
<input type="text" disabled placeholder="Available in PRO" style="width:220px;" /> |
| 99 |
<p class="description">Offer more flexible/custom subscription periods <span style="color:#2196f3;font-weight:600;">PRO</span></p> |
| 100 |
</td> |
| 101 |
</tr> |
| 102 |
<tr class="wp-subscription-pro-setting-row" style="opacity:0.55;pointer-events:none;"> |
| 103 |
<th scope="row"> |
| 104 |
<label><?php esc_html_e( 'Sign Up Fee', 'subscription' ); ?></label> |
| 105 |
</th> |
| 106 |
<td> |
| 107 |
<input type="number" disabled placeholder="Available in PRO" style="width:120px;" /> |
| 108 |
<p class="description">Charge a one-time sign up fee <span style="color:#2196f3;font-weight:600;">PRO</span></p> |
| 109 |
</td> |
| 110 |
</tr> |
| 111 |
<tr class="wp-subscription-pro-setting-row" style="opacity:0.55;pointer-events:none;"> |
| 112 |
<th scope="row"> |
| 113 |
<label><?php esc_html_e( 'Early Renewal', 'subscription' ); ?></label> |
| 114 |
</th> |
| 115 |
<td> |
| 116 |
<input class="wp-subscription-toggle" type="checkbox" disabled /> |
| 117 |
<span class="wp-subscription-toggle-ui" aria-hidden="true"></span> |
| 118 |
<p class="description">Allow early renewal for subscriptions <span style="color:#2196f3;font-weight:600;">PRO</span></p> |
| 119 |
</td> |
| 120 |
</tr> |
| 121 |
<tr class="wp-subscription-pro-setting-row" style="opacity:0.55;pointer-events:none;"> |
| 122 |
<th scope="row"> |
| 123 |
<label><?php esc_html_e( 'Renewal Price', 'subscription' ); ?></label> |
| 124 |
</th> |
| 125 |
<td> |
| 126 |
<input type="number" disabled placeholder="Available in PRO" style="width:120px;" /> |
| 127 |
<p class="description">Set a different price for renewals <span style="color:#2196f3;font-weight:600;">PRO</span></p> |
| 128 |
</td> |
| 129 |
</tr> |
| 130 |
<?php endif; ?> |
| 131 |
|