ACC_MAN_SHOW_HIS_CLIENT
This commit is contained in:
parent
05c920c2bb
commit
fb261a8908
@ -315,8 +315,10 @@ class EmployeeController extends AdminController
|
||||
// ->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||
// ->where('files.created_by', get_session_userid())->orderBy('files.created_at', 'desc')->findAll();
|
||||
// dd($this->fileModel->getLastQuery());
|
||||
$role_id = get_role_id();
|
||||
$user_id = get_session_userid();
|
||||
|
||||
$data['fileList'] = $this->fileModel
|
||||
$query = $this->fileModel
|
||||
->select([
|
||||
'files.id','files.file_name','files.created_by','files.created_at','files.is_active','files.status','files.client_id','files.policy_id','files.client_branch_id','files.action','files.uploaded_by',
|
||||
'up.emp_code',
|
||||
@ -334,13 +336,19 @@ class EmployeeController extends AdminController
|
||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||
->join("client_rm cr","cr.client_id = c.id and cr.is_active = 1",'left');
|
||||
if (in_array($role_id, [2, 3])) {
|
||||
|
||||
// If the user is a Account Manager or Manager, filter by user_id
|
||||
$query->where('cr.user_id', $user_id);
|
||||
}
|
||||
// ->where('files.created_by', get_session_userid())
|
||||
->orderBy('files.created_at', 'desc')
|
||||
$data['fileList'] = $query->orderBy('files.created_at', 'desc')
|
||||
->limit(100)
|
||||
->find();
|
||||
// dd($data['fileList']);
|
||||
|
||||
$data['batch_list'] = $this->batchFileModel->select("
|
||||
$query2 = $this->batchFileModel->select("
|
||||
|
||||
batch_files.id,
|
||||
batch_files.client_id,
|
||||
@ -378,9 +386,17 @@ class EmployeeController extends AdminController
|
||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->orderBy('batch_files.id', 'desc')
|
||||
->limit(1000)
|
||||
->find();
|
||||
->join("client_rm cr","cr.client_id = clients.id and cr.is_active = 1",'left');
|
||||
if (in_array($role_id, [2, 3])) {
|
||||
|
||||
// If the user is a Account Manager or Manager, filter by user_id
|
||||
$query2->where('cr.user_id', $user_id);
|
||||
}
|
||||
// ->where('files.created_by', get_session_userid())
|
||||
$data['batch_list'] = $query2->orderBy('batch_files.id', 'desc')
|
||||
->limit(1000)
|
||||
->find();
|
||||
|
||||
|
||||
|
||||
// dd($data['fileList']);die();
|
||||
@ -759,8 +775,18 @@ class EmployeeController extends AdminController
|
||||
|
||||
public function enrollmentClientList()
|
||||
{
|
||||
$role_id = get_role_id();
|
||||
$user_id = get_session_userid();
|
||||
|
||||
$data = [];
|
||||
$client_list = $this->clientModel->where('clients.is_active', 1)->findAll();
|
||||
$client_list = $this->clientModel->join("client_rm","client_rm.client_id = clients.id",'left')->where('clients.is_active', 1);
|
||||
if (in_array($role_id, [2, 3])) {
|
||||
|
||||
// If the user is a Account Manager or Manager, filter by user_id
|
||||
$client_list->where('client_rm.user_id', $user_id);
|
||||
}
|
||||
|
||||
$client_list = $client_list->groupBy("clients.id")->findAll();
|
||||
$branch_list = $this->clientBranchModel->where('client_branch.is_active', 1)->findAll();
|
||||
$policy_list = $this->clientPolicyModel
|
||||
->select('client_policy.*, policy_type.policy_type')
|
||||
|
||||
@ -53,17 +53,19 @@ class ClientModel extends Model
|
||||
|
||||
$columns = ['clients.id ', 'client_name','short_name'];
|
||||
$clients = $this->select($columns)
|
||||
->where('is_active',1)
|
||||
->where('clients.is_active',1)
|
||||
->findAll();
|
||||
|
||||
// if($role_id == 2 || $role_id == 3){
|
||||
if($role_id == 2 || $role_id == 3){
|
||||
|
||||
// $clients = $this->select($columns)
|
||||
// ->join('client_rm', 'client_rm.client_id = clients.id')
|
||||
// ->where('client_rm.user_id', $user_id)
|
||||
// ->where('clients.is_active',1)
|
||||
// ->findAll();
|
||||
// }
|
||||
$clients = $this->select($columns)
|
||||
->join('client_rm', 'client_rm.client_id = clients.id')
|
||||
->where('client_rm.user_id', $user_id)
|
||||
->where('clients.is_active',1)
|
||||
->findAll();
|
||||
}
|
||||
|
||||
// $clients->findAll();
|
||||
|
||||
|
||||
|
||||
@ -107,11 +109,24 @@ class ClientModel extends Model
|
||||
|
||||
public function getCreatedByUserName(){
|
||||
|
||||
return $this->db->table('clients')
|
||||
$role_id = get_role_id();
|
||||
$user_id = get_session_userid();
|
||||
|
||||
$query = $this->db->table('clients')
|
||||
->select('clients.*')
|
||||
->where('is_active', 1)
|
||||
->get()
|
||||
->getResult();
|
||||
->join('client_rm', 'client_rm.client_id = clients.id','left')
|
||||
->where('clients.is_active', 1);
|
||||
|
||||
if (in_array($role_id, [2, 3])) {
|
||||
|
||||
// If the user is a Account Manager or Manager, filter by user_id
|
||||
$query->where('client_rm.user_id', $user_id);
|
||||
}
|
||||
|
||||
$data = $query->groupBy("clients.id")->get()->getResult();
|
||||
// dd($data);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1994,6 +1994,17 @@
|
||||
$('#tpa').prop('required', true);
|
||||
$('#tpa_danger').show()
|
||||
}
|
||||
|
||||
if (res.data.policy_type_id > 7) {
|
||||
|
||||
$('#first').show();
|
||||
$('#second').show();
|
||||
$('#third').show();
|
||||
$('#base_policy_id').hide();
|
||||
$('#base_policy').prop('required', false);
|
||||
|
||||
$(".EB").hide();
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
$('#client_branch').val(res.data.client_branch_id).select2();
|
||||
|
||||
@ -1073,7 +1073,7 @@ function processJsonObject2(jsonObject) {
|
||||
function disableUnwantedTermsforGPA(jsonObject) {
|
||||
// alert("Disabling unwanted terms");
|
||||
|
||||
fields.forEach(function(key) {
|
||||
gpaFields.forEach(function(key) {
|
||||
// If key NOT in jsonObject, then hide and disable its associated elements
|
||||
if (!jsonObject.hasOwnProperty(key)) {
|
||||
const elements = document.getElementsByName(key);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user