Added a Alert Box in Members>Add Subscription form for existing and non existing subscribers

This commit is contained in:
Srinivas-Saravanan 2024-10-30 10:07:50 +05:30
parent f30d6db2b7
commit a5b98afcb7

View File

@ -437,8 +437,6 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</span>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="exacttotal">Total</label>
@ -854,6 +852,26 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Creating a model for new custome alert box -->
<!-- Creating a model for new custome alert box -->
<!-- Custom Alert Modal -->
<div class="modal fade" id="customAlertModal" tabindex="-1" role="dialog" aria-labelledby="customAlertLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="customAlertLabel">Alert</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" id="customAlertMessage">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
@ -1271,7 +1289,11 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
}
$('#hiddenBillingAddressId').val(bill_addrid);
get_customer_membership_details(custid)
$('#customer_name').onchange(function(){
get_customer_membership_details(custid);
})
get_customer_membership_details(custid);
}
if (inv_number != '') {
$("#invoiceNumber").val(inv_number).prop("readonly", true);
@ -1510,10 +1532,15 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
text1 = cm[0].is_renew == 1 ? " - Renewal" : "";
text2 = cm[0].isactive == 0 ? " - Expried" : "";
$(".subscribedetails").show(); // Change this line to use the class selector
$("#schemeName").text("Earlier Membership : " + cm[0].title + " ( From: " + cm[0].formatted_from_subscription + " To: " + cm[0].formatted_to_subscription + " )" + text1 + text2);
let message = "Earlier Membership : " + cm[0].title + " ( From: " + cm[0].formatted_from_subscription + " To: " + cm[0].formatted_to_subscription + " )" + text1 + text2;
console.log(text1);
$("#schemeName").text(message);
showAlert(message)
} else {
$(".subscribedetails").show(); // Change this line to use the class selector
$("#schemeName").text("No Earlier Membership found");
let message = "No Earlier Membership found";
$("#schemeName").text(message);
showAlert(message)
}
},
error: function() {
@ -1522,6 +1549,13 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
});
}
}
// New function to create a cutom alert box,
// since the default alert box is small to display the message
function showAlert(message) {
$('#customAlertMessage').text(message);
$('#customAlertModal').modal('show');
}
</script>
<!-- bill_addr = "<?= isset($invoice_details['billing_address']) ? $invoice_details['billing_address'] : ""; ?>"; -->
<!-- if (bill_addr != '') { $("#storeBillingAddress").val(bill_addr);} -->