pull/20/head
adriano 2022-09-21 01:29:54 -03:00
parent 0e720ef48e
commit 728c5b580e
3 changed files with 26 additions and 21 deletions

View File

@ -88,19 +88,23 @@ const ListTicketsService = async ({
if (searchParam) { if (searchParam) {
const sanitizedSearchParam = searchParam.toLocaleLowerCase().trim(); const sanitizedSearchParam = searchParam.toLocaleLowerCase().trim();
includeCondition = [ //othavio
...includeCondition,
{ console.log('sanitizedSearchParam:'+ sanitizedSearchParam, ' | sanitizedSearchParam.length: ',sanitizedSearchParam.length)
model: Message,
as: "messages", // includeCondition = [
attributes: ["id", "body"], // ...includeCondition,
where: { // {
body: where(fn("LOWER", col("body")), "LIKE", `%${sanitizedSearchParam}%`) // model: Message,
}, // as: "messages",
required: false, // attributes: ["id", "body"],
duplicating: false // where: {
} // body: where(fn("LOWER", col("body")), "LIKE", `%${sanitizedSearchParam}%`)
]; // },
// required: false,
// duplicating: false
// }
// ];
whereCondition = { whereCondition = {
...whereCondition, ...whereCondition,
@ -111,9 +115,9 @@ const ListTicketsService = async ({
{ "$contact.number$": { [Op.like]: `%${sanitizedSearchParam}%` } }, { "$contact.number$": { [Op.like]: `%${sanitizedSearchParam}%` } },
{ // {
"$message.body$": where(fn("LOWER", col("body")), "LIKE", `%${sanitizedSearchParam}%`) // "$message.body$": where(fn("LOWER", col("body")), "LIKE", `%${sanitizedSearchParam}%`)
} // }
] ]
}; };
} }

View File

@ -124,7 +124,8 @@ const TicketsManager = () => {
let searchTimeout; let searchTimeout;
const handleSearch = (e) => { const handleSearch = (e) => {
const searchedTerm = e.target.value.toLowerCase().trim(); let searchedTerm = e.target.value.toLowerCase()
clearTimeout(searchTimeout); clearTimeout(searchTimeout);
@ -136,7 +137,7 @@ const TicketsManager = () => {
searchTimeout = setTimeout(() => { searchTimeout = setTimeout(() => {
setSearchParam(searchedTerm); setSearchParam(searchedTerm);
}, 500); }, 200);
}; };
const handleChangeTab = (e, newValue) => { const handleChangeTab = (e, newValue) => {
@ -196,7 +197,7 @@ const TicketsManager = () => {
className={classes.searchInput} className={classes.searchInput}
inputRef={searchInputRef} inputRef={searchInputRef}
placeholder={i18n.t("tickets.search.placeholder")} placeholder={i18n.t("tickets.search.placeholder")}
type="search" type="search"
onChange={handleSearch} onChange={handleSearch}
/> />
</div> </div>

View File

@ -391,7 +391,7 @@ const Report = () => {
const queryOnQueue = await apiBroker.get("/reports/status/query/onqueue", { const queryOnQueue = await apiBroker.get("/reports/status/query/onqueue", {
params: { params: {
adminId: userA.id, adminId: userA.id,
baseURL: process.env.REACT_APP_BACKEND_URL, baseURL: process.env.REACT_APP_BACKEND_URL_PRIVATE,
identifier: 'csv' identifier: 'csv'
} }
}); });
@ -454,7 +454,7 @@ const Report = () => {
{ {
app: { app: {
adminId: userA.id, adminId: userA.id,
baseURL: process.env.REACT_APP_BACKEND_URL, baseURL: process.env.REACT_APP_BACKEND_URL_PRIVATE,
frontURL: process.env.REACT_APP_FRONTEND_URL, frontURL: process.env.REACT_APP_FRONTEND_URL,
identifier: 'csv' identifier: 'csv'
}, },