Commit 71682e427865e9b41d088004fca7aba6b1359d30

Authored by Marcelo Puebla
Exists in master and in 1 other branch develop

Merge branch 'master' into 'develop'

Master(benjamin)

See merge request !130
... ... @@ -28,7 +28,7 @@
28 28 <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script>
29 29 <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script>
30 30 <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script>
31   - <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script>
  31 + <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilio.min.js"></script>
32 32 <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script>
33 33 <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script>
34 34 <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script>
src/js/controller.js
... ... @@ -145,10 +145,14 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
145 145 focaModalService.alert('Ingrese Cliente');
146 146 return;
147 147 }
148   - if (!$scope.notaPedido.vendedor.id) {
149   - focaModalService.alert('Este cliente no tiene vendedor asignado');
150   - return;
151   - } else if ($scope.notaPedido.idRemito === -1) {
  148 +
  149 + // Se crearon comentarios en las restricciones de vendedor para las bases
  150 + // de datos que no poseen vendedor asignado a los clientes despues
  151 + // descomentar en (crear-nota-pedido, modal-nota-pedido, crear-remito y modal-remito)
  152 + // if (!$scope.notaPedido.vendedor.id) {
  153 + // focaModalService.alert('Este cliente no tiene vendedor asignado');
  154 + // return;
  155 + if ($scope.notaPedido.idRemito === -1) {
152 156 focaBotoneraLateralService.alert('No se puede modificar esta nota de pedido');
153 157 return;
154 158 } else if (!$scope.notaPedido.proveedor.COD) {
... ... @@ -181,7 +185,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
181 185 id: $scope.notaPedido.id,
182 186 fechaCarga: new Date($scope.notaPedido.fechaCarga)
183 187 .toISOString().slice(0, 19).replace('T', ' '),
184   - idVendedor: $scope.notaPedido.vendedor.id,
  188 + // idVendedor: $scope.notaPedido.vendedor.id,
185 189 idCliente: $scope.notaPedido.cliente.COD,
186 190 nombreCliente: $scope.notaPedido.cliente.NOM,
187 191 cuitCliente: $scope.notaPedido.cliente.CUIT,
... ... @@ -218,26 +222,27 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
218 222 $scope.notaPedido.notaPedidoPuntoDescarga);
219 223 }
220 224  
221   - var rutaJson = JSON.parse($localStorage.rutas);
222   -
223   - removeItemFromArr( rutaJson, 'venta-nota-pedido/crear' );
224   - $localStorage.rutas = JSON.stringify(rutaJson);
225   -
226   - var plazos = $scope.notaPedido.notaPedidoPlazo;
227   - var plazosACrear = [];
228   - plazos.forEach(function (plazo) {
229   - plazosACrear.push({
230   - idNotaPedido: data.data.id,
231   - dias: plazo.dias
  225 + var rutaJson;
  226 + if ($localStorage.rutas) {
  227 + rutaJson = JSON.parse($localStorage.rutas);
  228 + removeItemFromArr(rutaJson, 'venta-nota-pedido/crear');
  229 + $localStorage.rutas = JSON.stringify(rutaJson);
  230 + }
  231 +
  232 + var plazos = $scope.notaPedido.notaPedidoPlazo;
  233 + var plazosACrear = [];
  234 + plazos.forEach(function (plazo) {
  235 + plazosACrear.push({
  236 + idNotaPedido: data.data.id,
  237 + dias: plazo.dias
  238 + });
232 239 });
233   - });
234 240  
235 241 if (plazosACrear.length) {
236 242 crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear);
237 243 }
238 244  
239   - notaPedidoBusinessService.addEstado(data.data.id,
240   - $scope.notaPedido.vendedor.id);
  245 + notaPedidoBusinessService.addEstado(data.data.id);
241 246  
242 247 focaBotoneraLateralService.endGuardar(true);
243 248 $scope.saveLoading = false;
... ... @@ -507,13 +512,14 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
507 512 resolve: {
508 513 parametros: function () {
509 514 return {
510   - vendedor: $scope.idVendedor,
  515 + // vendedor: $scope.idVendedor,
511 516 cobrador: null,
512 517 searchText: $scope.notaPedido.cliente ?
513 518 $scope.notaPedido.cliente.NOM : ''
514 519 };
515 520 }
516 521 },
  522 + backdrop: false,
517 523 size: 'lg'
518 524 }
519 525 );
... ... @@ -534,15 +540,15 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
534 540 });
535 541 }
536 542  
537   - if (angular.equals({}, cliente.vendedor)) {
  543 + // if (angular.equals({}, cliente.vendedor)) {
538 544  
539   - focaModalService
540   - .alert('El cliente seleccionado no tiene tiene ' +
541   - 'vendedor asignado.')
542   - .then($scope.seleccionarCliente);
  545 + // focaModalService
  546 + // .alert('El cliente seleccionado no tiene tiene ' +
  547 + // 'vendedor asignado.')
  548 + // .then($scope.seleccionarCliente);
543 549  
544   - return;
545   - }
  550 + // return;
  551 + // }
546 552  
547 553 $scope.abrirModalDomicilios(cliente);
548 554 }, function () { }
... ... @@ -602,6 +608,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
602 608 idCliente: function () { return cliente.COD; },
603 609 esNuevo: function () { return cliente.esNuevo; }
604 610 },
  611 + backdrop: false,
605 612 size: 'lg',
606 613 }
607 614 );
... ... @@ -610,14 +617,14 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
610 617  
611 618 $scope.notaPedido.domicilio = domicilio;
612 619 $scope.notaPedido.cliente = cliente;
613   - $scope.notaPedido.vendedor = cliente.vendedor;
  620 + // $scope.notaPedido.vendedor = cliente.vendedor;
614 621  
615   - $scope.$broadcast('addCabecera', {
616   - label: 'Vendedor:',
617   - valor: $filter('rellenarDigitos')
618   - ($scope.notaPedido.vendedor.NUM, 3) +
619   - ' - ' + $scope.notaPedido.vendedor.NOM
620   - });
  622 + // $scope.$broadcast('addCabecera', {
  623 + // label: 'Vendedor:',
  624 + // valor: $filter('rellenarDigitos')
  625 + // ($scope.notaPedido.vendedor.NUM, 3) +
  626 + // ' - ' + $scope.notaPedido.vendedor.NOM
  627 + // });
621 628  
622 629 var domicilioStamp =
623 630 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
... ... @@ -957,7 +964,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
957 964  
958 965 $scope.cabeceras = [];
959 966  
960   - if (notaPedido.cotizacion.moneda.CODIGO_AFIP !== 'PES') {
  967 + if (notaPedido.cotizacion.moneda.codigo !== 'PES') {
961 968 $scope.cabeceras.push({
962 969 label: 'Moneda:',
963 970 valor: notaPedido.cotizacion.moneda.DETALLE
... ... @@ -978,13 +985,13 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
978 985 $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true;
979 986 }
980 987  
981   - if (notaPedido.vendedor.NUM) {
982   - $scope.cabeceras.push({
983   - label: 'Vendedor:',
984   - valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) +
985   - ' - ' + notaPedido.vendedor.NOM
986   - });
987   - }
  988 + // if (notaPedido.vendedor.NUM) {
  989 + // $scope.cabeceras.push({
  990 + // label: 'Vendedor:',
  991 + // valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) +
  992 + // ' - ' + notaPedido.vendedor.NOM
  993 + // });
  994 + // }
988 995  
989 996 if (notaPedido.cliente.COD) {
990 997 $scope.cabeceras.push({
... ... @@ -1111,11 +1118,11 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
1111 1118 }
1112 1119 }
1113 1120  
1114   - function removeItemFromArr ( arr, item ) {
1115   - var i = arr.indexOf( item );
1116   -
1117   - if ( i !== -1 ) {
1118   - arr.splice( i, 1 );
  1121 + function removeItemFromArr(arr, item) {
  1122 + var i = arr.indexOf(item);
  1123 +
  1124 + if (i !== -1) {
  1125 + arr.splice(i, 1);
1119 1126 }
1120 1127 }
1121 1128  
... ... @@ -1133,7 +1140,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
1133 1140 if (data) {
1134 1141 $location.path('/');
1135 1142 var rutaJson = JSON.parse($localStorage.rutas);
1136   - removeItemFromArr( rutaJson, 'venta-nota-pedido/crear' );
  1143 + removeItemFromArr(rutaJson, 'venta-nota-pedido/crear');
1137 1144 $localStorage.rutas = JSON.stringify(rutaJson);
1138 1145 }
1139 1146 });