Travel reimburse feature added

This commit is contained in:
2026-07-07 22:48:57 +02:00
parent e1ef2456ea
commit 30269316b2
29 changed files with 21392 additions and 26 deletions

View File

@@ -0,0 +1,263 @@
<?php
use api\classes\API_office_travel_reimburse;
use api\classes\API_companies;
if (!defined('APP_INIT')) {
exit;
}
if (!$GLOBALS['modules_enabled']['office']) {
echo '405 Not Allowed';
exit;
}
# IDE Section
# Includes Section
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_office_travel_reimburse.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";
# Check permissions
$API = new API_office_travel_reimburse();
if (!$API->checkPermissions('office-travel-reimburse', 'RO', true)) {
echo 'error 401 unauthorized';
exit;
}
# Page functions
# JS Scripts to load for this page
$jsScriptLoadData['/src/js/plugin/fullcalendar/fullcalendar.global.js'] = true;
$jsScriptLoadData['/src/css/fullcalendar/theme/global.js'] = true;
$jsScriptLoadData['/src/js/sentri/travelReimburse.js'] = true;
$jsScriptLoadData['/src/js/sentri/companiesMap.js'] = true;
# PageClasses Setup
# Retrieve Information for the page
$API_companies = new API_companies();
$_GET['builder'] = [1 => ['where' => [0 => 'company_state', 1 => 'active']]];
# Retrieve Information for the page
$portal_settings = $GLOBALS['conn']->query("SELECT * FROM system_settings")->fetch_assoc();
$companies = $API_companies->getCompanies();
# Start page output
?>
<div class="card">
<div class="card-body pt-2">
<form id="defaultForNew" enctype="multipart/form-data" method="post" action="/api/v1/portal-management/users/">
<div class="row align-items-end mt-0">
<div class="col mt-0">
<label for="new_departure_postcode" class="form-label"><?php echo __('departure_postcode') ?></label>
<input type="text" id="new_departure_postcode" class="form-control" value="" placeholder="Departure Postcode" required>
</div>
<div class="col mt-0">
<label for="new_destination_postcode" class="form-label"><?php echo __('destination_postcode') ?></label>
<input type="text" id="new_destination_postcode" class="form-control" value="" placeholder="Destination Postcode" required>
</div>
<div class="col mt-0">
<label for="new_travel_distance" class="form-label"><?php echo __('kilometers') ?></label>
<input type="number" id="new_travel_distance" class="form-control" value="" placeholder="0" required>
</div>
<div class="col mt-0">
<label for="new_office_travelreimburse_company_uuid" class="form-label"><?php echo __('company') ?></label>
<select id="new_office_travelreimburse_company_uuid" class="form-select" required>
<option value=""></option>
<?php foreach ($companies as $company) { ?>
<option value="<?php echo $company['company_uuid'] ?>">
<?php echo $company['company_name'] ?>
</option>
<?php } ?>
</select>
</div>
<div class="col">
<label class="form-check-label" for="new_homework"><?php echo __('homework') ?></label>
<div class="form-check form-switch pb-3 mb-4">
<input class="form-check-input" type="checkbox" id="new_homework">
</div>
</div>
<div class="col">
<button type="submit" class="btn btn-success">
<?php echo __('save_default') ?>
</button>
</div>
</div>
</form>
</div>
</div>
<div class="container-fluid h-100 d-flex flex-column p-0">
<div id="calendar" class="flex-grow-1"></div>
</div>
<div class="modal fade" id="travelModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5><?php echo __('edit') . ' ' . __('travelReimburse') ?></h5>
</div>
<div class="modal-body">
<input type="hidden" id="reimburse_uuid">
<input type="hidden" id="travel_date">
<div class="mb-3">
<label><?php echo __('departure_postcode') ?></label>
<label for="departure_postcode"></label><input class="form-control" id="departure_postcode" required>
</div>
<div class="mb-3">
<label><?php echo __('destination_postcode') ?></label>
<label for="destination_postcode"></label><input class="form-control" id="destination_postcode" required>
</div>
<div class="mb-3">
<label><?php echo __('kilometers') ?></label>
<label for="travel_distance"></label><input type="number" class="form-control" id="travel_distance" required>
</div>
<div class="mb-3">
<label><?php echo __('company') ?></label>
<select id="office_travelreimburse_company_uuid" aria-label="office_travelreimburse_company_uuid" aria-describedby="office_travelreimburse_company_uuid" class="form-control" required>
<option value=""></option>
<?php foreach ($companies as $company) { ?>
<option value="<?php echo $company['company_uuid'] ?>"><?php echo $company['company_name'] ?></option>
<?php } ?>
</select>
</div>
<div class="mb-3">
<label><?php echo __('description') ?></label>
<label for="travel_description"></label><textarea class="form-control" id="travel_description"></textarea>
</div>
<div class="form-check form-switch pb-3 mb-3">
<label class="form-check-label" for="homework"><?php echo __('total_travel_distance_homework') ?></label>
<input class="form-check-input" type="checkbox" id="homework">
</div>
</div>
<div class="modal-footer">
<button class="btn btn-danger" id="deleteTravelBtn"><?php echo __('delete') ?></button>
<button class="btn btn-primary" id="saveTravelBtn"><?php echo __('save') ?></button>
</div>
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-body">
<div class="row">
<div class="col-6">
<table class="table table-sm table-responsive">
<tr>
<td><?php echo __('office_travelreimburse_cents_homework_incl') ?>:</td>
<td>
<span id="office_travelreimburse_cents_homework_incl">
€ <?php echo number_format($portal_settings['office_travelreimburse_cents_homework_incl'] / 100, 2, ',', '.') ?>
</span>
</td>
<td>
<span id="total_travel_distance_homework_incl"></span>
</td>
<td>
<span id="office_travelreimburse_cents_homework_incl_total">
</span>
</td>
</tr>
<tr>
<td><?php echo __('office_travelreimburse_cents_homework_excl') ?>:</td>
<td>
<span id="office_travelreimburse_cents_homework_excl">
€ <?php echo number_format($portal_settings['office_travelreimburse_cents_homework_excl'] / 100, 2, ',', '.') ?>
</span>
</td>
<td>
<span id="total_travel_distance_homework_excl"></span>
</td>
<td>
<span id="office_travelreimburse_cents_homework_excl_total">
</span>
</td>
</tr>
<tr>
<td><?php echo __('office_travelreimburse_cents_business_incl') ?>:</td>
<td>
<span id="office_travelreimburse_cents_business_incl">
€ <?php echo number_format($portal_settings['office_travelreimburse_cents_business_incl'] / 100, 2, ',', '.') ?>
</span>
</td>
<td>
<span id="total_travel_distance_business_incl"></span>
</td>
<td>
<span id="office_travelreimburse_cents_business_incl_total">
</span>
</td>
</tr>
<tr>
<td><?php echo __('office_travelreimburse_cents_business_excl') ?>:</td>
<td>
<span id="office_travelreimburse_cents_business_excl">
€ <?php echo number_format($portal_settings['office_travelreimburse_cents_business_excl'] / 100, 2, ',', '.') ?>
</span>
</td>
<td>
<span id="total_travel_distance_business_excl"></span>
</td>
<td>
<span id="office_travelreimburse_cents_business_excl_total">
</span>
</td>
</tr>
<tr>
<td><?php echo __('total_travel_incl') ?>:</td>
<td></td>
<td></td>
<td>
<span id="total_travel_incl">
</span>
</td>
</tr>
<tr>
<td><?php echo __('total_travel_excl') ?>:</td>
<td></td>
<td></td>
<td>
<span id="total_travel_excl">
</span>
</td>
</tr>
</table>
</div>
<div class="col-auto">
<form method="POST" action="/api/v1/office/travel-reimburse/send/">
<input type="hidden" name="calender_month" id="calender_month" value="">
<button class="btn btn-success" type="submit">
<i class="fa-regular fa-envelope"></i> <?php echo __('mail_travelreimburse') ?>
<br> (<?php echo $_SESSION['user']['user_email'] ?>)
</button>
</form>
</div>
</div>
</div>
</div>

View File

@@ -49,6 +49,7 @@ function showCard($module_name, $page_name): void
if ($GLOBALS['modules_enabled']['office'] && $API->checkPermissions('office-stompjes', 'RO', true)) {
showCard('office', 'stompjeslist');
showCard('office', 'travelReimburse');
}
if ($GLOBALS['modules_enabled']['autop']) {

View File

@@ -0,0 +1,131 @@
<?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 } ?>

View File

@@ -319,12 +319,14 @@ while ($module = $system_modules_data->fetch_assoc()) {
<tr>
<th><?php echo __('module_name') ?></th>
<th><?php echo __('enabled') ?></th>
<th><?php echo __('configure') ?></th>
</tr>
</thead>
<tfoot>
<tr>
<th><?php echo __('module_name') ?></th>
<th><?php echo __('enabled') ?></th>
<th><?php echo __('configure') ?></th>
</tr>
</tfoot>
<tbody>
@@ -342,6 +344,11 @@ while ($module = $system_modules_data->fetch_assoc()) {
<span class="slider"></span>
</label>
</td>
<td class="text-nowrap">
<?php if ($module['module_slugify'] === 'office') { ?>
<a href="/portal-management/modules/office/" class="btn btn-primary btn-sm btn-rounded"><i class="fa-solid fa-gear"></i></a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>