| @@ -4,12 +4,10 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package Timetics |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -defined( 'ABSPATH' ) || exit; | |
| 9 | - | |
| 10 | -$timetics_user = wp_get_current_user(); | |
| 11 | -$timetics_integrations = timetics_get_staff_integrations( $timetics_user->ID ); | |
| 8 | +$user = wp_get_current_user(); | |
| 9 | +$integrations = timetics_get_staff_integrations( $user->ID ); | |
| 12 | 10 | ?> |
| 13 | 11 | |
| 14 | 12 | <!DOCTYPE html> |
| 15 | 13 | <html lang="en"> |
| @@ -19,10 +17,12 @@ | ||
| 19 | 17 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 20 | 18 | <title><?php esc_html_e( 'Staff onboard', 'timetics' ); ?></title> |
| 21 | 19 | <link rel="preconnect" href="https://fonts.googleapis.com" /> |
| 22 | 20 | <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
| 23 | - <?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet -- Standalone onboarding page outside normal WordPress context ?> | |
| 24 | - <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet" /> | |
| 21 | + <link | |
| 22 | + href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" | |
| 23 | + rel="stylesheet" | |
| 24 | + /> | |
| 25 | 25 | </head> |
| 26 | 26 | <style> |
| 27 | 27 | body { |
| 28 | 28 | box-sizing: border-box; |
| @@ -123,14 +123,14 @@ | ||
| 123 | 123 | <div class="template-container"> |
| 124 | 124 | <header><h2><?php esc_html_e( 'Integrations', 'timetics' ); ?></h2></header> |
| 125 | 125 | <main class="main-wrapper"> |
| 126 | 126 | <ul> |
| 127 | - <?php foreach( $timetics_integrations as $timetics_integration ): ?> | |
| 127 | + <?php foreach( $integrations as $integration ): ?> | |
| 128 | 128 | <li class="single-list"> |
| 129 | 129 | <div class="single-item"> |
| 130 | 130 | <div class="integration-logo"> |
| 131 | 131 | <?php |
| 132 | - if($timetics_integration['id'] == 'google-calendar-meet'){ | |
| 132 | + if($integration['id'] == 'google-calendar-meet'){ | |
| 133 | 133 | ?> |
| 134 | 134 | <svg |
| 135 | 135 | width="20" |
| 136 | 136 | height="20" |
| @@ -163,9 +163,9 @@ | ||
| 163 | 163 | fill="#FFBA00" |
| 164 | 164 | /> |
| 165 | 165 | </svg> |
| 166 | 166 | <?php |
| 167 | - } else if($timetics_integration['id'] == 'zoom-meeting'){ | |
| 167 | + } else if($integration['id'] == 'zoom-meeting'){ | |
| 168 | 168 | ?> |
| 169 | 169 | <svg |
| 170 | 170 | xmlns="http://www.w3.org/2000/svg" |
| 171 | 171 | width="28" |
| @@ -178,9 +178,9 @@ | ||
| 178 | 178 | fill="#4A8CFF" |
| 179 | 179 | /> |
| 180 | 180 | </svg> |
| 181 | 181 | <?php |
| 182 | - } else if($timetics_integration['id'] == 'google-calendar'){ | |
| 182 | + } else if($integration['id'] == 'google-calendar'){ | |
| 183 | 183 | ?> |
| 184 | 184 | <svg |
| 185 | 185 | width="20" |
| 186 | 186 | height="20" |
| @@ -229,14 +229,14 @@ | ||
| 229 | 229 | } ?> |
| 230 | 230 | |
| 231 | 231 | </div> |
| 232 | 232 | <div class="content"> |
| 233 | - <h3><?php echo esc_html( $timetics_integration['name'] ); ?></h3> | |
| 233 | + <h3><?php echo esc_html( $integration['name'] ); ?></h3> | |
| 234 | 234 | <p> |
| 235 | - <?php echo esc_html( $timetics_integration['description'] ); ?> | |
| 235 | + <?php echo esc_html( $integration['description'] ); ?> | |
| 236 | 236 | </p> |
| 237 | 237 | </div> |
| 238 | - <a class="connect-btn" href="<?php echo esc_url( $timetics_integration['auth_url'] ); ?>"><?php esc_html_e( 'Connect', 'timetics' ); ?></a> | |
| 238 | + <a class="connect-btn" href="<?php echo esc_url( $integration['auth_url'] ); ?>"><?php esc_html_e( 'Connect', 'timetics' ); ?></a> | |
| 239 | 239 | </div> |
| 240 | 240 | </li> |
| 241 | 241 | <?php endforeach; ?> |
| 242 | 242 | </ul> |
| @@ -248,8 +248,11 @@ | ||
| 248 | 248 | var onboard = document.getElementById('timetics-onboard-skip'); |
| 249 | 249 | |
| 250 | 250 | onboard.addEventListener('click', function(event) { |
| 251 | 251 | event.preventDefault(); |
| 252 | + let data = { | |
| 253 | + action: 'timetics_staff_onboard_skip' | |
| 254 | + } | |
| 252 | 255 | |
| 253 | 256 | fetch('<?php echo esc_url( admin_url('admin-ajax.php') ); ?>', { |
| 254 | 257 | method: 'POST', |
| 255 | 258 | headers: { |
| @@ -254,9 +257,9 @@ | ||
| 254 | 257 | method: 'POST', |
| 255 | 258 | headers: { |
| 256 | 259 | 'Content-Type': 'application/x-www-form-urlencoded' |
| 257 | 260 | }, |
| 258 | - body: 'action=timetics_staff_onboard_skip&nonce=<?php echo esc_js( wp_create_nonce( 'timetics_staff_onboard_skip' ) ); ?>' | |
| 261 | + body: 'action=timetics_staff_onboard_skip' | |
| 259 | 262 | , |
| 260 | 263 | }) |
| 261 | 264 | .then(response => response.json()) |
| 262 | 265 | .then(data => { |