mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 21:45:41 +00:00
feat: filter date in charts
This commit is contained in:
@@ -38,20 +38,22 @@ new Chart("vendas", {
|
||||
|
||||
|
||||
function mediaCuisine(){
|
||||
|
||||
var dateStart = document.getElementById('data-start').value == '' ? '2025-01-01' :document.getElementById('data-start').value;
|
||||
var dateEnd = document.getElementById('data-end').value == '' ? '2025-01-15' :document.getElementById('data-end').value;;
|
||||
var yValues = [];
|
||||
var xValues = ['Fila', 'Preparando', 'Entregar'];
|
||||
var barColors = ["red", "green","blue","orange","brown"];
|
||||
|
||||
var resposta = fetch('/chartCuisine', {method: 'GET',
|
||||
var resposta = fetch(`/chartCuisine/${dateStart}/${dateEnd}`, {method: 'GET',
|
||||
headers: {'Content-Type': 'application/json',
|
||||
},})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
yValues = []
|
||||
yValues.push(data['mediaFila'])
|
||||
yValues.push(data['mediaPreparando'])
|
||||
yValues.push(data['mediaFinalizado'])
|
||||
|
||||
console.log(yValues)
|
||||
new Chart("cuisine", {
|
||||
type: "doughnut",
|
||||
data: {
|
||||
@@ -76,6 +78,11 @@ var resposta = fetch('/chartCuisine', {method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
function deleyGraficos(){
|
||||
setTimeout(function() {
|
||||
mediaCuisine();}, 20000);
|
||||
}
|
||||
// productsPlus()
|
||||
mediaCuisine()
|
||||
|
||||
productsPlus()
|
||||
mediaCuisine()
|
||||
// console.log(document.getElementById('data-start').value)
|
||||
Reference in New Issue
Block a user