68 lines
2.2 KiB
PHP
68 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\ExameImagem;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\ExameImagem\JornadaService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
|
|
class JornadaController extends Controller
|
|
{
|
|
|
|
protected $modulo = 'exame-imagem';
|
|
protected $funcionalidade = 'jornada';
|
|
|
|
public function datatable(Request $request)
|
|
{
|
|
return datatables()->of(JornadaService::datatable($request))
|
|
->filterColumn('cadastro_cidadao.data_nascimento', function ($query, $keyword) {
|
|
|
|
$query
|
|
->whereRaw("DATE_FORMAT(cadastro_cidadao.data_nascimento, '%d/%m/%Y') like ?", ["%{$keyword}%"])
|
|
->orWhereRaw(
|
|
"CONCAT(
|
|
SUBSTR(cadastro_cidadao.data_nascimento,9,2),
|
|
SUBSTR(cadastro_cidadao.data_nascimento,6,2),
|
|
SUBSTR(cadastro_cidadao.data_nascimento,1,4)
|
|
) like ?",
|
|
["%{$keyword}%"]
|
|
);
|
|
})
|
|
->filterColumn('cadastro_cidadao.cpf', function ($query, $keyword) {
|
|
|
|
$query
|
|
->whereRaw("cadastro_cidadao.cpf like ?", ["%{$keyword}%"])
|
|
->orWhereRaw(
|
|
"CONCAT(
|
|
SUBSTR(cadastro_cidadao.cpf,1,3),
|
|
'.',
|
|
SUBSTR(cadastro_cidadao.cpf,4,3),
|
|
'.',
|
|
SUBSTR(cadastro_cidadao.cpf,7,3),
|
|
'-',
|
|
SUBSTR(cadastro_cidadao.cpf,10,2)
|
|
) like ?",
|
|
["%{$keyword}%"]
|
|
);
|
|
})
|
|
->skipTotalRecords()
|
|
->toJson();
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
return response()->json(JornadaService::show($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
return response()->json(JornadaService::store($request), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function getSupervisores(Request $request)
|
|
{
|
|
return response()->json(JornadaService::getSupervisores($request), Response::HTTP_OK);
|
|
}
|
|
}
|