diff --git a/src/app/components/busqueda-productos/busqueda-productos.component.ts b/src/app/components/busqueda-productos/busqueda-productos.component.ts index 288c838..beb4ffa 100644 --- a/src/app/components/busqueda-productos/busqueda-productos.component.ts +++ b/src/app/components/busqueda-productos/busqueda-productos.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit, EventEmitter } from '@angular/core'; import { ProductoService } from 'src/app/services/producto.service'; import { Producto } from 'src/app/wrappers/producto'; import { Categoria } from 'src/app/wrappers/categoria'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { Router } from '@angular/router'; @Component({ @@ -18,7 +18,7 @@ export class BusquedaProductosComponent implements OnInit { private categoriaActive: number = null; private showSpinner: boolean = true; private queMostrar: string = 'todos'; - private apiImagenes: string = appSettings.apiImagenes; + private apiImagenes: string = APP_SETTINGS.apiImagenes; private categorias: Categoria[] = []; private blurFocus = new EventEmitter(); private ordenandoByVendidos = true; diff --git a/src/app/components/cancelar-compra/cancelar-compra.component.ts b/src/app/components/cancelar-compra/cancelar-compra.component.ts index 497cf52..411d317 100644 --- a/src/app/components/cancelar-compra/cancelar-compra.component.ts +++ b/src/app/components/cancelar-compra/cancelar-compra.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { Location } from '@angular/common'; import { Router } from '@angular/router'; import { ProductoService } from 'src/app/services/producto.service'; @@ -11,7 +11,7 @@ import { ProductoService } from 'src/app/services/producto.service'; }) export class CancelarCompraComponent implements OnInit, OnDestroy { - private apiImagenes: string = appSettings.apiImagenes; + private apiImagenes: string = APP_SETTINGS.apiImagenes; private timer: any; constructor( diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts index fac50a3..c58cde0 100644 --- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts +++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { Location } from '@angular/common'; import { ProductoService } from 'src/app/services/producto.service'; import { Producto } from 'src/app/wrappers/producto'; @@ -15,7 +15,7 @@ import { PagoConTarjetaComponent } from '../pago-con-tarjeta/pago-con-tarjeta.co }) export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { - private apiImagenes: string = appSettings.apiImagenes; + private apiImagenes: string = APP_SETTINGS.apiImagenes; private compraConEfectivofinalizada: boolean = false; private compraConQRfinalizada: boolean = false; private productos: Producto[] = []; diff --git a/src/app/components/header/header.component.ts b/src/app/components/header/header.component.ts index ea751d1..609af8c 100644 --- a/src/app/components/header/header.component.ts +++ b/src/app/components/header/header.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, HostListener } from '@angular/core'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { BsModalService } from 'ngx-bootstrap'; import { ConfiguracionComponent } from '../configuracion/configuracion.component'; @@ -10,7 +10,7 @@ import { ConfiguracionComponent } from '../configuracion/configuracion.component }) export class HeaderComponent implements OnInit { - private apiImagenes : string = appSettings.apiImagenes; + private apiImagenes : string = APP_SETTINGS.apiImagenes; timer: any; isShowModalConfiguration = false; diff --git a/src/app/components/home/home.component.ts b/src/app/components/home/home.component.ts index 5afb64a..a46166b 100644 --- a/src/app/components/home/home.component.ts +++ b/src/app/components/home/home.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, HostListener } from '@angular/core'; import { Router } from '@angular/router'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; @Component({ selector: 'app-home', @@ -9,7 +9,7 @@ import { appSettings } from 'src/etc/AppSettings'; }) export class HomeComponent implements OnInit { - private apiImagenes: string = appSettings.apiImagenes; + private apiImagenes: string = APP_SETTINGS.apiImagenes; constructor() { } diff --git a/src/app/components/inicio/inicio.component.ts b/src/app/components/inicio/inicio.component.ts index f60755b..1c89467 100644 --- a/src/app/components/inicio/inicio.component.ts +++ b/src/app/components/inicio/inicio.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild, HostListener, AfterViewInit } from '@angular/core'; import { PopoverDirective } from 'ngx-bootstrap'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { Router } from '@angular/router'; import { ProductoService } from 'src/app/services/producto.service'; import { Producto } from 'src/app/wrappers/producto'; @@ -21,7 +21,7 @@ export class InicioComponent implements OnInit, AfterViewInit { private productos: Producto[] = []; private promociones: Producto[] = []; private sinonimos: Sinonimo[] = []; - private apiImagenes: string = appSettings.apiImagenes; + private apiImagenes: string = APP_SETTINGS.apiImagenes; @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective; diff --git a/src/app/components/mensaje-final/mensaje-final.component.ts b/src/app/components/mensaje-final/mensaje-final.component.ts index 729469e..1bf0cb4 100644 --- a/src/app/components/mensaje-final/mensaje-final.component.ts +++ b/src/app/components/mensaje-final/mensaje-final.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { ProductoService } from 'src/app/services/producto.service'; import { Router } from '@angular/router'; @@ -10,7 +10,7 @@ import { Router } from '@angular/router'; }) export class MensajeFinalComponent implements OnInit { - private apiImagenes: string = appSettings.apiImagenes; + private apiImagenes: string = APP_SETTINGS.apiImagenes; private timer: any; constructor( diff --git a/src/app/components/sidebar/sidebar.component.ts b/src/app/components/sidebar/sidebar.component.ts index d77af4b..7b1e029 100644 --- a/src/app/components/sidebar/sidebar.component.ts +++ b/src/app/components/sidebar/sidebar.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Producto } from 'src/app/wrappers/producto'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { ProductoService } from 'src/app/services/producto.service'; import { Router } from '@angular/router'; import { trigger, state, style, transition, animate } from '@angular/animations'; @@ -28,7 +28,7 @@ export class SidebarComponent implements OnInit { private cantMin: number = 1; private cantMax: number = 50; private total: number = 0; - private apiImagenes: string = appSettings.apiImagenes; + private apiImagenes: string = APP_SETTINGS.apiImagenes; public productosCarrito: Producto[] = []; diff --git a/src/app/services/cliente.service.ts b/src/app/services/cliente.service.ts index 6e01d84..00301fd 100644 --- a/src/app/services/cliente.service.ts +++ b/src/app/services/cliente.service.ts @@ -1,17 +1,17 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { appSettings } from "src/etc/AppSettings"; +import { APP_SETTINGS } from "src/etc/AppSettings"; @Injectable({ providedIn: 'root' }) export class ClienteService { - private url = appSettings.apiClientes; + private urlCliente = APP_SETTINGS.apiClientes; constructor(private http: HttpClient) { } getClienteById(id: number) { - return this.http.get(`${this.url}/get/${id}`); + return this.http.get(`${this.urlCliente}/get/${id}`); } } diff --git a/src/app/services/comanda.service.ts b/src/app/services/comanda.service.ts index f5ef224..4792d43 100644 --- a/src/app/services/comanda.service.ts +++ b/src/app/services/comanda.service.ts @@ -1,27 +1,28 @@ import { Injectable } from "@angular/core"; import { HttpClient } from "@angular/common/http"; -import { appSettings } from "src/etc/AppSettings"; +import { APP_SETTINGS } from "src/etc/AppSettings"; import { Observable } from "rxjs"; @Injectable({ providedIn: "root" }) export class ComandaService { - private apiUrl: string = appSettings.apiUrl; + private urlAutoservicio: string = APP_SETTINGS.apiAutoservicio; constructor(private http: HttpClient) { } getAll(): Observable { - return this.http.get(`${this.apiUrl}/comandas`); + return this.http.get(`${this.urlAutoservicio}/comandas`); } updateComanda(id: number, estado: number, observacion: string): Observable { - return this.http.get(`${this.apiUrl}/comandas/update/${id}/${estado}/${observacion}`); + return this.http.get(`${this.urlAutoservicio}/comandas/update/${id}/${estado}/${observacion}`); } getPendientesEntrega() { - return this.http.get(`${this.apiUrl}/comandas/pendientes-entrega`); + + return this.http.get(`${this.urlAutoservicio}/comandas/pendientes-entrega`); } } diff --git a/src/app/services/impresora.service.ts b/src/app/services/impresora.service.ts index fac66bb..678b006 100644 --- a/src/app/services/impresora.service.ts +++ b/src/app/services/impresora.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs/internal/Observable'; @@ -8,7 +8,7 @@ import { Observable } from 'rxjs/internal/Observable'; }) export class ImpresoraService { - private apiAutoservicio = appSettings.apiUrl; + private urlDeboSuite = APP_SETTINGS.apiDeboSuite; constructor( private http: HttpClient, @@ -16,7 +16,7 @@ export class ImpresoraService { getAll(): Observable { - return this.http.get(`${this.apiAutoservicio}/get/impresoras`); + return this.http.get(`${this.urlDeboSuite}/get/impresoras`); } } diff --git a/src/app/services/producto.service.ts b/src/app/services/producto.service.ts index 62f21a1..7874df2 100644 --- a/src/app/services/producto.service.ts +++ b/src/app/services/producto.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { Producto } from '../wrappers/producto'; import { ClienteService } from './cliente.service'; @@ -20,17 +20,17 @@ export class ProductoService { getProductoById(id): Observable { - return this.http.get(`${appSettings.apiUrl}/articulos/${id}`); + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/articulos/${id}`); } getAll(): Observable { - return this.http.get(`${appSettings.apiUrl}/articulos/`); + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/articulos/`); } getAllWithPaginator(page: number = 1): Observable { - return this.http.get(`${appSettings.apiUrl}/articulos/${page}`); + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/articulos/${page}`); } setProductos(producto: Producto) { @@ -57,28 +57,28 @@ export class ProductoService { getPromocionByCodigos(sector, codigo): Observable { - var url = `${appSettings.apiUrl}/promociones/by-codigos/${sector}/${codigo}`; + var url = `${APP_SETTINGS.apiAutoservicio}/promociones/by-codigos/${sector}/${codigo}`; // var url = `${appSettings.apiUrl}/promociones/by-codigos/${2}/${7}`; return this.http.get(url); } getPromociones(sector, codigo): Observable { - var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; + var url = `${APP_SETTINGS.apiAutoservicio}/promociones/incluir-articulo/${sector}/${codigo}`; // var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${2}/${1306}`; return this.http.get(url); } getPromocionSinonimos(sector, codigo): Observable { - var url = `${appSettings.apiUrl}/sinonimos/promo/${sector}/${codigo}`; + var url = `${APP_SETTINGS.apiAutoservicio}/sinonimos/promo/${sector}/${codigo}`; // var url = `${appSettings.apiUrl}/sinonimos/promo/${2}/${7}`; return this.http.get(url); } getCategorias() { - - return this.http.get(`${appSettings.apiUrl}/categorias`); + + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/categorias`); } pagar(dataPago: any) { @@ -87,12 +87,13 @@ export class ProductoService { this.clienteService.getClienteById(-1).subscribe(cliente => { - this.http.post(`${appSettings.apiUrl}/comprobante/guardar/${dataPago.medioPago}`, { + let puntoVenta = parseInt(localStorage.getItem('impresoraPVE')); + this.http.post(`${APP_SETTINGS.apiAutoservicio}/comprobante/guardar/${dataPago.medioPago}`, { productos: this.productos, cliente: cliente, origen: 'autoservicio', codigoVendedor: 5, - puntoVenta: parseInt(localStorage.getItem('impresoraPVE')), + puntoVenta: dataPago.medioPago === 9 ? -1 * puntoVenta : puntoVenta, pedidoAnombreDe: dataPago.pedidoAnombreDe, }).subscribe((data) => { diff --git a/src/app/services/punto-venta.service.ts b/src/app/services/punto-venta.service.ts index d43d7cc..5624799 100644 --- a/src/app/services/punto-venta.service.ts +++ b/src/app/services/punto-venta.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/internal/Observable'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; import { HttpClient } from '@angular/common/http'; @Injectable({ @@ -8,7 +8,8 @@ import { HttpClient } from '@angular/common/http'; }) export class PuntoVentaService { - private apiAutoservico = appSettings.apiUrl; + private apiAutoservico = APP_SETTINGS.apiAutoservicio; + private apiDeboSuite = APP_SETTINGS.apiDeboSuite; constructor( private http: HttpClient @@ -26,7 +27,7 @@ export class PuntoVentaService { getVendedor(filter: any = {}): Observable { - return this.http.get(`${this.apiAutoservico}/get/vendedor/${JSON.stringify(filter)}`); + return this.http.get(`${this.apiDeboSuite}/get/vendedor/${JSON.stringify(filter)}`); } } diff --git a/src/app/services/tarjetas.service.ts b/src/app/services/tarjetas.service.ts index 13f9885..5f07b73 100644 --- a/src/app/services/tarjetas.service.ts +++ b/src/app/services/tarjetas.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; -import { appSettings } from 'src/etc/AppSettings'; +import { APP_SETTINGS } from 'src/etc/AppSettings'; @Injectable({ providedIn: 'root' @@ -12,6 +12,6 @@ export class TarjetasService { getTarjetas(): Observable { - return this.http.get(`${appSettings.apiUrl}/tarjetas`); + return this.http.get(`${APP_SETTINGS.apiAutoservicio}/tarjetas`); } } diff --git a/src/etc/AppSettings ejemplo.ts b/src/etc/AppSettings ejemplo.ts index ea89eb1..06c7bab 100644 --- a/src/etc/AppSettings ejemplo.ts +++ b/src/etc/AppSettings ejemplo.ts @@ -1,5 +1,6 @@ -export const appSettings = { - // apiUrl: 'http://10.231.45.117:4705/autoservicio', +export const APP_SETTINGS = { + // apiAutoservicio: 'http://10.231.45.117:4705/autoservicio', + // apiDeboSuite: 'http://10.231.45.117:9900', // apiImagenes: 'http://10.231.45.117:4513/', // apiClientes: 'http://localhost:1515/clientes' };