| 1 |
<?php |
| 2 |
$has_wc = is_plugin_active('woocommerce/woocommerce.php'); |
| 3 |
$has_phone = isset($this->options['telephone']) && $this->options['telephone'] != ''; |
| 4 |
$has_spoki_keys = (isset($this->options['secret']) && trim($this->options['secret']) != '') && (isset($this->options['delivery_url']) && trim($this->options['delivery_url']) != ''); |
| 5 |
|
| 6 |
/** Spoki Without WooCommerce Onboarding */ |
| 7 |
if (!$has_wc && !$has_phone) : ?> |
| 8 |
<div class="spoki-onboarding"> |
| 9 |
<h2><?php _e("Welcome on Spoki!", "spoki") ?></h2> |
| 10 |
<p><?php _e("Insert your WhatsApp phone number and start using <b>Free WhatsApp buttons</b> on your website!", "spoki") ?></p> |
| 11 |
<table class="form-table"> |
| 12 |
<tr> |
| 13 |
<th scope="row"> |
| 14 |
<label for="<?php echo SPOKI_OPTIONS ?>[onboarding][telephone]"> |
| 15 |
<?php _e('Your WhatsApp Telephone', "spoki") ?> |
| 16 |
</label> |
| 17 |
</th> |
| 18 |
<td> |
| 19 |
<input type="tel" class="regular-text" required |
| 20 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][telephone]" |
| 21 |
placeholder="+393331234567" |
| 22 |
value="<?php echo (isset($this->options['onboarding']['telephone']) && $this->options['onboarding']['telephone'] != '') ? ($this->options['onboarding']['telephone']) : $this->options['telephone'] ?>" |
| 23 |
/> |
| 24 |
<p class="description"> |
| 25 |
* <?php _e("Your customers will send messages to this WhatsApp number.", "spoki") ?> |
| 26 |
</p> |
| 27 |
</td> |
| 28 |
</tr> |
| 29 |
</table> |
| 30 |
<input type="hidden" name="<?php echo SPOKI_OPTIONS ?>[onboarding][without_wc]" value="1"> |
| 31 |
<?php submit_button() ?> |
| 32 |
</div> |
| 33 |
<?php endif; |
| 34 |
|
| 35 |
/** Spoki WooCommerce Onboarding */ |
| 36 |
if ($has_wc && !$has_spoki_keys) : ?> |
| 37 |
<div class="spoki-onboarding"> |
| 38 |
<h2><?php _e("Welcome on Spoki!", "spoki") ?></h2> |
| 39 |
<p><?php _e("Confirm your shop info and start sending <b>free automated</b> WooCommerce order notifications via WhatsApp!", "spoki") ?></p> |
| 40 |
|
| 41 |
<table class="form-table"> |
| 42 |
<tr> |
| 43 |
<th scope="row"> |
| 44 |
<label for="<?php echo SPOKI_OPTIONS ?>[onboarding][telephone]"> |
| 45 |
<?php _e('Your WhatsApp Telephone', "spoki") ?> |
| 46 |
</label> |
| 47 |
</th> |
| 48 |
<td> |
| 49 |
<input type="tel" class="regular-text" required |
| 50 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][telephone]" |
| 51 |
placeholder="+393331234567" |
| 52 |
value="<?php echo (isset($this->options['onboarding']['telephone']) && $this->options['onboarding']['telephone'] != '') ? ($this->options['onboarding']['telephone']) : $this->options['telephone'] ?>"/> |
| 53 |
<p class="description"> |
| 54 |
* <?php _e("Your customers will send messages to this WhatsApp number.", "spoki") ?> |
| 55 |
</p> |
| 56 |
</td> |
| 57 |
</tr> |
| 58 |
<tr> |
| 59 |
<th scope="row"> |
| 60 |
<label for="<?php echo SPOKI_OPTIONS ?>[onboarding][shop_name]"> |
| 61 |
<?php _e('Shop Name', "spoki") ?> |
| 62 |
</label> |
| 63 |
</th> |
| 64 |
<td> |
| 65 |
<input type="text" class="regular-text" required |
| 66 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][shop_name]" |
| 67 |
placeholder="<?php echo Spoki()->shop['name'] ?>" |
| 68 |
value="<?php if (isset($this->options['onboarding']['shop_name']) && $this->options['onboarding']['shop_name'] !== '') { |
| 69 |
echo esc_html($this->options['onboarding']['shop_name']); |
| 70 |
} else { |
| 71 |
echo Spoki()->shop['name']; |
| 72 |
} ?>" |
| 73 |
/> |
| 74 |
<p class="description"> |
| 75 |
* <?php _e("Insert the name of your shop.", "spoki") ?> |
| 76 |
</p> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
<tr> |
| 80 |
<th scope="row"> |
| 81 |
<label for="<?php echo SPOKI_OPTIONS ?>[onboarding][email]"> |
| 82 |
<?php _e('Email', "spoki") ?> |
| 83 |
</label> |
| 84 |
</th> |
| 85 |
<td> |
| 86 |
<input type="email" class="regular-text" required |
| 87 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][email]" |
| 88 |
placeholder="<?php echo Spoki()->shop['email'] ?>" |
| 89 |
value="<?php if (isset($this->options['onboarding']['email']) && $this->options['onboarding']['email'] !== '') { |
| 90 |
echo esc_html($this->options['onboarding']['email']); |
| 91 |
} else { |
| 92 |
echo Spoki()->shop['email']; |
| 93 |
} ?>" |
| 94 |
/> |
| 95 |
<p class="description"> |
| 96 |
* <?php _e("We will send you your configuration keys to this email.", "spoki") ?> |
| 97 |
</p> |
| 98 |
</td> |
| 99 |
</tr> |
| 100 |
</table> |
| 101 |
<br/> |
| 102 |
<div> |
| 103 |
<input type="checkbox" id="terms_check" required |
| 104 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][terms_check]" |
| 105 |
value="1" <?php if (isset($this->options['onboarding']['terms_check'])) echo checked(1, $this->options['onboarding']['terms_check'], false) ?>> |
| 106 |
<label for="terms_check"> |
| 107 |
<?php _e("I accept", "spoki") ?> |
| 108 |
<a href="https://app.spoki.it/static/terms_conditions_spoki_flex.pdf" target="_blank"><?php _e('general terms and conditions', "spoki") ?></a> |
| 109 |
<?php _e("for using the Spoki service and the", "spoki") ?> |
| 110 |
<a href="https://app.spoki.it/static/attachment1_spoki_flex.pdf" target="_blank"><?php _e('privacy policy', "spoki") ?></a>. |
| 111 |
</label> |
| 112 |
</div> |
| 113 |
<input type="hidden" name="<?php echo SPOKI_OPTIONS ?>[onboarding][with_wc]" value="1"> |
| 114 |
<div class="enable-spoki-section"> |
| 115 |
<?php submit_button(__("Enable Spoki Free", "spoki")) ?> |
| 116 |
<a href="<?php echo Spoki()->get_plan_link(false) ?>" target="_blank"> |
| 117 |
<?php _e("Discover the free features of Spoki Free!", "spoki") ?> |
| 118 |
</a> |
| 119 |
</div> |
| 120 |
<p class="already-have-spoki"> |
| 121 |
<?php _e("Do you already have Spoki?", "spoki") ?> |
| 122 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=<?php echo urlencode('Settings') ?>"><?php _e("Insert your Spoki keys", "spoki") ?></a>. |
| 123 |
</p> |
| 124 |
</div> |
| 125 |
<?php endif; |
| 126 |
|