Commit 304ab2418e0ab32abc13439ec3486604b9f803c3
1 parent
61c9443742
Exists in
master
pre-commit
Showing
2 changed files
with
10 additions
and
10 deletions
Show diff stats
src/js/controller.js
| 1 | angular.module('focaHojaRuta') | 1 | angular.module('focaHojaRuta') |
| 2 | .controller('listaHojaRutaCtrl', | 2 | .controller('listaHojaRutaCtrl', |
| 3 | [ | 3 | [ |
| 4 | '$scope', '$filter', '$uibModal', 'hojaRutaService', | 4 | '$scope', '$filter', '$uibModal', 'hojaRutaService', |
| 5 | function($scope, $filter, $uibModal, hojaRutaService) { | 5 | function($scope, $filter, $uibModal, hojaRutaService) { |
| 6 | hojaRutaService.getHojasRuta().then(function(res) { | 6 | hojaRutaService.getHojasRuta().then(function(res) { |
| 7 | $scope.hojasRuta = res.data; | 7 | $scope.hojasRuta = res.data; |
| 8 | $scope.puntoVenta = rellenar(res.data[0].sucursal, 4); | 8 | $scope.puntoVenta = rellenar(res.data[0].sucursal, 4); |
| 9 | $scope.comprobante = rellenar(res.data[0].numeroHojaRuta, 8); | 9 | $scope.comprobante = rellenar(res.data[0].numeroHojaRuta, 8); |
| 10 | }); | 10 | }); |
| 11 | $scope.cabecera = []; | 11 | $scope.cabecera = []; |
| 12 | $scope.showCabecera = true; | 12 | $scope.showCabecera = true; |
| 13 | addCabecera('Transportista:', 'Andesmar'); | 13 | addCabecera('Transportista:', 'Andesmar'); |
| 14 | addCabecera('Chofer:', 'Carlos'); | 14 | addCabecera('Chofer:', 'Carlos'); |
| 15 | addCabecera('Vehículo:', 'SCANIA'); | 15 | addCabecera('Vehículo:', 'SCANIA'); |
| 16 | $scope.now = new Date(); | 16 | $scope.now = new Date(); |
| 17 | $scope.puntoVenta = '0000'; | 17 | $scope.puntoVenta = '0000'; |
| 18 | $scope.comprobante = '00000000'; | 18 | $scope.comprobante = '00000000'; |
| 19 | $scope.verDetalle = function(hojaRuta) { | 19 | $scope.verDetalle = function() { |
| 20 | var modalInstance = $uibModal.open( | 20 | var modalInstance = $uibModal.open( |
| 21 | { | 21 | { |
| 22 | ariaLabelledBy: 'Detalle hoja ruta', | 22 | ariaLabelledBy: 'Detalle hoja ruta', |
| 23 | templateUrl: 'modal-detalle-hoja-ruta.html', | 23 | templateUrl: 'modal-detalle-hoja-ruta.html', |
| 24 | controller: 'focaModalDetalleHojaRutaController', | 24 | controller: 'focaModalDetalleHojaRutaController', |
| 25 | resolve: { | 25 | resolve: { |
| 26 | parametrosDetalleHojaRuta: function(){ | 26 | parametrosDetalleHojaRuta: function(){ |
| 27 | return { | 27 | return { |
| 28 | remito: '00001-00000001', | 28 | remito: '00001-00000001', |
| 29 | cliente: 'Rubén Gomez', | 29 | cliente: 'Rubén Gomez', |
| 30 | domicilio: 'Patricias Mendocinas 5050', | 30 | domicilio: 'Patricias Mendocinas 5050', |
| 31 | producto: 'Super', | 31 | producto: 'Super', |
| 32 | litros: 20 | 32 | litros: 20 |
| 33 | }; | 33 | }; |
| 34 | } | 34 | } |
| 35 | }, | 35 | }, |
| 36 | size: 'lg' | 36 | size: 'lg' |
| 37 | } | 37 | } |
| 38 | ); | 38 | ); |
| 39 | modalInstance.result.then(function() { | 39 | modalInstance.result.then(function() { |
| 40 | 40 | ||
| 41 | }) | 41 | }); |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | function addCabecera(label, valor) { | 44 | function addCabecera(label, valor) { |
| 45 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 45 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 46 | if(propiedad.length === 1) { | 46 | if(propiedad.length === 1) { |
| 47 | propiedad[0].valor = valor; | 47 | propiedad[0].valor = valor; |
| 48 | } else { | 48 | } else { |
| 49 | $scope.cabecera.push({label: label, valor: valor}); | 49 | $scope.cabecera.push({label: label, valor: valor}); |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | 52 | //TODO Descomentar cuando se use | |
| 53 | function removeCabecera(label) { | 53 | // function removeCabecera(label) { |
| 54 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 54 | // var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 55 | if(propiedad.length === 1) { | 55 | // if(propiedad.length === 1) { |
| 56 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 56 | // $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 57 | } | 57 | // } |
| 58 | } | 58 | // } |
| 59 | 59 | ||
| 60 | function rellenar(relleno, longitud) { | 60 | function rellenar(relleno, longitud) { |
| 61 | relleno = '' + relleno; | 61 | relleno = '' + relleno; |
| 62 | while (relleno.length < longitud) { | 62 | while (relleno.length < longitud) { |
| 63 | relleno = '0' + relleno; | 63 | relleno = '0' + relleno; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | return relleno; | 66 | return relleno; |
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | ]); | 69 | ]); |
| 70 | 70 | ||
| 71 | 71 |
src/views/lista-hoja-ruta.html
| 1 | <div> | 1 | <div> |
| 2 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 2 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
| 3 | <div class="row p-1 panel-informativo"> | 3 | <div class="row p-1 panel-informativo"> |
| 4 | <div class="col-12"> | 4 | <div class="col-12"> |
| 5 | <div class="row"> | 5 | <div class="row"> |
| 6 | <div class="col-12 col-sm-4 nota-pedido"> | 6 | <div class="col-12 col-sm-4 nota-pedido"> |
| 7 | <h5>Hojas de ruta</h5> | 7 | <h5>Hojas de ruta</h5> |
| 8 | </div> | 8 | </div> |
| 9 | <div class="col-5 col-sm-4 numero-pedido" | 9 | <div class="col-5 col-sm-4 numero-pedido" |
| 10 | >Nº {{puntoVenta}}-{{comprobante}} | 10 | >Nº {{puntoVenta}}-{{comprobante}} |
| 11 | </div> | 11 | </div> |
| 12 | <div class="col-7 col-sm-4 text-right"> | 12 | <div class="col-7 col-sm-4 text-right"> |
| 13 | Fecha: | 13 | Fecha: |
| 14 | <span | 14 | <span |
| 15 | ng-show="!datepickerAbierto" | 15 | ng-show="!datepickerAbierto" |
| 16 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" | 16 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" |
| 17 | ng-click="datepickerAbierto = true" | 17 | ng-click="datepickerAbierto = true" |
| 18 | > | 18 | > |
| 19 | </span> | 19 | </span> |
| 20 | <input | 20 | <input |
| 21 | ng-show="datepickerAbierto" | 21 | ng-show="datepickerAbierto" |
| 22 | type="date" | 22 | type="date" |
| 23 | ng-model="now" | 23 | ng-model="now" |
| 24 | ng-change="datepickerAbierto = false" | 24 | ng-change="datepickerAbierto = false" |
| 25 | ng-blur="datepickerAbierto = false" | 25 | ng-blur="datepickerAbierto = false" |
| 26 | class="form-control form-control-sm col-8 float-right" | 26 | class="form-control form-control-sm col-8 float-right" |
| 27 | foca-focus="datepickerAbierto" | 27 | foca-focus="datepickerAbierto" |
| 28 | hasta-hoy | 28 | hasta-hoy |
| 29 | /> | 29 | /> |
| 30 | </div> | 30 | </div> |
| 31 | </div> | 31 | </div> |
| 32 | <div class="row"> | 32 | <div class="row"> |
| 33 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 33 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
| 34 | <span class="label" ng-bind="cab.label"></span> | 34 | <span class="label" ng-bind="cab.label"></span> |
| 35 | <span class="valor" ng-bind="cab.valor"></span> | 35 | <span class="valor" ng-bind="cab.valor"></span> |
| 36 | </div> | 36 | </div> |
| 37 | <a | 37 | <a |
| 38 | class="btn col-12 btn-secondary d-sm-none" | 38 | class="btn col-12 btn-secondary d-sm-none" |
| 39 | ng-show="cabecera.length > 0" | 39 | ng-show="cabecera.length > 0" |
| 40 | ng-click="showCabecera = !showCabecera" | 40 | ng-click="showCabecera = !showCabecera" |
| 41 | > | 41 | > |
| 42 | <i | 42 | <i |
| 43 | class="fa fa-chevron-down" | 43 | class="fa fa-chevron-down" |
| 44 | ng-hide="showCabecera" | 44 | ng-hide="showCabecera" |
| 45 | aria-hidden="true" | 45 | aria-hidden="true" |
| 46 | > | 46 | > |
| 47 | </i> | 47 | </i> |
| 48 | <i | 48 | <i |
| 49 | class="fa fa-chevron-up" | 49 | class="fa fa-chevron-up" |
| 50 | ng-show="showCabecera" | 50 | ng-show="showCabecera" |
| 51 | aria-hidden="true"> | 51 | aria-hidden="true"> |
| 52 | </i> | 52 | </i> |
| 53 | </a> | 53 | </a> |
| 54 | </div> | 54 | </div> |
| 55 | </div> | 55 | </div> |
| 56 | </div> | 56 | </div> |
| 57 | <div class="row p-1 botonera-secundaria"> | 57 | <div class="row p-1 botonera-secundaria"> |
| 58 | <div class="col-12"> | 58 | <div class="col-12"> |
| 59 | <div class="row"> | 59 | <div class="row"> |
| 60 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | 60 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> |
| 61 | <button | 61 | <button |
| 62 | type="button" | 62 | type="button" |
| 63 | class="btn btn-default btn-block btn-xs text-left py-2" | 63 | class="btn btn-default btn-block btn-xs text-left py-2" |
| 64 | ng-click="boton.accion()" | 64 | ng-click="boton.accion()" |
| 65 | ng-class="{'d-none d-sm-block': boton.texto == ''}" | 65 | ng-class="{'d-none d-sm-block': boton.texto == ''}" |
| 66 | > | 66 | > |
| 67 | <i | 67 | <i |
| 68 | class="fa fa-arrow-circle-right" | 68 | class="fa fa-arrow-circle-right" |
| 69 | ng-show="boton.texto != ''" | 69 | ng-show="boton.texto != ''" |
| 70 | ></i> | 70 | ></i> |
| 71 | | 71 | |
| 72 | {{boton.texto}} | 72 | {{boton.texto}} |
| 73 | </button> | 73 | </button> |
| 74 | </div> | 74 | </div> |
| 75 | </div> | 75 | </div> |
| 76 | </div> | 76 | </div> |
| 77 | </div> | 77 | </div> |
| 78 | </div> | 78 | </div> |
| 79 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 79 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
| 80 | <div class="row grilla-articulo d-none d-sm-flex"> | 80 | <div class="row grilla-articulo d-none d-sm-flex"> |
| 81 | <table class="table tabla-articulo table-striped table-sm table-dark"> | 81 | <table class="table tabla-articulo table-striped table-sm table-dark"> |
| 82 | <thead> | 82 | <thead> |
| 83 | <tr class="d-flex"> | 83 | <tr class="d-flex"> |
| 84 | <th>#</th> | 84 | <th>#</th> |
| 85 | <th>Fecha creacion</th> | 85 | <th>Fecha creacion</th> |
| 86 | <th>sucursal</th> | 86 | <th>sucursal</th> |
| 87 | <th>idTransportista</th> | 87 | <th>idTransportista</th> |
| 88 | <th>idChofer</th> | 88 | <th>idChofer</th> |
| 89 | <th>idVeh?culo</th> | 89 | <th>idVehiculo</th> |
| 90 | <th></th> | 90 | <th></th> |
| 91 | </tr> | 91 | </tr> |
| 92 | </thead> | 92 | </thead> |
| 93 | <tbody class="tabla-articulo-body"> | 93 | <tbody class="tabla-articulo-body"> |
| 94 | <tr | 94 | <tr |
| 95 | ng-repeat="(key, hojaRuta) in hojasRuta" class="d-flex" | 95 | ng-repeat="(key, hojaRuta) in hojasRuta" class="d-flex" |
| 96 | > | 96 | > |
| 97 | <td ng-bind="key + 1"></td> | 97 | <td ng-bind="key + 1"></td> |
| 98 | <td ng-bind="hojaRuta.sucursal"></td> | 98 | <td ng-bind="hojaRuta.sucursal"></td> |
| 99 | <td ng-bind="hojaRuta.fechaCreacion"></td> | 99 | <td ng-bind="hojaRuta.fechaCreacion"></td> |
| 100 | <td ng-bind="hojaRuta.sucursal"></td> | 100 | <td ng-bind="hojaRuta.sucursal"></td> |
| 101 | <td ng-bind="hojaRuta.transportista[0].nombre"></td> | 101 | <td ng-bind="hojaRuta.transportista[0].nombre"></td> |
| 102 | <td ng-bind="hojaRuta.chofer[0].nombre"></td> | 102 | <td ng-bind="hojaRuta.chofer[0].nombre"></td> |
| 103 | <td ng-bind="hojaRuta.vehiculo[0].tractor"></td> | 103 | <td ng-bind="hojaRuta.vehiculo[0].tractor"></td> |
| 104 | <td> | 104 | <td> |
| 105 | <button | 105 | <button |
| 106 | class="btn btn-secondary" | 106 | class="btn btn-secondary" |
| 107 | type="button" | 107 | type="button" |
| 108 | ng-click="verDetalle(hojaRuta)" | 108 | ng-click="verDetalle(hojaRuta)" |
| 109 | ><i class="fa fa-search" aria-hidden="true"></i> | 109 | ><i class="fa fa-search" aria-hidden="true"></i> |
| 110 | </button> | 110 | </button> |
| 111 | </td> | 111 | </td> |
| 112 | </tr> | 112 | </tr> |
| 113 | </tbody> | 113 | </tbody> |
| 114 | </table> | 114 | </table> |
| 115 | </div> | 115 | </div> |
| 116 | </div> | 116 | </div> |
| 117 | </div> | 117 | </div> |
| 118 | 118 |