dialog-filter.php
5 years ago
emails-list.php
5 years ago
pagination-desktop.php
5 years ago
pagination-mobile.php
5 years ago
search-bar.php
6 years ago
emails-list.php
394 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Title section. |
| 4 | * |
| 5 | * @var Hustle_Layout_Helper $this |
| 6 | * |
| 7 | * @package Hustle |
| 8 | * @since 4.0.0 |
| 9 | */ |
| 10 | |
| 11 | // ELEMENT: Pagination (Mobile). |
| 12 | ?> |
| 13 | <div class="hui-pagination hui-pagination-mobile"> |
| 14 | <?php $this->render( 'admin/email-lists/pagination-mobile' ); ?> |
| 15 | </div> |
| 16 | |
| 17 | <div class="sui-box"> |
| 18 | |
| 19 | <?php |
| 20 | $items = count( $this->admin->entries_iterator() ); |
| 21 | // Filter Bar. |
| 22 | $this->render( |
| 23 | 'admin/email-lists/pagination-desktop', |
| 24 | array( 'is_bottom' => false ) |
| 25 | ); |
| 26 | ?> |
| 27 | |
| 28 | <table class="hui-table-entries sui-table sui-table-flushed<?php echo $items ? ' sui-accordion' : ''; ?>"> |
| 29 | |
| 30 | <thead> |
| 31 | |
| 32 | <tr> |
| 33 | |
| 34 | <th class="hui-column-id"> |
| 35 | <label for="hustle-check-all-top" class="sui-checkbox sui-checkbox-sm"> |
| 36 | <input type="checkbox" id="hustle-check-all-top" class="hustle-check-all"> |
| 37 | <span aria-hidden="true"></span> |
| 38 | <span><?php esc_html_e( 'Id', 'hustle' ); ?></span> |
| 39 | </label> |
| 40 | </th> |
| 41 | |
| 42 | <?php |
| 43 | $fields_mappers = $this->admin->get_fields_mappers(); |
| 44 | // Start from 1, since first one is ID. |
| 45 | // Length is 3 because we only display the 4 common columns. |
| 46 | $fields_headers = array_slice( $fields_mappers, 1, 3 ); |
| 47 | |
| 48 | $fields_left = count( $fields_mappers ) - count( $fields_headers ); |
| 49 | |
| 50 | foreach ( $fields_headers as $header ) : |
| 51 | ?> |
| 52 | |
| 53 | <th <?php echo isset( $header['class'] ) ? ' class="' . esc_attr( $header['class'] ) . '"' : ''; ?>><?php echo esc_html( $header['label'] ); ?></th> |
| 54 | |
| 55 | <?php endforeach; ?> |
| 56 | |
| 57 | <th data-num-hidden-fields="<?php echo ( $fields_left >= 0 ? $fields_left : 0 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"></th> |
| 58 | |
| 59 | </tr> |
| 60 | |
| 61 | </thead> |
| 62 | |
| 63 | <tbody class="hustle-list"> |
| 64 | |
| 65 | <?php if ( $no_local_list ) { ?> |
| 66 | <tr><td role="alert" class="hui-entries-alert" colspan="5"> |
| 67 | <p> |
| 68 | <span class="sui-icon-loader sui-loading" aria-hidden="true"></span> |
| 69 | <span class="sui-screen-reader-text"><?php echo $add_local_list; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span> |
| 70 | </p> |
| 71 | </td></tr> |
| 72 | <?php } ?> |
| 73 | |
| 74 | <?php |
| 75 | if ( $items ) : |
| 76 | |
| 77 | foreach ( $this->admin->entries_iterator() as $entry ) : |
| 78 | |
| 79 | $entry_id = $entry['id']; |
| 80 | $db_entry_id = $entry['entry_id']; |
| 81 | |
| 82 | $summary = $entry['summary']; |
| 83 | $summary_items = $summary['items']; |
| 84 | |
| 85 | $detail = $entry['detail']; |
| 86 | $detail_items = $detail['items']; |
| 87 | |
| 88 | $addons = $entry['addons']; |
| 89 | ?> |
| 90 | |
| 91 | <tr class="sui-accordion-item" data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>"> |
| 92 | |
| 93 | <?php foreach ( $summary_items as $key => $summary_item ) : ?> |
| 94 | |
| 95 | <?php if ( 1 === $summary_item['colspan'] ) : ?> |
| 96 | |
| 97 | <td class="hui-column-id sui-accordion-item-title"> |
| 98 | |
| 99 | <label class="sui-checkbox sui-checkbox-sm"> |
| 100 | <input |
| 101 | type="checkbox" |
| 102 | name="ids[]" |
| 103 | value="<?php echo esc_attr( $db_entry_id ); ?>" |
| 104 | id="email-entry-<?php echo esc_attr( $db_entry_id ); ?>" |
| 105 | class="hustle-listing-checkbox" |
| 106 | /> |
| 107 | <span aria-hidden="true"></span> |
| 108 | <?php /* translators: entry id */ ?> |
| 109 | <span><?php printf( esc_html__( '%2$sSelect entry number%3$s%1$s', 'hustle' ), esc_attr( $db_entry_id ), '<span class="sui-screen-reader-text">', '</span>' ); ?></span> |
| 110 | </label> |
| 111 | |
| 112 | </td> |
| 113 | |
| 114 | <?php else : ?> |
| 115 | |
| 116 | <?php if ( 'hui-column-date' === $summary_item['class'] ) { ?> |
| 117 | <td class="hui-column-date"> |
| 118 | <?php echo esc_html( $summary_item['value'] ); ?> |
| 119 | <span class="sui-accordion-open-indicator" aria-hidden="true"> |
| 120 | <span class="sui-icon-chevron-down" aria-hidden="true"></span> |
| 121 | <span class="sui-screen-reader-text"><?php esc_html_e( 'Click to open', 'hustle' ); ?></span> |
| 122 | </span> |
| 123 | </td> |
| 124 | <?php } else { ?> |
| 125 | <td |
| 126 | <?php |
| 127 | if ( ! empty( $summary_item['class'] ) ) { |
| 128 | echo ' class="' . esc_attr( $summary_item['class'] ) . '"';} |
| 129 | ?> |
| 130 | ><?php echo esc_html( $summary_item['value'] ); ?></td> |
| 131 | <?php } ?> |
| 132 | |
| 133 | <?php endif; ?> |
| 134 | |
| 135 | <?php if ( ! $summary['num_fields_left'] && ( count( $summary_items ) - 1 ) === $key ) : ?> |
| 136 | |
| 137 | <td><span class="hui-entry-button sui-accordion-open-indicator"> |
| 138 | <span class="sui-icon-chevron-down" aria-hidden="true"></span> |
| 139 | <span class="sui-screen-reader-text"><?php esc_html_e( 'Click to open', 'hustle' ); ?></span> |
| 140 | </span></td> |
| 141 | |
| 142 | <?php endif; ?> |
| 143 | |
| 144 | <?php endforeach; ?> |
| 145 | |
| 146 | <?php if ( $summary['num_fields_left'] ) : ?> |
| 147 | |
| 148 | <?php /* translators: remaining fields */ ?> |
| 149 | <td><?php printf( esc_html__( '+ %s other fields', 'hustle' ), esc_html( $summary['num_fields_left'] ) ); ?> |
| 150 | <span class="sui-accordion-open-indicator"> |
| 151 | <span class="sui-icon-chevron-down" aria-hidden="true"></span> |
| 152 | <span class="sui-screen-reader-text"><?php esc_html_e( 'Click to open', 'hustle' ); ?></span> |
| 153 | </span></td> |
| 154 | |
| 155 | <?php endif; ?> |
| 156 | |
| 157 | </tr> |
| 158 | |
| 159 | <tr class="sui-accordion-item-content"> |
| 160 | |
| 161 | <td colspan="<?php echo esc_attr( $detail['colspan'] ); ?>"> |
| 162 | |
| 163 | <div class="sui-box"> |
| 164 | |
| 165 | <div class="sui-box-body"> |
| 166 | |
| 167 | <h2>#<?php echo esc_html( $db_entry_id ); ?></h2> |
| 168 | |
| 169 | <div class="sui-box-settings-row sui-flushed"> |
| 170 | |
| 171 | <div class="sui-box-settings-col-2"> |
| 172 | |
| 173 | <ul class="hui-list"> |
| 174 | |
| 175 | <?php foreach ( $detail_items as $detail_item ) : ?> |
| 176 | |
| 177 | <li> |
| 178 | <strong><?php echo esc_html( $detail_item['label'] ); ?></strong> |
| 179 | |
| 180 | <?php $sub_entries = $detail_item['sub_entries']; ?> |
| 181 | |
| 182 | <?php if ( empty( $sub_entries ) ) { ?> |
| 183 | <span class="sui-list-detail" |
| 184 | style="margin-top: 0;"> |
| 185 | <?php echo ( $detail_item['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 186 | </span> |
| 187 | <?php |
| 188 | } else { |
| 189 | foreach ( $sub_entries as $sub_entry ) { |
| 190 | ?> |
| 191 | <div class="sui-form-field"> |
| 192 | <span class="sui-settings-label"><?php echo esc_html( $sub_entry['label'] ); ?></span> |
| 193 | <span class="sui-list-detail"><?php echo ( $sub_entry['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span> |
| 194 | </div> |
| 195 | <?php |
| 196 | } |
| 197 | } |
| 198 | ?> |
| 199 | |
| 200 | |
| 201 | </li> |
| 202 | |
| 203 | <?php endforeach; ?> |
| 204 | |
| 205 | </ul> |
| 206 | |
| 207 | </div> |
| 208 | |
| 209 | </div> |
| 210 | |
| 211 | <?php if ( ! empty( $addons ) ) : ?> |
| 212 | |
| 213 | <div class="sui-box-settings-row"> |
| 214 | |
| 215 | <div class="sui-box-settings-col-2"> |
| 216 | |
| 217 | <h3><?php esc_html_e( 'Active Integrations', 'hustle' ); ?></h3> |
| 218 | |
| 219 | <p><?php esc_html_e( 'You can check if the data is submitted to your active integrations and the information returned by the integrations if any.', 'hustle' ); ?></p> |
| 220 | |
| 221 | <table class="sui-table sui-accordion hui-table-entries-app"> |
| 222 | |
| 223 | <thead> |
| 224 | |
| 225 | <tr> |
| 226 | |
| 227 | <th class="hui-column-name"><?php esc_html_e( 'Integration Name', 'hustle' ); ?></th> |
| 228 | <th class="hui-column-data"><?php esc_html_e( 'Data sent to integration', 'hustle' ); ?></th> |
| 229 | |
| 230 | </tr> |
| 231 | |
| 232 | </thead> |
| 233 | |
| 234 | <tbody> |
| 235 | |
| 236 | <?php |
| 237 | $num = 0; |
| 238 | $num_addons = count( $addons ); |
| 239 | |
| 240 | foreach ( $addons as $addon ) : |
| 241 | ?> |
| 242 | |
| 243 | <tr class="sui-accordion-item<?php echo ( ++$num === $num_addons ) ? ' sui-table-item-last' : ''; ?> <?php echo ( $addon['summary']['data_sent'] ) ? 'sui-success' : 'sui-error'; ?>"> |
| 244 | |
| 245 | <td class="hui-column-name sui-accordion-item-title" style="padding-bottom: 5px;"> |
| 246 | |
| 247 | <img |
| 248 | src="<?php echo esc_attr( $addon['summary']['icon'] ); ?>" |
| 249 | aria-hidden="true" |
| 250 | /> |
| 251 | |
| 252 | <span><?php echo esc_attr( $addon['summary']['name'] ); ?></span> |
| 253 | |
| 254 | </td> |
| 255 | |
| 256 | <td class="hui-column-data" style="padding-bottom: 5px;"> |
| 257 | |
| 258 | <div class="hui-column-data--alignment"> |
| 259 | |
| 260 | <div class="hui-column-data--left"><?php $addon['summary']['data_sent'] ? esc_html_e( 'Yes', 'hustle' ) : esc_html_e( 'No', 'hustle' ); ?></div> |
| 261 | |
| 262 | <div class="hui-column-data--right"> |
| 263 | |
| 264 | <a href="<?php echo esc_url( $wizard_page ); ?>" class="sui-button sui-button-ghost sui-accordion-item-action"> |
| 265 | <span class="sui-icon-wrench-tool" aria-hidden="true"></span> |
| 266 | <?php esc_html_e( 'Configure', 'hustle' ); ?> |
| 267 | </a> |
| 268 | |
| 269 | <button class="sui-button-icon sui-accordion-open-indicator"> |
| 270 | <span class="sui-icon-chevron-down" aria-hidden="true"></span> |
| 271 | <span class="sui-screen-reader-text"><?php esc_html_e( 'Click to open', 'hustle' ); ?></span> |
| 272 | </button> |
| 273 | |
| 274 | </div> |
| 275 | |
| 276 | </div> |
| 277 | |
| 278 | </td> |
| 279 | |
| 280 | </tr> |
| 281 | |
| 282 | <tr class="sui-accordion-item-content <?php echo ( $addon['summary']['data_sent'] ) ? 'sui-success' : 'sui-error'; ?>"> |
| 283 | |
| 284 | <td colspan="2"> |
| 285 | |
| 286 | <div class="sui-box"> |
| 287 | |
| 288 | <div class="sui-box-body"> |
| 289 | |
| 290 | <ul class="hui-list"> |
| 291 | |
| 292 | <?php foreach ( $addon['detail'] as $item ) : ?> |
| 293 | |
| 294 | <li> |
| 295 | <strong><?php echo $item['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong> |
| 296 | <span><?php echo $item['value']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span> |
| 297 | </li> |
| 298 | |
| 299 | <?php endforeach; ?> |
| 300 | |
| 301 | </ul> |
| 302 | |
| 303 | </div> |
| 304 | |
| 305 | <div class="sui-box-footer hui-hidden-desktop"> |
| 306 | |
| 307 | <a href="<?php echo esc_url( $wizard_page ); ?>" class="sui-button sui-button-ghost sui-accordion-item-action"> |
| 308 | <span class="sui-icon-wrench-tool" aria-hidden="true"></span> |
| 309 | <?php esc_html_e( 'Configure', 'hustle' ); ?> |
| 310 | </a> |
| 311 | |
| 312 | </div> |
| 313 | |
| 314 | </div> |
| 315 | |
| 316 | </td> |
| 317 | |
| 318 | </tr> |
| 319 | |
| 320 | <?php endforeach; ?> |
| 321 | |
| 322 | </tbody> |
| 323 | |
| 324 | </table> |
| 325 | |
| 326 | </div> |
| 327 | |
| 328 | </div> |
| 329 | |
| 330 | <?php endif; ?> |
| 331 | |
| 332 | </div> |
| 333 | |
| 334 | <div class="sui-box-footer"> |
| 335 | |
| 336 | <button class="sui-button sui-button-red sui-button-ghost hustle-delete-entry-button" |
| 337 | data-id="<?php echo esc_attr( $db_entry_id ); ?>" |
| 338 | data-nonce=<?php echo esc_attr( wp_create_nonce( 'hustle_entries_request' ) ); ?> |
| 339 | data-title="<?php esc_html_e( 'Delete Entry', 'hustle' ); ?>" |
| 340 | data-description="<?php esc_html_e( 'Are you sure you wish to permanently delete this entry?', 'hustle' ); ?>" |
| 341 | > |
| 342 | <span class="sui-icon-trash" aria-hidden="true"></span> |
| 343 | <?php esc_html_e( 'Delete', 'hustle' ); ?> |
| 344 | </button> |
| 345 | |
| 346 | </div> |
| 347 | |
| 348 | </div> |
| 349 | |
| 350 | </td> |
| 351 | |
| 352 | </tr> |
| 353 | |
| 354 | <?php endforeach; ?> |
| 355 | |
| 356 | <?php else : ?> |
| 357 | |
| 358 | <tr> |
| 359 | <td class="hui-column-notice" colspan="<?php echo count( $fields_headers ) + 2; ?>"> |
| 360 | |
| 361 | <?php |
| 362 | $notice_options = array( |
| 363 | array( |
| 364 | 'type' => 'inline_notice', |
| 365 | 'class' => 'sui-notice-error', |
| 366 | 'icon' => 'info', |
| 367 | 'value' => esc_html__( 'No entries were found.', 'hustle' ), |
| 368 | ), |
| 369 | ); |
| 370 | $this->get_html_for_options( $notice_options ); |
| 371 | ?> |
| 372 | |
| 373 | </td> |
| 374 | </tr> |
| 375 | |
| 376 | <?php endif; ?> |
| 377 | |
| 378 | </tbody> |
| 379 | |
| 380 | </table> |
| 381 | |
| 382 | <?php |
| 383 | // Filter Bar. |
| 384 | $this->render( |
| 385 | 'admin/email-lists/pagination-desktop', |
| 386 | array( |
| 387 | 'actions_class' => 'hui-mobile-hidden', |
| 388 | 'is_bottom' => true, |
| 389 | ) |
| 390 | ); |
| 391 | ?> |
| 392 | |
| 393 | </div> |
| 394 |