This commit is contained in:
45
api/app/Models/PainelSenha/Aviso.php
Normal file
45
api/app/Models/PainelSenha/Aviso.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Aviso extends Model
|
||||
{
|
||||
|
||||
protected $table = 'painel_senha_aviso';
|
||||
|
||||
protected $fillable = [
|
||||
'mensagem',
|
||||
'is_ativo',
|
||||
'data_inicial',
|
||||
'data_final',
|
||||
'dias_semana',
|
||||
'hora_inicial',
|
||||
'hora_final',
|
||||
'intervalo',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function agendamentos()
|
||||
{
|
||||
return $this->hasMany(AvisoAgendamento::class);
|
||||
}
|
||||
|
||||
public function unidades()
|
||||
{
|
||||
return $this->hasMany(AvisoUnidade::class);
|
||||
}
|
||||
|
||||
}
|
||||
29
api/app/Models/PainelSenha/AvisoAgendamento.php
Normal file
29
api/app/Models/PainelSenha/AvisoAgendamento.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AvisoAgendamento extends Model
|
||||
{
|
||||
protected $table = 'painel_senha_aviso_agendamento';
|
||||
|
||||
protected $fillable = [
|
||||
'aviso_id',
|
||||
'data_hora_agendada',
|
||||
'data_hora_executada',
|
||||
'is_envio_manual',
|
||||
'created_at',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
|
||||
public function aviso()
|
||||
{
|
||||
return $this->belongsTo(Aviso::class);
|
||||
}
|
||||
|
||||
}
|
||||
43
api/app/Models/PainelSenha/AvisoUnidade.php
Normal file
43
api/app/Models/PainelSenha/AvisoUnidade.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\Unidade;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AvisoUnidade extends Model
|
||||
{
|
||||
// use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_aviso_unidade';
|
||||
|
||||
protected $fillable = [
|
||||
'aviso_id',
|
||||
'unidade_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function aviso()
|
||||
{
|
||||
return $this->belongsTo(Aviso::class);
|
||||
}
|
||||
|
||||
|
||||
public function unidade()
|
||||
{
|
||||
return $this->belongsTo(Unidade::class);
|
||||
}
|
||||
|
||||
}
|
||||
35
api/app/Models/PainelSenha/CentroCustoCompartilhado.php
Normal file
35
api/app/Models/PainelSenha/CentroCustoCompartilhado.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
|
||||
class CentroCustoCompartilhado extends Model
|
||||
{
|
||||
protected $table = 'painel_senha_centro_custo_compartilhado';
|
||||
|
||||
protected $fillable = [
|
||||
'opcao_entrada_id',
|
||||
'centro_custo_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function opcaoEntrada()
|
||||
{
|
||||
return $this->belongsTo(OpcaoEntrada::class);
|
||||
}
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
}
|
||||
55
api/app/Models/PainelSenha/Chamada.php
Normal file
55
api/app/Models/PainelSenha/Chamada.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\Sala;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Paciente;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Chamada extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_chamada';
|
||||
|
||||
protected $fillable = [
|
||||
'fila_id',
|
||||
'status_id',
|
||||
'tela_id',
|
||||
'sala_id',
|
||||
'paciente_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function fila()
|
||||
{
|
||||
return $this->belongsTo(Fila::class);
|
||||
}
|
||||
|
||||
public function sala()
|
||||
{
|
||||
return $this->belongsTo(Sala::class);
|
||||
}
|
||||
|
||||
public function paciente()
|
||||
{
|
||||
return $this->belongsTo(Paciente::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
46
api/app/Models/PainelSenha/Encaminhamento.php
Normal file
46
api/app/Models/PainelSenha/Encaminhamento.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Encaminhamento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_encaminhamento';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id_de',
|
||||
'centro_custo_id_para',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function centroCustoDe()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class, 'centro_custo_id_de');
|
||||
}
|
||||
|
||||
public function centroCustoPara()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class, 'centro_custo_id_para');
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
175
api/app/Models/PainelSenha/Fila.php
Normal file
175
api/app/Models/PainelSenha/Fila.php
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Ambulatorio\Atendimento as AmbulatorioAtendimento;
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Paciente;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Fila extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_fila';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'opcao_entrada_id',
|
||||
'opcao_entrada_destino_id',
|
||||
'prioridade_id',
|
||||
'status_id',
|
||||
'paciente_id',
|
||||
'senha',
|
||||
'evadido',
|
||||
'motivo_evasao',
|
||||
'motivo_cancelamento_evasao',
|
||||
'finalizado',
|
||||
'emitido_em',
|
||||
'atualizado_em',
|
||||
'reaberto_em',
|
||||
'reabertura_lotacao_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'data_emissao',
|
||||
'hora_emissao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'centroCusto',
|
||||
'opcaoEntrada',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::created(function($model) {
|
||||
$model = (object) $model->fresh()->getRawOriginal();
|
||||
|
||||
FilaHistorico::create([
|
||||
'fila_id' => $model->id,
|
||||
'centro_custo_id' => $model->centro_custo_id,
|
||||
'opcao_entrada_id' => $model->opcao_entrada_id,
|
||||
'opcao_entrada_destino_id' => $model->opcao_entrada_destino_id,
|
||||
'prioridade_id' => $model->prioridade_id,
|
||||
'status_id' => $model->status_id,
|
||||
'senha' => $model->senha,
|
||||
'evadido' => $model->evadido,
|
||||
'motivo_evasao' => $model->motivo_evasao,
|
||||
'motivo_cancelamento_evasao' => $model->motivo_cancelamento_evasao,
|
||||
'finalizado' => $model->finalizado,
|
||||
'emitido_em' => $model->emitido_em,
|
||||
'atualizado_em' => $model->atualizado_em,
|
||||
]);
|
||||
});
|
||||
|
||||
self::updated(function($model) {
|
||||
$model = (object) $model->fresh()->getRawOriginal();
|
||||
|
||||
FilaHistorico::create([
|
||||
'fila_id' => $model->id,
|
||||
'centro_custo_id' => $model->centro_custo_id,
|
||||
'opcao_entrada_id' => $model->opcao_entrada_id,
|
||||
'opcao_entrada_destino_id' => $model->opcao_entrada_destino_id,
|
||||
'prioridade_id' => $model->prioridade_id,
|
||||
'status_id' => $model->status_id,
|
||||
'senha' => $model->senha,
|
||||
'evadido' => $model->evadido,
|
||||
'motivo_evasao' => $model->motivo_evasao,
|
||||
'motivo_cancelamento_evasao' => $model->motivo_cancelamento_evasao,
|
||||
'finalizado' => $model->finalizado,
|
||||
'emitido_em' => $model->emitido_em,
|
||||
'atualizado_em' => $model->atualizado_em,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function opcaoEntrada()
|
||||
{
|
||||
return $this->belongsTo(OpcaoEntrada::class)->withTrashed();
|
||||
}
|
||||
|
||||
public function opcaoEntradaDestino()
|
||||
{
|
||||
return $this->belongsTo(OpcaoEntrada::class)->withTrashed();
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(Status::class);
|
||||
}
|
||||
|
||||
public function prioridade()
|
||||
{
|
||||
return $this->belongsTo(Prioridade::class);
|
||||
}
|
||||
|
||||
public function reaberturaLotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function historico()
|
||||
{
|
||||
return $this->hasMany(FilaHistorico::class);
|
||||
}
|
||||
|
||||
public function ambulatorioAtendimento()
|
||||
{
|
||||
return $this->hasOne(AmbulatorioAtendimento::class);
|
||||
}
|
||||
|
||||
public function getSenhaAttribute($value)
|
||||
{
|
||||
return $this->opcaoEntrada->sigla . $value;
|
||||
}
|
||||
|
||||
public function getDataEmissaoAttribute()
|
||||
{
|
||||
return $this->created_at->format('d/m/Y');
|
||||
}
|
||||
|
||||
public function getHoraEmissaoAttribute()
|
||||
{
|
||||
return $this->created_at->format('H:i:s');
|
||||
}
|
||||
|
||||
public function chamadas()
|
||||
{
|
||||
return $this->hasMany(Chamada::class)->where('status_id', $this->status_id);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->centroCusto()
|
||||
->exists();
|
||||
}
|
||||
|
||||
public function getOpcaoEntradaAtualAttribute()
|
||||
{
|
||||
return $this->opcaoEntradaDestino ?? $this->opcaoEntrada;
|
||||
}
|
||||
|
||||
public function paciente()
|
||||
{
|
||||
return $this->belongsTo(Paciente::class)->withTrashed();
|
||||
}
|
||||
}
|
||||
57
api/app/Models/PainelSenha/FilaHistorico.php
Normal file
57
api/app/Models/PainelSenha/FilaHistorico.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class FilaHistorico extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_fila_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'fila_id',
|
||||
'centro_custo_id',
|
||||
'opcao_entrada_id',
|
||||
'opcao_entrada_destino_id',
|
||||
'prioridade_id',
|
||||
'status_id',
|
||||
'senha',
|
||||
'evadido',
|
||||
'motivo_evasao',
|
||||
'motivo_cancelamento_evasao',
|
||||
'finalizado',
|
||||
'emitido_em',
|
||||
'atualizado_em',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(Status::class);
|
||||
}
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
46
api/app/Models/PainelSenha/OpcaoChamada.php
Normal file
46
api/app/Models/PainelSenha/OpcaoChamada.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class OpcaoChamada extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_opcao_chamada';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'tela_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function tela()
|
||||
{
|
||||
return $this->belongsTo(Tela::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
70
api/app/Models/PainelSenha/OpcaoEntrada.php
Normal file
70
api/app/Models/PainelSenha/OpcaoEntrada.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Administracao\Modulo;
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class OpcaoEntrada extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_opcao_entrada';
|
||||
|
||||
protected $casts = [
|
||||
'prioridade_obrigatoria' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'modulo_id',
|
||||
'faixa_etaria_id',
|
||||
'nome',
|
||||
'prioridade_obrigatoria',
|
||||
'sigla',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function modulo()
|
||||
{
|
||||
return $this->belongsTo(Modulo::class);
|
||||
}
|
||||
|
||||
public function filas()
|
||||
{
|
||||
return $this->hasMany(Fila::class);
|
||||
}
|
||||
|
||||
public function centrosCustoCompartilhado()
|
||||
{
|
||||
return $this->hasMany(CentroCustoCompartilhado::class);
|
||||
}
|
||||
|
||||
public function opcoesEntradaDestino()
|
||||
{
|
||||
return $this->hasMany(OpcaoEntrada::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
34
api/app/Models/PainelSenha/OpcaoEntradaDestino.php
Normal file
34
api/app/Models/PainelSenha/OpcaoEntradaDestino.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class OpcaoEntradaDestino extends Model
|
||||
{
|
||||
protected $table = 'painel_senha_opcao_entrada_destino';
|
||||
|
||||
protected $fillable = [
|
||||
'opcao_entrada_origem_id',
|
||||
'opcao_entrada_destino_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function opcaoEntradaOrigem()
|
||||
{
|
||||
return $this->belongsTo(OpcaoEntrada::class);
|
||||
}
|
||||
|
||||
public function opcaoEntradaDestino()
|
||||
{
|
||||
return $this->belongsTo(OpcaoEntrada::class);
|
||||
}
|
||||
}
|
||||
38
api/app/Models/PainelSenha/ParametrizacaoInfraestrutura.php
Normal file
38
api/app/Models/PainelSenha/ParametrizacaoInfraestrutura.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Administracao\Modulo;
|
||||
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoInfraestrutura extends Model
|
||||
{
|
||||
protected $table = 'painel_senha_parametrizacao_infraestrutura';
|
||||
|
||||
protected $fillable = [
|
||||
'infraestrutura_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function infraestrutura()
|
||||
{
|
||||
return $this->belongsTo(Infraestrutura::class);
|
||||
}
|
||||
|
||||
public function modulos()
|
||||
{
|
||||
return $this->belongsToMany(Modulo::class, 'painel_senha_parametrizacao_infraestrutura_modulo')
|
||||
->using(ParametrizacaoInfraestruturaModulo::class)
|
||||
->as('parametrizacaoInfraestruturaModulo')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class ParametrizacaoInfraestruturaModulo extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
31
api/app/Models/PainelSenha/Prioridade.php
Normal file
31
api/app/Models/PainelSenha/Prioridade.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Prioridade extends Model
|
||||
{
|
||||
protected $table = 'painel_senha_prioridade';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'tipo_id',
|
||||
'nome',
|
||||
'grau',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function tipo()
|
||||
{
|
||||
return $this->belongsTo(PrioridadeTipo::class, 'tipo_id');
|
||||
}
|
||||
}
|
||||
20
api/app/Models/PainelSenha/PrioridadeTipo.php
Normal file
20
api/app/Models/PainelSenha/PrioridadeTipo.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class PrioridadeTipo extends Model
|
||||
{
|
||||
protected $table = 'painel_senha_prioridade_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
21
api/app/Models/PainelSenha/PrioridadeTipoCid.php
Normal file
21
api/app/Models/PainelSenha/PrioridadeTipoCid.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class PrioridadeTipoCid extends Model
|
||||
{
|
||||
protected $table = 'painel_senha_prioridade_tipo_cid';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'prioridade_tipo_id',
|
||||
'cid_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
24
api/app/Models/PainelSenha/Status.php
Normal file
24
api/app/Models/PainelSenha/Status.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Status extends Model
|
||||
{
|
||||
protected $table = 'painel_senha_status';
|
||||
|
||||
protected $fillable = [
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function filas()
|
||||
{
|
||||
return $this->hasMany(Fila::class);
|
||||
}
|
||||
}
|
||||
53
api/app/Models/PainelSenha/Tela.php
Normal file
53
api/app/Models/PainelSenha/Tela.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Tela extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_tela';
|
||||
|
||||
protected $fillable = [
|
||||
'infraestrutura_id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function infraestrutura()
|
||||
{
|
||||
return $this->belongsTo(Infraestrutura::class);
|
||||
}
|
||||
|
||||
public function opcoesChamada()
|
||||
{
|
||||
return $this->hasMany(OpcaoChamada::class);
|
||||
}
|
||||
|
||||
public function chamadas()
|
||||
{
|
||||
return $this->hasMany(Chamada::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'chamadas',
|
||||
]);
|
||||
}
|
||||
}
|
||||
52
api/app/Models/PainelSenha/TempoEspera.php
Normal file
52
api/app/Models/PainelSenha/TempoEspera.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\PainelSenha;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class TempoEspera extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'painel_senha_tempo_espera';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'infraestrutura_id',
|
||||
'cor',
|
||||
'tempo',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'minutos',
|
||||
];
|
||||
|
||||
public function infraestrutura()
|
||||
{
|
||||
return $this->belongsTo(Infraestrutura::class);
|
||||
}
|
||||
|
||||
public function getMinutosAttribute()
|
||||
{
|
||||
return $this->tempo . ' MINUTO(S)';
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user