From a65d046f3d041086084592f008f3aefaac943633 Mon Sep 17 00:00:00 2001 From: mpuebla Date: Thu, 4 Jul 2019 16:55:58 -0300 Subject: [PATCH] arreglo en responsividad. --- src/js/controller.js | 116 ++++++++++++++----------------------- src/views/lista-hoja-ruta.html | 127 +++++++++++++++++++++++------------------ 2 files changed, 115 insertions(+), 128 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index 47d891c..e87b537 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -1,71 +1,47 @@ angular.module('focaHojaRuta') .controller('listaHojaRutaCtrl', [ - '$scope', - '$location', - '$filter', - '$uibModal', - 'hojaRutaService', - 'focaLoginService', - 'focaModalService', - '$rootScope', - '$localStorage', - function ( - $scope, - $location, - $filter, - $uibModal, - hojaRutaService, - focaLoginService, - focaModalService, - $rootScope, - $localStorage - ) { + '$scope', '$location', '$filter', '$uibModal', 'hojaRutaService', + 'focaLoginService', 'focaModalService', '$rootScope', '$localStorage', + function ($scope, $location, $filter, $uibModal, hojaRutaService, + focaLoginService, focaModalService, $rootScope, $localStorage) { var loginData = focaLoginService.getLoginData(); - config(); - + init(); function config() { - $scope.cabecera = []; $scope.showCabecera = true; $scope.now = new Date(); $scope.puntoVenta = '0000'; $scope.comprobante = '00000000'; } - - hojaRutaService.getHojaRuta(loginData.chofer).then(function (res) { - - if (res.data) { - var hojaRuta = res.data; - $scope.hojaRuta = hojaRuta; - $scope.puntoVenta = hojaRuta.sucursal; - $scope.comprobante = hojaRuta.numeroHojaRuta; - addCabecera('Transportista:', hojaRuta.transportista.NOM); - addCabecera('Chofer:', hojaRuta.chofer.nombre); - addCabecera('Vehículo:', hojaRuta.vehiculo.tractor); - } else { - focaModalService.alert('Sin hoja de ruta asignada'); - $location.path('/'); - } - - watch(); - - if (!$scope.estadoRed) { - getLSHojaRuta(); - } - - - }); - + function init() { + hojaRutaService.getHojaRuta(loginData.chofer) + .then(function (res) { + if (res.data) { + var hojaRuta = res.data; + $scope.hojaRuta = hojaRuta; + $scope.puntoVenta = hojaRuta.sucursal; + $scope.comprobante = hojaRuta.numeroHojaRuta; + addCabecera('Transportista:', hojaRuta.transportista.NOM); + addCabecera('Chofer:', hojaRuta.chofer.nombre); + addCabecera('Vehículo:', hojaRuta.vehiculo.tractor); + } else { + focaModalService.alert('Sin hoja de ruta asignada'); + $location.path('/'); + } + watch(); + if (!$scope.estadoRed) { + getLSHojaRuta(); + } + }); + } function watch() { - $scope.$watch('hojaRuta', function (nuevoValor) { $localStorage.hojaRuta = JSON.stringify(nuevoValor); }, true); } - $scope.verDetalle = function (remito) { var modalInstance = $uibModal.open( { @@ -80,20 +56,13 @@ angular.module('focaHojaRuta') size: 'lg' } ); - modalInstance.result.then(function () { - //funcion se ejecuta cuando se carga pantalla - }); + modalInstance.result + .then(function (data) { + //funcion se ejecuta cuando se carga pantalla + console.log(data); + }) + .catch(function (e) { console.info(e); }); }; - - function addCabecera(label, valor) { - var propiedad = $filter('filter')($scope.cabecera, { label: label }, true); - if (propiedad.length === 1) { - propiedad[0].valor = valor; - } else { - $scope.cabecera.push({ label: label, valor: valor }); - } - } - $scope.rellenar = function (relleno, longitud) { relleno = '' + relleno; while (relleno.length < longitud) { @@ -102,11 +71,9 @@ angular.module('focaHojaRuta') return relleno; }; - $scope.salir = function () { $location.path('/'); }; - $scope.terminarHojaRuta = function () { focaModalService .confirm('¿Desea terminar la hoja de ruta? No podra realizar ninguna ' + @@ -136,7 +103,6 @@ angular.module('focaHojaRuta') ); } }; - $scope.datosExtraCierre = function (terminar) { var modalInstance = $uibModal.open( { @@ -146,7 +112,6 @@ angular.module('focaHojaRuta') ); modalInstance.result.then(terminar); }; - $scope.modalDescargas = function () { delete $scope.hojaRuta.remitos[0].cliente; var remito = $scope.hojaRuta.remitos[0]; @@ -158,7 +123,6 @@ angular.module('focaHojaRuta') ' esta vacía.\n'; else mostrarMensaje = false; - } if (mostrarMensaje === true) { focaModalService.alert(msg); @@ -173,26 +137,32 @@ angular.module('focaHojaRuta') }, } ); - modalInstance.result.then(function (data) { - console.log(data); }); }; - $rootScope.$on('estadoRed', function (event, value) { $scope.estadoRed = value; }); - + function addCabecera(label, valor) { + var propiedad = $filter('filter')($scope.cabecera, { label: label }, true); + if (propiedad.length === 1) { + propiedad[0].valor = valor; + } else { + $scope.cabecera.push({ label: label, valor: valor }); + } + } function getLSHojaRuta() { var hojaRuta = JSON.parse($localStorage.hojaRuta || null); if (hojaRuta) { + console.log('getLSHojaRuta() => ', hojaRuta); $scope.hojaRuta = hojaRuta; delete $localStorage.hojaRuta; } } } - ]); + ] + ); diff --git a/src/views/lista-hoja-ruta.html b/src/views/lista-hoja-ruta.html index 34f180c..d05ef5e 100644 --- a/src/views/lista-hoja-ruta.html +++ b/src/views/lista-hoja-ruta.html @@ -1,4 +1,4 @@ -
+
@@ -59,62 +59,79 @@
-
-
- - - - - - - - - - - - - - - - - - - -
#NúmeroRazon SocialDomicilio 
- -
+
+
+
+ + + + + + + + + + + + + + + + + + +
#NúmeroRazon SocialDomicilio
+
+ + + +
+
+
- - - - - - - - - - - - - - - - - - -
Remito abierto Nº - {{[hojaRuta.remitos[0].sucursal, hojaRuta.remitos[0].numeroRemito] | comprobante}} -
CisternaProductoDisponibles
+
+ + + + + + + + + + + + + + + + + + +
Remito abierto Nº + {{[hojaRuta.remitos[0].sucursal, hojaRuta.remitos[0].numeroRemito] | comprobante}} +
CisternaProductoDisponibles
+
-- 1.9.1