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->get('deleteTransporter', 'Supplier::deleteTransporter');
|
||||
$routes->get('reActivateTransporter', 'Supplier::reActivateTransporter');
|
||||
$routes->post('checkTransporter', 'Supplier::checkTransporter');
|
||||
|
||||
//Factory Machine Master Routes
|
||||
|
||||
|
||||
@ -464,6 +464,22 @@ class Supplier extends BaseController
|
||||
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
|
||||
@ -486,6 +502,9 @@ class Supplier extends BaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* reactivate the Transporter
|
||||
*/
|
||||
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){
|
||||
|
||||
|
||||
@ -82,50 +82,58 @@
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<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">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Master Details</a></li>
|
||||
<li class="breadcrumb-item active">
|
||||
<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">Transporter Details</h4>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<a data-toggle="modal" href="#transporterwizard" data-id="0" data-name="" class="btn btn-success">Add New Transporter</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<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 class="row">
|
||||
<div class="col-12">
|
||||
<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">
|
||||
<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>
|
||||
<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 class="form-check" style="margin-right: 25px;">
|
||||
<input class="form-check-input" type="checkbox" id="showArchiveId" name="showArchive"
|
||||
value="1" onchange="showArchiveList()" style="width: 18px; height: 18px;">
|
||||
<label class="form-check-label" for="showArchiveId" style="font-size: 1rem; margin-left: 8px;">
|
||||
Show Archive
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check" style="margin-right: 25px;">
|
||||
<input class="form-check-input" type="checkbox" id="showArchiveId"
|
||||
name="showArchive" value="1" onchange="showArchiveList()"
|
||||
style="width: 18px; height: 18px;">
|
||||
<label class="form-check-label" for="showArchiveId"
|
||||
style="font-size: 1rem; margin-left: 8px;">
|
||||
Show Archive
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="error" id="error"></div>
|
||||
</form>
|
||||
<div class="card-body" style="overflow-x:scroll;">
|
||||
@ -146,29 +154,32 @@
|
||||
$createdat = new DateTime($record->created_on);
|
||||
$date = $createdat->format('d-m-Y');
|
||||
$time = $createdat->format('h:i A');
|
||||
?>
|
||||
<tr
|
||||
class="<?php if($record->isactive == 0){echo"deactivatedRow";}?>"
|
||||
style="<?php if($record->isactive == 0){echo"display:none";}?>"
|
||||
>
|
||||
?>
|
||||
<tr class="<?php if ($record->isactive == 0) {
|
||||
echo "deactivatedRow";
|
||||
} ?>" style="<?php if ($record->isactive == 0) {
|
||||
echo "display:none";
|
||||
} ?>">
|
||||
<td><?php echo $date; ?></td>
|
||||
<td><?php echo $record->name ?></td>
|
||||
<td><?php echo $record->FirstName ?></td>
|
||||
<td>
|
||||
<?php if ($record->isactive == 0) { ?>
|
||||
<a
|
||||
onclick="confirmReActivate(event)"
|
||||
style="cursor:pointer;"
|
||||
href="<?php echo base_url() . 'reActivateTransporter?id=' . $record->id; ?>"><i class="fa fa-key" style="color:#02a8b5;"></i> </a>
|
||||
<?php } else { ?>
|
||||
<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>
|
||||
<a
|
||||
onclick="confirmDelete(event)"
|
||||
href="<?php echo base_url() . 'deleteTransporter?id=' . $record->id; ?>"><i class="fa fa-trash"></i> </a>
|
||||
<a onclick="confirmReActivate(event)" style="cursor:pointer;"
|
||||
href="<?php echo base_url() . 'reActivateTransporter?id=' . $record->id; ?>"><i
|
||||
class="fa fa-key" style="color:#02a8b5;"></i> </a>
|
||||
<?php } else { ?>
|
||||
<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>
|
||||
<a onclick="confirmDelete(event)"
|
||||
href="<?php echo base_url() . 'deleteTransporter?id=' . $record->id; ?>"><i
|
||||
class="fa fa-trash"></i> </a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -186,14 +197,13 @@
|
||||
</div>
|
||||
|
||||
<!-- for Add and edit Modal -->
|
||||
<div id="transporterwizard" class="modal fade" tabindex="-1" role="dialog"
|
||||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||||
<div id="transporterwizard" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title"></h4>
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-hidden="true">×</button>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body p-4">
|
||||
<form id="transporterForm" class="form-horizontal" role="form">
|
||||
@ -213,17 +223,17 @@
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary waves-effect"
|
||||
data-dismiss="modal" value="Cancel">Cancel</button>
|
||||
<button type="button"
|
||||
class="btn btn-info waves-effect waves-light tempClick" id="tempClick">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal"
|
||||
value="Cancel">Cancel</button>
|
||||
<button type="button" class="btn btn-info waves-effect waves-light tempClick"
|
||||
id="tempClick">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#transporterwizard").on("shown.bs.modal", function(e) {
|
||||
$(document).ready(function () {
|
||||
$("#transporterwizard").on("shown.bs.modal", function (e) {
|
||||
var id = $(e.relatedTarget).data('id');
|
||||
var name = $(e.relatedTarget).data('name');
|
||||
$('#transportername').val('');
|
||||
@ -236,7 +246,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#tempClick').click(function() {
|
||||
$('#tempClick').click(function () {
|
||||
if ($('#transportername').val() === '') {
|
||||
alert('Please Enter the Transporter Name');
|
||||
return;
|
||||
@ -247,41 +257,71 @@
|
||||
transportername: $('#transportername').val()
|
||||
};
|
||||
|
||||
$.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);
|
||||
let checkTransporterExists = function checkTransporterExists() {
|
||||
|
||||
let transportername = $('#transportername').val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url(); ?>checkTransporter",
|
||||
data: {
|
||||
transportername
|
||||
},
|
||||
success: function (response) {
|
||||
console.log("response", response);
|
||||
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
|
||||
var table = $('#transporter_list').DataTable({
|
||||
dom: 'Blfrtip',
|
||||
dom: 'Blfrtip',
|
||||
buttons: [
|
||||
'excel', 'pdf'
|
||||
'excel', 'pdf'
|
||||
],
|
||||
pageLength: 10,
|
||||
pageLength: 10,
|
||||
lengthMenu: [
|
||||
[10, 20, 30, 50, -1],
|
||||
[10, 20, 30, 50, "All"]
|
||||
],
|
||||
responsive: false,
|
||||
order: false,
|
||||
],
|
||||
responsive: false,
|
||||
order: false,
|
||||
language: {
|
||||
paginate: {
|
||||
next: '<i class="fas fa-angle-right"></i>', // Next button icon
|
||||
@ -292,7 +332,7 @@
|
||||
|
||||
// Date range filter function
|
||||
$.fn.dataTable.ext.search.push(
|
||||
function(settings, data, dataIndex) {
|
||||
function (settings, data, dataIndex) {
|
||||
var fromDate = $('#fromDate').val();
|
||||
var toDate = $('#toDate').val();
|
||||
|
||||
@ -324,20 +364,20 @@
|
||||
);
|
||||
|
||||
// Handle form submission for the date range filter
|
||||
$("#DateRangeFilter").submit(function(e) {
|
||||
$("#DateRangeFilter").submit(function (e) {
|
||||
e.preventDefault();
|
||||
table.draw(); // Redraw the table to apply the filter
|
||||
});
|
||||
|
||||
// Reset button functionality
|
||||
$("#resetButton").click(function() {
|
||||
$("#resetButton").click(function () {
|
||||
$("#fromDate").val('');
|
||||
$("#toDate").val('');
|
||||
table.draw(); // Redraw the table to clear the filter
|
||||
});
|
||||
|
||||
// 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 toDateInput = document.getElementById('toDate');
|
||||
|
||||
@ -366,10 +406,10 @@
|
||||
|
||||
|
||||
function showArchiveList() {
|
||||
let isChecked = $("#showArchiveId").prop('checked');
|
||||
|
||||
let isChecked = $("#showArchiveId").prop('checked');
|
||||
|
||||
// Show or hide the rows based on checkbox status
|
||||
$(".deactivatedRow").each(function() {
|
||||
$(".deactivatedRow").each(function () {
|
||||
if (isChecked) {
|
||||
$(this).show();
|
||||
} else {
|
||||
@ -378,7 +418,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
showArchiveList();
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user