c3lf-system-3/templates/match.php
2019-03-02 02:19:17 +01:00

81 lines
2.7 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: jedi
* Date: 12/27/18
* Time: 1:49 PM
*/
?>
<div class="container-fluid">
<!-- Breadcrumbs-->
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="#">Dashboard</a>
</li>
<li class="breadcrumb-item">Matches</li>
<li class="breadcrumb-item active">Add</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>
Insert Item into DB
</div>
<div class="card-body">
<form method="POST" id="match_form" action="/action.php?action=tinder">
<div class="form-group">
<input type="text" class="form-control" placeholder="FUND-ID" name="found_id" <?php if(isset($_GET["id"])) echo "value=\"".$_GET["id"]."\" readonly" ?>></div>
<div class="form-group">
<label>Only fill out one of these:</label>
<div class="input-group">
<input type="text" class="form-control" placeholder="LOST-ID" name="lost_id">
<input type="text" class="form-control" placeholder="TICKET-ID" name="ticket_id">
</div>
</div>
<div class="form-group">
<button type="submit" class="form-control" onclick="add_match(); return false;">Submit</button>
</div>
</form>
</div>
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
</div>
</div>
<script>
function add_match(){
$.post( "/ajax.php?action=add_match", $( "#match_form" ).serialize() ).done(function( data ) {
reply = JSON.parse(data);
if(reply.status == "ok"){
//update_found_table();
$("#alertmessage").collapse('hide');
$("#successmessage").html(reply.message).collapse('show');
setTimeout(function(){ window.location.assign("/table/") }, 1000);
}else{
$("#successmessage").collapse('hide');
$("#alertmessage").html(reply.message).collapse('show');
}
}).fail(function() {
$("#successmessage").collapse('hide');
$("#alertmessage").html("error").collapse('show');
});
}
</script>
<!-- /.container-fluid -->
<!-- /.content-wrapper -->