v1.0 Initial commit of project

This commit is contained in:
2026-01-01 10:54:18 +01:00
commit 768cf78b57
990 changed files with 241213 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
<?php
if (!defined('APP_INIT')) {
exit;
}
if (isset($_GET['view'])) {
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/customers/pageCompanies_company_view.php');
} else {
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/customers/pageCompanies_view.php');
}

View File

@@ -0,0 +1,93 @@
<?php
if (!defined('APP_INIT')) {
exit;
}
# IDE Section
# Includes Section
use api\classes\API;
use bin\php\Classes\pageNavbar;
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
# Check permissions
$API = new API();
if (!$API->checkPermissions('customer-companies', 'RO', true)) {
echo 'error 401 unauthorized';
exit;
}
# Page functions
# JS Scripts to load for this page
$jsScriptLoadData['datepicker'] = true;
$jsScriptLoadData['breadCrumbs'] = true;
# PageClasses Setup
$pageNavbar = new pageNavbar(true);
# Retrieve Information for the page
$company_uuid = htmlspecialchars($_GET['view'], ENT_QUOTES, 'UTF-8');
$stmt = $GLOBALS['conn']->prepare("SELECT * FROM companies WHERE company_uuid = ?");
$stmt->bind_param('s', $company_uuid);
$stmt->execute();
$result = $stmt->get_result();
$company_data = $result->fetch_assoc();
# Set breadcrumb data
array_push($GLOBALS['breadCrumbArray'], array('display' => __('companies'), 'href' => '/companies/'));
array_push($GLOBALS['breadCrumbArray'], array('display' => $company_data['company_name'], 'href' => ''));
# Start page output
$pageNavbar->outPutNavbar();
?>
<div class="card">
<div class="card-body">
<div class="row">
<h1>
<i class="<?php echo $GLOBALS['pages']['customers']['companies']['page_icon'] ?>"></i> <?php echo $company_data['company_name'] ?>
</h1>
</div>
<div class="col-md-6 col-lg-6">
<table>
<tr>
<td>company_uuid:</td>
<td><?php echo $company_data['company_uuid'] ?></td>
</tr>
<tr>
<td>source_uuid:</td>
<td><?php echo $company_data['source_uuid'] ?></td>
</tr>
<tr>
<td>company_source_id:</td>
<td><?php echo $company_data['company_source_id'] ?></td>
</tr>
<tr>
<td>company_source_id2:</td>
<td><?php echo $company_data['company_source_id2'] ?></td>
</tr>
<tr>
<td>company_name:</td>
<td><?php echo $company_data['company_name'] ?></td>
</tr>
<tr>
<td>company_state:</td>
<td><?php echo $company_data['company_state'] ?></td>
</tr>
<tr>
<td>company_create_timestamp:</td>
<td><?php echo $company_data['company_create_timestamp'] ?></td>
</tr>
<tr>
<td>company_modified_timestamp:</td>
<td><?php echo $company_data['company_modified_timestamp'] ?></td>
</tr>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,128 @@
<?php
if (!defined('APP_INIT')) {
exit;
}
# IDE Section
# Includes Section
use api\classes\API;
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_permissions.php');
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
# Check permissions
$API = new API();
if (!$API->checkPermissions('customer-companies', 'RO', true)) {
echo 'error 401 unauthorized';
exit;
}
# Page functions
# JS Scripts to load for this page
$jsScriptLoadData['delete_confirmation'] = true;
$jsScriptLoadData['datatables'] = true;
$jsScriptLoadData['multiFilterSelect'] = true;
$jsScriptLoadData['datepicker'] = true;
$jsScriptLoadData['activateCompany'] = true;
# PageClasses Setup
# Retrieve Information for the page
if (!isset($_GET['all'])) {
$query = "SELECT companies.*, COUNT(servers.company_uuid) AS server_count FROM companies LEFT JOIN servers ON companies.company_uuid = servers.company_uuid WHERE company_state = 'active' GROUP BY companies.company_uuid ORDER BY companies.company_name ASC;";
} else {
$query = "SELECT companies.*, COUNT(servers.company_uuid) AS server_count FROM companies LEFT JOIN servers ON companies.company_uuid = servers.company_uuid GROUP BY companies.company_uuid ORDER BY companies.company_name ASC;";
}
$stmt = $GLOBALS['conn']->query($query);
$stompjes = array();
$companies = [];
while ($row = $stmt->fetch_assoc()) {
$companies[$row['company_uuid']] = $row;
}
# Start page output
?>
<div class="form-group form-show-validation row mb-3">
<div class="col-5">
<h2>
<i class="<?php echo $GLOBALS['pages']['customers']['companies']['page_icon'] ?>"></i> &nbsp; <?php echo __('companies') ?>
</h2>
</div>
<div class="col d-flex justify-content-end px-1">
<div class="col-lg-auto col-md-auto col-sm-auto">
<?php
if (!isset($_GET['all'])) { ?>
<a class="btn btn-secondary" href="?all">
<i class="fa-solid fa-filter"></i> &nbsp; <?php echo __('show_all') ?>
</a>
<?php } else { ?>
<a class="btn btn-secondary" href="?">
<i class="fa-solid fa-filter"></i> &nbsp; <?php echo __('show_active') ?>
</a>
<?php } ?>
</div> &nbsp;
<form method="post" action="/api/v1/customers/companies/sync/">
<input type="hidden">
<div class="col-lg-auto col-md-auto col-sm-auto">
<button class="btn btn-primary">
<i class="fa-solid fa-arrow-rotate-right"></i> &nbsp;<?php echo __('sync') ?>
</button>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="multi-filter-select display table table-striped table-hover" data-skip-columns="0,1,2,4" data-page-length="50">
<thead>
<tr>
<th><?php echo __('company_name') ?></th>
<th><?php echo __('company_id') ?></th>
<th><?php echo __('company_debtor') ?></th>
<th><?php echo __('company_state') ?></th>
<th><?php echo __('server_count') ?></th>
<th><?php echo __('actions') ?></th>
</tr>
</thead>
<tfoot>
<tr>
<th><?php echo __('company_name') ?></th>
<th><?php echo __('company_id') ?></th>
<th><?php echo __('company_debtor') ?></th>
<th><?php echo __('company_state') ?></th>
<th><?php echo __('server_count') ?></th>
<th><?php echo __('actions') ?></th>
</tr>
</tfoot>
<tbody>
<?php foreach ($companies as $company) { ?>
<tr data-item-id="<?php echo $company['company_uuid'] ?>">
<td class="text-nowrap"><?php echo $company['company_name'] ?></td>
<td class="text-nowrap"><?php echo $company['company_source_id'] ?></td>
<td class="text-nowrap"><?php echo $company['company_source_id2'] ?></td>
<td class="text-nowrap"><?php echo $company['company_state'] ?></td>
<td class="text-nowrap"><?php echo $company['server_count'] ?></td>
<td>
<a href="/companies?view=<?php echo $company['company_uuid'] ?>" class="btn btn-info btn-sm btn-rounded" data-item-uuid="<?php echo $company['company_uuid'] ?>"><i class="fa-solid fa-eye"></i></a>
<?php if ($API->checkPermissions('customer-companies', 'RW', true) && $company['server_count'] == 0) { ?>
<a class="btn btn-<?php echo ($company['company_state'] != 'active') ? 'success' : 'danger' ?> btn-sm btn-rounded" data-item-company-state="" data-item-uuid="<?php echo $company['company_uuid'] ?>" data-item-state="<?php echo $company['company_state'] ?>"><i class="fa-solid <?php echo ($company['company_state'] != 'active') ? 'fa-plus' : 'fa-xmark' ?>"></i></a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<br>
</div>
</div>
</div>