Commit 96fc7b3af628331af667e7277d98961d22f3634d

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

Merge branch 'master' into 'develop'

Master(mpuebla)

See merge request !126
src/app/components/busqueda-productos/busqueda-productos.component.ts
... ... @@ -2,7 +2,7 @@ import { Component, OnInit, EventEmitter } from '@angular/core';
2 2 import { ProductoService } from 'src/app/services/producto.service';
3 3 import { Producto } from 'src/app/wrappers/producto';
4 4 import { Categoria } from 'src/app/wrappers/categoria';
5   -import { appSettings } from 'src/etc/AppSettings';
  5 +import { APP_SETTINGS } from 'src/etc/AppSettings';
6 6 import { Router } from '@angular/router';
7 7  
8 8 @Component({
... ... @@ -18,7 +18,7 @@ export class BusquedaProductosComponent implements OnInit {
18 18 private categoriaActive: number = null;
19 19 private showSpinner: boolean = true;
20 20 private queMostrar: string = 'todos';
21   - private apiImagenes: string = appSettings.apiImagenes;
  21 + private apiImagenes: string = APP_SETTINGS.apiImagenes;
22 22 private categorias: Categoria[] = [];
23 23 private blurFocus = new EventEmitter();
24 24 private ordenandoByVendidos = true;
src/app/components/cancelar-compra/cancelar-compra.component.ts
1 1 import { Component, OnInit, OnDestroy } from '@angular/core';
2   -import { appSettings } from 'src/etc/AppSettings';
  2 +import { APP_SETTINGS } from 'src/etc/AppSettings';
3 3 import { Location } from '@angular/common';
4 4 import { Router } from '@angular/router';
5 5 import { ProductoService } from 'src/app/services/producto.service';
... ... @@ -11,7 +11,7 @@ import { ProductoService } from 'src/app/services/producto.service';
11 11 })
12 12 export class CancelarCompraComponent implements OnInit, OnDestroy {
13 13  
14   - private apiImagenes: string = appSettings.apiImagenes;
  14 + private apiImagenes: string = APP_SETTINGS.apiImagenes;
15 15 private timer: any;
16 16  
17 17 constructor(
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
1 1 import { Component, OnInit, OnDestroy } from '@angular/core';
2   -import { appSettings } from 'src/etc/AppSettings';
  2 +import { APP_SETTINGS } from 'src/etc/AppSettings';
3 3 import { Location } from '@angular/common';
4 4 import { ProductoService } from 'src/app/services/producto.service';
5 5 import { Producto } from 'src/app/wrappers/producto';
... ... @@ -15,7 +15,7 @@ import { PagoConTarjetaComponent } from '../pago-con-tarjeta/pago-con-tarjeta.co
15 15 })
16 16 export class ConfirmacionCarritoComponent implements OnInit, OnDestroy {
17 17  
18   - private apiImagenes: string = appSettings.apiImagenes;
  18 + private apiImagenes: string = APP_SETTINGS.apiImagenes;
19 19 private compraConEfectivofinalizada: boolean = false;
20 20 private compraConQRfinalizada: boolean = false;
21 21 private productos: Producto[] = [];
src/app/components/header/header.component.ts
1 1 import { Component, OnInit, HostListener } from '@angular/core';
2   -import { appSettings } from 'src/etc/AppSettings';
  2 +import { APP_SETTINGS } from 'src/etc/AppSettings';
3 3 import { BsModalService } from 'ngx-bootstrap';
4 4 import { ConfiguracionComponent } from '../configuracion/configuracion.component';
5 5  
... ... @@ -10,7 +10,7 @@ import { ConfiguracionComponent } from '../configuracion/configuracion.component
10 10 })
11 11 export class HeaderComponent implements OnInit {
12 12  
13   - private apiImagenes : string = appSettings.apiImagenes;
  13 + private apiImagenes : string = APP_SETTINGS.apiImagenes;
14 14 timer: any;
15 15 isShowModalConfiguration = false;
16 16  
src/app/components/home/home.component.ts
1 1 import { Component, OnInit, HostListener } from '@angular/core';
2 2 import { Router } from '@angular/router';
3   -import { appSettings } from 'src/etc/AppSettings';
  3 +import { APP_SETTINGS } from 'src/etc/AppSettings';
4 4  
5 5 @Component({
6 6 selector: 'app-home',
... ... @@ -9,7 +9,7 @@ import { appSettings } from 'src/etc/AppSettings';
9 9 })
10 10 export class HomeComponent implements OnInit {
11 11  
12   - private apiImagenes: string = appSettings.apiImagenes;
  12 + private apiImagenes: string = APP_SETTINGS.apiImagenes;
13 13  
14 14 constructor() { }
15 15  
src/app/components/inicio/inicio.component.ts
1 1 import { Component, OnInit, ViewChild, HostListener, AfterViewInit } from '@angular/core';
2 2 import { PopoverDirective } from 'ngx-bootstrap';
3   -import { appSettings } from 'src/etc/AppSettings';
  3 +import { APP_SETTINGS } from 'src/etc/AppSettings';
4 4 import { Router } from '@angular/router';
5 5 import { ProductoService } from 'src/app/services/producto.service';
6 6 import { Producto } from 'src/app/wrappers/producto';
... ... @@ -21,7 +21,7 @@ export class InicioComponent implements OnInit, AfterViewInit {
21 21 private productos: Producto[] = [];
22 22 private promociones: Producto[] = [];
23 23 private sinonimos: Sinonimo[] = [];
24   - private apiImagenes: string = appSettings.apiImagenes;
  24 + private apiImagenes: string = APP_SETTINGS.apiImagenes;
25 25  
26 26 @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective;
27 27  
src/app/components/mensaje-final/mensaje-final.component.ts
1 1 import { Component, OnInit } from '@angular/core';
2   -import { appSettings } from 'src/etc/AppSettings';
  2 +import { APP_SETTINGS } from 'src/etc/AppSettings';
3 3 import { ProductoService } from 'src/app/services/producto.service';
4 4 import { Router } from '@angular/router';
5 5  
... ... @@ -10,7 +10,7 @@ import { Router } from '@angular/router';
10 10 })
11 11 export class MensajeFinalComponent implements OnInit {
12 12  
13   - private apiImagenes: string = appSettings.apiImagenes;
  13 + private apiImagenes: string = APP_SETTINGS.apiImagenes;
14 14 private timer: any;
15 15  
16 16 constructor(
src/app/components/sidebar/sidebar.component.ts
1 1 import { Component, OnInit } from '@angular/core';
2 2 import { Producto } from 'src/app/wrappers/producto';
3   -import { appSettings } from 'src/etc/AppSettings';
  3 +import { APP_SETTINGS } from 'src/etc/AppSettings';
4 4 import { ProductoService } from 'src/app/services/producto.service';
5 5 import { Router } from '@angular/router';
6 6 import { trigger, state, style, transition, animate } from '@angular/animations';
... ... @@ -28,7 +28,7 @@ export class SidebarComponent implements OnInit {
28 28 private cantMin: number = 1;
29 29 private cantMax: number = 50;
30 30 private total: number = 0;
31   - private apiImagenes: string = appSettings.apiImagenes;
  31 + private apiImagenes: string = APP_SETTINGS.apiImagenes;
32 32  
33 33 public productosCarrito: Producto[] = [];
34 34  
src/app/services/cliente.service.ts
1 1 import { Injectable } from '@angular/core';
2 2 import { HttpClient } from '@angular/common/http';
3   -import { appSettings } from "src/etc/AppSettings";
  3 +import { APP_SETTINGS } from "src/etc/AppSettings";
4 4  
5 5 @Injectable({
6 6 providedIn: 'root'
7 7 })
8 8 export class ClienteService {
9 9  
10   - private url = appSettings.apiClientes;
  10 + private urlCliente = APP_SETTINGS.apiClientes;
11 11  
12 12 constructor(private http: HttpClient) { }
13 13  
14 14 getClienteById(id: number) {
15   - return this.http.get(`${this.url}/get/${id}`);
  15 + return this.http.get(`${this.urlCliente}/get/${id}`);
16 16 }
17 17 }
src/app/services/comanda.service.ts
1 1 import { Injectable } from "@angular/core";
2 2 import { HttpClient } from "@angular/common/http";
3   -import { appSettings } from "src/etc/AppSettings";
  3 +import { APP_SETTINGS } from "src/etc/AppSettings";
4 4 import { Observable } from "rxjs";
5 5  
6 6 @Injectable({
7 7 providedIn: "root"
8 8 })
9 9 export class ComandaService {
10   - private apiUrl: string = appSettings.apiUrl;
  10 + private urlAutoservicio: string = APP_SETTINGS.apiAutoservicio;
11 11  
12 12 constructor(private http: HttpClient) { }
13 13  
14 14 getAll(): Observable<any> {
15 15  
16   - return this.http.get(`${this.apiUrl}/comandas`);
  16 + return this.http.get(`${this.urlAutoservicio}/comandas`);
17 17 }
18 18  
19 19 updateComanda(id: number, estado: number, observacion: string): Observable<any> {
20 20  
21   - return this.http.get(`${this.apiUrl}/comandas/update/${id}/${estado}/${observacion}`);
  21 + return this.http.get(`${this.urlAutoservicio}/comandas/update/${id}/${estado}/${observacion}`);
22 22 }
23 23  
24 24 getPendientesEntrega() {
25   - return this.http.get(`${this.apiUrl}/comandas/pendientes-entrega`);
  25 +
  26 + return this.http.get(`${this.urlAutoservicio}/comandas/pendientes-entrega`);
26 27 }
27 28 }
src/app/services/impresora.service.ts
1 1 import { Injectable } from '@angular/core';
2   -import { appSettings } from 'src/etc/AppSettings';
  2 +import { APP_SETTINGS } from 'src/etc/AppSettings';
3 3 import { HttpClient } from '@angular/common/http';
4 4 import { Observable } from 'rxjs/internal/Observable';
5 5  
... ... @@ -8,7 +8,7 @@ import { Observable } from &#39;rxjs/internal/Observable&#39;;
8 8 })
9 9 export class ImpresoraService {
10 10  
11   - private apiAutoservicio = appSettings.apiUrl;
  11 + private urlDeboSuite = APP_SETTINGS.apiDeboSuite;
12 12  
13 13 constructor(
14 14 private http: HttpClient,
... ... @@ -16,7 +16,7 @@ export class ImpresoraService {
16 16  
17 17 getAll(): Observable<any> {
18 18  
19   - return this.http.get(`${this.apiAutoservicio}/get/impresoras`);
  19 + return this.http.get(`${this.urlDeboSuite}/get/impresoras`);
20 20 }
21 21  
22 22 }
src/app/services/producto.service.ts
1 1 import { Injectable } from '@angular/core';
2 2 import { HttpClient } from '@angular/common/http';
3 3 import { Observable } from 'rxjs';
4   -import { appSettings } from 'src/etc/AppSettings';
  4 +import { APP_SETTINGS } from 'src/etc/AppSettings';
5 5 import { Producto } from '../wrappers/producto';
6 6 import { ClienteService } from './cliente.service';
7 7  
... ... @@ -20,17 +20,17 @@ export class ProductoService {
20 20  
21 21 getProductoById(id): Observable<any> {
22 22  
23   - return this.http.get(`${appSettings.apiUrl}/articulos/${id}`);
  23 + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/articulos/${id}`);
24 24 }
25 25  
26 26 getAll(): Observable<any> {
27 27  
28   - return this.http.get(`${appSettings.apiUrl}/articulos/`);
  28 + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/articulos/`);
29 29 }
30 30  
31 31 getAllWithPaginator(page: number = 1): Observable<any> {
32 32  
33   - return this.http.get(`${appSettings.apiUrl}/articulos/${page}`);
  33 + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/articulos/${page}`);
34 34 }
35 35  
36 36 setProductos(producto: Producto) {
... ... @@ -57,28 +57,28 @@ export class ProductoService {
57 57  
58 58 getPromocionByCodigos(sector, codigo): Observable<any> {
59 59  
60   - var url = `${appSettings.apiUrl}/promociones/by-codigos/${sector}/${codigo}`;
  60 + var url = `${APP_SETTINGS.apiAutoservicio}/promociones/by-codigos/${sector}/${codigo}`;
61 61 // var url = `${appSettings.apiUrl}/promociones/by-codigos/${2}/${7}`;
62 62 return this.http.get(url);
63 63 }
64 64  
65 65 getPromociones(sector, codigo): Observable<any> {
66 66  
67   - var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`;
  67 + var url = `${APP_SETTINGS.apiAutoservicio}/promociones/incluir-articulo/${sector}/${codigo}`;
68 68 // var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${2}/${1306}`;
69 69 return this.http.get(url);
70 70 }
71 71  
72 72 getPromocionSinonimos(sector, codigo): Observable<any> {
73 73  
74   - var url = `${appSettings.apiUrl}/sinonimos/promo/${sector}/${codigo}`;
  74 + var url = `${APP_SETTINGS.apiAutoservicio}/sinonimos/promo/${sector}/${codigo}`;
75 75 // var url = `${appSettings.apiUrl}/sinonimos/promo/${2}/${7}`;
76 76 return this.http.get(url);
77 77 }
78 78  
79 79 getCategorias() {
80   -
81   - return this.http.get(`${appSettings.apiUrl}/categorias`);
  80 +
  81 + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/categorias`);
82 82 }
83 83  
84 84 pagar(dataPago: any) {
... ... @@ -87,12 +87,13 @@ export class ProductoService {
87 87  
88 88 this.clienteService.getClienteById(-1).subscribe(cliente => {
89 89  
90   - this.http.post(`${appSettings.apiUrl}/comprobante/guardar/${dataPago.medioPago}`, {
  90 + let puntoVenta = parseInt(localStorage.getItem('impresoraPVE'));
  91 + this.http.post(`${APP_SETTINGS.apiAutoservicio}/comprobante/guardar/${dataPago.medioPago}`, {
91 92 productos: this.productos,
92 93 cliente: cliente,
93 94 origen: 'autoservicio',
94 95 codigoVendedor: 5,
95   - puntoVenta: parseInt(localStorage.getItem('impresoraPVE')),
  96 + puntoVenta: dataPago.medioPago === 9 ? -1 * puntoVenta : puntoVenta,
96 97 pedidoAnombreDe: dataPago.pedidoAnombreDe,
97 98 }).subscribe((data) => {
98 99  
src/app/services/punto-venta.service.ts
1 1 import { Injectable } from '@angular/core';
2 2 import { Observable } from 'rxjs/internal/Observable';
3   -import { appSettings } from 'src/etc/AppSettings';
  3 +import { APP_SETTINGS } from 'src/etc/AppSettings';
4 4 import { HttpClient } from '@angular/common/http';
5 5  
6 6 @Injectable({
... ... @@ -8,7 +8,8 @@ import { HttpClient } from &#39;@angular/common/http&#39;;
8 8 })
9 9 export class PuntoVentaService {
10 10  
11   - private apiAutoservico = appSettings.apiUrl;
  11 + private apiAutoservico = APP_SETTINGS.apiAutoservicio;
  12 + private apiDeboSuite = APP_SETTINGS.apiDeboSuite;
12 13  
13 14 constructor(
14 15 private http: HttpClient
... ... @@ -26,7 +27,7 @@ export class PuntoVentaService {
26 27  
27 28 getVendedor(filter: any = {}): Observable<any> {
28 29  
29   - return this.http.get(`${this.apiAutoservico}/get/vendedor/${JSON.stringify(filter)}`);
  30 + return this.http.get(`${this.apiDeboSuite}/get/vendedor/${JSON.stringify(filter)}`);
30 31 }
31 32  
32 33 }
src/app/services/tarjetas.service.ts
1 1 import { Injectable } from '@angular/core';
2 2 import { HttpClient } from '@angular/common/http';
3 3 import { Observable } from 'rxjs';
4   -import { appSettings } from 'src/etc/AppSettings';
  4 +import { APP_SETTINGS } from 'src/etc/AppSettings';
5 5  
6 6 @Injectable({
7 7 providedIn: 'root'
... ... @@ -12,6 +12,6 @@ export class TarjetasService {
12 12  
13 13 getTarjetas(): Observable<any> {
14 14  
15   - return this.http.get(`${appSettings.apiUrl}/tarjetas`);
  15 + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/tarjetas`);
16 16 }
17 17 }
src/etc/AppSettings ejemplo.ts
1   -export const appSettings = {
2   - // apiUrl: 'http://10.231.45.117:4705/autoservicio',
  1 +export const APP_SETTINGS = {
  2 + // apiAutoservicio: 'http://10.231.45.117:4705/autoservicio',
  3 + // apiDeboSuite: 'http://10.231.45.117:9900',
3 4 // apiImagenes: 'http://10.231.45.117:4513/',
4 5 // apiClientes: 'http://localhost:1515/clientes'
5 6 };