</script> <div class="container"> <div class="page-header"> <h2>Profile <small>Group by customers</small></h2> </div> <?php include_once "api/customer.php"; $Customer = new Customer(); if ($id) { include_once "api/purchase.php"; include_once "api/payment.php"; $Purchase = new Purchase(); $Payment = new Payment(); $profile = $Customer->getCustomer($id); if (count($profile)) { $getPurchases = $Purchase->getCustomerPurchases($id); $getPayments = $Payment->getCustomerPayments($id); $credit_limit = $profile->credit_limit == 0 ? 'Unlimited' : $profile->credit_limit; ?> <div class="row"> <div class="col-md-12"> <div class="well well-sm"> <h2><?php echo $profile->first_name . " " . $profile->last_name; ?> </h2> <div><?php echo $profile->address; ?> </div>
<?php } else { // id not set, show all customers and there purchases include_once "api/customer.php"; $Customer = new Customer(); $getCustomers = $Customer->getCustomers(); // $getCustomers = $Customer->getCustomers(); if (count($getCustomers)) { echo "<div id='accordion' class='panel-group'>"; foreach ($getCustomers as $val) { $getPurchases = $Purchase->getCustomerPurchases($val->id); echo "<div class='panel panel-success'>\n\t\t\t\t<div class='panel-heading'>\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t<a href='#section{$val->id}' data-parent='#accordion' data-toggle='collapse' class='collapsed'>\n\t\t\t\t\t\t{$val->first_name} {$val->last_name}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</h4>\n\t\t\t\t</div>\n\t\t\t\t<div class='panel-collapse collapse' id='section{$val->id}'>\n\t\t\t<div class='panel-body'>"; ?> <table class="table table-condensed "> <thead> <tr> <th>#</th> <th>Product</th> <th>Price</th> <th>Quantity</th> <th>Total</th> <th>Balance</th> <th >Date</th> <th>Action</th> </tr>