Merge branch 'development'
This commit is contained in:
@@ -1712,6 +1712,82 @@ if(($imageFileType == "jpg" || $imageFileType == "png" || $imageFileType == "jpe
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
// UPLOAD PICTURE for PRODUCTS
|
||||||
|
//------------------------------------------
|
||||||
|
function uploadrequest($requestid, $request_line_id, $name){
|
||||||
|
|
||||||
|
$identifier = date('YmdHis');
|
||||||
|
$target_dir = dirname(__FILE__)."/images/requests/";
|
||||||
|
$input_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
|
||||||
|
$imageFileType = strtolower(pathinfo($input_file,PATHINFO_EXTENSION));
|
||||||
|
$target_file = $target_dir . $name.'-'.$identifier .'.jpg';
|
||||||
|
$file_input_check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
|
||||||
|
$image_name = $name.'-'.$identifier .'.jpg';
|
||||||
|
//Do when JPG or PNG or JPEG or GIF and smaller than 5MB
|
||||||
|
if(($imageFileType == "jpg" || $imageFileType == "png" || $imageFileType == "jpeg" || $imageFileType == "gif" || $imageFileType == "png") && $_FILES["fileToUpload"]["size"] < 5000000 && $file_input_check !== false) {
|
||||||
|
//Upload picture
|
||||||
|
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
|
||||||
|
storeImage($requestid,$request_line_id,$image_name);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function storeImage($requestid, $request_line_id,$image_name){
|
||||||
|
|
||||||
|
include dirname(__FILE__,2).'/settings/settings.php';
|
||||||
|
|
||||||
|
$pdo = dbConnect($dbname);
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO images (requestid, request_line_id, image_name) VALUES (?,?,?)';
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute([$requestid, $request_line_id,$image_name]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
// displayImages
|
||||||
|
//------------------------------------------
|
||||||
|
function displayImages($requestid,$request_type){
|
||||||
|
|
||||||
|
include dirname(__FILE__,2).'/settings/settings.php';
|
||||||
|
|
||||||
|
$pdo = dbConnect($dbname);
|
||||||
|
|
||||||
|
switch ($request_type) {
|
||||||
|
case 'request':
|
||||||
|
$whereclause = 'requestid = "'.$requestid.'"';
|
||||||
|
break;
|
||||||
|
case 'request_line':
|
||||||
|
$whereclause = 'request_line_id = "'.$requestid.'"';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
# code...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$sql = 'SELECT * FROM images WHERE '.$whereclause;
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$images = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$output = '';
|
||||||
|
|
||||||
|
if($images){
|
||||||
|
$output .= '<div class="content-block media-page">
|
||||||
|
<div class="media">';
|
||||||
|
|
||||||
|
foreach ($images as $image){
|
||||||
|
$output .= '<img class="image" src="./assets/images/requests/'.$image['image_name'].'" loading="lazy">';
|
||||||
|
}
|
||||||
|
$output .= ' </div>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
// debuglog
|
// debuglog
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
@@ -2068,11 +2144,12 @@ $messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|||||||
//FOR EACH CARTEST TRANSFER TO CARTEST TABLE
|
//FOR EACH CARTEST TRANSFER TO CARTEST TABLE
|
||||||
foreach ($messages as $message){
|
foreach ($messages as $message){
|
||||||
//GET VARIABLES
|
//GET VARIABLES
|
||||||
$cartest = json_decode($message['description'],true);
|
$cartest = json_decode($message['description'],true) ?? '';
|
||||||
$carbrand = ucfirst($cartest["CarBrand"]);
|
$carbrand = ucfirst($cartest["CarBrand"] ?? 'Unknown');
|
||||||
$cartype = ucfirst($cartest["CarType"]);
|
$cartype = ucfirst($cartest["CarType"] ?? 'Unknown');
|
||||||
$questions = json_encode($cartest["Questions"] ??'');
|
$questions = json_encode($cartest["Questions"] ??'');
|
||||||
$datapoints = json_encode($cartest["plugDataPoints"] ?? '');
|
$datapoints = json_encode($cartest["plugDataPoints"] ?? '');
|
||||||
|
$nametester = $cartest["NameTester"] ?? 'Unknown';
|
||||||
|
|
||||||
//get header data only
|
//get header data only
|
||||||
unset($cartest["Questions"]);
|
unset($cartest["Questions"]);
|
||||||
@@ -2083,7 +2160,7 @@ $messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|||||||
$sql = 'INSERT INTO cartest (carbrand, cartype,header,questions,datapoints,createdby) VALUES (?,?,?,?,?,?)';
|
$sql = 'INSERT INTO cartest (carbrand, cartype,header,questions,datapoints,createdby) VALUES (?,?,?,?,?,?)';
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
//Excute Query
|
//Excute Query
|
||||||
$stmt->execute([$carbrand,$cartype,$header,$questions,$datapoints,$cartest["NameTester"]]);
|
$stmt->execute([$carbrand,$cartype,$header,$questions,$datapoints,$nametester]);
|
||||||
|
|
||||||
//MARK HISTORY ITEM FOR DELETATION
|
//MARK HISTORY ITEM FOR DELETATION
|
||||||
$sql = 'UPDATE history SET type = "delete" WHERE rowID = '.$message['rowID'];
|
$sql = 'UPDATE history SET type = "delete" WHERE rowID = '.$message['rowID'];
|
||||||
|
|||||||
@@ -239,6 +239,7 @@ $view .= '<div class="content-block">
|
|||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$cartest_datapoints = is_array($cartest_datapoints)? $cartest_datapoints : json_decode($cartest_datapoints, true);
|
||||||
$VCP = $cartest_datapoints['VCP']['VCP'];
|
$VCP = $cartest_datapoints['VCP']['VCP'];
|
||||||
$VPP1 = $cartest_datapoints['VPP1']['VPP1'];
|
$VPP1 = $cartest_datapoints['VPP1']['VPP1'];
|
||||||
$VPP2 = $cartest_datapoints['VPP2']['VPP2'];
|
$VPP2 = $cartest_datapoints['VPP2']['VPP2'];
|
||||||
@@ -249,7 +250,7 @@ $view .= '<div class="content-block">
|
|||||||
}
|
}
|
||||||
$view.= '
|
$view.= '
|
||||||
<div>
|
<div>
|
||||||
<canvas id="chart_VCP" style="width:400px;max-width:800px"></canvas></div>
|
<canvas id="chart_VCP" style="width:400px;max-width:100%"></canvas></div>
|
||||||
<p><small>STATE: 0 = DISCONNECTED, 3 = REACTIVATE, 5 = FULL_CONNECT</small></p>
|
<p><small>STATE: 0 = DISCONNECTED, 3 = REACTIVATE, 5 = FULL_CONNECT</small></p>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -132,6 +132,23 @@ if (isset($_GET['rowID'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//CREATE CARTEST BRAND DROPDOWN
|
||||||
|
$carbrands_input ='
|
||||||
|
<input list="carbrands" name="carbrand" placeholder="'.$cartest['carbrand'].'" class="datalist">
|
||||||
|
<datalist id="carbrands">';
|
||||||
|
//CHECK IF BRAND IS PROVIDED
|
||||||
|
if ($cartest['carbrand'] !='' && !empty($cartest['carbrand'])){
|
||||||
|
$carbrands_input .= '<option value="'.$cartest['carbrand'].'" selected>'.$cartest['carbrand'].'</option><option value=" "> </option>';
|
||||||
|
} else {
|
||||||
|
$carbrands_input .= '<option></option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($carbrands_array as $brand) {
|
||||||
|
$carbrands_input .= '<option value="'.$brand.'">'.$brand.'</option>';
|
||||||
|
}
|
||||||
|
$carbrands_input .= '</datalist>';
|
||||||
|
//END CARBRAND DROPDOWN
|
||||||
|
|
||||||
template_header('Cartesttool', 'cartesttool','manage');
|
template_header('Cartesttool', 'cartesttool','manage');
|
||||||
|
|
||||||
$view ='
|
$view ='
|
||||||
@@ -156,7 +173,7 @@ $view .= ' <div class="content-block order-details">
|
|||||||
</div>
|
</div>
|
||||||
<div class="order-detail">
|
<div class="order-detail">
|
||||||
<h3>'.$cartest_carbrand.'</h3>
|
<h3>'.$cartest_carbrand.'</h3>
|
||||||
<p><input type="text" name="carbrand" value="'.$cartest['carbrand'].'">
|
<p>'.$carbrands_input.'
|
||||||
<input type="hidden" name="rowID" value="'.$rowID.'">
|
<input type="hidden" name="rowID" value="'.$rowID.'">
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -94,4 +94,75 @@ $arrayQuestions_cartest = array(
|
|||||||
array("Question_sequence" => '1',"QuestionID" => "cartest_notes", "Question" => $cartest_notes, "Type" => 'textarea', "Response" => "")
|
array("Question_sequence" => '1',"QuestionID" => "cartest_notes", "Question" => $cartest_notes, "Type" => 'textarea', "Response" => "")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//=================================================================
|
||||||
|
//Carbrands ===================================
|
||||||
|
//=================================================================
|
||||||
|
|
||||||
|
$carbrands_array = [
|
||||||
|
"Abarth",
|
||||||
|
"Alfa Romeo",
|
||||||
|
"Aston Martin",
|
||||||
|
"Audi",
|
||||||
|
"Bentley",
|
||||||
|
"BMW",
|
||||||
|
"Bugatti",
|
||||||
|
"Cadillac",
|
||||||
|
"Chevrolet",
|
||||||
|
"Chrysler",
|
||||||
|
"Citroën",
|
||||||
|
"Dacia",
|
||||||
|
"Daewoo",
|
||||||
|
"Daihatsu",
|
||||||
|
"Dodge",
|
||||||
|
"Donkervoort",
|
||||||
|
"DS",
|
||||||
|
"Ferrari",
|
||||||
|
"Fiat",
|
||||||
|
"Fisker",
|
||||||
|
"Ford",
|
||||||
|
"Honda",
|
||||||
|
"Hummer",
|
||||||
|
"Hyundai",
|
||||||
|
"Infiniti",
|
||||||
|
"Iveco",
|
||||||
|
"Jaguar",
|
||||||
|
"Jeep",
|
||||||
|
"Kia",
|
||||||
|
"KTM",
|
||||||
|
"Lada",
|
||||||
|
"Lamborghini",
|
||||||
|
"Lancia",
|
||||||
|
"Land Rover",
|
||||||
|
"Landwind",
|
||||||
|
"Lexus",
|
||||||
|
"Lotus",
|
||||||
|
"Maserati",
|
||||||
|
"Maybach",
|
||||||
|
"Mazda",
|
||||||
|
"McLaren",
|
||||||
|
"Mercedes-Benz",
|
||||||
|
"MG",
|
||||||
|
"Mini",
|
||||||
|
"Mitsubishi",
|
||||||
|
"Morgan",
|
||||||
|
"Nissan",
|
||||||
|
"Opel",
|
||||||
|
"Peugeot",
|
||||||
|
"Porsche",
|
||||||
|
"Renault",
|
||||||
|
"Rolls-Royce",
|
||||||
|
"Rover",
|
||||||
|
"Saab",
|
||||||
|
"Seat",
|
||||||
|
"Skoda",
|
||||||
|
"Smart",
|
||||||
|
"SsangYong",
|
||||||
|
"Subaru",
|
||||||
|
"Suzuki",
|
||||||
|
"Tesla",
|
||||||
|
"Toyota",
|
||||||
|
"Volkswagen",
|
||||||
|
"Volvo"
|
||||||
|
];
|
||||||
Reference in New Issue
Block a user