This commit is contained in:
Gowtham M 2025-10-24 10:16:12 +05:30
parent 1be77c355b
commit ad3b9d9fdd
3 changed files with 14 additions and 4 deletions

View File

@ -40,6 +40,8 @@ class EnquiryController extends ResourceController
$from_date = $this->request->getGet('from_date');
$to_date = $this->request->getGet('to_date');
$status = $this->request->getGet('status');
$only_policy_data = $this->request->getGet('only_policy_data') ?? false;
@ -55,13 +57,13 @@ class EnquiryController extends ResourceController
}
if (!empty($agent_id)) {
$data = $this->enquiryModel->getEnquiry('AGENT', $agent_id, $only_policy_data, $from_date, $to_date);
$data = $this->enquiryModel->getEnquiry('AGENT', $agent_id, $only_policy_data, $from_date, $to_date, $status);
} elseif (!empty($staff_id)) {
$data = $this->enquiryModel->getEnquiry('STAFF', $staff_id, $only_policy_data, $from_date, $to_date);
$data = $this->enquiryModel->getEnquiry('STAFF', $staff_id, $only_policy_data, $from_date, $to_date, $status);
} elseif (!empty($enquiry_id)) {
$data = $this->enquiryModel->getEnquiry('ENQUIRY',$enquiry_id, $only_policy_data);
} elseif (!empty($manager_id)) {
$data = $this->enquiryModel->getEnquiry('MANAGER',$manager_id, $only_policy_data, $from_date, $to_date);
$data = $this->enquiryModel->getEnquiry('MANAGER',$manager_id, $only_policy_data, $from_date, $to_date, $status);
} else {
$data = $this->enquiryModel->getEnquiry('ALL');
}

View File

@ -29,6 +29,7 @@ class StaffController extends ResourceController
$data = $this->StaffModel->select('partner_staff.* , R.role')
->join('partner_role_master R', 'R.id = partner_staff.role_id', 'left')
->where('partner_staff.manager_id' , $manager_id )
->whereIn('partner_staff.role_id' , [2,3] )
->findAll();
}else{
@ -263,6 +264,7 @@ class StaffController extends ResourceController
public function monthlyLoginCount()
{
$month = $this->request->getGet('month') ?? date('Y-m'); // Default: current month
$manager_id = $this->request->getGet('manager_id');
// Extract year-month format (e.g., '2025-10')
$startDateTime = date('Y-m-01 00:00:00', strtotime($month));
@ -272,6 +274,9 @@ class StaffController extends ResourceController
$builder = $db->table('partner_staff_attendance a');
$builder->select('a.staff_id , s.name AS staff_name, DATE_FORMAT(a.login_datetime, "%Y-%m") AS month, COUNT(a.id) AS login_count');
$builder->join('partner_staff s', 's.id = a.staff_id', 'left');
if (!empty($manager_id)) {
$builder->where('s.manager_id', $manager_id);
}
$builder->where('a.login_datetime >=', $startDateTime);
$builder->where('a.login_datetime <=', $endDateTime);
$builder->groupBy('a.staff_id');

View File

@ -36,7 +36,7 @@ class EnquiryModel extends Model
protected $updatedField = 'updated_on';
public function getEnquiry($getBy = null , $Id = null , $only_policy_data = false, $from_date = null, $to_date = null)
public function getEnquiry($getBy = null , $Id = null , $only_policy_data = false, $from_date = null, $to_date = null , $status = null)
{
$data = $this->select('partner_enquiry.*, partner_enquiry.name as insured_name,
VT.vehicle_type as vehicle_type,
@ -57,6 +57,9 @@ class EnquiryModel extends Model
->where('partner_enquiry.is_active', 1)
->orderBy('partner_enquiry.created_on', 'ASC');
if($status != null){
$data->where('partner_enquiry.status' , $status );
}
if($only_policy_data){