diff --git a/account.php b/account.php
index b037b63..212a49c 100644
--- a/account.php
+++ b/account.php
@@ -235,13 +235,27 @@ $view .= '
';
$soldto_id = explode("-",$account_hierarchy->soldto) ?? '';
+
+//DISPLAY RELATED COMMUNICATION RECORDS
+$view_communication = '';
+if ($_SESSION['permission'] == 3 || $_SESSION['permission'] == 4){
+ $view_communication = '
'.$button_partner_assigned_communication.'';
+}
+
+//DISPLAY RELATED USERS
+$view_users ='';
+if ($_SESSION['permission'] == 3 || $_SESSION['permission'] == 4){
+ $view_users = '
'.$button_partner_assigned_users.'';
+}
+
$view .= '
';
//OUTPUT
diff --git a/api/v1/get/communications.php b/api/v1/get/communications.php
index 50cb443..0025932 100644
--- a/api/v1/get/communications.php
+++ b/api/v1/get/communications.php
@@ -48,6 +48,10 @@ if(isset($get_content) && $get_content!=''){
//build up search
$clause .= ' AND email like :'.$v[0];
}
+ elseif ($v[0] == 'partnerid') {
+ //check partnerID related records
+ $clause .= ' AND partnerID like :'.$v[0];
+ }
else {//create clause
$clause .= ' AND '.$v[0].' = :'.$v[0];
}
@@ -87,6 +91,10 @@ if (!empty($criterias)){
$search_value = '%'.$value.'%';
$stmt->bindValue($key, $search_value, PDO::PARAM_STR);
}
+ elseif ($key == 'partnerid'){
+ $search_value = $value.'-%';
+ $stmt->bindValue($key, $search_value, PDO::PARAM_STR);
+ }
else {
$stmt->bindValue($key, $value, PDO::PARAM_STR);
}
diff --git a/api/v1/get/users.php b/api/v1/get/users.php
index 06c5071..0c35a49 100644
--- a/api/v1/get/users.php
+++ b/api/v1/get/users.php
@@ -51,6 +51,10 @@ if(isset($get_content) && $get_content!=''){
//build up search
$clause .= ' AND username like :'.$v[0];
}
+ elseif ($v[0] == 'partnerid') {
+ //check accounthierarchy related users
+ $clause .= ' AND partnerhierarchy like :'.$v[0];
+ }
else {//create clause
$clause .= ' AND '.$v[0].' = :'.$v[0];
}
@@ -86,6 +90,10 @@ if (!empty($criterias)){
$search_value = '%'.$value.'%';
$stmt->bindValue($key, $search_value, PDO::PARAM_STR);
}
+ elseif ($key == 'partnerid'){
+ $search_value = '%"_"'.$value.'-%';
+ $stmt->bindValue($key, $search_value, PDO::PARAM_STR);
+ }
else {
$stmt->bindValue($key, $value, PDO::PARAM_STR);
}
diff --git a/assets/readdevice.js b/assets/readdevice.js
index 171daa8..3346194 100644
--- a/assets/readdevice.js
+++ b/assets/readdevice.js
@@ -8,9 +8,9 @@ const VPP1 = []; //for VPP1 values
const VPP2 = []; //for VPP2 values
const VBAT = []; //for VBAT values
const PWM = []; //for PWM values
+const STATE = []; //for STATE values
const xChart = []; //x-axis chart values
-
function progressBar(percentage, message, color){
var readbar = document.getElementById("readBar");
readBar.style.background = color;
@@ -238,14 +238,13 @@ const serialResultsDiv = document.getElementById("serialResults");
async function appendToTerminal(newStuff) {
serialResultsDiv.innerHTML += newStuff;
-
+ serialOutput +=newStuff
}
function renderChart(){
var test = serialResultsDiv.innerHTML.split(";");
- console.log(test)
test.forEach(getData);
const xValues = xChart;
new Chart("chart_VCP", {
@@ -263,6 +262,26 @@ function renderChart(){
data: VBAT,
borderColor: "black",
fill: false
+ },{
+ label: "VPP1",
+ data: VPP1,
+ borderColor: "green",
+ fill: false
+ },{
+ label: "VPP2",
+ data: VPP2,
+ borderColor: "blue",
+ fill: false
+ },{
+ label: "PWM",
+ data: PWM,
+ backgroundColor: "yellow",
+ fill: false
+ },{
+ label: "STATE",
+ data: STATE,
+ backgroundColor: "purple",
+ fill: false
}
]
},
@@ -270,75 +289,57 @@ function renderChart(){
legend: {display: true}
}
});
-
-
- new Chart("chart_VPP", {
- type: "line",
- data: {
- labels: xValues,
- datasets: [{
- label: "VPP1",
- data: VPP1,
- borderColor: "green",
- fill: false
- }, {
- label: "VPP2",
- data: VPP2,
- borderColor: "blue",
- fill: false
- },
- ]
- },
- options: {
- legend: {display: true}
- }
- });
-
- new Chart("chart_PWM", {
- type: "bar",
- data: {
- labels: xValues,
- datasets: [{
- label: "PWM",
- data: PWM,
- backgroundColor: "yellow",
- fill: false
- }
- ]
- },
- options: {
- legend: {display: true}
- }
- });
-
}
//Get the RAW data and turn into object
function getData(item) {
+
let item_array = item.split("=");
let xaxis = xChart.length + 1;
if (item_array[0] == "VCP"){
- VCP.push(item_array[1])
+ let vcp = item_array[1] / 1000000;
+ VCP.push(vcp)
xChart.push(xaxis);
}
if (item_array[0] == "VPP1"){
- VPP1.push(item_array[1])
+ let vpp1 = item_array[1] / 1000000;
+ VPP1.push(vpp1)
}
if (item_array[0] == "VPP2"){
- VPP2.push(item_array[1])
+ let vpp2 = item_array[1] / 1000000;
+ VPP2.push(vpp2)
}
if (item_array[0] == "VBAT"){
- VBAT.push(item_array[1])
+ let vbat = item_array[1] / 1000000;
+ VBAT.push(vbat)
+ }
+ if (item_array[0] == "STATE"){
+ let state
+ switch (item_array[1]) {
+ case 'FULL_CONNECT':
+ state = 5;
+ break;
+ case 'REACTIVATE':
+ state = 3;
+ break;
+ case 'WAIT_CONNECT':
+ state = -5;
+ break;
+ case 'DISCONNECTED':
+ state = 0;
+ break;
+ }
+ STATE.push(state)
}
if (item_array[0] == "PWM")
{
- var check_return = item_array[1].match(/[^\r\n]+/g);
- console.log(check_return, check_return[0])
+ var check_return = item_array[1].match(/[^\r\n]+/g);
if (check_return.length == 2){
- PWM.push(check_return[0])
+ let pwm = check_return[0] / 10;
+ PWM.push(pwm)
+ }
}
- }
}
async function closePort(){
diff --git a/cartest_manage.php b/cartest_manage.php
new file mode 100644
index 0000000..128b6ca
--- /dev/null
+++ b/cartest_manage.php
@@ -0,0 +1,127 @@
+prepare($sql);
+//Excute Query
+$stmt->execute();
+//Get results
+$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+template_header('Buildtool', 'buildtool','view');
+
+$view = '
+
+
+
+
+
'.$buildtool_h2 .'
+
'.$buildtool_p.'
+
+
+
';
+
+$view .= '
+
+';
+
+$view .= '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
STATE: -5 = WAIT_CONNECT, 0 = DISCONNECTED, 3 = REACTIVATE, 5 = FULL_CONNECT
+
+
+
+
+
+
+
+';
+
+
+//OUTPUT
+echo $view;
+
+//ADD JS FILES
+echo '
+
+
+
+
+
+';
+
+
+
+template_footer();
+?>
\ No newline at end of file
diff --git a/cartests.php b/cartests.php
index 3116c9b..9acf16a 100644
--- a/cartests.php
+++ b/cartests.php
@@ -76,7 +76,7 @@ $view .= '
-
'.$button_history.'';
+
'.$button_history.'
+ '.$view_communication.'
+ '.$view_users.'
+ ';
if ($update_allowed === 1){
diff --git a/settings/translations/translations_NL.php b/settings/translations/translations_NL.php
index ea39450..1cc875e 100644
--- a/settings/translations/translations_NL.php
+++ b/settings/translations/translations_NL.php
@@ -73,6 +73,8 @@ $button_create_communication = 'Maak communicatie';
$button_create_account = 'Maak klant';
$button_partner_assigned_equipment = 'Gerelateerde activa';
$button_partner_assigned_contracts = 'Gerelateerde contracten';
+$button_partner_assigned_communication = 'Gerelateerde communicatie';
+$button_partner_assigned_users = 'Gerelateerde gebruikers';
$button_create_contract = 'Maak contract';
$button_create_communication_send = 'Firmware communicatie';
$button_create_cartest = 'Maak autotest';
diff --git a/settings/translations/translations_US.php b/settings/translations/translations_US.php
index 588165a..b496405 100644
--- a/settings/translations/translations_US.php
+++ b/settings/translations/translations_US.php
@@ -73,6 +73,8 @@ $button_create_communication = 'Create communication';
$button_create_account = 'Create account';
$button_partner_assigned_equipment = 'Related assets';
$button_partner_assigned_contracts = 'Related contracts';
+$button_partner_assigned_communication = 'Related communication';
+$button_partner_assigned_users = 'Related users';
$button_create_contract = 'Create contract';
$button_create_communication_send = 'Firmware communication';
$button_create_cartest = 'Create cartest';
diff --git a/user.php b/user.php
index 33e22a3..cda01ba 100644
--- a/user.php
+++ b/user.php
@@ -175,7 +175,7 @@ $view .= '
+ '.$back_btn_orgin.'
';
if (isset($success_msg)){