Merge branch 'development'

This commit is contained in:
“VeLiTi”
2025-12-16 16:21:06 +01:00
113 changed files with 1014 additions and 308 deletions

View File

@@ -147,12 +147,7 @@ $view .= '</div>';
$view .= '<div class="tabs"> $view .= '<div class="tabs">
<a href="#" class="active">'.$view_account_information.'</a> <a href="#" class="active">'.$view_account_information.'</a>
<a href="#">'.$view_account_contact.'</a> </div>';
<a href="#">'.$account_billing.'</a>
<a href="#">'.$account_shipping.'</a>
<a href="#">'.$tab3.'</a>
</div>
';
//Define Permission & Profile //Define Permission & Profile
$view .= '<div class="content-block tab-content active"> $view .= '<div class="content-block tab-content active">
@@ -186,8 +181,10 @@ $view .= '<div class="content-block tab-content active">
</div> </div>
</div>'; </div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="tabs">
<a href="#">'.$view_account_contact.'</a>
</div>
<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="">'.$account_contactfirstname.'</label> <label for="">'.$account_contactfirstname.'</label>
<input name="accountdetails[contactfirstname]" type="text" value="'.$accountdetails->contactfirstname.'"> <input name="accountdetails[contactfirstname]" type="text" value="'.$accountdetails->contactfirstname.'">
@@ -206,8 +203,10 @@ $view .= '<div class="content-block tab-content">
</div> </div>
</div>'; </div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="tabs">
<a href="#">'.$account_billing.'</a>
</div>
<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="">'.$account_billstreetadress.'</label> <label for="">'.$account_billstreetadress.'</label>
<input name="accountdetails[billstreetadress]" type="text" value="'.$accountdetails->billstreetadress.'"> <input name="accountdetails[billstreetadress]" type="text" value="'.$accountdetails->billstreetadress.'">
@@ -231,7 +230,10 @@ $view .= '<div class="content-block tab-content">
</div> </div>
</div>'; </div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="tabs">
<a href="#">'.$account_shipping.'</a>
</div>
<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="">'.$account_streetadress.'</label> <label for="">'.$account_streetadress.'</label>
<input name="accountdetails[streetadress]" type="text" value="'.$accountdetails->streetadress.'"> <input name="accountdetails[streetadress]" type="text" value="'.$accountdetails->streetadress.'">
@@ -272,8 +274,10 @@ $view .= '<div class="content-block tab-content">
$partner_data = json_decode($_SESSION['partnerhierarchy']); $partner_data = json_decode($_SESSION['partnerhierarchy']);
$soldto_dropdown = listPartner('soldto',$_SESSION['permission'],$accounthierarchy->soldto,''); $soldto_dropdown = listPartner('soldto',$_SESSION['permission'],$accounthierarchy->soldto,'');
$view .= '<div class="content-block tab-content"> $view .= '<div class="tabs">
<a href="#">'.$tab3.'</a>
</div>
<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="">'.$general_salesid.'</label> <label for="">'.$general_salesid.'</label>
<input name="salesid" type="text" value="'.$partner_data->salesid.'"> <input name="salesid" type="text" value="'.$partner_data->salesid.'">

View File

@@ -161,25 +161,8 @@ if ($sw_version_latest_update == 1){
//------------------------------------------ //------------------------------------------
//UPDATE SW_STATUS //UPDATE SW_STATUS
//------------------------------------------ //------------------------------------------
//UPDATE ASSETS-> SW_LATEST_VERSION WITH NO PRODUCT_SOFTWARE TO 2 // Use the reusable function to update software version status for all equipment
$sql = 'UPDATE equipment e LEFT JOIN products_software ps ON e.productrowid = ps.productrowid SET e.sw_version_latest = 2 WHERE ps.rowID IS NULL'; updateSoftwareVersionStatus($pdo);
$stmt = $pdo->prepare($sql);
$stmt->execute();
//UPDATE ASSETS-> SW_LATEST_VERSION WITH PRODUCT_SOFTWARE FROM 2 TO 0
$sql = 'UPDATE equipment e LEFT JOIN products_software ps ON e.productrowid = ps.productrowid SET e.sw_version_latest = 0 WHERE ps.rowID IS NOT NULL AND sw_version_latest = 2';
$stmt = $pdo->prepare($sql);
$stmt->execute();
//UPDATE LATEST TO NO IN CASE HW_VERSION ARE EQUAL AND SW_VERSIONS NOT AND NOT LATEST
$sql = 'UPDATE equipment e JOIN products_software ps ON e.productrowid = ps.productrowid SET e.sw_version_latest = 0 WHERE ps.latest = 1 AND lower(e.sw_version) <> lower(ps.version) AND lower(e.hw_version) = lower(ps.hw_version) AND e.sw_version_latest = 1';
$stmt = $pdo->prepare($sql);
$stmt->execute();
//UPDATE LATEST TO YES IN CASE HW_VERSION ARE EQUAL AND SW_VERSIONS ARE EQUAL
$sql = 'UPDATE equipment e JOIN products_software ps ON e.productrowid = ps.productrowid SET e.sw_version_latest = 1 WHERE ps.latest = 1 AND lower(e.sw_version) = lower(ps.version) AND lower(e.hw_version) = lower(ps.hw_version) AND e.sw_version_latest = 0';
$stmt = $pdo->prepare($sql);
$stmt->execute();
//------------------------------------------ //------------------------------------------
//------------------------------------------ //------------------------------------------
} }

View File

@@ -0,0 +1,196 @@
<?php
defined($security_key) or exit;
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
//------------------------------------------
// Software Available Check API
// Returns boolean indicating if software updates are available
//------------------------------------------
//Connect to DB
$pdo = dbConnect($dbname);
//NEW ARRAY
$criterias = [];
$clause = '';
//Check for $_GET variables and build up clause
if(isset($get_content) && $get_content!=''){
//GET VARIABLES FROM URL
$requests = explode("&", $get_content);
//Check for keys and values
foreach ($requests as $y){
$v = explode("=", $y);
//INCLUDE VARIABLES IN ARRAY
$criterias[$v[0]] = $v[1];
}
}
// IF SN IS PROVIDED, CHECK FOR AVAILABLE UPGRADES
if (isset($criterias['sn']) && $criterias['sn'] != ''){
//default response
$software_available = "no";
//check if current version is send and update the equipment record
if(isset($criterias['version']) && $criterias['version'] !=''){
$sql = 'UPDATE equipment SET sw_version = ?, updatedby = ? WHERE serialnumber = ? ';
$stmt = $pdo->prepare($sql);
$stmt->execute([$criterias['version'],$username,$criterias['sn']]);
}
//check if current hw_version is send and update the equipment record
if(isset($criterias['hw_version']) && $criterias['hw_version'] !=''){
$sql = 'UPDATE equipment SET hw_version = ?, updatedby = ? WHERE serialnumber = ? ';
$stmt = $pdo->prepare($sql);
$stmt->execute([$criterias['hw_version'],$username,$criterias['sn']]);
}
//GET EQUIPMENT AND PRODUCT DATA BASED ON SERIAL NUMBER
$sql = 'SELECT
p.rowID as product_rowid,
p.productcode,
e.sw_version as current_sw_version,
e.hw_version,
e.sw_version_license,
e.rowID as equipment_rowid
FROM equipment e
JOIN products p ON e.productrowid = p.rowID
WHERE e.serialnumber = ?';
$stmt = $pdo->prepare($sql);
$stmt->execute([$criterias['sn']]);
$equipment_data = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$equipment_data) {
$messages = ["error" => "No equipment found for serialnumber"];
} else {
$product_rowid = $equipment_data['product_rowid'];
$productcode = $equipment_data['productcode'];
$current_sw_version = $equipment_data['current_sw_version'];
$hw_version = $equipment_data['hw_version'];
$sw_version_license = $equipment_data['sw_version_license'];
$equipment_rowid = $equipment_data['equipment_rowid'];
//GET ALL DATA: active assignments, version details, and upgrade paths
//Filter on active status, hw_version compatibility, and exclude current version
$sql = 'SELECT
psv.rowID as version_id,
psv.version,
psv.name,
psv.description,
psv.mandatory,
psv.latest,
psv.hw_version,
psv.file_path,
pup.price,
pup.currency,
pup.from_version_id,
from_ver.version as from_version
FROM products_software_assignment psa
JOIN products_software_versions psv ON psa.software_version_id = psv.rowID
LEFT JOIN products_software_upgrade_paths pup ON pup.to_version_id = psv.rowID AND pup.is_active = 1
LEFT JOIN products_software_versions from_ver ON pup.from_version_id = from_ver.rowID
WHERE psa.product_id = ?
AND psa.status = 1
AND (psv.hw_version = ? OR psv.hw_version IS NULL OR psv.hw_version = "")
AND psv.version != ?';
$stmt = $pdo->prepare($sql);
$stmt->execute([$product_rowid, $hw_version, $current_sw_version ?? '']);
$versions = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (empty($versions)) {
// No versions available
$software_available = "no";
} else {
$has_priced_options = false;
$has_latest_version_different = false;
foreach ($versions as $version) {
//Check if this version should be shown (same logic as software_update)
$show_version = false;
if (!$current_sw_version || $current_sw_version == '') {
//No current version - show all
$show_version = true;
} elseif ($version['from_version'] == $current_sw_version) {
//Upgrade path exists from current version
$show_version = true;
} else {
//Check if any upgrade paths exist for this version
$sql = 'SELECT COUNT(*) as path_count
FROM products_software_upgrade_paths
WHERE to_version_id = ? AND is_active = 1';
$stmt = $pdo->prepare($sql);
$stmt->execute([$version['version_id']]);
$path_check = $stmt->fetch(PDO::FETCH_ASSOC);
if ($path_check['path_count'] == 0) {
//No paths exist at all - show as free upgrade
$show_version = true;
}
}
if ($show_version) {
//Check if there's a valid license for this upgrade
$final_price = $version['price'] ?? '0.00';
if ($final_price > 0 && $sw_version_license) {
//Check if the license is valid
$sql = 'SELECT status, start_at, expires_at
FROM products_software_licenses
WHERE license_key = ? AND equipment_id = ?';
$stmt = $pdo->prepare($sql);
$stmt->execute([$sw_version_license, $equipment_rowid]);
$license = $stmt->fetch(PDO::FETCH_ASSOC);
if ($license && $license['status'] == 1) {
$now = date('Y-m-d H:i:s');
$start_at = $license['start_at'];
$expires_at = $license['expires_at'];
//Check if license is within valid date range
if ((!$start_at || $start_at <= $now) && (!$expires_at || $expires_at >= $now)) {
$final_price = '0.00';
}
}
}
// Check for priced options
if ($final_price > 0) {
$has_priced_options = true;
}
// Check if there's a "latest" flagged version that's different from current
if ($version['latest'] == 1 && $version['version'] != $current_sw_version) {
$has_latest_version_different = true;
}
}
}
// Apply the logic:
// 1. If there are priced options -> "yes"
// 2. If no priced options but current version != latest flagged version -> "yes"
// 3. Default -> "no"
if ($has_priced_options) {
$software_available = "yes";
} elseif ($has_latest_version_different) {
$software_available = "yes";
} else {
$software_available = "no";
}
}
$messages = ["software_available" => $software_available];
}
} else {
$messages = ["error" => "No serialnumber found"];
}
//Encrypt results
$messages = json_encode($messages, JSON_UNESCAPED_UNICODE);
//Send results
echo $messages;
?>

View File

@@ -23,17 +23,37 @@ document.querySelector('.responsive-toggle').onclick = event => {
document.querySelectorAll('.tabs a').forEach((element, index) => { document.querySelectorAll('.tabs a').forEach((element, index) => {
element.onclick = event => { element.onclick = event => {
event.preventDefault(); event.preventDefault();
document.querySelectorAll('.tabs a').forEach(element => element.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach((element2, index2) => { // Toggle the clicked tab
if (index == index2) { const isActive = element.classList.contains('active');
element.classList.add('active'); const tabContent = document.querySelectorAll('.tab-content')[index];
element2.style.display = 'block';
} else { // Remove active class from all tabs and contents
element2.style.display = 'none'; document.querySelectorAll('.tabs a').forEach(el => el.classList.remove('active'));
} document.querySelectorAll('.tab-content').forEach(content => {
content.classList.remove('active');
content.style.display = 'none';
}); });
// If it wasn't active, make it active (collapsible behavior)
if (!isActive && tabContent) {
element.classList.add('active');
tabContent.classList.add('active');
tabContent.style.display = 'block';
}
}; };
}); });
// Initialize first tab as open by default
if (document.querySelectorAll('.tabs a').length > 0) {
const firstTab = document.querySelectorAll('.tabs a')[0];
const firstContent = document.querySelectorAll('.tab-content')[0];
if (firstTab && firstContent) {
firstTab.classList.add('active');
firstContent.classList.add('active');
firstContent.style.display = 'block';
}
}
if (document.querySelector('.filters a')) { if (document.querySelector('.filters a')) {
let filtersList = document.querySelector('.filters .list'); let filtersList = document.querySelector('.filters .list');
let filtersListStyle = window.getComputedStyle(filtersList); let filtersListStyle = window.getComputedStyle(filtersList);

View File

@@ -1490,6 +1490,7 @@ function getProfile($profile, $permission){
'com_log' => 'U', 'com_log' => 'U',
'software_update' => 'R', 'software_update' => 'R',
'software_download' => 'R', 'software_download' => 'R',
'software_available' => 'R'
]; ];
// Group permissions: [granting_page => [collection => allowed_actions_string]] // Group permissions: [granting_page => [collection => allowed_actions_string]]
@@ -5111,3 +5112,83 @@ function checkAndInsertIdentityDealer($pdo, $identityUserkey) {
return false; return false;
} }
} }
//------------------------------------------
// Update software version status for equipment
// Parameters:
// $pdo - PDO database connection
// $serialnumber - Optional serial number. If null, updates all equipment
// Returns: boolean - true on success, false on error
//------------------------------------------
function updateSoftwareVersionStatus($pdo, $serialnumber = null) {
try {
// Build WHERE clause for serial number filtering if provided
$sn_clause = '';
$bind_params = [];
if ($serialnumber !== null) {
$sn_clause = ' AND e.serialnumber = ?';
$bind_params = [$serialnumber];
}
//------------------------------------------
// STEP 1: Set sw_version_latest = 2 for equipment with NO software assignments
//------------------------------------------
$sql = 'UPDATE equipment e
LEFT JOIN products_software_assignment psa ON e.productrowid = psa.product_id AND psa.status = 1
SET e.sw_version_latest = 2
WHERE psa.product_id IS NULL' . $sn_clause;
$stmt = $pdo->prepare($sql);
$stmt->execute($bind_params);
//------------------------------------------
// STEP 2: Set sw_version_latest = 0 for equipment WITH software assignments (from previous 2)
//------------------------------------------
$sql = 'UPDATE equipment e
JOIN products_software_assignment psa ON e.productrowid = psa.product_id AND psa.status = 1
SET e.sw_version_latest = 0
WHERE e.sw_version_latest = 2' . $sn_clause;
$stmt = $pdo->prepare($sql);
$stmt->execute($bind_params);
//------------------------------------------
// STEP 3: Set sw_version_latest = 0 for equipment NOT matching latest version
//------------------------------------------
$sql = 'UPDATE equipment e
JOIN products_software_assignment psa ON e.productrowid = psa.product_id AND psa.status = 1
JOIN products_software_versions psv ON psa.software_version_id = psv.rowID
SET e.sw_version_latest = 0
WHERE psv.latest = 1
AND psv.status = 1
AND lower(e.sw_version) <> lower(psv.version)
AND (psv.hw_version = e.hw_version OR psv.hw_version IS NULL OR psv.hw_version = "")
AND e.sw_version_latest = 1' . $sn_clause;
$stmt = $pdo->prepare($sql);
$stmt->execute($bind_params);
//------------------------------------------
// STEP 4: Set sw_version_latest = 1 for equipment matching latest version
//------------------------------------------
$sql = 'UPDATE equipment e
JOIN products_software_assignment psa ON e.productrowid = psa.product_id AND psa.status = 1
JOIN products_software_versions psv ON psa.software_version_id = psv.rowID
SET e.sw_version_latest = 1
WHERE psv.latest = 1
AND psv.status = 1
AND lower(e.sw_version) = lower(psv.version)
AND (psv.hw_version = e.hw_version OR psv.hw_version IS NULL OR psv.hw_version = "")
AND e.sw_version_latest = 0' . $sn_clause;
$stmt = $pdo->prepare($sql);
$stmt->execute($bind_params);
return true;
} catch (PDOException $e) {
error_log('Database error in updateSoftwareVersionStatus: ' . $e->getMessage());
return false;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 913 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 MiB

BIN
assets/images/media/SP1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

View File

@@ -256,9 +256,15 @@ $view .= '</div>';
foreach($arrayQuestions_cartest as $group){ foreach($arrayQuestions_cartest as $group){
if ($group['Group_sequence'] == 1){ if ($group['Group_sequence'] == 1){
$view .= '<div class="tabs">
<a href="#" class="active">'.$group['Group'].'</a>
</div>';
$view .= '<div class="content-block tab-content active"> $view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100">'; <div class="form responsive-width-100">';
} else { } else {
$view .= '<div class="tabs">
<a href="#">'.$group['Group'].'</a>
</div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="content-block tab-content">
<div class="form responsive-width-100">'; <div class="form responsive-width-100">';
} }

View File

@@ -128,10 +128,7 @@ $view .= '</div>';
$view .= '<div class="tabs"> $view .= '<div class="tabs">
<a href="#" class="active">'.$tab1.'</a> <a href="#" class="active">'.$tab1.'</a>
<a href="#">'.$tab2.'</a> </div>';
<a href="#">'.$tab3.'</a>
</div>
';
$view .='<div class="content-block tab-content active"> $view .='<div class="content-block tab-content active">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
@@ -257,6 +254,10 @@ $shipto_dropdown = listPartner('shipto',$_SESSION['permission'],$partner_data->s
$location_dropdown = listPartner('location',$_SESSION['permission'],$partner_data->location,''); $location_dropdown = listPartner('location',$_SESSION['permission'],$partner_data->location,'');
//DISPLAY //DISPLAY
$view .= '<div class="tabs">
<a href="#">'.$tab2.'</a>
</div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
'; ';
@@ -273,6 +274,10 @@ $view .= '
</div> </div>
</div>'; </div>';
$view .= '<div class="tabs">
<a href="#">'.$tab3.'</a>
</div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="">'.$general_created.'</label> <label for="">'.$general_created.'</label>

View File

@@ -155,13 +155,7 @@ $view .= '</div>';
$view .= '<div class="tabs"> $view .= '<div class="tabs">
<a href="#" class="active">'.($view_dealers_information ?? 'Dealer information').'</a> <a href="#" class="active">'.($view_dealers_information ?? 'Dealer information').'</a>
<a href="#">'.($view_dealer_details_1 ?? 'Descriptions').'</a> </div>';
<a href="#">'.($view_dealer_details_3 ?? 'Location').'</a>
<a href="#">'.($dealers_openinghours ?? 'opening_hours').'</a>
<a href="#">'.($view_dealer_details_2 ?? 'Settings').'</a>
<a href="#">'.$tab3.'</a>
</div>
';
$view .= '<div class="content-block tab-content active"> $view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
@@ -190,6 +184,10 @@ $view .= '<div class="content-block tab-content active">
$view .= '<input type="hidden" name="rowID" value="'.($responses['rowID'] ?? '').'">'; $view .= '<input type="hidden" name="rowID" value="'.($responses['rowID'] ?? '').'">';
} }
$view .= '<div class="tabs">
<a href="#">'.($view_dealers_descriptions ?? 'Description').'</a>
</div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="dealerdescription">'.($dealers_short_description ?? 'short').'</label> <label for="dealerdescription">'.($dealers_short_description ?? 'short').'</label>
@@ -325,6 +323,10 @@ $view .= '
</div> </div>
</div>'; </div>';
$view .= '<div class="tabs">
<a href="#">'.$tab3.'</a>
</div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="dealercode">'.$general_created.'</label> <label for="dealercode">'.$general_created.'</label>

View File

@@ -157,13 +157,6 @@ if ($update_allowed === 1 || $equipment_owner === 1){
$view .= '</div>'; $view .= '</div>';
$view .= '<div class="tabs">
<a href="#" class="active">'.$tab1.'</a>
<a href="#">'.$tab2.'</a>
<a href="#">'.$tab3.'</a>
</div>
';
//create product option list //create product option list
$product_option_list =''; $product_option_list ='';
foreach ($products as $product){ foreach ($products as $product){
@@ -188,7 +181,10 @@ if (isset($products_software) && $products_software !=''){
$product_software_list .= '</select>'; $product_software_list .= '</select>';
} }
$view .= '<div class="content-block tab-content active"> $view .= '<div class="tabs">
<a href="#" class="active">'.$tab1.'</a>
</div>
<div class="content-block tab-content active">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="status">'.$equipment_label3.'</label> <label for="status">'.$equipment_label3.'</label>
<select id="status" name="status" '.($update_allowed_special==0? 'disabled':'').'> <select id="status" name="status" '.($update_allowed_special==0? 'disabled':'').'>
@@ -232,8 +228,11 @@ $location_dropdown = listPartner('location',$_SESSION['permission'],$partner_dat
if (isset($partner_data->section)){$section = getPartnerName($partner_data->section) ?? 'Not specified';} else {$section = 'Not specified';} if (isset($partner_data->section)){$section = getPartnerName($partner_data->section) ?? 'Not specified';} else {$section = 'Not specified';}
//DISPLAY //DISPLAY TAB 2
$view .= '<div class="content-block tab-content"> $view .= '<div class="tabs">
<a href="#">'.$tab2.'</a>
</div>
<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
'; ';
$view .= '<label for="status">'.$general_salesid.'</label>'; $view .= '<label for="status">'.$general_salesid.'</label>';
@@ -266,7 +265,11 @@ if (is_array($geo_details)) {
$geodetails_lon = ''; $geodetails_lon = '';
} }
$view .= '<div class="content-block tab-content"> //DISPLAY TAB 3
$view .= '<div class="tabs">
<a href="#">'.$tab3.'</a>
</div>
<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="productcode">'.$general_created.'</label> <label for="productcode">'.$general_created.'</label>
<input id="name" type="text" name="" placeholder="'.$general_created.'" value="'.$equipment['created'].'" readonly> <input id="name" type="text" name="" placeholder="'.$general_created.'" value="'.$equipment['created'].'" readonly>

View File

@@ -115,9 +115,7 @@ $view .= '</div>';
$view .= '<div class="tabs"> $view .= '<div class="tabs">
<a href="#" class="active">'.$tab1.'</a> <a href="#" class="active">'.$tab1.'</a>
<a href="#" class="">'.$tab3.'</a> </div>';
</div>
';
$view .= '<div class="content-block tab-content active"> $view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
@@ -152,6 +150,10 @@ $view .= '<div class="content-block tab-content active">
</div> </div>
</div>'; </div>';
$view .= '<div class="tabs">
<a href="#">'.$tab3.'</a>
</div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">

View File

@@ -7,12 +7,14 @@ if (isAllowed('logfile',$_SESSION['profile'],$_SESSION['permission'],'R') === 0)
exit; exit;
} }
// Define logs directory path
$logs_dir = __DIR__ . '/log/';
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// POST HANDLER - Delete all logs // POST HANDLER - Delete all logs
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$delete_message = ''; $delete_message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete_all_logs'])) { if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete_all_logs'])) {
$logs_dir = __DIR__ . '/log/';
$deleted_count = 0; $deleted_count = 0;
if (is_dir($logs_dir)) { if (is_dir($logs_dir)) {
@@ -37,6 +39,28 @@ if (isset($_GET['deleted'])) {
$delete_message = "Successfully deleted " . intval($_GET['deleted']) . " log file(s)."; $delete_message = "Successfully deleted " . intval($_GET['deleted']) . " log file(s).";
} }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// DOWNLOAD HANDLER
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (isset($_GET['download']) && $_GET['download']) {
$filename = $_GET['download'];
$filepath = $logs_dir . $filename;
// Security check: ensure file exists and is within logs directory
if (file_exists($filepath) && strpos(realpath($filepath), realpath($logs_dir)) === 0) {
// Set headers for file download
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Content-Length: ' . filesize($filepath));
header('Cache-Control: must-revalidate');
header('Pragma: public');
// Output file content
readfile($filepath);
exit;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// GET HANDLER // GET HANDLER
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -45,7 +69,6 @@ if (isset($_GET['deleted'])) {
$selected_log = $_GET['log'] ?? ''; $selected_log = $_GET['log'] ?? '';
// Scan logs directory for all log files // Scan logs directory for all log files
$logs_dir = __DIR__ . '/log/';
$log_files = []; $log_files = [];
if (is_dir($logs_dir)) { if (is_dir($logs_dir)) {
@@ -113,6 +136,9 @@ if (file_exists($filelocation_webserver)){
<button type="button" onclick="refreshLog()" class="btn" > <button type="button" onclick="refreshLog()" class="btn" >
<i class="fas fa-sync-alt"></i> <i class="fas fa-sync-alt"></i>
</button> </button>
<button type="button" onclick="downloadLogFile()" class="btn" style="background: #3498db; color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer;">
<i class="fas fa-download"></i>
</button>
<button type="submit" name="delete_all_logs" onclick="return confirmDeleteAll()" class="btn" style="background: #e74c3c; color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer;"> <button type="submit" name="delete_all_logs" onclick="return confirmDeleteAll()" class="btn" style="background: #e74c3c; color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer;">
<i class="fas fa-trash-alt"></i> <i class="fas fa-trash-alt"></i>
</button> </button>
@@ -165,6 +191,20 @@ function loadLogFile(filename) {
} }
} }
// Download current log file
function downloadLogFile() {
const selector = document.getElementById('log-file-selector');
const selectedFile = selector.value;
if (selectedFile) {
const url = new URL(window.location.href);
url.searchParams.set('download', selectedFile);
window.location.href = url.toString();
} else {
alert('No log file selected to download.');
}
}
// Refresh log functionality // Refresh log functionality
function refreshLog() { function refreshLog() {
const button = event.target.closest('button'); const button = event.target.closest('button');

View File

@@ -123,9 +123,7 @@ $view .= '</div>';
$view .= '<div class="tabs"> $view .= '<div class="tabs">
<a href="#" class="active">'.$tab1 .'</a> <a href="#" class="active">'.$tab1 .'</a>
<a href="#">'.$tab3.'</a> </div>';
</div>
';
//Define Service and User enabled //Define Service and User enabled
$view .= '<div class="content-block tab-content active"> $view .= '<div class="content-block tab-content active">
@@ -141,6 +139,10 @@ $view .= '<div class="content-block tab-content active">
$view .= '</div> $view .= '</div>
</div>'; </div>';
$view .= '<div class="tabs">
<a href="#">'.$tab3.'</a>
</div>';
$view .= '<div class="content-block tab-content"> $view .= '<div class="content-block tab-content">
<div class="form responsive-width-100"> <div class="form responsive-width-100">
<label for="">'.$general_created.'</label> <label for="">'.$general_created.'</label>

Some files were not shown because too many files have changed in this diff Show More