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['invoice_number_formatting'] = $model->getData('invoice_number_formatting', $where);
$data['books'] = $model->getCategoryBooks(1); // Invocie type = 2 (invoice)
$data['customers'] = array_reverse($data['customers']);
if ($id === '0') {
$this->logger->info("Book Invoice: In Add 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['books'] = $model->getCategoryBooks(2); // Invocie type = 2 (subscription)
$data['invoice_number_formatting'] = $model->getData('invoice_number_formatting', $where);
$data['customers'] = array_reverse($data['customers']);
if ($id === '0') {
$this->logger->info("Subscription Invoice: In Add Page");
$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_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_serial_number'] = $invoice_serial_number;
$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['tax'] = $tax;
$records['total_amount'] = $total_amount;

View File

@ -575,7 +575,7 @@ class Notifications extends BaseController
// dd($window_time);
$valid_dates = [0,1,7,15,30];
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();
$this->update_expired_members();

View File

@ -59,7 +59,7 @@
</div>
<div class="form-group col-md-4">
<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>
</div>
</div>
@ -173,7 +173,7 @@
</div>
<div class="form-group col-md-3">
<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>
@ -245,7 +245,7 @@
</div>
<div class="form-group col-md-3">
<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>
@ -630,7 +630,8 @@ document.getElementById('myForm').addEventListener('submit', function(event) {
}
function checkExisting(inputvalue,fieldname,elementid){
spanid = elementid == 'cmail' ? "emailValidationMessage" : "mobileValidationMessage";
var validationMessage = document.getElementById(spanid);
if(spanid != ''){
var validationMessage = document.getElementById(spanid);
$.ajax({
type: "POST",
url: "<?= base_url() . 'check_existing' ?>",
@ -645,13 +646,15 @@ document.getElementById('myForm').addEventListener('submit', function(event) {
validationMessage.style.color = "red";
document.getElementById(elementid).value = "";
} else {
validationMessage.textContent = "";
// validationMessage.textContent = "";
}
},
error: function() {
alert("Error occur.");
}
});
}
}
</script>
<script>

View File

@ -202,7 +202,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<option class="blueText" value="0"> + Add a customer</option>
<?php } ?>
<?php foreach ($customers as $customer) :
if ((int)$customer->isactive == 1) { ?>
if ((int)$customer->isactive == 1) {?>
<option value="<?= $customer->customer_id ?>"> <?= $customer->first_name . ' ' . $customer->last_name; ?>
</option>
<?php }
@ -636,13 +636,25 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<div class="modal fade" id="customerModal" tabindex="-1" role="dialog" aria-labelledby="paymentModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="customerModalLabel">Add New Customer</h5>
<button type="button" class="close closeCustomerModal" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form class="needs-validation" novalidate id="addCustomerForm">
<div class="modal-header">
<!-- 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">
<span aria-hidden="true">&times;</span>
</button>
</div>
</div>
</form>
</div>
<div class="modal-body">
<div class="form-row">
<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 class="form-group col-md-6">
<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 class="form-row">
@ -760,13 +772,13 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<!-- Pincode -->
<div class="form-group col-md-6">
<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 class="modal-footer">
<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>
<!-- Country, State, City, Postal Code, etc. fields for Shipping Address -->
</form>
@ -874,7 +886,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<div class="col-md-4">
<div class="form-group">
<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 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="form-group">
<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>
@ -2009,7 +2021,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
},
success: function (response) {
if (response['data']['status']) {
alert(response['data']['message']);
// alert(response['data']['message']);
// Extract response data
const customerName = response['data']['cus_name'];