96 lines
2.8 KiB
PHP
96 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Bpa;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Bpa\ProcedimentoIndividualizadoService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
|
|
class ProcedimentoIndividualizadoController extends Controller
|
|
{
|
|
protected $modulo = 'bpa';
|
|
protected $funcionalidade = 'procedimento-individualizado';
|
|
|
|
public function list(Request $request)
|
|
{
|
|
return response()->json(ProcedimentoIndividualizadoService::list($request), Response::HTTP_OK);
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ProcedimentoIndividualizadoService::index(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ProcedimentoIndividualizadoService::create(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ProcedimentoIndividualizadoService::store($request), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ProcedimentoIndividualizadoService::show($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ProcedimentoIndividualizadoService::edit($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function update(Request $request, $id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ProcedimentoIndividualizadoService::update($request, $id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ProcedimentoIndividualizadoService::destroy($id), Response::HTTP_NO_CONTENT);
|
|
}
|
|
|
|
public function datatable()
|
|
{
|
|
return datatables()
|
|
->of(ProcedimentoIndividualizadoService::datatable())
|
|
->filterColumn('procedimento_codigo', function ($query, $keyword) {
|
|
|
|
$query
|
|
->whereRaw("procedimento_codigo like ?", ["%{$keyword}%"])
|
|
->orWhereRaw(
|
|
"CONCAT(
|
|
SUBSTR(procedimento_codigo,1,2),
|
|
'.',
|
|
SUBSTR(procedimento_codigo,3,2),
|
|
'.',
|
|
SUBSTR(procedimento_codigo,5,2),
|
|
'.',
|
|
SUBSTR(procedimento_codigo,7,3),
|
|
'-',
|
|
SUBSTR(procedimento_codigo,10,1)
|
|
) like ?",
|
|
["%{$keyword}%"]
|
|
);
|
|
})
|
|
->skipTotalRecords()
|
|
->make(true);
|
|
}
|
|
}
|