status.'_text'; $warrantydate = warrantyStatus($responses->warranty_date); $service_date_due = serviceStatus($responses->service_date); $firmware_status = availableFirmware($responses->sw_version, $responses->hw_version); //GetPartnerDetails $partner_data = json_decode($responses->accounthierarchy); $salesid = getPartnerName($partner_data->salesid) ?? $not_specified; $soldto = getPartnerName($partner_data->soldto) ?? '-'; $shipto = getPartnerName($partner_data->shipto) ?? '-'; $location = getPartnerName($partner_data->location) ?? '-'; if (isset($partner_data->section)){$section = getPartnerName($partner_data->section) ?? '-';} else {$section = '-';} //Check if productcode is 0 and status if ($responses->productcode == 0 && $responses->status == 0) {$location = $product_location_raw;} if ($responses->productcode == 0 && $responses->status == 1) {$location = $product_location_SFG;} if ($responses->productcode == 0 && $responses->status == 2) {$location = $product_location_FG;} if ($update_allowed === 1){ if (isset($_POST['description'])) { //GET ALL POST DATA $data = json_encode($_POST, JSON_UNESCAPED_UNICODE); //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/history', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=equipment&equipmentID='.$_POST['equipmentid'].'&success_msg=2'); exit; } } } // 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; } } template_header('Asset', 'asset', 'view'); $view = '

'.$view_asset_h2.' - '.$_GET['equipmentID'].'

'.$button_cancel.' '; //------------------------------------ //CHECK IF USER IS ALSO CREATOR OF RECORD THEN OVERRIDE UPDATE_ALLOWED_EDIT //------------------------------------ $equipment_owner = (($responses->createdby == $_SESSION['username'])? 1 : 0); //------------------------------------ // //------------------------------------ if ($update_allowed_edit === 1 || $equipment_owner === 1){ $view .= 'Edit'; } $view .= '
'; if (isset($success_msg)){ $view .= '

'.$success_msg.'

'; } $view .= '
'; $view .= '
'.$view_asset_information.'

'.$equipment_label3.'

'.$$status_text.'

'.$equipment_label2.'

'.$responses->serialnumber.'

'.$equipment_label10.'

'.$responses->equipmentID.'

'.$product_code.'

'.(($view_product == 1)? ''.$responses->productcode.'':$responses->productcode).'

'.$product_name.'

'.(($view_product == 1)? ''.$responses->productname.'':$responses->productname).'

'; $picture = glob("./assets/images/products/".$responses->productcode.".{jpg,jpeg,png,gif}", GLOB_BRACE); if (!empty($picture)){ $view .='
'; } $view .='
'; $view .='
'.$view_asset_partners.'

'.$general_salesid.'

'.$salesid.'

'.$general_soldto.'

'.$soldto.'

'.$general_shipto.'

'.$shipto.'

'.$general_location.'

'.$location.'

'.$general_section.'

'.$section.'

'; $view .= '
'; $view .= '
'.$view_asset_details.'
'.$warranty_status.' '.$warrantydate.'
'.$service_status.' '.$service_date_due.'
'.$software_status.' '.$firmware_status.'
'.$equipment_label5.' '.$responses->hw_version.'
'.$equipment_label6.' '.$responses->sw_version.'
'; //SHOW LOCATION BASED ON GEOLOCATION if (!empty($responses->geolocation) || $responses->geolocation != ''){ $geolocation = json_decode($responses->geolocation,true); if ($geolocation[1] != ''){ $view .= '
'; } } //Get all related service events if (isAllowed('servicereports',$_SESSION['profile'],$_SESSION['permission'],'R') === 1){ $service_events = serviceEvents($history,$page); $view .= '
'.$view_asset_servicereport.'
'.$service_events.'
'; } if ($update_allowed === 1){ $view .= '
'.$view_asset_notes.'
'; } //DISPLAY RELATED COMMUNICATION RECORDS $soldto_id = explode("-",$partner_data->soldto) ?? ''; $shipto_id = explode("-",$partner_data->shipto) ?? ''; $partner_users_id = ($shipto_id[0] != '')? $shipto_id[0] : (($soldto_id[0] != '')? $soldto_id[0] : 1); $view_communication = ''; if ($partner_users_id != 1 && ($_SESSION['permission'] == 3 || $_SESSION['permission'] == 4)){ $view_communication = ' '.$button_partner_assigned_communication.''; } //DISPLAY RELATED USERS $view_users =''; if ($partner_users_id != 1 && ($_SESSION['permission'] == 3 || $_SESSION['permission'] == 4)){ $view_users = ' '.$button_partner_assigned_users.''; } $view .= '
'.$view_asset_actions.'
'.$button_history.' '.$view_communication.' '.$view_users.' '; if ($update_allowed === 1){ $view .=''.$button_firmware.''; } $view .='
'; //OUTPUT echo $view; template_footer() ?>