Commit c86c4954e2cabc93850186c4b19fab112078b561
1 parent
7efca250b0
Exists in
master
primer commit
Showing
8 changed files
with
189 additions
and
3 deletions
Show diff stats
gulpfile.js
| ... | ... | @@ -2,7 +2,7 @@ const templateCache = require('gulp-angular-templatecache'); |
| 2 | 2 | const concat = require('gulp-concat'); |
| 3 | 3 | const htmlmin = require('gulp-htmlmin'); |
| 4 | 4 | const rename = require('gulp-rename'); |
| 5 | -const uglify = require('gulp-uglify-es').default; | |
| 5 | +const uglify = require('gulp-uglify'); | |
| 6 | 6 | const gulp = require('gulp'); |
| 7 | 7 | const pump = require('pump'); |
| 8 | 8 | const jshint = require('gulp-jshint'); |
| ... | ... | @@ -40,7 +40,7 @@ gulp.task('uglify', ['templates'], function() { |
| 40 | 40 | 'tmp/views.js' |
| 41 | 41 | ]), |
| 42 | 42 | concat('foca-activar-hoja-ruta.js'), |
| 43 | - replace("['ngRoute', 'focaModal', 'ui.bootstrap']", '[]'), | |
| 43 | + replace("['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']", '[]'), | |
| 44 | 44 | replace("src/views/", ''), |
| 45 | 45 | gulp.dest(paths.tmp), |
| 46 | 46 | rename('foca-activar-hoja-ruta.min.js'), |
package.json
src/etc/develop.js.ejemplo
src/js/app.js
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +angular.module('focaActivarHojaRuta', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']); |
src/js/controller.js
| ... | ... | @@ -0,0 +1,108 @@ |
| 1 | +angular.module('focaActivarHojaRuta') | |
| 2 | + .controller('focaActivarHojaRutaController', [ | |
| 3 | + '$scope', 'focaActivarHojaRutaService', '$location', 'focaModalService', | |
| 4 | + '$uibModal', 'focaBotoneraLateralService', '$timeout', | |
| 5 | + function($scope, focaActivarHojaRutaService, $location, focaModalService, | |
| 6 | + $uibModal, focaBotoneraLateralService, $timeout) { | |
| 7 | + config(); | |
| 8 | + | |
| 9 | + //METODOS | |
| 10 | + function config() { | |
| 11 | + $scope.botonera = [{ | |
| 12 | + label: 'Chofer', | |
| 13 | + image: 'cliente.png' | |
| 14 | + }]; | |
| 15 | + //SETEO BOTONERA LATERAL | |
| 16 | + focaBotoneraLateralService.showSalir(true); | |
| 17 | + focaBotoneraLateralService.showPausar(false); | |
| 18 | + focaBotoneraLateralService.showCancelar(false); | |
| 19 | + focaBotoneraLateralService.showGuardar(false); | |
| 20 | + | |
| 21 | + init(); | |
| 22 | + } | |
| 23 | + | |
| 24 | + function init() { | |
| 25 | + $scope.now = new Date(); | |
| 26 | + $scope.hojasRuta = []; | |
| 27 | + $scope.$broadcast('removeCabecera', 'Chofer:'); | |
| 28 | + } | |
| 29 | + | |
| 30 | + $scope.seleccionarChofer = function() { | |
| 31 | + var modalInstance = $uibModal.open( | |
| 32 | + { | |
| 33 | + ariaLabelledBy: 'Busqueda de Chofer', | |
| 34 | + templateUrl: 'modal-chofer.html', | |
| 35 | + controller: 'focaModalChoferController', | |
| 36 | + size: 'lg' | |
| 37 | + } | |
| 38 | + ); | |
| 39 | + modalInstance.result.then( | |
| 40 | + function(chofer) { | |
| 41 | + $scope.chofer = chofer.id; | |
| 42 | + focaActivarHojaRutaService.getHojasRutas($scope.chofer) | |
| 43 | + .then(function(hojasRutas) { | |
| 44 | + $scope.$broadcast('addCabecera', { | |
| 45 | + label: 'Chofer:', | |
| 46 | + valor: $scope.chofer + ' - ' + chofer.nombre | |
| 47 | + }); | |
| 48 | + | |
| 49 | + $scope.hojasRuta = hojasRutas.data; | |
| 50 | + }) | |
| 51 | + }, function() { | |
| 52 | + | |
| 53 | + } | |
| 54 | + ); | |
| 55 | + }; | |
| 56 | + | |
| 57 | + $scope.activarHojaRuta = function(hoja_ruta_id) { | |
| 58 | + focaActivarHojaRutaService.activarHojaRuta(hoja_ruta_id, $scope.chofer) | |
| 59 | + .then(function(hojaRuta) { | |
| 60 | + init(); | |
| 61 | + focaModalService.alert('Hoja de ruta activada'); | |
| 62 | + }) | |
| 63 | + } | |
| 64 | + | |
| 65 | + | |
| 66 | + /* | |
| 67 | + | |
| 68 | + if(focaActivarHojaRutaService.transportistaSeleccionado.COD) { | |
| 69 | + elegirTransportista(focaActivarHojaRutaService.transportistaSeleccionado); | |
| 70 | + } | |
| 71 | + focaActivarHojaRutaService.cleanCisternasLocal(); | |
| 72 | + $scope.editar = function(id) { | |
| 73 | + $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | |
| 74 | + }; | |
| 75 | + $scope.solicitarConfirmacion = function(vehiculo) { | |
| 76 | + focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | |
| 77 | + vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | |
| 78 | + function(data) { | |
| 79 | + if(data) { | |
| 80 | + focaActivarHojaRutaService.deleteVehiculo(vehiculo.id); | |
| 81 | + $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | |
| 82 | + } | |
| 83 | + } | |
| 84 | + ); | |
| 85 | + }; | |
| 86 | + | |
| 87 | + function elegirTransportista(transportista) { | |
| 88 | + var codigo = ('00000' + transportista.COD).slice(-5); | |
| 89 | + $scope.idTransportista = transportista.COD; | |
| 90 | + $scope.filtros = transportista.NOM.trim(); | |
| 91 | + $timeout(function() { | |
| 92 | + $scope.$broadcast('addCabecera', { | |
| 93 | + label: 'Transportista:', | |
| 94 | + valor: codigo + ' - ' + transportista.NOM | |
| 95 | + }); | |
| 96 | + }); | |
| 97 | + buscar(transportista.COD); | |
| 98 | + } | |
| 99 | + | |
| 100 | + function buscar(idTransportista) { | |
| 101 | + focaActivarHojaRutaService | |
| 102 | + .getVehiculosPorTransportista(idTransportista) | |
| 103 | + .then(function(datos) { | |
| 104 | + $scope.vehiculos = datos.data; | |
| 105 | + }); | |
| 106 | + }*/ | |
| 107 | + } | |
| 108 | + ]); |
src/js/route.js
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +angular.module('focaActivarHojaRuta') | |
| 2 | + .config([ | |
| 3 | + '$routeProvider', | |
| 4 | + function($routeProvider) { | |
| 5 | + $routeProvider.when('/hoja-ruta/activar', { | |
| 6 | + controller: 'focaActivarHojaRutaController', | |
| 7 | + templateUrl: 'src/views/activar-hoja-ruta.html' | |
| 8 | + }); | |
| 9 | + } | |
| 10 | + ]); |
src/js/service.js
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +angular.module('focaActivarHojaRuta') | |
| 2 | + .factory('focaActivarHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | |
| 3 | + return { | |
| 4 | + getHojasRutas: function(chofer) { | |
| 5 | + return $http.get(API_ENDPOINT.URL + '/hoja-ruta/disponible/' + chofer); | |
| 6 | + }, | |
| 7 | + activarHojaRuta: function(hoja_ruta, chofer) { | |
| 8 | + return $http.get(API_ENDPOINT.URL + '/hoja-ruta/activar/' + hoja_ruta + '/' + chofer); | |
| 9 | + } | |
| 10 | + }; | |
| 11 | + }]); |
src/views/activar-hoja-ruta.html
| ... | ... | @@ -0,0 +1,52 @@ |
| 1 | +<div class="row"> | |
| 2 | + <foca-cabecera-facturador | |
| 3 | + titulo="'Activar Hoja de Ruta'" | |
| 4 | + fecha="now" | |
| 5 | + class="mb-0 col-lg-12" | |
| 6 | + ></foca-cabecera-facturador> | |
| 7 | +</div> | |
| 8 | +<div class="row"> | |
| 9 | + <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | |
| 10 | + <div class="row px-5 py-2 botonera-secundaria"> | |
| 11 | + <div class="col-12"> | |
| 12 | + <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 15 | + <!-- <div class="col-6 form-group"> | |
| 16 | + <input seleccionarTransportista() | |
| 17 | + type="text" | |
| 18 | + teclado-virtual | |
| 19 | + class="form-control form-control-sm" | |
| 20 | + placeholder="Búsqueda" | |
| 21 | + ng-model="filtros" | |
| 22 | + /> | |
| 23 | + </div> --> | |
| 24 | + <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | |
| 25 | + <thead> | |
| 26 | + <tr> | |
| 27 | + <th>Número</th> | |
| 28 | + <th>Fecha</th> | |
| 29 | + <th>Remitos</th> | |
| 30 | + <th class="text-center"> | |
| 31 | + </th> | |
| 32 | + </tr> | |
| 33 | + </thead> | |
| 34 | + <tbody> | |
| 35 | + <tr ng-repeat="hojaRuta in hojasRuta | filter:filtros"> | |
| 36 | + <td ng-bind="[hojaRuta.sucursal, hojaRuta.numeroHojaRuta] | comprobante"></td> | |
| 37 | + <td ng-bind="hojaRuta.fechaReparto | date:'yyyy-MM-dd'"></td> | |
| 38 | + <td ng-bind="hojaRuta.remitos.length"></td> | |
| 39 | + <td class="text-center"> | |
| 40 | + <button | |
| 41 | + class="btn btn-outline-dark boton-accion" | |
| 42 | + title="Editar" | |
| 43 | + ng-click="activarHojaRuta(hojaRuta.id)" | |
| 44 | + > | |
| 45 | + <i class="fa fa-check"></i> | |
| 46 | + </button> | |
| 47 | + </td> | |
| 48 | + </tr> | |
| 49 | + </body> | |
| 50 | + </table> | |
| 51 | + </div> | |
| 52 | +</div> |