Add comprehensive voicemail integration to browser phone

- Add AJAX endpoint for fetching user voicemails with stats and recent list
- Create voicemail display section with counts, transcriptions, and playback
- Implement click-to-play functionality for voicemail audio
- Add refresh and view-all buttons with admin page integration
- Style voicemail section with consistent design and dark mode support
- Include visual indicators for recordings and formatted durations
- Add mobile responsive design and hover effects

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-15 09:29:35 -07:00
parent d63eec129a
commit f26cb24dfd
5 changed files with 380 additions and 4 deletions

View File

@@ -72,6 +72,7 @@ class TWP_Shortcodes {
// Localize script with AJAX data
wp_localize_script('twp-browser-phone-frontend', 'twp_frontend_ajax', array(
'ajax_url' => admin_url('admin-ajax.php'),
'admin_url' => admin_url(),
'nonce' => wp_create_nonce('twp_frontend_nonce'),
'user_id' => get_current_user_id(),
'is_logged_in' => is_user_logged_in()
@@ -200,6 +201,34 @@ class TWP_Shortcodes {
</div>
</div>
<!-- Voicemail Section -->
<div class="twp-voicemail-section" id="twp-voicemail-section">
<h4>Recent Voicemails</h4>
<div class="voicemail-stats">
<div class="stat-item">
<span class="stat-label">Total:</span>
<span class="stat-value" id="twp-total-voicemails">0</span>
</div>
<div class="stat-item">
<span class="stat-label">Today:</span>
<span class="stat-value" id="twp-today-voicemails">0</span>
</div>
</div>
<div class="twp-voicemail-list" id="twp-voicemail-list">
<div class="voicemail-loading">Loading voicemails...</div>
</div>
<div class="voicemail-actions">
<button id="twp-refresh-voicemails" class="twp-btn twp-btn-secondary">
Refresh
</button>
<button id="twp-view-all-voicemails" class="twp-btn twp-btn-secondary">
View All
</button>
</div>
</div>
<!-- Audio elements for incoming calls handled by browser -->
<audio id="twp-ringtone" style="display: none;"></audio>