<?php

use api\classes\API;

if (!defined('APP_INIT')) {
    exit;
}
# IDE Section


# Includes Section

require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";
# Check permissions
$API = new \api\classes\API_companies();

# Page functions


# JS Scripts to load for this page
$jsScriptLoadData['/src/js/sentri/activeTabOnRefresh.js'] = true;
$jsScriptLoadData['/src/js/sentri/copyInputValue.js'] = true;
$jsScriptLoadData['/src/js/sentri/updateToggle.js'] = true;

# PageClasses Setup

# Retrieve Information for the page
$portal_settings = $GLOBALS['conn']->query("SELECT * FROM system_settings")->fetch_assoc();

$companies = [];
if ($GLOBALS['modules_enabled']['customers']) {
    $_GET['builder'] = [1 => ['where' => [0 => 'company_state', 1 => 'active']]];
    $companies = $API->getCompanies();
}

# Set breadcrumb data

# Start page output

?><?php if ($API->checkPermissions('admin-portalsettings', 'RO', true)) { ?>
    <div class="card-body activeTabOnRefresh">
        <div class="row">
            <div class="col-md-1 col-lg-2">
                <div class="nav flex-column nav-pills nav-secondary nav-pills-no-bd nav-pills-icons" id="v-pills-tab-with-icon" role="tablist" aria-orientation="vertical">
                    <a class="nav-link" id="travel-reimbursement-settings-tab" data-bs-toggle="pill" href="#travel-reimburse-settings" role="tab" aria-controls="mail-settings" aria-selected="true">
                        <i class="<?php echo $GLOBALS['pages']['office']['travelReimburse']['page_icon'] ?>"></i><?php echo __('travelReimburse'); ?>
                    </a>

                    <a class="nav-link" id="global-settings-tab" data-bs-toggle="pill" href="#stompjes-settings" role="tab" aria-controls="global-settings">
                        <i class="<?php echo $GLOBALS['pages']['office']['stompjeslist']['page_icon'] ?>"></i><?php echo __('stompjeslist'); ?>
                    </a>

                </div>
            </div>
            <div class="col-md-11 col-lg-10">
                <div class="tab-content" id="v-pills-with-icon-tabContent">
                    <div class="tab-pane fade show active" id="travel-reimburse-settings" role="tabpanel" aria-labelledby="travel-reimbursement-settings-tab">
                        <div class="row mb-3">
                            <div class="col-12">
                                <h2>
                                    <i class="fas fa-globe-americas"></i> &nbsp; <?php echo __('travelReimburse') . " " . __('settings'); ?>
                                </h2>
                            </div>
                        </div>
                        <div class="card">
                            <form id="FormValidation" method="post" action="/api/v1/office/travel-reimburse/configure/">
                                <input type="hidden" name="X-HTTP-Method-Override" value="PUT">
                                <input type="hidden" name="_return" value="/portal-management/modules/office/#travel-reimburse-settings">
                                <input type="hidden" name="portal_uuid" value="<?php echo $portal_settings['portal_uuid']; ?>">
                                <div class="card-body">
                                    <div class="form-group form-show-validation row">
                                        <label for="office_travelreimburse_cents_homework_incl" class="col-lg-4 col-md-4 col-sm-4 mt-sm-2"><?php echo __('office_travelreimburse_cents_homework_incl') ?></label>
                                        <div class="col-lg-3 col-md-3 col-sm-3">
                                            <input type="number" class="form-control" id="office_travelreimburse_cents_homework_incl" name="office_travelreimburse_cents_homework_incl" value="<?php echo $portal_settings['office_travelreimburse_cents_homework_incl'] ?>" placeholder="" required/>
                                        </div>
                                    </div>
                                    <div class="form-group form-show-validation row">
                                        <label for="office_travelreimburse_cents_homework_excl" class="col-lg-4 col-md-4 col-sm-4 mt-sm-2"><?php echo __('office_travelreimburse_cents_homework_excl') ?></label>
                                        <div class="col-lg-3 col-md-3 col-sm-3">
                                            <input type="number" class="form-control" id="office_travelreimburse_cents_homework_excl" name="office_travelreimburse_cents_homework_excl" value="<?php echo $portal_settings['office_travelreimburse_cents_homework_excl'] ?>" placeholder="" required/>
                                        </div>
                                    </div>

                                    <div class="form-group form-show-validation row">
                                        <label for="office_travelreimburse_cents_business_incl" class="col-lg-4 col-md-4 col-sm-4 mt-sm-2"><?php echo __('office_travelreimburse_cents_business_incl') ?></label>
                                        <div class="col-lg-3 col-md-3 col-sm-3">
                                            <input type="number" class="form-control" id="office_travelreimburse_cents_business_incl" name="office_travelreimburse_cents_business_incl" value="<?php echo $portal_settings['office_travelreimburse_cents_business_incl'] ?>" placeholder="" required/>
                                        </div>
                                    </div>
                                    <div class="form-group form-show-validation row">
                                        <label for="office_travelreimburse_cents_business_excl" class="col-lg-4 col-md-4 col-sm-4 mt-sm-2"><?php echo __('office_travelreimburse_cents_business_excl') ?></label>
                                        <div class="col-lg-3 col-md-3 col-sm-3">
                                            <input type="number" class="form-control" id="office_travelreimburse_cents_business_excl" name="office_travelreimburse_cents_business_excl" value="<?php echo $portal_settings['office_travelreimburse_cents_business_excl'] ?>" placeholder="" required/>
                                        </div>
                                    </div>
                                </div>
                                <div class="card-footer py-4">
                                    <div class="row">
                                        <div class="col d-flex justify-content-end">
                                            <?php if ($API->checkPermissions('admin-portalsettings', 'RW', true)) { ?>
                                                <button type="submit" class="btn btn-primary">
                                                    <i class="fas fa-edit"></i> <?php echo __('edit') ?>
                                                </button>
                                            <?php } ?>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>

                    <div class="tab-pane fade show active" id="stompjes-settings" role="tabpanel" aria-labelledby="stompjes-settings-tab">
                        <div class="row mb-3">
                            <div class="col-12">
                                <h2>
                                    <i class="fa-solid fa-envelope"></i> &nbsp; <?php echo __('stompjes') . ' ' . __('settings') ?>
                                </h2>
                            </div>
                        </div>
                        <div class="card">
                            <div class="card-body">
                                No settings for stompjes yet.
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
<?php } ?>