This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ProntoAtendimento;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\ProntoAtendimento\FechamentoFaaMassaService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FechamentoFaaMassaController extends Controller
|
||||
{
|
||||
protected $modulo = 'pronto-atendimento';
|
||||
protected $funcionalidade = 'fechamento-faa-massa';
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FechamentoFaaMassaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FechamentoFaaMassaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FechamentoFaaMassaService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(FechamentoFaaMassaService::datatable())
|
||||
->filterColumn('pronto_atendimento_faa.created_at', function ($query, $keyword) {
|
||||
$query->whereRaw("DATE_FORMAT(pronto_atendimento_faa.created_at, '%d/%m/%Y') LIKE ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(pronto_atendimento_faa.created_at,9,2),
|
||||
SUBSTR(pronto_atendimento_faa.created_at,6,2),
|
||||
SUBSTR(pronto_atendimento_faa.created_at,1,4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('cadastro_infraestrutura.nome', function ($query, $keyword) {
|
||||
$query->whereRaw("COALESCE(cadastro_infraestrutura.nome, cadastro_unidade.nome_fantasia) LIKE ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user