Merge branch 'uat' of bitbucket.org:venbainformationtechnology/vb_book into uat
This commit is contained in:
commit
c48258dbc2
@ -361,7 +361,7 @@ class ApiIntegration extends ResourceController
|
||||
}
|
||||
$book_image_data[$i]['img_name'] =isset($img->name) && !empty($img->name) ? $img->name : NULL;
|
||||
$book_image_data[$i]['wp_img_url'] = isset($img->src) && !empty($img->src) ? $img->src : NULL;
|
||||
$book_image_data[$i]['is_cover'] = empty($bookImgId) && $i == 0 ? 1 : 0 ;
|
||||
$book_image_data[$i]['is_cover'] = (!empty($bookImgId) && $i == 0) ? 1 : 0 ;
|
||||
$book_image_data[$i]['type'] = 2;
|
||||
$book_image_data[$i]['book_id'] = $last_insert_book_id;
|
||||
$book_image_data[$i]['isactive'] = 1;
|
||||
|
||||
@ -173,10 +173,10 @@ class Invoice extends BaseController
|
||||
'tax' => (int)$this->request->getPost('invoice_tax'),
|
||||
'discount' => (int)$this->request->getPost('discount'),
|
||||
'total_amount' => (int)$this->request->getPost('grand_total'),
|
||||
'shipping_charge' => (int)$this->request->getPost('shippingCharges'),
|
||||
'shipping_label' =>$this->request->getPost('shippingChargesLabel'),
|
||||
'shipping_charge' => ((int)$invoiceType === 1) ? (int)$this->request->getPost('shippingCharges') : NULL,
|
||||
'shipping_label' => ((int)$invoiceType === 1) ? $this->request->getPost('shippingChargesLabel') : NULL,
|
||||
'order_number' => $this->request->getPost('order_number'),
|
||||
'payment_method' =>$this->request->getPost('payment_method'), // "Credit Card," "Cash on Delivery," "PayPal","PayTm","Gpay"
|
||||
'payment_method' => $invoice_status !== 'Draft' ? $this->request->getPost('payment_method') : NULL, // "Credit Card," "Cash on Delivery," "PayPal","PayTm","Gpay"
|
||||
'payment_status' => 'Pending', //"Paid," "Pending," "Failed," "Refunded," "Canceled," "Authorized," and "Completed."
|
||||
'event_id' => (int)$this->request->getPost('event_id'),
|
||||
'business_id' => (int)get_business_id(),
|
||||
@ -327,25 +327,27 @@ class Invoice extends BaseController
|
||||
$invoiceitem_arr = [];
|
||||
if ($count > 0) {
|
||||
for ($x = 0; $x < $count; $x++) {
|
||||
$invoiceitem_arr[$x]['invoice_id'] = $id;
|
||||
$invoiceitem_arr[$x]['product'] = (int)$requestData['item_details'][$x];
|
||||
$invoiceitem_arr[$x]['quantity'] = (int)$requestData['quantity'][$x];
|
||||
$invoiceitem_arr[$x]['tax'] = (int)$requestData['tax'][$x];
|
||||
$invoiceitem_arr[$x]['unit_price'] = (int)$requestData['rate'][$x];
|
||||
$invoiceitem_arr[$x]['subtotal'] = (int)$requestData['amount'][$x];
|
||||
$invoiceitem_arr[$x]['discount_amount'] = (int)$requestData['discount_amount'][$x];
|
||||
$invoiceitem_arr[$x]['discount_type'] =$requestData['discount_type'][$x];
|
||||
if (!empty($requestData['from_subscription'])) {
|
||||
$invoiceitem_arr[0]['from_subscription'] = $requestData['from_subscription'];
|
||||
if(!empty($requestData['item_details'][$x])){
|
||||
$invoiceitem_arr[$x]['invoice_id'] = $id;
|
||||
$invoiceitem_arr[$x]['product'] = (int)$requestData['item_details'][$x];
|
||||
$invoiceitem_arr[$x]['quantity'] = (int)$requestData['quantity'][$x];
|
||||
$invoiceitem_arr[$x]['tax'] = (int)$requestData['tax'][$x];
|
||||
$invoiceitem_arr[$x]['unit_price'] = (int)$requestData['rate'][$x];
|
||||
$invoiceitem_arr[$x]['subtotal'] = (int)$requestData['amount'][$x];
|
||||
$invoiceitem_arr[$x]['discount_amount'] = (int)$requestData['discount_amount'][$x];
|
||||
$invoiceitem_arr[$x]['discount_type'] =$requestData['discount_type'][$x];
|
||||
if (!empty($requestData['from_subscription'])) {
|
||||
$invoiceitem_arr[0]['from_subscription'] = $requestData['from_subscription'];
|
||||
}
|
||||
|
||||
if (!empty($requestData['to_subscription'])) {
|
||||
$invoiceitem_arr[0]['to_subscription'] = $requestData['to_subscription'];
|
||||
}
|
||||
$invoiceitem_arr[$x]['created_by'] = (int)get_logged_user_id();
|
||||
$invoiceitem_arr[$x]['updated_by'] = (int)get_logged_user_id();
|
||||
$invoiceitem_arr[$x]['isactive'] = 1;
|
||||
$invoiceitem_arr[$x]['invoice_child_id'] = $itemid[$x];
|
||||
}
|
||||
|
||||
if (!empty($requestData['to_subscription'])) {
|
||||
$invoiceitem_arr[0]['to_subscription'] = $requestData['to_subscription'];
|
||||
}
|
||||
$invoiceitem_arr[$x]['created_by'] = (int)get_logged_user_id();
|
||||
$invoiceitem_arr[$x]['updated_by'] = (int)get_logged_user_id();
|
||||
$invoiceitem_arr[$x]['isactive'] = 1;
|
||||
$invoiceitem_arr[$x]['invoice_child_id'] = $itemid[$x];
|
||||
}
|
||||
$statement = $model->saveInvoiceItemDetails($invoiceitem_arr);
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@
|
||||
<div class="form-group">
|
||||
<span style="<?= $shippingChargesStyle ?>">
|
||||
<label for="shippingCharges">Charge Amount </label>
|
||||
<input type="number" class="form-control" id="shippingCharges" name="shippingCharges" placeholder="Charges Amount" value="<?= isset($invoice_details['shipping_charge']) ? $invoice_details['shipping_charge'] : 0 ?>" oninput="calculateOverallTotals()" <?= $shippingChargesHidden ?> min="1" >
|
||||
<input type="number" class="form-control" id="shippingCharges" name="shippingCharges" placeholder="Charges Amount" value="<?= isset($invoice_details['shipping_charge']) ? $invoice_details['shipping_charge'] : 0 ?>" oninput="calculateOverallTotals()" <?= $shippingChargesHidden ?> min="0" >
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -268,6 +268,7 @@
|
||||
<div class="modal-body">
|
||||
<!-- Add your mode of payment options here -->
|
||||
<select class="form-control" id="paymentMode" name="payment_method">
|
||||
<option value="">Select a mode</option>
|
||||
<option value="credit">Credit Card</option>
|
||||
<option value="debit">Debit Card</option>
|
||||
<option value="cash">Cash</option>
|
||||
@ -684,10 +685,26 @@
|
||||
<!-- bill_addr = "<?= isset($invoice_details['billing_address']) ? $invoice_details['billing_address'] : ""; ?>"; -->
|
||||
<!-- if (bill_addr != '') { $("#storeBillingAddress").val(bill_addr);} -->
|
||||
<script>
|
||||
document.getElementById('saveapproved').addEventListener('click', function() {
|
||||
document.getElementById('saveapproved').addEventListener('click', function(event) {
|
||||
var paymentMode = document.getElementById('paymentMode').value;
|
||||
|
||||
if(paymentMode !== ""){
|
||||
// Get the balance amount
|
||||
var balanceAmount = parseFloat(document.getElementById('balanceAmount').value) || 0;
|
||||
|
||||
// Replicate the balance amount value to the paid amount
|
||||
document.getElementById('paidAmount').value = balanceAmount;
|
||||
|
||||
// Set the status field to 'Draft' before submitting
|
||||
document.getElementById('status').value = 'Approved';
|
||||
});
|
||||
}
|
||||
else{
|
||||
// Prevent the form submission
|
||||
// document.getElementById('paymentMode').focus();
|
||||
alert("Choose Your payment Mode ");
|
||||
event.preventDefault(); // Pass the event parameter here
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// Get the Invoice Date input element by its ID
|
||||
@ -745,15 +762,12 @@
|
||||
|
||||
// Close the modal
|
||||
$('#paymentModal').modal('hide');
|
||||
document.getElementById('paymentMode').value = "";
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('saveapproved').addEventListener('click', function() {
|
||||
// Get the balance amount
|
||||
var balanceAmount = parseFloat(document.getElementById('balanceAmount').value) || 0;
|
||||
|
||||
// Replicate the balance amount value to the paid amount
|
||||
document.getElementById('paidAmount').value = balanceAmount;
|
||||
// Add event listener for the "Close" button
|
||||
document.getElementById('paymentModal').addEventListener('hidden.bs.modal', function () {
|
||||
// Reset the payment_method value to an empty string
|
||||
document.getElementById('paymentMode').value = "";
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
@ -765,15 +779,23 @@
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
if (status == "Draft") {
|
||||
$('#saveDraftButton').prop('disabled', false);
|
||||
$('#saveApprovedButton').prop('disabled', false);
|
||||
$('#saveapproved').prop('disabled', false);
|
||||
}
|
||||
if (status == "Approved") {
|
||||
$('#saveDraftButton').prop('disabled', false);
|
||||
$('#saveApprovedButton').prop('disabled', false);
|
||||
$('#saveapproved').prop('disabled', false);
|
||||
}
|
||||
} else {
|
||||
if (status == "Draft") {
|
||||
$('#saveDraftButton').prop('disabled', true);
|
||||
$('#saveApprovedButton').prop('disabled', true);
|
||||
$('#saveapproved').prop('disabled', true);
|
||||
}
|
||||
if (status == "Approved") {
|
||||
$('#saveDraftButton').prop('disabled', true);
|
||||
$('#saveApprovedButton').prop('disabled', true);
|
||||
$('#saveapproved').prop('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user