FIX_INVOICE NOT SAVING AS APPROVED OR DRAFT ISSUE

This commit is contained in:
Srinivas-Saravanan 2024-12-17 14:24:44 +05:30
parent 1935623f7e
commit 1dee1b365c
4 changed files with 18 additions and 56 deletions

View File

@ -19,7 +19,7 @@ class App extends BaseConfig
* http://example.com/
*/
// public string $baseURL = 'http://localhost:8080/';
public string $baseURL = 'http://192.168.1.24/vb_book/';
public string $baseURL = 'http://localhost/vb_book/';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.

View File

@ -386,7 +386,6 @@ class Invoice extends BaseController
$this->logger->info("Invoice: Insert/Update Details");
try {
// Retrieve form data
dd($_POST);
$invoice_status = $this->request->getPost('status');
$invoice_id = (!empty($this->request->getPost('invoice_id'))) ? $this->request->getPost('invoice_id') : "";
$invoiceType = $this->request->getPost('invoice_type');

View File

@ -117,6 +117,7 @@ class HomeModel extends Model
->select('books.business_id,books.title as name ,scheme_id, books.short_code, count(*) as overall')
->join('books','books.book_id = subscription.scheme_id')
->where('to_subscription>now()')
->where('subscription.isactive',1)
->groupBy('scheme_id');
$results = $query->get()->getResultArray();
return $results;

View File

@ -225,17 +225,6 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div>
</div>
<div class="form-row">
<div id = 'walkin_Customer_name'class="form-group col-md-5">
<label for="walkInCustomerName">Customer Name</label>
<input type="text" class = 'form-control' name="walkInCustomerName" placeholder="Enter the Customer Name" id="walkInCustomerName" required>
</div>
<div id= 'walkin_Customer_Mobile' class="form-group col-md-5">
<label for="mobile_no">Mobile No.</label>
<input type="text" class = 'form-control'name="walkin_Customer_Mobile" id="walkin_Customer_Mobile" placeholder="Mobile Number (Enter only numbers)" maxlength="10" pattern="\d*">
</div>
</div>
<div id = 'address_div' class="form-row" style="margin-top: 19px;">
<div class="form-group col-md-5">
<label for="storeBillingAddress"> Billing Address &ensp;( <input type="checkbox" id="editAddressesCheckbox" /> Do you want to change addresses?)</label>
@ -686,8 +675,8 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<span id="mobileValidationMessage"></span>
</div>
<div class="form-group col-md-6">
<label for="baddress1" class="col-form-label">Billing Address 1<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="baddress1" name="baddress1" placeholder="Address (eg : 1234 Main St)" required/>
<label for="baddress1" class="col-form-label">Billing Address 1</span></label>
<input type="text" class="form-control" id="baddress1" name="baddress1" placeholder="Address (eg : 1234 Main St)" />
</div>
<!-- Address 2 -->
<div class="form-group col-md-6">
@ -696,8 +685,8 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div>
<div class="form-group col-md-6">
<label for="bcountry" class="col-form-label">Country<span class="text-danger"> *</span></label>
<select class="form-control" id="bcountry" name="bcountry[]"placeholder="Choose Your Country" required>
<label for="bcountry" class="col-form-label">Country</span></label>
<select class="form-control" id="bcountry" name="bcountry[]"placeholder="Choose Your Country" >
<option selected value="India">India</option> <?php
if(!empty($country_details)){
foreach ($country_details as $value) { ?>
@ -713,13 +702,13 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div>
<div class="form-group col-md-6">
<label for="sstate" class="col-form-label">City<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bcity" name="bcity" placeholder="City" required/>
<label for="sstate" class="col-form-label">City</span></label>
<input type="text" class="form-control" id="bcity" name="bcity" placeholder="City" />
</div>
<div class="form-group col-md-6">
<label for="bpincode" class="col-form-label">Pincode<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bpincode" name="bpincode" minlength="6" maxlength="6" placeholder="Pincode" required/>
<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" />
</div>
<div class="form-row">
@ -734,8 +723,8 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<div class="form-row">
<!-- Shipping Address 1 -->
<div class="form-group col-md-6">
<label for="saddress1" class="col-form-label">Shipping Address 1<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="saddress1" name="saddress1" placeholder="Address (eg : 1234 Main St)" required/>
<label for="saddress1" class="col-form-label">Shipping Address 1</span></label>
<input type="text" class="form-control" id="saddress1" name="saddress1" placeholder="Address (eg : 1234 Main St)" />
</div>
<!-- Shipping Address 2 -->
@ -746,8 +735,8 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div>
<!-- Country -->
<div class="form-group col-md-6">
<label for="scountry" class="col-form-label">Country<span class="text-danger"> *</span></label>
<select class="form-control" id="scountry" name="scountry[]"placeholder="Choose Your Country" required>
<label for="scountry" class="col-form-label">Country</span></label>
<select class="form-control" id="scountry" name="scountry[]"placeholder="Choose Your Country" >
<option selected value="India">India</option> <?php
if(!empty($country_details)){
foreach ($country_details as $value) { ?>
@ -764,14 +753,14 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div>
<div class="form-group col-md-6">
<label for="sstate" class="col-form-label">City<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="scity" name="scity" placeholder="City" required/>
<label for="sstate" class="col-form-label">City</span></label>
<input type="text" class="form-control" id="scity" name="scity" placeholder="City" />
</div>
<!-- Pincode -->
<div class="form-group col-md-6">
<label for="spincode" class="col-form-label">Pincode<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="spincode" name="spincode" minlength="6" maxlength="6" placeholder="Pincode" required />
<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" />
</div>
</div>
@ -970,32 +959,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
var page_name = <?= isset($page_name) ? json_encode($page_name) : '""' ?>;
if (page_name == 'Walkin Customers') {
$('#name_div').hide();
$("#customerName").removeAttr('required');
$('#loadShippingDropdown').removeAttr('required');
$('#hiddenBillingAddressId').removeAttr('required');
$('#hiddenBillingAddressId').hide();
$('#storeBillingAddressId').removeAttr('required');
$('#storeBillingAddressId').hide();
$('#address_div').hide();
$('#walkin_Customer_name').show();
$('#walkin_Customer_Mobile').show();
$('#walkInCustomerName').on('change', function() {
var walkInName = $('#walkInCustomerName').val();
$('#customerName').val(walkInName);
console.log('Customer name is ' + walkInName);
});
} else {
$('#walkin_Customer_name').hide();
$('#walkin_Customer_name').removeAttr('required');
$('#walkin_Customer_Mobile').hide();
}
var status = "<?php echo isset($invoice_details['status']) ? $invoice_details['status'] : ''; ?>";
var invoice_type = "<?php echo isset($invoice_type) ? $invoice_type : ''; ?>";
console.log('Invoice Type:', invoice_type);
@ -2012,8 +1976,6 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
// Validate required fields
if (!cus_first_name) missingFieldsMessage += "Name\n";
if (!cus_mobile_no) missingFieldsMessage += "Mobile No.\n";
if (!baddress1 || !bcountry || !bcity || !bzip) missingFieldsMessage += "Billing Address Fields\n";
if (!saddress1 || !scountry || !scity || !szip) missingFieldsMessage += "Shipping Address Fields\n";
// If there are missing fields, show an alert
if (missingFieldsMessage) {