| 1 |
<?php |
| 2 |
/** |
| 3 |
* Pricing Table Builder - Admin List Page. |
| 4 |
* |
| 5 |
* @package King_Addons |
| 6 |
*/ |
| 7 |
|
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
$new_url = admin_url('admin.php?page=king-addons-pricing-tables&action=new'); |
| 13 |
?> |
| 14 |
<div class="kng-v3-wrap"> |
| 15 |
<div class="kng-v3-header"> |
| 16 |
<div class="kng-v3-header-content"> |
| 17 |
<h1 class="kng-v3-title"><?php esc_html_e('Pricing Tables', 'king-addons'); ?></h1> |
| 18 |
<p class="kng-v3-subtitle"><?php esc_html_e('Create beautiful pricing tables for your website', 'king-addons'); ?></p> |
| 19 |
</div> |
| 20 |
<div class="kng-v3-header-actions"> |
| 21 |
<a href="<?php echo esc_url($new_url); ?>" class="kng-v3-btn kng-v3-btn-primary"> |
| 22 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> |
| 23 |
<?php esc_html_e('Create New Table', 'king-addons'); ?> |
| 24 |
</a> |
| 25 |
</div> |
| 26 |
</div> |
| 27 |
|
| 28 |
<?php if (isset($_GET['deleted']) && $_GET['deleted'] === '1'): ?> |
| 29 |
<div class="kng-v3-notice kng-v3-notice-success"> |
| 30 |
<p><?php esc_html_e('Pricing table deleted successfully.', 'king-addons'); ?></p> |
| 31 |
</div> |
| 32 |
<?php endif; ?> |
| 33 |
|
| 34 |
<div class="kng-v3-content"> |
| 35 |
<?php if (empty($tables)): ?> |
| 36 |
<div class="kng-pt-empty"> |
| 37 |
<div class="kng-pt-empty-icon"> |
| 38 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" width="64" height="64"> |
| 39 |
<rect x="3" y="3" width="18" height="18" rx="2"/> |
| 40 |
<line x1="3" y1="9" x2="21" y2="9"/> |
| 41 |
<line x1="9" y1="21" x2="9" y2="9"/> |
| 42 |
</svg> |
| 43 |
</div> |
| 44 |
<h2 class="kng-pt-empty-title"><?php esc_html_e('No Pricing Tables Yet', 'king-addons'); ?></h2> |
| 45 |
<p class="kng-pt-empty-text"><?php esc_html_e('Create your first pricing table to showcase your plans and pricing.', 'king-addons'); ?></p> |
| 46 |
<a href="<?php echo esc_url($new_url); ?>" class="kng-v3-btn kng-v3-btn-primary kng-v3-btn-lg"> |
| 47 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="20" height="20"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> |
| 48 |
<?php esc_html_e('Create Your First Table', 'king-addons'); ?> |
| 49 |
</a> |
| 50 |
</div> |
| 51 |
<?php else: ?> |
| 52 |
<div class="kng-pt-grid-admin"> |
| 53 |
<?php foreach ($tables as $table): |
| 54 |
$config_json = get_post_meta($table->ID, \King_Addons\Pricing_Table_Builder::META_CONFIG, true); |
| 55 |
$config = json_decode($config_json, true); |
| 56 |
$plans_count = count($config['plans'] ?? []); |
| 57 |
$preset_id = $config['style']['preset_id'] ?? 'free_modern_cards'; |
| 58 |
$is_published = $table->post_status === 'publish'; |
| 59 |
|
| 60 |
$edit_url = admin_url('admin.php?page=king-addons-pricing-tables&action=edit&table_id=' . $table->ID); |
| 61 |
$delete_url = wp_nonce_url(admin_url('admin-post.php?action=king_addons_pt_delete&table_id=' . $table->ID), 'kng_pt_delete_' . $table->ID); |
| 62 |
$duplicate_url = wp_nonce_url(admin_url('admin-post.php?action=king_addons_pt_duplicate&table_id=' . $table->ID), 'kng_pt_duplicate_' . $table->ID); |
| 63 |
?> |
| 64 |
<div class="kng-pt-table-card"> |
| 65 |
<div class="kng-pt-table-card-header"> |
| 66 |
<h3 class="kng-pt-table-card-title"><?php echo esc_html($table->post_title); ?></h3> |
| 67 |
<span class="kng-pt-status kng-pt-status--<?php echo $is_published ? 'published' : 'draft'; ?>"> |
| 68 |
<?php echo $is_published ? esc_html__('Published', 'king-addons') : esc_html__('Draft', 'king-addons'); ?> |
| 69 |
</span> |
| 70 |
</div> |
| 71 |
<div class="kng-pt-table-card-meta"> |
| 72 |
<span class="kng-pt-meta-item"> |
| 73 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg> |
| 74 |
<?php echo esc_html(get_the_modified_date('M j, Y', $table->ID)); ?> |
| 75 |
</span> |
| 76 |
<span class="kng-pt-meta-item"> |
| 77 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg> |
| 78 |
<?php printf(_n('%d plan', '%d plans', $plans_count, 'king-addons'), $plans_count); ?> |
| 79 |
</span> |
| 80 |
</div> |
| 81 |
<div class="kng-pt-table-card-shortcode"> |
| 82 |
<code class="kng-pt-shortcode" data-copy="[kng_pricing_table id="<?php echo esc_attr($table->ID); ?>"]">[kng_pricing_table id="<?php echo esc_attr($table->ID); ?>"]</code> |
| 83 |
<button type="button" class="kng-pt-copy-btn" title="<?php esc_attr_e('Copy shortcode', 'king-addons'); ?>"> |
| 84 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg> |
| 85 |
</button> |
| 86 |
</div> |
| 87 |
<div class="kng-pt-table-card-actions"> |
| 88 |
<a href="<?php echo esc_url($edit_url); ?>" class="kng-v3-btn kng-v3-btn-secondary kng-v3-btn-sm"> |
| 89 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg> |
| 90 |
<?php esc_html_e('Edit', 'king-addons'); ?> |
| 91 |
</a> |
| 92 |
<a href="<?php echo esc_url($duplicate_url); ?>" class="kng-v3-btn kng-v3-btn-outline kng-v3-btn-sm"> |
| 93 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg> |
| 94 |
<?php esc_html_e('Duplicate', 'king-addons'); ?> |
| 95 |
</a> |
| 96 |
<a href="<?php echo esc_url($delete_url); ?>" class="kng-v3-btn kng-v3-btn-danger kng-v3-btn-sm" onclick="return confirm('<?php echo esc_js(__('Are you sure you want to delete this pricing table?', 'king-addons')); ?>')"> |
| 97 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg> |
| 98 |
<?php esc_html_e('Delete', 'king-addons'); ?> |
| 99 |
</a> |
| 100 |
</div> |
| 101 |
</div> |
| 102 |
<?php endforeach; ?> |
| 103 |
</div> |
| 104 |
<?php endif; ?> |
| 105 |
</div> |
| 106 |
</div> |
| 107 |
|