Initial Commit

This commit is contained in:
GiacomoHome
2021-09-17 12:41:45 +02:00
commit 9001e4656e
570 changed files with 31013 additions and 0 deletions
@@ -0,0 +1,82 @@
'use strict';
function DashboardController($scope, Ordini, moment, toaster, AuthService, DateRangePickerService, $timeout, $window) {
$scope.dateRangeOptions = {
...defaultDateRangePickerOptions,
ranges: DateRangePickerService.getTrimestreCustomRangeOptions(),
autoApply: true
};
const stampaRapportoAdminUri = `${BASE_URL_SITE}/admin/index/stampareportattivita`;
$scope.loading = true;
$scope.DataConsegna = {startDate: moment().subtract(29, 'days'), endDate: moment()};
$scope.Periodo = '';
$scope.series = ['Ordini ' + $scope.Periodo, ''];
$scope.colors = ['#44ABF1', '#DDDDDD'];
$scope.labels = [];
$scope.data = [];
$scope.TotOrdiniPeriodo = 0;
$scope.graphOptions = {
legend: {display: false},
scales: {
yAxes: [
{
id: 'y-axis-1',
type: 'linear',
display: true,
position: 'left'
}
]
}
};
$scope.$watch('DataConsegna', (oldVal, newVal) => {
$scope.Periodo = 'Dal ' + newVal.startDate.format('DD/MM/YYYY') + ' al ' + newVal.endDate.format('DD/MM/YYYY');
$scope.refreshGraph();
});
$scope.refreshGraph = () => {
$scope.loading = true;
const per = $scope.DataConsegna.startDate.format('YYYY-MM-DD') + '|' + $scope.DataConsegna.endDate.format('YYYY-MM-DD');
Ordini.getGraphData(per).then((res) => {
$scope.labels = res.DatiGrafico.labels;
$scope.data = [res.DatiGrafico.data, []];
$scope.TotOrdiniPeriodo = res.TotOrdini;
}).catch((err) => {
toaster.error("Attenzione", "Errore durante il recupero dei dati del grafico");
}).finally(() => {
$timeout(() => {
$scope.loading = false
}, 300);
});
};
$scope.stampaRapporto = () => {
if (!$scope.DataConsegna) {
alert("Devi selezionare un periodo per la stampa rapporto");
return;
}
let periodo = $scope.DataConsegna.startDate.format('YYYY-MM-DD') + '|' + $scope.DataConsegna.endDate.format('YYYY-MM-DD');
/*if(!confirm(`Aprire la stampa report per il periodo scelto (${periodo}) ?`)){
return;
}*/
let url = `${stampaRapportoAdminUri}/p/${periodo}`;
$window.open(url, '_blank');
};
//$scope.refreshGraph();
}
app.controller('DashboardController', DashboardController);