CMXX - Catalog API

This commit is contained in:
“VeLiTi”
2025-01-30 09:28:50 +01:00
parent 661783270a
commit a669b2fadf
19 changed files with 579 additions and 118 deletions

View File

@@ -77,6 +77,14 @@ if ($query_products != null){
$product_list .= '</select>';
}
//CALL TO API
$api_url = '/v2/media/';
$media_responses = ioServer($api_url,'');
//Decode Payload
if (!empty($media_responses)){$media_responses = json_decode($media_responses,true);}else{$media_responses = null;}
// Handle success messages
if (isset($_GET['success_msg'])) {
if ($_GET['success_msg'] == 1) {
@@ -223,7 +231,14 @@ if ($response->productcode == 0 && $response->status == 2) {$location = $product
//Check for Section
if (isset($partner_data->section)){$section = getPartnerName($partner_data->section) ?? $not_specified;} else {$section = $not_specified;}
$picture = glob("./assets/images/products/".$response->productcode.".{jpg,jpeg,png,gif}", GLOB_BRACE);
//GET PATH OF ASSIGNED MEDIA
$full_path = '';
foreach ($media_responses as $media){
if($response->product_media == $media['rowID']){
$full_path = $media['full_path'];
}
}
$indicators = overviewIndicators($response->warranty_date,$response->service_date,$response->sw_version, $response->sw_version_latest);
@@ -231,14 +246,8 @@ $view .= '<tr>
<td class="responsive-hidden">'.$indicators.'</td>
<td>'.$response->serialnumber.'</td>
<td><span class="status id'.$response->status.'">'.$$status_text.'</span></td>
<td>'.$response->productcode.'-'.(${$response->productname} ?? $response->productname).'</td>';
$view .= ' <td class="responsive-hidden">';
if (!empty($picture)){
$view .='
<img style="border-radius: 4px;height: 40px;" src="'.$picture[0].'" alt="">
';
}
$view .= ' </td>
<td>'.$response->productcode.'-'.(${$response->productname} ?? $response->productname).'</td>
<td class="responsive-hidden">'.(($full_path !='')?'<img style="border-radius: 4px;height: 50px;" src="'.$full_path.'" alt="">' : '').'</td>
<td class="responsive-hidden">'.$location.'</td>
<td class="responsive-hidden">'.$section.'</td>
<td><a href="index.php?page=equipment&equipmentID='.$response->equipmentID.'" class="btn_link">'.$general_view .'</a></td>