changes in master details-4 vadivel J 20-11-2024
This commit is contained in:
parent
6e9aad3c4e
commit
23f90d518d
@ -405,6 +405,7 @@ $routes->get('transporterListing', 'Supplier::transporterListing');
|
|||||||
$routes->post('fetchTransporterDetails', 'Supplier::fetchTransporterDetails');// for Ajax both add and edit....
|
$routes->post('fetchTransporterDetails', 'Supplier::fetchTransporterDetails');// for Ajax both add and edit....
|
||||||
$routes->get('deleteTransporter', 'Supplier::deleteTransporter');
|
$routes->get('deleteTransporter', 'Supplier::deleteTransporter');
|
||||||
$routes->get('reActivateTransporter', 'Supplier::reActivateTransporter');
|
$routes->get('reActivateTransporter', 'Supplier::reActivateTransporter');
|
||||||
|
$routes->post('checkTransporter', 'Supplier::checkTransporter');
|
||||||
|
|
||||||
//Factory Machine Master Routes
|
//Factory Machine Master Routes
|
||||||
|
|
||||||
|
|||||||
@ -464,6 +464,22 @@ class Supplier extends BaseController
|
|||||||
return $this->response->setJSON($data);
|
return $this->response->setJSON($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check the Transporter exists?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function checkTransporter(){
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$message = $this->supplier_model->checkTransporter($data['transportername']);
|
||||||
|
if(!empty($message)){
|
||||||
|
echo true;
|
||||||
|
}else{
|
||||||
|
echo false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* delete the Transporter
|
* delete the Transporter
|
||||||
@ -486,6 +502,9 @@ class Supplier extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reactivate the Transporter
|
||||||
|
*/
|
||||||
function reActivateTransporter($id = NULL)
|
function reActivateTransporter($id = NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,16 @@ class Supplier_model extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function checkTransporter($transporterName){
|
||||||
|
$builder = $this->db->table('t_transporter')
|
||||||
|
->where('name', $transporterName)
|
||||||
|
->where('isactive',1);
|
||||||
|
$query = $builder->get();
|
||||||
|
|
||||||
|
return $query->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function deleteTransporter($Sid, $SupplierInfo){
|
function deleteTransporter($Sid, $SupplierInfo){
|
||||||
|
|
||||||
|
|||||||
@ -82,50 +82,58 @@
|
|||||||
<!-- start page title -->
|
<!-- start page title -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="page-title-box page-title-box-alt">
|
<div class="page-title-box page-title-box-alt">
|
||||||
<div class="page-title-right">
|
<div class="page-title-right">
|
||||||
<ol class="breadcrumb m-0">
|
<ol class="breadcrumb m-0">
|
||||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Master Details</a></li>
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Master Details</a></li>
|
||||||
<li class="breadcrumb-item active">
|
<li class="breadcrumb-item active">
|
||||||
<h4 class="page-title">Transporter Details</h4>
|
<h4 class="page-title">Transporter Details</h4>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a data-toggle="modal" href="#transporterwizard" data-id="0" data-name="" class="btn btn-success">Add New Transporter</a>
|
<a data-toggle="modal" href="#transporterwizard" data-id="0" data-name=""
|
||||||
|
class="btn btn-success">Add New Transporter</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
|
<form class="Date-filter-form" id="DateRangeFilter"
|
||||||
|
style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
|
||||||
<input type="hidden" name="table" value="requisition">
|
<input type="hidden" name="table" value="requisition">
|
||||||
<label for="fromDate">From:</label>
|
<label for="fromDate">From:</label>
|
||||||
<input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
|
<input class="form-control date_range form-date-search" id="fromDate" name="fromDate"
|
||||||
|
placeholder="Select From Date" autocomplete="off" required>
|
||||||
|
|
||||||
<label for="toDate">To:</label>
|
<label for="toDate">To:</label>
|
||||||
<input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
|
<input class="form-control date_range to-date-search" id="toDate" name="toDate"
|
||||||
|
placeholder="Select To Date" autocomplete="off" required>
|
||||||
|
|
||||||
|
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true"
|
||||||
|
class="icon-button" title="Search"></i></button>
|
||||||
|
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button"
|
||||||
|
id="resetButton" title="Reset"></i>
|
||||||
|
|
||||||
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
|
|
||||||
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
|
|
||||||
|
|
||||||
<div style="margin-left:auto">
|
<div style="margin-left:auto">
|
||||||
<div class="form-check" style="margin-right: 25px;">
|
<div class="form-check" style="margin-right: 25px;">
|
||||||
<input class="form-check-input" type="checkbox" id="showArchiveId" name="showArchive"
|
<input class="form-check-input" type="checkbox" id="showArchiveId"
|
||||||
value="1" onchange="showArchiveList()" style="width: 18px; height: 18px;">
|
name="showArchive" value="1" onchange="showArchiveList()"
|
||||||
<label class="form-check-label" for="showArchiveId" style="font-size: 1rem; margin-left: 8px;">
|
style="width: 18px; height: 18px;">
|
||||||
Show Archive
|
<label class="form-check-label" for="showArchiveId"
|
||||||
</label>
|
style="font-size: 1rem; margin-left: 8px;">
|
||||||
</div>
|
Show Archive
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="error" id="error"></div>
|
<div class="error" id="error"></div>
|
||||||
</form>
|
</form>
|
||||||
<div class="card-body" style="overflow-x:scroll;">
|
<div class="card-body" style="overflow-x:scroll;">
|
||||||
@ -146,29 +154,32 @@
|
|||||||
$createdat = new DateTime($record->created_on);
|
$createdat = new DateTime($record->created_on);
|
||||||
$date = $createdat->format('d-m-Y');
|
$date = $createdat->format('d-m-Y');
|
||||||
$time = $createdat->format('h:i A');
|
$time = $createdat->format('h:i A');
|
||||||
?>
|
?>
|
||||||
<tr
|
<tr class="<?php if ($record->isactive == 0) {
|
||||||
class="<?php if($record->isactive == 0){echo"deactivatedRow";}?>"
|
echo "deactivatedRow";
|
||||||
style="<?php if($record->isactive == 0){echo"display:none";}?>"
|
} ?>" style="<?php if ($record->isactive == 0) {
|
||||||
>
|
echo "display:none";
|
||||||
|
} ?>">
|
||||||
<td><?php echo $date; ?></td>
|
<td><?php echo $date; ?></td>
|
||||||
<td><?php echo $record->name ?></td>
|
<td><?php echo $record->name ?></td>
|
||||||
<td><?php echo $record->FirstName ?></td>
|
<td><?php echo $record->FirstName ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($record->isactive == 0) { ?>
|
<?php if ($record->isactive == 0) { ?>
|
||||||
<a
|
<a onclick="confirmReActivate(event)" style="cursor:pointer;"
|
||||||
onclick="confirmReActivate(event)"
|
href="<?php echo base_url() . 'reActivateTransporter?id=' . $record->id; ?>"><i
|
||||||
style="cursor:pointer;"
|
class="fa fa-key" style="color:#02a8b5;"></i> </a>
|
||||||
href="<?php echo base_url() . 'reActivateTransporter?id=' . $record->id; ?>"><i class="fa fa-key" style="color:#02a8b5;"></i> </a>
|
<?php } else { ?>
|
||||||
<?php } else { ?>
|
<a data-toggle="modal" href="#transporterwizard"
|
||||||
<a data-toggle="modal" href="#transporterwizard" data-id="<?php echo $record->id; ?>" data-name="<?php echo $record->name; ?>"><i class="fa fa-edit"></i> </a>
|
data-id="<?php echo $record->id; ?>"
|
||||||
<a
|
data-name="<?php echo $record->name; ?>"><i
|
||||||
onclick="confirmDelete(event)"
|
class="fa fa-edit"></i> </a>
|
||||||
href="<?php echo base_url() . 'deleteTransporter?id=' . $record->id; ?>"><i class="fa fa-trash"></i> </a>
|
<a onclick="confirmDelete(event)"
|
||||||
|
href="<?php echo base_url() . 'deleteTransporter?id=' . $record->id; ?>"><i
|
||||||
|
class="fa fa-trash"></i> </a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -186,14 +197,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- for Add and edit Modal -->
|
<!-- for Add and edit Modal -->
|
||||||
<div id="transporterwizard" class="modal fade" tabindex="-1" role="dialog"
|
<div id="transporterwizard" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
aria-hidden="true" style="display: none;">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title"></h4>
|
<h4 class="modal-title"></h4>
|
||||||
<button type="button" class="close" data-dismiss="modal"
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
aria-hidden="true">×</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body p-4">
|
<div class="modal-body p-4">
|
||||||
<form id="transporterForm" class="form-horizontal" role="form">
|
<form id="transporterForm" class="form-horizontal" role="form">
|
||||||
@ -213,17 +223,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary waves-effect"
|
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal"
|
||||||
data-dismiss="modal" value="Cancel">Cancel</button>
|
value="Cancel">Cancel</button>
|
||||||
<button type="button"
|
<button type="button" class="btn btn-info waves-effect waves-light tempClick"
|
||||||
class="btn btn-info waves-effect waves-light tempClick" id="tempClick">Submit</button>
|
id="tempClick">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
$("#transporterwizard").on("shown.bs.modal", function(e) {
|
$("#transporterwizard").on("shown.bs.modal", function (e) {
|
||||||
var id = $(e.relatedTarget).data('id');
|
var id = $(e.relatedTarget).data('id');
|
||||||
var name = $(e.relatedTarget).data('name');
|
var name = $(e.relatedTarget).data('name');
|
||||||
$('#transportername').val('');
|
$('#transportername').val('');
|
||||||
@ -236,7 +246,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#tempClick').click(function() {
|
$('#tempClick').click(function () {
|
||||||
if ($('#transportername').val() === '') {
|
if ($('#transportername').val() === '') {
|
||||||
alert('Please Enter the Transporter Name');
|
alert('Please Enter the Transporter Name');
|
||||||
return;
|
return;
|
||||||
@ -247,41 +257,71 @@
|
|||||||
transportername: $('#transportername').val()
|
transportername: $('#transportername').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax({
|
let checkTransporterExists = function checkTransporterExists() {
|
||||||
type: 'POST',
|
|
||||||
url: "<?php echo base_url(); ?>fetchTransporterDetails",
|
let transportername = $('#transportername').val();
|
||||||
data: formData,
|
$.ajax({
|
||||||
dataType: 'json',
|
type: 'POST',
|
||||||
success: function(response) {
|
url: "<?php echo base_url(); ?>checkTransporter",
|
||||||
if (response.status) {
|
data: {
|
||||||
alert(response.message);
|
transportername
|
||||||
$('#transporterwizard').modal('hide');
|
},
|
||||||
location.reload();
|
success: function (response) {
|
||||||
} else {
|
console.log("response", response);
|
||||||
alert(response.message);
|
if (response) {
|
||||||
|
alert("Already Transporter with this Name Exists..!!");
|
||||||
|
window.location.href = "transporterListing";
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: "<?php echo base_url(); ?>fetchTransporterDetails",
|
||||||
|
data: formData,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (response) {
|
||||||
|
if (response.status) {
|
||||||
|
alert(response.message);
|
||||||
|
$('#transporterwizard').modal('hide');
|
||||||
|
location.reload();
|
||||||
|
} else {
|
||||||
|
alert(response.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
alert('An error occurred: ' + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
alert('An error occurred inside Check transporterExsits: ' + error);
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
error: function(xhr, status, error) {
|
|
||||||
alert('An error occurred: ' + error);
|
|
||||||
}
|
};
|
||||||
});
|
|
||||||
|
checkTransporterExists();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
// Initialize the DataTable
|
// Initialize the DataTable
|
||||||
var table = $('#transporter_list').DataTable({
|
var table = $('#transporter_list').DataTable({
|
||||||
dom: 'Blfrtip',
|
dom: 'Blfrtip',
|
||||||
buttons: [
|
buttons: [
|
||||||
'excel', 'pdf'
|
'excel', 'pdf'
|
||||||
],
|
],
|
||||||
pageLength: 10,
|
pageLength: 10,
|
||||||
lengthMenu: [
|
lengthMenu: [
|
||||||
[10, 20, 30, 50, -1],
|
[10, 20, 30, 50, -1],
|
||||||
[10, 20, 30, 50, "All"]
|
[10, 20, 30, 50, "All"]
|
||||||
],
|
],
|
||||||
responsive: false,
|
responsive: false,
|
||||||
order: false,
|
order: false,
|
||||||
language: {
|
language: {
|
||||||
paginate: {
|
paginate: {
|
||||||
next: '<i class="fas fa-angle-right"></i>', // Next button icon
|
next: '<i class="fas fa-angle-right"></i>', // Next button icon
|
||||||
@ -292,7 +332,7 @@
|
|||||||
|
|
||||||
// Date range filter function
|
// Date range filter function
|
||||||
$.fn.dataTable.ext.search.push(
|
$.fn.dataTable.ext.search.push(
|
||||||
function(settings, data, dataIndex) {
|
function (settings, data, dataIndex) {
|
||||||
var fromDate = $('#fromDate').val();
|
var fromDate = $('#fromDate').val();
|
||||||
var toDate = $('#toDate').val();
|
var toDate = $('#toDate').val();
|
||||||
|
|
||||||
@ -324,20 +364,20 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Handle form submission for the date range filter
|
// Handle form submission for the date range filter
|
||||||
$("#DateRangeFilter").submit(function(e) {
|
$("#DateRangeFilter").submit(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
table.draw(); // Redraw the table to apply the filter
|
table.draw(); // Redraw the table to apply the filter
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reset button functionality
|
// Reset button functionality
|
||||||
$("#resetButton").click(function() {
|
$("#resetButton").click(function () {
|
||||||
$("#fromDate").val('');
|
$("#fromDate").val('');
|
||||||
$("#toDate").val('');
|
$("#toDate").val('');
|
||||||
table.draw(); // Redraw the table to clear the filter
|
table.draw(); // Redraw the table to clear the filter
|
||||||
});
|
});
|
||||||
|
|
||||||
// Automatically focus and open the To Date picker when From Date is selected
|
// Automatically focus and open the To Date picker when From Date is selected
|
||||||
document.getElementById('fromDate').addEventListener('change', function() {
|
document.getElementById('fromDate').addEventListener('change', function () {
|
||||||
var fromDate = this.value;
|
var fromDate = this.value;
|
||||||
var toDateInput = document.getElementById('toDate');
|
var toDateInput = document.getElementById('toDate');
|
||||||
|
|
||||||
@ -366,10 +406,10 @@
|
|||||||
|
|
||||||
|
|
||||||
function showArchiveList() {
|
function showArchiveList() {
|
||||||
let isChecked = $("#showArchiveId").prop('checked');
|
let isChecked = $("#showArchiveId").prop('checked');
|
||||||
|
|
||||||
// Show or hide the rows based on checkbox status
|
// Show or hide the rows based on checkbox status
|
||||||
$(".deactivatedRow").each(function() {
|
$(".deactivatedRow").each(function () {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
$(this).show();
|
$(this).show();
|
||||||
} else {
|
} else {
|
||||||
@ -378,7 +418,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
showArchiveList();
|
showArchiveList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user