CMXX - Catalog API
This commit is contained in:
@@ -272,7 +272,7 @@ else {
|
||||
}
|
||||
|
||||
//SQL for Paging
|
||||
$sql = 'SELECT e.rowID as equipmentID, e.*, p.productcode, p.productname from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY '.$sort.' LIMIT :page,:num_products';
|
||||
$sql = 'SELECT e.rowID as equipmentID, e.*, p.productcode, p.productname, p.product_media from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY '.$sort.' LIMIT :page,:num_products';
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
|
||||
141
api/v2/get/catalog.php
Normal file
141
api/v2/get/catalog.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
defined($security_key) or exit;
|
||||
|
||||
//------------------------------------------
|
||||
// Catalog
|
||||
//------------------------------------------
|
||||
|
||||
//------------------------------------------
|
||||
//Create Catalog
|
||||
//------------------------------------------
|
||||
$catalog = []; // Main catalog array
|
||||
|
||||
//------------------------------------------
|
||||
//GET ACTIVE AND SALES RELATED PRODUCTS
|
||||
//------------------------------------------
|
||||
|
||||
$filter = (isset($get_content) && $get_content !='') ? '&'.$get_content : '';
|
||||
|
||||
//GET PRODUCTS
|
||||
$api_url = '/v2/products/salesflag=1&status=1'.$filter;
|
||||
$products = ioApi($api_url,'',$clientsecret);
|
||||
$products = json_decode($products,true);
|
||||
|
||||
foreach ($products as $product) {
|
||||
|
||||
//------------------------------------------
|
||||
// Create product entry in catalog if it doesn't exist
|
||||
//------------------------------------------
|
||||
if (!isset($catalog[$product['rowID']])) {
|
||||
$catalog[$product['rowID']] = $product;
|
||||
$catalog[$product['rowID']]['versions'] = []; // Changed to versions array
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
//Check for configurations and add to product
|
||||
//------------------------------------------
|
||||
if (isset($product['configurable']) && $product['configurable'] == 1){
|
||||
|
||||
//GET ACTIVE CONFIGURATIONS ITEMS BASED ON ACTIVE VERSIONS
|
||||
$api_url = '/v2/products_configurations/status=1&version_status=1&productrowid='.$product['rowID'] ;
|
||||
$product_config = ioApi($api_url,'',$clientsecret);
|
||||
$product_config = json_decode($product_config,true);
|
||||
|
||||
//------------------------------------------
|
||||
// Group configurations by version
|
||||
//------------------------------------------
|
||||
$version_configurations = [];
|
||||
|
||||
foreach ($product_config as $item) {
|
||||
if ($item['productrowid'] == $product['rowID']) {
|
||||
// Initialize version array if it doesn't exist
|
||||
if (!isset($version_configurations[$item['version']])) {
|
||||
$version_configurations[$item['version']] = [
|
||||
'version_id' => $item['version'],
|
||||
'config_setting' => $item['config'],
|
||||
'configurations' => []
|
||||
];
|
||||
}
|
||||
|
||||
if ($item['type'] == 'product') {
|
||||
$version_configurations[$item['version']]['configurations'][] = $item;
|
||||
}
|
||||
|
||||
if ($item['type'] == 'group') {
|
||||
$api_url = '/v2/products_attributes_items/item_status=1&list=catalog&group_id='.$item['assignment'];
|
||||
$attributes = ioApi($api_url,'',$clientsecret);
|
||||
$attributes = json_decode($attributes,true);
|
||||
|
||||
// Add attributes to the group item
|
||||
$item['attributes'] = $attributes;
|
||||
$version_configurations[$item['version']]['configurations'][] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add all version configurations to the catalog
|
||||
$catalog[$product['rowID']]['versions'] = array_values($version_configurations);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// Lookup pricing (active pricelist and pricelistitems only)
|
||||
//------------------------------------------
|
||||
$api_url = '/v2/pricelists/status=1&item_status=1&list=price';
|
||||
$pricelist = ioApi($api_url,'',$clientsecret);
|
||||
$pricelist = json_decode($pricelist,true);
|
||||
|
||||
foreach ($pricelist as $price) {
|
||||
|
||||
// Add price to product level
|
||||
if (isset($catalog[$price['product_id']])) {
|
||||
$catalog[$price['product_id']]['price'] = $price['price'];
|
||||
$catalog[$price['product_id']]['rrp'] = $price['rrp'];
|
||||
$catalog[$price['product_id']]['price_modifier'] = $price['price_modifier'];
|
||||
}
|
||||
|
||||
//Check for configuration (can also include products as above)
|
||||
foreach ($catalog as &$items) {
|
||||
if (!empty($items['versions'])) {
|
||||
foreach ($items['versions'] as &$version) {
|
||||
foreach ($version['configurations'] as &$config) {
|
||||
//UPDATE PRODUCT PRICES IN CONFIGURATION
|
||||
if ($config['type'] == 'product' && $config['assignment'] == $price['product_id']) {
|
||||
$config['price'] = $price['price'];
|
||||
$config['rrp'] = $price['rrp'];
|
||||
$config['price_modifier'] = $price['price_modifier'];
|
||||
}
|
||||
|
||||
//UPDATE PRICES OF ATTRIBUTES IN GROUPS
|
||||
if ($config['type'] == 'group') {
|
||||
//check all attributes
|
||||
foreach($config['attributes'] as &$attribute) {
|
||||
if ($attribute['attribute_id'] == $price['product_id']) {
|
||||
$attribute['price'] = $price['price'];
|
||||
$attribute['rrp'] = $price['rrp'];
|
||||
$attribute['price_modifier'] = $price['price_modifier'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------
|
||||
//REMOVE KEYS FROM OUTPUT
|
||||
//------------------------------------------
|
||||
$keys_to_remove = ['status','item_status','group_status','version','config','sn','build','softwareversion','healthindex','salesflag','configurable','updatedby','createdby','updated','created'];
|
||||
removeKeysRecursive($catalog,$keys_to_remove);
|
||||
|
||||
//------------------------------------------
|
||||
//JSON_ENCODE
|
||||
//------------------------------------------
|
||||
$messages = json_encode($catalog, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
//------------------------------------------
|
||||
//Send results
|
||||
//------------------------------------------
|
||||
echo $messages;
|
||||
|
||||
?>
|
||||
@@ -267,7 +267,7 @@ else {
|
||||
}
|
||||
|
||||
//SQL for Paging
|
||||
$sql = 'SELECT e.rowID as equipmentID, e.*, p.productcode, p.productname from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY '.$sort.' LIMIT :page,:num_products';
|
||||
$sql = 'SELECT e.rowID as equipmentID, e.*, p.productcode, p.productname, p.product_media from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY '.$sort.' LIMIT :page,:num_products';
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
|
||||
@@ -23,7 +23,7 @@ switch ($permission) {
|
||||
break;
|
||||
default:
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
||||
$whereclause = 'WHERE accounthierarchy like "'.$condition.'"';
|
||||
$whereclause = 'WHERE pls.accounthierarchy like "'.$condition.'"';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -46,10 +46,14 @@ if(isset($get_content) && $get_content!=''){
|
||||
}
|
||||
elseif ($v[0] == 'name') {
|
||||
//build up search
|
||||
$clause .= ' AND name like :'.$v[0];
|
||||
$clause .= ' AND pls.name like :'.$v[0];
|
||||
}
|
||||
elseif ($v[0] == 'item_status') {
|
||||
//build up search
|
||||
$clause .= ' AND pli.status = :'.$v[0];
|
||||
}
|
||||
else {//create clause
|
||||
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
||||
$clause .= ' AND pls.'.$v[0].' = :'.$v[0];
|
||||
}
|
||||
}
|
||||
if ($whereclause == '' && $clause !=''){
|
||||
@@ -61,11 +65,15 @@ if(isset($get_content) && $get_content!=''){
|
||||
//Define Query
|
||||
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
||||
//Request for total rows
|
||||
$sql = 'SELECT count(*) as count FROM pricelists '.$whereclause.'';
|
||||
$sql = 'SELECT count(*) as count FROM pricelists pls '.$whereclause.'';
|
||||
}
|
||||
elseif (isset($criterias['list']) && $criterias['list'] =='price'){
|
||||
$sql = 'SELECT pls.*,pli.* FROM pricelists pls JOIN pricelists_items pli ON pls.rowID = pli.pricelist_ID '.$whereclause;
|
||||
|
||||
}
|
||||
else {
|
||||
//SQL for Paging
|
||||
$sql = 'SELECT * FROM pricelists '.$whereclause.' LIMIT :page,:num_products';
|
||||
$sql = 'SELECT * FROM pricelists pls '.$whereclause.' LIMIT :page,:num_products';
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
@@ -96,6 +104,12 @@ if(isset($criterias['totals']) && $criterias['totals']==''){
|
||||
$messages = $stmt->fetch();
|
||||
$messages = $messages[0];
|
||||
}
|
||||
elseif(isset($criterias['list'])){
|
||||
//Excute Query
|
||||
$stmt->execute();
|
||||
//Get results
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
else {
|
||||
$current_page = isset($criterias['p']) && is_numeric($criterias['p']) ? (int)$criterias['p'] : 1;
|
||||
$stmt->bindValue('page', ($current_page - 1) * $page_rows_pricelists, PDO::PARAM_INT);
|
||||
|
||||
@@ -48,6 +48,11 @@ if(isset($get_content) && $get_content!=''){
|
||||
//build up search
|
||||
$clause .= ' AND productcode like :'.$v[0];
|
||||
}
|
||||
elseif ($v[0] == 'list' && $v[1] == 'price') {
|
||||
//Add default selection criteria for LIST
|
||||
$clause .= ' AND salesflag = 1';
|
||||
$clause .= ' AND item_status = 1';
|
||||
}
|
||||
else {//create clause
|
||||
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
||||
}
|
||||
@@ -68,8 +73,32 @@ elseif (isset($criterias['list']) && $criterias['list'] =='') {
|
||||
$sql = 'SELECT * FROM products '.$whereclause.'';
|
||||
}
|
||||
elseif (isset($criterias['list']) && $criterias['list'] =='price'){
|
||||
|
||||
//SET SPECIFIC WHERECLAUSE
|
||||
if ($whereclause == ''){
|
||||
$whereclause_1 = 'WHERE salesflag = 1';
|
||||
$whereclause_2 = 'WHERE item_status = 1';
|
||||
} else {
|
||||
$whereclause_1 = $whereclause .' AND salesflag = 1 AND status = 1 ';
|
||||
$whereclause_2 = $whereclause .' AND item_status = 1';
|
||||
}
|
||||
|
||||
//GET ALL PRODUCTS AND PRODUCT ATTRIBUTES FOR PRICING
|
||||
$sql = '(SELECT rowID as product_id, productname as product_name FROM products where salesflag = 1 '.$whereclause.' ) UNION (SELECT attribute_id as product_id, item_name as product_name FROM `products_attributes_items` WHERE item_status = 1 '.$whereclause.' )';
|
||||
$sql = '(SELECT rowID as product_id, productname as product_name FROM products '.$whereclause_1.' ) UNION (SELECT attribute_id as product_id, item_name as product_name FROM `products_attributes_items` '.$whereclause_2.' )';
|
||||
}
|
||||
elseif (isset($criterias['list']) && $criterias['list'] =='config'){
|
||||
|
||||
//SET SPECIFIC WHERECLAUSE
|
||||
if ($whereclause == ''){
|
||||
$whereclause_1 = 'WHERE salesflag = 1 AND status = 1 AND configurable = 0 ';
|
||||
$whereclause_2 = 'WHERE group_status = 1';
|
||||
} else {
|
||||
$whereclause_1 = $whereclause .' AND salesflag = 1 AND status = 1 AND configurable = 0 ';
|
||||
$whereclause_2 = $whereclause .' AND group_status = 1';
|
||||
}
|
||||
|
||||
//GET ALL PRODUCTS AND PRODUCT ATTRIBUTES FOR PRICING
|
||||
$sql = '(SELECT rowID as product_id, productname as product_name FROM products '.$whereclause_1.' ) UNION (SELECT group_id as product_id, group_name as product_name FROM `products_attributes_groups` '.$whereclause_2.' )';
|
||||
}
|
||||
else {
|
||||
//SQL for Paging
|
||||
|
||||
@@ -43,15 +43,16 @@ if(isset($get_content) && $get_content!=''){
|
||||
|
||||
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='totals' || $v[0] =='list' || $v[0] =='media'|| $v[0] =='success_msg'){
|
||||
//do nothing
|
||||
}
|
||||
elseif ($v[0] == 'search') {
|
||||
//build up search
|
||||
$clause .= ' AND translation like :'.$v[0];
|
||||
}
|
||||
else {//create clause
|
||||
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
||||
$clause .= ' AND pat.'.$v[0].' = :'.$v[0];
|
||||
}
|
||||
}
|
||||
//WHEN LIST = CATALOG change select based on GROUPS instead of ITEMS
|
||||
if ($criterias['list'] && $criterias['list'] == 'catalog'){
|
||||
$clause = str_replace('pat.group_id','pag.group_id',$clause);
|
||||
}
|
||||
//CREATE WHERE CLAUSE
|
||||
if ($whereclause == '' && $clause !=''){
|
||||
$whereclause = 'WHERE '.substr($clause, 4);
|
||||
} else {
|
||||
@@ -60,14 +61,20 @@ if(isset($get_content) && $get_content!=''){
|
||||
}
|
||||
//Define Query
|
||||
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
||||
//Request for total rows
|
||||
//Request for total rows
|
||||
$sql = 'SELECT count(*) as count FROM products_attributes_items '.$whereclause.'';
|
||||
|
||||
} elseif ($criterias['media'] && $criterias['media'] =='all'){
|
||||
//GET ALL MEDIA ITEMS RELATED TO ATTRIBUTES
|
||||
$sql = 'SELECT pat.*, m.full_path FROM products_attributes_items pat LEFT JOIN media m ON pat.item_media = m.rowID '.$whereclause;
|
||||
}
|
||||
else {
|
||||
|
||||
} elseif ($criterias['list'] && $criterias['list'] =='catalog'){
|
||||
//GET ALL ATTRIBUTE DATA FOR CATALOG GROUPS,ITEMS,MEDIA
|
||||
$sql = 'SELECT pag.*, pat.*, m.title, m.full_path FROM products_attributes_groups pag JOIN products_attributes_items pat ON pag.rowID = pat.group_id LEFT JOIN media m ON pat.item_media = m.rowID '.$whereclause;
|
||||
|
||||
} else {
|
||||
//SQL for Paging
|
||||
$sql = 'SELECT * FROM products_attributes_items '.$whereclause.' LIMIT :page,:num_products';
|
||||
$sql = 'SELECT * FROM products_attributes_items pat '.$whereclause.' LIMIT :page,:num_products';
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
@@ -104,6 +111,12 @@ elseif($criterias['media'] && $criterias['media'] =='all'){
|
||||
//Get results
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
elseif($criterias['list'] && $criterias['list'] =='catalog'){
|
||||
//Excute Query
|
||||
$stmt->execute();
|
||||
//Get results
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
else {
|
||||
$current_page = isset($criterias['p']) && is_numeric($criterias['p']) ? (int)$criterias['p'] : 1;
|
||||
$stmt->bindValue('page', ($current_page - 1) * $page_rows_products_attributes, PDO::PARAM_INT);
|
||||
|
||||
@@ -23,7 +23,7 @@ switch ($permission) {
|
||||
break;
|
||||
default:
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
||||
$whereclause = 'WHERE accounthierarchy like "'.$condition.'"';
|
||||
$whereclause = 'WHERE pc.accounthierarchy like "'.$condition.'"';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -43,13 +43,11 @@ if(isset($get_content) && $get_content!=''){
|
||||
|
||||
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='totals' || $v[0] =='list' || $v[0] =='history'|| $v[0] =='success_msg'){
|
||||
//do nothing
|
||||
}
|
||||
elseif ($v[0] == 'search') {
|
||||
//build up search
|
||||
$clause .= ' AND productcode like :'.$v[0];
|
||||
} elseif($v[0] == 'version_status'){
|
||||
$clause .= ' AND pv.status = :'.$v[0];
|
||||
}
|
||||
else {//create clause
|
||||
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
||||
$clause .= ' AND pc.'.$v[0].' = :'.$v[0];
|
||||
}
|
||||
}
|
||||
if ($whereclause == '' && $clause !=''){
|
||||
@@ -75,15 +73,25 @@ if (isset($criterias['productrowid']) && $criterias['productrowid'] != ''){
|
||||
//Define Query
|
||||
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
||||
//Request for total rows
|
||||
$sql = 'SELECT count(*) as count FROM products_configurations '.$whereclause.'';
|
||||
$sql = 'SELECT count(*) as count FROM products_configurations pc '.$whereclause.'';
|
||||
}
|
||||
elseif (isset($criterias['list']) && $criterias['list'] =='') {
|
||||
//SQL for Paging
|
||||
$sql = 'SELECT * FROM products_configurations '.$whereclause.'';
|
||||
$sql = 'SELECT * FROM products_configurations pc '.$whereclause.'';
|
||||
}
|
||||
else {
|
||||
//SQL for Paging
|
||||
$sql = 'SELECT * FROM products_configurations '.$whereclause.'';
|
||||
//SQL for Paging include name from different tables
|
||||
$sql = 'SELECT pc.*, pv.config,
|
||||
CASE WHEN p.rowID IS NOT NULL THEN p.productname
|
||||
WHEN pag.group_id IS NOT NULL THEN pag.group_name
|
||||
END AS assignment_name,
|
||||
CASE WHEN p.rowID IS NOT NULL THEN "product"
|
||||
WHEN pag.group_id IS NOT NULL THEN "group"
|
||||
END AS type
|
||||
FROM products_configurations pc
|
||||
LEFT JOIN products p ON p.rowID = pc.assignment
|
||||
LEFT JOIN products_attributes_groups pag ON pag.group_id = pc.assignment
|
||||
LEFT JOIN products_versions pv ON pv.rowID = pc.version '.$whereclause.'';
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
|
||||
@@ -2961,4 +2961,26 @@ function generateLanguageFile($language_key,$token){
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Removekeys from array ++++++++++++++
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
function removeKeysRecursive(array &$array, array $keysToRemove): void {
|
||||
foreach ($array as $key => &$value) {
|
||||
// Remove the key if it exists in our removal list
|
||||
if (in_array($key, $keysToRemove, true)) {
|
||||
unset($array[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If value is an array, recursively process it
|
||||
if (is_array($value)) {
|
||||
removeKeysRecursive($value, $keysToRemove);
|
||||
|
||||
// If array is empty after processing, remove it
|
||||
if (empty($value)) {
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
89
catalog.php
Normal file
89
catalog.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
defined(page_security_key) or exit;
|
||||
|
||||
if (debug && debug_id == $_SESSION['id']){
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
}
|
||||
|
||||
include_once './assets/functions.php';
|
||||
include_once './settings/settings.php';
|
||||
|
||||
//SET ORIGIN FOR NAVIGATION
|
||||
$prev_page = $_SESSION['prev_origin'] ?? '';
|
||||
$page = $_SESSION['origin'] = 'catalog';
|
||||
|
||||
/*Check if allowed
|
||||
if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
|
||||
header('location: index.php');
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
//GET PARAMETERS
|
||||
$pagination_page = isset($_GET['p']) ? $_GET['p'] : 1;
|
||||
$search = isset($_GET['search']) ? '&search='.$_GET['search'] : '';
|
||||
|
||||
// Determine the URL
|
||||
$url = 'index.php?page=catalog'.$search;
|
||||
//GET Details from URL
|
||||
$GET_VALUES = urlGETdetails($_GET) ?? '';
|
||||
//CALL TO API
|
||||
$api_url = '/v2/catalog/'.$GET_VALUES;
|
||||
$catalog = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($catalog)){$catalog = json_decode($catalog,true);}else{$catalog = null;}
|
||||
|
||||
//Return QueryTotal from API
|
||||
$api_url = '/v2/products/'.$GET_VALUES.'&totals=&salesflag=1&status=1';
|
||||
$query_total = ioServer($api_url,'');
|
||||
|
||||
//Decode Payload
|
||||
if (!empty($query_total)){$query_total = json_decode($query_total,true);}else{$query_total = null;}
|
||||
|
||||
template_header('Catalog', 'catalog','view');
|
||||
$view = '
|
||||
<div class="content-title">
|
||||
<div class="title">
|
||||
<i class="fa-solid fa-box-open"></i>
|
||||
<div class="txt">
|
||||
<h2>'.($catalog_h2 ?? 'Catalog').' ('.$query_total.')</h2>
|
||||
<p>'.($catalog_p ?? '').'</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
if (isset($success_msg)){
|
||||
$view .= ' <div class="msg success">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
<p>'.$success_msg.'</p>
|
||||
<i class="fas fa-times"></i>
|
||||
</div>';
|
||||
}
|
||||
$description = json_encode($catalog, JSON_PRETTY_PRINT);
|
||||
$view .= '
|
||||
<div class="content-block">
|
||||
<pre>' . $description . '</pre>
|
||||
</div>
|
||||
';
|
||||
|
||||
$view.='<div class="pagination">';
|
||||
if ($pagination_page > 1) {
|
||||
$page = $pagination_page-1;
|
||||
$view .= '<a href="'.$url.'&p=1">'.$general_first.'</a>';
|
||||
$view .= '<a href="'.$url.'&p='.$page.'">'.$general_prev.'</a>';
|
||||
}
|
||||
$totals = ceil($query_total / $page_rows_products) == 0 ? 1 : ceil($query_total / $page_rows_products);
|
||||
$view .= '<span> '.$general_page.$pagination_page.$general_page_of.$totals.'</span>';
|
||||
if ($pagination_page * $page_rows_products < $query_total){
|
||||
$page = $pagination_page+1;
|
||||
$view .= '<a href="'.$url.'&p='.$page.'">'.$general_next.'</a>';
|
||||
$view .= '<a href="'.$url.'&p='.$totals.'">'.$general_last.'</a>';
|
||||
|
||||
}
|
||||
$view .= '</div>';
|
||||
//OUTPUT
|
||||
echo $view;
|
||||
|
||||
template_footer();
|
||||
?>
|
||||
@@ -38,6 +38,14 @@ $responses = ioServer($api_url,'');
|
||||
if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;}
|
||||
$responses = $responses[0];
|
||||
|
||||
//CALL TO API FOR RELATED
|
||||
$api_url = '/v2/media/rowID='.$responses->product_media;
|
||||
$media_responses = ioServer($api_url,'');
|
||||
|
||||
//Decode Payload
|
||||
if (!empty($media_responses)){$media_responses = json_decode($media_responses,true);}else{$media_responses = null;}
|
||||
$media_responses = $media_responses[0];
|
||||
|
||||
//CALL TO API FOR History
|
||||
$api_url = '/v1/equipments/equipmentID='.$responses->equipmentID.'&type=ServiceReport&history=1';
|
||||
$history = ioServer($api_url,'');
|
||||
@@ -172,15 +180,14 @@ $view .= ' <div class="content-block order-details">
|
||||
<h3>'.$product_name.'</h3>
|
||||
<p>'.(($view_product == 1)? '<a href="index.php?page=product&rowID='.$responses->productrowid.'" class="btn2">'.(${$responses->productname} ?? $responses->productname).'</a>':(${$responses->productname} ?? $responses->productname)).'</p>
|
||||
</div>';
|
||||
|
||||
$picture = glob("./assets/images/products/".$responses->productcode.".{jpg,jpeg,png,gif}", GLOB_BRACE);
|
||||
if (!empty($picture)){
|
||||
if (!empty($media_responses['full_path'])){
|
||||
$view .='
|
||||
<div class="order-detail">
|
||||
<img style="border-radius: 4px;height: 100px;" src="'.$picture[0].'" alt="">
|
||||
<img style="border-radius: 4px;height: 200px;margin: auto;" src="'.$media_responses['full_path'].'" alt="">
|
||||
</div>
|
||||
';
|
||||
}
|
||||
|
||||
$view .='
|
||||
</div>
|
||||
';
|
||||
|
||||
@@ -77,6 +77,14 @@ if ($query_products != null){
|
||||
$product_list .= '</select>';
|
||||
}
|
||||
|
||||
//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) {
|
||||
@@ -223,7 +231,14 @@ if ($response->productcode == 0 && $response->status == 2) {$location = $product
|
||||
//Check for Section
|
||||
if (isset($partner_data->section)){$section = getPartnerName($partner_data->section) ?? $not_specified;} else {$section = $not_specified;}
|
||||
|
||||
$picture = glob("./assets/images/products/".$response->productcode.".{jpg,jpeg,png,gif}", GLOB_BRACE);
|
||||
//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);
|
||||
|
||||
@@ -231,14 +246,8 @@ $view .= '<tr>
|
||||
<td class="responsive-hidden">'.$indicators.'</td>
|
||||
<td>'.$response->serialnumber.'</td>
|
||||
<td><span class="status id'.$response->status.'">'.$$status_text.'</span></td>
|
||||
<td>'.$response->productcode.'-'.(${$response->productname} ?? $response->productname).'</td>';
|
||||
$view .= ' <td class="responsive-hidden">';
|
||||
if (!empty($picture)){
|
||||
$view .='
|
||||
<img style="border-radius: 4px;height: 40px;" src="'.$picture[0].'" alt="">
|
||||
';
|
||||
}
|
||||
$view .= ' </td>
|
||||
<td>'.$response->productcode.'-'.(${$response->productname} ?? $response->productname).'</td>
|
||||
<td class="responsive-hidden">'.(($full_path !='')?'<img style="border-radius: 4px;height: 50px;" src="'.$full_path.'" alt="">' : '').'</td>
|
||||
<td class="responsive-hidden">'.$location.'</td>
|
||||
<td class="responsive-hidden">'.$section.'</td>
|
||||
<td><a href="index.php?page=equipment&equipmentID='.$response->equipmentID.'" class="btn_link">'.$general_view .'</a></td>
|
||||
|
||||
27
product.php
27
product.php
@@ -42,6 +42,14 @@ $responses = ioServer($api_url,'');
|
||||
if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;}
|
||||
$responses = $responses[0];
|
||||
|
||||
//CALL TO API FOR RELATED
|
||||
$api_url = '/v2/media/rowID='.$responses->product_media;
|
||||
$media_responses = ioServer($api_url,'');
|
||||
|
||||
//Decode Payload
|
||||
if (!empty($media_responses)){$media_responses = json_decode($media_responses,true);}else{$media_responses = null;}
|
||||
$media_responses = $media_responses[0];
|
||||
|
||||
//CALL TO API FOR Product_versions
|
||||
$api_url = '/v1/products_versions/productrowid='.$_GET['rowID'];
|
||||
$product_versions = ioServer($api_url,'');
|
||||
@@ -61,7 +69,7 @@ $products_configurations = ioServer($api_url,'');
|
||||
if (!empty($products_configurations)){$products_configurations = json_decode($products_configurations,true);}else{$products_configurations = null;}
|
||||
|
||||
//------------------------------
|
||||
//Variables
|
||||
// Variables
|
||||
//------------------------------
|
||||
$status_text = 'prod_status_'.$responses->status ?? '';
|
||||
$product_category_text = 'product_category'.$responses->product_category ?? '';
|
||||
@@ -130,6 +138,10 @@ $view .= ' <div class="content-block order-details">
|
||||
<div class="order-detail">
|
||||
<h3>'.$product_name.'</h3>
|
||||
<p>'.(${$responses->productname} ?? $responses->productname).'</p>
|
||||
</div>
|
||||
<div class="order-detail">
|
||||
<h3>'.($product_slug ?? 'Product_slug').'</h3>
|
||||
<p>'.(${$responses->url_slug} ?? $responses->url_slug).'</p>
|
||||
</div>';
|
||||
|
||||
$view .='
|
||||
@@ -140,11 +152,10 @@ $view .='<div class="content-block order-details">
|
||||
<div class="block-header">
|
||||
<i class="fa-solid fa-user fa-sm"></i>
|
||||
</div>';
|
||||
$picture = glob("./assets/images/products/".$responses->productcode.".{jpg,jpeg,png,gif}", GLOB_BRACE);
|
||||
if (!empty($picture)){
|
||||
if (!empty($media_responses['full_path'])){
|
||||
$view .='
|
||||
<div class="order-detail">
|
||||
<img style="border-radius: 4px;height: 200px;margin: auto;" src="'.$picture[0].'" alt="">
|
||||
<img style="border-radius: 4px;height: 200px;margin: auto;" src="'.$media_responses['full_path'].'" alt="">
|
||||
</div>
|
||||
';
|
||||
}
|
||||
@@ -175,6 +186,8 @@ if ($responses->configurable == 1){
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.($product_configuration_version ?? 'Config-version').'</th>
|
||||
<th>'.($product_configuration_assignment ?? 'Code').'</th>
|
||||
<th>'.($product_configuration_assignment ?? 'Name').'</th>
|
||||
<th>'.$general_actions.'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -182,8 +195,10 @@ if ($responses->configurable == 1){
|
||||
foreach ($products_configurations as $product_config){
|
||||
|
||||
$view .= '<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>'.$product_config['version'].'</td>
|
||||
<td>'.$product_config['assignment'].'</td>
|
||||
<td>'.(${$product_config['assignment_name']} ?? $product_config['assignment_name']).'</td>
|
||||
<td><a href="index.php?page=products_configurations&productrowid='.$_GET['rowID'].'&rowID='.$product_config['rowID'].'" class="btn_link">'.$general_view.'</a></td>
|
||||
</tr>';
|
||||
}
|
||||
$view .= '
|
||||
|
||||
@@ -26,6 +26,8 @@ $product = [
|
||||
'productname' => '',
|
||||
'productdescription' => '',
|
||||
'softwareversion' => 'v1.0',
|
||||
'product_media' =>'',
|
||||
'full_path' =>'',
|
||||
'created' => '',
|
||||
'createdby' => $_SESSION['username'],
|
||||
'parttype' => 1,
|
||||
@@ -52,6 +54,20 @@ if (isset($_GET['id'])) {
|
||||
|
||||
$product = json_decode(json_encode($responses[0]), true);
|
||||
|
||||
//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;}
|
||||
|
||||
//GET PATH OF ASSIGNED MEDIA
|
||||
foreach ($media_responses as $media){
|
||||
if($media['rowID'] == $product['product_media']){
|
||||
$product['full_path'] = $media['full_path'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($update_allowed === 1){
|
||||
if (isset($_POST['file_upload'])){
|
||||
uploadProduct($_POST['productcode']);
|
||||
@@ -161,17 +177,21 @@ $view .= '<div class="content-block tab-content active">
|
||||
<input id="name" type="text" name="productcode" placeholder="'.$product_code.'" value="'.$product['productcode'].'" required>
|
||||
<label for="productname"><i class="required">*</i>'.$product_name.'</label>
|
||||
<input id="name" type="text" name="productname" placeholder="'.$product_name.'" value="'.$product['productname'].'" required>
|
||||
<label for="productname"><i class="required">*</i>'.($product_slug ?? 'Product_slug').'</label>
|
||||
<input id="name" type="text" name="url_slug" placeholder="'.($product_slug ?? 'Product_slug').'" value="'.$product['url_slug'].'">
|
||||
<label for="productdescription">'.$product_description.'</label>
|
||||
<textarea id="description" name="productdescription" placeholder="'.$product_description.'">'.$product['productdescription'].'</textarea>
|
||||
<label for="softwareversion">'.$product_software.'</label>
|
||||
<input id="name" type="text" name="softwareversion" placeholder="'.$product_software.'" value="'.$product['softwareversion'].'">
|
||||
<label for="price"><i class="required">*</i> '.$product_price.' </label>
|
||||
<input id="price" type="number" name="price" placeholder="'.$product_price.'" min="0" step=".01" value="'.$product['price'].'" required>
|
||||
<input type="hidden" name="rowID" value="'.$product['rowID'].'">
|
||||
<input type="hidden" name="rowID" value="'.$product['rowID'].'">
|
||||
<input id="source_'.$product['rowID'].'" type="hidden" name="product_media" value="'.$product['product_media'].'">
|
||||
<img id="image_'.$product['rowID'].'" src="'.$product['full_path'].'" alt="" style="display: block; max-width: 75px;">
|
||||
<button type="button" class="btn" id="openSelectorBtn" onclick="setSourceID(\''.$product['rowID'].'\'), openDialog(\'image_'.$product['rowID'].'\')">'.($button_assign_image ?? 'Assign Image').'</button>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
$view .= '<div class="content-block tab-content">
|
||||
<div class="form responsive-width-100">
|
||||
<label for="serialized">'.($product_configurable ?? 'Configurable').'</label>
|
||||
@@ -216,13 +236,65 @@ $view .= '<div class="content-block tab-content">
|
||||
</div>';
|
||||
$view .= '</form>';
|
||||
|
||||
$view .= '<form action="" method="post" style="padding: 20px;" enctype="multipart/form-data">
|
||||
<input type="hidden" value="'.$product['rowID'].'" name="file_upload" />
|
||||
<input type="hidden" name="productcode" value="'.$product["productcode"].'"/>
|
||||
<input type="file" name="fileToUpload" id="fileToUpload" onchange="this.form.submit()" accept=".jpg, .jpeg, .png">
|
||||
</form>
|
||||
$view .= '<!-- Image Selector Dialog -->
|
||||
<dialog id="imageSelector" style="padding: 20px; max-width: 800px;">
|
||||
<h3>Select an Image</h3>
|
||||
<div style="display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 20px 0;">';
|
||||
|
||||
foreach ($media_responses as $media_response){
|
||||
$view .= '
|
||||
<img src="'.$media_response['full_path'].'" id="'.$media_response['rowID'].'" style="width: 100%; cursor: pointer; border: 2px solid transparent;" onmouseover="this.style.border=\'2px solid #4CAF50\'" onmouseout="this.style.border=\'2px solid transparent\'" onclick="selectImage(this.id,this.src)">
|
||||
';
|
||||
}
|
||||
$view .= '</div>
|
||||
<button onclick="closeImageSelector()">Close</button>
|
||||
</dialog>
|
||||
';
|
||||
|
||||
|
||||
$view .= '<script>
|
||||
//POPUP FOR IMAGE SELECTION
|
||||
const dialog = document.getElementById(\'imageSelector\');
|
||||
image_source_id = 0;
|
||||
//const openButton = document.getElementById(\'openSelectorBtn\');
|
||||
|
||||
function setSourceID(sourceid){
|
||||
image_source_id = "source_"+sourceid;
|
||||
image_source_src = "image_"+sourceid;
|
||||
}
|
||||
|
||||
function openDialog(){
|
||||
dialog.showModal();
|
||||
}
|
||||
|
||||
function selectImage(id,src) {
|
||||
|
||||
if (image_source_id != 0){
|
||||
const selectedImageInput = document.getElementById(image_source_id);
|
||||
const previewImage = document.getElementById(image_source_src);
|
||||
|
||||
selectedImageInput.value = id;
|
||||
previewImage.src = src;
|
||||
|
||||
}
|
||||
else {
|
||||
const selectedImageInput = document.getElementById(\'selectedImage\');
|
||||
const previewImage = document.getElementById(\'previewImage\');
|
||||
|
||||
selectedImageInput.value = id;
|
||||
previewImage.src = src;
|
||||
previewImage.style.display = \'block\';
|
||||
}
|
||||
|
||||
dialog.close();
|
||||
}
|
||||
|
||||
function closeImageSelector() {
|
||||
dialog.close();
|
||||
}
|
||||
|
||||
</script>';
|
||||
|
||||
//Output
|
||||
echo $view;
|
||||
template_footer()?>
|
||||
21
products.php
21
products.php
@@ -41,6 +41,13 @@ $query_total = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($query_total)){$query_total = decode_payload($query_total);}else{$query_total = null;}
|
||||
|
||||
//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) {
|
||||
@@ -125,15 +132,23 @@ $view .= '
|
||||
}
|
||||
else {
|
||||
foreach ($responses as $response){
|
||||
$picture = glob('./assets/images/products/'.$response->productcode.'.{jpg,jpeg,png,gif}', GLOB_BRACE);
|
||||
|
||||
|
||||
//GET PATH OF ASSIGNED MEDIA
|
||||
$full_path = '';
|
||||
|
||||
foreach ($media_responses as $media){
|
||||
if($response->product_media == $media['rowID']){
|
||||
$full_path = $media['full_path'];
|
||||
}
|
||||
}
|
||||
|
||||
$view .= '
|
||||
<tr>
|
||||
<td>'.$response->productcode.'</td>
|
||||
<td>'.${'part_type'.$response->parttype}.'</td>
|
||||
<td>'.${'product_category'.$response->product_category}.'</td>
|
||||
<td class="responsive-hidden">
|
||||
'.(($picture)?'<img style="border-radius: 4px;height: 50px;" src="'.$picture[0].'" alt="">' : '').'
|
||||
'.(($full_path !='')?'<img style="border-radius: 4px;height: 50px;" src="'.$full_path.'" alt="">' : '').'
|
||||
</td>
|
||||
<td>'.(${$response->productname} ?? $response->productname).'</td>
|
||||
<td><a href="index.php?page=product&rowID='.$response->rowID.'" class="btn_link">'.$general_view .'</a></td>
|
||||
|
||||
@@ -117,9 +117,9 @@ $view .= '
|
||||
foreach ($responses as $response){
|
||||
$view .= '
|
||||
<tr>
|
||||
<td>'.$response['rowID'].'</td>
|
||||
<td>'.$response['group_id'].'</td>
|
||||
<td>'.${'general_status_'.$response['group_status']}.'</td>
|
||||
<td>'.$response['group_name'].'</td>
|
||||
<td>'.(${$response['group_name']} ?? $response['group_name']).'</td>
|
||||
<td>'.${'general_form_'.$response['group_type']}.'</td>
|
||||
<td class="responsive-hidden">'.getRelativeTime($response['created']).'</td>
|
||||
<td><a href="index.php?page=products_attributes_manage&rowID='.$response['rowID'].'" class="btn_link">'.$general_view .'</a></td>
|
||||
|
||||
@@ -191,7 +191,7 @@ $view .='<div class="content-block tab-content active">
|
||||
</div>
|
||||
<div class="form responsive-width-100">
|
||||
<label for="group_name">'.($products_attributes_group_name ?? 'Groupname').'</label>
|
||||
<input id="group_name" type="text" name="group_name" placeholder="'.($products_attributes_group_name ?? '').'" value="'.$products_attributes['group_name'].'" pattern="^\S+$" required">
|
||||
<input id="group_name" type="text" name="group_name" placeholder="'.($products_attributes_group_name ?? '').'" value="'.$products_attributes['group_name'].'" required">
|
||||
<input type="hidden" name="rowID" value="'.$products_attributes['rowID'].'" readonly>
|
||||
</div>
|
||||
<div class="form responsive-width-100">
|
||||
|
||||
@@ -18,15 +18,30 @@ $products_configurations = [
|
||||
'productrowid' => '',
|
||||
'status' => '',
|
||||
'version' => '',
|
||||
'config' => '',
|
||||
'assignment' => '',
|
||||
'created' => '',
|
||||
'createdby' => $_SESSION['username'],
|
||||
'measurement' => '',
|
||||
'updated' => '',
|
||||
'updatedby' => ''
|
||||
];
|
||||
|
||||
//productrowid is required by api
|
||||
$productrowid = $_GET['productrowid'] ?? '';
|
||||
|
||||
//GET PRODUCTS AND ATTRIBUTES
|
||||
$api_url = '/v2/products/list=config';
|
||||
$products = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($products)){$products = json_decode($products,true);}else{$products = null;}
|
||||
|
||||
//GET RELATED PRODUCT VERSIONS
|
||||
$api_url = '/v2/products_versions/productrowid='.$productrowid;
|
||||
$products_versions = ioServer($api_url,'');
|
||||
|
||||
//Decode Payload
|
||||
if (!empty($products_versions)){$products_versions = json_decode($products_versions,true);}else{$products_versions = null;}
|
||||
|
||||
|
||||
if (isset($_GET['rowID'])) {
|
||||
// ID param exists, edit an existing product
|
||||
//CALL TO API
|
||||
@@ -38,7 +53,23 @@ if (isset($_GET['rowID'])) {
|
||||
|
||||
$products_configurations = json_decode(json_encode($responses[0]), true);
|
||||
|
||||
|
||||
//------------------------------------------
|
||||
//CALL TO API FOR RELATED ATTTRIBUTES_ITEMS
|
||||
//GET rowID of group from assignment
|
||||
//------------------------------------------
|
||||
$api_url = '/v2/products_attributes/group_id='.$products_configurations['assignment'];
|
||||
$group_id = ioServer($api_url,'');
|
||||
|
||||
if (!empty($group_id) && strlen($group_id) > 3){
|
||||
$group_id = json_decode($group_id,true);
|
||||
//get the related attributes
|
||||
$api_url = '/v2/products_attributes_items/media=all&group_id='.$group_id[0]['rowID'];
|
||||
$products_attributes_items = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($products_attributes_items)){$products_attributes_items = json_decode($products_attributes_items,true);}else{$products_attributes_items = null;}
|
||||
|
||||
}
|
||||
|
||||
if ($update_allowed === 1){
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
@@ -77,9 +108,7 @@ if (isset($_GET['rowID'])) {
|
||||
if (isset($_POST['submit']) && $create_allowed === 1) {
|
||||
|
||||
//GET ALL POST DATA
|
||||
$data = json_encode($_POST , JSON_UNESCAPED_UNICODE);
|
||||
//Secure data
|
||||
$payload = generate_payload($data);
|
||||
$payload = json_encode($_POST , JSON_UNESCAPED_UNICODE);
|
||||
//API call
|
||||
$responses = ioServer('/v2/products_configurations', $payload);
|
||||
if ($responses === 'NOK'){
|
||||
@@ -97,7 +126,7 @@ template_header('Products configurations', 'products configurations', 'manage');
|
||||
$view ='
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
|
||||
<h2 class="responsive-width-100">'.$product_version_version.'</h2>
|
||||
<h2 class="responsive-width-100">'.($product_configuration ?? 'Product configuration').'</h2>
|
||||
<a href="index.php?page=product&rowID='.$productrowid.'" class="btn alt mar-right-2">'.$button_cancel.'</a>
|
||||
';
|
||||
|
||||
@@ -123,58 +152,19 @@ $view .= '<div class="content-block tab-content active">
|
||||
<option value="1" '.($products_configurations['status']==1?' selected':'').'>'.$prod_status_1 .'</option>
|
||||
<option value="0" '.($products_configurations['status']==0?' selected':'').'>'.$prod_status_0 .'</option>
|
||||
</select>
|
||||
<label for=""><i class="required">*</i>'.$product_version_version.'</label>
|
||||
<input id="name" type="text" name="version" placeholder="'.$product_version_version.'" value="'.$products_configurations['version'].'" required>
|
||||
|
||||
';
|
||||
//VIEW FOR PRODUCT CONFIGURATION
|
||||
if (isset($_GET['rowID']) && $_GET['rowID'] !=''){
|
||||
|
||||
$view .= '
|
||||
<label for="">'.($product_version_config ?? 'Config').'</label>
|
||||
<div class="table">
|
||||
<textarea id="config" name="config" placeholder="'.($product_version_config ?? 'Config').'">'.$products_configurations['config'].'</textarea>
|
||||
</table>
|
||||
</div>';
|
||||
<label for=""><i class="required">*</i>'.($product_configuration_version ?? 'Version').'</label>
|
||||
<select name="version">';
|
||||
foreach ($products_versions as $product_version){
|
||||
$view .= '<option value="'.$product_version['rowID'].'" '.($product_version['rowID']==$products_configurations['version'] ?' selected':'').'>'.($product_version['version'] ?? '').'</option>
|
||||
';}
|
||||
$view .= ' </select>
|
||||
<label for=""><i class="required">*</i>'.($product_configuration_assignment ?? 'Product assignment').'</label>
|
||||
<select name="assignment">';
|
||||
foreach ($products as $product){
|
||||
$view .= '<option value="'.$product['product_id'].'" '.($product['product_id']==$products_configurations['assignment'] ?' selected':'').'>'.(${$product['product_name']} ?? $product['product_name']).'</option>
|
||||
';}
|
||||
$view .= ' </select>';
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['rowID']) && $_GET['rowID'] !='' && !empty($products_configurations['measurement'])){
|
||||
$measurements = json_decode($products_configurations['measurement'],true);
|
||||
|
||||
$view .= '
|
||||
<label for="">'.$product_version_measurement.'</label>
|
||||
<div class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Test</td>
|
||||
<td>N</td>
|
||||
<td>Average</td>
|
||||
<td>Median</td>
|
||||
<td>STdev</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
foreach ($measurements as $name => $measurement){
|
||||
$view .='
|
||||
<tr>
|
||||
<td>'.$name.'</td>
|
||||
<td>'.$measurement['n'].'</td>
|
||||
<td>'.$measurement['average'].'</td>
|
||||
<td>'.$measurement['median'].'</td>
|
||||
<td>'.$measurement['stdev'].'</td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
$view .= '</tbody>
|
||||
</table>
|
||||
</div>';
|
||||
|
||||
}
|
||||
$view .= '
|
||||
<input type="hidden" name="rowID" value="'.$products_configurations['rowID'].'">
|
||||
<input type="hidden" name="productrowid" value="'.$productrowid.'">
|
||||
@@ -191,6 +181,42 @@ $view .= '<div class="content-block tab-content">
|
||||
</div>';
|
||||
$view .= '</form>';
|
||||
|
||||
if (!empty($products_attributes_items)){
|
||||
$view .= '
|
||||
<div class="content-block">
|
||||
<h2 class="responsive-width-100">'.($products_attributes_group_items ?? 'Groupitems').'</h2>
|
||||
<div class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.($products_attributes_item_name ?? 'name').'</th>
|
||||
<th>'.($products_attributes_item_quantity ?? 'quantity').'</th>
|
||||
<th>'.($products_attributes_item_media ?? 'media').'</th>
|
||||
<th>'.$general_created.'</th>
|
||||
<th>'.$general_actions.'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tableBody">
|
||||
';
|
||||
foreach ($products_attributes_items as $item){
|
||||
$view .= '
|
||||
<tr>
|
||||
<td>'.(${$item['item_name']} ?? $item['item_name']).'</td>
|
||||
<td>'.$item['item_quantity'].'</td>
|
||||
<td><img id="image_'.$item['rowID'].'" src="'.$item['full_path'].'" alt="" style="display: block; max-width: 75px;">
|
||||
</td>
|
||||
<td>'.getRelativeTime($item['created']).'</td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
$view .= '
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
//Output
|
||||
echo $view;
|
||||
template_footer()
|
||||
|
||||
@@ -6,7 +6,7 @@ define('superuser_profile','dashboard,profile,assets,equipments,equipment,equipm
|
||||
/*Admin*/
|
||||
define('admin_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,rmas,rma,rma_manage,rma_history,rma_history_manage,buildtool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,changelog,application');
|
||||
/*AdminPlus*/
|
||||
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,billing,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,rmas,rma,rma_manage,rma_history,rma_history_manage,buildtool,products,products_versions,products_software,products_attributes,products_attributes_items,products_attributes_manage,products_configurations,product,product_manage,pricelists,pricelists_items,pricelists_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,report_usage,config,settings,logfile,changelog,language,translations,translations_details,translation_manage,media,media_manage,application,maintenance,profiles,vin');
|
||||
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,billing,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,rmas,rma,rma_manage,rma_history,rma_history_manage,buildtool,products,products_versions,products_software,products_attributes,products_attributes_items,products_attributes_manage,products_configurations,product,product_manage,pricelists,pricelists_items,pricelists_manage,catalog,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,report_usage,config,settings,logfile,changelog,language,translations,translations_details,translation_manage,media,media_manage,application,maintenance,profiles,vin');
|
||||
/*Build*/
|
||||
define('build','dashboard,profile,buildtool,firmwaretool,buildtool,products_software,application');
|
||||
/*Distribution*/
|
||||
|
||||
@@ -47,6 +47,7 @@ $all_views = [
|
||||
"pricelists",
|
||||
"pricelists_items",
|
||||
"pricelists_manage",
|
||||
"catalog",
|
||||
"servicereports",
|
||||
"servicereport",
|
||||
"admin",
|
||||
|
||||
Reference in New Issue
Block a user