This commit is contained in:
33
api/app/Http/Requests/PainelSenha/ChamadaRequest.php
Normal file
33
api/app/Http/Requests/PainelSenha/ChamadaRequest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
|
||||
class ChamadaRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch($this->method()) {
|
||||
case 'POST':
|
||||
return $this->getPostRules();
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'fila_id' => ['required', 'integer'],
|
||||
'tela_id' => ['required', 'integer'],
|
||||
];
|
||||
}
|
||||
}
|
||||
79
api/app/Http/Requests/PainelSenha/EncaminhamentoRequest.php
Normal file
79
api/app/Http/Requests/PainelSenha/EncaminhamentoRequest.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class EncaminhamentoRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch($this->method()) {
|
||||
case 'POST':
|
||||
return $this->getPostRules();
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
return $this->getPutRules();
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id_de' => [
|
||||
'required',
|
||||
'integer',
|
||||
'different:centro_custo_id_para',
|
||||
Rule::unique('\App\Models\PainelSenha\Encaminhamento')->where(function ($query) {
|
||||
return $query
|
||||
->where('centro_custo_id_para', $this->centro_custo_id_para)
|
||||
->whereNull('deleted_at');
|
||||
}),
|
||||
],
|
||||
'centro_custo_id_para' => [
|
||||
'required',
|
||||
'integer',
|
||||
'different:centro_custo_id_de',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
private function getPutRules()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id_de' => [
|
||||
'required',
|
||||
'integer',
|
||||
'different:centro_custo_id_para',
|
||||
Rule::unique('\App\Models\PainelSenha\Encaminhamento')->where(function ($query) {
|
||||
return $query
|
||||
->where('centro_custo_id_para', $this->centro_custo_id_para)
|
||||
->whereNull('deleted_at');
|
||||
})->ignore($this->encaminhamento),
|
||||
],
|
||||
'centro_custo_id_para' => [
|
||||
'required',
|
||||
'integer',
|
||||
'different:centro_custo_id_de',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id_de.unique' => 'Já existe um encaminhamento cadastrado com estas informações.'
|
||||
];
|
||||
}
|
||||
}
|
||||
39
api/app/Http/Requests/PainelSenha/FilaRequest.php
Normal file
39
api/app/Http/Requests/PainelSenha/FilaRequest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
use App\Models\PainelSenha\OpcaoEntrada;
|
||||
|
||||
class FilaRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch($this->method()) {
|
||||
case 'POST':
|
||||
return $this->getPostRules();
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'opcao_entrada_id' => ['required', 'integer'],
|
||||
'prioridade_id' => [
|
||||
'nullable',
|
||||
'integer',
|
||||
Rule::requiredIf(fn () => OpcaoEntrada::findOrFail($this->opcao_entrada_id)->prioridade_obrigatoria),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
67
api/app/Http/Requests/PainelSenha/OpcaoChamadaRequest.php
Normal file
67
api/app/Http/Requests/PainelSenha/OpcaoChamadaRequest.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class OpcaoChamadaRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch($this->method()) {
|
||||
case 'POST':
|
||||
return $this->getPostRules();
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
return $this->getPutRules();
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id' => [
|
||||
'required',
|
||||
Rule::unique('painel_senha_opcao_chamada')->where(function ($query) {
|
||||
return $query->where('tela_id', $this->tela_id)->whereNull('deleted_at');
|
||||
})
|
||||
],
|
||||
'tela_id' => [
|
||||
'required',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
private function getPutRules()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id' => [
|
||||
'required',
|
||||
Rule::unique('painel_senha_opcao_chamada')->where(function ($query) {
|
||||
return $query->where('tela_id', $this->tela_id)->whereNull('deleted_at');
|
||||
})->ignore($this->opcao_chamada),
|
||||
],
|
||||
'tela_id' => [
|
||||
'required',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id.unique' => 'Já existe uma opção de chamada cadastrada com estas informações.'
|
||||
];
|
||||
}
|
||||
}
|
||||
99
api/app/Http/Requests/PainelSenha/OpcaoEntradaRequest.php
Normal file
99
api/app/Http/Requests/PainelSenha/OpcaoEntradaRequest.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class OpcaoEntradaRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch($this->method()) {
|
||||
case 'POST':
|
||||
return $this->getPostRules();
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
return $this->getPutRules();
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id' => [
|
||||
'required',
|
||||
Rule::unique('\App\Models\PainelSenha\OpcaoEntrada')->where(function ($query) {
|
||||
return $query
|
||||
->where('nome', $this->nome)
|
||||
->where('sigla', $this->sigla)
|
||||
->where('modulo_id', $this->modulo_id)
|
||||
->where('faixa_etaria_id', $this->faixa_etaria_id)
|
||||
->whereNull('deleted_at');
|
||||
}),
|
||||
],
|
||||
'modulo_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
],
|
||||
'nome' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:100',
|
||||
],
|
||||
'sigla' => [
|
||||
'required',
|
||||
'min:2',
|
||||
'max:2',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
private function getPutRules()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id' => [
|
||||
'required',
|
||||
Rule::unique('\App\Models\PainelSenha\OpcaoEntrada')->where(function ($query) {
|
||||
return $query
|
||||
->where('nome', $this->nome)
|
||||
->where('sigla', $this->sigla)
|
||||
->where('modulo_id', $this->modulo_id)
|
||||
->where('faixa_etaria_id', $this->faixa_etaria_id)
|
||||
->whereNull('deleted_at');
|
||||
})->ignore($this->opcao_entrada),
|
||||
],
|
||||
'modulo_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
],
|
||||
'nome' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:100',
|
||||
],
|
||||
'sigla' => [
|
||||
'required',
|
||||
'min:2',
|
||||
'max:2',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id.unique' => 'Já existe uma opção de entrada cadastrada com estas informações.'
|
||||
];
|
||||
}
|
||||
}
|
||||
46
api/app/Http/Requests/PainelSenha/ParametrizacaoRequest.php
Normal file
46
api/app/Http/Requests/PainelSenha/ParametrizacaoRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
|
||||
class ParametrizacaoRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch ($this->method()) {
|
||||
|
||||
case 'POST': {
|
||||
|
||||
return $this->getPostRules();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'infraestruturas' => [
|
||||
'present',
|
||||
'array',
|
||||
],
|
||||
'infraestruturas.*.id' => [
|
||||
'required',
|
||||
'integer',
|
||||
],
|
||||
'infraestruturas.*.modulos' => [
|
||||
'required',
|
||||
'array',
|
||||
],
|
||||
'infraestruturas.*.modulos.*' => [
|
||||
'required',
|
||||
'integer',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
69
api/app/Http/Requests/PainelSenha/StatusRequest.php
Normal file
69
api/app/Http/Requests/PainelSenha/StatusRequest.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StatusRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch($this->method()) {
|
||||
case 'POST':
|
||||
return $this->getPostRules();
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
return $this->getPutRules();
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id' => [
|
||||
'required',
|
||||
Rule::unique('\App\Models\PainelSenha\Status')->where(function ($query) {
|
||||
return $query
|
||||
->where('tipo_id', $this->tipo_id)
|
||||
->whereNull('deleted_at');
|
||||
}),
|
||||
],
|
||||
'tipo_id' => ['required'],
|
||||
'nome' => ['required', 'min:3', 'max:100']
|
||||
];
|
||||
}
|
||||
|
||||
private function getPutRules()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id' => [
|
||||
'required',
|
||||
Rule::unique('\App\Models\PainelSenha\Status')->where(function ($query) {
|
||||
return $query
|
||||
->where('tipo_id', $this->tipo_id)
|
||||
->whereNull('deleted_at');
|
||||
})->ignore($this->status),
|
||||
],
|
||||
'tipo_id' => ['required'],
|
||||
'nome' => ['required', 'min:3', 'max:100']
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'centro_custo_id.unique' => 'Já existe um Status cadastrado com o setor e tipo selecionados.'
|
||||
];
|
||||
}
|
||||
}
|
||||
75
api/app/Http/Requests/PainelSenha/TelaRequest.php
Normal file
75
api/app/Http/Requests/PainelSenha/TelaRequest.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class TelaRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch($this->method()) {
|
||||
case 'POST':
|
||||
return $this->getPostRules();
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
return $this->getPutRules();
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'infraestrutura_id' => [
|
||||
'required',
|
||||
Rule::unique('painel_senha_tela')->where(function ($query) {
|
||||
return $query
|
||||
->where('nome', $this->nome)
|
||||
->whereNull('deleted_at');
|
||||
})
|
||||
],
|
||||
'nome' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:100',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
private function getPutRules()
|
||||
{
|
||||
return [
|
||||
'infraestrutura_id' => [
|
||||
'required',
|
||||
Rule::unique('painel_senha_tela')->where(function ($query) {
|
||||
return $query
|
||||
->where('nome', $this->nome)
|
||||
->where('id', '!=', $this->tela)
|
||||
->whereNull('deleted_at');
|
||||
})
|
||||
],
|
||||
'nome' => [
|
||||
'required',
|
||||
'max:100',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'infraestrutura_id.unique' => 'Já existe uma tela cadastrada com estas informações.'
|
||||
];
|
||||
}
|
||||
}
|
||||
87
api/app/Http/Requests/PainelSenha/TempoEsperaRequest.php
Normal file
87
api/app/Http/Requests/PainelSenha/TempoEsperaRequest.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\PainelSenha;
|
||||
|
||||
use App\Http\Requests\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class TempoEsperaRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch($this->method()) {
|
||||
case 'POST':
|
||||
return $this->getPostRules();
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
return $this->getPutRules();
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private function getPostRules()
|
||||
{
|
||||
return [
|
||||
'infraestrutura_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::unique('\App\Models\PainelSenha\TempoEspera')->where(function ($query) {
|
||||
return $query
|
||||
->where('tempo', $this->tempo)
|
||||
->whereNull('deleted_at');
|
||||
}),
|
||||
],
|
||||
'cor' => [
|
||||
'required',
|
||||
'string',
|
||||
],
|
||||
'tempo' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1',
|
||||
'max:240',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
private function getPutRules()
|
||||
{
|
||||
return [
|
||||
'infraestrutura_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::unique('\App\Models\PainelSenha\TempoEspera')->where(function ($query) {
|
||||
return $query
|
||||
->where('tempo', $this->nome)
|
||||
->whereNull('deleted_at');
|
||||
})->ignore($this->tempo_espera),
|
||||
],
|
||||
'cor' => [
|
||||
'required',
|
||||
'string',
|
||||
],
|
||||
'tempo' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1',
|
||||
'max:240',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'infraestrutura_id.unique' => 'Já existe um tempo de espera cadastrado com estas informações.'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user