FIX_bug fixes : ps
This commit is contained in:
parent
4148d76e2c
commit
7faaac70a8
@ -1202,7 +1202,7 @@ class Invoice extends BaseController
|
||||
|
||||
## Invoice Line Item..
|
||||
$invoice_child_id = $requestData['invoice_child_id'];
|
||||
$count = count($invoice_child_id);
|
||||
$count = count($invoice_child_id);
|
||||
if ($count > 0) {
|
||||
for ($x = 0; $x < $count; $x++) {
|
||||
if (!empty($requestData['item_details'][$x])) {
|
||||
@ -1249,7 +1249,7 @@ class Invoice extends BaseController
|
||||
$subscription_where = [
|
||||
'customer_id' => $customer_id,
|
||||
'invoice_id' => $invoice_id,
|
||||
'scheme_id' => $product_id
|
||||
'isactive' => 1
|
||||
];
|
||||
}
|
||||
$subs_aff_row = $model->updateData('subscription', $subscription_data, $subscription_where);
|
||||
|
||||
@ -1287,7 +1287,13 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
|
||||
var fromDateValue = "<?= isset($invoice_item_details[0]['from_subscription']) ? $invoice_item_details[0]['from_subscription'] : ""; ?>";
|
||||
if (fromDateValue != '') {
|
||||
updateToDateMinDate(fromDateValue)
|
||||
fromDateValue = formatDate(fromDateValue);
|
||||
updateToDateMinDate(fromDateValue);
|
||||
}
|
||||
|
||||
function formatDate(dateString) {
|
||||
const dateParts = dateString.split('-');
|
||||
return `${dateParts[2]}/${dateParts[1]}/${dateParts[0]}`;
|
||||
}
|
||||
|
||||
$("#editAddressesCheckbox").on("change", function() {
|
||||
@ -1555,14 +1561,22 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
invoiceDateInput.setAttribute("min", minDate);
|
||||
invoiceDateInput.setAttribute("max", maxDate);
|
||||
|
||||
const fromsubcriptionDateInput = document.getElementById("fromsubcription");
|
||||
fromsubcriptionDateInput.setAttribute("max", maxDate);
|
||||
// const fromsubcriptionDateInput = document.getElementById("fromsubcription");
|
||||
// fromsubcriptionDateInput.setAttribute("max", maxDate);
|
||||
|
||||
document.getElementById("fromsubcription").onchange = function() {
|
||||
const toDateInput = document.getElementById('tosubcription');
|
||||
toDateInput.value = ''; // Clear the value of the "To Subscription" field
|
||||
|
||||
const fromDateValue = this.value;
|
||||
updateToDateMinDate(fromDateValue);
|
||||
};
|
||||
|
||||
function updateToDateMinDate(fromDateValue) {
|
||||
const toDateInput = document.getElementById('tosubcription');
|
||||
toDateInput.min = fromDateValue;
|
||||
// toDateInput.setAttribute('data-date-end-date', fromDateValue);
|
||||
toDateInput.setAttribute('data-date-start-date', fromDateValue);
|
||||
toDateInput.setAttribute('data-date-start-date', fromDateValue); // Optional if you're using this attribute for something else
|
||||
|
||||
// Update the minimum date for the datepicker
|
||||
$(toDateInput).datepicker('setStartDate', fromDateValue);
|
||||
}
|
||||
|
||||
@ -1993,7 +2007,34 @@ function saveInvoiceCustomer() {
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function validateForm() {
|
||||
const fromDateInput = document.getElementById('fromsubcription');
|
||||
const toDateInput = document.getElementById('tosubcription');
|
||||
const invoiceDate = document.getElementById('invoiceDate');
|
||||
|
||||
if (invoiceDate.value.trim() === '') {
|
||||
alert('Please select a invoice date.');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if From Subscription field is empty
|
||||
if (fromDateInput.value.trim() === '') {
|
||||
alert('Please select a From Subscription date.');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if To Subscription field is empty
|
||||
if (toDateInput.value.trim() === '') {
|
||||
alert('Please select a To Subscription date.');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Additional validation logic if needed...
|
||||
|
||||
return true; // Form is valid
|
||||
}
|
||||
$('#saveButton').click(function() {
|
||||
if (validateForm()) {
|
||||
var formData = $("#myForm").serialize();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -2001,10 +2042,12 @@ $('#saveButton').click(function() {
|
||||
dataType: 'json',
|
||||
url: '<?php echo base_url("update_approval_subscription"); ?>',
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
if (response.success) {
|
||||
alert(response.message);
|
||||
console.log(response);
|
||||
setTimeout(function(){ window.location.href = '" . base_url("subscribers_list") . "'; }, 250);
|
||||
setTimeout(function() {
|
||||
window.location.href = "<?php echo base_url('subscribers_list'); ?>";
|
||||
}, 250);
|
||||
} else {
|
||||
alert(response.message);
|
||||
console.log(response); // Logging the response from backend
|
||||
@ -2014,7 +2057,7 @@ $('#saveButton').click(function() {
|
||||
console.error(error); // Logging any errors
|
||||
}
|
||||
});
|
||||
});
|
||||
}});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -390,7 +390,7 @@
|
||||
<table class="footer-table mt-3" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<center><small>WhatsApp No: 96004 78526 | Email: vijayabharatham78@gmail.com | Website: www.vijayabharatham.org</small></center>
|
||||
<center><small>WhatsApp No: 8939149466 | Email: contact@vijayabharathambooks.com | Website: www.vijayabharathambooks.com</small></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -51,28 +51,31 @@
|
||||
$invoice_date = date('d/m/Y', strtotime($row['invoice_date']));
|
||||
$from_date = date('d/m/Y', strtotime($row['from_subscription']));
|
||||
$to_date = date('d/m/Y', strtotime($row['to_subscription']));
|
||||
// $daysRemaining = (int)$row['subscription_in_days'];
|
||||
// $fromDateTime = (new DateTime($row['from_subscription']))->format('Y-m-d');
|
||||
// $toDateTime = (new DateTime($row['to_subscription']))->format('Y-m-d');
|
||||
// $currentDate = (new DateTime())->format('Y-m-d');
|
||||
|
||||
// Calculate days remaining
|
||||
// if ($currentDate < $fromDateTime) {
|
||||
// $interval = $fromDateTime->diff($toDateTime);
|
||||
// } else {
|
||||
// $interval = $currentDate->diff($toDateTime);
|
||||
// }
|
||||
|
||||
$fromDateTime = new DateTime($row['from_subscription']);
|
||||
$toDateTime = new DateTime($row['to_subscription']);
|
||||
$currentDate = new DateTime();
|
||||
$currentDate->setTime(0, 0, 0);
|
||||
$toDateTime->setTime(0, 0, 0);
|
||||
|
||||
// Calculate days remaining
|
||||
$interval = $currentDate->diff($toDateTime);
|
||||
$daysRemaining = $interval->days;
|
||||
|
||||
// Adjust class and message based on remaining days
|
||||
if ($currentDate > $toDateTime) {
|
||||
|
||||
if ($daysRemaining <= 0) {
|
||||
$class = 'text-danger';
|
||||
$message = "Expired";
|
||||
} elseif ($currentDate == $toDateTime) {
|
||||
$class = 'text-danger';
|
||||
$message = "Expired on Today";
|
||||
} elseif ($daysRemaining == 1) {
|
||||
$class = 'text-warning';
|
||||
$message = "Expires in 1 day";
|
||||
$message = "Expires Tomorrow";
|
||||
} elseif ($daysRemaining <= 7) {
|
||||
$class = 'text-warning';
|
||||
$message = "Expires in $daysRemaining days";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user