{include file="sections/header.tpl"}
<style>
    .panel-title {
        font-weight: bolder;
        font-size: large;
    }
    
    /* Direct fix for collapsed panels */
    .panel-collapse {
        display: block !important;
        height: auto !important;
        visibility: visible !important;
    }
    
    /* Make each section more distinguishable */
    .panel {
        margin-bottom: 25px;
        border: 1px solid #e7e7e7;
    }
    
    .panel-heading {
        background-color: #f8f8f8 !important;
        cursor: pointer;
    }
    
    .panel-heading:hover {
        background-color: #f0f0f0 !important;
    }
    
    .panel-body {
        padding: 15px;
        display: block !important;
    }
</style>
<script>
    // Immediately executed function to fix panels
    (function() {
        document.addEventListener('DOMContentLoaded', function() {
            // Convert all collapsible panels to visible panels
            var allPanels = document.querySelectorAll('.panel-collapse');
            for(var i = 0; i < allPanels.length; i++) {
                allPanels[i].classList.remove('collapse');
                allPanels[i].classList.remove('panel-collapse');
                allPanels[i].classList.add('panel-body-visible');
                allPanels[i].style.display = 'block';
                allPanels[i].style.height = 'auto';
                allPanels[i].style.visibility = 'visible';
            }
            
            // Replace any existing refresh buttons with our compact style
            setTimeout(function() {
                var refreshButtons = document.querySelectorAll('button[style*="position: fixed"]');
                for(var i = 0; i < refreshButtons.length; i++) {
                    var btn = refreshButtons[i];
                    btn.className = 'compact-refresh-btn';
                    btn.textContent = 'Refresh';
                }
            }, 500);
        });
    })();
</script>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel" id="accordion" role="tablist" aria-multiselectable="true">
        <div class="panel-heading" role="tab" id="General">
            <h3 class="panel-title">
                <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseGeneral"
                    aria-expanded="true" aria-controls="collapseGeneral">
                    {Lang::T('General')}
                </a>
            </h3>
        </div>
        <div id="collapseGeneral" class="panel-body-visible" role="tabpanel" aria-labelledby="General">
            <div class="panel-body">
                <div class="form-group">
                    <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">
                    <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">{Lang::T('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">
                    <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">
                    <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">
                    <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">
                    <label class="col-md-2 control-label">{Lang::T('Email')}</label>
                    <div class="col-md-6">
                        <input type="email" class="form-control" id="company_email" name="company_email" value="{$_c['company_email']}">
                    </div>
                    <span class="help-block col-md-4">{Lang::T('Company Email Address')}</span>
                </div>
                <div class="form-group">
                    <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">
                    <label class="col-md-2 control-label"><i class="glyphicon glyphicon-print"></i>
                        {Lang::T('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">{Lang::T('For invoice print using Thermal
                        Printer')}</span>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Theme')}</label>
                    <div class="col-md-6">
                        <select name="theme" id="theme" class="form-control">
                            <option value="default" {if $_c['theme'] eq 'default' }selected="selected" {/if}>
                                {Lang::T('Default')}
                            </option>
                            {foreach $themes as $theme}
                                <option value="{$theme}" {if $_c['theme'] eq $theme}selected="selected" {/if}>
                                    {Lang::ucWords($theme)}</option>
                            {/foreach}
                        </select>
                    </div>
                    <p class="help-block col-md-4"><a href="https://github.com/hotspotbilling/phpnuxbill/wiki/Themes"
                            target="_blank">{Lang::T('Theme Info')}</a></p>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Theme Settings')}</label>
                    <div class="col-md-6">
                        <div class="theme-settings">
                            <div class="setting-item">
                                <label>{Lang::T('Select Theme')}</label>
                                <select class="form-control" id="theme-selector" name="selected_theme">
                                    <option value="default">{Lang::T('Default Theme')}</option>
                                    <option value="modern-light">{Lang::T('Modern Light')}</option>
                                    <option value="modern-dark">{Lang::T('Modern Dark')}</option>
                                </select>
                            </div>
                            <div class="setting-item">
                                <label>{Lang::T('Font Family')}</label>
                                <select class="form-control" id="font-selector" name="selected_font">
                                    <option value="Roboto">Roboto</option>
                                    <option value="Open Sans">Open Sans</option>
                                    <option value="Nunito">Nunito</option>
                                    <option value="Poppins">Poppins</option>
                                </select>
                            </div>
                            <div class="setting-item">
                                <label>{Lang::T('Text Size')}</label>
                                <select class="form-control" id="size-selector" name="text_size">
                                    <option value="compact">{Lang::T('Compact')}</option>
                                    <option value="normal">{Lang::T('Normal')}</option>
                                    <option value="comfortable">{Lang::T('Comfortable')}</option>
                                </select>
                            </div>
                            <div class="setting-item colors-section" id="theme-colors" style="display: none;">
                                <label>{Lang::T('Theme Colors')}</label>
                                <div class="color-pickers">
                                    <div class="color-picker">
                                        <label>{Lang::T('Primary Color')}</label>
                                        <input type="color" name="primary_color" class="form-control">
                                    </div>
                                    <div class="color-picker">
                                        <label>{Lang::T('Secondary Color')}</label>
                                        <input type="color" name="secondary_color" class="form-control">
                                    </div>
                                    <div class="color-picker">
                                        <label>{Lang::T('Success Color')}</label>
                                        <input type="color" name="success_color" class="form-control">
                                    </div>
                                    <div class="color-picker">
                                        <label>{Lang::T('Info Color')}</label>
                                        <input type="color" name="info_color" class="form-control">
                                    </div>
                                    <div class="color-picker">
                                        <label>{Lang::T('Warning Color')}</label>
                                        <input type="color" name="warning_color" class="form-control">
                                    </div>
                                    <div class="color-picker">
                                        <label>{Lang::T('Danger Color')}</label>
                                        <input type="color" name="danger_color" class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <span class="help-block col-md-4">{Lang::T('Customize the appearance of your application')}</span>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Recharge Using')}</label>
                    <div class="col-md-6">
                        <input type="text" name="payment_usings" class="form-control" value="{$_c['payment_usings']}"
                            placeholder="{Lang::T('Cash')}, {Lang::T('Bank Transfer')}">
                    </div>
                    <p class="help-block col-md-4">
                        {Lang::T('This used for admin to select payment in recharge, using comma for every new options')}
                    </p>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Income reset date')}</label>
                    <div class="col-md-6">
                        <input type="number" required class="form-control" id="reset_day" placeholder="20" min="1"
                            max="28" step="1" name="reset_day" value="{$_c['reset_day']}">
                    </div>
                    <span class="help-block col-md-4">{Lang::T('Income will reset every this
                        day')}</span>
                </div>
                <button class="btn btn-success btn-block" name="general" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>

        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="HideDashboardContent">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseHideDashboardContent" aria-expanded="false"
                    aria-controls="collapseHideDashboardContent">
                    {Lang::T('Hide Dashboard Content')}
                </a>
            </h4>
        </div>
        <div id="collapseHideDashboardContent" class="panel-body-visible" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-3 control-label"><input type="checkbox" name="hide_mrc" value="yes" {if
                            $_c['hide_mrc'] eq 'yes' }checked{/if}>
                        {Lang::T('Monthly Registered Customers')}</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_tms" value="yes" {if
                            $_c['hide_tms'] eq 'yes' }checked{/if}> {Lang::T('Total Monthly Sales')}</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_tws" value="yes" {if
                            $_c['hide_tws'] eq 'yes' }checked{/if}> {Lang::T('Total Weekly Sales')}</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_lt" value="yes" {if
                            $_c['hide_lt'] eq 'yes' }checked{/if}> {Lang::T('Last 5 Transactions')}</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_aui" value="yes" {if
                            $_c['hide_aui'] eq 'yes' }checked{/if}> {Lang::T('All Users Insights')}</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_al" value="yes" {if
                            $_c['hide_al'] eq 'yes' }checked{/if}> {Lang::T('Activity Log')}</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_uet" value="yes" {if
                            $_c['hide_uet'] eq 'yes' }checked{/if}> {Lang::T('User Expired, Today')}</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_vs" value="yes" {if
                            $_c['hide_vs'] eq 'yes' }checked{/if}> Vouchers Stock</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_pg" value="yes" {if
                            $_c['hide_pg'] eq 'yes' }checked{/if}> Payment Gateway</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_income_today" value="yes" {if
                            $_c['hide_income_today'] eq 'yes' }checked{/if}> 
                        <i class="fa fa-eye-slash text-muted"></i> {Lang::T('Hide Income Today')}</label>
                    <label class="col-md-2 control-label"><input type="checkbox" name="hide_income_month" value="yes" {if
                            $_c['hide_income_month'] eq 'yes' }checked{/if}> 
                        <i class="fa fa-eye-slash text-muted"></i> {Lang::T('Hide Income This Month')}</label>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">Support Tickets SMS</label>
                    <div class="col-md-9">
                        <label><input type="checkbox" name="ticket_sms_enabled" value="yes" {if
                                $_c['ticket_sms_enabled'] eq 'yes' }checked{/if}> Enable SMS notifications for support tickets</label>
                        <p class="help-block">When enabled, customers will receive SMS when tickets are created, replied to, closed, or reopened</p>
                    </div>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="Registration">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseRegistration" aria-expanded="false" aria-controls="collapseRegistration">
                    {Lang::T('Registration')}
                </a>
            </h4>
        </div>
        <div id="collapseRegistration" class="panel-body-visible" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Allow Registration')}</label>
                    <div class="col-md-6">
                        <select name="disable_registration" id="disable_registration" class="form-control">
                            <option value="no" {if $_c['disable_registration']=='no' }selected="selected" {/if}>
                                {Lang::T('Yes')}
                            </option>
                            {if $_c['disable_voucher'] != 'yes'}
                                <option value="yes" {if $_c['disable_registration']=='yes' }selected="selected" {/if}>
                                    {Lang::T('Voucher Only')}
                                </option>
                            {/if}
                            <option value="noreg" {if $_c['disable_registration']=='noreg' }selected="selected" {/if}>
                                {Lang::T('No Registration')}
                            </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">
                    <label class="col-md-2 control-label">{Lang::T('Registration Username')}</label>
                    <div class="col-md-6">
                        <select name="registration_username" id="voucher_format" class="form-control">
                            <option value="username" {if $_c['registration_username']=='username' }selected="selected"
                                {/if}>Username
                            </option>
                            <option value="email" {if $_c['registration_username']=='email' }selected="selected" {/if}>
                                Email
                            </option>
                            <option value="phone" {if $_c['registration_username']=='phone' }selected="selected" {/if}>
                                Phone Number
                            </option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('SMS OTP Registration')}</label>
                    <div class="col-md-6">
                        <select name="sms_otp_registration" id="sms_otp_registration" class="form-control">
                            <option value="no">
                                {Lang::T('No')}
                            </option>
                            <option value="yes" {if $_c['sms_otp_registration']=='yes' }selected="selected" {/if}>
                                {Lang::T('Yes')}
                            </option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">
                        {Lang::T('Customer Registration need to validate using OTP')}
                    </p>
                </div>
                <div class="form-group">
                    <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-control">
                            <option value="sms" {if $_c['phone_otp_type']=='sms' }selected="selected" {/if}>
                                {Lang::T('By SMS')}</option>
                            <option value="whatsapp" {if $_c['phone_otp_type']=='whatsapp' }selected="selected" {/if}>
                                {Lang::T('by WhatsApp')}</option>
                            <option value="both" {if $_c['phone_otp_type']=='both' }selected="selected" {/if}>
                                {Lang::T('By WhatsApp and SMS')}
                            </option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">{Lang::T('The method which OTP will be sent to user')}<br>
                        {Lang::T('For Registration and Update Phone Number')}</p>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>


<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="Security">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseSecurity" aria-expanded="false" aria-controls="collapseSecurity">
                    {Lang::T('Security')}
                </a>
            </h4>
        </div>
        <div id="collapseSecurity" class="panel-body-visible" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-3 control-label">{Lang::T('Enable Session Timeout')}</label>
                    <div class="col-md-5">
                        <label class="switch">
                            <input type="checkbox" id="enable_session_timeout" value="1"
                                name="enable_session_timeout" {if $_c['enable_session_timeout']==1}checked{/if}>
                            <span class="slider"></span>
                        </label>
                    </div>
                    <p class="help-block col-md-4">
                        {Lang::T('Logout Admin if not Available/Online a period of time')}</p>
                </div>
                <div class="form-group" id="timeout_duration_input" style="display: none;">
                    <label class="col-md-3 control-label">{Lang::T('Timeout Duration')}</label>
                    <div class="col-md-5">
                        <input type="number" value="{$_c['session_timeout_duration']}" class="form-control"
                            name="session_timeout_duration" id="session_timeout_duration"
                            placeholder="{Lang::T('Enter the session timeout duration (minutes)')}" min="1">
                    </div>
                    <p class="help-block col-md-4">{Lang::T('Idle Timeout, Logout Admin if Idle for xx
                            minutes')}
                    </p>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">{Lang::T('Single Admin Session')}</label>
                    <div class="col-md-5">
                        <select name="single_session" id="single_session" class="form-control">
                            <option value="no">
                                {Lang::T('No')}</option>
                            <option value="yes" {if $_c['single_session']=='yes' }selected="selected" {/if}>
                                {Lang::T('Yes')}
                            </option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">
                        {Lang::T('Admin can only have single session login, it will logout another session')}
                    </p>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label">{Lang::T('Enable CSRF Validation')}</label>
                    <div class="col-md-5">
                        <select name="csrf_enabled" id="csrf_enabled" class="form-control">
                            <option value="no">
                                {Lang::T('No')}</option>
                            <option value="yes" {if $_c['csrf_enabled']=='yes' }selected="selected" {/if}>
                                {Lang::T('Yes')}
                            </option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">
                        <a href="https://en.wikipedia.org/wiki/Cross-site_request_forgery" target="_blank">{Lang::T('Cross-site request forgery')}</a>
                    </p>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="Voucher">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseVoucher" aria-expanded="false" aria-controls="collapseVoucher">
                    Voucher
                </a>
            </h4>
        </div>
        <div id="collapseVoucher" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <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-control">
                            <option value="no" {if $_c['disable_voucher']=='no' }selected="selected" {/if}>
                                {Lang::T('No')}
                            </option>
                            <option value="yes" {if $_c['disable_voucher']=='yes' }selected="selected" {/if}>
                                {Lang::T('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">
                    <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-control">
                            <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>
                            <option value="numbers" {if $_c['voucher_format']=='numbers' }selected="selected" {/if}>
                                Numbers
                            </option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">UPPERCASE lowercase RaNdoM</p>
                </div>
                {if $_c['disable_voucher'] != 'yes'}
                    <div class="form-group">
                        <label class="col-md-2 control-label">{Lang::T('Redirect URL 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="{$_c['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}
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="FreeRadius">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseFreeRadius" aria-expanded="false" aria-controls="collapseFreeRadius">
                    FreeRadius
                </a>
            </h4>
        </div>
        <div id="collapseFreeRadius" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Enable Radius')}</label>
                    <div class="col-md-6">
                        <select name="radius_enable" id="radius_enable" class="form-control text-muted">
                            <option value="0">{Lang::T('No')}</option>
                            <option value="1" {if $_c['radius_enable']}selected="selected" {/if}>{Lang::T('Yes')}
                            </option>
                        </select>
                    </div>
                    <p class="help-block col-md-4"><a
                            href="https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius"
                            target="_blank">{Lang::T('Radius Instructions')}</a></p>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="ExtendPostpaidExpiration">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseExtendPostpaidExpiration" aria-expanded="false"
                    aria-controls="collapseExtendPostpaidExpiration">
                    {Lang::T('Extend Postpaid Expiration')}
                </a>
            </h4>
        </div>
        <div id="collapseExtendPostpaidExpiration" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Allow Extend')}</label>
                    <div class="col-md-6">
                        <select name="extend_expired" id="extend_expired" class="form-control text-muted">
                            <option value="0">{Lang::T('No')}</option>
                            <option value="1" {if $_c['extend_expired']==1}selected="selected" {/if}>
                                {Lang::T('Yes')}</option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">{Lang::T('Customer can request to extend expirations')}</p>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Extend Days')}</label>
                    <div class="col-md-6">
                        <input type="text" class="form-control" name="extend_days" placeholder="3"
                            value="{$_c['extend_days']}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Confirmation Message')}</label>
                    <div class="col-md-6">
                        <textarea type="text" rows="4" class="form-control" name="extend_confirmation"
                            placeholder="{Lang::T('i agree to extends and will paid full after this')}">{$_c['extend_confirmation']}</textarea>
                    </div>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="CustomerBalanceSystem">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseCustomerBalanceSystem" aria-expanded="false"
                    aria-controls="collapseCustomerBalanceSystem">
                    {Lang::T('Customer Balance System')}
                </a>
            </h4>
        </div>
        <div id="collapseCustomerBalanceSystem" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <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-control">
                            <option value="no" {if $_c['enable_balance']=='no' }selected="selected" {/if}>
                                {Lang::T('No')}
                            </option>
                            <option value="yes" {if $_c['enable_balance']=='yes' }selected="selected" {/if}>
                                {Lang::T('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">
                    <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-control">
                            <option value="no" {if $_c['allow_balance_transfer']=='no' }selected="selected" {/if}>
                                {Lang::T('No')}</option>
                            <option value="yes" {if $_c['allow_balance_transfer']=='yes' }selected="selected" {/if}>
                                {Lang::T('Yes')}</option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">{Lang::T('Allow balance transfer between customers')}</p>
                </div>
                <div class="form-group">
                    <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>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="TelegramNotification">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseTelegramNotification" aria-expanded="false"
                    aria-controls="collapseTelegramNotification">
                    {Lang::T('Telegram Notification')}
                    <div class="btn-group pull-right">
                        <a class="btn btn-success btn-xs" style="color: black;" href="javascript:testTg()">Test TG</a>
                    </div>
                </a>
            </h4>
        </div>
        <div id="collapseTelegramNotification" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('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">
                    <label class="col-md-2 control-label">{Lang::T('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>
                </div>
                <small id="emailHelp" class="form-text text-muted">
                    {Lang::T('You will get Payment and Error notification')}
                </small>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="SMSNotification">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseSMSNotification" aria-expanded="false" aria-controls="collapseSMSNotification">
                    {Lang::T('SMS Notification')}
                    <div class="btn-group pull-right">
                        <a class="btn btn-success btn-xs" style="color: black;" href="javascript:testSms()">
                            {Lang::T('Test SMS')}
                        </a>
                    </div>
                </a>
            </h4>
        </div>
        <div id="collapseSMSNotification" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('SMS Gateway')}</label>
                    <div class="col-md-6">
                        <select name="active_sms_gateway" id="active_sms_gateway" class="form-control">
                            <option value="blessed_texts" {if $_c['active_sms_gateway']=='blessed_texts'}selected="selected"{/if}>
                                Blessed Texts
                            </option>
                            <option value="talksasa" {if $_c['active_sms_gateway']=='talksasa'}selected="selected"{/if}>
                                Talk Sasa
                            </option>
                            <option value="bytewave" {if $_c['active_sms_gateway']=='bytewave'}selected="selected"{/if}>
                                BytewaveSMS
                            </option>
                            <option value="smsgate" {if $_c['active_sms_gateway']=='smsgate'}selected="selected"{/if}>
                                SmSGate
                            </option>
                            <option value="texin" {if $_c['active_sms_gateway']=='texin'}selected="selected"{/if}>
                                Texin SMS
                            </option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">{Lang::T('Select which SMS gateway to use')}</p>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('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">{Lang::T('Must include')} <b>[text]</b> &amp; <b>[number]</b>,
                        {Lang::T('it will be replaced.')}
                    </p>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Or use Mikrotik SMS')}</label>
                    <div class="col-md-6">
                        <select class="form-control" onchange="document.getElementById('sms_url').value = this.value">
                            <option value="">{Lang::T('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">{Lang::T('Must include')} <b>[text]</b> &amp; <b>[number]</b>,
                        {Lang::T('it will be replaced.')}
                    </p>
                </div>
                <small id="emailHelp" class="form-text text-muted">{Lang::T('You can use')} WhatsApp
                    {Lang::T('in here too.')} <a href="https://wa.nux.my.id/login" target="_blank">{Lang::T('Free
                        Server')}</a></small>

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

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="WhatsappNotification">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseWhatsappNotification" aria-expanded="false"
                    aria-controls="collapseWhatsappNotification">
                    {Lang::T('Whatsapp Notification')}
                    <div class="btn-group pull-right">
                        <a class="btn btn-success btn-xs" style="color: black;" href="javascript:testWa()">Test WA</a>
                    </div>
                </a>
            </h4>
        </div>
        <div id="collapseWhatsappNotification" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('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">{Lang::T('Must include')} <b>[text]</b> &amp; <b>[number]</b>,
                        {Lang::T('it will be replaced.')}</p>
                </div>
                <small id="emailHelp" class="form-text text-muted">{Lang::T('You can use')} WhatsApp
                    {Lang::T('in here too.')} <a href="https://wa.nux.my.id/login" target="_blank">{Lang::T('Free
                        Server')}</a></small>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="EmailNotification">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseEmailNotification" aria-expanded="false" aria-controls="collapseEmailNotification">
                    {Lang::T('Email Notification')}
                    <div class="btn-group pull-right">
                        <a class="btn btn-success btn-xs" style="color: black;" href="javascript:testEmail()">Test
                            Email</a>
                    </div>
                </a>
            </h4>
        </div>
        <div id="collapseEmailNotification" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <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">{Lang::T('Empty this to use internal mail() PHP')}</p>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('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">
                    <label class="col-md-2 control-label">{Lang::T('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">
                    <label class="col-md-2 control-label">{Lang::T('SMTP Security')}</label>
                    <div class="col-md-6">
                        <select name="smtp_ssltls" id="smtp_ssltls" class="form-control">
                            <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>
                    <p class="help-block col-md-4">UPPERCASE lowercase RaNdoM</p>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">Mail {Lang::T('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">
                    <label class="col-md-2 control-label">{Lang::T('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">
                        {Lang::T('Customer will reply email to this address, empty if you want to use From
                        Address')}
                    </p>
                </div>

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

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="UserNotification">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseUserNotification" aria-expanded="false" aria-controls="collapseUserNotification">
                    {Lang::T('User Notification')}
                </a>
            </h4>
        </div>
        <div id="collapseUserNotification" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Expired Notification')}</label>
                    <div class="col-md-6">
                        <select class="form-control" id="expired_notification" name="expired_notification">
                            <option value="none">{Lang::T('None')}</option>
                            <option value="sms" {if $_c['expired_notification']=='sms'}selected="selected"{/if}>{Lang::T('By SMS')}</option>
                            <option value="wa" {if $_c['expired_notification']=='wa'}selected="selected"{/if}>{Lang::T('By WhatsApp')}</option>
                            <option value="both" {if $_c['expired_notification']=='both'}selected="selected"{/if}>{Lang::T('By SMS & WhatsApp')}</option>
                        </select>
                    </div>
                    <span class="help-block col-md-4">{Lang::T('User will get notification when package expired')}</span>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Payment Notification')}</label>
                    <div class="col-md-6">
                        <select class="form-control" id="payment_notification" name="payment_notification">
                            <option value="none">{Lang::T('None')}</option>
                            <option value="sms" {if $_c['payment_notification']=='sms'}selected="selected"{/if}>{Lang::T('By SMS')}</option>
                            <option value="wa" {if $_c['payment_notification']=='wa'}selected="selected"{/if}>{Lang::T('By WhatsApp')}</option>
                            <option value="both" {if $_c['payment_notification']=='both'}selected="selected"{/if}>{Lang::T('By SMS & WhatsApp')}</option>
                        </select>
                    </div>
                    <span class="help-block col-md-4">{Lang::T('User will get invoice notification when buy package or package refilled')}</span>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Reminder Notification')}</label>
                    <div class="col-md-6">
                        <select class="form-control" id="reminder_notification" name="reminder_notification">
                            <option value="none">{Lang::T('None')}</option>
                            <option value="sms" {if $_c['reminder_notification']=='sms'}selected="selected"{/if}>{Lang::T('By SMS')}</option>
                            <option value="wa" {if $_c['reminder_notification']=='wa'}selected="selected"{/if}>{Lang::T('By WhatsApp')}</option>
                            <option value="both" {if $_c['reminder_notification']=='both'}selected="selected"{/if}>{Lang::T('By SMS & WhatsApp')}</option>
                        </select>
                    </div>
                    <span class="help-block col-md-4">{Lang::T('User will get reminder notification before package expires')}</span>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="TawkToChatWidget">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseTawkToChatWidget" aria-expanded="false" aria-controls="collapseTawkToChatWidget">
                    {Lang::T('Tawk.to Chat Widget')}
                </a>
            </h4>
        </div>
        <div id="collapseTawkToChatWidget" class="panel-collapse collapse" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <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>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">Tawk.to Javascript API key</label>
                    <div class="col-md-6">
                        <input type="text" class="form-control" id="tawkto_api_key" name="tawkto_api_key" value="{$_c['tawkto_api_key']}"
                            placeholder="39e52264cxxxxxxxxxxxxxdd078af5342e8">
                    </div>
                </div>
                <label class="col-md-2"></label>
                <p class="col-md-6 help-block">/ip hotspot walled-garden<br>
                    add dst-host=tawk.to<br>
                    add dst-host=*.tawk.to</p>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="APIKey">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseAPIKey" aria-expanded="false" aria-controls="collapseAPIKey">
                    API Key
                </a>
            </h4>
        </div>
        <div id="collapseAPIKey" class="panel-body-visible" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('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="{Lang::T('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>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="Proxy">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseProxy"
                    aria-expanded="false" aria-controls="collapseProxy">
                    {Lang::T('Proxy')}
                </a>
            </h4>
        </div>
        <div id="collapseProxy" class="panel-body-visible" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <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>
                </div>
                <div class="form-group">
                    <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>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="TaxSystem">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseTaxSystem" aria-expanded="false" aria-controls="collapseTaxSystem">
                    {Lang::T('Tax System')}
                </a>
            </h4>
        </div>
        <div id="collapseTaxSystem" class="panel-body-visible" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Enable Tax System')}</label>
                    <div class="col-md-6">
                        <select name="enable_tax" id="enable_tax" class="form-control">
                            <option value="no" {if $_c['enable_tax']=='no' }selected="selected" {/if}>
                                {Lang::T('No')}
                            </option>
                            <option value="yes" {if $_c['enable_tax']=='yes' }selected="selected" {/if}>
                                {Lang::T('Yes')}
                            </option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">{Lang::T('Tax will be calculated in Internet Plan Price')}</p>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Tax Rate')}</label>
                    <div class="col-md-6">
                        <select name="tax_rate" id="tax_rate" class="form-control">
                            <option value="0.5" {if $_c['tax_rate']=='0.5' }selected="selected" {/if}>
                                0.5
                            </option>
                            <option value="1" {if $_c['tax_rate']=='1' }selected="selected" {/if}>
                                1
                            </option>
                            <option value="1.5" {if $_c['tax_rate']=='1.5' }selected="selected" {/if}>
                                1.5
                            </option>
                            <option value="2" {if $_c['tax_rate']=='2' }selected="selected" {/if}>
                                2
                            </option>
                            <option value="5" {if $_c['tax_rate']=='5' }selected="selected" {/if}>
                                5
                            </option>
                            <option value="10" {if $_c['tax_rate']=='10' }selected="selected" {/if}>
                                10
                            </option>
                            <!-- Custom tax rate option -->
                            <option value="custom" {if $_c['tax_rate']=='custom' }selected="selected" {/if}>
                                {Lang::T('Custome')}</option>
                        </select>
                    </div>
                    <p class="help-block col-md-4">{Lang::T('Tax Rates by percentage')}</p>
                </div>
                <!-- Custom tax rate input field (initially hidden) -->
                <div class="form-group" id="customTaxRate" style="display: none;">
                    <label class="col-md-2 control-label">{Lang::T('Custome Tax Rate')}</label>
                    <div class="col-md-6">
                        <input type="text" value="{$_c['custom_tax_rate']}" class="form-control" name="custom_tax_rate"
                            id="custom_tax_rate" placeholder="{Lang::T('Enter Custome Tax Rate')}">
                    </div>
                    <p class="help-block col-md-4">{Lang::T('Enter the custom tax rate (e.g., 3.75 for 3.75%)')}</p>
                </div>

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

<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
    <input type="hidden" name="csrf_token" value="{$csrf_token}">
    <div class="panel">
        <div class="panel-heading" role="tab" id="GithubAuthentication">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion"
                    href="#collapseAuthentication" aria-expanded="false" aria-controls="collapseAuthentication">
                    Github {Lang::T('Authentication')}
                </a>
            </h4>
        </div>
        <div id="collapseAuthentication" class="panel-body-visible" role="tabpanel">
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Github Username')}</label>
                    <div class="col-md-6">
                        <div class="input-group">
                            <span class="input-group-addon">https://github.com/</span>
                            <input type="text" class="form-control" id="github_username" name="github_username"
                                value="{$_c['github_username']}" placeholder="ibnux">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{Lang::T('Github Token')}</label>
                    <div class="col-md-6">
                        <input type="password" class="form-control" id="github_token" name="github_token"
                            value="{$_c['github_token']}" placeholder="ghp_........"
                            onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
                    </div>
                    <span class="help-block col-md-4"><a href="https://github.com/settings/tokens/new"
                            target="_blank">{Lang::T('Create GitHub personal access token')} (classic)</a>,
                        {Lang::T('only need repo
                        scope')}</span>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-offset-2 col-md-8" style="text-align: left;">{Lang::T('This
                        will allow
                        you to download plugin from private/paid repository')}</label>
                </div>
                <button class="btn btn-success btn-block" type="submit">
                    {Lang::T('Save Changes')}
                </button>
            </div>
        </div>
    </div>
</form>

<div class="bs-callout bs-callout-info" id="callout-navbar-role">
    <h4><b>{Lang::T('Settings For Mikrotik Firewall Rules')}</b></h4>
    <p>/ip hotspot walled-garden ip add dst-host={$_domain} action=accept<br>
        /ip hotspot walled-garden ip add dst-host=*.{$_domain} action=accept<br>
        /ip hotspot walled-garden ip add dst-host=code.jquery.com action=accept<br>
        /ip hotspot walled-garden ip add dst-host=cdn.jsdelivr.net action=accept<br>
        /ip hotspot walled-garden ip add dst-host=cdnjs.cloudflare.com action=accept<br>
        /ip hotspot walled-garden ip add dst-host=fonts.googleapis.com action=accept<br>
        /ip hotspot walled-garden ip add dst-host=cdn.tailwindcss.com action=accept<br>
        /ip hotspot walled-garden ip add dst-host=ajax.googleapis.com action=accept
    </p>
    <br>
    <h4><b>{Lang::T('Settings For Cron Jobs')}</b></h4>
    <p>
        # Execute expired customers every 4 hours<br>
        0 */4 * * * cd {$dir} && {$php} -f cron.php
        <br><br>
        # Run the script every 5 minutes (e.g., for creating hourly vouchers) [Recommended]<br>
        */5 * * * * cd {$dir} && {$php} -f cron.php
        <br><br>
        # Send reminder to users every day at 7 AM<br>
        0 7 * * * cd {$dir} && {$php} -f cron_reminder.php
    </p>
</div>

<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>


<script>
    document.addEventListener('DOMContentLoaded', function () {
        var sectionTimeoutCheckbox = document.getElementById('enable_session_timeout');
        var timeoutDurationInput = document.getElementById('timeout_duration_input');
        var timeoutDurationField = document.getElementById('session_timeout_duration');

        if (sectionTimeoutCheckbox.checked) {
            timeoutDurationInput.style.display = 'block';
            timeoutDurationField.required = true;
        }

        sectionTimeoutCheckbox.addEventListener('change', function () {
            if (this.checked) {
                timeoutDurationInput.style.display = 'block';
                timeoutDurationField.required = true;
            } else {
                timeoutDurationInput.style.display = 'none';
                timeoutDurationField.required = false;
            }
        });

        document.querySelector('form').addEventListener('submit', function (event) {
            if (sectionTimeoutCheckbox.checked && (!timeoutDurationField.value || isNaN(
                timeoutDurationField.value))) {
                event.preventDefault();
                alert('Please enter a valid session timeout duration.');
                timeoutDurationField.focus();
            }
        });
    });
</script>

<script>
    document.addEventListener("DOMContentLoaded", function() {
        // Function to toggle visibility of custom tax rate input field
        function toggleCustomTaxRate() {
            var taxRateSelect = document.getElementById("tax_rate");
            var customTaxRateInput = document.getElementById("customTaxRate");

            if (taxRateSelect.value === "custom") {
                customTaxRateInput.style.display = "block";
            } else {
                customTaxRateInput.style.display = "none";
            }
        }

        // Call the function when the page loads
        toggleCustomTaxRate();

        // Call the function whenever the tax rate dropdown value changes
        document.getElementById("tax_rate").addEventListener("change", toggleCustomTaxRate);
    });
</script>
<script>
// Direct fix for blank panels
$(document).ready(function() {
    // Remove all panel-collapse and collapse classes to force panels to be visible
    $('.panel-collapse').removeClass('panel-collapse collapse').addClass('panel-body');
    
    // Handle clicking on panel headers for smooth UX
    $('.panel-heading').click(function() {
        var target = $(this).attr('id');
        $('html, body').animate({
            scrollTop: $('#' + target).offset().top - 100
        }, 500);
    });

    // Create navigation tabs at the top for easier navigation
    var tabNav = '<ul class="nav nav-tabs" style="margin-bottom: 20px;">';
    $('.panel-title a').each(function(index) {
        var tabText = $(this).text().trim();
        var tabTarget = $(this).attr('href');
        var activeClass = index === 0 ? 'class="active"' : '';
        tabNav += '<li ' + activeClass + '><a href="' + tabTarget + '">' + tabText + '</a></li>';
    });
    tabNav += '</ul>';
    $('.content-header').after(tabNav);
    
    // Make the tab navigation functional
    $('.nav-tabs a').click(function(e) {
        e.preventDefault();
        var target = $($(this).attr('href'));
        $('html, body').animate({
            scrollTop: target.offset().top - 100
        }, 500);
        // Highlight the clicked tab
        $('.nav-tabs li').removeClass('active');
        $(this).parent().addClass('active');
    });
});
</script>
{include file="sections/footer.tpl"}