changes in master details-4 vadivel J 20-11-2024

This commit is contained in:
vadivelJ96 2024-11-20 14:36:16 +05:30
parent 6e9aad3c4e
commit 23f90d518d
4 changed files with 153 additions and 83 deletions

View File

@ -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

View File

@ -465,6 +465,22 @@ class Supplier extends BaseController
}
/**
* 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)
{

View File

@ -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){

View File

@ -92,7 +92,8 @@
</ol>
</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>
@ -104,22 +105,29 @@
<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;">
<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>
@ -147,24 +155,27 @@
$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>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;</a>
<a
onclick="confirmDelete(event)"
href="<?php echo base_url() . 'deleteTransporter?id=' . $record->id; ?>"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<a data-toggle="modal" href="#transporterwizard"
data-id="<?php echo $record->id; ?>"
data-name="<?php echo $record->name; ?>"><i
class="fa fa-edit"></i>&nbsp;&nbsp;</a>
<a onclick="confirmDelete(event)"
href="<?php echo base_url() . 'deleteTransporter?id=' . $record->id; ?>"><i
class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?>
</td>
</tr>
@ -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,10 +223,10 @@
</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>
@ -247,6 +257,22 @@
transportername: $('#transportername').val()
};
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",
@ -265,6 +291,20 @@
alert('An error occurred: ' + error);
}
});
}
},
error: function (xhr, status, error) {
alert('An error occurred inside Check transporterExsits: ' + error);
}
});
};
checkTransporterExists();
});
});