create composite insert and search pages

This commit is contained in:
/jedi/ 2019-02-22 14:09:20 +01:00
parent fef7701152
commit d4c22b8742
3 changed files with 221 additions and 8 deletions

View file

@ -21,8 +21,7 @@
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="#">Dashboard</a> <a href="#">Dashboard</a>
</li> </li>
<li class="breadcrumb-item">Found</li> <li class="breadcrumb-item active">Found</li>
<li class="breadcrumb-item active">Add</li>
</ol> </ol>
<div id="alertmessage" class="collapse alert alert-danger" role="alert"> <div id="alertmessage" class="collapse alert alert-danger" role="alert">
@ -38,7 +37,7 @@
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"> <div class="card-header">
<i class="fas fa-plus"></i> <i class="fas fa-plus"></i>
Insert Item into DB Add Found Item
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="POST" action="#" id="lost_form"> <form method="POST" action="#" id="lost_form">
@ -63,11 +62,69 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<button type="submit" class="form-control" onclick="add_found_item(); return false;">Submit</button> <button type="submit" class="form-control btn btn-primary" onclick="add_found_item(); return false;">Submit</button>
</div> </div>
</form> </form>
</div> </div>
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div> <!--div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div-->
</div>
<!-- DataTables Example -->
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i>
Lost Items</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>ID</th>
<th>was</th>
<th>wann</th>
<th>wo</th>
<th>kontakt</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>was</th>
<th>wann</th>
<th>wo</th>
<th>kontakt</th>
</tr>
</tfoot>
<tbody>
<?php
foreach( get_lostitems(true) as $item){
?>
<tr>
<td><?php echo $item["id"]; ?></td>
<td><?php echo $item["was"]; ?></td>
<td><?php echo $item["wann"]; ?></td>
<td><?php echo $item["wo"]; ?></td>
<td><?php echo $item["contact"]; ?></td>
<!--td>
<?php
foreach(explode(",",$item["tags"]) as $tag){
?>
<span class="label label-default"><?php echo $tag; ?></span>
<?php
}
?>
</td>
<td><?php echo $item["id"]; ?></td-->
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<!--div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div-->
</div> </div>
</div> </div>

148
templates/lost_item.php Normal file
View file

@ -0,0 +1,148 @@
<?php
/**
* Created by PhpStorm.
* User: jedi
* Date: 12/27/18
* Time: 4:46 AM
*/
?>
<div class="container-fluid">
<!-- Breadcrumbs-->
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="#">Dashboard</a>
</li>
<li class="breadcrumb-item active">Lost</li>
</ol>
<div id="alertmessage" class="collapse alert alert-danger" role="alert">
This is a danger alert—check it out!
</div>
<div id="successmessage" class="collapse alert alert-success" role="alert">
A simple success alert—check it out!
</div>
<!-- Area Chart Example-->
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-plus"></i>
Add Lost Item
</div>
<div class="card-body">
<form method="POST" action="/action.php?action=lost" id="lost_form">
<p><input type="text" class="form-control" placeholder="WANN" name="wann" value="<?php echo date("Y-m-d H:i:s");?>"></p>
<p><input type="text" class="form-control" placeholder="WO" name="wo"></p>
<p><input type="text" class="form-control" placeholder="WAS" name="was"></p>
<p><input type="text" class="form-control" placeholder="KONTAKT" name="contact" autocomplete="off"></p>
<p><button type="submit" class="form-control" onclick="testajax(); return false;">Submit</button></p>
</form>
</div>
<!--div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div-->
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i>
Found Items</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>ID</th>
<th>was</th>
<th>wann</th>
<th>wo</th>
<th>foto</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>was</th>
<th>wann</th>
<th>wo</th>
<th>foto</th>
<th></th>
</tr>
</tfoot>
<tbody>
<?php
foreach( get_founditems(true) as $item){
?>
<tr>
<td><?php echo $item["id"]; ?></td>
<td><?php echo $item["was"]; ?></td>
<td><?php echo $item["wann"]; ?></td>
<td><?php echo $item["wo"]; ?></td>
<td><img style="height: 48px;" src="/upload/<?php echo $item["hash"]; ?>"></td>
<td>
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-secondary"><i class="fas fa-fw fa-check-circle"></i></button>
<a href="/found_item_edit/<?php echo $item["id"]; ?>/" type="button" class="btn btn-outline-secondary"><i class="fas fa-fw fa-edit"></i></a>
<button type="button" class="btn btn-outline-danger" onclick="delete_item(<?php echo $item["id"]; ?>)"><i class="fas fa-fw fa-trash-alt"></i></button>
</div>
</td>
<!--td>
<?php
foreach(explode(",",$item["tags"]) as $tag){
?>
<span class="label label-default"><?php echo $tag; ?></span>
<?php
}
?>
</td>
<td><?php echo $item["id"]; ?></td-->
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<!--div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div-->
</div>
</div>
<!-- /.container-fluid -->
<script>
function testajax(){
$.post( "/ajax.php?action=add_found_item", $( "#lost_form" ).serialize() ).done(function( data ) {;
reply = JSON.parse(data);
if(reply.status == "ok"){
$( "#lost_form" ).trigger("reset");
$("#alertmessage").collapse('hide');
$("#successmessage").html(reply.message).collapse('show');
}else{
$("#successmessage").collapse('hide');
$("#alertmessage").html(reply.message).collapse('show');
}
}).fail(function() {
$("#successmessage").collapse('hide');
$("#alertmessage").html("error").collapse('show');
});
}
</script>
<!-- Page level plugin JavaScript-->
<script src="/vendor/chart.js/Chart.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="/js/sb-admin.min.js"></script>
<!-- Demo scripts for this page-->
<script src="/js/demo/chart-area-demo.js"></script>
<script src="/js/demo/chart-bar-demo.js"></script>
<script src="/js/demo/chart-pie-demo.js"></script>

View file

@ -19,13 +19,21 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/found_item/"> <a class="nav-link" href="/found_item/">
<i class="fas fa-fw fa-archive"></i> <i class="fas fa-fw fa-archive"></i>
<span>Found Items (NEW VERSION)</span> <span>Found Item (NEW VERSION)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/lost_item/">
<i class="fas fa-fw fa-archive"></i>
<span>Lost Item (NEW VERSION)</span>
</a> </a>
</li> </li>
<li class="nav-item"> <!--li class="nav-item">
<a class="nav-link" href="/table/"> <a class="nav-link" href="/table/">
<i class="fas fa-fw fa-archive"></i> <i class="fas fa-fw fa-archive"></i>
<span>Found Items</span> <span>Found Items</span>
@ -48,7 +56,7 @@
<i class="fas fa-fw fa-plus"></i> <i class="fas fa-fw fa-plus"></i>
<span>Lost</span> <span>Lost</span>
</a> </a>
</li> </li-->
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/matches/"> <a class="nav-link" href="/matches/">
<i class="fas fa-fw fa-check"></i> <i class="fas fa-fw fa-check"></i>