CIM79 - Filter on productname in asset view
This commit is contained in:
@@ -51,7 +51,7 @@ if(isset($get_content) && $get_content!=''){
|
||||
$v = explode("=", $y);
|
||||
//INCLUDE VARIABLES IN ARRAY
|
||||
$criterias[$v[0]] = $v[1];
|
||||
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='totals' || $v[0] =='history' || $v[0] =='success_msg' || $v[0] =='download' || $v[0] =='sort'){
|
||||
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='products' || $v[0] =='totals' || $v[0] =='history' || $v[0] =='success_msg' || $v[0] =='download' || $v[0] =='sort'){
|
||||
//do nothing
|
||||
}
|
||||
elseif ($v[0] == 'equipmentid') {
|
||||
@@ -115,6 +115,10 @@ elseif (isset($criterias['totals']) && $criterias['totals'] =='' && !isset($crit
|
||||
//Request for total rows
|
||||
$sql = 'SELECT count(*) as count from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.'';
|
||||
}
|
||||
elseif (isset($criterias['products']) && $criterias['products'] ==''){
|
||||
//Request for all products in equipment view
|
||||
$sql = 'SELECT distinct(p.productcode), p.productname from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY p.productcode';
|
||||
}
|
||||
elseif (isset($criterias['totals']) && $criterias['totals'] =='' && isset($criterias['type'])){
|
||||
//Request for total rows for history reports
|
||||
$sql ='SELECT count(*) as count from history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.'';
|
||||
@@ -239,7 +243,7 @@ if(isset($criterias['totals']) && $criterias['totals']==''){
|
||||
$messages = $stmt->fetch();
|
||||
$messages = $messages[0];
|
||||
}
|
||||
elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['download']) && $criterias['download'] =='')){
|
||||
elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['products']) && $criterias['products'] =='') || (isset($criterias['download']) && $criterias['download'] =='')){
|
||||
//Excute Query
|
||||
$stmt->execute();
|
||||
//Get results
|
||||
|
||||
@@ -36,13 +36,13 @@ $software = $_SESSION['firmware'] = isset($_GET['firmware']) ? '&firmware='.$_GE
|
||||
$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'] : '';
|
||||
|
||||
//GET PARAMETERS FOR FILTERS
|
||||
$filter = urlGETdetailsFilter($_GET) ?? '';
|
||||
|
||||
// Determine the URL
|
||||
$url = 'index.php?page=equipments'.$status.$search.$software.$servicedate.$warrantydate.$partnerid.$sort;
|
||||
$url = 'index.php?page=equipments'.$status.$search.$software.$servicedate.$warrantydate.$partnerid.$sort.$productselected;
|
||||
//GET Details from URL
|
||||
$GET_VALUES = urlGETdetails($_GET) ?? '';
|
||||
//CALL TO API
|
||||
@@ -57,6 +57,25 @@ $query_total = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($query_total)){$query_total = decode_payload($query_total);}else{$query_total = null;}
|
||||
|
||||
//Get Products related to assets
|
||||
$api_url = '/v1/equipments/'.$GET_VALUES.'&products=';
|
||||
$query_products = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($query_products)){$query_products = decode_payload($query_products);}else{$query_products = null;}
|
||||
|
||||
//BUILD LIST OF PRODUCTS
|
||||
$product_list = '';
|
||||
|
||||
if ($query_products != null){
|
||||
$product_list = '
|
||||
<select name="productcode">
|
||||
<option value="" disabled selected>'.$equipment_label4.'</option>';
|
||||
foreach ($query_products as $product){
|
||||
$product_list .= '<option value="'.$product->productcode.'">'.$product->productname.'</option>';
|
||||
}
|
||||
$product_list .= '</select>';
|
||||
}
|
||||
|
||||
// Handle success messages
|
||||
if (isset($_GET['success_msg'])) {
|
||||
if ($_GET['success_msg'] == 1) {
|
||||
@@ -119,7 +138,9 @@ $view .= '
|
||||
<option value="4"'.($status==4?' selected':'').'>'.$status4_text.'</option>
|
||||
<option value="5"'.($status==5?' selected':'').'>'.$status5_text.'</option>
|
||||
</select>
|
||||
'.$product_list.'
|
||||
<button type="submit">'.$button_apply.'</button>
|
||||
<a class="cancel_link" style="color: #FFFFFF;text-decoration: none;" href="index.php?page=equipments">'.$general_filters_clear.'</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sort">
|
||||
|
||||
@@ -41,6 +41,8 @@ $general_updated = 'Update';
|
||||
$general_updatedby = 'Update door';
|
||||
|
||||
$general_filters = 'Filters';
|
||||
$general_filters_clear = 'opheffen';
|
||||
|
||||
$general_sort = 'Sorteren';
|
||||
$general_page = 'Pagina ';
|
||||
$general_page_of = ' van ';
|
||||
|
||||
@@ -41,6 +41,8 @@ $general_updated = 'Updated';
|
||||
$general_updatedby = 'Updatedby';
|
||||
|
||||
$general_filters = 'Filters';
|
||||
$general_filters_clear = 'clear';
|
||||
|
||||
$general_sort = 'Sort';
|
||||
$general_page = 'Page ';
|
||||
$general_page_of = ' of ';
|
||||
|
||||
@@ -2671,3 +2671,15 @@ h4.label {
|
||||
#support_btn img:hover{
|
||||
transform: scale(1.5);
|
||||
}
|
||||
|
||||
.cancel_link {
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
background: #b44a4a;
|
||||
border: 0;
|
||||
padding: 5px 0;
|
||||
font-size: 9px;
|
||||
margin-top: 5px;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
}
|
||||
Reference in New Issue
Block a user