mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 12:49:32 +00:00
improvement: updated translations en/pt
This commit is contained in:
@@ -103,7 +103,7 @@ const ContactModal = ({ open, onClose, contactId }) => {
|
|||||||
} else {
|
} else {
|
||||||
await api.post("/contacts", values);
|
await api.post("/contacts", values);
|
||||||
}
|
}
|
||||||
toast.success("Contact saved sucessfully!");
|
toast.success(i18n.t("contactModal.success"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if (err.response && err.response.data && err.response.data.error) {
|
if (err.response && err.response.data && err.response.data.error) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { toast } from "react-toastify";
|
|||||||
import MenuItem from "@material-ui/core/MenuItem";
|
import MenuItem from "@material-ui/core/MenuItem";
|
||||||
import Menu from "@material-ui/core/Menu";
|
import Menu from "@material-ui/core/Menu";
|
||||||
|
|
||||||
// import { i18n } from "../../translate/i18n";
|
import { i18n } from "../../translate/i18n";
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
import ConfirmationModal from "../ConfirmationModal";
|
import ConfirmationModal from "../ConfirmationModal";
|
||||||
|
|
||||||
@@ -31,12 +31,12 @@ const MessageOptionsMenu = ({ messageId, menuOpen, handleClose, anchorEl }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
title={`Delete message?`}
|
title={i18n.t("messageOptionsMenu.confirmationModal.title")}
|
||||||
open={confirmationOpen}
|
open={confirmationOpen}
|
||||||
setOpen={setConfirmationOpen}
|
setOpen={setConfirmationOpen}
|
||||||
onConfirm={handleDeleteMessage}
|
onConfirm={handleDeleteMessage}
|
||||||
>
|
>
|
||||||
This action cannot be reverted.
|
{i18n.t("messageOptionsMenu.confirmationModal.message")}
|
||||||
</ConfirmationModal>
|
</ConfirmationModal>
|
||||||
<Menu
|
<Menu
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
@@ -53,9 +53,9 @@ const MessageOptionsMenu = ({ messageId, menuOpen, handleClose, anchorEl }) => {
|
|||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
>
|
>
|
||||||
<MenuItem onClick={handleOpenConfirmationModal}>
|
<MenuItem onClick={handleOpenConfirmationModal}>
|
||||||
Delete Message
|
{i18n.t("messageOptionsMenu.delete")}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem disabled>Reply Message</MenuItem>
|
<MenuItem disabled> {i18n.t("messageOptionsMenu.reply")}</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ const NotificationsPopOver = () => {
|
|||||||
<List dense className={classes.tabContainer}>
|
<List dense className={classes.tabContainer}>
|
||||||
{notifications.length === 0 ? (
|
{notifications.length === 0 ? (
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemText>No tickets with unread messages.</ListItemText>
|
<ListItemText>{i18n.t("notifications.noTickets")}</ListItemText>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
) : (
|
) : (
|
||||||
notifications.map(ticket => (
|
notifications.map(ticket => (
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import InputLabel from "@material-ui/core/InputLabel";
|
|||||||
import MenuItem from "@material-ui/core/MenuItem";
|
import MenuItem from "@material-ui/core/MenuItem";
|
||||||
import FormControl from "@material-ui/core/FormControl";
|
import FormControl from "@material-ui/core/FormControl";
|
||||||
|
|
||||||
// import { i18n } from "../../translate/i18n";
|
import { i18n } from "../../translate/i18n";
|
||||||
|
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ const UserModal = ({ open, onClose, userId }) => {
|
|||||||
} else {
|
} else {
|
||||||
await api.post("/users", values);
|
await api.post("/users", values);
|
||||||
}
|
}
|
||||||
toast.success("Success!");
|
toast.success(i18n.t("userModal.success"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if (err.response && err.response.data && err.response.data.error) {
|
if (err.response && err.response.data && err.response.data.error) {
|
||||||
@@ -119,7 +119,9 @@ const UserModal = ({ open, onClose, userId }) => {
|
|||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<Dialog open={open} onClose={handleClose} maxWidth="lg" scroll="paper">
|
<Dialog open={open} onClose={handleClose} maxWidth="lg" scroll="paper">
|
||||||
<DialogTitle id="form-dialog-title">
|
<DialogTitle id="form-dialog-title">
|
||||||
{userId ? `Edit User` : `New User`}
|
{userId
|
||||||
|
? `${i18n.t("userModal.title.edit")}`
|
||||||
|
: `${i18n.t("userModal.title.add")}`}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<Formik
|
<Formik
|
||||||
initialValues={user}
|
initialValues={user}
|
||||||
@@ -137,7 +139,7 @@ const UserModal = ({ open, onClose, userId }) => {
|
|||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
label="Name"
|
label={i18n.t("userModal.form.name")}
|
||||||
autoFocus
|
autoFocus
|
||||||
name="name"
|
name="name"
|
||||||
error={touched.name && Boolean(errors.name)}
|
error={touched.name && Boolean(errors.name)}
|
||||||
@@ -148,7 +150,7 @@ const UserModal = ({ open, onClose, userId }) => {
|
|||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
label="Email"
|
label={i18n.t("userModal.form.email")}
|
||||||
name="email"
|
name="email"
|
||||||
error={touched.email && Boolean(errors.email)}
|
error={touched.email && Boolean(errors.email)}
|
||||||
helperText={touched.email && errors.email}
|
helperText={touched.email && errors.email}
|
||||||
@@ -158,7 +160,7 @@ const UserModal = ({ open, onClose, userId }) => {
|
|||||||
<div>
|
<div>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
label="New Password"
|
label={i18n.t("userModal.form.password")}
|
||||||
type="password"
|
type="password"
|
||||||
name="password"
|
name="password"
|
||||||
error={touched.password && Boolean(errors.password)}
|
error={touched.password && Boolean(errors.password)}
|
||||||
@@ -176,7 +178,7 @@ const UserModal = ({ open, onClose, userId }) => {
|
|||||||
</InputLabel>
|
</InputLabel>
|
||||||
<Field
|
<Field
|
||||||
as={Select}
|
as={Select}
|
||||||
label="Profile"
|
label={i18n.t("userModal.form.profile")}
|
||||||
name="profile"
|
name="profile"
|
||||||
labelId="profile-selection-label"
|
labelId="profile-selection-label"
|
||||||
id="profile-selection"
|
id="profile-selection"
|
||||||
@@ -195,7 +197,7 @@ const UserModal = ({ open, onClose, userId }) => {
|
|||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
Cancel
|
{i18n.t("userModal.buttons.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -204,7 +206,9 @@ const UserModal = ({ open, onClose, userId }) => {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
className={classes.btnWrapper}
|
className={classes.btnWrapper}
|
||||||
>
|
>
|
||||||
{"Ok"}
|
{userId
|
||||||
|
? `${i18n.t("userModal.buttons.okEdit")}`
|
||||||
|
: `${i18n.t("userModal.buttons.okAdd")}`}
|
||||||
{isSubmitting && (
|
{isSubmitting && (
|
||||||
<CircularProgress
|
<CircularProgress
|
||||||
size={24}
|
size={24}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
|
|
||||||
// import { i18n } from "../../translate/i18n";
|
// import { i18n } from "../../translate/i18n";
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
|
import { i18n } from "../../translate/i18n";
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
const useStyles = makeStyles(theme => ({
|
||||||
form: {
|
form: {
|
||||||
@@ -91,7 +92,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
|
|||||||
} else {
|
} else {
|
||||||
await api.post("/whatsapp", values);
|
await api.post("/whatsapp", values);
|
||||||
}
|
}
|
||||||
toast.success("Success!");
|
toast.success(i18n.t("whatsappModal.success"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if (err.response && err.response.data && err.response.data.error) {
|
if (err.response && err.response.data && err.response.data.error) {
|
||||||
@@ -108,7 +109,11 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onClose={handleClose} maxWidth="lg" scroll="paper">
|
<Dialog open={open} onClose={handleClose} maxWidth="lg" scroll="paper">
|
||||||
<DialogTitle>WhatsApp</DialogTitle>
|
<DialogTitle>
|
||||||
|
{whatsAppId
|
||||||
|
? i18n.t("whatsappModal.title.edit")
|
||||||
|
: i18n.t("whatsappModal.title.add")}
|
||||||
|
</DialogTitle>
|
||||||
<Formik
|
<Formik
|
||||||
initialValues={whatsApp}
|
initialValues={whatsApp}
|
||||||
enableReinitialize={true}
|
enableReinitialize={true}
|
||||||
@@ -116,7 +121,6 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
|
|||||||
onSubmit={(values, actions) => {
|
onSubmit={(values, actions) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
handleSaveWhatsApp(values);
|
handleSaveWhatsApp(values);
|
||||||
// alert(JSON.stringify(values, null, 2));
|
|
||||||
actions.setSubmitting(false);
|
actions.setSubmitting(false);
|
||||||
}, 400);
|
}, 400);
|
||||||
}}
|
}}
|
||||||
@@ -126,7 +130,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
|
|||||||
<DialogContent dividers className={classes.form}>
|
<DialogContent dividers className={classes.form}>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
label="Name"
|
label={i18n.t("whatsappModal.form.name")}
|
||||||
autoFocus
|
autoFocus
|
||||||
name="name"
|
name="name"
|
||||||
error={touched.name && Boolean(errors.name)}
|
error={touched.name && Boolean(errors.name)}
|
||||||
@@ -144,7 +148,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
|
|||||||
checked={values.isDefault}
|
checked={values.isDefault}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
label="Default"
|
label={i18n.t("whatsappModal.form.default")}
|
||||||
/>
|
/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
@@ -154,7 +158,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
|
|||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
Cancel
|
{i18n.t("whatsappModal.buttons.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -163,7 +167,9 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
className={classes.btnWrapper}
|
className={classes.btnWrapper}
|
||||||
>
|
>
|
||||||
Save
|
{whatsAppId
|
||||||
|
? i18n.t("whatsappModal.buttons.okEdit")
|
||||||
|
: i18n.t("whatsappModal.buttons.okAdd")}
|
||||||
{isSubmitting && (
|
{isSubmitting && (
|
||||||
<CircularProgress
|
<CircularProgress
|
||||||
size={24}
|
size={24}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const MainListItems = () => {
|
|||||||
<ListItemLink to="/" primary="Dashboard" icon={<DashboardIcon />} />
|
<ListItemLink to="/" primary="Dashboard" icon={<DashboardIcon />} />
|
||||||
<ListItemLink
|
<ListItemLink
|
||||||
to="/connections"
|
to="/connections"
|
||||||
primary="Connections"
|
primary={i18n.t("mainDrawer.listItems.connections")}
|
||||||
icon={<SyncAltIcon />}
|
icon={<SyncAltIcon />}
|
||||||
/>
|
/>
|
||||||
<ListItemLink
|
<ListItemLink
|
||||||
@@ -61,7 +61,9 @@ const MainListItems = () => {
|
|||||||
{userProfile === "admin" && (
|
{userProfile === "admin" && (
|
||||||
<>
|
<>
|
||||||
<Divider />
|
<Divider />
|
||||||
<ListSubheader inset>Administration</ListSubheader>
|
<ListSubheader inset>
|
||||||
|
{i18n.t("mainDrawer.listItems.administration")}
|
||||||
|
</ListSubheader>
|
||||||
<ListItemLink
|
<ListItemLink
|
||||||
to="/users"
|
to="/users"
|
||||||
primary={i18n.t("mainDrawer.listItems.users")}
|
primary={i18n.t("mainDrawer.listItems.users")}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import NotificationsPopOver from "../NotificationsPopOver";
|
|||||||
import UserModal from "../UserModal";
|
import UserModal from "../UserModal";
|
||||||
import { AuthContext } from "../../context/Auth/AuthContext";
|
import { AuthContext } from "../../context/Auth/AuthContext";
|
||||||
import BackdropLoading from "../BackdropLoading";
|
import BackdropLoading from "../BackdropLoading";
|
||||||
|
import { i18n } from "../../translate/i18n";
|
||||||
|
|
||||||
const drawerWidth = 240;
|
const drawerWidth = 240;
|
||||||
|
|
||||||
@@ -197,7 +198,7 @@ const LoggedInLayout = ({ appTitle, children }) => {
|
|||||||
noWrap
|
noWrap
|
||||||
className={classes.title}
|
className={classes.title}
|
||||||
>
|
>
|
||||||
WHATICKET
|
WhaTicket
|
||||||
</Typography>
|
</Typography>
|
||||||
<NotificationsPopOver />
|
<NotificationsPopOver />
|
||||||
|
|
||||||
@@ -226,8 +227,12 @@ const LoggedInLayout = ({ appTitle, children }) => {
|
|||||||
open={menuOpen}
|
open={menuOpen}
|
||||||
onClose={handleCloseMenu}
|
onClose={handleCloseMenu}
|
||||||
>
|
>
|
||||||
<MenuItem onClick={handleOpenUserModal}>Profile</MenuItem>
|
<MenuItem onClick={handleOpenUserModal}>
|
||||||
<MenuItem onClick={handleLogout}>Logout</MenuItem>
|
{i18n.t("mainDrawer.appBar.user.profile")}
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={handleLogout}>
|
||||||
|
{i18n.t("mainDrawer.appBar.user.logout")}
|
||||||
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import api from "../../services/api";
|
|||||||
import WhatsAppModal from "../../components/WhatsAppModal";
|
import WhatsAppModal from "../../components/WhatsAppModal";
|
||||||
import ConfirmationModal from "../../components/ConfirmationModal";
|
import ConfirmationModal from "../../components/ConfirmationModal";
|
||||||
import QrcodeModal from "../../components/QrcodeModal";
|
import QrcodeModal from "../../components/QrcodeModal";
|
||||||
|
import { i18n } from "../../translate/i18n";
|
||||||
|
|
||||||
const reducer = (state, action) => {
|
const reducer = (state, action) => {
|
||||||
if (action.type === "LOAD_WHATSAPPS") {
|
if (action.type === "LOAD_WHATSAPPS") {
|
||||||
@@ -179,7 +180,7 @@ const Connections = () => {
|
|||||||
const handleDeleteWhatsApp = async whatsAppId => {
|
const handleDeleteWhatsApp = async whatsAppId => {
|
||||||
try {
|
try {
|
||||||
await api.delete(`/whatsapp/${whatsAppId}`);
|
await api.delete(`/whatsapp/${whatsAppId}`);
|
||||||
toast.success("Deleted!");
|
toast.success(i18n.t("connections.toasts.deleted"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if (err.response && err.response.data && err.response.data.error) {
|
if (err.response && err.response.data && err.response.data.error) {
|
||||||
@@ -192,12 +193,17 @@ const Connections = () => {
|
|||||||
return (
|
return (
|
||||||
<MainContainer>
|
<MainContainer>
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
title={deletingWhatsApp && `Delete ${deletingWhatsApp.name}?`}
|
title={
|
||||||
|
deletingWhatsApp &&
|
||||||
|
`${i18n.t("connections.confirmationModal.deleteTitle")} ${
|
||||||
|
deletingWhatsApp.name
|
||||||
|
}?`
|
||||||
|
}
|
||||||
open={confirmModalOpen}
|
open={confirmModalOpen}
|
||||||
setOpen={setConfirmModalOpen}
|
setOpen={setConfirmModalOpen}
|
||||||
onConfirm={() => handleDeleteWhatsApp(deletingWhatsApp.id)}
|
onConfirm={() => handleDeleteWhatsApp(deletingWhatsApp.id)}
|
||||||
>
|
>
|
||||||
Are you sure? It cannot be reverted.
|
{i18n.t("connections.confirmationModal.deleteMessage")}
|
||||||
</ConfirmationModal>
|
</ConfirmationModal>
|
||||||
<QrcodeModal
|
<QrcodeModal
|
||||||
open={qrModalOpen}
|
open={qrModalOpen}
|
||||||
@@ -212,14 +218,14 @@ const Connections = () => {
|
|||||||
whatsAppId={selectedWhatsApp && !qrModalOpen && selectedWhatsApp.id}
|
whatsAppId={selectedWhatsApp && !qrModalOpen && selectedWhatsApp.id}
|
||||||
/>
|
/>
|
||||||
<MainHeader>
|
<MainHeader>
|
||||||
<Title>Connections</Title>
|
<Title>{i18n.t("connections.title")}</Title>
|
||||||
<MainHeaderButtonsWrapper>
|
<MainHeaderButtonsWrapper>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={handleOpenWhatsAppModal}
|
onClick={handleOpenWhatsAppModal}
|
||||||
>
|
>
|
||||||
Add Whatsapp
|
{i18n.t("connections.buttons.add")}
|
||||||
</Button>
|
</Button>
|
||||||
</MainHeaderButtonsWrapper>
|
</MainHeaderButtonsWrapper>
|
||||||
</MainHeader>
|
</MainHeader>
|
||||||
@@ -227,11 +233,21 @@ const Connections = () => {
|
|||||||
<Table size="small">
|
<Table size="small">
|
||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell align="center">Name</TableCell>
|
<TableCell align="center">
|
||||||
<TableCell align="center">Status</TableCell>
|
{i18n.t("connections.table.name")}
|
||||||
<TableCell align="center">Last update</TableCell>
|
</TableCell>
|
||||||
<TableCell align="center">Default</TableCell>
|
<TableCell align="center">
|
||||||
<TableCell align="center">Actions</TableCell>
|
{i18n.t("connections.table.status")}
|
||||||
|
</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>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ const Contacts = () => {
|
|||||||
const handleDeleteContact = async contactId => {
|
const handleDeleteContact = async contactId => {
|
||||||
try {
|
try {
|
||||||
await api.delete(`/contacts/${contactId}`);
|
await api.delete(`/contacts/${contactId}`);
|
||||||
toast.success("Contact deleted sucessfully!");
|
toast.success(i18n.t("contacts.toasts.deleted"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if (err.response && err.response.data && err.response.data.error) {
|
if (err.response && err.response.data && err.response.data.error) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Select from "@material-ui/core/Select";
|
|||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
|
import { i18n } from "../../translate/i18n.js";
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
const useStyles = makeStyles(theme => ({
|
||||||
root: {
|
root: {
|
||||||
@@ -78,7 +79,7 @@ const Settings = () => {
|
|||||||
await api.put(`/settings/${settingKey}`, {
|
await api.put(`/settings/${settingKey}`, {
|
||||||
value: selectedValue,
|
value: selectedValue,
|
||||||
});
|
});
|
||||||
toast.success("Setting updated");
|
toast.success(i18n.t("settings.success"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if (err.response && err.response.data && err.response.data.error) {
|
if (err.response && err.response.data && err.response.data.error) {
|
||||||
@@ -96,10 +97,12 @@ const Settings = () => {
|
|||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<Container className={classes.container} maxWidth="sm">
|
<Container className={classes.container} maxWidth="sm">
|
||||||
<Typography variant="body2" gutterBottom>
|
<Typography variant="body2" gutterBottom>
|
||||||
Settings
|
{i18n.t("settings.title")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Paper className={classes.paper}>
|
<Paper className={classes.paper}>
|
||||||
<Typography variant="body1">User creation</Typography>
|
<Typography variant="body1">
|
||||||
|
{i18n.t("settings.settings.userCreation.name")}
|
||||||
|
</Typography>
|
||||||
<Select
|
<Select
|
||||||
margin="dense"
|
margin="dense"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -112,8 +115,12 @@ const Settings = () => {
|
|||||||
className={classes.settingOption}
|
className={classes.settingOption}
|
||||||
onChange={handleChangeSetting}
|
onChange={handleChangeSetting}
|
||||||
>
|
>
|
||||||
<option value="enabled">Enabled</option>
|
<option value="enabled">
|
||||||
<option value="disabled">Disabled</option>
|
{i18n.t("settings.settings.userCreation.options.enabled")}
|
||||||
|
</option>
|
||||||
|
<option value="disabled">
|
||||||
|
{i18n.t("settings.settings.userCreation.options.disabled")}
|
||||||
|
</option>
|
||||||
</Select>
|
</Select>
|
||||||
</Paper>
|
</Paper>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import MainHeaderButtonsWrapper from "../../components/MainHeaderButtonsWrapper"
|
|||||||
import Title from "../../components/Title";
|
import Title from "../../components/Title";
|
||||||
|
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
|
import { i18n } from "../../translate/i18n";
|
||||||
import TableRowSkeleton from "../../components/TableRowSkeleton";
|
import TableRowSkeleton from "../../components/TableRowSkeleton";
|
||||||
import UserModal from "../../components/UserModal";
|
import UserModal from "../../components/UserModal";
|
||||||
import ConfirmationModal from "../../components/ConfirmationModal";
|
import ConfirmationModal from "../../components/ConfirmationModal";
|
||||||
@@ -161,7 +162,7 @@ const Users = () => {
|
|||||||
const handleDeleteUser = async userId => {
|
const handleDeleteUser = async userId => {
|
||||||
try {
|
try {
|
||||||
await api.delete(`/users/${userId}`);
|
await api.delete(`/users/${userId}`);
|
||||||
toast.success("User deleted!");
|
toast.success(i18n.t("users.toasts.deleted"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if (err.response && err.response.data && err.response.data.error) {
|
if (err.response && err.response.data && err.response.data.error) {
|
||||||
@@ -188,12 +189,17 @@ const Users = () => {
|
|||||||
return (
|
return (
|
||||||
<MainContainer>
|
<MainContainer>
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
title={deletingUser && `Delete ${deletingUser.name}?`}
|
title={
|
||||||
|
deletingUser &&
|
||||||
|
`${i18n.t("users.confirmationModal.deleteTitle")} ${
|
||||||
|
deletingUser.name
|
||||||
|
}?`
|
||||||
|
}
|
||||||
open={confirmModalOpen}
|
open={confirmModalOpen}
|
||||||
setOpen={setConfirmModalOpen}
|
setOpen={setConfirmModalOpen}
|
||||||
onConfirm={e => handleDeleteUser(deletingUser.id)}
|
onConfirm={() => handleDeleteUser(deletingUser.id)}
|
||||||
>
|
>
|
||||||
Are you sure? It canoot be reverted.
|
{i18n.t("users.confirmationModal.deleteMessage")}
|
||||||
</ConfirmationModal>
|
</ConfirmationModal>
|
||||||
<UserModal
|
<UserModal
|
||||||
open={userModalOpen}
|
open={userModalOpen}
|
||||||
@@ -202,10 +208,10 @@ const Users = () => {
|
|||||||
userId={selectedUser && selectedUser.id}
|
userId={selectedUser && selectedUser.id}
|
||||||
/>
|
/>
|
||||||
<MainHeader>
|
<MainHeader>
|
||||||
<Title>Usuários</Title>
|
<Title>{i18n.t("users.title")}</Title>
|
||||||
<MainHeaderButtonsWrapper>
|
<MainHeaderButtonsWrapper>
|
||||||
<TextField
|
<TextField
|
||||||
placeholder="Search..."
|
placeholder={i18n.t("contacts.searchPlaceholder")}
|
||||||
type="search"
|
type="search"
|
||||||
value={searchParam}
|
value={searchParam}
|
||||||
onChange={handleSearch}
|
onChange={handleSearch}
|
||||||
@@ -222,7 +228,7 @@ const Users = () => {
|
|||||||
color="primary"
|
color="primary"
|
||||||
onClick={handleOpenUserModal}
|
onClick={handleOpenUserModal}
|
||||||
>
|
>
|
||||||
Novo Usuário
|
{i18n.t("users.buttons.add")}
|
||||||
</Button>
|
</Button>
|
||||||
</MainHeaderButtonsWrapper>
|
</MainHeaderButtonsWrapper>
|
||||||
</MainHeader>
|
</MainHeader>
|
||||||
@@ -234,10 +240,12 @@ const Users = () => {
|
|||||||
<Table size="small">
|
<Table size="small">
|
||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell>Name</TableCell>
|
<TableCell>{i18n.t("users.table.name")}</TableCell>
|
||||||
<TableCell>Email</TableCell>
|
<TableCell>{i18n.t("users.table.email")}</TableCell>
|
||||||
<TableCell>Profile</TableCell>
|
<TableCell>{i18n.t("users.table.profile")}</TableCell>
|
||||||
<TableCell align="right">Actions</TableCell>
|
<TableCell align="right">
|
||||||
|
{i18n.t("users.table.actions")}
|
||||||
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
|
|||||||
@@ -41,20 +41,50 @@ const messages = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sessionInfo: {
|
connections: {
|
||||||
status: "Status:",
|
title: "Connections",
|
||||||
battery: "Battery:",
|
toasts: {
|
||||||
charging: "Loading:",
|
deleted: "WhatsApp connection deleted sucessfully!",
|
||||||
updatedAt: "Updated at:",
|
|
||||||
buttons: {
|
|
||||||
disconnect: "Disconnect",
|
|
||||||
},
|
},
|
||||||
|
confirmationModal: {
|
||||||
|
deleteTitle: "Delete",
|
||||||
|
deleteMessage: "Are you sure? It cannot be reverted.",
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
add: "Add WhatsApp",
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
name: "Name",
|
||||||
|
status: "Status",
|
||||||
|
lastUpdate: "Last Update",
|
||||||
|
default: "Default",
|
||||||
|
actions: "Actions",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
whatsappModal: {
|
||||||
|
title: {
|
||||||
|
add: "Add WhatsApp",
|
||||||
|
edit: "Edit WhatsApp",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
name: "Name",
|
||||||
|
default: "Default",
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
okAdd: "Add",
|
||||||
|
okEdit: "Save",
|
||||||
|
cancel: "Cancel",
|
||||||
|
},
|
||||||
|
success: "WhatsApp saved successfully.",
|
||||||
},
|
},
|
||||||
qrCode: {
|
qrCode: {
|
||||||
message: "Read QrCode to start the session",
|
message: "Read QrCode to start the session",
|
||||||
},
|
},
|
||||||
contacts: {
|
contacts: {
|
||||||
title: "Contacts",
|
title: "Contacts",
|
||||||
|
toasts: {
|
||||||
|
deleted: "Contact deleted sucessfully!",
|
||||||
|
},
|
||||||
searchPlaceholder: "Search ...",
|
searchPlaceholder: "Search ...",
|
||||||
confirmationModal: {
|
confirmationModal: {
|
||||||
deleteTitle: "Delete",
|
deleteTitle: "Delete",
|
||||||
@@ -95,6 +125,25 @@ const messages = {
|
|||||||
okEdit: "Save",
|
okEdit: "Save",
|
||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
},
|
},
|
||||||
|
success: "Contact saved successfully.",
|
||||||
|
},
|
||||||
|
userModal: {
|
||||||
|
title: {
|
||||||
|
add: "Add user",
|
||||||
|
edit: "Edit user",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
name: "Name",
|
||||||
|
email: "Email",
|
||||||
|
password: "Password",
|
||||||
|
profile: "Profile",
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
okAdd: "Add",
|
||||||
|
okEdit: "Save",
|
||||||
|
cancel: "Cancel",
|
||||||
|
},
|
||||||
|
success: "User saved successfully.",
|
||||||
},
|
},
|
||||||
chat: {
|
chat: {
|
||||||
noTicketMessage: "Select a ticket to start chatting.",
|
noTicketMessage: "Select a ticket to start chatting.",
|
||||||
@@ -138,13 +187,55 @@ const messages = {
|
|||||||
mainDrawer: {
|
mainDrawer: {
|
||||||
listItems: {
|
listItems: {
|
||||||
dashboard: "Dashboard",
|
dashboard: "Dashboard",
|
||||||
connection: "Connection",
|
connections: "Connections",
|
||||||
tickets: "Tickets",
|
tickets: "Tickets",
|
||||||
contacts: "Contacts",
|
contacts: "Contacts",
|
||||||
administration: "Administration",
|
administration: "Administration",
|
||||||
users: "Users",
|
users: "Users",
|
||||||
settings: "Settings",
|
settings: "Settings",
|
||||||
},
|
},
|
||||||
|
appBar: {
|
||||||
|
user: {
|
||||||
|
profile: "Profile",
|
||||||
|
logout: "Logout",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
notifications: {
|
||||||
|
noTickets: "No notifications.",
|
||||||
|
},
|
||||||
|
users: {
|
||||||
|
title: "Users",
|
||||||
|
table: {
|
||||||
|
name: "Name",
|
||||||
|
email: "Email",
|
||||||
|
profile: "Profile",
|
||||||
|
actions: "Actions",
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
add: "Add user",
|
||||||
|
},
|
||||||
|
toasts: {
|
||||||
|
deleted: "User deleted sucessfully.",
|
||||||
|
},
|
||||||
|
confirmationModal: {
|
||||||
|
deleteTitle: "Delete",
|
||||||
|
deleteMessage:
|
||||||
|
"All user data will be lost. Users' open tickets will be moved to queue.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
success: "Settings saved successfully.",
|
||||||
|
title: "Settings",
|
||||||
|
settings: {
|
||||||
|
userCreation: {
|
||||||
|
name: "User creation",
|
||||||
|
options: {
|
||||||
|
enabled: "Enabled",
|
||||||
|
disabled: "Disabled",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
messagesList: {
|
messagesList: {
|
||||||
header: {
|
header: {
|
||||||
@@ -185,6 +276,14 @@ const messages = {
|
|||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
messageOptionsMenu: {
|
||||||
|
delete: "Delete",
|
||||||
|
reply: "Reply",
|
||||||
|
confirmationModal: {
|
||||||
|
title: "Delete message?",
|
||||||
|
message: "This action cannot be reverted.",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,20 +41,50 @@ const messages = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sessionInfo: {
|
connections: {
|
||||||
status: "Status: ",
|
title: "Conexões",
|
||||||
battery: "Bateria: ",
|
toasts: {
|
||||||
charging: "Carregando: ",
|
deleted: "Conexão com o WhatsApp excluída com sucesso!",
|
||||||
updatedAt: "Atualizado em:",
|
|
||||||
buttons: {
|
|
||||||
disconnect: "Desconectar",
|
|
||||||
},
|
},
|
||||||
|
confirmationModal: {
|
||||||
|
deleteTitle: "Deletar",
|
||||||
|
deleteMessage: "Você tem certeza? Essa ação não pode ser revertida.",
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
add: "Adicionar WhatsApp",
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
name: "Nome",
|
||||||
|
status: "Status",
|
||||||
|
lastUpdate: "Última atualização",
|
||||||
|
default: "Padrão",
|
||||||
|
actions: "Ações",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
whatsappModal: {
|
||||||
|
title: {
|
||||||
|
add: "Adicionar WhatsApp",
|
||||||
|
edit: "Editar WhatsApp",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
name: "Nome",
|
||||||
|
default: "Padrão",
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
okAdd: "Adicionar",
|
||||||
|
okEdit: "Salvar",
|
||||||
|
cancel: "Cancelar",
|
||||||
|
},
|
||||||
|
success: "WhatsApp salvo com sucesso.",
|
||||||
},
|
},
|
||||||
qrCode: {
|
qrCode: {
|
||||||
message: "Leia o QrCode para iniciar a sessão",
|
message: "Leia o QrCode para iniciar a sessão",
|
||||||
},
|
},
|
||||||
contacts: {
|
contacts: {
|
||||||
title: "Contatos",
|
title: "Contatos",
|
||||||
|
toasts: {
|
||||||
|
deleted: "Contato excluído com sucesso!",
|
||||||
|
},
|
||||||
searchPlaceholder: "Pesquisar...",
|
searchPlaceholder: "Pesquisar...",
|
||||||
confirmationModal: {
|
confirmationModal: {
|
||||||
deleteTitle: "Deletar ",
|
deleteTitle: "Deletar ",
|
||||||
@@ -95,6 +125,25 @@ const messages = {
|
|||||||
okEdit: "Salvar",
|
okEdit: "Salvar",
|
||||||
cancel: "Cancelar",
|
cancel: "Cancelar",
|
||||||
},
|
},
|
||||||
|
success: "Contato salvo com sucesso.",
|
||||||
|
},
|
||||||
|
userModal: {
|
||||||
|
title: {
|
||||||
|
add: "Adicionar usuário",
|
||||||
|
edit: "Editar usuário",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
name: "Nome",
|
||||||
|
email: "Email",
|
||||||
|
password: "Senha",
|
||||||
|
profile: "Perfil",
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
okAdd: "Adicionar",
|
||||||
|
okEdit: "Salvar",
|
||||||
|
cancel: "Cancelar",
|
||||||
|
},
|
||||||
|
success: "Usuário salvo com sucesso.",
|
||||||
},
|
},
|
||||||
chat: {
|
chat: {
|
||||||
noTicketMessage: "Selecione um ticket para começar a conversar.",
|
noTicketMessage: "Selecione um ticket para começar a conversar.",
|
||||||
@@ -112,7 +161,7 @@ const messages = {
|
|||||||
search: { title: "Busca" },
|
search: { title: "Busca" },
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
placeholder: "Pesquisar tickets e mensagens.",
|
placeholder: "Buscar tickets e mensagens",
|
||||||
},
|
},
|
||||||
buttons: {
|
buttons: {
|
||||||
showAll: "Todos",
|
showAll: "Todos",
|
||||||
@@ -139,9 +188,54 @@ const messages = {
|
|||||||
mainDrawer: {
|
mainDrawer: {
|
||||||
listItems: {
|
listItems: {
|
||||||
dashboard: "Dashboard",
|
dashboard: "Dashboard",
|
||||||
connection: "Conexão",
|
connections: "Conexões",
|
||||||
tickets: "Tickets",
|
tickets: "Tickets",
|
||||||
contacts: "Contatos",
|
contacts: "Contatos",
|
||||||
|
administration: "Administração",
|
||||||
|
users: "Usuários",
|
||||||
|
settings: "Configurações",
|
||||||
|
},
|
||||||
|
appBar: {
|
||||||
|
user: {
|
||||||
|
profile: "Perfil",
|
||||||
|
logout: "Sair",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
notifications: {
|
||||||
|
noTickets: "Nenhuma notificação.",
|
||||||
|
},
|
||||||
|
users: {
|
||||||
|
title: "Usuários",
|
||||||
|
table: {
|
||||||
|
name: "Nome",
|
||||||
|
email: "Email",
|
||||||
|
profile: "Perfil",
|
||||||
|
actions: "Ações",
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
add: "Adicionar usuário",
|
||||||
|
},
|
||||||
|
toasts: {
|
||||||
|
deleted: "Usuário excluído com sucesso.",
|
||||||
|
},
|
||||||
|
confirmationModal: {
|
||||||
|
deleteTitle: "Excluir",
|
||||||
|
deleteMessage:
|
||||||
|
"Todos os dados do usuário serão perdidos. Os tickets abertos deste usuário serão movidos para a fila.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
success: "Configurações salvas com sucesso.",
|
||||||
|
title: "Configurações",
|
||||||
|
settings: {
|
||||||
|
userCreation: {
|
||||||
|
name: "Criação de usuário",
|
||||||
|
options: {
|
||||||
|
enabled: "Ativado",
|
||||||
|
disabled: "Desativado",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
messagesList: {
|
messagesList: {
|
||||||
@@ -173,6 +267,10 @@ const messages = {
|
|||||||
message:
|
message:
|
||||||
"Atenção! Todas as mensagens relacionadas ao ticket serão perdidas.",
|
"Atenção! Todas as mensagens relacionadas ao ticket serão perdidas.",
|
||||||
},
|
},
|
||||||
|
buttons: {
|
||||||
|
delete: "Excluir",
|
||||||
|
cancel: "Cancelar",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
confirmationModal: {
|
confirmationModal: {
|
||||||
buttons: {
|
buttons: {
|
||||||
@@ -180,6 +278,14 @@ const messages = {
|
|||||||
cancel: "Cancelar",
|
cancel: "Cancelar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
messageOptionsMenu: {
|
||||||
|
delete: "Deletar",
|
||||||
|
reply: "Responder",
|
||||||
|
confirmationModal: {
|
||||||
|
title: "Apagar mensagem?",
|
||||||
|
message: "Esta ação não pode ser revertida.",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user