{include file="sections/header.tpl"}
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></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="container-fluid">
            <form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
        <!-- General Settings -->
        <div class="row mb-3">
            <div class="col-sm-12">
                <div class="card card-primary card-hovered card-stacked">
                    <div class="card-title text-center">
                        <div class="btn-group pull-right">
                            <button class="btn btn-primary btn-xs" title="save" type="submit">
                                <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save
                            </button>
                        </div>
                        {Lang::T('General Settings')}
                    </div>
                    <div class="card-body">
                        <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">{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 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('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>
                        <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>
                </div>
            </div>
        </div>

                <!-- Extend Postpaid Expiration -->
                <div class="row mb-3">
                    <div class="col-sm-12">
                        <div class="card card-primary card-hovered card-stacked">
                            <div class="card-title text-center">
                                <div class="btn-group pull-right">
                                    <button class="btn btn-primary btn-xs" title="save" type="submit">
                                        <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save
                                    </button>
                                </div>
                                {Lang::T('Extend Postpaid Expiration')}
                            </div>
                            <div class="card-body">
                                <div class="form-group row">
                                    <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 row">
                                    <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 row">
                                    <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>
                            </div>
                        </div>
                    </div>
                </div>
                <form class="form-horizontal" method="post" role="form" action="{$_url}settings/login-page-post" enctype="multipart/form-data">
                    <input type="hidden" name="csrf_token" value="{$csrf_token}">
                    <div class="card">
                        <div class="card-header">
                            <h3 class="card-title">
                                {Lang::T('Customer Login Page Settings')}
                            </h3>
                        </div>
                        <div class="card-body">
                            <div class="form-group">
                                <label class="col-md-2 control-label">{Lang::T('Choose Template')}</label>
                                <div class="col-md-6">
                                    <select name="login_page_type" id="login_page_type" class="form-control">
                                        <option value="default" {if $_c['login_page_type']=='default' }selected="selected" {/if}>
                                            {Lang::T('Default')}
                                        </option>
                                        <option value="custom" {if $_c['login_page_type']=='custom' }selected="selected" {/if}>
                                            {Lang::T('Custom')}
                                        </option>
                                    </select>
                                </div>
                                <span class="help-block col-md-4"><small>{Lang::T('Select your login template type')}</small></span>
                            </div>
                            <div id="customFields" style="display: none;">
                                <div class="form-group">
                                    <label class="col-md-2 control-label">{Lang::T('Select Login Page')}</label>
                                    <div class="col-md-6">
                                        <select name="login_Page_template" id="login_Page_template" class="form-control">
                                            {foreach $template_files as $template}
                                                <option value="{$template.value|escape}"
                                                    {if $_c['login_Page_template'] eq $template.value}selected="selected" {/if}>
                                                    {$template.name|escape}
                                                </option>
                                            {/foreach}
                                        </select>
                                    </div>
                                    <span class="help-block col-md-4"><small>{Lang::T('Select your preferred login template')}</small></span>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">{Lang::T('Page Heading / Company Name')}</label>
                                    <div class="col-md-6">
                                        <input type="text" required class="form-control" id="login_page_head" name="login_page_head"
                                            value="{$_c['login_page_head']}">
                                    </div>
                                    <span class="help-block col-md-4"><small>{Lang::T('This Name will be shown on the login wallpaper')}</small></span>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">{Lang::T('Page Description')}</label>
                                    <div class="col-md-6">
                                        <textarea class="form-control" id="login_page_description" name="login_page_description" rows="3">
                                            {Lang::htmlspecialchars($_c['login_page_description'])}
                                        </textarea>
                                    </div>
                                    <span class="help-block col-md-4"><small>{Lang::T('This will also display on wallpaper, You can use html tag')}</small></span>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">{Lang::T('Favicon')}</label>
                                    <div class="col-md-6">
                                        <input type="file" class="form-control" id="login_page_favicon" name="login_page_favicon" accept="image/*">
                                        <span class="help-block"><small>{Lang::T('Best size 30 x 30 | uploaded image will be autosize')}</small></span>
                                    </div>
                                    <span class="help-block col-md-4">
                                        <a href="./{$favicon}" target="_blank"><img src="./{$favicon}" height="48" alt="Favicon"></a>
                                    </span>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">{Lang::T('Login Page Logo')}</label>
                                    <div class="col-md-6">
                                        <input type="file" class="form-control" id="login_page_logo" name="login_page_logo" accept="image/*">
                                        <span class="help-block"><small>{Lang::T('Best size 300 x 60 | uploaded image will be autosize')}</small></span>
                                    </div>
                                    <span class="help-block col-md-4">
                                        <a href="./{$login_logo}" target="_blank"><img src="./{$login_logo}" height="48" alt="Logo"></a>
                                    </span>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">{Lang::T('Login Page Wallpaper')}</label>
                                    <div class="col-md-6">
                                        <input type="file" class="form-control" id="login_page_wallpaper" name="login_page_wallpaper" accept="image/*">
                                        <span class="help-block"><small>{Lang::T('Best size 1920 x 1080 | uploaded image will be autosize')}</small></span>
                                    </div>
                                    <span class="help-block col-md-4">
                                        <a href="./{$wallpaper}" target="_blank"><img src="./{$wallpaper}" height="48" alt="Wallpaper"></a>
                                    </span>
                                </div>
                            </div>
                
                            <button class="btn btn-success btn-block" name="general" type="submit">
                                {Lang::T('Save Changes')}
                            </button>
                        </div>
                    </div>
                </form>
                
                <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
                <script>
                    $(document).ready(function() {
                        // Trigger the change event to show or hide the customFields section on page load based on the selected template type
                        if ($('#login_page_type').val() == 'custom') {
                            $('#customFields').show();
                        }
                
                        // Toggle visibility of customFields based on dropdown selection
                        $('#login_page_type').change(function() {
                            if ($(this).val() == 'custom') {
                                $('#customFields').show();
                            } else {
                                $('#customFields').hide();
                            }
                        });
                    });
                </script>
                
                
                <script>
                    $(document).ready(function() {
                        $('#login_page_type').change(function() {
                            if ($(this).val() == 'custom') {
                                $('#customFields').show();
                            } else {
                                $('#customFields').hide();
                            }
                        });
                    });
                </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="card">
                        <div class="card-header">
                            <h4 class="card-title">
                                {Lang::T('Registration')}
                            </h4>
                        </div>
                        <div class="card-body">
                            <div class="form-group row">
                                <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 row">
                                <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 row">
                                <label class="col-md-2 control-label">{Lang::T('Photo Required')}</label>
                                <div class="col-md-6">
                                    <select name="photo_register" id="photo_register" class="form-control">
                                        <option value="no">{Lang::T('No')}</option>
                                        <option value="yes" {if $_c['photo_register']=='yes' }selected="selected" {/if}>{Lang::T('Yes')}</option>
                                    </select>
                                </div>
                                <p class="help-block col-md-4">
                                    {Lang::T('Customer Registration need to upload their photo')}
                                </p>
                            </div>
                            <div class="form-group row">
                                <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>
                            </div>
                            <div class="form-group row">
                                <label class="col-md-2 control-label">{Lang::T('Enable Captcha Registration')}</label>
                                <div class="col-md-6">
                                    <select name="captcha_register" id="captcha_register" class="form-control">
                                        <option value="no" {if $_c['captcha_register']=='no' }selected="selected" {/if}>{Lang::T('No')}</option>
                                        <option value="yes" {if $_c['captcha_register']=='yes' }selected="selected" {/if}>{Lang::T('Yes')}</option>
                                    </select>
                                </div>
                            </div>
                
                            <button class="btn btn-success btn-block" name="general" type="submit">
                                {Lang::T('Save Changes')}
                            </button>
                        </div>
                    </div>
                </form>
                

                <!-- Customer Balance System -->
                <div class="row mb-3">
                    <div class="col-sm-12">
                        <div class="card card-primary card-hovered card-stacked">
                            <div class="card-title text-center">
                                <div class="btn-group pull-right">
                                    <button class="btn btn-primary btn-xs" title="save" type="submit">
                                        <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save
                                    </button>
                                </div>
                                {Lang::T('Customer Balance System')}
                            </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-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 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-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 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>
                    </div>
                </div>
        
                <!-- Telegram Notification -->
                <div class="row mb-3">
                    <div class="col-sm-12">
                        <div class="card card-primary card-hovered card-stacked">
                            <div class="card-title text-center">
                                <div class="btn-group pull-right">
                                    <a class="btn btn-success btn-xs" style="color: black;" href="javascript:testTg()">Test TG</a>
                                    <button class="btn btn-primary btn-xs" title="save" type="submit">
                                        <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save
                                    </button>
                                </div>
                                {Lang::T('Telegram Notification')}
                            </div>
                            <div class="card-body">
                                <div class="form-group row">
                                    <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 row">
                                    <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>
                            </div>
                        </div>
                    </div>
                </div>     
                <!-- SMS OTP Registration -->
                <div class="row mb-3">
                    <div class="col-sm-12">
                        <div class="card card-primary card-hovered card-stacked">
                            <div class="card-title text-center">
                                <div class="btn-group pull-right">
                                    <a class="btn btn-success btn-xs" style="color: black;" href="javascript:testSms()">{Lang::T('Test SMS')}</a>
                                    <button class="btn btn-primary btn-xs" title="save" type="submit">
                                        <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save
                                    </button>
                                </div>
                                {Lang::T('SMS OTP Registration')}
                            </div>
                            <div class="card-body">
                                <div class="form-group row">
                                    <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>
                    </div>
                </div>
        
            </form>
        </div>
        <!-- WhatsApp Notification -->
        <div class="row mb-3">
            <div class="col-sm-12">
                <div class="card card-primary card-hovered card-stacked">
                    <div class="card-title text-center">
                        <div class="btn-group pull-right">
                            <a class="btn btn-success btn-xs" style="color: black;" href="javascript:testWa()">Test WA</a>
                            <button class="btn btn-primary btn-xs" title="save" type="submit">
                                <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save
                            </button>
                        </div>
                        {Lang::T('WhatsApp Notification')}
                    </div>
                    <div class="card-body">
                        <div class="form-group row">
                            <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>
                    </div>
                </div>
            </div>
        </div>             
               
               <!-- User Notification -->
                <div class="row mb-3">
                    <div class="col-sm-12">
                        <div class="card card-primary card-hovered card-stacked">
                            <div class="card-title text-center">
                                <div class="btn-group pull-right">
                                    <button class="btn btn-primary btn-xs" title="save" type="submit">
                                        <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save
                                    </button>
                                </div>
                                {Lang::T('User Notification')}
                            </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-control">
                                            <option value="none">{Lang::T('None')}</option>
                                            <option value="wa" {if $_c['user_notification_expired']=='wa' }selected="selected" {/if}>{Lang::T('By WhatsApp')}</option>
                                            <option value="sms" {if $_c['user_notification_expired']=='sms' }selected="selected" {/if}>{Lang::T('By SMS')}</option>
                                            <option value="email" {if $_c['user_notification_expired']=='email' }selected="selected" {/if}>{Lang::T('By Email')}</option>
                                        </select>
                                    </div>
                                </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-control">
                                            <option value="none">{Lang::T('None')}</option>
                                            <option value="wa" {if $_c['user_notification_payment']=='wa' }selected="selected" {/if}>{Lang::T('By WhatsApp')}</option>
                                            <option value="sms" {if $_c['user_notification_payment']=='sms' }selected="selected" {/if}>{Lang::T('By SMS')}</option>
                                            <option value="email" {if $_c['user_notification_payment']=='email' }selected="selected" {/if}>{Lang::T('By Email')}</option>
                                        </select>
                                    </div>
                                </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-control">
                                            <option value="none">{Lang::T('None')}</option>
                                            <option value="wa" {if $_c['user_notification_reminder']=='wa' }selected="selected" {/if}>{Lang::T('By WhatsApp')}</option>
                                            <option value="sms" {if $_c['user_notification_reminder']=='sms' }selected="selected" {/if}>{Lang::T('By SMS')}</option>
                                            <option value="email" {if $_c['user_notification_reminder']=='email' }selected="selected" {/if}>{Lang::T('By Email')}</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
               <!-- Miscellaneous -->
                <div class="row mb-3" id="miscellaneous">
                    <div class="col-sm-12">
                        <div class="card card-primary card-hovered card-stacked">
                            <div class="card-title text-center">
                                <div class="btn-group pull-right">
                                    <button class="btn btn-primary btn-xs" title="save" type="submit">
                                        <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save
                                    </button>
                                </div>
                                {Lang::T('Miscellaneous')}
                            </div>
                            <div class="card-body">
                                <div class="form-group row">
                                    <label class="col-md-2 control-label">{Lang::T('Enable Session Timeout')}</label>
                                    <div class="col-md-6">
                                        <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 row" id="timeout_duration_input" style="display: none;">
                                    <label class="col-md-2 control-label">{Lang::T('Timeout Duration')}</label>
                                    <div class="col-md-6">
                                        <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 row">
                                    <label class="col-md-2 control-label">{Lang::T('Router Check')}</label>
                                    <div class="col-md-6">
                                        <select name="router_check" id="router_check" class="form-control">
                                            <option value="0" {if $_c['router_check']=='0' }selected="selected" {/if}>{Lang::T('Disabled')}</option>
                                            <option value="1" {if $_c['router_check']=='1' }selected="selected" {/if}>{Lang::T('Enabled')}</option>
                                        </select>
                                    </div>
                                    <p class="help-block col-md-4">{Lang::T('If enabled, the system will notify Admin when router goes Offline')}</p>
                                </div>         
                        <div class="form-group row">
                            <label class="col-md-2 control-label">{Lang::T('Extend Package Expiry')}</label>
                            <div class="col-md-6">
                                <select name="extend_expiry" id="extend_expiry" class="form-control">
                                    <option value="yes" {if $_c['extend_expiry']!='no' }selected="selected" {/if}>
                                        {Lang::T('Yes')}</option>
                                    <option value="no" {if $_c['extend_expiry']=='no' }selected="selected" {/if}>
                                        {Lang::T('No')}</option>
                                </select>
                            </div>
                            <p class="help-block col-md-4">
                                {Lang::T('If user buy same internet plan, expiry date will extend')}</p>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-2 control-label">{Lang::T('Show Bandwidth Plan')}</label>
                            <div class="col-md-6">
                                <select name="show_bandwidth_plan" id="show_bandwidth_plan" class="form-control">
                                    <option value="no" {if $_c['show_bandwidth_plan']=='no' }selected="selected" {/if}>
                                        {Lang::T('No')}</option>
                                    <option value="yes" {if $_c['show_bandwidth_plan']=='yes' }selected="selected" {/if}>
                                        {Lang::T('Yes')}</option>
                                </select>
                            </div>
                            <p class="help-block col-md-4">
                                {Lang::T(' for Customer')}</p>
                        </div>
                    </div>
                </div>
            </form>
        </div>      
        <div class="container-fluid">
            <form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">    
        <!-- Save Changes Button -->
        <div class="panel-body">
            <div class="form-group row">
                <button class="btn btn-success btn-block" type="submit">{Lang::T('Save Changes')}</button>
            </div>
        </div>
        <pre>/ip hotspot walled-garden
            add dst-host={$_domain}
            add dst-host=*.{$_domain}</pre>
            
                        <pre>
            # {Lang::T('Expired Cronjob Every 5 Minutes')}
            */5 * * * * cd {$dir} && {$php} cron.php
            
            # {Lang::T('Expired Cronjob Every 1 Hour')}
            0 * * * * cd {$dir} && {$php} cron.php
            </pre>
                        <pre>
            # {Lang::T('Reminder Cronjob Every 7 AM')}
            0 7 * * * cd {$dir} && {$php} cron_reminder.php
            </pre>
                    </div>
                </div>
            </form>


    
    
    <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>
        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() {
            // 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>
    
    
    
    {include file="sections/footer.tpl"}