Commit 23cf964408901141cccc3bbce0c79b89ff87c502

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'develop'

Master(mpuebla)

See merge request !16
... ... @@ -4,6 +4,7 @@
4 4 "description": "foca-hoja-ruta",
5 5 "main": "index.js",
6 6 "scripts": {
  7 + "refresh" : "gulp uglify && cp tmp/foca-hoja-ruta.js ../wrapper-demo/node_modules/foca-hoja-ruta/dist/foca-hoja-ruta.min.js",
7 8 "test": "echo \"Error: no test specified\" && exit 1",
8 9 "compile": "gulp uglify",
9 10 "gulp-pre-commit": "gulp pre-commit",
src/js/controller.js
... ... @@ -10,7 +10,7 @@ angular.module('focaHojaRuta')
10 10 'focaModalService',
11 11 '$rootScope',
12 12 '$localStorage',
13   - function(
  13 + function (
14 14 $scope,
15 15 $location,
16 16 $filter,
... ... @@ -35,7 +35,7 @@ angular.module('focaHojaRuta')
35 35 $scope.comprobante = '00000000';
36 36 }
37 37  
38   - hojaRutaService.getHojaRuta(loginData.chofer).then(function(res) {
  38 + hojaRutaService.getHojaRuta(loginData.chofer).then(function (res) {
39 39  
40 40 if (res.data) {
41 41 var hojaRuta = res.data;
... ... @@ -60,12 +60,12 @@ angular.module('focaHojaRuta')
60 60  
61 61 function watch() {
62 62  
63   - $scope.$watch('hojaRuta', function(nuevoValor) {
  63 + $scope.$watch('hojaRuta', function (nuevoValor) {
64 64 $localStorage.hojaRuta = JSON.stringify(nuevoValor);
65 65 }, true);
66 66 }
67 67  
68   - $scope.verDetalle = function(remito) {
  68 + $scope.verDetalle = function (remito) {
69 69 var modalInstance = $uibModal.open(
70 70 {
71 71 ariaLabelledBy: 'Detalle hoja ruta',
... ... @@ -79,21 +79,21 @@ angular.module('focaHojaRuta')
79 79 size: 'lg'
80 80 }
81 81 );
82   - modalInstance.result.then(function() {
  82 + modalInstance.result.then(function () {
83 83 //funcion se ejecuta cuando se carga pantalla
84 84 });
85 85 };
86 86  
87 87 function addCabecera(label, valor) {
88   - var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
89   - if(propiedad.length === 1) {
  88 + var propiedad = $filter('filter')($scope.cabecera, { label: label }, true);
  89 + if (propiedad.length === 1) {
90 90 propiedad[0].valor = valor;
91 91 } else {
92   - $scope.cabecera.push({label: label, valor: valor});
  92 + $scope.cabecera.push({ label: label, valor: valor });
93 93 }
94 94 }
95 95  
96   - $scope.rellenar = function(relleno, longitud) {
  96 + $scope.rellenar = function (relleno, longitud) {
97 97 relleno = '' + relleno;
98 98 while (relleno.length < longitud) {
99 99 relleno = '0' + relleno;
... ... @@ -102,15 +102,15 @@ angular.module(&#39;focaHojaRuta&#39;)
102 102 return relleno;
103 103 };
104 104  
105   - $scope.salir = function() {
  105 + $scope.salir = function () {
106 106 $location.path('/');
107 107 };
108 108  
109   - $scope.terminarHojaRuta = function() {
  109 + $scope.terminarHojaRuta = function () {
110 110 focaModalService
111 111 .confirm('¿Desea terminar la hoja de ruta? No podra realizar ninguna ' +
112 112 'otra descarga ni modificación')
113   - .then(function() {$scope.datosExtraCierre(terminar);});
  113 + .then(function () { $scope.datosExtraCierre(terminar); });
114 114 function terminar(datosExtraCierre) {
115 115 $scope.hojaRuta = angular.extend({}, $scope.hojaRuta, datosExtraCierre);
116 116 //limpio objeto para guardar
... ... @@ -125,18 +125,18 @@ angular.module(&#39;focaHojaRuta&#39;)
125 125 $scope.hojaRuta.fechaReparto.slice(0, 19).replace('T', ' ');
126 126 $scope.hojaRuta.estado = 2;
127 127 hojaRutaService.terminarHojaRuta($scope.hojaRuta).then(
128   - function() {
  128 + function () {
129 129 focaModalService.alert(
130 130 'Hoja de ruta ' +
131 131 $filter('comprobante')([$scope.puntoVenta,
132   - $scope.comprobante]) + ' cerrada con éxito');
133   - $location.path('/');
  132 + $scope.comprobante]) + ' cerrada con éxito');
  133 + $location.path('/');
134 134 }
135 135 );
136 136 }
137 137 };
138 138  
139   - $scope.datosExtraCierre = function(terminar) {
  139 + $scope.datosExtraCierre = function (terminar) {
140 140 var modalInstance = $uibModal.open(
141 141 {
142 142 templateUrl: 'focaDatosExtra.html',
... ... @@ -146,7 +146,25 @@ angular.module(&#39;focaHojaRuta&#39;)
146 146 modalInstance.result.then(terminar);
147 147 };
148 148  
149   - $rootScope.$on('estadoRed', function(event, value) {
  149 + $scope.modalDescargas = function () {
  150 + delete $scope.hojaRuta.remitos[0].cliente;
  151 + var modalInstance = $uibModal.open(
  152 + {
  153 + templateUrl: 'foca-modal-descarga.html',
  154 + controller: 'focaModalDescargaCtrl',
  155 + resolve: {
  156 + remito: function () { return $scope.hojaRuta.remitos[0]; }
  157 + },
  158 + }
  159 + );
  160 +
  161 + modalInstance.result.then(function (data) {
  162 +
  163 + console.log(data);
  164 + });
  165 + };
  166 +
  167 + $rootScope.$on('estadoRed', function (event, value) {
150 168 $scope.esatadoRed = value;
151 169 });
152 170  
src/views/lista-hoja-ruta.html
... ... @@ -61,7 +61,7 @@
61 61 </div>
62 62 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2">
63 63 <div class="row grilla-articulo">
64   - <table class="table table-responsive table-striped table-sm table-dark">
  64 + <table ng-hide="hojaRuta.abierta" class="table table-responsive table-striped table-sm table-dark">
65 65 <thead>
66 66 <tr>
67 67 <th>#</th>
... ... @@ -92,7 +92,45 @@
92 92 </tr>
93 93 </tbody>
94 94 </table>
95   -
  95 + </div>
  96 + <div ng-show="hojaRuta.abierta" class="row grilla-articulo">
  97 + <table class="table table-striped table-sm table-dark">
  98 + <thead>
  99 + <tr>
  100 + <th colspan="3" class="text-center">Remito abierto Nº
  101 + {{[hojaRuta.remitos[0].sucursal, hojaRuta.remitos[0].numeroRemito] | comprobante}}
  102 + </th>
  103 + </tr>
  104 + <tr>
  105 + <th>Cisterna</th>
  106 + <th>Producto</th>
  107 + <th>Disponibles</th>
  108 + </tr>
  109 + </thead>
  110 + <tbody>
  111 + <tr ng-repeat="cisterna in hojaRuta.remitos[0].cisternas">
  112 + <td ng-bind="cisterna.codigo"></td>
  113 + <td ng-bind="cisterna.cisternaCarga.articulo.DetArt"></td>
  114 + <td ng-bind="cisterna.cisternaCarga.cantidad"></td>
  115 + </tr>
  116 + </tbody>
  117 + </table>
  118 + <table class="table table-striped table-sm table-dark">
  119 + <thead>
  120 + <tr>
  121 + <th>Descarga en cliente</th>
  122 + <th>
  123 + <button class="btn btn-outline-debo" ng-click="modalDescargas()">
  124 + <i class="fa fa-plus"></i>
  125 + </button>
  126 + </th>
  127 + </tr>
  128 + <tr></tr>
  129 + </thead>
  130 + <tbody>
  131 + <tr ng-repeat="remito in remitos"></tr>
  132 + </tbody>
  133 + </table>
96 134 </div>
97 135 </div>
98 136 <div class="row d-md-none fixed-bottom">