←':''; //Check if allowed if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){ header('location: index.php'); exit; } //PAGE Security $page_manage = 'equipment_manage'; $update_allowed = isAllowed($page_manage ,$_SESSION['profile'],$_SESSION['permission'],'U'); $delete_allowed = isAllowed($page_manage ,$_SESSION['profile'],$_SESSION['permission'],'D'); $create_allowed = isAllowed($page_manage ,$_SESSION['profile'],$_SESSION['permission'],'C'); //GET PARAMETERS && STORE in SESSION for FURTHER USE/NAVIGATION $pagination_page = $_SESSION['p'] = isset($_GET['p']) ? $_GET['p'] : 1; $status = $_SESSION['status'] = isset($_GET['status']) ? '&status='.$_GET['status'] : ''; $sort = $_SESSION['sort'] = isset($_GET['sort']) ? '&sort='.$_GET['sort'] : ''; $search = $_SESSION['search'] = isset($_GET['search']) ? '&search='.$_GET['search'] : ''; $software = $_SESSION['firmware'] = isset($_GET['firmware']) ? '&firmware='.$_GET['firmware'] : ''; $servicedate = $_SESSION['servicedate'] = isset($_GET['servicedate']) ? '&servicedate='.$_GET['servicedate'] : ''; $warrantydate = $_SESSION['warrantydate'] = isset($_GET['warrantydate']) ? '&warrantydate='.$_GET['warrantydate'] : ''; $partnerid = $_SESSION['partnerid'] = isset($_GET['partnerid']) ? '&partnerid='.$_GET['partnerid'] : ''; $productselected = $_SESSION['productcode'] = isset($_GET['productcode']) ? '&productcode='.$_GET['productcode'] : ''; $serialnumber_input = $_SESSION['serialnumber'] = isset($_GET['serialnumber']) ? '&serialnumber='.$_GET['serialnumber'] : ''; //GET PARAMETERS FOR FILTERS $filter = urlGETdetailsFilter($_GET) ?? ''; // Determine the URL $url = 'index.php?page=equipments'.$status.$search.$software.$servicedate.$warrantydate.$partnerid.$sort.$productselected.$serialnumber_input; //GET Details from URL $GET_VALUES = urlGETdetails($_GET) ?? ''; //CALL TO API $api_url = '/v2/equipments/'.$GET_VALUES; $responses = ioServer($api_url,''); //Decode Payload if (!empty($responses)){$responses = json_decode($responses);}else{$responses = null;} //Return QueryTotal from API $total_url = ((!empty($GET_VALUES) && $GET_VALUES !='') ? '&totals=' : 'totals=' ); $api_url = '/v2/equipments/'.$GET_VALUES.$total_url; $query_total = ioServer($api_url,''); //Decode Payload if (!empty($query_total)){$query_total = json_decode($query_total);}else{$query_total = null;} //Get Products related to assets $product_url = ((!empty($GET_VALUES) && $GET_VALUES !='') ? '&products=' : 'products=' ); $api_url = '/v2/equipments/'.$GET_VALUES.$product_url; $query_products = ioServer($api_url,''); //Decode Payload if (!empty($query_products)){$query_products = json_decode($query_products);}else{$query_products = null;} //BUILD LIST OF PRODUCTS $product_list = ''; if ($query_products != null){ $product_list = ' '; } //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) { $success_msg = $message_eq_1; } if ($_GET['success_msg'] == 2) { $success_msg = $message_eq_2; } if ($_GET['success_msg'] == 3) { $success_msg = $message_eq_3; } } if (isset($_GET['download'])){ downloadToExcel('equipment',$responses); } template_header('Assets', 'assets','view'); $view = '

'.$assets_h2.' ('.$query_total.')

'.$assets_p.'

'.$back_btn_orgin; if ($create_allowed === 1){ $view .= '+'; } $view .= '
'; if (isset($success_msg)){ $view .= '

'.$success_msg.'

'; } $view .= ' '; $view .= '
'; if (empty($responses)){ $view .= ' '; } foreach ($responses as $response){ //Translate status INT to STR $status_text = 'status'.$response->status.'_text'; //GetPartnerDetails $partner_data = json_decode($response->accounthierarchy); //Default location $location = getPartnerName($partner_data->location) ?? $not_specified; //Check if productcode is 0 and status if ($response->productcode == 0 && $response->status == 0) {$location = $product_location_raw;} if ($response->productcode == 0 && $response->status == 1) {$location = $product_location_SFG;} if ($response->productcode == 0 && $response->status == 2) {$location = $product_location_FG;} //Check for Section if (isset($partner_data->section)){$section = getPartnerName($partner_data->section) ?? $not_specified;} else {$section = $not_specified;} //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); $view .= ' '; } $view .= '
'.$equipment_label1.' '.$equipment_label2.' '.$equipment_label3.' '.$equipment_label4.' '.$general_location.' '.$general_section.'
'.$message_no_assets.'
'.$indicators.' '.$response->serialnumber.' '.$$status_text.' '.$response->productcode.'-'.(${$response->productname} ?? $response->productname).' '.(($full_path !='')?'' : '').' '.$location.' '.$section.'
'; $view.=''; //OUTPUT echo $view; template_footer(); ?>