| @@ -26,8 +26,18 @@ | ||
| 26 | 26 | add_shortcode( 'timetics-booking-form', [ $this, 'booking_form' ] ); |
| 27 | 27 | |
| 28 | 28 | // [timetics-meeting-list limit=''] |
| 29 | 29 | add_shortcode( 'timetics-meeting-list', [ $this, 'meeting_list' ] ); |
| 30 | + | |
| 31 | + // [timetics-user-dashboard] | |
| 32 | + add_shortcode( 'timetics-user-dashboard', [ $this, 'user_dashboard' ] ); | |
| 33 | + | |
| 34 | + // [timetics-category id=''] | |
| 35 | + add_shortcode( 'timetics-category', [ $this, 'category_meetings' ] ); | |
| 36 | + | |
| 37 | + if ( class_exists( 'Wpeventin' ) ) { | |
| 38 | + add_action( 'init', [ $this, 'eventin_seat_plan' ] ); | |
| 39 | + } | |
| 30 | 40 | } |
| 31 | 41 | |
| 32 | 42 | /** |
| 33 | 43 | * booking form for frontend |
| @@ -33,52 +43,139 @@ | ||
| 33 | 43 | * booking form for frontend |
| 34 | 44 | * |
| 35 | 45 | * @return void |
| 36 | 46 | */ |
| 37 | - public function booking_form($attribute) { | |
| 38 | - wp_enqueue_style('timetics-vendor'); | |
| 39 | - wp_enqueue_style('timetics-frontend'); | |
| 40 | - wp_enqueue_script('timetics-antd-scripts'); | |
| 41 | - wp_enqueue_script('timetics-flatpickr-scripts'); | |
| 42 | - wp_enqueue_script('timetics-frontend-scripts'); | |
| 47 | + public function booking_form( $attribute ) { | |
| 48 | + wp_enqueue_style( 'timetics-vendor' ); | |
| 49 | + wp_enqueue_style( 'timetics-frontend' ); | |
| 50 | + wp_enqueue_script( 'timetics-flatpickr-scripts' ); | |
| 51 | + wp_enqueue_script( 'timetics-frontend-scripts' ); | |
| 52 | + wp_enqueue_script( 'calendar-locale' ); | |
| 43 | 53 | |
| 44 | - $id = isset($attribute['id']) ? $attribute['id'] : ''; | |
| 54 | + $id = isset( $attribute['id'] ) ? $attribute['id'] : ''; | |
| 45 | 55 | $data_controls = [ |
| 46 | - 'id'=>$id, | |
| 56 | + 'id' => $id, | |
| 47 | 57 | ]; |
| 48 | - $controls = json_encode( $data_controls ); | |
| 58 | + $controls = json_encode( $data_controls ); | |
| 49 | 59 | |
| 60 | + $visibility = get_post_meta( $id, '_tt_apointment_visibility', true ); | |
| 61 | + $is_visible = 'enabled' === $visibility; | |
| 62 | + | |
| 63 | + if ( ! $is_visible && ! current_user_can( 'manage_options' ) ) { | |
| 64 | + return '<div class="timetics-shortcode-wrapper"><p>' . esc_html__( 'This booking form is not available.', 'timetics' ) . '</p></div>'; | |
| 65 | + } | |
| 66 | + | |
| 50 | 67 | ob_start(); |
| 51 | 68 | ?> |
| 69 | + <div class="timetics-shortcode-wrapper"> | |
| 70 | + <div class="timetics-single-booking-wrapper" | |
| 71 | + data-controls="<?php echo esc_attr( $controls ); ?>"></div> | |
| 72 | + </div> | |
| 73 | + <?php | |
| 74 | + return ob_get_clean(); | |
| 75 | + } | |
| 76 | + /** | |
| 77 | + * user dashboard for frontend | |
| 78 | + * | |
| 79 | + * @return void | |
| 80 | + */ | |
| 81 | + public function user_dashboard( $attribute ) { | |
| 82 | + wp_enqueue_style( 'timetics-vendor' ); | |
| 83 | + wp_enqueue_style( 'timetics-frontend' ); | |
| 84 | + wp_enqueue_script( 'timetics-frontend-scripts' ); | |
| 85 | + | |
| 86 | + $id = get_current_user_id(); | |
| 87 | + $data_controls = [ | |
| 88 | + 'id' => $id, | |
| 89 | + ]; | |
| 90 | + $controls = json_encode( $data_controls ); | |
| 91 | + | |
| 92 | + ob_start(); | |
| 93 | + if (is_user_logged_in()) { | |
| 94 | + | |
| 95 | + ?> | |
| 52 | 96 | <div class="timetics-shortcode-wrapper"> |
| 53 | - <div class="timetics-single-booking-wrapper" data-controls="<?php echo esc_attr( $controls ); ?>" > </div> | |
| 97 | + <div class="timetics-user-dashboard-wrapper" | |
| 98 | + data-controls="<?php echo esc_attr( $controls ); ?>"> | |
| 99 | + </div> | |
| 100 | + </div> | |
| 101 | + <?php | |
| 102 | + | |
| 103 | + }else{ | |
| 104 | + ?> | |
| 105 | + <div class="timetics-userdashbaord-wrapper"> | |
| 106 | + <h3> <?php esc_html_e( 'You are not logged in', 'timetics' ); ?> <a href="<?php echo esc_url(wp_login_url()) ?>"><?php esc_html_e( 'Login', 'timetics' ); ?></a></h3> | |
| 54 | 107 | </div> |
| 55 | - <?php | |
| 108 | + <?php | |
| 109 | + } | |
| 56 | 110 | return ob_get_clean(); |
| 111 | + | |
| 57 | 112 | } |
| 58 | 113 | |
| 114 | + public function eventin_seat_plan() { | |
| 115 | + wp_enqueue_style( 'timetics-vendor' ); | |
| 116 | + wp_enqueue_style( 'timetics-frontend' ); | |
| 117 | + wp_enqueue_script( 'timetics-flatpickr-scripts' ); | |
| 118 | + wp_enqueue_script( 'timetics-frontend-scripts' ); | |
| 119 | + } | |
| 120 | + | |
| 59 | 121 | /** |
| 60 | 122 | * booking form for frontend |
| 61 | 123 | * |
| 62 | 124 | * @return void |
| 63 | 125 | */ |
| 64 | - public function meeting_list($attribute) { | |
| 65 | - wp_enqueue_style('timetics-vendor'); | |
| 66 | - wp_enqueue_style('timetics-frontend'); | |
| 126 | + public function meeting_list( $attribute ) { | |
| 127 | + wp_enqueue_style( 'timetics-vendor' ); | |
| 128 | + wp_enqueue_style( 'timetics-frontend' ); | |
| 129 | + wp_enqueue_script( 'timetics-flatpickr-scripts' ); | |
| 130 | + wp_enqueue_script( 'timetics-frontend-scripts' ); | |
| 131 | + wp_enqueue_script( 'calendar-locale' ); | |
| 132 | + wp_enqueue_script( 'jquery' ); | |
| 67 | 133 | |
| 68 | - $limit = isset($attribute['limit']) ? $attribute['limit'] : ''; | |
| 134 | + wp_enqueue_script( 'timetics-meeting-filtering', TIMETICS_ASSETS_URL . 'js/meeting-filter.js', ['jquery'], time() ); | |
| 69 | 135 | |
| 136 | + $limit = isset( $attribute['limit'] ) ? $attribute['limit'] : ''; | |
| 137 | + $show_filter = isset( $attribute['show_filter'] ) && 'true' == $attribute['show_filter'] ? $attribute['show_filter'] : false; | |
| 138 | + | |
| 70 | 139 | ob_start(); |
| 71 | 140 | ?> |
| 72 | - <div class="timetics-shortcode-wrapper"> | |
| 73 | - <div class="timetics-meeting-list-wrapper"> | |
| 74 | - <?php | |
| 75 | - if (file_exists(TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php')){ | |
| 76 | - require_once TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php'; | |
| 77 | - } | |
| 78 | - ?> | |
| 79 | - </div> | |
| 141 | + <div class="timetics-shortcode-wrapper"> | |
| 142 | + <div class="timetics-meeting-list-wrapper"> | |
| 143 | + <?php | |
| 144 | + if ( file_exists( TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php' ) ) { | |
| 145 | + require_once TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php'; | |
| 146 | + } | |
| 147 | + ?> | |
| 80 | 148 | </div> |
| 149 | + </div> | |
| 150 | + <?php | |
| 151 | + return ob_get_clean(); | |
| 152 | + } | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * category wise meeting for frontend | |
| 156 | + * | |
| 157 | + * @return void | |
| 158 | + */ | |
| 159 | + public function category_meetings( $attribute ) { | |
| 160 | + wp_enqueue_style( 'timetics-vendor' ); | |
| 161 | + wp_enqueue_style( 'timetics-frontend' ); | |
| 162 | + wp_enqueue_script( 'timetics-flatpickr-scripts' ); | |
| 163 | + wp_enqueue_script( 'timetics-frontend-scripts' ); | |
| 164 | + wp_enqueue_script( 'calendar-locale' ); | |
| 165 | + | |
| 166 | + $id = isset( $attribute['id'] ) ? $attribute['id'] : ''; | |
| 167 | + $data_controls = [ | |
| 168 | + 'id' => $id, | |
| 169 | + ]; | |
| 170 | + $controls = json_encode( $data_controls ); | |
| 171 | + | |
| 172 | + ob_start(); | |
| 173 | + ?> | |
| 174 | + <div class="timetics-shortcode-wrapper"> | |
| 175 | + <div class="timetics-category-wrapper" | |
| 176 | + data-controls="<?php echo esc_attr( $controls ); ?>"></div> | |
| 177 | + </div> | |
| 81 | 178 | <?php |
| 82 | 179 | return ob_get_clean(); |
| 83 | 180 | } |
| 84 | 181 | } |