FIX_REQUESTED CLIENT CHANGES IN QUICK ADD

This commit is contained in:
Srinivas-Saravanan 2024-12-21 12:48:52 +05:30
parent 2617911d2e
commit 457eab75e6
4 changed files with 42 additions and 22 deletions

View File

@ -80,7 +80,7 @@ class Invoice extends BaseController
$data['financial_year'] = get_financial_year(); $data['financial_year'] = get_financial_year();
$data['invoice_number_formatting'] = $model->getData('invoice_number_formatting', $where); $data['invoice_number_formatting'] = $model->getData('invoice_number_formatting', $where);
$data['books'] = $model->getCategoryBooks(1); // Invocie type = 2 (invoice) $data['books'] = $model->getCategoryBooks(1); // Invocie type = 2 (invoice)
$data['customers'] = array_reverse($data['customers']);
if ($id === '0') { if ($id === '0') {
$this->logger->info("Book Invoice: In Add Details"); $this->logger->info("Book Invoice: In Add Details");
$data['page_name'] = 'Add Book Invoice Details'; $data['page_name'] = 'Add Book Invoice Details';
@ -115,6 +115,7 @@ class Invoice extends BaseController
$data['events'] = $model->getData('events', array_merge($where, ['isactive' => 1])); $data['events'] = $model->getData('events', array_merge($where, ['isactive' => 1]));
$data['books'] = $model->getCategoryBooks(2); // Invocie type = 2 (subscription) $data['books'] = $model->getCategoryBooks(2); // Invocie type = 2 (subscription)
$data['invoice_number_formatting'] = $model->getData('invoice_number_formatting', $where); $data['invoice_number_formatting'] = $model->getData('invoice_number_formatting', $where);
$data['customers'] = array_reverse($data['customers']);
if ($id === '0') { if ($id === '0') {
$this->logger->info("Subscription Invoice: In Add Page"); $this->logger->info("Subscription Invoice: In Add Page");
$data['page_name'] = 'Add Subscription Invoice Details'; $data['page_name'] = 'Add Subscription Invoice Details';
@ -838,10 +839,14 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
$business_email = $rec['business_email']; $business_email = $rec['business_email'];
$business_mobile_no = $rec['business_mobile_no']; $business_mobile_no = $rec['business_mobile_no'];
} }
if (!isset($recipient_email)){
log_message('error','Email Id not set for customer');
return;
}
$records['invoice_order_number'] = $reference_number; $records['invoice_order_number'] = $reference_number;
$records['invoice_serial_number'] = $invoice_serial_number; $records['invoice_serial_number'] = $invoice_serial_number;
$records['recipient_name'] = $recipient_name; $records['recipient_name'] = $recipient_name;
$records['recipient_email'] = $recipient_email ? $recipient_email : "sanjeev.p@venbainfotech.com"; $records['recipient_email'] = $recipient_email ? $recipient_email : $business_email;
$records['subtotal'] = $subtotal; $records['subtotal'] = $subtotal;
$records['tax'] = $tax; $records['tax'] = $tax;
$records['total_amount'] = $total_amount; $records['total_amount'] = $total_amount;

View File

@ -575,7 +575,7 @@ class Notifications extends BaseController
// dd($window_time); // dd($window_time);
$valid_dates = [0,1,7,15,30]; $valid_dates = [0,1,7,15,30];
if(!in_array($window_time,$valid_dates) ){ if(!in_array($window_time,$valid_dates) ){
return "Invalid Window Time"; return "Please enter a valid notification period. Accepted values are 0, 7, 15, or 30 days.";
} }
$NotificationModel = new NotificationModel(); $NotificationModel = new NotificationModel();
$this->update_expired_members(); $this->update_expired_members();

View File

@ -59,7 +59,7 @@
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="cmail" class="col-form-label">Email<span class="text-danger"> </span></label> <label for="cmail" class="col-form-label">Email<span class="text-danger"> </span></label>
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onChange="validateEmail(this.value)" onchange="checkExisting(this.value,'email','cmail')" /> <input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" onchange="checkExisting(this.value,'email','cmail')" />
<span id="emailValidationMessage"></span> <span id="emailValidationMessage"></span>
</div> </div>
</div> </div>
@ -173,7 +173,7 @@
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger"> *</span></label> <label for="bzip" class="col-form-label">Postal Code<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bzip" name="bzip[]" placeholder="Postal Code" required pattern="\d*" maxlength="10" /> <input type="number" class="form-control" id="bzip" name="bzip[]" placeholder="Postal Code" required pattern="\d*" maxlength="6" />
</div> </div>
</div> </div>
@ -245,7 +245,7 @@
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="szip" class="col-form-label">Postal Code<span class="text-danger"> *</span></label> <label for="szip" class="col-form-label">Postal Code<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="szip" name="szip[]" placeholder="Postal Code" required pattern="\d*" maxlength="10" /> <input type="number" class="form-control" id="szip" name="szip[]" placeholder="Postal Code" required pattern="\d*" maxlength="6" />
</div> </div>
@ -630,6 +630,7 @@ document.getElementById('myForm').addEventListener('submit', function(event) {
} }
function checkExisting(inputvalue,fieldname,elementid){ function checkExisting(inputvalue,fieldname,elementid){
spanid = elementid == 'cmail' ? "emailValidationMessage" : "mobileValidationMessage"; spanid = elementid == 'cmail' ? "emailValidationMessage" : "mobileValidationMessage";
if(spanid != ''){
var validationMessage = document.getElementById(spanid); var validationMessage = document.getElementById(spanid);
$.ajax({ $.ajax({
type: "POST", type: "POST",
@ -645,7 +646,7 @@ document.getElementById('myForm').addEventListener('submit', function(event) {
validationMessage.style.color = "red"; validationMessage.style.color = "red";
document.getElementById(elementid).value = ""; document.getElementById(elementid).value = "";
} else { } else {
validationMessage.textContent = ""; // validationMessage.textContent = "";
} }
}, },
error: function() { error: function() {
@ -653,6 +654,8 @@ document.getElementById('myForm').addEventListener('submit', function(event) {
} }
}); });
} }
}
</script> </script>
<script> <script>
function restriction(event) { function restriction(event) {

View File

@ -637,12 +637,24 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="customerModalLabel">Add New Customer</h5> <!-- Add Form -->
<form class="needs-validation w-100" novalidate id="addCustomerForm">
<div class="d-flex justify-content-between align-items-center w-100">
<!-- Add New Customer (Aligned Left) -->
<h5 class="modal-title" id="customerModalLabel" style="margin: 0;">Add New Customer</h5>
<!-- Buttons (Aligned Right) -->
<div class="d-flex">
<button type="submit" class="btn btn-primary save-invoice-customer" style="margin-right: 10px;">Save Customer</button>
<button type="button" class="close closeCustomerModal" data-dismiss="modal" aria-label="Close"> <button type="button" class="close closeCustomerModal" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<form class="needs-validation" novalidate id="addCustomerForm"> </div>
</form>
</div>
<div class="modal-body"> <div class="modal-body">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
@ -708,7 +720,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div> </div>
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="bpincode" class="col-form-label">Pincode</span></label> <label for="bpincode" class="col-form-label">Pincode</span></label>
<input type="text" class="form-control" id="bpincode" name="bpincode" minlength="6" maxlength="6" placeholder="Pincode" /> <input type="number" class="form-control" id="bpincode" name="bpincode" minlength="6" maxlength="6" placeholder="Pincode" />
</div> </div>
<div class="form-row"> <div class="form-row">
@ -760,13 +772,13 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<!-- Pincode --> <!-- Pincode -->
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="spincode" class="col-form-label">Pincode</span></label> <label for="spincode" class="col-form-label">Pincode</span></label>
<input type="text" class="form-control" id="spincode" name="spincode" minlength="6" maxlength="6" placeholder="Pincode" /> <input type="number" class="form-control" id="spincode" name="spincode" minlength="6" maxlength="6" placeholder="Pincode" />
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary closeCustomerModal" data-dismiss="modal" id="closeCustomerModal">Close</button> <button type="button" class="btn btn-secondary closeCustomerModal" data-dismiss="modal" id="closeCustomerModal">Close</button>
<button type="submit" class="btn btn-primary save-invoice-customer">Save Customer</button>
</div> </div>
<!-- Country, State, City, Postal Code, etc. fields for Shipping Address --> <!-- Country, State, City, Postal Code, etc. fields for Shipping Address -->
</form> </form>
@ -874,7 +886,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="quick_billing_postal_code"> Postal Code<span class="text-danger"> *</span></label> <label for="quick_billing_postal_code"> Postal Code<span class="text-danger"> *</span></label>
<input class="form-control" type="text" id="quick_billing_postal_code" required placeholder="Postal Code"> <input class="form-control" type="number" id="quick_billing_postal_code" required placeholder="Postal Code" maxlength="6">
</div> </div>
</div> </div>
<div class="form-group col-md-12 text-right"> <div class="form-group col-md-12 text-right">
@ -922,7 +934,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="quick_shipping_postal_code"> Postal Code<span class="text-danger"> *</span></label> <label for="quick_shipping_postal_code"> Postal Code<span class="text-danger"> *</span></label>
<input class="form-control" type="text" id="quick_shipping_postal_code" required placeholder="Postal Code"> <input class="form-control" type="number" id="quick_shipping_postal_code" required placeholder="Postal Code" maxlength="6">
</div> </div>
</div> </div>
</div> </div>
@ -2009,7 +2021,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
}, },
success: function (response) { success: function (response) {
if (response['data']['status']) { if (response['data']['status']) {
alert(response['data']['message']); // alert(response['data']['message']);
// Extract response data // Extract response data
const customerName = response['data']['cus_name']; const customerName = response['data']['cus_name'];