Files
assetmgt/buildtool.php
“VeLiTi” 50593cdf9e Bug buildtool
2024-03-21 12:59:28 +01:00

98 lines
3.0 KiB
PHP

<?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';
$page = 'buildtool';
//Check if allowed
if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
header('location: index.php');
exit;
}
$bearertoken = createCommunicationToken($_SESSION['userkey']);
//GET PRODUCTS FROM DB
$pdo = dbConnect($dbname);
$sql = 'SELECT rowID, productcode, productname, product_category,sn from products where status = "1" and build = "1"';
$stmt = $pdo->prepare($sql);
//Excute Query
$stmt->execute();
//Get results
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
template_header('Buildtool', 'buildtool','view');
$view = '
<div class="content-title">
<div class="title">
<i class="fa-solid fa-box-open"></i>
<div class="txt">
<h2>'.$buildtool_h2 .'</h2>
<p>'.$buildtool_p.'</p>
</div>
</div>
</div>';
$view .= '
<div class="content-header responsive-flex-column pad-top-5">
<a href="index.php?page=dashboard" class="btn">'.$button_cancel.'</a>
</div>
';
$view .= '<div class="content-block">
<div class="block-header">
<i class="fa-solid fa-bars fa-sm"></i>
</div>
<p id="servicetoken" value="" hidden>'.$bearertoken.'</p>
<div>
<select id="productlist" style="width: 100%;padding: 15px 5px;margin-bottom: 25px;border: 0;border-bottom: 1px solid #dedfe1;" name="productlist" >
<option selected value="0">Assign Product</option>
';
foreach ($messages as $message){
$view .='<option value="'.$message["rowID"].'|'.$message["product_category"].'|'.$message["sn"].'">'.$message["productcode"].' - '.$message["productname"].'</option>';
}
$view .='</select>
<input type="hidden" id="lineToSend" >
</div>
<div id="connectdevice" style="display:flex;">
<div>
<button class="btn" style="margin-right:10px;" onclick="startMaintenance()">Assembly</button>
<button class="btn" onClick="window.location.reload()">&#8634;</button>
</div>
<div id="readStatus" style="width: 75%;background-color: #f1f1f1;">
<div id="readBar"></div>
</div>
</div>
<div id="Device_output" style="display:none;margin-top: 10px;">
<div id="serialResults" style="font-family: monospace;white-space: pre;padding: 10px;background-color:#f1f1f1;"></div>
</div>
<div>
</div>
';
//OUTPUT
echo $view;
//ADD JS FILES
echo '
<script src = "./assets/readdevice.js?'.script_version.'"></script>
<script src = "./assets/charts.js?'.script_version.'"></script>
<script src = "./assets/jquery-2.1.4.min.js"></script>
<script src = "./assets/DYMO.Label.Framework.latest.js?'.script_version.'" type="text/javascript" charset="UTF-8"> </script>
<script>
var link = "'.$baseurl.'";
</script>';
template_footer();
?>