Commit c75172371947d8f45d465d281c30dd8a1437ac38
1 parent
751e6eec4a
Exists in
master
alerta fecha
Showing
1 changed file
with
20 additions
and
26 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -836,34 +836,28 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
| 836 | 836 | }; |
| 837 | 837 | |
| 838 | 838 | $scope.seleccionarFechaEntrega = function () { |
| 839 | + | |
| 839 | 840 | var confirmacion = false; |
| 840 | - var hasVehiculoId = $scope.hojaRuta.vehiculo.id !== undefined; | |
| 841 | - var hasTarifario = $scope.hojaRuta.tarifario !== null; | |
| 842 | - var hasTransportista = Object.keys($scope.hojaRuta.transportista).length > 0; | |
| 843 | - var hasChofer = Object.keys($scope.hojaRuta.chofer).length > 0; | |
| 844 | - var hasDatosExtra = $scope.hojaRuta.datosExtra !== undefined; | |
| 845 | - | |
| 846 | - if (hasVehiculoId || hasTransportista || | |
| 847 | - hasChofer || hasDatosExtra) { | |
| 841 | + | |
| 842 | + if (!angular.equals($scope.hojaRuta, $scope.inicial)) { | |
| 848 | 843 | confirmacion = true; |
| 849 | - if (confirmacion) { | |
| 850 | - focaModalService | |
| 851 | - .confirm('Si cambia la fecha se perderán los datos actuales') | |
| 852 | - .then(function (data) { | |
| 853 | - if (data) { | |
| 854 | - $scope.hojaRuta.vehiculo.id = undefined; | |
| 855 | - $scope.hojaRuta.tarifario = null; | |
| 856 | - $scope.hojaRuta.transportista = {}; | |
| 857 | - $scope.hojaRuta.chofer = {}; | |
| 858 | - $scope.hojaRuta.datosExtra = undefined; | |
| 859 | - elegirFecha(); | |
| 860 | - } | |
| 861 | - }, function () { | |
| 862 | - return; | |
| 863 | - }); | |
| 864 | - } else { | |
| 865 | - elegirFecha(); | |
| 866 | - } | |
| 844 | + } | |
| 845 | + | |
| 846 | + if (confirmacion) { | |
| 847 | + focaModalService | |
| 848 | + .confirm('Si cambia la fecha se perderán los datos actuales') | |
| 849 | + .then(function (data) { | |
| 850 | + if (data) { | |
| 851 | + $scope.hojaRuta.vehiculo.id = undefined; | |
| 852 | + $scope.hojaRuta.tarifario = null; | |
| 853 | + $scope.hojaRuta.transportista = {}; | |
| 854 | + $scope.hojaRuta.chofer = {}; | |
| 855 | + $scope.hojaRuta.datosExtra = undefined; | |
| 856 | + elegirFecha(); | |
| 857 | + } | |
| 858 | + }, function () { | |
| 859 | + return; | |
| 860 | + }); | |
| 867 | 861 | } else { |
| 868 | 862 | elegirFecha(); |
| 869 | 863 | } |