..
This commit is contained in:
parent
1be77c355b
commit
ad3b9d9fdd
@ -40,6 +40,8 @@ class EnquiryController extends ResourceController
|
|||||||
$from_date = $this->request->getGet('from_date');
|
$from_date = $this->request->getGet('from_date');
|
||||||
$to_date = $this->request->getGet('to_date');
|
$to_date = $this->request->getGet('to_date');
|
||||||
|
|
||||||
|
$status = $this->request->getGet('status');
|
||||||
|
|
||||||
$only_policy_data = $this->request->getGet('only_policy_data') ?? false;
|
$only_policy_data = $this->request->getGet('only_policy_data') ?? false;
|
||||||
|
|
||||||
|
|
||||||
@ -55,13 +57,13 @@ class EnquiryController extends ResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($agent_id)) {
|
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)) {
|
} 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)) {
|
} elseif (!empty($enquiry_id)) {
|
||||||
$data = $this->enquiryModel->getEnquiry('ENQUIRY',$enquiry_id, $only_policy_data);
|
$data = $this->enquiryModel->getEnquiry('ENQUIRY',$enquiry_id, $only_policy_data);
|
||||||
} elseif (!empty($manager_id)) {
|
} 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 {
|
} else {
|
||||||
$data = $this->enquiryModel->getEnquiry('ALL');
|
$data = $this->enquiryModel->getEnquiry('ALL');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@ class StaffController extends ResourceController
|
|||||||
$data = $this->StaffModel->select('partner_staff.* , R.role')
|
$data = $this->StaffModel->select('partner_staff.* , R.role')
|
||||||
->join('partner_role_master R', 'R.id = partner_staff.role_id', 'left')
|
->join('partner_role_master R', 'R.id = partner_staff.role_id', 'left')
|
||||||
->where('partner_staff.manager_id' , $manager_id )
|
->where('partner_staff.manager_id' , $manager_id )
|
||||||
|
->whereIn('partner_staff.role_id' , [2,3] )
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@ -263,6 +264,7 @@ class StaffController extends ResourceController
|
|||||||
public function monthlyLoginCount()
|
public function monthlyLoginCount()
|
||||||
{
|
{
|
||||||
$month = $this->request->getGet('month') ?? date('Y-m'); // Default: current month
|
$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')
|
// Extract year-month format (e.g., '2025-10')
|
||||||
$startDateTime = date('Y-m-01 00:00:00', strtotime($month));
|
$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 = $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->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');
|
$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 >=', $startDateTime);
|
||||||
$builder->where('a.login_datetime <=', $endDateTime);
|
$builder->where('a.login_datetime <=', $endDateTime);
|
||||||
$builder->groupBy('a.staff_id');
|
$builder->groupBy('a.staff_id');
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class EnquiryModel extends Model
|
|||||||
protected $updatedField = 'updated_on';
|
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,
|
$data = $this->select('partner_enquiry.*, partner_enquiry.name as insured_name,
|
||||||
VT.vehicle_type as vehicle_type,
|
VT.vehicle_type as vehicle_type,
|
||||||
@ -57,6 +57,9 @@ class EnquiryModel extends Model
|
|||||||
->where('partner_enquiry.is_active', 1)
|
->where('partner_enquiry.is_active', 1)
|
||||||
->orderBy('partner_enquiry.created_on', 'ASC');
|
->orderBy('partner_enquiry.created_on', 'ASC');
|
||||||
|
|
||||||
|
if($status != null){
|
||||||
|
$data->where('partner_enquiry.status' , $status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if($only_policy_data){
|
if($only_policy_data){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user