Commit dc53fa7fe6666c99e9322b805d68876ed4107f1c
1 parent
f283da0383
Exists in
master
and in
1 other branch
Agregar Precio y condicion - Plazos
Showing
1 changed file
with
48 additions
and
14 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -25,8 +25,12 @@ angular.module('focaAbmCliente') |
| 25 | 25 | image: 'dimiciliodeentrega.png' |
| 26 | 26 | }, |
| 27 | 27 | { |
| 28 | - label: 'Precio y Condiciones', | |
| 28 | + label: 'Lista de precios', | |
| 29 | 29 | image: 'precios-condiciones.png' |
| 30 | + }, | |
| 31 | + { | |
| 32 | + label: 'Plazos', | |
| 33 | + image: 'plazos.png' | |
| 30 | 34 | } |
| 31 | 35 | ]; |
| 32 | 36 | |
| ... | ... | @@ -64,6 +68,7 @@ angular.module('focaAbmCliente') |
| 64 | 68 | }).then(function (res) { |
| 65 | 69 | $scope.cliente.NOM = res.NOM; |
| 66 | 70 | $scope.cliente.COD = res.COD; |
| 71 | + $scope.cliente.MOD = res.MOD; | |
| 67 | 72 | $scope.$broadcast('addCabecera', { |
| 68 | 73 | label: 'Cliente:', |
| 69 | 74 | valor: $filter('rellenarDigitos') |
| ... | ... | @@ -133,37 +138,66 @@ angular.module('focaAbmCliente') |
| 133 | 138 | }); |
| 134 | 139 | }; |
| 135 | 140 | |
| 136 | - $scope.seleccionarPrecioYCondiciones = function () { | |
| 137 | - | |
| 141 | + $scope.seleccionarListaDePrecios = function () { | |
| 138 | 142 | if ($scope.cliente.NOM === undefined || $scope.cliente.COD === undefined) { |
| 139 | 143 | focaModalService.alert('Seleccione cliente'); |
| 140 | 144 | return; |
| 141 | 145 | } |
| 142 | 146 | var modalInstance = $uibModal.open( |
| 143 | 147 | { |
| 144 | - ariaLabelledBy: 'Busqueda de Precio Condición', | |
| 145 | - templateUrl: 'modal-precio-condicion.html', | |
| 146 | - controller: 'focaModalPrecioCondicionController', | |
| 148 | + ariaLabelledBy: 'Precio-Condicion: Listas', | |
| 149 | + templateUrl: 'modal-precios.html', | |
| 150 | + controller: 'focaModalListaPreciosController', | |
| 147 | 151 | size: 'lg', |
| 148 | - resolve: { | |
| 149 | - idListaPrecio: function () { | |
| 152 | + resolve : { | |
| 153 | + idListaPrecio : function () { | |
| 150 | 154 | return $scope.cliente.MOD || null; |
| 151 | 155 | } |
| 152 | 156 | } |
| 153 | 157 | } |
| 154 | 158 | ); |
| 155 | - | |
| 156 | 159 | modalInstance.result.then( function (data) { |
| 157 | 160 | if (data) { |
| 158 | - console.log('Data: ', data); | |
| 161 | + $scope.$broadcast('addCabecera', { | |
| 162 | + label: 'Precio y Condicion:', | |
| 163 | + valor: $filter('rellenarDigitos')(parseInt(data.listaPrecio.ID), 4) + | |
| 164 | + ' - ' + data.listaPrecio.DES | |
| 165 | + }); | |
| 159 | 166 | } |
| 167 | + }); | |
| 168 | + }; | |
| 160 | 169 | |
| 161 | - }, function () { | |
| 162 | - | |
| 170 | + $scope.seleccionarPlazos = function () { | |
| 171 | + if ($scope.cliente.NOM === undefined || $scope.cliente.COD === undefined) { | |
| 172 | + focaModalService.alert('Seleccione cliente'); | |
| 173 | + return; | |
| 174 | + } | |
| 175 | + var modalInstance = $uibModal.open( | |
| 176 | + { | |
| 177 | + ariaLabelledBy: 'Plazos', | |
| 178 | + templateUrl: 'modal-plazos.html', | |
| 179 | + controller: 'focaModalListaPlazosController', | |
| 180 | + size: 'lg', | |
| 181 | + resolve: { | |
| 182 | + idCliente: function () { | |
| 183 | + return $scope.cliente.COD || null; | |
| 184 | + } | |
| 185 | + } | |
| 163 | 186 | } |
| 164 | 187 | ); |
| 188 | + modalInstance.result.then( function (data) { | |
| 189 | + if (data) { | |
| 190 | + var plazosConcat = ''; | |
| 191 | + for (var i = 0; i < data.plazoPago.length; i++) { | |
| 192 | + plazosConcat += data.plazoPago[i].dias + ', '; | |
| 193 | + } | |
| 194 | + plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2); | |
| 195 | + $scope.$broadcast('addCabecera', { | |
| 196 | + label: 'Plazos:', | |
| 197 | + valor: $filter('rellenarDigitos')(plazosConcat) | |
| 198 | + }); | |
| 199 | + } | |
| 200 | + }); | |
| 165 | 201 | }; |
| 166 | - | |
| 167 | - | |
| 168 | 202 | } |
| 169 | 203 | ]); |