@php if(env('FILESYSTEM_DRIVER') == 's3'){ $fileurlbase = env('URLS3') . '/' . env('FILEKEY') . '/'; }else{ $fileurlbase = env('APP_URL') . '/'; } $td_colunas_fields_key = []; $td_colunas_fields = json_decode('[{"name":"Empresa","type":"select","size":"12","auto_fill_fields":false,"disabled":false,"note":null,"value":null,"relationship":"Cadastro de Empresa","relationship_reference":"Nome da Empresa","relationshipReferenceClassName":"CadastroDeEmpresa","relationshipReferenceCleanName":"nome_da_empresa","className":"Empresa","cleanName":"empresa"},{"name":"Tipo","type":"text","size":"12","auto_fill_fields":false,"className":"Tipo","cleanName":"tipo"}]',true); foreach($td_colunas_fields as $tcf){ $td_colunas_fields_key[$tcf['cleanName']] = $tcf; } // :: Buscando Opções de Quadro $quadros = []; $quadros_options = []; // ! Tipo -> Seleção if($td_colunas_fields_key[$kanban_field]['type'] == 'selectbox'){ $Get_Options = 'Get_options_'.$kanban_field; if(method_exists($controller_model,$Get_Options)){ $quadros_options = $controller_model::$Get_Options(); } // ! Tipo -> Relacionamento }elseif($td_colunas_fields_key[$kanban_field]['type'] == 'select'){ $Get_relationship = "\\App\\Models\\".$td_colunas_fields_key[$kanban_field]['relationshipReferenceClassName']; $Get_relationship_reference = $td_colunas_fields_key[$kanban_field]['relationshipReferenceCleanName']; $Get_Options = $Get_relationship::kanban_list(10000, $Get_relationship_reference); $quadros_options = $Get_Options->toArray(); } foreach($quadros_options as $key => $qo){ $quadros[$key]['id'] = (string) $key; $quadros[$key]['title'] = (in_array($key,[0,''])?'Início':$qo); $quadros[$key]['item'] = []; } foreach($tipo_de_treinamento as $key => $list){ // ! Verifica se o 'Registro' possuí 'Status' caso contrário = (null,0,'') // atribuí para o 'Início' posição = 0 $list->$kanban_field = (in_array($list->$kanban_field,[null,0,''])?0:$list->$kanban_field); $quadros[$list->$kanban_field]['item'][$key]['column'] = (string) $kanban_field; $quadros[$list->$kanban_field]['item'][$key]['id'] = (string) $list->id; $quadros[$list->$kanban_field]['item'][$key]['title'] = ''; if(is_array($td_colunas_fields)){ foreach($td_colunas_fields as $tcf){ if( (isset($tcf['hidden_view']) && $tcf['hidden_view']) || ($td_colunas_fields_key[$kanban_field]['type'] == 'select' and $tcf['cleanName'] == $kanban_field) ){ continue; } try { // :: Texto if(isset($tcf['type']) and $tcf['type'] == 'text'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: Relacionamento }elseif(isset($tcf['type']) and $tcf['type'] == 'select' and isset($tcf['className']) and isset($tcf['relationshipReferenceCleanName'])){ $cleanName = $tcf['cleanName']; $className = $tcf['className']; $relationshipReferenceCleanName = $tcf['relationshipReferenceCleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.($list->$className?$list->$className->$relationshipReferenceCleanName:'---').'
'; // :: Caixa de Seleção }elseif(isset($tcf['type']) and $tcf['type'] == 'selectbox' and isset($tcf['cleanName'])){ $cleanName = $tcf['cleanName']; $Get_Options = 'Get_'.$cleanName; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$Get_Options())?$list->$Get_Options():'---').'
'; // :: Data }elseif(isset($tcf['type']) and $tcf['type'] == 'data'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: Data e Hora }elseif(isset($tcf['type']) and $tcf['type'] == 'dataehora'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: Hora }elseif(isset($tcf['type']) and $tcf['type'] == 'hora'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: Data / Date - Pop Up }elseif(isset($tcf['type']) and $tcf['type'] == 'date'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?date("d/m/Y", strtotime($list->$cleanName)):'---').'
'; // :: Data e Hora / Datetime - Pop Up }elseif(isset($tcf['type']) and $tcf['type'] == 'datetime'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.((!empty($list->$cleanName) and (bool)strtotime($list->$cleanName))?date("d/m/Y H:i", strtotime($list->$cleanName)):'---').'
'; // :: Data e Hora Automático / Dataehoraauto }elseif(isset($tcf['type']) and $tcf['type'] == 'dataehoraauto'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.((!empty($list->$cleanName) and (bool)strtotime($list->$cleanName))?date("d/m/Y H:i", strtotime($list->$cleanName)):'---').'
'; // :: CNPJ }elseif(isset($tcf['type']) and $tcf['type'] == 'cnpj'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: CPF }elseif(isset($tcf['type']) and $tcf['type'] == 'cpf'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: E-mail }elseif(isset($tcf['type']) and $tcf['type'] == 'email'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: Dinheiro R$ / Money }elseif(isset($tcf['type']) and $tcf['type'] == 'money'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?number_format($list->$cleanName,2,'.',''):'---').'
'; // :: Cálculo / calculo }elseif(isset($tcf['type']) and $tcf['type'] == 'calculo'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?number_format($list->$cleanName,2,'.',''):'---').'
'; // :: Numérico / number }elseif(isset($tcf['type']) and $tcf['type'] == 'number'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: Cep }elseif(isset($tcf['type']) and $tcf['type'] == 'cep'){ $cleanName = $tcf['cleanName']; $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.(!empty($list->$cleanName)?$list->$cleanName:'---').'
'; // :: Upload / file }elseif(isset($tcf['type']) and $tcf['type'] == 'file'){ $cleanName = $tcf['cleanName']; $campo_value = '---'; if(!empty($list->$cleanName) and count(explode(".", $list->$cleanName)) >= 2){ $campo_href = (in_array(explode(".", $list->$cleanName)[1], array("jpg", "jpeg", "gif", "png", "bmp", "mp4", "pdf", "doc", "docx", "rar", "zip", "txt", "7zip", "csv", "xls", "xlsx")) ? $fileurlbase . "images/" . $list->$cleanName : "javascript:void(0);"); $campo_img_src = (in_array(explode(".", $list->$cleanName)[1], array("mp4", "pdf", "doc", "docx", "rar", "zip", "txt", "7zip", "csv", "xls", "xlsx")) ? explode(".", $list->$cleanName)[1] . "-icon.png" : $fileurlbase . "images/" . $list->$cleanName); $campo_value = ''; } $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'.$tcf['name'].':
'.$campo_value.'
'; } }catch(\Exception $e){ } } } $quadros[$list->$kanban_field]['item'][$key]['title'] .= '
'; } $quadros = array_values($quadros); foreach($quadros as $key => $q){ $quadros[$key]['item'] = array_values($q['item']); } // - :: $boards_list = json_encode(array_values($quadros)); @endphp
@if(\App\Models\Permissions::permissaoUsuario(\Auth::user(), "$controller@store") OR $isPublic) Cadastrar @endif
{{-- --}}
@section('script') @endsection