Ateração na role para que somente o administrador acesse o /connections quando logado
parent
605a33751b
commit
d687d0900a
|
@ -6,6 +6,8 @@ import cors from "cors";
|
||||||
import cookieParser from "cookie-parser";
|
import cookieParser from "cookie-parser";
|
||||||
import * as Sentry from "@sentry/node";
|
import * as Sentry from "@sentry/node";
|
||||||
|
|
||||||
|
console.log('dddddddddddddddddddddddddddd')
|
||||||
|
|
||||||
import "./database";
|
import "./database";
|
||||||
import uploadConfig from "./config/upload";
|
import uploadConfig from "./config/upload";
|
||||||
import AppError from "./errors/AppError";
|
import AppError from "./errors/AppError";
|
||||||
|
|
|
@ -6,9 +6,13 @@ import ListQueuesService from "../services/QueueService/ListQueuesService";
|
||||||
import ShowQueueService from "../services/QueueService/ShowQueueService";
|
import ShowQueueService from "../services/QueueService/ShowQueueService";
|
||||||
import UpdateQueueService from "../services/QueueService/UpdateQueueService";
|
import UpdateQueueService from "../services/QueueService/UpdateQueueService";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const index = async (req: Request, res: Response): Promise<Response> => {
|
export const index = async (req: Request, res: Response): Promise<Response> => {
|
||||||
const queues = await ListQueuesService();
|
const queues = await ListQueuesService();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return res.status(200).json(queues);
|
return res.status(200).json(queues);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import UpdateTicketService from "../services/TicketServices/UpdateTicketService"
|
||||||
import SendWhatsAppMessage from "../services/WbotServices/SendWhatsAppMessage";
|
import SendWhatsAppMessage from "../services/WbotServices/SendWhatsAppMessage";
|
||||||
import ShowWhatsAppService from "../services/WhatsappService/ShowWhatsAppService";
|
import ShowWhatsAppService from "../services/WhatsappService/ShowWhatsAppService";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type IndexQuery = {
|
type IndexQuery = {
|
||||||
searchParam: string;
|
searchParam: string;
|
||||||
pageNumber: string;
|
pageNumber: string;
|
||||||
|
@ -26,6 +28,8 @@ interface TicketData {
|
||||||
userId: number;
|
userId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const index = async (req: Request, res: Response): Promise<Response> => {
|
export const index = async (req: Request, res: Response): Promise<Response> => {
|
||||||
const {
|
const {
|
||||||
pageNumber,
|
pageNumber,
|
||||||
|
|
|
@ -24,6 +24,7 @@ const syncUnreadMessages = async (wbot: Session) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const msg of unreadMessages) {
|
for (const msg of unreadMessages) {
|
||||||
|
console.log('--BACKEND MSG: ', msg)
|
||||||
await handleMessage(msg, wbot);
|
await handleMessage(msg, wbot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ import quickAnswerRoutes from "./quickAnswerRoutes";
|
||||||
|
|
||||||
const routes = Router();
|
const routes = Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
routes.use(userRoutes);
|
routes.use(userRoutes);
|
||||||
routes.use("/auth", authRoutes);
|
routes.use("/auth", authRoutes);
|
||||||
routes.use(settingRoutes);
|
routes.use(settingRoutes);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import * as SettingController from "../controllers/SettingController";
|
||||||
|
|
||||||
const settingRoutes = Router();
|
const settingRoutes = Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
settingRoutes.get("/settings", isAuth, SettingController.index);
|
settingRoutes.get("/settings", isAuth, SettingController.index);
|
||||||
|
|
||||||
// routes.get("/settings/:settingKey", isAuth, SettingsController.show);
|
// routes.get("/settings/:settingKey", isAuth, SettingsController.show);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import * as TicketController from "../controllers/TicketController";
|
||||||
|
|
||||||
const ticketRoutes = express.Router();
|
const ticketRoutes = express.Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ticketRoutes.get("/tickets", isAuth, TicketController.index);
|
ticketRoutes.get("/tickets", isAuth, TicketController.index);
|
||||||
|
|
||||||
ticketRoutes.get("/tickets/:ticketId", isAuth, TicketController.show);
|
ticketRoutes.get("/tickets/:ticketId", isAuth, TicketController.show);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import * as UserController from "../controllers/UserController";
|
||||||
|
|
||||||
const userRoutes = Router();
|
const userRoutes = Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
userRoutes.get("/users", isAuth, UserController.index);
|
userRoutes.get("/users", isAuth, UserController.index);
|
||||||
|
|
||||||
userRoutes.post("/users", isAuth, UserController.store);
|
userRoutes.post("/users", isAuth, UserController.store);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import * as WhatsAppController from "../controllers/WhatsAppController";
|
||||||
|
|
||||||
const whatsappRoutes = express.Router();
|
const whatsappRoutes = express.Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
whatsappRoutes.get("/whatsapp/", isAuth, WhatsAppController.index);
|
whatsappRoutes.get("/whatsapp/", isAuth, WhatsAppController.index);
|
||||||
|
|
||||||
whatsappRoutes.post("/whatsapp/", isAuth, WhatsAppController.store);
|
whatsappRoutes.post("/whatsapp/", isAuth, WhatsAppController.store);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import WhatsAppSessionController from "../controllers/WhatsAppSessionController"
|
||||||
|
|
||||||
const whatsappSessionRoutes = Router();
|
const whatsappSessionRoutes = Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
whatsappSessionRoutes.post(
|
whatsappSessionRoutes.post(
|
||||||
"/whatsappsession/:whatsappId",
|
"/whatsappsession/:whatsappId",
|
||||||
isAuth,
|
isAuth,
|
||||||
|
|
|
@ -16,9 +16,7 @@ interface Request {
|
||||||
messageData: MessageData;
|
messageData: MessageData;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CreateMessageService = async ({
|
const CreateMessageService = async ({messageData}: Request): Promise<Message> => {
|
||||||
messageData
|
|
||||||
}: Request): Promise<Message> => {
|
|
||||||
await Message.upsert(messageData);
|
await Message.upsert(messageData);
|
||||||
|
|
||||||
const message = await Message.findByPk(messageData.id, {
|
const message = await Message.findByPk(messageData.id, {
|
||||||
|
@ -41,6 +39,8 @@ const CreateMessageService = async ({
|
||||||
throw new Error("ERR_CREATING_MESSAGE");
|
throw new Error("ERR_CREATING_MESSAGE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//console.log('SERVER SIDE MESSAGE: ', message)
|
||||||
|
|
||||||
const io = getIO();
|
const io = getIO();
|
||||||
io.to(message.ticketId.toString())
|
io.to(message.ticketId.toString())
|
||||||
.to(message.ticket.status)
|
.to(message.ticket.status)
|
||||||
|
|
|
@ -86,7 +86,7 @@ const verifyMediaMessage = async (
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Sentry.captureException(err);
|
Sentry.captureException(err);
|
||||||
logger.error(err);
|
logger.error(`There was an error: wbotMessageLitener.ts: ${err}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const messageData = {
|
const messageData = {
|
||||||
|
@ -135,8 +135,11 @@ const verifyQueue = async (
|
||||||
ticket: Ticket,
|
ticket: Ticket,
|
||||||
contact: Contact
|
contact: Contact
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!);
|
const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!);
|
||||||
|
|
||||||
|
console.log('---greetingMessage: ',greetingMessage)
|
||||||
|
|
||||||
if (queues.length === 1) {
|
if (queues.length === 1) {
|
||||||
await UpdateTicketService({
|
await UpdateTicketService({
|
||||||
ticketData: { queueId: queues[0].id },
|
ticketData: { queueId: queues[0].id },
|
||||||
|
@ -170,6 +173,8 @@ const verifyQueue = async (
|
||||||
|
|
||||||
const body = `\u200e${greetingMessage}\n${options}`;
|
const body = `\u200e${greetingMessage}\n${options}`;
|
||||||
|
|
||||||
|
console.log('BACKEND BODY TEST: ', body)
|
||||||
|
|
||||||
const debouncedSentMessage = debounce(
|
const debouncedSentMessage = debounce(
|
||||||
async () => {
|
async () => {
|
||||||
const sentMessage = await wbot.sendMessage(
|
const sentMessage = await wbot.sendMessage(
|
||||||
|
@ -226,7 +231,11 @@ const handleMessage = async (
|
||||||
|
|
||||||
msgContact = await wbot.getContactById(msg.to);
|
msgContact = await wbot.getContactById(msg.to);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
msgContact = await msg.getContact();
|
msgContact = await msg.getContact();
|
||||||
|
|
||||||
|
console.log('---msgContact: ', msgContact, ' | msg.body: ', msg.body)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const chat = await msg.getChat();
|
const chat = await msg.getChat();
|
||||||
|
@ -249,6 +258,7 @@ const handleMessage = async (
|
||||||
|
|
||||||
const contact = await verifyContact(msgContact);
|
const contact = await verifyContact(msgContact);
|
||||||
|
|
||||||
|
|
||||||
if ( unreadMessages === 0 && whatsapp.farewellMessage && whatsapp.farewellMessage === msg.body) return;
|
if ( unreadMessages === 0 && whatsapp.farewellMessage && whatsapp.farewellMessage === msg.body) return;
|
||||||
|
|
||||||
const ticket = await FindOrCreateTicketService(
|
const ticket = await FindOrCreateTicketService(
|
||||||
|
@ -258,12 +268,19 @@ const handleMessage = async (
|
||||||
groupContact
|
groupContact
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log('---passou 1')
|
||||||
|
|
||||||
|
|
||||||
if (msg.hasMedia) {
|
if (msg.hasMedia) {
|
||||||
await verifyMediaMessage(msg, ticket, contact);
|
await verifyMediaMessage(msg, ticket, contact);
|
||||||
} else {
|
} else {
|
||||||
await verifyMessage(msg, ticket, contact);
|
await verifyMessage(msg, ticket, contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('---passou 2 ')
|
||||||
|
//await verifyQueue(wbot, msg, ticket, contact);
|
||||||
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!ticket.queue &&
|
!ticket.queue &&
|
||||||
!chat.isGroup &&
|
!chat.isGroup &&
|
||||||
|
@ -276,6 +293,8 @@ const handleMessage = async (
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Sentry.captureException(err);
|
Sentry.captureException(err);
|
||||||
logger.error(`Error handling whatsapp message: Err: ${err}`);
|
logger.error(`Error handling whatsapp message: Err: ${err}`);
|
||||||
|
|
|
@ -283,6 +283,7 @@ const reducer = (state, action) => {
|
||||||
state[messageIndex] = newMessage;
|
state[messageIndex] = newMessage;
|
||||||
} else {
|
} else {
|
||||||
state.push(newMessage);
|
state.push(newMessage);
|
||||||
|
console.log(' TESTANDO NOVA MENSAGEM: ', newMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return [...state];
|
return [...state];
|
||||||
|
@ -363,6 +364,9 @@ const MessagesList = ({ ticketId, isGroup }) => {
|
||||||
socket.on("appMessage", (data) => {
|
socket.on("appMessage", (data) => {
|
||||||
if (data.action === "create") {
|
if (data.action === "create") {
|
||||||
dispatch({ type: "ADD_MESSAGE", payload: data.message });
|
dispatch({ type: "ADD_MESSAGE", payload: data.message });
|
||||||
|
|
||||||
|
console.log('* NOVA MENSAGEM CAP: ', data.message)
|
||||||
|
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,6 +517,8 @@ const MessagesList = ({ ticketId, isGroup }) => {
|
||||||
let messageUser = messagesList[index].fromMe;
|
let messageUser = messagesList[index].fromMe;
|
||||||
let previousMessageUser = messagesList[index - 1].fromMe;
|
let previousMessageUser = messagesList[index - 1].fromMe;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (messageUser !== previousMessageUser) {
|
if (messageUser !== previousMessageUser) {
|
||||||
return (
|
return (
|
||||||
<span style={{ marginTop: 16 }} key={`divider-${message.id}`}></span>
|
<span style={{ marginTop: 16 }} key={`divider-${message.id}`}></span>
|
||||||
|
|
|
@ -7,6 +7,8 @@ const AuthContext = createContext();
|
||||||
const AuthProvider = ({ children }) => {
|
const AuthProvider = ({ children }) => {
|
||||||
const { loading, user, isAuth, handleLogin, handleLogout } = useAuth();
|
const { loading, user, isAuth, handleLogin, handleLogout } = useAuth();
|
||||||
|
|
||||||
|
//{console.log('authContext teste: ', user)}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthContext.Provider
|
<AuthContext.Provider
|
||||||
value={{ loading, user, isAuth, handleLogin, handleLogout }}
|
value={{ loading, user, isAuth, handleLogin, handleLogout }}
|
||||||
|
|
|
@ -41,6 +41,11 @@ import { i18n } from "../../translate/i18n";
|
||||||
import { WhatsAppsContext } from "../../context/WhatsApp/WhatsAppsContext";
|
import { WhatsAppsContext } from "../../context/WhatsApp/WhatsAppsContext";
|
||||||
import toastError from "../../errors/toastError";
|
import toastError from "../../errors/toastError";
|
||||||
|
|
||||||
|
//--------
|
||||||
|
import { AuthContext } from "../../context/Auth/AuthContext";
|
||||||
|
import { Can } from "../../components/Can";
|
||||||
|
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
const useStyles = makeStyles(theme => ({
|
||||||
mainPaper: {
|
mainPaper: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
@ -93,6 +98,11 @@ const CustomToolTip = ({ title, content, children }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const Connections = () => {
|
const Connections = () => {
|
||||||
|
|
||||||
|
//--------
|
||||||
|
const { user } = useContext(AuthContext);
|
||||||
|
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
const { whatsApps, loading } = useContext(WhatsAppsContext);
|
const { whatsApps, loading } = useContext(WhatsAppsContext);
|
||||||
|
@ -100,6 +110,8 @@ const Connections = () => {
|
||||||
const [qrModalOpen, setQrModalOpen] = useState(false);
|
const [qrModalOpen, setQrModalOpen] = useState(false);
|
||||||
const [selectedWhatsApp, setSelectedWhatsApp] = useState(null);
|
const [selectedWhatsApp, setSelectedWhatsApp] = useState(null);
|
||||||
const [confirmModalOpen, setConfirmModalOpen] = useState(false);
|
const [confirmModalOpen, setConfirmModalOpen] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
const confirmationModalInitialState = {
|
const confirmationModalInitialState = {
|
||||||
action: "",
|
action: "",
|
||||||
title: "",
|
title: "",
|
||||||
|
@ -290,6 +302,11 @@ const Connections = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
|
<Can
|
||||||
|
role={user.profile}
|
||||||
|
perform="connections-view:show"
|
||||||
|
yes={() => (
|
||||||
<MainContainer>
|
<MainContainer>
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
title={confirmModalInfo.title}
|
title={confirmModalInfo.title}
|
||||||
|
@ -395,6 +412,114 @@ const Connections = () => {
|
||||||
</Table>
|
</Table>
|
||||||
</Paper>
|
</Paper>
|
||||||
</MainContainer>
|
</MainContainer>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
/*<MainContainer>
|
||||||
|
<ConfirmationModal
|
||||||
|
title={confirmModalInfo.title}
|
||||||
|
open={confirmModalOpen}
|
||||||
|
onClose={setConfirmModalOpen}
|
||||||
|
onConfirm={handleSubmitConfirmationModal}
|
||||||
|
>
|
||||||
|
{confirmModalInfo.message}
|
||||||
|
</ConfirmationModal>
|
||||||
|
<QrcodeModal
|
||||||
|
open={qrModalOpen}
|
||||||
|
onClose={handleCloseQrModal}
|
||||||
|
whatsAppId={!whatsAppModalOpen && selectedWhatsApp?.id}
|
||||||
|
/>
|
||||||
|
<WhatsAppModal
|
||||||
|
open={whatsAppModalOpen}
|
||||||
|
onClose={handleCloseWhatsAppModal}
|
||||||
|
whatsAppId={!qrModalOpen && selectedWhatsApp?.id}
|
||||||
|
/>
|
||||||
|
<MainHeader>
|
||||||
|
<Title>{i18n.t("connections.title")}</Title>
|
||||||
|
<MainHeaderButtonsWrapper>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
onClick={handleOpenWhatsAppModal}
|
||||||
|
>
|
||||||
|
{i18n.t("connections.buttons.add")}
|
||||||
|
</Button>
|
||||||
|
</MainHeaderButtonsWrapper>
|
||||||
|
</MainHeader>
|
||||||
|
<Paper className={classes.mainPaper} variant="outlined">
|
||||||
|
<Table size="small">
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell align="center">
|
||||||
|
{i18n.t("connections.table.name")}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{i18n.t("connections.table.status")}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{i18n.t("connections.table.session")}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{i18n.t("connections.table.lastUpdate")}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{i18n.t("connections.table.default")}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{i18n.t("connections.table.actions")}
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{loading ? (
|
||||||
|
<TableRowSkeleton />
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{whatsApps?.length > 0 &&
|
||||||
|
whatsApps.map(whatsApp => (
|
||||||
|
<TableRow key={whatsApp.id}>
|
||||||
|
<TableCell align="center">{whatsApp.name}</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{renderStatusToolTips(whatsApp)}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{renderActionButtons(whatsApp)}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{format(parseISO(whatsApp.updatedAt), "dd/MM/yy HH:mm")}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{whatsApp.isDefault && (
|
||||||
|
<div className={classes.customTableCell}>
|
||||||
|
<CheckCircle style={{ color: green[500] }} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<IconButton
|
||||||
|
size="small"
|
||||||
|
onClick={() => handleEditWhatsApp(whatsApp)}
|
||||||
|
>
|
||||||
|
<Edit />
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
size="small"
|
||||||
|
onClick={e => {
|
||||||
|
handleOpenConfirmationModal("delete", whatsApp.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DeleteOutline />
|
||||||
|
</IconButton>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</Paper>
|
||||||
|
</MainContainer>*/
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,7 @@ const Login = () => {
|
||||||
</Button>
|
</Button>
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
href="#"
|
href="#"
|
||||||
variant="body2"
|
variant="body2"
|
||||||
|
@ -141,6 +142,7 @@ const Login = () => {
|
||||||
>
|
>
|
||||||
{i18n.t("login.buttons.register")}
|
{i18n.t("login.buttons.register")}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -219,6 +219,7 @@ const Users = () => {
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -226,6 +227,7 @@ const Users = () => {
|
||||||
>
|
>
|
||||||
{i18n.t("users.buttons.add")}
|
{i18n.t("users.buttons.add")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</MainHeaderButtonsWrapper>
|
</MainHeaderButtonsWrapper>
|
||||||
</MainHeader>
|
</MainHeader>
|
||||||
<Paper
|
<Paper
|
||||||
|
@ -243,9 +245,11 @@ const Users = () => {
|
||||||
<TableCell align="center">
|
<TableCell align="center">
|
||||||
{i18n.t("users.table.profile")}
|
{i18n.t("users.table.profile")}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
||||||
<TableCell align="center">
|
<TableCell align="center">
|
||||||
{i18n.t("users.table.actions")}
|
{i18n.t("users.table.actions")}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
|
@ -255,7 +259,9 @@ const Users = () => {
|
||||||
<TableCell align="center">{user.name}</TableCell>
|
<TableCell align="center">{user.name}</TableCell>
|
||||||
<TableCell align="center">{user.email}</TableCell>
|
<TableCell align="center">{user.email}</TableCell>
|
||||||
<TableCell align="center">{user.profile}</TableCell>
|
<TableCell align="center">{user.profile}</TableCell>
|
||||||
|
|
||||||
<TableCell align="center">
|
<TableCell align="center">
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => handleEditUser(user)}
|
onClick={() => handleEditUser(user)}
|
||||||
|
@ -272,7 +278,9 @@ const Users = () => {
|
||||||
>
|
>
|
||||||
<DeleteOutlineIcon />
|
<DeleteOutlineIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
{loading && <TableRowSkeleton columns={4} />}
|
{loading && <TableRowSkeleton columns={4} />}
|
||||||
|
|
|
@ -17,6 +17,11 @@ import { AuthProvider } from "../context/Auth/AuthContext";
|
||||||
import { WhatsAppsProvider } from "../context/WhatsApp/WhatsAppsContext";
|
import { WhatsAppsProvider } from "../context/WhatsApp/WhatsAppsContext";
|
||||||
import Route from "./Route";
|
import Route from "./Route";
|
||||||
|
|
||||||
|
//console.log('---AuthProvider: ',AuthProvider)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Routes = () => {
|
const Routes = () => {
|
||||||
return (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
|
@ -33,12 +38,14 @@ const Routes = () => {
|
||||||
component={Tickets}
|
component={Tickets}
|
||||||
isPrivate
|
isPrivate
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
exact
|
exact
|
||||||
path="/connections"
|
path="/connections"
|
||||||
component={Connections}
|
component={Connections}
|
||||||
isPrivate
|
isPrivate
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route exact path="/contacts" component={Contacts} isPrivate />
|
<Route exact path="/contacts" component={Contacts} isPrivate />
|
||||||
<Route exact path="/users" component={Users} isPrivate />
|
<Route exact path="/users" component={Users} isPrivate />
|
||||||
<Route
|
<Route
|
||||||
|
|
|
@ -11,6 +11,8 @@ const rules = {
|
||||||
"user-modal:editQueues",
|
"user-modal:editQueues",
|
||||||
"ticket-options:deleteTicket",
|
"ticket-options:deleteTicket",
|
||||||
"contacts-page:deleteContact",
|
"contacts-page:deleteContact",
|
||||||
|
|
||||||
|
"connections-view:show",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue