PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / trunk
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent vtrunk
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
supportcandy / includes / admin / onboarding / class-wpsc-onboarding-step-categories.php

class-wpsc-onboarding-step-categories.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent trunk, at includes/admin/onboarding/class-wpsc-onboarding-step-categories.php

61 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly!
4 }
5
6 if ( ! class_exists( 'WPSC_Onboarding_Step_Categories' ) ) :
7
8 /**
9 * Onboarding step 3: Review Ticket Categories.
10 *
11 * Renders its own simple list + "Add Category" form (not the existing Settings
12 * screen's table/modal), but posts to the existing 'wpsc_set_add_category' AJAX
13 * action so categories are still created through the one existing code path -
14 * no category storage/logic is duplicated here.
15 */
16 final class WPSC_Onboarding_Step_Categories {
17
18 const STEP_ID = 'categories';
19
20 /**
21 * Render step body
22 *
23 * @param string $step_id - step id.
24 * @return void
25 */
26 public static function render( $step_id ) {
27
28 $categories = WPSC_Category::find( array( 'items_per_page' => 0 ) )['results'];
29 ?>
30 <div class="wpsc-onboarding-step">
31 <h2><?php esc_attr_e( 'Review Ticket Categories', 'supportcandy' ); ?></h2>
32 <p class="wpsc-onboarding-step-desc">
33 <?php esc_attr_e( 'Categories help you organize tickets by topic, such as Billing, Technical Support, Sales, or General Questions. A default "General" category is already set up - add more if it fits your business, or continue as-is.', 'supportcandy' ); ?>
34 </p>
35
36 <ul class="wpsc-onboarding-pill-list">
37 <?php foreach ( $categories as $category ) : ?>
38 <li><?php echo esc_html( $category->name ); ?></li>
39 <?php endforeach; ?>
40 </ul>
41
42 <form action="#" onsubmit="return false;" class="wpsc-frm-onboarding-add-category">
43 <div class="wpsc-onboarding-inline-form">
44 <input type="text" name="label" placeholder="<?php esc_attr_e( 'e.g. Billing', 'supportcandy' ); ?>" autocomplete="off">
45 <button
46 type="button"
47 class="wpsc-button normal primary"
48 onclick="wpsc_onboarding_add_category(this, '<?php echo esc_attr( wp_create_nonce( 'wpsc_set_add_category' ) ); ?>');">
49 <?php esc_attr_e( 'Add Category', 'supportcandy' ); ?>
50 </button>
51 </div>
52 </form>
53
54 <?php WPSC_Onboarding::render_step_footer( $step_id ); ?>
55 </div>
56 <?php
57 wp_die();
58 }
59 }
60 endif;
61