| Current Path : /home2/wtmwscom/www/member/ |
| Current File : /home2/wtmwscom/www/member/product_kit.php |
<?php
$title = "Order Product Kit";
include 'header.php';
$uid = $_SESSION['userid'];
?>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<h4 class="page-title">Product Ordered</h4>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0);">Lexa</a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">Tables</a></li>
<li class="breadcrumb-item active">Basic Tables</li>
</ol>
</div>
</div>
</div>
<?php if ($_SESSION['is_paid'] != 0) {
//if (mysqli_num_rows($product_kit_result) == 0) {
$result_pin = mysqli_query($connection, "SELECT t1.used_datetime as used_datetime, t2.package_amount as package_amount, t2.package_name as package_name, t2.bv_amount AS bv_amount FROM `dynamicpinnumber` t1 INNER JOIN pin_package t2 ON t1.type = t2.id WHERE t1.uid = '$uid' ORDER BY t1.used_datetime DESC LIMIT 1 ");
// $row_pin = mysqli_fetch_object($result_pin);
// $package_amount = $row_pin->bv_amount;
//
// $package_amount_new = $package_amount + 500;
?>
<div class="row">
<div class="col-lg-12">
<div class="card m-b-20" style="width:100%">
<div class="card-body">
<!-- <h3>Order Product Kit of max INR <?php echo!empty($package_amount_new) ? $package_amount_new : 0; ?></h3>-->
<?php echo getMessage(); ?>
<form name="form" id="form" method="post" enctype="multipart/form-data" action="./product_kit_modal.php">
<table class="table mb-0 datatable">
<thead>
<tr>
<th>SNo.</th>
<th>Product Name</th>
<th></th>
<th>Product Code</th>
<th></th>
<th>MRP</th>
<th></th>
<th>Choose</th>
</tr>
</thead>
<tbody>
<?php
$product_kit_user_array = array();
$product_kit_result1 = mysqli_query($connection, "SELECT * FROM product_kit_user pku WHERE uid = '$uid'");
while ($product_kit_row1 = mysqli_fetch_object($product_kit_result1)) {
$product_kit_user_array[] = $product_kit_row1->pid;
}
$query = "SELECT * FROM product_kit ";
$result = mysqli_query($connection, $query);
if ($result) {
$i = 1;
while ($row = mysqli_fetch_object($result)) {
?>
<tr>
<td><?php echo $i++; ?></td>
<td><?php echo $row->pname; ?></td>
<td></td>
<td><?php echo $row->pcode; ?></td>
<td></td>
<td><?php echo $row->mrp; ?></td>
<td></td>
<td><input <?php echo in_array($row->pid, $product_kit_user_array) ? 'checked="checked"' : '' ?> type="checkbox" name="pid[]" value="<?php echo $row->pid ?>" class="product-checkbox" data-amount="<?php echo $row->mrp; ?>" /> </td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<button type="submit" class="btn btn-primary" id="orderProduct" name="submit">Submit</button>
</form>
</div>
</div>
</div> <!-- end col -->
</div>
<?php } ?>
<div class="row">
<div class="col-lg-12">
<div class="card m-b-20" style="width:100%">
<div class="card-body">
<!-- <h4 class="mt-0 header-title">Basic example</h4>
<p class="text-muted m-b-30">For basic styling—light padding and
only horizontal dividers—add the base class <code>.table</code> to any
<code><table></code>.
</p>-->
<h3>Product Kit Ordered</h3>
<?php echo getMessage(); ?>
<table class="table mb-0 datatable">
<thead>
<tr>
<th>SNo.</th>
<th>Product Name</th>
<th></th>
<th></th>
<th>Product Code</th>
<th></th>
<th></th>
<th>MRP</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$product_kit_result = mysqli_query($connection, "SELECT pk.* FROM product_kit pk INNER JOIN product_kit_user pku ON pk.pid = pku.pid WHERE pku.uid = '$uid'");
while ($product_kit_row = mysqli_fetch_object($product_kit_result)) {
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $product_kit_row->pname; ?></td>
<td></td>
<td></td>
<td><?php echo $product_kit_row->pcode; ?></td>
<td></td>
<td></td>
<td><?php echo $product_kit_row->mrp; ?></td>
<td></td>
<td></td>
</tr>
<?php
$i++;
}
// }
?>
</tbody>
</table>
</div>
</div>
</div> <!-- end col -->
</div>
<!--table content ends here-->
</div>
<script>
var package_amount_new = <?php echo!empty($package_amount_new) ? $package_amount_new : 0; ?>;
function checkProductAmount(thisObj) {
var totalAmount = 0;
$(".product-checkbox").each(function () {
if ($(this).is(":checked")) {
totalAmount += parseFloat($(this).data("amount"));
}
});
if (totalAmount > package_amount_new) {
alert("Total amount of product you selected can not exceed your topup package amount");
$(thisObj).prop("checked", false);
}
}
</script>
<?php include 'footer.php'; ?>