| 1 |
<?php |
| 2 |
$lists_data = $args['lists_data'] ?? []; |
| 3 |
?> |
| 4 |
<style> |
| 5 |
#wpfooter{position:relative !important;} |
| 6 |
</style> |
| 7 |
<div class="col-sm-9 sue-external-lists-main"> |
| 8 |
<div class="sue-log-card"> |
| 9 |
<div class="sue-log-card-header"> |
| 10 |
<span class="sue-log-card-icon">🗂️</span> |
| 11 |
<h3><?php esc_html_e( 'Edit External List', 'send-users-email' ); ?></h3> |
| 12 |
</div> |
| 13 |
<div class="sue-log-card-body"> |
| 14 |
<div class="sue-field-row sue-external-edit-search-row"> |
| 15 |
<div class="sue-field-label"> |
| 16 |
<label for="external-list-search"><?php esc_html_e( 'Search', 'send-users-email' ); ?></label> |
| 17 |
<p class="sue-form-hint"><?php esc_html_e( 'Filter entries by email, name, title, salutation, and custom fields.', 'send-users-email' ); ?></p> |
| 18 |
</div> |
| 19 |
<div class="sue-field-input"> |
| 20 |
<input type="search" class="sue-input" id="external-list-search" placeholder="<?php esc_attr_e( 'Type to filter...', 'send-users-email' ); ?>"> |
| 21 |
<div class="sue-form-hint" id="matchCount" aria-live="polite"></div> |
| 22 |
</div> |
| 23 |
</div> |
| 24 |
|
| 25 |
<?php if (!empty($lists_data)) : ?> |
| 26 |
<div class="sue-templates-table-wrap"> |
| 27 |
<table class="table table-bordered table-striped sue-table" id="external-list-edit-table"> |
| 28 |
<thead> |
| 29 |
<tr> |
| 30 |
<th><?php esc_html_e('Email', 'send-users-email'); ?></th> |
| 31 |
<th><?php esc_html_e('First Name', 'send-users-email'); ?></th> |
| 32 |
<th><?php esc_html_e('Last Name', 'send-users-email'); ?></th> |
| 33 |
<th><?php esc_html_e('Title', 'send-users-email'); ?></th> |
| 34 |
<th><?php esc_html_e('Salutation', 'send-users-email'); ?></th> |
| 35 |
<th><?php esc_html_e('Field 01', 'send-users-email'); ?></th> |
| 36 |
<th><?php esc_html_e('Field 02', 'send-users-email'); ?></th> |
| 37 |
<th><?php esc_html_e('Field 03', 'send-users-email'); ?></th> |
| 38 |
<th><?php esc_html_e('Field 04', 'send-users-email'); ?></th> |
| 39 |
<th><?php esc_html_e('Field 05', 'send-users-email'); ?></th> |
| 40 |
<th><?php esc_html_e('Subscribed', 'send-users-email'); ?></th> |
| 41 |
<th><?php esc_html_e('Actions', 'send-users-email'); ?></th> |
| 42 |
</tr> |
| 43 |
</thead> |
| 44 |
<tbody id="external-list-edit-table-body"> |
| 45 |
<?php foreach ($lists_data as $list) : $hay = sue_make_haystack($list); ?> |
| 46 |
<tr data-id="<?php echo esc_attr($list->id); ?>" data-list-id="<?php echo esc_attr($list->list_id); ?>" data-hay="<?php echo esc_attr($hay); ?>"> |
| 47 |
<td class="email"><?php echo esc_html($list->email); ?></td> |
| 48 |
<td class="first_name"><?php echo esc_html($list->first_name); ?></td> |
| 49 |
<td class="last_name"><?php echo esc_html($list->last_name); ?></td> |
| 50 |
<td class="title"><?php echo esc_html($list->title); ?></td> |
| 51 |
<td class="salutation"><?php echo esc_html($list->salutation); ?></td> |
| 52 |
<td class="field_01"><?php echo esc_html($list->field_01); ?></td> |
| 53 |
<td class="field_02"><?php echo esc_html($list->field_02); ?></td> |
| 54 |
<td class="field_03"><?php echo esc_html($list->field_03); ?></td> |
| 55 |
<td class="field_04"><?php echo esc_html($list->field_04); ?></td> |
| 56 |
<td class="field_05"><?php echo esc_html($list->field_05); ?></td> |
| 57 |
<td class="subscribed"><?php echo $list->subscribed ? esc_html__('Yes', 'send-users-email') : esc_html__('No', 'send-users-email'); ?></td> |
| 58 |
<td class="actions sue-table-actions"> |
| 59 |
<button |
| 60 |
class="sue-btn sue-btn-danger sue-btn-icon sue-delete-external-list-btn" |
| 61 |
data-list-id="<?php echo esc_attr($list->id); ?>" |
| 62 |
data-nonce="<?php echo esc_attr( wp_create_nonce( 'sue_external_lists_delete_' . $list->id ) ); ?>" |
| 63 |
type="button" |
| 64 |
> |
| 65 |
<span class="dashicons dashicons-trash" aria-hidden="true"></span> |
| 66 |
</button> |
| 67 |
<button |
| 68 |
class="sue-btn sue-btn-muted sue-btn-icon sue-edit-external-list-btn" |
| 69 |
data-list-id="<?php echo esc_attr($list->id); ?>" |
| 70 |
data-nonce="<?php echo esc_attr( wp_create_nonce( 'sue_external_lists_edit_' . $list->id ) ); ?>" |
| 71 |
data-url="<?php echo esc_url( admin_url() . 'admin.php?page=send-users-email-external-lists&action=edit-lists&list_id=' . $list->id ); ?>" |
| 72 |
type="button" |
| 73 |
> |
| 74 |
<span class="dashicons dashicons-edit" aria-hidden="true"></span> |
| 75 |
</button> |
| 76 |
<input class="nonce_update_<?php echo esc_attr($list->id); ?>" type="hidden" value="<?php echo esc_attr( wp_create_nonce( 'sue_update_external_list_' . $list->id ) ); ?>"> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
<?php endforeach; ?> |
| 80 |
</tbody> |
| 81 |
</table> |
| 82 |
</div> |
| 83 |
<?php else : ?> |
| 84 |
<div class="sue-notice sue-notice-info" style="margin-bottom:0;"> |
| 85 |
<div class="sue-notice-icon">📭</div> |
| 86 |
<div class="sue-notice-body"> |
| 87 |
<p class="sue-notice-title"><?php esc_html_e('No list entries found', 'send-users-email'); ?></p> |
| 88 |
<p><?php esc_html_e('There are no records in this list yet.', 'send-users-email'); ?></p> |
| 89 |
</div> |
| 90 |
</div> |
| 91 |
<?php endif; ?> |
| 92 |
</div> |
| 93 |
<div class="sue-log-card-body" style="padding-top:0;"> |
| 94 |
<div class="sue-external-edit-pagination"> |
| 95 |
<?php if (isset($args['pagination'])) : ?> |
| 96 |
<div> |
| 97 |
<?php echo $args['pagination']; ?> |
| 98 |
</div> |
| 99 |
<?php endif; ?> |
| 100 |
</div> |
| 101 |
</div> |
| 102 |
</div> |
| 103 |
</div> |
| 104 |
<?php SUE_External_Lists_Edit::enqueue_scripts(); ?> |