{** * WhatsApp Bot - Merged Overview Template * Path: /modules/servers/whatsappbot/templates/overview.tpl * Merged version with Settings and Knowledge Base tabs integrated * Uses AJAX for saving to save_settings.php and save_knowledge.php *}
{* Suspended State *} {if $tenant.status eq 'suspended'} {else} {* Main Navigation Tabs *}
{* Tab Content *}
{* ==================== OVERVIEW TAB ==================== *}
{* Connection Status Banner *}
{if $session.status == 'connected'}
{elseif $session.status == 'disconnected'} {else}
{/if}

{if $session.status == 'connected'} WhatsApp Connected {elseif $session.status == 'disconnected'} WhatsApp Disconnected {else} Connecting... {/if}

{if $session.status == 'connected'} Your bot is online and responding to messages on {$tenant.whatsapp_number} {if $session.last_connected} Connected since: {$session.last_connected|date_format:"%Y-%m-%d %H:%M"} {/if} {elseif $session.status == 'disconnected'} Your bot is offline. Scan the QR code below to reconnect. {else} Please wait while we establish your WhatsApp connection... {/if}

{if $session.status == 'disconnected'}
{/if}
{* QR Code Section *} {if $session.status neq 'connected' && $tenant.status neq 'suspended'}
Loading...
Generating QR Code...

Please wait while we prepare your connection

{/if} {* Statistics Dashboard *}

{$stats.messages_sent|number_format|default:"0"}

Messages Sent

{$stats.messages_sent_change|abs}% vs last month

{$stats.messages_received|number_format|default:"0"}

Messages Received

{$stats.messages_received_change|abs}% vs last month

{$stats.ai_queries|number_format|default:"0"}

AI Queries

{$tenant.config.ai_model|default:"GPT-4"}

{$stats.voice_messages|number_format|default:"0"}

Voice Messages

{$stats.voice_minutes|number_format:1|default:"0"} mins processed
{* Main Content Grid *}
{* Usage Chart *}
Message Activity Last 30 Days
{* Recent Conversations *} {if $stats.recent_conversations}
Recent Conversations
View All
{foreach from=$stats.recent_conversations item=conv} {/foreach}
Customer Last Message Msgs Action
{$conv.customer_name|substr:0:1|upper|default:"?"}
{$conv.customer_name|default:"Unknown"}
{$conv.customer_phone}
{$conv.last_message|truncate:40}
{$conv.last_message_time|date_format:"%H:%M"}
{$conv.message_count} View
{/if}
{* Plan Information *}
Plan Details
{$tenant.plan|capitalize|default:"Basic"} {if $tenant.status eq 'active'} Active {else} {$tenant.status|capitalize} {/if}
  • {$plan_limits.messages_per_month|number_format|default:"Unlimited"} messages/month
  • AI Assistant
  • Knowledge Base
  • Voice Output
Usage This Month {$stats.usage_percentage|default:"0"}%
{$stats.total_messages|number_format|default:"0"} of {$plan_limits.messages_per_month|number_format} used {if $stats.usage_percentage > 80}
Approaching limit! Upgrade
{/if}
{* Quick Actions *}
Quick Actions
Conversations
Logs
Support
{* ==================== SETTINGS TAB ==================== *}

Bot Configuration

Control how your AI responds to customers

{* AI Settings Section *}
Artificial Intelligence
Select the AI engine for generating responses. All models run on our secure servers.
Precise (0.0) Creative (1.0)
Tip: Define your bot's personality and instructions clearly.
{* Feature Controls Section *}
Feature Controls
{* Auto-Reply Messages Section *}
Automated Messages
Leave empty to skip welcome message
Used when AI doesn't know the answer
{* Action Buttons *}
{* ==================== KNOWLEDGE BASE TAB ==================== *}

Knowledge Base {if $knowledge_count} {$knowledge_count} entries {/if}

Train your bot with business-specific information

How Knowledge Base Works

When a customer asks a question, the bot checks these entries first.

If a match is found, it uses your exact answer instead of generating an AI response.

{* Search Box *}
{* Knowledge Entries *}
{if $knowledge_items}
{foreach from=$knowledge_items item=item} {/foreach}
Keywords / Question Answer Actions
{$item.keyword}
{if strlen($item.answer) > 120} {$item.answer|truncate:120:"..."} {else} {$item.answer} {/if}
{else}

No Knowledge Entries Yet

Start training your bot with business-specific information.
Add answers to frequently asked questions.

Business Hours
Keywords: hours, time, open
Answer: We're open Mon-Fri 9am-5pm
Pricing
Keywords: price, cost, how much
Answer: Our basic plan starts at $99/mo
Location
Keywords: location, address, where
Answer: We're located at 123 Main St
{/if}
{/if}
{* ==================== MODALS ==================== *} {* QR Code Modal *} {if $session.status == 'disconnected'} {/if} {* Add Knowledge Modal *} {* Edit Knowledge Modal *} {* View Knowledge Modal *} {* ==================== SCRIPTS ==================== *}