diff --git a/gulpfile.js b/gulpfile.js
index 05e4802..188182c 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -23,7 +23,7 @@ gulp.task('templates', ['clean'], function() {
gulp.src(paths.srcViews),
htmlmin(),
templateCache('views.js', {
- module: 'focaAdminSeguimiento',
+ module: 'focaLogisticaPedidoRuta',
root: ''
}),
gulp.dest(paths.tmp)
@@ -38,10 +38,10 @@ gulp.task('uglify', ['templates'], function() {
paths.srcJS,
'tmp/views.js'
]),
- concat('foca-admin-seguimiento.js'),
+ concat('foca-logistica-pedido-ruta.js'),
replace('src/views/', ''),
gulp.dest(paths.tmp),
- rename('foca-admin-seguimiento.min.js'),
+ rename('foca-logistica-pedido-ruta.min.js'),
uglify(),
replace('"ngRoute","ui.bootstrap"', ''),
gulp.dest(paths.dist)
diff --git a/package.json b/package.json
index 995e9b7..8c7a450 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
- "name": "foca-admin-seguimiento",
+ "name": "foca-logistica-pedido-ruta",
"version": "0.0.2",
- "description": "Seguimiento de actividad",
+ "description": "Logistica de pedidos",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
@@ -15,7 +15,7 @@
],
"repository": {
"type": "git",
- "url": "https://debo.suite.repo/modulos-npm/foca-admin-seguimiento.git"
+ "url": "http://git.focasoftware.com/npm/foca-logistica-pedido-ruta.git"
},
"author": "Foca Software",
"license": "ISC",
@@ -25,10 +25,10 @@
"bootstrap": "^4.1.3",
"font-awesome": "^4.7.0",
"gulp": "^3.9.1",
- "gulp-angular-templatecache": "^2.2.3",
+ "gulp-angular-templatecache": "^2.2.5",
"gulp-clean": "^0.4.0",
"gulp-concat": "^2.6.1",
- "gulp-connect": "^5.6.1",
+ "gulp-connect": "^5.7.0",
"gulp-htmlmin": "^5.0.1",
"gulp-jshint": "^2.1.0",
"gulp-rename": "^1.4.0",
@@ -38,7 +38,7 @@
"gulp-uglify-es": "^1.0.4",
"jasmine-core": "^3.3.0",
"jquery": "^3.3.1",
- "jshint": "^2.9.6",
+ "jshint": "^2.9.7",
"leaflet": "^1.3.4",
"pre-commit": "^1.2.2",
"pump": "^3.0.0",
diff --git a/src/js/app.js b/src/js/app.js
index da5db76..7cbe9a6 100644
--- a/src/js/app.js
+++ b/src/js/app.js
@@ -1,4 +1,4 @@
-angular.module('focaAdminSeguimiento', [
+angular.module('focaLogisticaPedidoRuta', [
'ngRoute',
'ui.bootstrap'
]);
diff --git a/src/js/controller.js b/src/js/controller.js
index d693e5e..8e90f98 100644
--- a/src/js/controller.js
+++ b/src/js/controller.js
@@ -1,35 +1,59 @@
-angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [
- '$scope', 'focaAdminSeguimientoService', '$location', '$routeParams',
- function($scope, focaAdminSeguimientoService, $location, $routeParams) {
+angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [
+ '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter',
+ function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter) {
$scope.actividad = '';
$scope.now = new Date();
-
- if ($routeParams.parametro === 'nota-pedido') {
- $scope.actividad = 'Nota de pedido';
- }
-
- if ($routeParams.parametro === 'hoja-ruta') {
- $scope.actividad = 'Entrega de producto';
- }
-
- if ($routeParams.parametro === 'cobranza') {
- $scope.actividad = 'Cobranza';
- }
-
+ $scope.actividad = 'Nota de pedido';
$scope.idUsuario = 0;
$scope.marcadores = [];
+ $scope.vehiculos = [];
getSeguimiento();
-
+ $scope.arrastrando = false;
$scope.general = function() {
$scope.idUsuario = 0;
getSeguimiento();
};
+ $scope.cargar = function(id, punto) {
+ var marcador = JSON.parse(punto);
+ var vehiculo = $filter('filter')($scope.vehiculos, {id: parseInt(id)})[0];
+ var modalInstance = $uibModal.open(
+ {
+ ariaLabelledBy: 'Busqueda de Vehiculo',
+ templateUrl: 'foca-detalle-vehiculo.html',
+ controller: 'focaDetalleVehiculo',
+ size: 'lg',
+ resolve: {
+ vehiculo: function() {return vehiculo;},
+ marcador: function() {return marcador;}
+ }
+ }
+ );
+ modalInstance.result.then(function() {
+ }, function() {
+ //run when cancel modal
+ });
+ };
+
+ $scope.arrastra = function() {
+ $scope.arrastrando = true;
+ $scope.$digest();
+ };
+
+ $scope.noArrastra = function() {
+ $scope.arrastrando = false;
+ $scope.$digest();
+ };
+
$scope.individual = function() {
$scope.idUsuario = -1;
};
+ $scope.mostrarDetalle = function() {
+ $scope.detalle = true;
+ };
+
$scope.salir = function() {
$location.path('/');
};
@@ -44,7 +68,28 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoControll
$scope.fecha = function() {
getSeguimiento();
};
+
+ $scope.seleccionarVehiculo = function() {
+ var modalInstance = $uibModal.open(
+ {
+ ariaLabelledBy: 'Busqueda de Vehiculo',
+ templateUrl: 'modal-vehiculo.html',
+ controller: 'focaModalVehiculoController',
+ size: 'lg'
+ }
+ );
+
+ modalInstance.result.then(
+ function(vehiculo) {
+ $scope.vehiculos.push(vehiculo);
+ }, function() {
+ // funcion ejecutada cuando se cancela el modal
+ }
+ );
+ };
+
+
function getSeguimiento() {
var now = $scope.now;
var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
@@ -62,7 +107,7 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoControll
individual: $scope.idUsuario !== 0 ? true : false
};
- focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
+ focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
$scope.marcadores = datos.data;
});
diff --git a/src/js/controllerDetalleVehiculo.js b/src/js/controllerDetalleVehiculo.js
new file mode 100644
index 0000000..846c481
--- /dev/null
+++ b/src/js/controllerDetalleVehiculo.js
@@ -0,0 +1,9 @@
+angular.module('focaLogisticaPedidoRuta')
+ .controller('focaDetalleVehiculo', ['$scope', '$uibModalInstance', 'vehiculo', 'marcador',
+ function($scope, $uibModalInstance, vehiculo, marcador) {
+ $scope.articulos = marcador.notaPedido.articulosNotaPedido;
+ $scope.vehiculo = vehiculo;
+ $scope.aceptar = function() {
+ $uibModalInstance.close();
+ };
+ }]);
diff --git a/src/js/osm-directive.js b/src/js/osm-directive.js
index ee1a190..bdbbbf5 100644
--- a/src/js/osm-directive.js
+++ b/src/js/osm-directive.js
@@ -1,4 +1,4 @@
-angular.module('focaAdminSeguimiento').directive('osm', function() {
+angular.module('focaLogisticaPedidoRuta').directive('foca', function() {
return {
restrict: 'E',
link: function(scope, el, attrs) {
@@ -7,105 +7,18 @@ angular.module('focaAdminSeguimiento').directive('osm', function() {
scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map);
},
- controller: ['$scope', '$filter', function($scope, $filter) {
- $scope.markers = [];
+ controller: ['$scope', function($scope) {
+ $scope.markers = [];
$scope.$watch('marcadores', function() {
for(var i in $scope.markers) {
$scope.map.removeLayer($scope.markers[i]);
}
-
$scope.markers = [];
- angular.forEach($scope.marcadores, function(marcador) {
- var observacion = '';
-
- if ($scope.parametros.actividad === 'Nota de pedido') {
- observacion +=
- 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' +
- (
- marcador.notaPedido.vendedor ?
- marcador.notaPedido.vendedor.NomVen :
- ''
- ) + '
';
- observacion += 'Fecha: ' +
- $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
- marcador.fecha.slice(11,19) + '
';
- observacion += 'Nº: ' + $filter('comprobante')([
- marcador.notaPedido.sucursal,
- marcador.notaPedido.numeroNotaPedido
- ]) + '
';
- observacion += 'Cliente: ' +
- marcador.notaPedido.cliente.NOM + '
';
-
- if ($scope.parametros.individual) {
- observacion +=
- 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$');
- observacion = 'Orden: ' + marcador.orden + '
' + observacion;
-
- if (marcador.distancia) {
- observacion += '
Distancia a casa central: ' +
- marcador.distancia + 'km';
- }
- } else {
- observacion += 'Cantidad de nota de pedido: ' +
- marcador.cantidad + '
';
- observacion += 'Total Vendido: ' +
- $filter('currency')(marcador.total, '$');
- }
- }
-
- if ($scope.parametros.actividad === 'Cobranza') {
- observacion += 'Cobrador: ' + marcador.recibo.CFE + '
';
- observacion += 'Fecha: ' +
- $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
- marcador.fecha.slice(11,19) + '
';
- observacion += 'Nº: ' + $filter('comprobante')([
- marcador.sucursal, marcador.idUsuario]) + '
';
- observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '
';
- observacion += 'Total Cobrado: $' + marcador.factura.IPA;
- }
-
- if ($scope.parametros.actividad === 'Entrega de producto') {
- observacion += 'Vehiculo: ' +
- marcador.remito.hojaRuta.idVehiculo + ' - ' +
- marcador.remito.hojaRuta.vehiculo.tractor + '
';
- observacion += 'Transportista: ' +
- marcador.remito.hojaRuta.transportista.NOM + '
';
- observacion += 'Chofer: ' +
- marcador.remito.hojaRuta.chofer.nombre + '
';
- observacion += 'Fecha: ' +
- $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
- marcador.fecha.slice(11,19) + '
';
- observacion += 'Hoja de ruta: ' + $filter('comprobante')([
- marcador.remito.hojaRuta.sucursal,
- marcador.remito.hojaRuta.numeroHojaRuta
- ]) + '
';
- observacion += 'Remito: ' + $filter('comprobante')([
- marcador.remito.sucursal,
- marcador.remito.numeroRemito
- ]) + '
';
- observacion += 'Cliente: ' +
- marcador.remito.cliente.NOM + '
';
-
- if ($scope.parametros.individual) {
- observacion += 'Producto: ' +
- marcador.remito.articulosRemito[0].descripcion + '
';
- observacion += 'Cantidad entregada: ' +
- marcador.remito.carga + '
';
-
- if (marcador.distancia) {
- observacion += 'Distancia a casa central: ' + marcador.distancia +
- 'km
';
- }
-
- if (marcador.observaciones) {
- observacion += 'Observaciones: ' + marcador.observaciones;
- }
- observacion = 'Orden: ' + marcador.orden + '
' + observacion;
- } else {
- observacion += 'Cantidad de entregas: ' + marcador.cantidad;
- }
- }
+ angular.forEach($scope.marcadores, function(marcador) {
+ var observacion = '';
$scope.markers.push(
L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map)
.bindPopup(observacion)
diff --git a/src/js/route.js b/src/js/route.js
index c869d47..4c3752e 100644
--- a/src/js/route.js
+++ b/src/js/route.js
@@ -1,7 +1,7 @@
-angular.module('focaAdminSeguimiento')
+angular.module('focaLogisticaPedidoRuta')
.config(['$routeProvider', function($routeProvider) {
- $routeProvider.when('/admin-seguimiento/:parametro', {
- controller: 'focaAdminSeguimientoController',
- templateUrl: 'src/views/foca-admin-seguimiento.html'
+ $routeProvider.when('/logistica-pedido-ruta', {
+ controller: 'focaLogisticaPedidoRutaController',
+ templateUrl: 'src/views/foca-logistica-pedido-ruta.html'
});
}]);
diff --git a/src/js/service.js b/src/js/service.js
index d1a8620..c6e00f6 100644
--- a/src/js/service.js
+++ b/src/js/service.js
@@ -1,6 +1,6 @@
-angular.module('focaAdminSeguimiento')
+angular.module('focaLogisticaPedidoRuta')
.service(
- 'focaAdminSeguimientoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT
+ 'focaLogisticaPedidoRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT
) {
return {
obtenerActividad: function(parametros) {
diff --git a/src/views/foca-admin-seguimiento.html b/src/views/foca-admin-seguimiento.html
deleted file mode 100644
index 80efdc8..0000000
--- a/src/views/foca-admin-seguimiento.html
+++ /dev/null
@@ -1,63 +0,0 @@
-