|
|
|
@ -45,8 +45,9 @@ class Atendimento extends Model
|
|
|
|
|
return $this->read($this->query, ['evento' => $evento, 'fila' => $fila])->fetchAll(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function findAtendAgent($matricula) |
|
|
|
|
public function findAtendAgent($matricula, $quantidade = 10) |
|
|
|
|
{ |
|
|
|
|
$data = []; |
|
|
|
|
$this->query = "SELECT ma.*, |
|
|
|
|
ma.nome AS profile_name, |
|
|
|
|
ppr.protocolo as protocolo, |
|
|
|
@ -56,11 +57,17 @@ class Atendimento extends Model
|
|
|
|
|
ELSE 0 |
|
|
|
|
END AS status |
|
|
|
|
FROM {$this->atendimento} ma |
|
|
|
|
INNER JOIN pbx_protocolo_reg ppr ON ma.uniqueid = ppr.uniqueid |
|
|
|
|
WHERE ma.matricula = :matricula |
|
|
|
|
ORDER BY status DESC, data_reg DESC |
|
|
|
|
LIMIT 10"; |
|
|
|
|
return $this->read($this->query, ['matricula' => $matricula])->fetchAll(); |
|
|
|
|
INNER JOIN pbx_protocolo_reg ppr ON ma.uniqueid = ppr.uniqueid "; |
|
|
|
|
if ($matricula) { |
|
|
|
|
$this->query .= " WHERE ma.matricula = :matricula "; |
|
|
|
|
$data['matricula'] = $matricula; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$data['quantidade'] = $quantidade; |
|
|
|
|
$this->query .= " ORDER BY status DESC, data_reg DESC |
|
|
|
|
LIMIT :quantidade "; |
|
|
|
|
|
|
|
|
|
return $this->read($this->query, $data)->fetchAll(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function findAtenEmAberto($cliente_id = null) |
|
|
|
@ -116,7 +123,7 @@ class Atendimento extends Model
|
|
|
|
|
WHERE (SELECT m2.evento FROM md_evento m2 WHERE ma.uniqueid = m2.uniqueid ORDER BY id DESC LIMIT 1) = 'ABANDON' |
|
|
|
|
AND ma.data_reg >= CURRENT_DATE "; |
|
|
|
|
if ($fila) { |
|
|
|
|
$this->query += ' AND me.fila = :fila'; |
|
|
|
|
$this->query .= ' AND me.fila = :fila'; |
|
|
|
|
$data['fila'] = $fila; |
|
|
|
|
} |
|
|
|
|
return $this->read($this->query, $data)->fetchAll(); |
|
|
|
|