

<?php $__env->startSection('title', 'App Settings'); ?>
<?php $__env->startSection('heading', 'App Settings'); ?>

<?php $__env->startSection('content'); ?>
<?php $tab = $tab ?? request('tab', 'website'); ?>

<div class="settings-tabs">
    <a class="<?php echo e($tab === 'website' ? 'active' : ''); ?>" href="<?php echo e(route('admin.settings.index', ['tab' => 'website'])); ?>">Website Information</a>
    <a class="<?php echo e($tab === 'preference' ? 'active' : ''); ?>" href="<?php echo e(route('admin.settings.index', ['tab' => 'preference'])); ?>">Preference</a>
    <a class="<?php echo e($tab === 'email' ? 'active' : ''); ?>" href="<?php echo e(route('admin.settings.index', ['tab' => 'email'])); ?>">Email/Google Login-Captcha</a>
</div>

<div class="panel">
    <?php if($tab === 'website'): ?>
        <form class="form" method="POST" action="<?php echo e(route('admin.settings.update')); ?>" enctype="multipart/form-data">
            <?php echo csrf_field(); ?>
            <input type="hidden" name="section" value="website">
            <div class="form-row">
                <div class="field">
                    <label>Website Name</label>
                    <input name="website_name" value="<?php echo e(old('website_name', $settings['website_name'] ?? '')); ?>" required>
                </div>
                <div class="field">
                    <label>Website Title</label>
                    <input name="website_title" value="<?php echo e(old('website_title', $settings['website_title'] ?? '')); ?>" required>
                </div>
            </div>
            <div class="form-row">
                <div class="field">
                    <label>Website Url (https://yoursite.com)</label>
                    <input name="website_url" value="<?php echo e(old('website_url', $settings['website_url'] ?? '')); ?>">
                </div>
                <div class="field">
                    <label>Office Address</label>
                    <input name="office_address" value="<?php echo e(old('office_address', $settings['office_address'] ?? '')); ?>">
                </div>
            </div>
            <div class="form-row">
                <div class="field">
                    <label>WhatsApp number</label>
                    <input name="whatsapp" value="<?php echo e(old('whatsapp', $settings['whatsapp'] ?? '')); ?>" placeholder="e.g. 14102402648">
                    <small class="hint">If you don't want to use WhatsApp leave it empty.</small>
                </div>
                <div class="field">
                    <label>Telegram number / username</label>
                    <input name="telegram" value="<?php echo e(old('telegram', $settings['telegram'] ?? '')); ?>" placeholder="e.g. accessway_support">
                    <small class="hint">If you don't want to use Telegram leave it empty.</small>
                </div>
            </div>
            <div class="form-row">
                <div class="field">
                    <label>Year started</label>
                    <input name="year_started" value="<?php echo e(old('year_started', $settings['year_started'] ?? '')); ?>">
                </div>
                <div class="field">
                    <label>Installation Type</label>
                    <select name="installation_type">
                        <option value="Main-Domain" <?php if(($settings['installation_type'] ?? '') === 'Main-Domain'): echo 'selected'; endif; ?>>Main-Domain</option>
                        <option value="Sub-Domain" <?php if(($settings['installation_type'] ?? '') === 'Sub-Domain'): echo 'selected'; endif; ?>>Sub-Domain</option>
                    </select>
                </div>
            </div>
            <div class="field">
                <label>Smartsupp code</label>
                <textarea name="smartsupp_code" rows="6" placeholder="Paste Smartsupp embed script here"><?php echo e(old('smartsupp_code', $settings['smartsupp_code'] ?? '')); ?></textarea>
                <small class="hint">Paste the Smartsupp chat widget script. Leave empty to disable.</small>
            </div>
            <div class="form-row">
                <div class="field">
                    <label>Logo (Recommended size: max width 200px and max height 80px)</label>
                    <input type="file" name="logo" accept="image/*">
                    <?php if(!empty($settings['logo_path'])): ?>
                        <img src="<?php echo e(asset('storage/'.$settings['logo_path'])); ?>" alt="Logo" style="max-height:50px;margin-top:8px;">
                    <?php endif; ?>
                </div>
                <div class="field">
                    <label>Favicon (Recommended size: max width 32px and max height 32px)</label>
                    <input type="file" name="favicon" accept="image/*">
                    <?php if(!empty($settings['favicon_path'])): ?>
                        <img src="<?php echo e(asset('storage/'.$settings['favicon_path'])); ?>" alt="Favicon" style="width:32px;height:32px;margin-top:8px;">
                    <?php endif; ?>
                </div>
            </div>
            <button class="btn-admin btn-primary" type="submit">Save</button>
        </form>
    <?php elseif($tab === 'preference'): ?>
        <?php
            $currency = old('website_currency', $settings['website_currency'] ?? '$');
            $currencies = ['$' => '$', '£' => '£', '€' => '€', '¥' => '¥', '₦' => '₦', '₹' => '₹', 'C$' => 'C$', 'A$' => 'A$'];
        ?>
        <form class="form" method="POST" action="<?php echo e(route('admin.settings.update')); ?>">
            <?php echo csrf_field(); ?>
            <input type="hidden" name="section" value="preference">
            <div class="form-row">
                <div class="field">
                    <label>Contact Email</label>
                    <input type="email" name="contact_email" value="<?php echo e(old('contact_email', $settings['contact_email'] ?? ($settings['mail_from'] ?? ''))); ?>">
                </div>
                <div class="field">
                    <label>Website Currency</label>
                    <select name="website_currency">
                        <?php $__currentLoopData = $currencies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $symbol): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($symbol); ?>" <?php if($currency === $symbol): echo 'selected'; endif; ?>><?php echo e($symbol); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
            </div>
            <div class="field">
                <label>HomePage Url (Redirect)</label>
                <input name="homepage_redirect" value="<?php echo e(old('homepage_redirect', $settings['homepage_redirect'] ?? '')); ?>" placeholder="eg https://myhomepage.com">
                <small class="help">If you use a custom homepage and you want all request to be redirected to that page, please enter the url here, if empty the system will use our default homepage/webpages</small>
            </div>
            <button class="btn-admin btn-primary" type="submit">Save</button>
        </form>
    <?php else: ?>
        <h2 class="config-title">Configuration</h2>
        <p class="mail-label">Mail Server</p>
        <div class="mailer-toggle">
            <button type="button" class="mailer-btn <?php echo e(($settings['mail_mailer'] ?? '') === 'sendmail' ? 'active' : ''); ?>" data-mailer="sendmail">Sendmail</button>
            <button type="button" class="mailer-btn <?php echo e(($settings['mail_mailer'] ?? 'smtp') === 'smtp' ? 'active' : ''); ?>" data-mailer="smtp">SMTP</button>
        </div>
        <form class="form" method="POST" action="<?php echo e(route('admin.settings.update')); ?>">
            <?php echo csrf_field(); ?>
            <input type="hidden" name="section" value="email">
            <input type="hidden" name="mail_mailer" id="mail_mailer" value="<?php echo e($settings['mail_mailer'] ?? 'smtp'); ?>">
            <div class="form-row">
                <div class="field">
                    <label>Email From</label>
                    <input type="email" name="mail_from" value="<?php echo e(old('mail_from', $settings['mail_from'] ?? '')); ?>" required>
                </div>
                <div class="field">
                    <label>Email From Name</label>
                    <input name="mail_from_name" value="<?php echo e(old('mail_from_name', $settings['mail_from_name'] ?? '')); ?>" required>
                </div>
            </div>
            <div class="smtp-fields">
                <div class="form-row">
                    <div class="field">
                        <label>SMTP Host</label>
                        <input name="smtp_host" value="<?php echo e(old('smtp_host', $settings['smtp_host'] ?? '')); ?>">
                    </div>
                    <div class="field">
                        <label>SMTP Port</label>
                        <input name="smtp_port" value="<?php echo e(old('smtp_port', $settings['smtp_port'] ?? '587')); ?>">
                    </div>
                </div>
                <div class="form-row">
                    <div class="field">
                        <label>SMTP Encryption</label>
                        <input name="smtp_encryption" value="<?php echo e(old('smtp_encryption', $settings['smtp_encryption'] ?? 'tls')); ?>" placeholder="tls or ssl">
                    </div>
                    <div class="field">
                        <label>SMTP Username</label>
                        <input name="smtp_username" value="<?php echo e(old('smtp_username', $settings['smtp_username'] ?? '')); ?>">
                    </div>
                </div>
                <div class="field">
                    <label>SMTP Password</label>
                    <input type="password" name="smtp_password" placeholder="Leave blank to keep current password">
                </div>
            </div>
            <button class="btn-admin btn-primary" type="submit">Save</button>
        </form>
        <script>
            document.querySelectorAll('.mailer-btn').forEach(function (btn) {
                btn.addEventListener('click', function () {
                    document.querySelectorAll('.mailer-btn').forEach(function (b) { b.classList.remove('active'); });
                    btn.classList.add('active');
                    document.getElementById('mail_mailer').value = btn.dataset.mailer;
                    document.querySelector('.smtp-fields').style.display = btn.dataset.mailer === 'smtp' ? 'block' : 'none';
                });
            });
            document.querySelector('.smtp-fields').style.display = document.getElementById('mail_mailer').value === 'smtp' ? 'block' : 'none';
        </script>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\owner\Videos\NEWCOURIER\resources\views/admin/settings/index.blade.php ENDPATH**/ ?>