You've already forked wc-licensed-product
Add inline editing for licenses and copy license key button
- Add inline editing for status, expiry date, and domain fields - Add copy-to-clipboard button for license keys - Add AJAX handlers for inline editing with nonce verification - Update LicenseManager with updateLicenseExpiry method - Add new translations for inline editing strings (de_CH) - Compile updated German translations to .mo file Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -110,7 +110,12 @@
|
||||
<th scope="row" class="check-column">
|
||||
<input type="checkbox" name="license_ids[]" value="{{ item.license.id }}">
|
||||
</th>
|
||||
<td><code>{{ item.license.licenseKey }}</code></td>
|
||||
<td>
|
||||
<code class="wclp-license-key">{{ item.license.licenseKey }}</code>
|
||||
<button type="button" class="wclp-copy-btn button-link" data-license-key="{{ esc_attr(item.license.licenseKey) }}" title="{{ __('Copy to clipboard') }}">
|
||||
<span class="dashicons dashicons-clipboard"></span>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
{% if item.product_edit_url %}
|
||||
<a href="{{ esc_url(item.product_edit_url) }}">{{ esc_html(item.product_name) }}</a>
|
||||
@@ -124,18 +129,54 @@
|
||||
<br><small>{{ esc_html(item.customer_email) }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ esc_html(item.license.domain) }}</td>
|
||||
<td>
|
||||
<span class="license-status license-status-{{ item.license.status }}">
|
||||
{{ item.license.status|capitalize }}
|
||||
</span>
|
||||
<td class="wclp-editable-cell" data-field="domain" data-license-id="{{ item.license.id }}">
|
||||
<span class="wclp-display-value">{{ esc_html(item.license.domain) }}</span>
|
||||
<button type="button" class="wclp-edit-btn button-link" title="{{ __('Edit') }}">
|
||||
<span class="dashicons dashicons-edit"></span>
|
||||
</button>
|
||||
<div class="wclp-edit-form" style="display:none;">
|
||||
<input type="text" class="wclp-edit-input" value="{{ esc_attr(item.license.domain) }}">
|
||||
<button type="button" class="wclp-save-btn button button-small button-primary">{{ __('Save') }}</button>
|
||||
<button type="button" class="wclp-cancel-btn button button-small">{{ __('Cancel') }}</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{% if item.license.expiresAt %}
|
||||
{{ item.license.expiresAt|date('Y-m-d') }}
|
||||
{% else %}
|
||||
<span class="license-lifetime">{{ __('Lifetime') }}</span>
|
||||
{% endif %}
|
||||
<td class="wclp-editable-cell" data-field="status" data-license-id="{{ item.license.id }}">
|
||||
<span class="wclp-display-value">
|
||||
<span class="license-status license-status-{{ item.license.status }}">
|
||||
{{ item.license.status|capitalize }}
|
||||
</span>
|
||||
</span>
|
||||
<button type="button" class="wclp-edit-btn button-link" title="{{ __('Edit') }}">
|
||||
<span class="dashicons dashicons-edit"></span>
|
||||
</button>
|
||||
<div class="wclp-edit-form" style="display:none;">
|
||||
<select class="wclp-edit-input">
|
||||
<option value="active" {{ item.license.status == 'active' ? 'selected' : '' }}>{{ __('Active') }}</option>
|
||||
<option value="inactive" {{ item.license.status == 'inactive' ? 'selected' : '' }}>{{ __('Inactive') }}</option>
|
||||
<option value="expired" {{ item.license.status == 'expired' ? 'selected' : '' }}>{{ __('Expired') }}</option>
|
||||
<option value="revoked" {{ item.license.status == 'revoked' ? 'selected' : '' }}>{{ __('Revoked') }}</option>
|
||||
</select>
|
||||
<button type="button" class="wclp-save-btn button button-small button-primary">{{ __('Save') }}</button>
|
||||
<button type="button" class="wclp-cancel-btn button button-small">{{ __('Cancel') }}</button>
|
||||
</div>
|
||||
</td>
|
||||
<td class="wclp-editable-cell" data-field="expiry" data-license-id="{{ item.license.id }}">
|
||||
<span class="wclp-display-value">
|
||||
{% if item.license.expiresAt %}
|
||||
{{ item.license.expiresAt|date('Y-m-d') }}
|
||||
{% else %}
|
||||
<span class="license-lifetime">{{ __('Lifetime') }}</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
<button type="button" class="wclp-edit-btn button-link" title="{{ __('Edit') }}">
|
||||
<span class="dashicons dashicons-edit"></span>
|
||||
</button>
|
||||
<div class="wclp-edit-form" style="display:none;">
|
||||
<input type="date" class="wclp-edit-input" value="{{ item.license.expiresAt ? item.license.expiresAt|date('Y-m-d') : '' }}" placeholder="{{ __('Leave empty for lifetime') }}">
|
||||
<button type="button" class="wclp-save-btn button button-small button-primary">{{ __('Save') }}</button>
|
||||
<button type="button" class="wclp-cancel-btn button button-small">{{ __('Cancel') }}</button>
|
||||
<button type="button" class="wclp-lifetime-btn button button-small" title="{{ __('Set to lifetime') }}">∞</button>
|
||||
</div>
|
||||
</td>
|
||||
<td class="license-actions">
|
||||
<div class="row-actions">
|
||||
|
||||
Reference in New Issue
Block a user