{include file="sections/header.tpl"}
<div class="container-fluid">
    <form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
        <div class="row">
            <div class="col-xxl-12">
                <div class="col-md-12">
                    <div class="card">
                        <!-- General Settings Section -->
                        <div class="card-header">
                            <h5 class="card-title">{Lang::T('General Settings')}</h5>
                            <div class="btn-group pull-right">
                                <button class="btn btn-primary" title="save" type="submit">
                                    <span class="flaticon-381-save" aria-hidden="true"></span>
                                </button>
                            </div>
                        </div>
                        <div class="card-body">
                            <!-- Company Information -->
                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Application Name/Company Name')}</label>
                                <div class="col-md-6">
                                    <input type="text" required class="form-control" id="CompanyName" name="CompanyName" value="{$_c['CompanyName']}">
                                </div>
                                <span class="help-block col-md-4">{Lang::T('This Name will be shown on the Title')}</span>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Company Logo')}</label>
                                <div class="col-md-6">
                                    <input type="file" class="form-control" id="logo" name="logo" accept="image/*">
                                    <span class="help-block">For PDF Reports | Best size 1078 x 200 | uploaded image will be autosize</span>
                                </div>
                                <span class="help-block col-md-4">
                                    <a href="./{$logo}" target="_blank">
                                        <img src="./{$logo}" height="48" alt="logo for PDF">
                                    </a>
                                </span>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Company Footer')}</label>
                                <div class="col-md-6">
                                    <input type="text" required class="form-control" id="CompanyFooter" name="CompanyFooter" value="{$_c['CompanyFooter']}">
                                </div>
                                <span class="help-block col-md-4">{Lang::T('Will show below user pages')}</span>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Address')}</label>
                                <div class="col-md-6">
                                    <textarea class="form-control" id="address" name="address" rows="3">{Lang::htmlspecialchars($_c['address'])}</textarea>
                                </div>
                                <span class="help-block col-md-4">{Lang::T('You can use html tag')}</span>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Phone Number')}</label>
                                <div class="col-md-6">
                                    <input type="text" class="form-control" id="phone" name="phone" value="{$_c['phone']}">
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Hotspot Portal URL')}</label>
                                <div class="col-md-6">
                                    <input type="url" class="form-control" id="hotspot_url" name="hotspot_url" value="{$_c['hotspot_url']}" placeholder="https://portal.yourdomain.com">
                                </div>
                                <p class="help-block col-md-4">{Lang::T('URL for hotspot user portal (used in notifications)')}</p>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Invoice Footer')}</label>
                                <div class="col-md-6">
                                    <textarea class="form-control" id="note" name="note" rows="3">{Lang::htmlspecialchars($_c['note'])}</textarea>
                                    <span class="help-block">{Lang::T('You can use html tag')}</span>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">
                                    <i class="glyphicon glyphicon-print"></i> Print Max Char
                                </label>
                                <div class="col-md-6">
                                    <input type="number" required class="form-control" id="printer_cols" placeholder="37" name="printer_cols" value="{$_c['printer_cols']}">
                                </div>
                                <span class="help-block col-md-4">For invoice print using Thermal Printer</span>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">Theme</label>
                                <div class="col-md-6">
                                    <select name="theme" id="theme" class="form-select" style="height: 52px; background-color: white;">
                                        <option value="default" {if $_c['theme'] eq 'default'}selected="selected" {/if}>Default</option>
                                        {foreach $themes as $theme}
                                        <option value="{$theme}" {if $_c['theme'] eq $theme}selected="selected" {/if}>
                                            {Lang::ucWords($theme)}
                                        </option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">APP URL</label>
                                <div class="col-md-6">
                                    <input type="text" readonly class="form-control" value="{$app_url}">
                                </div>
                                <p class="help-block col-md-4">edit at config.php</p>
                            </div>
                        </div>
                    </div>

                    <hr>

                    <!-- Dashboard Content Settings -->
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title">Hide Dashboard Content</h5>
                            <div class="btn-group pull-right">
                                <button class="btn btn-primary" title="save" type="submit">
                                    <span class="flaticon-381-save" aria-hidden="true"></span>
                                </button>
                            </div>
                        </div>
                        <div class="card-body">
                            <div class="form-group row">
                                <div class="col-md-12">
                                    <div class="row">
                                        <div class="col-md-3">
                                            <label class="control-label">
                                                <input type="checkbox" name="hide_mrc" value="yes" {if $_c['hide_mrc'] eq 'yes'}checked{/if}>
                                                {Lang::T('Monthly Registered Customers')}
                                            </label>
                                        </div>
                                        <div class="col-md-3">
                                            <label class="control-label">
                                                <input type="checkbox" name="hide_tms" value="yes" {if $_c['hide_tms'] eq 'yes'}checked{/if}>
                                                {Lang::T('Total Monthly Sales')}
                                            </label>
                                        </div>
                                        <div class="col-md-3">
                                            <label class="control-label">
                                                <input type="checkbox" name="hide_aui" value="yes" {if $_c['hide_aui'] eq 'yes'}checked{/if}>
                                                {Lang::T('All Users Insights')}
                                            </label>
                                        </div>
                                        <div class="col-md-3">
                                            <label class="control-label">
                                                <input type="checkbox" name="hide_al" value="yes" {if $_c['hide_al'] eq 'yes'}checked{/if}>
                                                {Lang::T('Activity Log')}
                                            </label>
                                        </div>
                                    </div>
                                    <div class="row mt-2">
                                        <div class="col-md-3">
                                            <label class="control-label">
                                                <input type="checkbox" name="hide_uet" value="yes" {if $_c['hide_uet'] eq 'yes'}checked{/if}>
                                                {Lang::T('User Expired, Today')}
                                            </label>
                                        </div>
                                        <div class="col-md-3">
                                            <label class="control-label">
                                                <input type="checkbox" name="hide_vs" value="yes" {if $_c['hide_vs'] eq 'yes'}checked{/if}>
                                                Vouchers Stock
                                            </label>
                                        </div>
                                        <div class="col-md-3">
                                            <label class="control-label">
                                                <input type="checkbox" name="hide_pg" value="yes" {if $_c['hide_pg'] eq 'yes'}checked{/if}>
                                                Payment Gateway
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <hr>

                    <!-- Voucher Settings -->
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title">{Lang::T('Voucher')}</h5>
                            <div class="btn-group pull-right">
                                <button class="btn btn-primary" title="save" type="submit">
                                    <span class="flaticon-381-save" aria-hidden="true"></span>
                                </button>
                            </div>
                        </div>
                        <div class="card-body">
                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Disable Voucher')}</label>
                                <div class="col-md-6">
                                    <select name="disable_voucher" id="disable_voucher" class="form-select" style="height: 52px; background-color: white;">
                                        <option value="no" {if $_c['disable_voucher']=='no'}selected="selected" {/if}>No</option>
                                        <option value="yes" {if $_c['disable_voucher']=='yes'}selected="selected" {/if}>Yes</option>
                                    </select>
                                </div>
                                <p class="help-block col-md-4">{Lang::T('Voucher activation menu will be hidden')}</p>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Voucher Format')}</label>
                                <div class="col-md-6">
                                    <select name="voucher_format" id="voucher_format" class="form-select" style="height: 52px; background-color: white;">
                                        <option value="up" {if $_c['voucher_format']=='up'}selected="selected" {/if}>UPPERCASE</option>
                                        <option value="low" {if $_c['voucher_format']=='low'}selected="selected" {/if}>lowercase</option>
                                        <option value="rand" {if $_c['voucher_format']=='rand'}selected="selected" {/if}>RaNdoM</option>
                                    </select>
                                </div>
                                <p class="help-block col-md-4">UPPERCASE lowercase RaNdoM</p>
                            </div>

                            {if $_c['disable_voucher'] != 'yes'}
                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Disable Registration')}</label>
                                <div class="col-md-6">
                                    <select name="disable_registration" id="disable_registration" class="form-select" style="height: 52px; background-color: white;">
                                        <option value="no" {if $_c['disable_registration']=='no'}selected="selected" {/if}>No</option>
                                        <option value="yes" {if $_c['disable_registration']=='yes'}selected="selected" {/if}>Yes</option>
                                    </select>
                                </div>
                                <p class="help-block col-md-4">
                                    {Lang::T('Customer just Login with Phone number and Voucher Code, Voucher will be password')}
                                </p>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">Redirect after Activation</label>
                                <div class="col-md-6">
                                    <input type="text" class="form-control" id="voucher_redirect" name="voucher_redirect" placeholder="https://192.168.88.1/status" value="{$voucher_redirect}">
                                </div>
                                <p class="help-block col-md-4">
                                    {Lang::T('After Customer activate voucher or login, customer will be redirected to this url')}
                                </p>
                            </div>
                            {/if}
                        </div>
                    </div>

                    <hr>

                    <!-- FreeRadius Settings -->
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title">{Lang::T('FreeRadius')}</h5>
                            <div class="btn-group pull-right">
                                <button class="btn btn-primary" title="save" type="submit">
                                    <span class="flaticon-381-save" aria-hidden="true"></span>
                                </button>
                            </div>
                        </div>
                        <div class="card-body">
                            <div class="form-group row">
                                <label class="col-md-2 control-label">Enable Radius</label>
                                <div class="col-md-6">
                                    <select name="radius_enable" id="radius_enable" class="form-select" style="height: 52px; background-color: white;">
                                        <option value="0">No</option>
                                        <option value="1" {if $_c['radius_enable']}selected="selected" {/if}>Yes</option>
                                    </select>
                                </div>
                                <p class="help-block col-md-4">
                                    <a href="https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius" target="_blank">
                                        You can find Free Radius Setup & Configuration Instructions here.
                                    </a>
                                </p>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">Radius Client</label>
                                <div class="col-md-6">
                                    <input type="text" class="form-control" name="radius_client" value="{$_c['radius_client']}">
                                </div>
                            </div>
                        </div>
                    </div>

                    <hr>

                    <!-- Balance System Settings -->
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title">{Lang::T('Balance System')}</h5>
                            <div class="btn-group pull-right">
                                <button class="btn btn-primary" title="save" type="submit">
                                    <span class="flaticon-381-save" aria-hidden="true"></span>
                                </button>
                            </div>
                        </div>
                        <div class="card-body">
                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Enable System')}</label>
                                <div class="col-md-6">
                                    <select name="enable_balance" id="enable_balance" class="form-select" style="height: 52px; background-color: white;">
                                        <option value="no" {if $_c['enable_balance']=='no'}selected="selected" {/if}>No</option>
                                        <option value="yes" {if $_c['enable_balance']=='yes'}selected="selected" {/if}>Yes</option>
                                    </select>
                                </div>
                                <p class="help-block col-md-4">{Lang::T('Customer can deposit money to buy voucher')}</p>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Allow Transfer')}</label>
                                <div class="col-md-6">
                                    <select name="allow_balance_transfer" id="allow_balance_transfer" class="form-select" style="height: 52px; background-color: white;">
                                        <option value="no" {if $_c['allow_balance_transfer']=='no'}selected="selected" {/if}>No</option>
                                        <option value="yes" {if $_c['allow_balance_transfer']=='yes'}selected="selected" {/if}>Yes</option>
                                    </select>
                                </div>
                                <p class="help-block col-md-4">{Lang::T('Allow balance transfer between customers')}</p>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Minimum Balance Transfer')}</label>
                                <div class="col-md-6">
                                    <input type="number" class="form-control" id="minimum_transfer" name="minimum_transfer" value="{$_c['minimum_transfer']}">
                                </div>
                            </div>
                        </div>
                    </div>

                    <hr>

                    <!-- Notification Settings -->
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title">{Lang::T('Notification Settings')}</h5>
                            <div class="btn-group pull-right">
                                <button class="btn btn-primary" title="save" type="submit">
                                    <span class="flaticon-381-save" aria-hidden="true"></span>
                                </button>
                            </div>
                        </div>
                        <div class="card-body">
                            <!-- Telegram Notification -->
                            <div class="card mb-3">
                                <div class="card-header">
                                    <h6 class="card-title">{Lang::T('Telegram Notification')}</h6>
                                    <div class="btn-group pull-right">
                                        <a class="btn btn-success btn-xs" href="javascript:testTg()">Test TG</a>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Telegram Bot Token</label>
                                        <div class="col-md-6">
                                            <input type="password" class="form-control" id="telegram_bot" name="telegram_bot" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'" value="{$_c['telegram_bot']}" placeholder="123456:asdasgdkuasghddlashdashldhalskdklasd">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Telegram User/Channel/Group ID</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="telegram_target_id" name="telegram_target_id" value="{$_c['telegram_target_id']}" placeholder="12345678">
                                        </div>
                                        <small class="form-text text-muted help-block col-md-4">You will get Payment and Error notification on you telegram</small>
                                    </div>
                                </div>
                            </div>

                            <!-- SMS Notification -->
                            <div class="card mb-3">
                                <div class="card-header">
                                    <h6 class="card-title">{Lang::T('SMS OTP Registration')}</h6>
                                    <div class="btn-group pull-right">
                                        <a class="btn btn-success" href="javascript:testSms()">Test SMS</a>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">SMS Server URL</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="sms_url" name="sms_url" value="{$_c['sms_url']}" placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
                                        </div>
                                        <p class="help-block col-md-4">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.</p>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Or use Mikrotik SMS</label>
                                        <div class="col-md-6">
                                            <select class="form-control" onchange="document.getElementById('sms_url').value = this.value">
                                                <option value="">Select Router</option>
                                                {foreach $r as $rs}
                                                <option value="{$rs['name']}" {if $rs['name']==$_c['sms_url']}selected{/if}>
                                                    {$rs['name']}
                                                </option>
                                                {/foreach}
                                            </select>
                                        </div>
                                        <p class="help-block col-md-4">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.</p>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Test Message Template</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="test_message_sms" name="test_message_sms" value="{$_c['test_message_sms']}" placeholder="Hello this is a test SMS Courtesy of Smart-tech">
                                        </div>
                                        <p class="help-block col-md-4">Customize the test message sent when testing SMS notifications</p>
                                    </div>
                                </div>
                            </div>

                            <!-- WhatsApp Notification -->
                            <div class="card mb-3">
                                <div class="card-header">
                                    <h6 class="card-title">{Lang::T('Whatsapp Notification')}</h6>
                                    <div class="btn-group pull-right">
                                        <a class="btn btn-success" href="javascript:testWa()">Test WA</a>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Whatsapp Server URL</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="wa_url" name="wa_url" value="{$_c['wa_url']}" placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
                                        </div>
                                        <p class="help-block col-md-4">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.</p>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Test Message Template</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="test_message_wa" name="test_message_wa" value="{$_c['test_message_wa']}" placeholder="Hello this is a test Whatsapp Courtesy of Smart-tech">
                                        </div>
                                        <p class="help-block col-md-4">Customize the test message sent when testing WhatsApp notifications</p>
                                    </div>
                                </div>
                            </div>

                            <!-- Email Notification -->
                            <div class="card mb-3">
                                <div class="card-header">
                                    <h6 class="card-title">{Lang::T('Email Notification')}</h6>
                                    <div class="btn-group pull-right">
                                        <a class="btn btn-success" href="javascript:testEmail()">Test Email</a>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">SMTP Host : port</label>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" id="smtp_host" name="smtp_host" value="{$_c['smtp_host']}" placeholder="smtp.host.tld">
                                        </div>
                                        <div class="col-md-2">
                                            <input type="number" class="form-control" id="smtp_port" name="smtp_port" value="{$_c['smtp_port']}" placeholder="465 587 port">
                                        </div>
                                        <p class="help-block col-md-4">Empty this to use internal mail() PHP</p>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">SMTP username</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="smtp_user" name="smtp_user" value="{$_c['smtp_user']}" placeholder="user@host.tld">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">SMTP Password</label>
                                        <div class="col-md-6">
                                            <input type="password" class="form-control" id="smtp_pass" name="smtp_pass" value="{$_c['smtp_pass']}" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">SMTP Security</label>
                                        <div class="col-md-6">
                                            <select name="smtp_ssltls" id="smtp_ssltls" class="form-select" style="height: 52px; background-color: white;">
                                                <option value="" {if $_c['smtp_ssltls']==''}selected="selected" {/if}>Not Secure</option>
                                                <option value="ssl" {if $_c['smtp_ssltls']=='ssl'}selected="selected" {/if}>SSL</option>
                                                <option value="tls" {if $_c['smtp_ssltls']=='tls'}selected="selected" {/if}>TLS</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Mail From</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="mail_from" name="mail_from" value="{$_c['mail_from']}" placeholder="noreply@host.tld">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Mail Reply To</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="mail_reply_to" name="mail_reply_to" value="{$_c['mail_reply_to']}" placeholder="support@host.tld">
                                        </div>
                                        <p class="help-block col-md-4">Customer will reply email to this address, empty if you want to use From Address</p>
                                    </div>
                                </div>
                            </div>

                            <!-- User Notification Settings -->
                            <div class="card">
                                <div class="card-header">
                                    <h6 class="card-title">{Lang::T('User Notification')}</h6>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">{Lang::T('Expired Notification')}</label>
                                        <div class="col-md-6">
                                            <select name="user_notification_expired" id="user_notification_expired" class="form-select" style="height: 52px; background-color: white;">
                                                <option value="none">None</option>
                                                <option value="wa" {if $_c['user_notification_expired']=='wa'}selected="selected" {/if}>Whatsapp</option>
                                                <option value="sms" {if $_c['user_notification_expired']=='sms'}selected="selected" {/if}>SMS</option>
                                            </select>
                                        </div>
                                        <p class="help-block col-md-4">{Lang::T('User will get notification when package expired')}</p>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">{Lang::T('Payment Notification')}</label>
                                        <div class="col-md-6">
                                            <select name="user_notification_payment" id="user_notification_payment" class="form-select" style="height: 52px; background-color: white;">
                                                <option value="none">None</option>
                                                <option value="wa" {if $_c['user_notification_payment']=='wa'}selected="selected" {/if}>Whatsapp</option>
                                                <option value="sms" {if $_c['user_notification_payment']=='sms'}selected="selected" {/if}>SMS</option>
                                            </select>
                                        </div>
                                        <p class="help-block col-md-4">
                                            {Lang::T('User will get invoice notification when buy package or package refilled, and welcome notification when account is created')}
                                        </p>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">{Lang::T('Reminder Notification')}</label>
                                        <div class="col-md-6">
                                            <select name="user_notification_reminder" id="user_notification_reminder" class="form-select" style="height: 52px; background-color: white;">
                                                <option value="none">None</option>
                                                <option value="wa" {if $_c['user_notification_reminder']=='wa'}selected="selected" {/if}>Whatsapp</option>
                                                <option value="sms" {if $_c['user_notification_reminder']=='sms'}selected="selected" {/if}>SMS</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <hr>

                    <!-- Additional Settings -->
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title">{Lang::T('Additional Settings')}</h5>
                            <div class="btn-group pull-right">
                                <button class="btn btn-primary" title="save" type="submit">
                                    <span class="flaticon-381-save" aria-hidden="true"></span>
                                </button>
                            </div>
                        </div>
                        <div class="card-body">
                            <!-- Tawk.to Chat Widget -->
                            <div class="card mb-3">
                                <div class="card-header">
                                    <h6 class="card-title">{Lang::T('Tawk.to Chat Widget')}</h6>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">https://tawk.to/chat/</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="tawkto" name="tawkto" value="{$_c['tawkto']}" placeholder="62f1ca7037898912e961f5/1ga07df">
                                        </div>
                                        <p class="help-block col-md-4">For Direct Chat Link with client from their Dashboard</p>
                                    </div>
                                    <div class="col-md-12">
                                        <div class="card kanbanPreview-bx">
                                            <div class="card-body">
                                                <div class="sub-card">
                                                    <span class="text-warning sub-title fs-14">Copy and paste in Terminal</span>
                                                    <p class="font-w500">
                                                        <code>/ip hotspot walled-garden add dst-host=tawk.to add dst-host=*.tawk.to</code>
                                                    </p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <!-- API Key -->
                            <div class="card mb-3">
                                <div class="card-header">
                                    <h6 class="card-title">Generate Your API Key</h6>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">Access Token</label>
                                        <div class="col-md-6">
                                            <input type="password" class="form-control" id="api_key" name="api_key" value="{$_c['api_key']}" placeholder="Empty this to randomly created API key" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
                                        </div>
                                        <p class="col-md-4 help-block">{Lang::T('This Token will act as SuperAdmin/Admin.')}</p>
                                        <p class="col-md-12 help-block">Empty this to randomly created API key that you can use to link this application to other services</p>
                                    </div>
                                </div>
                            </div>

                            <!-- Proxy Settings -->
                            <div class="card mb-3">
                                <div class="card-header">
                                    <h6 class="card-title">{Lang::T('Proxy')}</h6>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">{Lang::T('Proxy Server')}</label>
                                        <div class="col-md-6">
                                            <input type="text" class="form-control" id="http_proxy" name="http_proxy" value="{$_c['http_proxy']}" placeholder="127.0.0.1:3128">
                                        </div>
                                        <p class="col-md-4 help-block">Enter Your Proxy Server IP Address or DNS IP or URl</p>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">{Lang::T('Proxy Server Login')}</label>
                                        <div class="col-md-6">
                                            <input type="password" class="form-control" id="http_proxyauth" name="http_proxyauth" autocomplete="off" value="{$_c['http_proxyauth']}" placeholder="username:password" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
                                        </div>
                                        <p class="col-md-4 help-block">Enter Your Proxy Server Login Password</p>
                                    </div>
                                </div>
                            </div>

                            <!-- Miscellaneous Settings -->
                            <div class="card">
                                <div class="card-header">
                                    <h6 class="card-title">{Lang::T('Miscellaneous')}</h6>
                                </div>
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">{Lang::T('OTP Required')}</label>
                                        <div class="col-md-6">
                                            <select name="allow_phone_otp" id="allow_phone_otp" class="form-select" style="height: 52px; background-color: white;">
                                                <option value="no" {if $_c['allow_phone_otp']=='no'}selected="selected" {/if}>No</option>
                                                <option value="yes" {if $_c['allow_phone_otp']=='yes'}selected="selected" {/if}>Yes</option>
                                            </select>
                                        </div>
                                        <p class="help-block col-md-4">{Lang::T('OTP is required when user want to change phone number')}</p>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-md-2 control-label">{Lang::T('OTP Method')}</label>
                                        <div class="col-md-6">
                                            <select name="phone_otp_type" id="phone_otp_type" class="form-select" style="height: 52px; background-color: white;">
                                                <option value="sms" {if $_c['phone_otp_type']=='sms'}selected="selected" {/if}>{Lang::T('SMS')}</option>
                                                <option value="whatsapp" {if $_c['phone_otp_type']=='whatsapp'}selected="selected" {/if}>{Lang::T('WhatsApp')}</option>
                                                <option value="both" {if $_c['phone_otp_type']=='both'}selected="selected" {/if}>{Lang::T('SMS and WhatsApp')}</option>
                                            </select>
                                        </div>
                                        <p class="help-block col-md-4">{Lang::T('The method which OTP will be sent to user')}</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Save Button -->
                    <div class="card">
                        <div class="card-body">
                            <div class="form-group">
                                <button class="btn btn-success btn-block" type="submit">{Lang::T('Save Changes')}</button>
                            </div>
                        </div>
                    </div>

                    <!-- System Information -->
                    <div class="card">
                        <div class="card-body">
                            <div class="card kanbanPreview-bx">
                                <div class="card-body">
                                    <div class="sub-card">
                                        <span class="text-warning sub-title fs-14">Copy and paste in Terminal</span>
                                        <code>/ip hotspot walled-garden add dst-host={$_domain} add dst-host=*.{$_domain}</code>
                                    </div>
                                </div>
                            </div>
                            <div class="card kanbanPreview-bx">
                                <div class="card-body">
                                    <div class="sub-card">
                                        <span class="text-warning sub-title fs-14">Cron Jobs</span>
                                        <p># Expired Cronjob Every 5 Minutes</p>
                                        <pre>*/5 * * * * cd {$dir} && {$php} cron.php</pre>
                                        <p># Expired Cronjob Every 1 Hour</p>
                                        <pre>0 * * * * cd {$dir} && {$php} cron.php</pre>
                                        <p># Reminder Cronjob Every 7 AM</p>
                                        <pre>0 7 * * * cd {$dir} && {$php} cron_reminder.php</pre>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>

    <!-- JavaScript Functions -->
    <script>
        function testWa() {
            var target = prompt("Phone number\nSave First before Test", "");
            if (target != null) {
                window.location.href = '{$_url}settings/app&testWa=' + target;
            }
        }

        function testSms() {
            var target = prompt("Phone number\nSave First before Test", "");
            if (target != null) {
                window.location.href = '{$_url}settings/app&testSms=' + target;
            }
        }

        function testEmail() {
            var target = prompt("Email\nSave First before Test", "");
            if (target != null) {
                window.location.href = '{$_url}settings/app&testEmail=' + target;
            }
        }

        function testTg() {
            window.location.href = '{$_url}settings/app&testTg=test';
        }
    </script>
</div>
{include file="sections/footer.tpl"}