This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
remove = function(item) { | |
var tr = $(item).closest('tr'); | |
tr.fadeOut(400, function() { | |
tr.remove(); | |
}); | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table id="details-table" class="table table-bordered"> | |
<tr> | |
<th>Coluna 1</th> | |
<th>Coluna 2</th> | |
<th>Coluna 3</th> | |
<th>Coluna 4</th> | |
<th>Opções</th> | |
</tr> | |
<tr> | |
<td> </td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<h1 class="page-header">Tabelas com Bootstrap</h1> | |
<div class="table-responsive"> | |
<table class="table table-striped table-bordered table-hover"> | |
<thead> | |
<tr> | |
<th>#</th> | |
<th>Coluna 01</th> | |
<th>Coluna 02</th> | |
<th>Coluna 03</th> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove uma linha de uma tabela pelo ID do registro | |
*/ | |
function remove( $table = null, $id = null ) { | |
$database = open_database(); | |
try { | |
if ($id) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('functions.php'); | |
if (isset($_GET['id'])){ | |
delete($_GET['id']); | |
} else { | |
die("ERRO: ID não definido."); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Passa os dados do cliente para o Modal, e atualiza o link para exclusão | |
*/ | |
$('#delete-modal').on('show.bs.modal', function (event) { | |
var button = $(event.relatedTarget); | |
var id = button.data('customer'); | |
var modal = $(this); | |
modal.find('.modal-title').text('Excluir Cliente #' + id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Modal de Delete--> | |
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="modalLabel"> | |
<div class="modal-dialog" role="document"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Fechar"><span aria-hidden="true">×</span></button> | |
<h4 class="modal-title" id="modalLabel">Excluir Item</h4> | |
</div> | |
<div class="modal-body"> | |
Deseja realmente excluir este item? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Exclusão de um Cliente | |
*/ | |
function delete($id = null) { | |
global $customer; | |
$customer = remove('customers', $id); | |
header('location: index.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('functions.php'); | |
view($_GET['id']); | |
?> | |
<?php include(HEADER_TEMPLATE); ?> | |
<h2>Cliente <?php echo $customer['id']; ?></h2> | |
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Visualização de um Cliente | |
*/ | |
function view($id = null) { | |
global $customer; | |
$customer = find('customers', $id); | |
} |