Compare commits
No commits in common. "42073cc821e2bcf29d8f12479e59652d65927349" and "bfae2956a530844f781e559a2c226f4fcab58815" have entirely different histories.
42073cc821
...
bfae2956a5
|
@ -264,8 +264,7 @@ export const remoteTicketCreation = async (
|
|||
whatsappId,
|
||||
0,
|
||||
undefined,
|
||||
queueId,
|
||||
true
|
||||
queueId
|
||||
);
|
||||
botSendMessage(ticket, `${msg}`);
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
import { QueryInterface, DataTypes } from "sequelize";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.addColumn("Tickets", "isRemote", {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: true,
|
||||
defaultValue: false
|
||||
});
|
||||
},
|
||||
|
||||
down: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.removeColumn("Tickets", "isRemote");
|
||||
}
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
import { QueryInterface } from "sequelize";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.bulkInsert(
|
||||
"Settings",
|
||||
[
|
||||
{
|
||||
key: "filterMediasByType",
|
||||
value: "disabled",
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date()
|
||||
}
|
||||
],
|
||||
{}
|
||||
);
|
||||
},
|
||||
|
||||
down: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.bulkDelete("Settings", {});
|
||||
}
|
||||
};
|
|
@ -5,11 +5,10 @@ export default function quickAnswearByQueueFiltered(
|
|||
quickAnswers: QuickAnswer[]
|
||||
) {
|
||||
let auxQuickAnswear = [];
|
||||
let repet: any[] = [];
|
||||
const userQueues = queueIds.map((uq: any) => uq.queueId);
|
||||
|
||||
for (const quickAnswer of quickAnswers) {
|
||||
const { queues, id } = quickAnswer;
|
||||
const { queues } = quickAnswer;
|
||||
|
||||
if (queues.length == 0) {
|
||||
auxQuickAnswear.push(quickAnswer);
|
||||
|
@ -18,9 +17,6 @@ export default function quickAnswearByQueueFiltered(
|
|||
|
||||
for (const q of queues) {
|
||||
if (userQueues.includes(q.id)) {
|
||||
if (repet.includes(id)) continue;
|
||||
repet.push(id);
|
||||
|
||||
auxQuickAnswear.push(quickAnswer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,6 @@ class Ticket extends Model<Ticket> {
|
|||
@Column
|
||||
isGroup: boolean;
|
||||
|
||||
@Default(false)
|
||||
@Column
|
||||
isRemote: boolean;
|
||||
|
||||
@ForeignKey(() => StatusChatEnd)
|
||||
@Column
|
||||
statusChatEndId: number;
|
||||
|
|
|
@ -14,8 +14,7 @@ const FindOrCreateTicketService = async (
|
|||
whatsappId: number,
|
||||
unreadMessages: number,
|
||||
groupContact?: Contact,
|
||||
queueId?: number | string,
|
||||
isRemote?: boolean
|
||||
queueId?: number | string
|
||||
): Promise<Ticket> => {
|
||||
try {
|
||||
let ticket;
|
||||
|
@ -107,8 +106,7 @@ const FindOrCreateTicketService = async (
|
|||
queueId,
|
||||
unreadMessages,
|
||||
whatsappId,
|
||||
phoneNumberId,
|
||||
isRemote
|
||||
phoneNumberId
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ interface TicketData {
|
|||
statusChatEndId?: number;
|
||||
unreadMessages?: number;
|
||||
whatsappId?: string | number;
|
||||
isRemote?: boolean;
|
||||
}
|
||||
|
||||
interface Request {
|
||||
|
@ -49,8 +48,7 @@ const UpdateTicketService = async ({
|
|||
statusChatEnd,
|
||||
unreadMessages,
|
||||
statusChatEndId,
|
||||
whatsappId,
|
||||
isRemote
|
||||
whatsappId
|
||||
} = ticketData;
|
||||
|
||||
const ticket = await ShowTicketService(ticketId);
|
||||
|
@ -78,8 +76,7 @@ const UpdateTicketService = async ({
|
|||
unreadMessages,
|
||||
statusChatEnd,
|
||||
statusChatEndId,
|
||||
whatsappId,
|
||||
isRemote
|
||||
whatsappId
|
||||
});
|
||||
|
||||
await ticket.reload();
|
||||
|
|
|
@ -70,10 +70,11 @@ const PositionModal = ({
|
|||
}
|
||||
|
||||
const [position, setPosition] = useState(initialState)
|
||||
// const [selectedQueueIds, setSelectedQueueIds] = useState([])
|
||||
const { setting } = useContext(AuthContext)
|
||||
const [selectedQueueIds, setSelectedQueueIds] = useState([])
|
||||
const { user, setting, getSettingValue } = useContext(AuthContext)
|
||||
const [settings, setSettings] = useState(setting)
|
||||
|
||||
// console.log('USER: ', JSON.stringify(user, null, 6))
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
|
@ -120,11 +121,11 @@ const PositionModal = ({
|
|||
if (isMounted.current) {
|
||||
setPosition(data)
|
||||
|
||||
// if (data?.queues) {
|
||||
// console.log('data.queues: ', data.queues)
|
||||
// const quickQueueIds = data.queues?.map((queue) => queue.id)
|
||||
// setSelectedQueueIds(quickQueueIds)
|
||||
// }
|
||||
if (data?.queues) {
|
||||
console.log('data.queues: ', data.queues)
|
||||
const quickQueueIds = data.queues?.map((queue) => queue.id)
|
||||
setSelectedQueueIds(quickQueueIds)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
toastError(err)
|
||||
|
@ -202,7 +203,7 @@ const PositionModal = ({
|
|||
fullWidth
|
||||
/>
|
||||
</div>
|
||||
{/* <div>
|
||||
<div>
|
||||
{
|
||||
((settings && getSettingValue('quickAnswerByQueue') === 'enabled')) && (
|
||||
<QueueSelect
|
||||
|
@ -214,7 +215,7 @@ const PositionModal = ({
|
|||
/>
|
||||
)
|
||||
}
|
||||
</div> */}
|
||||
</div>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
|
|
|
@ -81,6 +81,8 @@ const QuickAnswersModal = ({
|
|||
const { user, setting, getSettingValue } = useContext(AuthContext)
|
||||
const [settings, setSettings] = useState(setting)
|
||||
|
||||
// console.log('USER: ', JSON.stringify(user, null, 6))
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
isMounted.current = false
|
||||
|
@ -91,14 +93,6 @@ const QuickAnswersModal = ({
|
|||
setSettings(setting)
|
||||
}, [setting])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
setSelectedQueueIds([])
|
||||
if (open && selectedQueueIds.length === 0 && !quickAnswerId) {
|
||||
setSelectedQueueIds(user.queues.map(q => q.id))
|
||||
}
|
||||
|
||||
}, [open,])
|
||||
|
||||
useEffect(() => {
|
||||
const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
|
||||
|
@ -120,9 +114,6 @@ const QuickAnswersModal = ({
|
|||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
// setSelectedQueueIds([])
|
||||
|
||||
const fetchQuickAnswer = async () => {
|
||||
if (initialValues) {
|
||||
setQuickAnswer((prevState) => {
|
||||
|
@ -130,9 +121,7 @@ const QuickAnswersModal = ({
|
|||
})
|
||||
}
|
||||
|
||||
if (!quickAnswerId) {
|
||||
return
|
||||
}
|
||||
if (!quickAnswerId) return
|
||||
|
||||
try {
|
||||
const { data } = await api.get(`/quickAnswers/${quickAnswerId}`)
|
||||
|
@ -140,6 +129,7 @@ const QuickAnswersModal = ({
|
|||
setQuickAnswer(data)
|
||||
|
||||
if (data?.queues) {
|
||||
console.log('data.queues: ', data.queues)
|
||||
const quickQueueIds = data.queues?.map((queue) => queue.id)
|
||||
setSelectedQueueIds(quickQueueIds)
|
||||
}
|
||||
|
|
|
@ -246,17 +246,7 @@ const TicketListItem = ({ ticket }) => {
|
|||
loading={loading}
|
||||
onClick={e => handleAcepptTicket(ticket.id)}
|
||||
>
|
||||
{/* {i18n.t("ticketsList.buttons.accept")} */}
|
||||
<>
|
||||
{/* {i18n.t("ticketsList.buttons.accept")}<br />CAMPANHA */}
|
||||
|
||||
{ticket?.isRemote ? (
|
||||
<>{i18n.t("ticketsList.buttons.accept")}<br />CAMPANHA</>
|
||||
) : (
|
||||
<>{i18n.t("ticketsList.buttons.accept")}</>
|
||||
)}
|
||||
|
||||
</>
|
||||
{i18n.t("ticketsList.buttons.accept")}
|
||||
</ButtonWithSpinner>
|
||||
)}
|
||||
</ListItem>
|
||||
|
|
Loading…
Reference in New Issue