forked from evskorobogatij/callcenter_view
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Количество пропущеных звонков за 30 рабочих дней
- Loading branch information
1 parent
03a9c37
commit 167e2d5
Showing
5 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React, {useEffect, useMemo, useState} from "react"; | ||
import moment from "moment"; | ||
import {Link} from "react-router-dom"; | ||
import {Button} from "primereact/button"; | ||
import {Chart} from "primereact/components/chart/Chart"; | ||
|
||
import "./CallsGraph.scss" | ||
|
||
function CallsAbandonGraph() { | ||
|
||
const [graphData,setGraphData] = useState({ | ||
data : [], | ||
labels: [] | ||
}) | ||
|
||
React.useEffect(()=>{ | ||
// let s_date = moment(props.date).format("YYYY-MM-DD"); | ||
fetch(`/api/abandon_calls_log`).then(response => response.json()).then( | ||
result => { | ||
let descr = [] | ||
let values= [] | ||
result.reverse().map((item)=>{ | ||
descr.push(moment(item.dt).lang('ru').format("DD MMM")) | ||
values.push(item.cn) | ||
}) | ||
setGraphData({ | ||
data: values, | ||
labels: descr | ||
}) | ||
} | ||
) | ||
},[]) | ||
|
||
useEffect(()=>{ | ||
console.log(graphData) | ||
},[graphData]) | ||
|
||
const basicData = useMemo(()=>( | ||
{ | ||
labels: graphData.labels, | ||
datasets: [ | ||
{ | ||
label: 'Пропущеные звонки', | ||
backgroundColor: '#f9c851', | ||
data: graphData.data | ||
} | ||
] | ||
} | ||
),[graphData]) | ||
|
||
return ( | ||
<> | ||
<div className={"CallGraph-title"}> | ||
<Link to={"dasboard"} > | ||
<Button icon="pi pi-chevron-left" className={"p-button-outlined"} label={"Назад"} /> | ||
</Link> | ||
<h1>Количество пропущеных звонков по дням</h1> | ||
</div> | ||
|
||
<Chart type={"bar"} data={basicData} height={120}/> | ||
|
||
</> | ||
) | ||
} | ||
|
||
export default CallsAbandonGraph; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters