Commit d0d403600ade33c33e08410b93d8a64ae03a58b4
1 parent
143e243471
Exists in
master
cambio nombre de archivos
Showing
6 changed files
with
184 additions
and
188 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -90,8 +90,8 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
| 90 | 90 | var modalInstance = $uibModal.open( |
| 91 | 91 | { |
| 92 | 92 | ariaLabelledBy: 'Creación hoja ruta', |
| 93 | - templateUrl: 'foca-modal-crear-hoja-ruta.html', | |
| 94 | - controller: 'focaModalCrearHojaRuta', | |
| 93 | + templateUrl: 'foca-modal-cerrar-vehiculo.html', | |
| 94 | + controller: 'focaModalCerrarVehiculo', | |
| 95 | 95 | size: 'lg', |
| 96 | 96 | resolve: { |
| 97 | 97 | idVehiculo: function() {return vehiculo.id;} |
src/js/controllerCerrarVehiculo.js
| ... | ... | @@ -0,0 +1,86 @@ |
| 1 | +angular.module('focaLogisticaPedidoRuta') | |
| 2 | + .controller('focaModalCerrarVehiculo', [ | |
| 3 | + '$scope', | |
| 4 | + '$uibModalInstance', | |
| 5 | + '$uibModal', | |
| 6 | + 'focaLogisticaPedidoRutaService', | |
| 7 | + 'idVehiculo', | |
| 8 | + 'focaModalService', | |
| 9 | + '$filter', | |
| 10 | + function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService, | |
| 11 | + idVehiculo, focaModalService, $filter) { | |
| 12 | + $scope.vehiculo = {}; | |
| 13 | + $scope.remitos = []; | |
| 14 | + $scope.now = new Date(); | |
| 15 | + focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) { | |
| 16 | + $scope.vehiculo = res.data; | |
| 17 | + }); | |
| 18 | + //TODO: refactor código esta rre feo | |
| 19 | + focaLogisticaPedidoRutaService.getRemitos(idVehiculo).then(function(res) { | |
| 20 | + $scope.remitos = focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data); | |
| 21 | + }); | |
| 22 | + | |
| 23 | + focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) { | |
| 24 | + $scope.sucursal = res.data.sucursal; | |
| 25 | + $scope.numero = res.data.numeroHojaRuta; | |
| 26 | + }); | |
| 27 | + $scope.cancelar = function() { | |
| 28 | + $uibModalInstance.close(); | |
| 29 | + }; | |
| 30 | + $scope.aceptar = function() { | |
| 31 | + var save = { | |
| 32 | + hojaRuta: { | |
| 33 | + id: 0, | |
| 34 | + fechaCreacion: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | |
| 35 | + idTransportista: $scope.vehiculo.idTransportista, | |
| 36 | + idChofer: $scope.chofer.id, | |
| 37 | + idVehiculo: $scope.vehiculo.id, | |
| 38 | + tarifaFlete: $scope.tarifaFlete | |
| 39 | + }, | |
| 40 | + remitos: $scope.remitos, | |
| 41 | + idVehiculo: $scope.vehiculo.id | |
| 42 | + }; | |
| 43 | + focaLogisticaPedidoRutaService.crearHojaRuta(save).then(function() { | |
| 44 | + $uibModalInstance.close(); | |
| 45 | + focaModalService.alert('Hoja de ruta guardada con éxito'); | |
| 46 | + }); | |
| 47 | + }; | |
| 48 | + $scope.seleccionarChofer = function() { | |
| 49 | + var modalInstance = $uibModal.open( | |
| 50 | + { | |
| 51 | + ariaLabelledBy: 'Busqueda de Chofer', | |
| 52 | + templateUrl: 'modal-chofer.html', | |
| 53 | + controller: 'focaModalChoferController', | |
| 54 | + size: 'lg' | |
| 55 | + } | |
| 56 | + ); | |
| 57 | + | |
| 58 | + modalInstance.result.then( | |
| 59 | + function(chofer) { | |
| 60 | + $scope.chofer = chofer; | |
| 61 | + }, function() { | |
| 62 | + // funcion ejecutada cuando se cancela el modal | |
| 63 | + } | |
| 64 | + ); | |
| 65 | + }; | |
| 66 | + $scope.eliminarRemitos = function() { | |
| 67 | + var remitosDel = $filter('filter')($scope.remitos, {checked: true}); | |
| 68 | + focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?') | |
| 69 | + .then(function() { | |
| 70 | + eliminarRemitos(remitosDel); | |
| 71 | + } | |
| 72 | + ); | |
| 73 | + }; | |
| 74 | + $scope.minimoUnoChecked = function() { | |
| 75 | + var remitosChequeados = $filter('filter')($scope.remitos, {checked: true}); | |
| 76 | + return !remitosChequeados.length; | |
| 77 | + }; | |
| 78 | + function eliminarRemitos(remitosDel) { | |
| 79 | + var nuevosRemitos = $filter('filter')($scope.remitos, {checked: !true}); | |
| 80 | + focaLogisticaPedidoRutaService.desasociarRemitos(remitosDel, $scope.vehiculo.id, | |
| 81 | + nuevosRemitos ? true : false).then(function() { | |
| 82 | + focaModalService.alert('Remitos desasociados con éxito'); | |
| 83 | + $scope.remitos = nuevosRemitos; | |
| 84 | + }); | |
| 85 | + } | |
| 86 | + }]); |
src/js/controllerHojaRuta.js
| ... | ... | @@ -1,86 +0,0 @@ |
| 1 | -angular.module('focaLogisticaPedidoRuta') | |
| 2 | - .controller('focaModalCrearHojaRuta', [ | |
| 3 | - '$scope', | |
| 4 | - '$uibModalInstance', | |
| 5 | - '$uibModal', | |
| 6 | - 'focaLogisticaPedidoRutaService', | |
| 7 | - 'idVehiculo', | |
| 8 | - 'focaModalService', | |
| 9 | - '$filter', | |
| 10 | - function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService, | |
| 11 | - idVehiculo, focaModalService, $filter) { | |
| 12 | - $scope.vehiculo = {}; | |
| 13 | - $scope.remitos = []; | |
| 14 | - $scope.now = new Date(); | |
| 15 | - focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) { | |
| 16 | - $scope.vehiculo = res.data; | |
| 17 | - }); | |
| 18 | - //TODO: refactor código esta rre feo | |
| 19 | - focaLogisticaPedidoRutaService.getRemitos(idVehiculo).then(function(res) { | |
| 20 | - $scope.remitos = focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data); | |
| 21 | - }); | |
| 22 | - | |
| 23 | - focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) { | |
| 24 | - $scope.sucursal = res.data.sucursal; | |
| 25 | - $scope.numero = res.data.numeroHojaRuta; | |
| 26 | - }); | |
| 27 | - $scope.cancelar = function() { | |
| 28 | - $uibModalInstance.close(); | |
| 29 | - }; | |
| 30 | - $scope.aceptar = function() { | |
| 31 | - var save = { | |
| 32 | - hojaRuta: { | |
| 33 | - id: 0, | |
| 34 | - fechaCreacion: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | |
| 35 | - idTransportista: $scope.vehiculo.idTransportista, | |
| 36 | - idChofer: $scope.chofer.id, | |
| 37 | - idVehiculo: $scope.vehiculo.id, | |
| 38 | - tarifaFlete: $scope.tarifaFlete | |
| 39 | - }, | |
| 40 | - remitos: $scope.remitos, | |
| 41 | - idVehiculo: $scope.vehiculo.id | |
| 42 | - }; | |
| 43 | - focaLogisticaPedidoRutaService.crearHojaRuta(save).then(function() { | |
| 44 | - $uibModalInstance.close(); | |
| 45 | - focaModalService.alert('Hoja de ruta guardada con éxito'); | |
| 46 | - }); | |
| 47 | - }; | |
| 48 | - $scope.seleccionarChofer = function() { | |
| 49 | - var modalInstance = $uibModal.open( | |
| 50 | - { | |
| 51 | - ariaLabelledBy: 'Busqueda de Chofer', | |
| 52 | - templateUrl: 'modal-chofer.html', | |
| 53 | - controller: 'focaModalChoferController', | |
| 54 | - size: 'lg' | |
| 55 | - } | |
| 56 | - ); | |
| 57 | - | |
| 58 | - modalInstance.result.then( | |
| 59 | - function(chofer) { | |
| 60 | - $scope.chofer = chofer; | |
| 61 | - }, function() { | |
| 62 | - // funcion ejecutada cuando se cancela el modal | |
| 63 | - } | |
| 64 | - ); | |
| 65 | - }; | |
| 66 | - $scope.eliminarRemitos = function() { | |
| 67 | - var remitosDel = $filter('filter')($scope.remitos, {checked: true}); | |
| 68 | - focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?') | |
| 69 | - .then(function() { | |
| 70 | - eliminarRemitos(remitosDel); | |
| 71 | - } | |
| 72 | - ); | |
| 73 | - }; | |
| 74 | - $scope.minimoUnoChecked = function() { | |
| 75 | - var remitosChequeados = $filter('filter')($scope.remitos, {checked: true}); | |
| 76 | - return !remitosChequeados.length; | |
| 77 | - }; | |
| 78 | - function eliminarRemitos(remitosDel) { | |
| 79 | - var nuevosRemitos = $filter('filter')($scope.remitos, {checked: !true}); | |
| 80 | - focaLogisticaPedidoRutaService.desasociarRemitos(remitosDel, $scope.vehiculo.id, | |
| 81 | - nuevosRemitos ? true : false).then(function() { | |
| 82 | - focaModalService.alert('Remitos desasociados con éxito'); | |
| 83 | - $scope.remitos = nuevosRemitos; | |
| 84 | - }); | |
| 85 | - } | |
| 86 | - }]); |
src/views/foca-logistica-pedido-ruta.html
src/views/foca-modal-cerrar-vehiculo.html
| ... | ... | @@ -0,0 +1,95 @@ |
| 1 | +<div class="modal-header"> | |
| 2 | + <h5>En desarrollo</h5> | |
| 3 | + <h4>Cerrar vehículo</h4> | |
| 4 | + <div class="row"> | |
| 5 | + <div class="col-6 row"> | |
| 6 | + <label class="col-3 mt-2">Fecha:</label> | |
| 7 | + <input | |
| 8 | + type="text" | |
| 9 | + readonly | |
| 10 | + ng-model="now" | |
| 11 | + uib-datepicker-popup="dd/MM/yyyy" | |
| 12 | + show-button-bar="false" | |
| 13 | + is-open="datepickerOpen" | |
| 14 | + on-open-focus="false" | |
| 15 | + ng-focus="datepickerOpen = true" | |
| 16 | + datepicker-options="dateOptions" | |
| 17 | + class="form-control col-8"/> | |
| 18 | + </div> | |
| 19 | + </div> | |
| 20 | +</div> | |
| 21 | +<div class="modal-body"> | |
| 22 | + <form class="row" name="formHojaRuta"> | |
| 23 | + | |
| 24 | + <div class="col-2"> | |
| 25 | + <label>Transportista</label> | |
| 26 | + </div> | |
| 27 | + <div class="col-4"> | |
| 28 | + <input | |
| 29 | + class="form-control" | |
| 30 | + readonly | |
| 31 | + ng-value="vehiculo.transportista.COD + ' ' + vehiculo.transportista.NOM" | |
| 32 | + > | |
| 33 | + </div> | |
| 34 | + <div class="col-2 form-group"> | |
| 35 | + <label>Unidad</label> | |
| 36 | + </div> | |
| 37 | + <div class="col-4"> | |
| 38 | + <input | |
| 39 | + class="form-control" | |
| 40 | + readonly | |
| 41 | + ng-model="vehiculo.tractor" | |
| 42 | + > | |
| 43 | + </div> | |
| 44 | + </form> | |
| 45 | + <strong>Remitos:</strong> | |
| 46 | + <table class="table"> | |
| 47 | + <thead> | |
| 48 | + <tr> | |
| 49 | + <th>Remito Nº</th> | |
| 50 | + <th>Cliente</th> | |
| 51 | + <th>Domicilio de entrega</th> | |
| 52 | + </tr> | |
| 53 | + </thead> | |
| 54 | + <tbody> | |
| 55 | + <tr ng-show="!remitos.length"> | |
| 56 | + <td colspan="3"> | |
| 57 | + No se han encontrado remitos. | |
| 58 | + </td> | |
| 59 | + </tr> | |
| 60 | + <tr ng-repeat="remito in remitos"> | |
| 61 | + <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> | |
| 62 | + <td ng-bind="remito.nombreCliente"></td> | |
| 63 | + <td ng-bind="remito.domicilioStamp"></td> | |
| 64 | + <td> | |
| 65 | + <div class="custom-control custom-checkbox"> | |
| 66 | + <input | |
| 67 | + type="checkbox" | |
| 68 | + ng-model="remito.checked" | |
| 69 | + class="custom-control-input" | |
| 70 | + id="{{remito.id}}"> | |
| 71 | + <label class="custom-control-label" for="{{remito.id}}"></label> | |
| 72 | + </div> | |
| 73 | + </td> | |
| 74 | + </tr> | |
| 75 | + </tbody> | |
| 76 | + </table> | |
| 77 | +</div> | |
| 78 | +<div class="modal-footer py-1"> | |
| 79 | + <button | |
| 80 | + class="btn btn-sm btn-danger" | |
| 81 | + type="button" | |
| 82 | + ng-click="eliminarRemitos()" | |
| 83 | + ng-disabled="minimoUnoChecked()">Eliminar</button> | |
| 84 | + <button | |
| 85 | + class="btn btn-sm btn-secondary" | |
| 86 | + ladda="cargando" | |
| 87 | + type="button" | |
| 88 | + ng-click="cancelar()">Cancelar</button> | |
| 89 | + <button | |
| 90 | + class="btn btn-sm btn-primary" | |
| 91 | + ladda="cargando" | |
| 92 | + type="button" | |
| 93 | + ng-disabled="!formHojaRuta.$valid || !remitos.length || true" | |
| 94 | + ng-click="aceptar()">Cerrar distribución</button> | |
| 95 | +</div> |
src/views/foca-modal-crear-hoja-ruta.html
| ... | ... | @@ -1,99 +0,0 @@ |
| 1 | -<div class="modal-header"> | |
| 2 | - <h5>En desarrollo</h5> | |
| 3 | - <h4>Confirmar hoja de ruta</h4> | |
| 4 | - <div class="row"> | |
| 5 | - <!-- <div class="col-6"> | |
| 6 | - <span>Hoja de ruta Nº </span> | |
| 7 | - <strong ng-bind="[sucursal, numero] | comprobante"></strong> | |
| 8 | - </div> --> | |
| 9 | - <div class="col-6 row"> | |
| 10 | - <label class="col-3 mt-2">Fecha:</label> | |
| 11 | - <input | |
| 12 | - type="text" | |
| 13 | - readonly | |
| 14 | - ng-model="now" | |
| 15 | - uib-datepicker-popup="dd/MM/yyyy" | |
| 16 | - show-button-bar="false" | |
| 17 | - is-open="datepickerOpen" | |
| 18 | - on-open-focus="false" | |
| 19 | - ng-focus="datepickerOpen = true" | |
| 20 | - datepicker-options="dateOptions" | |
| 21 | - class="form-control col-8"/> | |
| 22 | - </div> | |
| 23 | - </div> | |
| 24 | -</div> | |
| 25 | -<div class="modal-body"> | |
| 26 | - <form class="row" name="formHojaRuta"> | |
| 27 | - | |
| 28 | - <div class="col-2"> | |
| 29 | - <label>Transportista</label> | |
| 30 | - </div> | |
| 31 | - <div class="col-4"> | |
| 32 | - <input | |
| 33 | - class="form-control" | |
| 34 | - readonly | |
| 35 | - ng-value="vehiculo.transportista.COD + ' ' + vehiculo.transportista.NOM" | |
| 36 | - > | |
| 37 | - </div> | |
| 38 | - <div class="col-2 form-group"> | |
| 39 | - <label>Unidad</label> | |
| 40 | - </div> | |
| 41 | - <div class="col-4"> | |
| 42 | - <input | |
| 43 | - class="form-control" | |
| 44 | - readonly | |
| 45 | - ng-model="vehiculo.tractor" | |
| 46 | - > | |
| 47 | - </div> | |
| 48 | - </form> | |
| 49 | - <strong>Remitos:</strong> | |
| 50 | - <table class="table"> | |
| 51 | - <thead> | |
| 52 | - <tr> | |
| 53 | - <th>Remito Nº</th> | |
| 54 | - <th>Cliente</th> | |
| 55 | - <th>Domicilio de entrega</th> | |
| 56 | - </tr> | |
| 57 | - </thead> | |
| 58 | - <tbody> | |
| 59 | - <tr ng-show="!remitos.length"> | |
| 60 | - <td colspan="3"> | |
| 61 | - No se han encontrado remitos. | |
| 62 | - </td> | |
| 63 | - </tr> | |
| 64 | - <tr ng-repeat="remito in remitos"> | |
| 65 | - <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> | |
| 66 | - <td ng-bind="remito.nombreCliente"></td> | |
| 67 | - <td ng-bind="remito.domicilioStamp"></td> | |
| 68 | - <td> | |
| 69 | - <div class="custom-control custom-checkbox"> | |
| 70 | - <input | |
| 71 | - type="checkbox" | |
| 72 | - ng-model="remito.checked" | |
| 73 | - class="custom-control-input" | |
| 74 | - id="{{remito.id}}"> | |
| 75 | - <label class="custom-control-label" for="{{remito.id}}"></label> | |
| 76 | - </div> | |
| 77 | - </td> | |
| 78 | - </tr> | |
| 79 | - </tbody> | |
| 80 | - </table> | |
| 81 | -</div> | |
| 82 | -<div class="modal-footer py-1"> | |
| 83 | - <button | |
| 84 | - class="btn btn-sm btn-danger" | |
| 85 | - type="button" | |
| 86 | - ng-click="eliminarRemitos()" | |
| 87 | - ng-disabled="minimoUnoChecked()">Eliminar</button> | |
| 88 | - <button | |
| 89 | - class="btn btn-sm btn-secondary" | |
| 90 | - ladda="cargando" | |
| 91 | - type="button" | |
| 92 | - ng-click="cancelar()">Cancelar</button> | |
| 93 | - <button | |
| 94 | - class="btn btn-sm btn-primary" | |
| 95 | - ladda="cargando" | |
| 96 | - type="button" | |
| 97 | - ng-disabled="!formHojaRuta.$valid || !remitos.length || true" | |
| 98 | - ng-click="aceptar()">Confirmar hoja ruta</button> | |
| 99 | -</div> |