6 Commits

Author SHA1 Message Date
57f4b48e2e Fixed oopsie 2022-01-19 12:58:41 +01:00
a6059d5831 Fixed "Create-system" form 2022-01-19 12:55:42 +01:00
0481dc380e Fixed system creation form
Added serviceTag field
Fixed System type filed
2022-01-19 12:37:43 +01:00
bprieshof
506b49f11d Fixed Create user button 2019-09-26 00:57:41 +02:00
jeffreyv
3a767083df Update 'backend/edit-system.php' 2019-09-04 15:02:55 +02:00
73536f54a5 Added search function to main pages 2019-08-30 19:11:51 +02:00
8 changed files with 149 additions and 92 deletions

View File

@@ -170,3 +170,9 @@ th.meta {
line-height: 2.4rem; line-height: 2.4rem;
color: rgba(255,255,255,0.87)!important; color: rgba(255,255,255,0.87)!important;
} }
input#SearchInput {
height: 3.6rem;
border-left: 11px solid white;
margin-left: -11px;
margin-top: 9px;
}

14
assets/js/search-bar.js Normal file
View File

@@ -0,0 +1,14 @@
$(document).ready(function(){
$("#SearchInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#Search_table tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
$(document).ready(function(){
$("#SearchButton").click(function(){
$("#SearchInput").toggle();
});
});

View File

@@ -57,6 +57,8 @@ require_once "../assets/php/cuttext.php";
<script type="text/javascript" src="../assets/fuse-html/fuse-html.min.js"></script> <script type="text/javascript" src="../assets/fuse-html/fuse-html.min.js"></script>
<!-- Main JS --> <!-- Main JS -->
<script type="text/javascript" src="../assets/js/main.js"></script> <script type="text/javascript" src="../assets/js/main.js"></script>
<!-- Search -->
<script type="text/javascript" src="../assets/js/search-bar.js"></script>
<!-- / JAVASCRIPT --> <!-- / JAVASCRIPT -->
</head> </head>
<body class="layout layout-vertical layout-left-navigation layout-below-toolbar layout-below-footer"> <body class="layout layout-vertical layout-left-navigation layout-below-toolbar layout-below-footer">
@@ -145,8 +147,15 @@ require_once "../assets/php/cuttext.php";
<!-- CONTENT --> <!-- CONTENT -->
<div class="clearfix" style="padding:20px;"> <div class="clearfix" style="padding:20px;">
<button class="headbnt btn btn-secondary btn-fab icon icon-arrow-left" onclick="window.history.back();"></button>
<h2 class="pull-right">Ticket archive</h2> <h2 class="pull-right">Ticket archive</h2>
<div class="toolbar crud pull-left">
<button class="headbnt btn btn-secondary btn-fab icon icon-arrow-left" onclick="window.history.back();"></button>
<button type="button" class="btn btn-secondary btn-fab" id="SearchButton"><i class="icon-magnify"></i></button>
<input type="search" id="SearchInput" style="display:none;" placeholder="Search">
</div>
</div> </div>
<body> <body>
<div class="wrapper"> <div class="wrapper">
@@ -173,7 +182,7 @@ require_once "../assets/php/cuttext.php";
echo "<th>Date/Time</th>"; echo "<th>Date/Time</th>";
echo "</tr>"; echo "</tr>";
echo "</thead>"; echo "</thead>";
echo "<tbody>"; echo "<tbody id='Search_table'>";
while($row = mysqli_fetch_array($result)){ while($row = mysqli_fetch_array($result)){
echo "<tr>"; echo "<tr>";
echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['id'] . "</td>";

View File

@@ -7,7 +7,7 @@ if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
exit; exit;
} }
require_once "../assets/php/config.php"; require_once "../assets/php/config.php";
if(isset( $_POST ['sysID'], $_POST ['ServiceTag'], $_POST ['location'], $_POST ['WinKey'], $_POST ['EthMac'])){ if(isset( $_POST ['sysID'],$_POST['sysType'], $_POST ['ServiceTag'], $_POST ['location'], $_POST ['WinKey'], $_POST ['EthMac'])){
// Escape user inputs for security // Escape user inputs for security
$sysID = mysqli_real_escape_string($link, $_POST['sysTypeID'].$_POST['sysID']); $sysID = mysqli_real_escape_string($link, $_POST['sysTypeID'].$_POST['sysID']);
$sysType = mysqli_real_escape_string($link, $_POST['sysType']); $sysType = mysqli_real_escape_string($link, $_POST['sysType']);
@@ -180,81 +180,80 @@ mysqli_close($link);
</div> </div>
<div class="form-wrapper md-elevation-8 p-4"> <div class="form-wrapper md-elevation-8 p-4">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post"> <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<!-- Prepended text--> <!-- Prepended text-->
<div class='control-group'>
<div class='control-group'> <label class="col-md-8 control-label" >System ID <span style="color:red">*</span></label>
<label class="col-md-8 control-label" >System ID <span style="color:red">*</span></label> <div class='controls'>
<div class='controls'> <div class="col-md-4">
<div class="col-md-4"> <div class='input-prepend dropdown' id="sysType" name="sysType" data-select='true'>
<div class='input-prepend dropdown' id="sysType" name="sysType" data-select='true'> <!-- there must not be a space between the prepend toggle and the input field -->
<!-- there must not be a space between the prepend toggle and the input field --> <a class='add-on dropdown-toggle' data-toggle='dropdown' href='#'>
<a class='add-on dropdown-toggle' data-toggle='dropdown' href='#'> <!-- span.dropdown-display will be updated with the text from the selected option -->
<!-- span.dropdown-display will be updated with the text from the selected option --> <span class='dropdown-display'>DT</span>
<span class='dropdown-display'>DT</span> <i class='caret'></i>
<i class='caret'></i> </a>
</a> <input type='text' placeholder='000' id="sysID" required="" minlength="3" maxlength="3" name="sysID" class='col-md-4 control-label' />
<input type='text' placeholder='000' id="sysID" required="" minlength="3" maxlength="3" name="sysID" class='col-md-4 control-label' /> <!-- this hidden field is used to contain the selected option from the dropdown -->
<!-- this hidden field is used to contain the selected option from the dropdown --> <input type='hidden' id="sysTypeID" name="sysTypeID" value='DT' class='dropdown-field' />
<input type='hidden' id="sysTypeID" name="sysTypeID" value='DT' class='dropdown-field' /> <!-- unordered list of options -->
<!-- unordered list of options --> <ul class='dropdown-menu'>
<ul class='dropdown-menu'> <li>
<li> <a href="#" class="idlist" id="sysType" name="sysTypeID" data-value="DT">DT</a>
<a href="#" class="idlist" id="sysType" name="sysTypeID" data-value="DT">DT</a> </li>
</li> <li>
<li> <a href="#" class="idlist" id="sysType" name="sysTypeID" data-value="LT">LT</a>
<a href="#" class="idlist" id="sysType" name="sysTypeID" data-value="LT">LT</a> </li>
</li> <li>
<li> <a href="#" class="idlist" id="sysType" name="sysTypeID" data-value="TC">TC</a>
<a href="#" class="idlist" id="sysType" name="sysTypeID" data-value="TC">TC</a> </li>
</li> </ul>
</ul> </div>
</div> </div>
</div> </div>
</div> <!-- Text input-->
<!-- /PREPEND EXAMPLE --> <div class="form-group">
<label class="col-md-4 control-label" for="sysType">System type <span style="color:red">*</span></label>
<!-- Text input--> <div class="col-md-4">
<div class="form-group"> <input id="ServiceTag" name="ServiceTag" type="text" placeholder="" class="form-control input-md" required="">
<label class="col-md-4 control-label" for="ServiceTag">System type <span style="color:red">*</span></label> </div>
<div class="col-md-4"> </div>
<input id="ServiceTag" name="ServiceTag" type="text" placeholder="" class="form-control input-md" required=""> <!-- Select Basic -->
</div> <div class="form-group">
</div> <label class="col-md-4 control-label" for="location">Location <span style="color:red">*</span></label>
<div class="col-md-4">
<select id="location" name="location" class="form-control">
<!-- Select Basic --> <option value="Arnhem">Arnhem</option>
<div class="form-group"> <option value="Doetinchem">Doetinchem</option>
<label class="col-md-4 control-label" for="location">Location <span style="color:red">*</span></label> <option value="Nijmegen">Nijmegen</option>
<div class="col-md-4"> </select>
<select id="location" name="location" class="form-control"> </div>
<option value="Arnhem">Arnhem</option> </div>
<option value="Doetinchem">Doetinchem</option> <!-- Text input-->
<option value="Nijmegen">Nijmegen</option> <div class="form-group">
</select> <label class="col-md-4 control-label" for="EthMac">Mac addres <span style="color:red">*</span></label>
</div> <div class="col-md-4">
</div> <input id="EthMac" name="EthMac" type="text" placeholder="" class="form-control input-md" required="">
</div>
<!-- Text input--> </div>
<div class="form-group"> <!-- Text input-->
<label class="col-md-4 control-label" for="WinKey">Windows key <span style="color:red">*</span></label> <div class="form-group">
<div class="col-md-4"> <label class="col-md-4 control-label" for="WinKey">Windows key <span style="color:red">*</span></label>
<input id="WinKey" name="WinKey" type="WinKey" placeholder="" class="form-control input-md" required=""> <div class="col-md-4">
</div> <input id="WinKey" name="WinKey" type="WinKey" placeholder="" class="form-control input-md" required="">
</div> </div>
</div>
<!-- Text input--> <!-- Text input-->
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label" for="EthMac">Mac addres <span style="color:red">*</span></label> <label class="col-md-4 control-label" for="sysType">Service Tag/Serial nr<span style="color:red">*</span></label>
<div class="col-md-4"> <div class="col-md-4">
<input id="EthMac" name="EthMac" type="text" placeholder="" class="form-control input-md" required=""> <input id="sysType" name="sysType" type="text" placeholder="" class="form-control input-md" required="">
</div> </div>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<input type="submit" class="btn btn-secondary" value="Add"> <input type="submit" class="btn btn-secondary" value="Add">
</div> </div>
</div>
</form> </form>
</div>
<!-- / CONTENT --> <!-- / CONTENT -->

View File

@@ -3,8 +3,8 @@
require_once "../assets/php/config.php"; require_once "../assets/php/config.php";
error_log("Loading Page", 0); error_log("Loading Page", 0);
// Define variables and initialize with empty values // Define variables and initialize with empty values
$sysID = $sysType = $location = $EthMac = $Winkey = ""; $sysID = $sysType = $location = $EthMac = $Winkey = $ServiceTag = "";
$sysID_err = $sysType_err = $location_err = $EthMac_err = $Winkey_err = ""; $sysID_err = $sysType_err = $location_err = $EthMac_err = $Winkey_err = $ServiceTag_err = "";
// Processing form data when form is submitted // Processing form data when form is submitted
if(isset($_POST["id"]) && !empty($_POST["id"])){ if(isset($_POST["id"]) && !empty($_POST["id"])){
// Get hidden input value // Get hidden input value
@@ -46,14 +46,21 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
} else{ } else{
$Winkey = $input_Winkey; $Winkey = $input_Winkey;
} }
$input_ServiceTag = trim($_POST["ServiceTag"]);
if(empty($input_ServiceTag)){
$ServiceTag_err = "Please enter a Servicetag/Serial nr";
} else{
$ServiceTag = $input_ServiceTag;
}
// Check input errors before inserting in database // Check input errors before inserting in database
if(empty($sysID_err) && empty($location_err) && empty($requestype_err) && empty($request_by_err) && empty($reason_err)){ if(empty($sysID_err) && empty($location_err) && empty($requestype_err) && empty($request_by_err) && empty($reason_err)){
// Prepare an update statement // Prepare an update statement
$sql = "UPDATE systems SET sysID=?,sysType=?,location=?,EthMac=?, WinKey=? WHERE id=?"; $sql = "UPDATE systems SET sysID=?,sysType=?,location=?,EthMac=?, WinKey=?, ServiceTag=? WHERE id=?";
if($stmt = mysqli_prepare($link, $sql)){ if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters // Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "sssssi", $param_sysID, $param_systype, $param_location, $param_EthMac, $param_Winkey, $param_id); mysqli_stmt_bind_param($stmt, "ssssssi", $param_sysID, $param_systype, $param_location, $param_EthMac, $param_Winkey, $param_ServiceTag, $param_id);
// Set parameters // Set parameters
$param_sysID = $sysID; $param_sysID = $sysID;
@@ -61,6 +68,7 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
$param_location = $location; $param_location = $location;
$param_EthMac = $EthMac; $param_EthMac = $EthMac;
$param_Winkey = $Winkey; $param_Winkey = $Winkey;
$param_ServiceTag = $ServiceTag;
$param_id = $id; $param_id = $id;
// Attempt to execute the prepared statement // Attempt to execute the prepared statement
@@ -106,6 +114,7 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
$location = $row["location"]; $location = $row["location"];
$Winkey = $row["WinKey"]; $Winkey = $row["WinKey"];
$EthMac = $row["EthMac"]; $EthMac = $row["EthMac"];
$ServiceTag = $row['ServiceTag'];
$id = $row['id']; $id = $row['id'];
$string = $row["sysMeta"]; $string = $row["sysMeta"];
} else{ } else{
@@ -356,6 +365,12 @@ $lines = explode("\n", $trimmedString);
<input type="text" name="Win_Key" class="form-control" value="<?php echo $Winkey; ?>"> <input type="text" name="Win_Key" class="form-control" value="<?php echo $Winkey; ?>">
<span class="help-block"><?php echo $Winkey_err;?></span> <span class="help-block"><?php echo $Winkey_err;?></span>
</div> </div>
<div class="form-group col-md-4 <?php echo (!empty($ServiceTag_err)) ? 'has-error' : ''; ?>">
<label>Service Tag/Serial nr</label>
<input type="text" name="ServiceTag" class="form-control" value="<?php echo $ServiceTag; ?>">
<span class="help-block"><?php echo $ServiceTag_err;?></span>
</div>
<input type="hidden" name="id" value="<?php echo $id; ?>"/> <input type="hidden" name="id" value="<?php echo $id; ?>"/>
<input type="submit" class="btn btn-secondary" value="Submit"> <input type="submit" class="btn btn-secondary" value="Submit">
</form> </form>

View File

@@ -60,6 +60,8 @@ require_once "../assets/php/cuttext.php";
<script type="text/javascript" src="../assets/fuse-html/fuse-html.min.js"></script> <script type="text/javascript" src="../assets/fuse-html/fuse-html.min.js"></script>
<!-- Main JS --> <!-- Main JS -->
<script type="text/javascript" src="../assets/js/main.js"></script> <script type="text/javascript" src="../assets/js/main.js"></script>
<!-- Search -->
<script type="text/javascript" src="../assets/js/search-bar.js"></script>
<!-- / JAVASCRIPT --> <!-- / JAVASCRIPT -->
</head> </head>
@@ -145,12 +147,14 @@ require_once "../assets/php/cuttext.php";
<div class="content custom-scrollbar"> <div class="content custom-scrollbar">
<div class="page-layout simple full-width"> <div class="page-layout simple full-width">
<div class="page-content-wrapper"> <div class="page-content-wrapper">
<!-- CONTENT --> <!-- CONTENT -->
<div class="clearfix" style="padding:20px;"> <div class="clearfix" style="padding:20px;">
<a href="create-system.php" class="btn btn-secondary btn-fab pull-left"><i class="icon-plus"></i></a>
<h2 class="pull-right">Systems</h2> <h2 class="pull-right">Systems</h2>
<div class="toolbar crud pull-left">
<a href="create-system.php" class="btn btn-secondary btn-fab"><i class="icon-plus"></i></a>
<button type="button" class="btn btn-secondary btn-fab" id="SearchButton"><i class="icon-magnify"></i></button>
<input type="search" id="SearchInput" style="display:none;" placeholder="Search">
</div>
</div> </div>
<body> <body>
@@ -176,7 +180,7 @@ require_once "../assets/php/cuttext.php";
echo "<th>ServiceTag</th>"; echo "<th>ServiceTag</th>";
echo "</tr>"; echo "</tr>";
echo "</thead>"; echo "</thead>";
echo "<tbody>"; echo "<tbody id='Search_table'>";
while($row = mysqli_fetch_array($result)){ while($row = mysqli_fetch_array($result)){
echo "<tr>"; echo "<tr>";
echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['id'] . "</td>";

View File

@@ -57,6 +57,8 @@ require_once "../assets/php/cuttext.php";
<script type="text/javascript" src="../assets/fuse-html/fuse-html.min.js"></script> <script type="text/javascript" src="../assets/fuse-html/fuse-html.min.js"></script>
<!-- Main JS --> <!-- Main JS -->
<script type="text/javascript" src="../assets/js/main.js"></script> <script type="text/javascript" src="../assets/js/main.js"></script>
<!-- Search -->
<script type="text/javascript" src="../assets/js/search-bar.js"></script>
<!-- / JAVASCRIPT --> <!-- / JAVASCRIPT -->
</head> </head>
<body class="layout layout-vertical layout-left-navigation layout-below-toolbar layout-below-footer"> <body class="layout layout-vertical layout-left-navigation layout-below-toolbar layout-below-footer">
@@ -145,13 +147,15 @@ require_once "../assets/php/cuttext.php";
<!-- CONTENT --> <!-- CONTENT -->
<div class="clearfix" style="padding:20px;"> <div class="clearfix" style="padding:20px;">
<h2 class="pull-right">Tickets</h2>
<div class="toolbar crud pull-left"> <div class="toolbar crud pull-left">
<a data-toggle='tooltip' data-original-title='Add Ticket' href="create-ticket.php" class="btn btn-secondary btn-fab"><i class="icon-plus"></i></a> <a data-toggle='tooltip' data-original-title='Add Ticket' href="create-ticket.php" class="btn btn-secondary btn-fab"><i class="icon-plus"></i></a>
<?php <?php
echo "<a data-toggle='tooltip' data-original-title='Open Archive' class='btn btn-success btn-fab' href='archive.php'><span class='icons icon-archive'></span></a>"; echo "<a data-toggle='tooltip' data-original-title='Open Archive' class='btn btn-success btn-fab' href='archive.php'><span class='icons icon-archive'></span></a>";
?> ?>
<button type="button" class="btn btn-secondary btn-fab" id="SearchButton"><i class="icon-magnify"></i></button>
<input type="search" id="SearchInput" style="display:none;" placeholder="Search">
</div> </div>
<h2 class="pull-right">Tickets</h2>
</div> </div>
<body> <body>
<div class="wrapper"> <div class="wrapper">
@@ -178,7 +182,7 @@ require_once "../assets/php/cuttext.php";
echo "<th>Date/Time</th>"; echo "<th>Date/Time</th>";
echo "</tr>"; echo "</tr>";
echo "</thead>"; echo "</thead>";
echo "<tbody>"; echo "<tbody id='Search_table'>";
while($row = mysqli_fetch_array($result)){ while($row = mysqli_fetch_array($result)){
echo "<tr>"; echo "<tr>";
echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['id'] . "</td>";

View File

@@ -57,6 +57,8 @@ require_once "../assets/php/cuttext.php";
<script type="text/javascript" src="../assets/fuse-html/fuse-html.min.js"></script> <script type="text/javascript" src="../assets/fuse-html/fuse-html.min.js"></script>
<!-- Main JS --> <!-- Main JS -->
<script type="text/javascript" src="../assets/js/main.js"></script> <script type="text/javascript" src="../assets/js/main.js"></script>
<!-- Search -->
<script type="text/javascript" src="../assets/js/search-bar.js"></script>
<!-- / JAVASCRIPT --> <!-- / JAVASCRIPT -->
</head> </head>
<body class="layout layout-vertical layout-left-navigation layout-below-toolbar layout-below-footer"> <body class="layout layout-vertical layout-left-navigation layout-below-toolbar layout-below-footer">
@@ -144,10 +146,14 @@ require_once "../assets/php/cuttext.php";
<!-- CONTENT --> <!-- CONTENT -->
<div class="clearfix" style="padding:20px;"> <div class="clearfix" style="padding:20px;">
<a href="create-user.php" class="btn btn-secondary btn-fab pull-left"><i class="icon-plus"></i></a> <h2 class="pull-right">Users</h2>
<h2 class="pull-right">Users</h2> <div class="toolbar crud pull-left">
<a href="create-user.php" class="btn btn-secondary btn-fab"><i class="icon-plus"></i></a>
<button type="button" class="btn btn-secondary btn-fab" id="SearchButton"><i class="icon-magnify"></i></button>
<input type="search" id="SearchInput" style="display:none;" placeholder="Search">
</div> </div>
</div>
<body> <body>
<div class="wrapper"> <div class="wrapper">
<div class="container-fluid"> <div class="container-fluid">
@@ -168,7 +174,7 @@ require_once "../assets/php/cuttext.php";
echo "<th>User name</th>"; echo "<th>User name</th>";
echo "</tr>"; echo "</tr>";
echo "</thead>"; echo "</thead>";
echo "<tbody>"; echo "<tbody id='Search_table'>";
while($row = mysqli_fetch_array($result)){ while($row = mysqli_fetch_array($result)){
echo "<tr>"; echo "<tr>";
echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['id'] . "</td>";