c3lf-system-3/templates/table.php

126 lines
4.9 KiB
PHP
Raw Normal View History

2018-12-27 04:24:44 +00:00
<?php
/**
* Created by PhpStorm.
* User: jedi
* Date: 12/27/18
* Time: 4:48 AM
*/
?>
2018-12-27 20:56:30 +00:00
2018-12-27 04:24:44 +00:00
<div class="container-fluid">
<!-- Breadcrumbs-->
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="#">Dashboard</a>
</li>
2018-12-27 18:51:29 +00:00
<li class="breadcrumb-item active">Found</li>
2018-12-27 04:24:44 +00:00
</ol>
2019-02-21 23:10:56 +00:00
<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>
2018-12-27 04:24:44 +00:00
<!-- DataTables Example -->
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i>
Data Table Example</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>
2018-12-27 07:27:47 +00:00
<th>was</th>
<th>wann</th>
<th>wo</th>
2019-02-21 23:10:56 +00:00
<th>foto</th>
<th></th>
2018-12-27 04:24:44 +00:00
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
2018-12-27 07:27:47 +00:00
<th>was</th>
<th>wann</th>
<th>wo</th>
2019-02-21 23:10:56 +00:00
<th>foto</th>
<th></th>
2018-12-27 04:24:44 +00:00
</tr>
</tfoot>
<tbody>
<?php
2018-12-28 00:24:31 +00:00
foreach( get_founditems(true) as $item){
2018-12-27 04:24:44 +00:00
?>
<tr>
<td><?php echo $item["id"]; ?></td>
2018-12-27 07:27:47 +00:00
<td><?php echo $item["was"]; ?></td>
<td><?php echo $item["wann"]; ?></td>
<td><?php echo $item["wo"]; ?></td>
2019-02-21 23:10:56 +00:00
<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>
2018-12-27 07:27:47 +00:00
<!--td>
2018-12-27 04:24:44 +00:00
<?php
foreach(explode(",",$item["tags"]) as $tag){
?>
<span class="label label-default"><?php echo $tag; ?></span>
<?php
}
?>
</td>
2018-12-27 07:27:47 +00:00
<td><?php echo $item["id"]; ?></td-->
2018-12-27 04:24:44 +00:00
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
</div>
<p class="small text-center text-muted my-5">
<em>More table examples coming soon...</em>
</p>
2019-02-21 23:10:56 +00:00
<script>
function delete_item(id){
$.post( "/ajax.php?action=delete_found_item", {id: id} ).done(function( data ) {;
reply = JSON.parse(data);
if(reply.status == "ok"){
//TODO tabelle aktualisieren
$("#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>
2018-12-27 04:24:44 +00:00
</div>
<!-- /.container-fluid -->