GWM : FE request changes

This commit is contained in:
Gowtham M 2025-11-14 12:25:40 +05:30
parent f9ee583f6f
commit 2626051ff6
6 changed files with 146 additions and 9 deletions

View File

@ -56,24 +56,37 @@ class StaffController extends ResourceController
$handler_id = $this->request->getGet('handler_id');
$manager_id = $this->request->getGet('manager_id');
$data = [];
if(!empty($manager_id))
{
$data = $this->StaffModel->select('partner_staff.id, partner_staff.name , R.role')
$staffData = $this->StaffModel->select('partner_staff.id, partner_staff.name , R.role')
->join('partner_role_master R', 'R.id = partner_staff.role_id', 'left')
->where('partner_staff.manager_id' , $manager_id )
->where('partner_staff.role_id' , 3 )
->where('partner_staff.is_active' , 1 )
->findAll();
$managerData = $this->StaffModel->select('partner_staff.id, partner_staff.name , R.role')
->join('partner_role_master R', 'R.id = partner_staff.role_id', 'left')
->where('partner_staff.id', $manager_id )
->where('partner_staff.is_active' , 1 )
->first();
$data = array_values(array_unique(array_merge($staffData, [$managerData]), SORT_REGULAR));
}else if(!empty($handler_id)){
$data = $this->StaffModel->select('partner_staff.id, partner_staff.name , R.role')
->join('partner_role_master R', 'R.id = partner_staff.role_id', 'left')
->where("JSON_CONTAINS(partner_staff.handler_id, '\"$handler_id\"')")
// ->where('partner_staff.handler_id' , $handler_id )
->where('partner_staff.role_id' , 3 )
->where('partner_staff.is_active' , 1 )
->findAll();
$staffData = $this->StaffModel->select('partner_staff.id, partner_staff.name , R.role')
->join('partner_role_master R', 'R.id = partner_staff.role_id', 'left')
->where("JSON_CONTAINS(partner_staff.handler_id, '\"$handler_id\"')")
->where('partner_staff.role_id' , 3 )
->where('partner_staff.is_active' , 1 )
->findAll();
$handlerData = $this->StaffModel->select('partner_staff.id, partner_staff.name , R.role')
->join('partner_role_master R', 'R.id = partner_staff.role_id', 'left')
->where('partner_staff.id', $handler_id )
->where('partner_staff.is_active' , 1 )
->first();
$data = array_values(array_unique(array_merge($staffData, [$handlerData]), SORT_REGULAR));
}
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $data], 200);

View File

@ -18,6 +18,7 @@ class AgentModel extends Model
'email_otp',
'firebase_device_token',
'manager_id',
'commission_retain',
'is_active',
'created_by',
'created_on',

View File

@ -42,7 +42,7 @@ class EnquiryModel extends Model
{
$data = $this->select('partner_enquiry.*, partner_enquiry.name as insured_name,
VT.vehicle_type as vehicle_type,
A.name as agent_name,
A.name as agent_name, A.agent_code,
I.name as insurer_name,I.short_name as insurer_short_name,
S.name as assigned_to_name,
Q.id as quotation_id,

View File

@ -0,0 +1,41 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class InvoiceItemModel extends Model
{
protected $table = 'partner_invoice_items';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $allowedFields = [
'invoice_id',
'policy_id',
'policy_no',
'commission_amount',
'is_active',
'created_at',
'created_by',
'updated_at',
'updated_by'
];
protected $useTimestamps = false;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $validationRules = [
'invoice_id' => 'required|integer',
'policy_id' => 'required|integer',
'policy_no' => 'required|max_length[100]',
'commission_amount' => 'decimal'
];
protected $validationMessages = [];
protected $skipValidation = false;
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class InvoiceModel extends Model
{
protected $table = 'partner_invoice';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $allowedFields = [
'invoice_no',
'invoice_amount',
'agent_id',
'invoice_date',
'is_active',
'created_at',
'created_by',
'updated_at',
'updated_by'
];
// Timestamps
protected $useTimestamps = false;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
// Validation (optional)
protected $validationRules = [
'invoice_no' => 'required|max_length[100]',
'invoice_amount' => 'decimal',
'agent_id' => 'required|integer',
'invoice_date' => 'required|valid_date',
];
protected $validationMessages = [];
protected $skipValidation = false;
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class InvoiceUtrModel extends Model
{
protected $table = 'partner_invoice_utr';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $allowedFields = [
'invoice_id',
'utr_no',
'amount',
'is_active',
'created_at',
'created_by',
'updated_at',
'updated_by'
];
protected $useTimestamps = false;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $validationRules = [
'invoice_id' => 'required|integer',
'utr_no' => 'required|max_length[100]',
'amount' => 'decimal'
];
protected $validationMessages = [];
protected $skipValidation = false;
}