| 1 |
<?php |
| 2 |
/** |
| 3 |
* Manage Products modal (Pro). Syncs the plan group's products to the picker: |
| 4 |
* search and multi-select; on save, checked products/variations are attached to |
| 5 |
* every duration and any previously-attached one left unchecked is removed. |
| 6 |
* |
| 7 |
* @var array $plan Plan (provides id). |
| 8 |
* |
| 9 |
* @package SpringDevs\Subscription\Admin |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
?> |
| 16 |
<div class="wpsubs-modal" id="subscrpt-add-product" hidden data-subscrpt-add-product data-group-id="<?php echo esc_attr( $plan['id'] ); ?>"> |
| 17 |
<div class="wpsubs-modal__backdrop" data-wpsubs-modal-close></div> |
| 18 |
<div class="wpsubs-modal__dialog" style="width:min(720px, calc(100vw - 40px));"> |
| 19 |
<div class="wpsubs-modal__head" style="align-items:flex-start;"> |
| 20 |
<div> |
| 21 |
<h2 class="wpsubs-modal__title"><?php esc_html_e( 'Manage Products', 'subscription' ); ?></h2> |
| 22 |
<?php // The picker is the plan's product list, not an add queue — say so, because unticking removes. ?> |
| 23 |
<p style="margin:5px 0 0;color:var(--wpsubs-text-muted);font-size:13px;line-height:1.5;font-weight:400;"> |
| 24 |
<?php esc_html_e( 'Ticked products are sold on this plan, at every duration. Untick one to take it off the plan.', 'subscription' ); ?> |
| 25 |
</p> |
| 26 |
</div> |
| 27 |
<button type="button" class="wpsubs-modal__close" data-wpsubs-modal-close aria-label="<?php esc_attr_e( 'Close', 'subscription' ); ?>">×</button> |
| 28 |
</div> |
| 29 |
<div class="wpsubs-modal__body"> |
| 30 |
<div style="display:flex;align-items:center;gap:12px;margin-bottom:12px;"> |
| 31 |
<label style="display:inline-flex;align-items:center;padding-left:4px;cursor:pointer;" title="<?php esc_attr_e( 'Select all available products', 'subscription' ); ?>"> |
| 32 |
<input type="checkbox" class="wpsubs-checkbox" data-subscrpt-picker-all /> |
| 33 |
</label> |
| 34 |
<div class="wpsubs-input-wrap wpsubs-input-wrap--icon-l" style="flex:1;"> |
| 35 |
<svg class="wpsubs-input-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z"/></svg> |
| 36 |
<input type="search" class="wpsubs-input" placeholder="<?php esc_attr_e( 'Search products…', 'subscription' ); ?>" data-subscrpt-product-search /> |
| 37 |
</div> |
| 38 |
</div> |
| 39 |
<ul data-subscrpt-product-list style="list-style:none;margin:0;padding:0;max-height:min(560px, 60vh);overflow-y:auto;display:flex;flex-direction:column;gap:2px;"> |
| 40 |
<li style="padding:10px 4px;color:var(--wpsubs-text-subtle);font-size:13px;"><?php esc_html_e( 'Loading…', 'subscription' ); ?></li> |
| 41 |
</ul> |
| 42 |
</div> |
| 43 |
<div class="wpsubs-modal__footer"> |
| 44 |
<?php // Running tally, so the effect of a tick is visible before saving. ?> |
| 45 |
<span data-subscrpt-picker-count style="margin-right:auto;font-size:13px;color:var(--wpsubs-text-muted);"></span> |
| 46 |
<button type="button" class="wpsubs-btn wpsubs-btn--outline" data-wpsubs-modal-close><?php esc_html_e( 'Cancel', 'subscription' ); ?></button> |
| 47 |
<button type="button" class="wpsubs-btn wpsubs-btn--primary" data-subscrpt-add-product-submit><?php esc_html_e( 'Save products', 'subscription' ); ?></button> |
| 48 |
</div> |
| 49 |
</div> |
| 50 |
</div> |
| 51 |
|