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