controller.js 4.91 KB
angular.module('focaInformes')
    .controller('focaInformesController',
    [
        '$scope',
        'focaInformesService',
        'focaBotoneraLateralService',
        '$uibModal',
        function($scope, focaInformesService, focaBotoneraLateralService, $uibModal)
        {
            $scope.now = new Date();
            $scope.botonera = focaInformesService.getBotonera();

            //SETEO BOTONERA LATERAL
            focaBotoneraLateralService.showSalir(true);
            focaBotoneraLateralService.showPausar(false);
            focaBotoneraLateralService.showGuardar(false);

            $scope.seleccionarHojasDeRuta = function() {
                focaBotoneraLateralService.showTeclado(false);
                $uibModal.open(
                    {
                        ariaLabelledBy: 'Informes de hojas de ruta',
                        templateUrl: 'informe-hoja-ruta.html',
                        controller: 'focaModalInformeHojaRutaController',
                        size: 'xl'
                    }
                )
                .result.then(function() {
                    focaBotoneraLateralService.showTeclado(true);
                }, function() {
                    focaBotoneraLateralService.showTeclado(true);
                });
            };
            $scope.seleccionarChoferes = function() {
                focaBotoneraLateralService.showTeclado(false);
                $uibModal.open(
                    {
                        ariaLabelledBy: 'Informes de choferes',
                        templateUrl: 'informe-chofer.html',
                        controller: 'focaModalInformeChoferController',
                        size: 'xl'
                    }
                )
                .result.then(function() {
                    focaBotoneraLateralService.showTeclado(true);
                }, function() {
                    focaBotoneraLateralService.showTeclado(true);
                });
            };
            $scope.seleccionarLitrosPorKmRecorridosPorUnidadDeReparto = function() {
                focaBotoneraLateralService.showTeclado(false);
                $uibModal.open(
                    {
                        ariaLabelledBy: 'Informes de litros por km recorridos por unidad de reparto',
                        templateUrl: 'informe-litros-km-unidad.html',
                        controller: 'focaModalInformeLitrosKmUnidadController',
                        size: 'xl'
                    }
                )
                .result.then(function() {
                    focaBotoneraLateralService.showTeclado(true);
                }, function() {
                    focaBotoneraLateralService.showTeclado(true);
                });
            };
            $scope.seleccionarInformeGeneralPorUnidadDeReparto = function() {
                focaBotoneraLateralService.showTeclado(false);
                $uibModal.open(
                    {
                        ariaLabelledBy: 'Informe general por unidad de reparto',
                        templateUrl: 'informe-general-unidad.html',
                        controller: 'focaModalInformeGeneralUnidadController',
                        size: 'xl'
                    }
                )
                .result.then(function() {
                    focaBotoneraLateralService.showTeclado(true);
                }, function() {
                    focaBotoneraLateralService.showTeclado(true);
                });
            };
            $scope.seleccionarInformeDeRepartoÓptimoDetallado = function() {
                focaBotoneraLateralService.showTeclado(false);
                $uibModal.open(
                    {
                        ariaLabelledBy: 'Informe de reparto óptimo detallado',
                        templateUrl: 'informe-reparto-optimo.html',
                        controller: 'focaModalInformeRepartoOptimoController',
                        size: 'xl'
                    }
                )
                .result.then(function() {
                    focaBotoneraLateralService.showTeclado(true);
                }, function() {
                    focaBotoneraLateralService.showTeclado(true);
                });
            };
            $scope.seleccionarInformeDeProductividad = function() {
                focaBotoneraLateralService.showTeclado(false);
                $uibModal.open(
                    {
                        ariaLabelledBy:
                            'Informe de productividad de Vendedores / Cobradores / Transportistas',
                        templateUrl: 'informe-productividad.html',
                        controller: 'focaModalInformeProductividadController',
                        size: 'xl'
                    }
                )
                .result.then(function() {
                    focaBotoneraLateralService.showTeclado(true);
                }, function() {
                    focaBotoneraLateralService.showTeclado(true);
                });
            };
        }
    ]);