Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
c56fa1d486
@ -412,6 +412,7 @@ $routes->get('deleteAttachment', 'Sales::deleteAttachment');
|
||||
$routes->post('saveAttachment', 'Sales::saveAttachment');
|
||||
$routes->get('sales_invoice', 'Sales::sales_invoice');
|
||||
$routes->post('sales_invoice', 'Sales::sales_invoice');
|
||||
$routes->post('updateInvRecQty', 'Sales::updateInvRecQty');
|
||||
|
||||
// transporter Routes
|
||||
$routes->get('transporterListing', 'Supplier::transporterListing');
|
||||
|
||||
@ -194,4 +194,25 @@ class Sales extends BaseController
|
||||
|
||||
return $this->response->setJSON(['success' => true]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function updateInvRecQty()
|
||||
{
|
||||
$invoice_id = $this->request->getPost('invoice_id');
|
||||
$received_qty = $this->request->getPost('received_qty');
|
||||
|
||||
if ($invoice_id && $received_qty) {
|
||||
|
||||
$result = $this->ipinvoice_model->updateInvRecQty($invoice_id , $received_qty);
|
||||
|
||||
if ($result) {
|
||||
echo json_encode(['status' => 'success', 'message' => 'Attachment deleted successfully.']);
|
||||
} else {
|
||||
echo json_encode(['status' => 'error', 'message' => 'Failed to delete attachment.']);
|
||||
}
|
||||
} else {
|
||||
echo json_encode(['status' => 'error', 'message' => 'Invalid attachment ID.']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@ class Ipinvoice_model extends Model
|
||||
ip_products.product_name, ip_invoice_items.item_price, ip_products.cgst, ip_products.sgst,
|
||||
ip_invoice_items.item_quantity, ip_invoice_items.item_price, ip_invoice_items.item_name, ip_invoice_items.item_quantity,
|
||||
ip_invoice_amounts.invoice_total, ip_invoice_amounts.invoice_item_subtotal, ip_invoice_amounts.invoice_item_tax_total
|
||||
,ip_invoice_attachment.file_name')
|
||||
,ip_invoice_attachment.file_name , ip_invoices.received_qty')
|
||||
->join('ip_payment_methods', 'ip_invoices.payment_method = ip_payment_methods.payment_method_id', 'left')
|
||||
->join('ip_clients', 'ip_invoices.client_id = ip_clients.client_id', 'left')
|
||||
->join('ip_users', 'ip_invoices.user_id = ip_users.user_id', 'left')
|
||||
@ -191,6 +191,17 @@ class Ipinvoice_model extends Model
|
||||
}
|
||||
|
||||
|
||||
function updateInvRecQty($invoice_id , $received_qty)
|
||||
{
|
||||
$data = ['received_qty'=>$received_qty];
|
||||
$this->db->table('ip_invoices')
|
||||
->where('invoice_id', $invoice_id)
|
||||
->update($data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This function is used to delete the user information
|
||||
|
||||
@ -57,6 +57,14 @@
|
||||
|
||||
<!-- Init js-->
|
||||
<script src="<?php echo base_url(); ?>public/new_assets/js/pages/form-wizard.init.js"></script>
|
||||
|
||||
|
||||
<!-- Plugins js -->
|
||||
<script src="<?php echo base_url(); ?>public/new_assets/libs/moment/min/moment.min.js"></script>
|
||||
<script src="<?php echo base_url(); ?>public/new_assets/libs/x-editable/bootstrap-editable/js/bootstrap-editable.min.js"></script>
|
||||
|
||||
<!-- Init js-->
|
||||
<script src="<?php echo base_url(); ?>public/new_assets/js/pages/form-xeditable.init.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('select').addClass('form-control');
|
||||
|
||||
@ -217,6 +217,14 @@
|
||||
/* Darker red on hover */
|
||||
color: white;
|
||||
}
|
||||
.editableform{
|
||||
position: relative;
|
||||
}
|
||||
.editableform .editable-buttons{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
@ -1,5 +1,60 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
<style>
|
||||
|
||||
.edit-container {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.edit-input-field {
|
||||
padding: 2px;
|
||||
font-size: 14px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.edit-input-field:focus {
|
||||
outline: none;
|
||||
border-color: #007bff;
|
||||
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
||||
}
|
||||
|
||||
.save-btn, .cancel-btn {
|
||||
border: none;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
color: #28a745;
|
||||
background-color: #e8f5e9;
|
||||
}
|
||||
|
||||
.save-btn:hover {
|
||||
background-color: #c3e6cb;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
color: #dc3545;
|
||||
background-color: #f8d7da;
|
||||
}
|
||||
|
||||
.cancel-btn:hover {
|
||||
background-color: #f5c6cb;
|
||||
}
|
||||
|
||||
|
||||
/* Target the first child element of #datatable-buttons_wrapper */
|
||||
#datatable-buttons_wrapper.dataTables_wrapper.dt-bootstrap4.no-footer> :nth-child(1) {
|
||||
display: none;
|
||||
@ -173,6 +228,7 @@
|
||||
<th>Client Name</th>
|
||||
<th>Product</th>
|
||||
<th>Quantity</th>
|
||||
<th> Rec Qty </th>
|
||||
<th>Rate</th>
|
||||
<th>Sub Total</th>
|
||||
<th>GST</th>
|
||||
@ -214,6 +270,18 @@
|
||||
<td><?php echo $invoice->client_name ?></td>
|
||||
<td><?php echo $invoice->item_name ?></td>
|
||||
<td align="right"><?php echo number_format($invoice->item_quantity, 2, '.', ',') ?></td>
|
||||
<td>
|
||||
<a href="#"
|
||||
class="editable-field"
|
||||
data-invoice-id="<?php echo $invoice->invoice_id; ?>">
|
||||
<?php echo !empty($invoice->received_qty) ? $invoice->received_qty : "Click to Edit"; ?>
|
||||
</a>
|
||||
<div class="edit-container" style="display:none;">
|
||||
<input type="text" class="edit-input-field" />
|
||||
<button class="save-btn">✔</button>
|
||||
<button class="cancel-btn">✖</button>
|
||||
</div>
|
||||
</td>
|
||||
<td align="right"><?php echo number_format($invoice->item_price, 2, '.', ',') ?></td>
|
||||
<td align="right"><?php echo number_format($subtotal, 2, '.', ',') ?></td>
|
||||
<td align="right"><?php echo number_format($cgst_amount + $sgst_amount, 2, '.', ',') ?></td>
|
||||
@ -301,6 +369,65 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
// Handle click on the <a> tag
|
||||
$(document).on('click', '.editable-field', function (e) {
|
||||
e.preventDefault();
|
||||
const $link = $(this);
|
||||
const value = $link.text().trim();
|
||||
|
||||
// Hide the <a> tag and show the edit container
|
||||
$link.hide();
|
||||
const $editContainer = $link.siblings('.edit-container');
|
||||
$editContainer.find('.edit-input-field').val(value);
|
||||
$editContainer.show();
|
||||
});
|
||||
|
||||
// Handle click on the tick (save) button
|
||||
$(document).on('click', '.save-btn', function (e) {
|
||||
e.preventDefault();
|
||||
const $btn = $(this);
|
||||
const $editContainer = $btn.closest('.edit-container');
|
||||
const $input = $editContainer.find('.edit-input-field');
|
||||
const value = $input.val().trim();
|
||||
const $link = $editContainer.siblings('.editable-field');
|
||||
const invoiceId = $link.data('invoice-id');
|
||||
$('#loader').show();
|
||||
// Save logic (API call)
|
||||
$.ajax({
|
||||
url: '<?php echo base_url() ?>updateInvRecQty',
|
||||
method: 'POST',
|
||||
data: { invoice_id: invoiceId, received_qty: value },
|
||||
success: function (response) {
|
||||
// Show success and update the <a> tag value
|
||||
$link.text(value).show();
|
||||
$editContainer.hide();
|
||||
$('#loader').hide();
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('#loader').hide();
|
||||
alert('Failed to save the value.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle click on the close (cancel) button
|
||||
$(document).on('click', '.cancel-btn', function (e) {
|
||||
e.preventDefault();
|
||||
const $btn = $(this);
|
||||
const $editContainer = $btn.closest('.edit-container');
|
||||
const $link = $editContainer.siblings('.editable-field');
|
||||
|
||||
// Hide the edit container and show the <a> tag
|
||||
$editContainer.hide();
|
||||
$link.show();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize the DataTable
|
||||
var table = $('#datatable-buttosns').DataTable({
|
||||
@ -349,9 +476,7 @@
|
||||
invoice_number: invoiceId
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
console.log(JSON.parse(response).invoiceAttachment);
|
||||
|
||||
var list = JSON.parse(response).invoiceAttachment;
|
||||
var attachmentsHtml = '';
|
||||
if(list.length){ $('#day').hide(); }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user