Adição da rule para que apenas o usuário master conecte ou desconecte a sessão do whatsapp

pull/1/head
adriano 2022-02-22 21:53:10 -03:00
parent 0db6e88477
commit eff9c9bb7e
3 changed files with 42 additions and 8 deletions

View File

@ -208,7 +208,13 @@ const Connections = () => {
const renderActionButtons = whatsApp => {
return (
<>
<Can
role={user.profile}
perform="connection-button:show"
yes={() => (
<>
{whatsApp.status === "qrcode" && (
<Button
size="small"
@ -220,6 +226,7 @@ const Connections = () => {
</Button>
)}
{whatsApp.status === "DISCONNECTED" && (
<>
<Button
size="small"
@ -259,6 +266,10 @@ const Connections = () => {
</Button>
)}
</>
)}
/>
);
};
@ -358,9 +369,20 @@ const Connections = () => {
<TableCell align="center">
{i18n.t("connections.table.status")}
</TableCell>
<TableCell align="center">
<Can
role={user.profile}
perform="connection-button:show"
yes={() => (
<TableCell align="center">
{i18n.t("connections.table.session")}
</TableCell>
</TableCell>
)}
/>
<TableCell align="center">
{i18n.t("connections.table.lastUpdate")}
</TableCell>
@ -384,9 +406,19 @@ const Connections = () => {
<TableCell align="center">
{renderStatusToolTips(whatsApp)}
</TableCell>
<TableCell align="center">
<Can
role={user.profile}
perform="connection-button:show"
yes={() => (
<TableCell align="center">
{renderActionButtons(whatsApp)}
</TableCell>
)}
/>
<TableCell align="center">
{format(parseISO(whatsApp.updatedAt), "dd/MM/yy HH:mm")}
</TableCell>

View File

@ -38,6 +38,7 @@ const rules = {
"btn-add-whatsapp",
"btn-remove-whatsapp",
"ticket-report:show",
"connection-button:show"
],
},
};

View File

@ -80,7 +80,8 @@ const messages = {
qrcode: {
title: "Esperando leitura do QR Code",
content:
"Clique no botão 'QR CODE' e leia o QR Code com o seu celular para iniciar a sessão",
// "Clique no botão 'QR CODE' e leia o QR Code com o seu celular para iniciar a sessão",
"Entre em contato com o suporte para realizar a leitura do QR code",
},
connected: {
title: "Conexão estabelecida!",