示例#1
0
            <div class="col-md-4">
              <div class="page-header"><h1>Clientes</h1></div>
              <?php 
$clients = get_list('cliente', 5, $connection);
if (!empty($clients)) {
    echo '<table class="table"><thead><tr><th>#</th><th>Nome</th><th>Email</th><th>Telefone</th></tr></thead><tbody>';
    foreach ($clients as $client) {
        echo '<tr><td>' . $client['id'] . '</td><td>' . $client['nome'] . '</td><td>' . $client['email'] . '</td><td>' . $client['telefone'] . '</td></tr>';
    }
    echo '</tbody></table>';
}
?>
            </div>

            <div class="col-md-4">
              <div class="page-header"><h1>Pedidos</h1></div>
              <?php 
$orders = get_list('pedido', 5, $connection);
if (!empty($orders)) {
    echo '<table class="table"><thead><tr><th>Produto</th><th>Cliente</th></tr></thead><tbody>';
    foreach ($orders as $order) {
        echo '<tr><td>' . get_name_by_id('produto', $order['produto_id'], $connection) . '</td><td>' . get_name_by_id('cliente', $order['cliente_id'], $connection) . '</td></tr>';
    }
    echo '</tbody></table>';
}
?>
            </div>
        </div>
<?php 
require_once 'footer.php';
			  	</div>
			  	<div class="form-group">
				    <label for="client">Cliente:</label>
				    <select class="form-control" id="client" name="client" required>
				    <?php 
$clients = get_list('cliente', ' ', $connection);
foreach ($clients as $client) {
    echo '<option value="' . $client['id'] . '">' . $client['nome'] . '</option>';
}
?>
				    </select>
			  	</div>
			  	<input type="submit" class="btn btn-lg btn-success" />
	    	</form>
	    </div>
	    <div class="col-md-4">
	    	<?php 
$lasts = get_list('pedido', ' ', $connection);
if (!empty($lasts)) {
    echo '<h3>Pedidos</h3><h6>Pedidos não podem ser alterados para preservar o histórico.</h6';
    echo '<ul class="list-group">';
    foreach ($lasts as $last) {
        echo '<li class="list-group-item"><h4 class="list-group-item-heading">' . get_name_by_id('produto', $last['produto_id'], $connection) . '</h4><p class="list-group-item-text">' . get_name_by_id('cliente', $last['cliente_id'], $connection) . '</p></li>';
    }
    echo '</ul>';
}
?>
	    </div>
	</div>
<?php 
require_once 'footer.php';