Pequena modificação no dasboard
parent
ffcefe8f12
commit
2d95bfe20d
|
@ -39,7 +39,7 @@ const ListTicketsService = async ({
|
||||||
showAll,
|
showAll,
|
||||||
userId,
|
userId,
|
||||||
withUnreadMessages,
|
withUnreadMessages,
|
||||||
unlimited='false'
|
unlimited = 'false'
|
||||||
}: Request): Promise<Response> => {
|
}: Request): Promise<Response> => {
|
||||||
let whereCondition: Filterable["where"] = {
|
let whereCondition: Filterable["where"] = {
|
||||||
[Op.or]: [{ userId }, { status: "pending" }],
|
[Op.or]: [{ userId }, { status: "pending" }],
|
||||||
|
@ -47,6 +47,8 @@ const ListTicketsService = async ({
|
||||||
};
|
};
|
||||||
let includeCondition: Includeable[];
|
let includeCondition: Includeable[];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
includeCondition = [
|
includeCondition = [
|
||||||
{
|
{
|
||||||
model: Contact,
|
model: Contact,
|
||||||
|
@ -65,20 +67,21 @@ const ListTicketsService = async ({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
|
|
||||||
|
whereCondition = { ...whereCondition, status };
|
||||||
|
|
||||||
|
// console.log('TEST unlimited: ', unlimited)
|
||||||
|
|
||||||
|
if (unlimited === 'true' && status !== 'pending') {
|
||||||
|
|
||||||
whereCondition = {
|
whereCondition = {
|
||||||
...whereCondition,
|
...whereCondition,
|
||||||
status
|
createdAt: {
|
||||||
};
|
[Op.gte]: dateToday.fullDate + ' 00:00:00.000000',
|
||||||
|
[Op.lte]: dateToday.fullDate + ' 23:59:59.999999'
|
||||||
// if (unlimited) {
|
}
|
||||||
// whereCondition = {
|
}
|
||||||
// ...whereCondition,
|
}
|
||||||
// createdAt: {
|
|
||||||
// [Op.gte]: dateToday.fullDate + ' 00:00:00.000000',
|
|
||||||
// [Op.lte]: dateToday.fullDate + ' 23:59:59.999999'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,11 +95,7 @@ const ListTicketsService = async ({
|
||||||
as: "messages",
|
as: "messages",
|
||||||
attributes: ["id", "body"],
|
attributes: ["id", "body"],
|
||||||
where: {
|
where: {
|
||||||
body: where(
|
body: where(fn("LOWER", col("body")), "LIKE", `%${sanitizedSearchParam}%`)
|
||||||
fn("LOWER", col("body")),
|
|
||||||
"LIKE",
|
|
||||||
`%${sanitizedSearchParam}%`
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
required: false,
|
required: false,
|
||||||
duplicating: false
|
duplicating: false
|
||||||
|
@ -107,19 +106,13 @@ const ListTicketsService = async ({
|
||||||
...whereCondition,
|
...whereCondition,
|
||||||
[Op.or]: [
|
[Op.or]: [
|
||||||
{
|
{
|
||||||
"$contact.name$": where(
|
"$contact.name$": where(fn("LOWER", col("contact.name")), "LIKE", `%${sanitizedSearchParam}%`)
|
||||||
fn("LOWER", col("contact.name")),
|
|
||||||
"LIKE",
|
|
||||||
`%${sanitizedSearchParam}%`
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "$contact.number$": { [Op.like]: `%${sanitizedSearchParam}%` } },
|
{ "$contact.number$": { [Op.like]: `%${sanitizedSearchParam}%` } },
|
||||||
|
|
||||||
{
|
{
|
||||||
"$message.body$": where(
|
"$message.body$": where(fn("LOWER", col("body")), "LIKE", `%${sanitizedSearchParam}%`)
|
||||||
fn("LOWER", col("body")),
|
|
||||||
"LIKE",
|
|
||||||
`%${sanitizedSearchParam}%`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -125,7 +125,7 @@ const MTable = (props) => {
|
||||||
exportAllData: true,
|
exportAllData: true,
|
||||||
|
|
||||||
sorting: true ? props.hasChild : false,
|
sorting: true ? props.hasChild : false,
|
||||||
loadingType: 'circular',
|
// loadingType: 'circular',
|
||||||
searchFieldStyle: {
|
searchFieldStyle: {
|
||||||
width: 300,
|
width: 300,
|
||||||
},
|
},
|
||||||
|
|
|
@ -195,6 +195,9 @@ const TicketsList = (props) => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!status && !searchParam) return;
|
if (!status && !searchParam) return;
|
||||||
|
|
||||||
|
// console.log('lllllllllllllllllllllllllllllllll')
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "LOAD_TICKETS",
|
type: "LOAD_TICKETS",
|
||||||
payload: tickets,
|
payload: tickets,
|
||||||
|
|
|
@ -20,7 +20,7 @@ const Chart = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const date = useRef(new Date().toISOString());
|
const date = useRef(new Date().toISOString());
|
||||||
const { tickets } = useTickets({ date: date.current });
|
const { tickets } = useTickets({ date: date.current, unlimited: "true" });
|
||||||
|
|
||||||
const [chartData, setChartData] = useState([
|
const [chartData, setChartData] = useState([
|
||||||
{ time: "08:00", amount: 0 },
|
{ time: "08:00", amount: 0 },
|
||||||
|
|
|
@ -75,6 +75,7 @@ const Dashboard = () => {
|
||||||
<div>
|
<div>
|
||||||
<Container maxWidth="lg" className={classes.container}>
|
<Container maxWidth="lg" className={classes.container}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
|
|
||||||
<Grid item xs={4}>
|
<Grid item xs={4}>
|
||||||
<Paper className={classes.customFixedHeightPaper} style={{ overflow: "hidden" }}>
|
<Paper className={classes.customFixedHeightPaper} style={{ overflow: "hidden" }}>
|
||||||
<Typography component="h3" variant="h6" color="primary" paragraph>
|
<Typography component="h3" variant="h6" color="primary" paragraph>
|
||||||
|
@ -111,11 +112,13 @@ const Dashboard = () => {
|
||||||
</Grid>
|
</Grid>
|
||||||
</Paper>
|
</Paper>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Paper className={classes.fixedHeightPaper}>
|
<Paper className={classes.fixedHeightPaper}>
|
||||||
<Chart />
|
<Chart />
|
||||||
</Paper>
|
</Paper>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Container>
|
</Container>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -397,8 +397,8 @@ const Report = () => {
|
||||||
|
|
||||||
const { data } = await api.get("/reports/", { params: { userId, startDate, endDate, pageNumber: pageNumberTickets }, });
|
const { data } = await api.get("/reports/", { params: { userId, startDate, endDate, pageNumber: pageNumberTickets }, });
|
||||||
|
|
||||||
console.log('dataQuery: ', data)
|
// console.log('dataQuery: ', data)
|
||||||
console.log('pageNumberTickets: ', pageNumberTickets)
|
// console.log('pageNumberTickets: ', pageNumberTickets)
|
||||||
|
|
||||||
// dispatchQ({ type: "RESET" })
|
// dispatchQ({ type: "RESET" })
|
||||||
dispatchQ({ type: "LOAD_QUERY", payload: data.tickets });
|
dispatchQ({ type: "LOAD_QUERY", payload: data.tickets });
|
||||||
|
|
Loading…
Reference in New Issue