←':''; //Check if allowed if (isAllowed($page,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'R') === 0){ header('location: index.php'); exit; } //PAGE Security $page_manage = 'equipment_manage'; $update_allowed = isAllowed($page_manage ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'U'); $delete_allowed = isAllowed($page_manage ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'D'); $create_allowed = isAllowed($page_manage ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['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;} // Redirect if only one equipment is found if (is_array($responses) && count($responses) === 1 && isset($responses[0]->equipmentID)) { header('Location: index.php?page=equipment&equipmentID=' . $responses[0]->equipmentID); exit; } //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_p.'
'.$success_msg.'
| '.$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.' | |