Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
vadivelJ96 2025-02-06 12:17:50 +05:30
commit d68eeb02fb
5 changed files with 62 additions and 89 deletions

View File

@ -51,7 +51,7 @@ class Driver extends BaseController
$this->driver_model->useDriverTable()->insert($driver_details);
$insertedId = $this->driver_model->insertID();
if ($insertedId > 0) {
$data = ['status' => true, 'message' => 'Successfully created driver details'];
$data = ['status' => true, 'message' => 'Driver details created successfully.'];
}
} else {
$driver_details = [
@ -63,7 +63,7 @@ class Driver extends BaseController
$this->driver_model->useDriverTable()->update($id, $driver_details);
if ($this->driver_model->affectedRows() > 0) {
$data = ['status' => true, 'message' => 'Successfully updated driver details'];
$data = ['status' => true, 'message' => "Driver details updated successfully."];
}
}
@ -82,10 +82,10 @@ class Driver extends BaseController
$this->driver_model->useDriverTable()->update($driverId, $data);
if ($this->driver_model->affectedRows() > 0) {
// $data = ['status' => true, 'message' => 'Successfully updated driver details'];
$message = 'Successfully Updated Driver details';
$message = "Driver details deleted successfully.";
}
}else{
$message = "Driver details Not Avalable";
$message = "Driver details not available.";
}
$this->session->setFlashdata('success', $message);
return redirect()->route('DriverListing');
@ -102,9 +102,9 @@ class Driver extends BaseController
if(!empty($driverId)){
$data = ['isactive' => 0,'updated_by' => $this->session->get('userId')];
$this->driver_model->useDriverTable()->update($driverId, $data);
$message = ($this->driver_model->affectedRows() > 0) ? "Driver Deleted Successfully." : "Driver already Deleted States";
$message = ($this->driver_model->affectedRows() > 0) ? "Driver deleted successfully." : "Driver already deleted.";
}else{
$message = "Driver details Not Avalable";
$message = "Driver details not available.";
}
$this->session->setFlashdata('success', $message);
return redirect()->route('DriverListing');
@ -133,14 +133,10 @@ class Driver extends BaseController
}
public function loadDriverAttendance()
{
{
// $input_driver_id = $this->request->getGet('driverId') ? $this->request->getGet('driverId') : '';
$input_driver_id = $this->request->getPost('driver_id') ? $this->request->getPost('driver_id') : $this->request->getGet('driverId');
// echo($input_driver_id);
$input_month_year = $this->request->getPost('monthyear') ? $this->request->getPost('monthyear') : date('M-Y');
$input_driver_id = $this->request->getPost('gobal_driver_id') ? $this->request->getPost('gobal_driver_id') : $this->request->getGet('gobal_driver_id');
$input_month_year = $this->request->getPost('month_year') ? $this->request->getPost('month_year') : $this->request->getGet('month_year');
list($month, $year) = explode('-', $input_month_year);
$month_in_number = get_date_time_dynamical_format('M','m',"$month");// refer helper
@ -189,7 +185,7 @@ class Driver extends BaseController
$this->driver_model->useDriverAttendanceTable()->insert($driver_details);
$insertedId = $this->driver_model->insertID();
if ($insertedId > 0) {
$data = ['status' => true, 'message' => 'Successfully created driver Trip details'];
$data = ['status' => true, 'message' => 'Driver trip details created successfully.'];
}
} else {
$driver_details = [
@ -207,7 +203,7 @@ class Driver extends BaseController
$this->driver_model->useDriverAttendanceTable()->update($id, $driver_details);
if ($this->driver_model->affectedRows() > 0) {
$data = ['status' => true, 'message' => 'Successfully updated driver Trip details'];
$data = ['status' => true, 'message' => 'Driver trip details updated successfully.'];
}
}
@ -215,55 +211,28 @@ class Driver extends BaseController
return $this->response->setJSON($data);
}
/**
* reactive the driver Attendance details isactive - 0 into 1
*/
public function reActivateDriverAttendance(){
$driverAttendanceId = $_GET['driverAttendanceId'];
$driverId = $_GET['driverId'];
if(!empty($driverAttendanceId)){
$data = ['isactive' => 1,'updated_by' => $this->session->get('userId')];
$this->driver_model->useDriverAttendanceTable()->update($driverAttendanceId, $data);
if ($this->driver_model->affectedRows() > 0) {
// $data = ['status' => true, 'message' => 'Successfully updated Driver Trip details'];
$message = 'Successfully Updated Driver Trip details';
}
}else{
$message = "Driver Trip details Not Avalable";
}
$this->session->setFlashdata('success', $message);
return redirect()->to(current_url());
// return redirect()->route('loadDriverAttendance');
// return redirect()->to(base_url('loadDriverAttendance?driverId=' . $driverId));
}
/**
* delete the driver Attendance details
*/
function deleteDriverAttendance()
{
$driverId = $this->request->getGet('driverId') ? $this->request->getGet('driverId') : '';
$driverId = $this->request->getGet('gobal_driver_id') ? $this->request->getGet('gobal_driver_id') : '';
$driverAttendanceId = $this->request->getGet('driverAttendanceId') ? $this->request->getGet('driverAttendanceId') : '';
// echo "*****";
// echo $driverAttendanceId."**";
// echo "-------------";
// die;
$monthyear = $this->request->getGet('month_year') ?? date('M-Y');
if(!empty($driverAttendanceId)){
$data = ['isactive' => 0,'updated_by' => $this->session->get('userId')];
$this->driver_model->useDriverAttendanceTable()->update($driverAttendanceId, $data);
$message = ($this->driver_model->affectedRows() > 0) ? "Driver Trip Deleted Successfully." : "Driver Trip already Deleted States";
$message = ($this->driver_model->affectedRows() > 0) ? "Driver trip deleted successfully." : "Driver trip already deleted.";
}else{
$message = "Driver Trip details Not Avalable";
$message = "Driver trip details not available.";
}
$this->session->setFlashdata('success', $message);
// return redirect()->to(current_url());
return redirect()->route('loadDriverAttendance');
// return redirect()->to(base_url('loadDriverAttendance?driverId=' . $driverId));
// return redirect()->route('loadDriverAttendance');
return redirect()->to(base_url('loadDriverAttendance?gobal_driver_id=' . $driverId . '&month_year=' . $monthyear));
}
@ -273,7 +242,4 @@ class Driver extends BaseController
$results = $this->driver_model->gatheredCustAndQty($invoice);
return $this->response->setJSON($results);
}
}
}

View File

@ -57,6 +57,7 @@ class Driver_model extends Model
->join('ip_clients', 'ip_clients.client_id = ip_invoices.client_id', 'left')
->where($this->table.'.date BETWEEN "'.$from.'" AND "'.$to.'"')
->where($this->table . '.driver_id', $driver_id)
->where($this->table . '.isactive', 1)
->findAll();
}

View File

@ -55,11 +55,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="box-body">
<div class="row">
<div class="col-8">
<form action="<?= base_url('loadDriverAttendance'); ?>" method="post">
<form action="<?= base_url('loadDriverAttendance'); ?>" method="get">
<div class="row">
<div class="col-4">
<?php $today = date('M-Y'); ?>
<input type="text" name="monthyear" id="monthyear" value="<?php echo $datefordropdown; ?>" class="form-control" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1">
<input type="text" value="<?php echo $datefordropdown; ?>" name="month_year" class="form-control monthpicker" id="month_year">
<input type="hidden" name="gobal_driver_id" id="gobal_driver_id" value="<?php echo $gobal_driver_id; ?>" >
</div>
@ -85,16 +85,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<tr>
<th>Create Date</th>
<th>Create By</th>
<th>Driver Name</th>
<th>Date</th>
<th>Invoice Number</th>
<th>Customer</th>
<th>Quantity</th>
<th>Vehicle Number</th>
<th>Salary Amount</th>
<th>Food Amount</th>
<th>Load Type</th>
<th>Customer</th>
<th>Quantity</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
@ -112,31 +110,25 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<tr>
<td><?= esc($date) ?></td>
<td><?= esc($record['FullName']) ?></td>
<td><?= esc($record['driver_name']) ?></td>
<td><?= esc($attdate) ?></td>
<td><?= esc($record['invoice_number']) ?></td>
<td><?= esc($record['customer']) ?></td>
<td><?= esc($record['quantity']) ?></td>
<td><?= esc($record['vehicle_number']) ?></td>
<td><?= esc($record['salary_amount']) ?></td>
<td><?= esc($record['food_amount']) ?></td>
<td><?= esc($record['load_type']) ?></td>
<td><?= esc($record['customer']) ?></td>
<td><?= esc($record['quantity']) ?></td>
<td><?= $record['isactive'] == 1 ? 'Active' : 'InActive' ?></td>
<td><?php if ($record['isactive'] == 0) { ?>
<?php }else{ ?>
<td>
<a data-toggle="modal" href="#attendanceModal" data-arr='<?php echo json_encode($record); ?>' data-id='<?= esc($record['driver_attendance_id']) ?>'>
<i class="fas fa-edit"></i>&nbsp;&nbsp;&nbsp;
</a>
<a onclick="confirmDelete(event)" style="cursor:pointer;" href="<?php echo base_url() . 'deleteDriverAttendance?driverAttendanceId=' . esc($record['driver_attendance_id']).'&gobal_driver_id='.esc($record['driver_id']).'&month_year='.esc($datefordropdown); ?>">
<i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;
</a>
<!-- <a onclick="confirmDelete(event)" style="cursor:pointer;" href="<?php echo base_url() . 'deleteDriverAttendance?driverAttendanceId=' . esc($record['driver_attendance_id']).'&driverId='.esc($record['driver_id']); ?>">
<i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;
</a> -->
</a>
<!-- <a onclick="confirmDelete(event)" style="cursor:pointer;" href="<?php echo base_url() . 'deleteDriverAttendance?driverAttendanceId=' . esc($record['driver_attendance_id']).'&driverId='.esc($record['driver_id']); ?>">
<i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;
</a> -->
<?php } ?>
</td>
</tr>
<?php } ?>
@ -224,7 +216,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="col-md-6">
<label class="form" for="vehicle_number">Vechile Number</label>
<input type="text" class="form-control" id="vehicle_number" name="vehicle_number">
<input type="text" class="form-control" id="vehicle_number" name="vehicle_number" onkeyup="this.value = this.value.toUpperCase();">
</div>
<div class="col-md-6">
@ -249,7 +241,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<input type="text" class="form-control" id="food_amount" name="food_amount" onkeypress="return isNumber(event);" onchange="salary();">
</div>
<div class="col-md-4">
<label class="form" for="food_amount">Total Amount</label>
<label class="form" for="total_amount">Total Amount</label>
<input type="text" class="form-control" id="total_amount" name="total_amount" onkeypress="return isNumber(event);" readonly>
</div>
</div>
@ -273,10 +265,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script>
$('#month_year').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
</script>
<script type="text/javascript">
$('#monthyear').attr('class', 'form-control');
function isNumber(evt) {
//alert("hi");
@ -295,7 +294,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$("#driver_name").val("<?php echo $page_driver_name; ?>");
let urlParams = new URLSearchParams(window.location.search);
let gobal_driver_id = urlParams.get("driverId");
let gobal_driver_id = urlParams.get("gobal_driver_id");
if (gobal_driver_id !== null) {
$("#gobal_driver_id").val(gobal_driver_id);
$("#driver_id").val(gobal_driver_id);
@ -332,7 +331,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$("#driver_id").val(arr && arr['driver_id']);
}
if(field == 'salary_amount' || field == 'food_amount') {
var ttl = parseFloat(arr['salary_amount']) + parseFloat(arr['food_amount']);
var ttl = parseFloat(arr['salary_amount']) + (parseFloat(arr['food_amount'] || 0));
$('#total_amount').val(ttl.toFixed(2));
}
});
@ -345,10 +344,6 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
alert('Please Enter the Valid Invoice Number');
return;
}
if ($('#food_amount').val() === '') {
alert('Please Enter the Food Amount');
return;
}
if ($('#customer').val() === '') {
alert('Please Enter the Valid Invoice Number because Customer Value Not Fetched');
return;
@ -503,8 +498,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
success: function (data) {
console.log('got the result: ' + data);
if (data) {
$('#customer').val(data['customer']);
$('#quantity').val(data['quantity']);
if(data == ""){
alert('Please Enter the Valid Invoice Number');
$('#invoice_number').val("");
}else{
if(data['customer'] != ""){
$('#customer').val(data['customer']);
}
if(data['quantity'] != ""){
$('#quantity').val(data['quantity']);
}
}
}
},
error: function (xhr, status, error) {

View File

@ -62,7 +62,8 @@
<a onclick="confirmDelete(event)" style="cursor:pointer;" href="<?php echo base_url() . 'deleteDriver?driverId=' . $record['driver_id']; ?>">
<i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;
</a>
<a style="cursor:pointer;" href="<?= base_url() . 'loadDriverAttendance?driverId=' . $record['driver_id']; ?>">
<?php $today = date('M-Y'); ?>
<a style="cursor:pointer;" href="<?= base_url() . 'loadDriverAttendance?gobal_driver_id=' . $record['driver_id'].'&month_year='.$today; ?>">
<i class="fas fa-user-clock"></i>&nbsp;&nbsp;&nbsp;
</a>
<?php } ?>

View File

@ -764,6 +764,7 @@
</a>
<div class="dropdown-menu" aria-labelledby="topnav-hr">
<a href="<?php echo base_url(); ?>employeeListing" class="dropdown-item"><i class="ri-shield-user-line align-middle mr-1"></i> Employee Details</a>
<a href="<?php echo base_url(); ?>DriverListing" class="dropdown-item"><i class="ri-file-settings-line align-middle mr-1"></i> Driver Details</a>
<a href="<?php echo base_url(); ?>attendance" class="dropdown-item"><i class=" ri-time-line align-middle mr-1"></i> Attendance</a>
<div class="dropdown">
@ -790,7 +791,7 @@
</div>
</div>
<a href="<?php echo base_url(); ?>DriverListing" class="dropdown-item"><i class="ri-file-settings-line align-middle mr-1"></i>Driver Details</a>
</div>
</li>