Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
f01e195f01
@ -4256,8 +4256,14 @@ class Purchaseorder extends BaseController
|
||||
$filelist = array('PONO' => $pono, 'IGRNO' => $igr, 'FilePath' => $Picture);
|
||||
$uploadfiles = $this->purchaseorder_model->insertfile($filelist);
|
||||
if ($uploadfiles > 0) {
|
||||
echo "file updated successfully!";
|
||||
return true;
|
||||
$response = [
|
||||
'message' => 'File updated successfully!',
|
||||
'data' => $uploadfiles
|
||||
];
|
||||
|
||||
// Return the response as JSON
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
} else{
|
||||
echo " Internal Server Error..!!";
|
||||
@ -4395,8 +4401,16 @@ class Purchaseorder extends BaseController
|
||||
}
|
||||
|
||||
|
||||
if($uploadfile > 0){
|
||||
echo "updated successfully!";
|
||||
if( $uploadfile['afftectedRows'] > 0){
|
||||
|
||||
$response = [
|
||||
'message' => 'File updated successfully!',
|
||||
'data' =>$uploadfile['updatedRow']
|
||||
];
|
||||
|
||||
// Return the response as JSON
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
else{
|
||||
echo "Update Failed (maybe same file provided for update kindly check)..!!";
|
||||
|
||||
@ -2325,12 +2325,23 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
||||
function updatefile($bill, $Picture)
|
||||
{
|
||||
|
||||
$uploadfile;
|
||||
$this->db->table('t_purchaseorder_billupload')
|
||||
->set('FilePath', $Picture)
|
||||
->where('BillNo', $bill)
|
||||
->update();
|
||||
$afftectedRows = $this->db->affectedRows();
|
||||
return $afftectedRows;
|
||||
|
||||
$uploadfile['afftectedRows'] = $this->db->affectedRows();
|
||||
|
||||
if( $uploadfile['afftectedRows'] > 0){
|
||||
$uploadfile['updatedRow'] = $this->db->table('t_purchaseorder_billupload')
|
||||
->where('BillNo', $bill)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
}
|
||||
return $uploadfile;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2425,11 +2436,11 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
||||
function insertfile($filelist)
|
||||
{
|
||||
|
||||
//print_r($myfile);die;
|
||||
$builder = $this->db->table('t_purchaseorder_billupload');
|
||||
$builder->insert($filelist);
|
||||
$myfile = $this->db->affectedRows();
|
||||
return $myfile;
|
||||
$insertedID = $this->db->insertID();
|
||||
$insertedRow = $builder->where('BillNo', $insertedID)->get()->getRowArray();
|
||||
return $insertedRow;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
@ -1096,11 +1096,11 @@ if (!empty($getlogpodtl)) {
|
||||
<table id="ServiceTable" class="table table-striped table-hover mb-0" style="font-size:12px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>SNo</th>
|
||||
<th>Requisition No</th>
|
||||
<th>Item Code</th>
|
||||
<th style="text-align:center !important;">SNo</th>
|
||||
<th style="text-align:center !important;">Requisition No</th>
|
||||
<th style="text-align:center !important;">Item Code</th>
|
||||
<th>Item Name</th>
|
||||
<th style="text-align: right;">Quantity</th>
|
||||
<th style="text-align: center;">Quantity</th>
|
||||
<th>UOM</th>
|
||||
<th style="text-align: right;">Rate <?php echo "($INRSYM)" ?></th>
|
||||
<th style="text-align: right;">Basic Amount <?php echo "($INRSYM)" ?></th>
|
||||
@ -1132,11 +1132,11 @@ if (!empty($getlogpodtl)) {
|
||||
|
||||
?>
|
||||
<tr id="<?php echo $index; ?>">
|
||||
<td align="left"><?php echo $index; ?></td>
|
||||
<td><?php echo $record->ReqNo ?></td>
|
||||
<td><?php echo $record->MaterialCode ?></td>
|
||||
<td align="center"><?php echo $index; ?></td>
|
||||
<td align="center"><?php echo $record->ReqNo ?></td>
|
||||
<td align="center"><?php echo $record->MaterialCode ?></td>
|
||||
<td><?php echo $record->MaterialName ?></td>
|
||||
<td align="right"><?php echo $record->Quantity ?></td>
|
||||
<td align="center"><?php echo $record->Quantity ?></td>
|
||||
<td><?php echo $record->UOM ?></td>
|
||||
|
||||
<td align="right"><?php echo $record->Rate ?></td>
|
||||
|
||||
@ -128,7 +128,7 @@
|
||||
<th>PONO#</th>
|
||||
<th>PO Type</th>
|
||||
<th>Supplier Name</th>
|
||||
<th>Total Order Value</th>
|
||||
<th style="text-align: right !important;">Total Order Value</th>
|
||||
<th>PO Status</th>
|
||||
<th>Delivery Option</th>
|
||||
<th>Delivery Date</th>
|
||||
@ -152,7 +152,7 @@
|
||||
<td><?php echo $record->ReqType ?></td>
|
||||
|
||||
<td><?php echo $record->SupplierName ?></td>
|
||||
<td><?php echo $record->TotalOrderValue ?></td>
|
||||
<td align="right"><?php echo $record->TotalOrderValue ?></td>
|
||||
|
||||
<!-- <td><?php echo $record->StatusName ?></td> -->
|
||||
<td><?php
|
||||
|
||||
@ -2522,14 +2522,14 @@ if (!empty($getlogpodtl)) {
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="spl">
|
||||
<tbody id="splPoBillTbId">
|
||||
<?php
|
||||
if (!empty($billfile)) {
|
||||
if (!empty($billfile)) {
|
||||
|
||||
foreach ($billfile as $row => $gd) {
|
||||
if (!empty($gd->BillNo)) {
|
||||
$index = $row + 1;
|
||||
?>
|
||||
foreach ($billfile as $row => $gd) {
|
||||
if (!empty($gd->BillNo)) {
|
||||
$index = $row + 1;
|
||||
?>
|
||||
<tr id="lastvalue">
|
||||
<td><?php echo $gd->BillNo ?></td>
|
||||
|
||||
@ -5090,8 +5090,17 @@ if (!empty($getlogpodtl)) {
|
||||
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
console.error("AJAX Error: " + textStatus + ": " + errorThrown);
|
||||
alert("Error: " + textStatus);
|
||||
// Handle errors here
|
||||
$('#loader').hide();
|
||||
console.error("AJAX Error: ", textStatus, errorThrown);
|
||||
alert("An error occurred: " + textStatus + " - " + errorThrown);
|
||||
|
||||
},
|
||||
|
||||
complete: function() {
|
||||
// Actions that should always happen regardless of success or error
|
||||
console.log("AJAX request completed.");
|
||||
$('#loader').hide(); // Hide the loader in any case
|
||||
}
|
||||
|
||||
});
|
||||
@ -5304,24 +5313,25 @@ if (!empty($getlogpodtl)) {
|
||||
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: formData, // The form data to send (contains the file)
|
||||
type: "POST", // HTTP method
|
||||
url: "<?php echo base_url();?>purchaseorder/uploadfile", // URL to send the request to
|
||||
cache: false, // Disable caching of the response
|
||||
contentType: false, // Tell jQuery not to set content type (it's handled by FormData)
|
||||
processData: false, // Don't process the data into a query string (needed for FormData)
|
||||
data: formData,
|
||||
type: "POST",
|
||||
url: "<?php echo base_url();?>purchaseorder/uploadfile",
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
$('#loader').hide(); // Hide loader on success
|
||||
alert(data); // Show response data (you may want to customize this)
|
||||
$('#billModel').modal('hide'); // Hide the modal if file uploaded successfully
|
||||
window.location.reload(); // Reload the page to reflect changes
|
||||
success: function(response) {
|
||||
if (response) {
|
||||
$('#loader').hide();
|
||||
updateRowToTable(response.data,response.data.BillNo);
|
||||
console.log(response.data);
|
||||
$('#billModel').modal('hide');
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) { // Handle errors gracefully
|
||||
$('#loader').hide(); // Hide the loader even on error
|
||||
error: function(xhr, status, error) {
|
||||
$('#loader').hide();
|
||||
let errorMessage = '';
|
||||
|
||||
// Custom error messages based on status codes
|
||||
@ -5417,11 +5427,13 @@ if (!empty($getlogpodtl)) {
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
success: function(response) {
|
||||
if (response) {
|
||||
$('#loader').hide();
|
||||
alert(data);
|
||||
window.location.reload();
|
||||
alert(response.message);
|
||||
console.log(response.data.BillNo);
|
||||
console.log(response.data.FilePath);
|
||||
addRowToTable(response.data);
|
||||
$('#billModel').modal('hide');
|
||||
}
|
||||
},
|
||||
@ -5551,4 +5563,57 @@ if (!empty($getlogpodtl)) {
|
||||
$('#Quantity').attr('required', true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// This function adds a new row to the table
|
||||
function addRowToTable(data) {
|
||||
|
||||
var currentRowCount = $('#splPoBillTbId tr').length;
|
||||
|
||||
var newIndex = currentRowCount + 1;
|
||||
|
||||
var newRow = `
|
||||
<tr id="lastvalue">
|
||||
<td>${data.BillNo}</td>
|
||||
<td>${data.FilePath ? data.FilePath : "No File"}</td>
|
||||
<input type="hidden" id="billnos${newIndex}" value="${data.BillNo}">
|
||||
<input type="hidden" id="file${newIndex}" name="file" value="${data.FilePath}">
|
||||
<td style="cursor:pointer">
|
||||
<span onclick="openbillmodel(${newIndex});">
|
||||
<i class="ri-pencil-fill"></i>
|
||||
</span>
|
||||
|
||||
<a target="_blank" href="<?= base_url('public/uploads/BillFiles/') ?>${data.FilePath}">
|
||||
<i class="fa fa-download"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
$('#splPoBillTbId').append(newRow);
|
||||
}
|
||||
|
||||
|
||||
function updateRowToTable(updatedData, billNo) {
|
||||
// Find the row using the provided BillNo
|
||||
$('#splPoBillTbId tr').each(function(index) {
|
||||
// Check if the BillNo of the current row matches the provided billNo
|
||||
var currentBillNo = $(this).find('td:first').text(); // Assuming BillNo is in the first cell
|
||||
if (currentBillNo === billNo) {
|
||||
// Update the relevant cells of the row with the new values from updatedData
|
||||
$(this).find('td:nth-child(1)').text(updatedData.BillNo); // Update BillNo
|
||||
$(this).find('td:nth-child(2)').text(updatedData.FilePath || 'No File'); // Update FilePath
|
||||
|
||||
// Also update the hidden inputs if necessary
|
||||
$(this).find('input[id^="billnos"]').val(updatedData.BillNo); // Update BillNo hidden input
|
||||
$(this).find('input[id^="file"]').val(updatedData.FilePath); // Update FilePath hidden input
|
||||
|
||||
// Exit the loop once the correct row is found and updated
|
||||
return false; // Stops the iteration as we've found the row to update
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Master Details</a></li>
|
||||
<li class="breadcrumb-item active">
|
||||
<h4 class="page-title ">User Listing</h4>
|
||||
<h4 class="page-title">User Listing</h4>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user