Your IP : 3.145.41.108
<?php
session_start();ob_start();
include("lib/connect.inc.php");
if(isset($_POST['EditSavingContribution'])){
$sn = $_POST['EditSavingContribution'];
$sql = $db->query("SELECT * FROM contributions WHERE sn = '$sn' LIMIT 1");
$edit = $sql->fetch_object();
}
$button = (isset($edit)) ? 'UpdateContribution' : 'CreateContribution';
$btnValue = (isset($edit)) ? 'Update' : 'Submit';
$report = isset($_SESSION['report']) ? $_SESSION['report'] : null;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>My Contribution</title>
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome -->
<?php include('head.php'); ?>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">
<?php include('nav.php'); ?>
<!-- Content Wrapper. Contains page content -->
<!-- Content Header (Page header) -->
<!-- Content Header (Page header) -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>MY CONTRIBUTION</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item active">My Contributions</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section> <!-- Content Header (Page header) -->
<div class="content">
<div class="container-fluid">
<div id="refresh">
<?php if(isset($report)){$covis->Alert(); } $val = 5;?>
</div>
<div class="row">
<div class="col-md-12 col-lg-12">
<div class="card">
<div class="card-header text-white bg-dark">
My Pending Contribution
</div>
<div class="card-body">
<div class="card-body table-responsive">
<table class="table table-striped table-bordered dataTable"
id="example3">
<thead>
<tr>
<th>S/N</th>
<th>Contribution Title</th>
<th>Amount</th>
<th>Period</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
$sql = $db->query("SELECT * FROM contributionparticipants WHERE user_id = '$uid' AND status = 0 ORDER BY sn DESC");
while($row = $sql->fetch_assoc()) { $e = $i++;
$savingsId = $row['savings_id']
?>
<tr>
<td><?php echo $e; ?></td>
<td><?= getContributionField($savingsId) ?></td>
<td>$<?= getContributionField($savingsId, 'amount')
?></td>
<td><?= getContributionField($savingsId, 'period')
?></td>
<td><?= date('jS M, Y', strtotime
($row['created_at'])) ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header text-white bg-dark">
<h5>My Active Contribution</h5>
</div>
<div class="card-body table-responsive">
<table class="table table-striped table-bordered dataTable"
id="example2">
<thead>
<tr>
<th>S/N</th>
<th>ID</th>
<th>Title</th>
<th>Amount</th>
<th>Created By</th>
<th>Total Amount Contributed</th>
<th>Start Date</th>
<th>End Date</th>
<th>Action</th>
<!-- <th>Action</th> -->
</tr>
</thead>
<tbody>
<?php
$i=1;
$sql = $db->query("SELECT * FROM contributionparticipants WHERE user_id = '$uid' AND status = 1 ORDER BY sn DESC");
while($row = $sql->fetch_assoc()) { $e = $i++;
$savingsId = $row['savings_id']
?>
<tr>
<td><?php echo $e; ?></td>
<td><?php echo $savingsId ?></td>
<td><?= getContributionField($savingsId) ?></td>
<td>$<?= getContributionField($savingsId, 'amount') ?></td>
<td><?php echo userName(getContributionField($savingsId, 'user_id')).
'('.userName(getContributionField($savingsId,
'user_id'), 'user').')'
?></td>
<td>$<?= getTotalContribution($uid, $savingsId, 1) ??
0 ?>
</td>
<td><?= getContributionField
($savingsId, 'start') ? date('jS M, Y',
getContributionField
($savingsId, 'start')) : '-'; ?></td>
<td><?= getContributionField
($savingsId, 'stop') ? date('jS M, Y',
getContributionField
($savingsId, 'stop')) : '-';
?></td>
<?php
$disabled1 = ( (getContributionField($savingsId, 'start') == null
|| time() < getContributionField
($savingsId, 'start') || time() > getContributionField
($savingsId, 'stop'))) ? 'disabled': '';
?>
<td>
<form method="POST">
<button class="btn btn-success btn-block"
data-savings="<?= $savingsId ?>"
data-id="<?= $uid ?>"
data-period="<?= getContributionField
($savingsId, 'period') ?>"
data-amount="<?= getContributionField
($savingsId, 'amount') ?>"
id="PaySavingsContribution"
<?= $disabled1 ?>
name="PaySavingsContribution">
Pay
</button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /.card -->
<!-- right col -->
</div>
<!-- /.row (main row) -->
</div><!-- /.container-fluid -->
<!-- /.content -->
</div>
<div class="modal fade" role="dialog" tabindex="-1" id="paySavings">
<div class="modal-dialog modal-dialog-centered modal-sm modal-dialog-scrollable"
role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="editTitle">Contribution Details (Wallet:
$<?= number_format($covis->totalEarnings($uidx), 2) ?> )
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button></div>
<div class="modal-body">
<form method="POST">
<div id="showTable" class="table-responsive"></div>
<input type="hidden" id="savingsM" name="savingsM">
<input type="hidden" id="amountM" name="amountM">
<input type="hidden" id="monthM" name="monthM">
<button class="btn btn-primary float-right" type="submit"
name="PayContribution" id="PayContribution">
Pay
</button>
</form>
</div>
</div>
</div>
</div>
<!-- /.content-wrapper -->
<?php include('foot.php'); ?>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="../plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
$.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- ChartJS -->
<script src="../plugins/chart.js/Chart.min.js"></script>
<!-- Sparkline -->
<script src="../plugins/sparklines/sparkline.js"></script>
<!-- JQVMap -->
<script src="../plugins/jqvmap/jquery.vmap.min.js"></script>
<script src="../plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
<!-- jQuery Knob Chart -->
<script src="../plugins/jquery-knob/jquery.knob.min.js"></script>
<!-- daterangepicker -->
<script src="../plugins/moment/moment.min.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="../plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="../plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="../dist/js/pages/dashboard.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<!-- page script -->
<script>
$(function () {
$("#example1").DataTable({
"responsive": true,
"autoWidth": false,
});
$('#example2').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": false,
});
$('#example3').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
$('#example4').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": false,
});
$('#example5').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
$('#example6').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
$('#example7').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
$('#shared').on('input', function() {
const shared = $('#shared').val();
const participant = $('#participants').val();
let result = participant % shared;
if(result !== 0 && shared.trim() !== ''){
$('#result').show().html('Please make sure the division of participants and ' +
'no of' +
' ' +
'beneficiary' +
' ' +
'result to an even number')
$('#submitSaving').attr('disabled', 'disabled')
} else {
$('#result').hide();
$('#submitSaving').removeAttr('disabled')
}
});
$('body').on('click', '#PaySavingsContribution', function (e) {
e.preventDefault();
const savings = $(this).data('savings')
const user = $(this).data('id')
const amount = $(this).data('amount')
const period = $(this).data('period')
const request = {
savings, user
}
$('#paySavings').modal('show')
// console.log(request)
$.ajax({
url: 'ajax.php?paySavings='+JSON.stringify(request),
method: 'GET'
}).done((res) => {
res = JSON.parse(res)
let table = `<table class="table">`
if(res.count === period){
$('#PayContribution').hide();
}
// if(res.count < 1){
for(let i = 1; i <= period; i++){
let styleShow = '';
if(i < (res.count+1)){
styleShow = "background-color: gray; color: white"
} else if(i === (res.count+1)){
styleShow = "background-color: blue; color: white"
} else {
styleShow = ""
}
table += `<tbody>
<tr class="active" style="${styleShow}">
<td><input type="checkbox"
${i <= (res.count+1) ? 'checked': ''} disabled
class="form-control"
/></td>
<td>$${amount}</td>
<td>Month ${i}</td>
</tr></tbody>`
}
// }
table += '</table>'
$('#showTable').html(table)
$('#amountM').val(amount)
$('#savingsM').val(savings)
$('#monthM').val((res.count + 1))
})
// $('#showTable').html(user+' Savings: '+savings)
})
});
</script>
<!-- page script -->
<script type="text/javascript">
<?php
// if($covis->globeStage($uidy)==1 ){
if($stages==1 ){
echo $covis->covisTreeGlobe($uid);
}else{
echo $covis->covisTree4Globe($uid);
}
?>
</script>
<script src="treant/vendor/raphael.js"></script>
<script src="treant/Treant.js"></script>
<script>
new Treant( chart_config );
</script>
</body>
</html>