donation/app/Views/subscribers_list.php

134 lines
8.4 KiB
PHP

<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="float-right">
<!-- Add a "Print Addresses" button -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#printAddressesModal">Print Addresses</button>
<a href="<?= base_url() . "new_subscription_invoice/0"; ?>" class="btn btn-primary"><i class="ri-shield-user-line"></i> Add Subscription</a>
</div><!-- end col-->
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
<div class="table-responsive">
<table id="scroll-horizontal-datatable_subcription" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Invoice Number</th>
<th>Invoice Date</th>
<th>From Subscription</th>
<th>To Subscription</th>
<th>Customer Name</th>
<th>Scheme Name</th>
<th>Status</th>
<th>Total</th>
<th align="center">Action</th>
</tr>
</thead>
<tbody>
<?php
foreach ($invoice as $row) :
if ($row['invoice_type'] == 1) :
$invoice_date = date('d/m/Y', strtotime($row['invoice_date']));
?>
<tr>
<td hidden><?= $row['invoice_id'] ?></td>
<td><?= $row['invoice_number']; ?></td>
<td><?= $invoice_date; ?></td>
<td><?= $row['from_subscription']; ?></td>
<td><?= $row['to_subscription']; ?></td>
<td><?= $row['customer_name']; ?></td>
<td><?= $row['scheme_name']; ?></td>
<td><?= $row['status']; ?></td>
<td><?= "₹ " . $row['total_amount']; ?></td>
<td>
<!-- <a href="<?= base_url() . "approve_invoice/" . $row['invoice_id']; ?>" class="approve-button" title="Approve the Invoice"><i class="ri-checkbox-circle-fill"></i></a>&nbsp; -->
<?php if ($row['invoice_type'] == 1) : ?>
<a href="<?= base_url() . "new_subscription_invoice/" . $row['invoice_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>&nbsp;
<?php elseif ($row['invoice_type'] == 2) : ?>
<a href="<?= base_url() . "new_book_invoice/" . $row['invoice_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>&nbsp;
<?php endif; ?>
<a href="<?= base_url("generate_invoice_pdf/{$row['invoice_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>&nbsp;
<a href="<?= base_url("print_address/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-line"></i></a>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<!-- Scheme List Modal -->
<!-- Create a modal for scheme selection -->
<div class="modal fade" id="printAddressesModal" tabindex="-1" role="dialog" aria-labelledby="printAddressesModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="printAddressesModalLabel">Select Schemes to Print Addresses</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Create a form to select schemes and download details -->
<!-- ... Inside the modal in subscriber_list.php ... -->
<form action="<?= base_url('subscription/download_details'); ?>" method="post">
<div class="form-group">
<?php
$uniqueSchemes = [];
foreach ($subscriber as $scheme) :
if (!in_array($scheme['title'], $uniqueSchemes)) {
$uniqueSchemes[] = $scheme['title'];
?>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="selected_schemes[]" value="<?= $scheme['title']; ?>">
<label class="form-check-label"><?= $scheme['title']; ?></label>
</div>
<?php
}
endforeach;
?>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="form-check-label">Select Action:</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="action" value="1" checked>
<label class="form-check-label">1</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="action" value="2">
<label class="form-check-label">2 x 4(A4)</label>
</div>
</div>
</div>
<div class="col-md-6">
<div style="text-align: end;margin-top: 2rem;"> <!-- Adjust the margin as needed -->
<button type="submit" class="btn btn-primary">Download Details</button>
</div>
</div>
</div>
</form>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('#scroll-horizontal-datatable_subcription').DataTable({
"order": [
[0, "desc"]
] // 0 is the column index
});
});
</script>