
<div class="assign-to">
    <?php 
        //pr($crmuserTypeList);exit;
        $class = [];
        $list = [];
        if ($this->request->params['action'] == 'clientonboarding') {
            $list['My own client list'] = ['0'=>'My own client list'];
            $class['My own client list'] = 'my-own-client-list';
        }else {
            $list['Please Select'] = ['0'=>'Me'];
            $class['Please Select'] = 'only-me';
            if($_SESSION['userType'] == CRM_USER_INDICATOR){
                $list['Please Select'][0] = 'Me';
                $list['Please Select']['-1'] = 'Admin';
            }
        }
        
       //pr($data);exit;
        
        if(!empty($data['employee'])){
            $list['Employee List'] = $data['employee'];
            $class['Employee List'] = 'rest-employee';
        } 
        
        if(!empty ($data['own_affiliate'])){
            $list['My Own Affiliate List'] = $data['own_affiliate'];
            $class['My Own Affiliate List'] = 'rest-employee';
        }
        
        if(!empty ($data['employee_affiliate'])){
            $list['Employee Affiliate List'] = $data['employee_affiliate'];
            $class['Employee Affiliate List'] = 'rest-employee';
        }

        
        $crmuser_ids = [];
        $selected_assoc = [];
        if($client->client->crmuser_id == 0 && $client->client->employee_id == 0){
             $crmuser_id = 0;
             $crmuser_ids[] = $crmuser_id;
        }
        if($client->client->crmuser_id == 0 && $client->client->employee_id > 0){
            $crmuser_id = $client->client->employee_id;
            $crmuser_ids[] = $crmuser_id;
            $selected_assoc['Employee List'][] = $crmuser_id;
        } 
        
        if($client->client->crmuser_id > 0 && $client->client->employee_id == 0){
            $crmuser_id = $client->client->crmuser_id;
            $crmuser_ids[] = $crmuser_id;
            $selected_assoc['Affiliate List'][] = $crmuser_id;
        } 
        
        if($client->client->crmuser_id > 0 && $client->client->employee_id > 0){
            $crmuser_id = $client->client->crmuser_id;
            $crmuser_ids[] = $crmuser_id;
            $crmuser_ids[] = $client->client->employee_id;
            $selected_assoc['Affiliate List'][] = $crmuser_id;
            $selected_assoc['Employee List'][] = $client->client->employee_id;
        }
        
       
        //pr($list);exit;
        echo $this->element('multi_select_checkbox_global',['data'=>['url'=>$data['url'],'member_id'=>$selected_reminders['member_id'],'admin_id'=>$selected_reminders['admin_id'],'selected'=>$selected_reminders['employees'],'list'=>$list,'class'=>$class,'default'=>$default_select]]);//$this->Form->select('crmuser_id_as_affiliate_id',$list, ['empty'=>false,'style'=>'width:160px;','label' =>false,'class' => 'form-control multi-select-dropdown','onchange'=>'shiftClient(this,'.$client->client->id.',"'.$client->client->name.'")','default'=>$crmuser_ids,'multiple'=>true]); 
    ?>
    
</div>   
