←':''; //Check if allowed if (isAllowed($page,$_SESSION['authorization']['profile'],$_SESSION['authorization']['permission'],'R') === 0){ header('location: index.php'); exit; } //GET PARAMETERS $pagination_page = isset($_GET['p']) ? $_GET['p'] : 1; $status = isset($_GET['status']) ? '&status='.$_GET['status'] : ''; $search = isset($_GET['search']) ? '&search='.$_GET['search'] : ''; $equipmentid = isset($_GET['equipmentid']) ? '&equipmentid='.$_GET['equipmentid'] : ''; // Determine the URL $url = 'index.php?page=servicereports'.$status.$search.$equipmentid; //GET Details from URL $GET_VALUES = urlGETdetails($_GET) ?? ''; //CALL TO API FOR History $api_url = '/v2/history/type=ServiceReport&'.$GET_VALUES.''; $history = ioServer($api_url,''); //Decode Payload if (!empty($history)){$history = json_decode($history);}else{$history = null;} //Return QueryTotal from API $api_url = '/v2/history/type=ServiceReport&'.$GET_VALUES.'&totals='; $query_total = ioServer($api_url,''); //Decode Payload if (!empty($query_total)){$query_total = json_decode($query_total);}else{$query_total = null;} template_header('Servicereports', 'servicereports','view'); $view = '

'.$servicereports_h2.' ('.$query_total.')

'.$servicereports_p.'

'.$back_btn_orgin.'
'; $view .= ' '; //Get all related service events if (empty($history)){ $service_events = ' '.$servicereports_no_history.' '; } else { $service_events = serviceEvents($history,$page); } $view .= '
'.$service_events.'
'; $view .= ' '; $view.=''; //OUTPUT echo $view; template_footer(); ?>