Atualização das configuração de mesagens do Zap
This commit is contained in:
@@ -16,8 +16,20 @@ class Admin::ContatosController < ApplicationController
|
||||
@contatos = escopo.ordenados
|
||||
end
|
||||
|
||||
# GET /admin/contatos/grupos_whatsapp (JSON)
|
||||
def grupos_whatsapp
|
||||
authorize Contato, :create?
|
||||
|
||||
resposta = Notificacao::ClienteWhatsapp.padrao.grupos
|
||||
if resposta.ok?
|
||||
render json: { grupos: resposta.dados['grupos'] || [] }
|
||||
else
|
||||
render json: { erro: resposta.erro, grupos: [] }, status: :ok
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@contato = Contato.new(grupo_contato_id: params[:grupo_id])
|
||||
@contato = Contato.new(grupo_contato_id: params[:grupo_id], tipo: params[:tipo].presence || 'pessoa')
|
||||
authorize @contato
|
||||
end
|
||||
|
||||
@@ -67,7 +79,8 @@ class Admin::ContatosController < ApplicationController
|
||||
end
|
||||
|
||||
def contato_params
|
||||
params.require(:contato).permit(:nome, :telefone, :email, :grupo_contato_id, :ativo, :observacao)
|
||||
params.require(:contato).permit(:nome, :telefone, :email, :grupo_contato_id, :ativo,
|
||||
:observacao, :tipo, :whatsapp_grupo_jid, :whatsapp_grupo_nome)
|
||||
end
|
||||
|
||||
def registrar(detalhes)
|
||||
|
||||
Reference in New Issue
Block a user