Compare View
Commits (19)
-
Master(mpuebla) See merge request !126
-
Master(mpuebla) See merge request !127
-
Validar pve See merge request !128
-
Master(mpuebla) See merge request !129
-
Master(mpuebla) See merge request !130
-
Master(mpuebla) See merge request !131
-
Master(mpuebla) See merge request !132
-
Master(mpuebla) See merge request !133
Showing
22 changed files
Show diff stats
package.json
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/configuracion/configuracion.component.ts
... | ... | @@ -5,6 +5,7 @@ import { PuntoVenta } from 'src/app/wrappers/puntoVenta'; |
5 | 5 | import { ImpresoraService } from 'src/app/services/impresora.service'; |
6 | 6 | import { Impresora } from 'src/app/wrappers/impresora'; |
7 | 7 | import { FormGroup, FormControl } from '@angular/forms'; |
8 | +import { Router } from '@angular/router'; | |
8 | 9 | |
9 | 10 | @Component({ |
10 | 11 | selector: 'app-configuracion', |
... | ... | @@ -16,11 +17,13 @@ export class ConfiguracionComponent implements OnInit { |
16 | 17 | puntosVenta: PuntoVenta[] = []; |
17 | 18 | impresoras: Impresora[] = []; |
18 | 19 | form: FormGroup; |
20 | + reiniciar: boolean = false; | |
19 | 21 | |
20 | 22 | constructor( |
21 | 23 | private activeModal: BsModalRef, |
22 | 24 | private puntoVentaService: PuntoVentaService, |
23 | 25 | private impresoraService: ImpresoraService, |
26 | + private router: Router | |
24 | 27 | ) { } |
25 | 28 | |
26 | 29 | ngOnInit() { |
... | ... | @@ -50,9 +53,13 @@ export class ConfiguracionComponent implements OnInit { |
50 | 53 | close() { |
51 | 54 | |
52 | 55 | this.activeModal.hide(); |
56 | + if (this.reiniciar) { | |
57 | + this.router.navigate(['inicio']); | |
58 | + } | |
53 | 59 | } |
54 | 60 | |
55 | 61 | acept() { |
62 | + this.reiniciar = !localStorage.getItem('impresoraPVE') ? true : false; | |
56 | 63 | |
57 | 64 | let auxPuntoVenta = this.puntosVenta.find(p => p.ID === this.form.get('puntoVenta').value); |
58 | 65 | let auxImpresora = this.impresoras.find(p => p.PVE === this.form.get('impresora').value); |
src/app/components/confirmacion-carrito/confirmacion-carrito.component.html
... | ... | @@ -32,10 +32,11 @@ |
32 | 32 | </label> |
33 | 33 | <div class="col-12 col-sm-6 col-md-5 col-lg-5"> |
34 | 34 | <input |
35 | + [matKeyboard]="'spanish'" | |
35 | 36 | type="text" |
36 | 37 | class="form-control text-center" |
37 | 38 | id="customLabel" |
38 | - maxlength="24" | |
39 | + maxlength="24" | |
39 | 40 | [(ngModel)]="pedidoAnombreDe" |
40 | 41 | autofocus |
41 | 42 | > |
... | ... | @@ -63,7 +64,7 @@ |
63 | 64 | <div *ngIf="producto.tieneSinonimos"> |
64 | 65 | <p *ngFor="let p of producto.productos" class="h6 text-left m-0"> |
65 | 66 | <small> |
66 | - - {{producto.cantidad}} {{p.DET_LAR}} | |
67 | + - {{p.cantidad * producto.cantidad}} {{p.DET_LAR}} | |
67 | 68 | </small> |
68 | 69 | </p> |
69 | 70 | </div> |
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.html
1 | -<div class="row m-0 fade-in"> | |
1 | +<div class="row m-0 fade-in" [hidden]="!mostrarPantalla"> | |
2 | 2 | <div class="col-12 p-0"> |
3 | 3 | |
4 | 4 | <!-- NOMBRE DE SECCION --> |
... | ... | @@ -209,3 +209,7 @@ |
209 | 209 | |
210 | 210 | </div> |
211 | 211 | </div> |
212 | + | |
213 | +<div class="row m-0 fade-in" [hidden]="mostrarPantalla"> | |
214 | + <p class="w-100 text-center">No está configurado el punto de venta</p> | |
215 | +</div> |
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,8 @@ 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 | + private mostrarPantalla : boolean = false; | |
25 | 26 | |
26 | 27 | @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective; |
27 | 28 | |
... | ... | @@ -44,6 +45,7 @@ export class InicioComponent implements OnInit, AfterViewInit { |
44 | 45 | |
45 | 46 | this.productoAcargar = this.productoService.productoAcargar; |
46 | 47 | this.getProductos(); |
48 | + this.mostrarPantalla = localStorage.getItem('impresoraPVE') ? true : false; | |
47 | 49 | } |
48 | 50 | |
49 | 51 | ngAfterViewInit() { |
... | ... | @@ -89,15 +91,11 @@ export class InicioComponent implements OnInit, AfterViewInit { |
89 | 91 | }, error => { console.error(error); }) |
90 | 92 | } |
91 | 93 | |
92 | - confirmarProducto(cantidad?: number) { | |
94 | + confirmarProducto() { | |
93 | 95 | |
94 | 96 | let producto = this.promoAcargar ? this.promoAcargar : this.productoAcargar; |
95 | 97 | |
96 | - if (cantidad) { | |
97 | - producto.cantidad = cantidad; | |
98 | - } else { | |
99 | - producto.cantidad = producto.cantidad ? producto.cantidad : 1; | |
100 | - } | |
98 | + producto.cantidad = producto.cantidad ? producto.cantidad : 1; | |
101 | 99 | |
102 | 100 | this.productoService.setProductos(producto); |
103 | 101 | this.productoService.productoAcargar = this.promoAcargar = this.productoAcargar = undefined; |
... | ... | @@ -150,9 +148,9 @@ export class InicioComponent implements OnInit, AfterViewInit { |
150 | 148 | }) |
151 | 149 | } |
152 | 150 | |
153 | - productosPersonalizados($event: any) { | |
151 | + productosPersonalizados($event: Producto[]) { | |
154 | 152 | |
155 | - let productosPersonalizados = $event.productosAenviar; | |
153 | + let productosPersonalizados = $event; | |
156 | 154 | |
157 | 155 | productosPersonalizados.forEach(productoElegido => { |
158 | 156 | |
... | ... | @@ -162,7 +160,8 @@ export class InicioComponent implements OnInit, AfterViewInit { |
162 | 160 | }); |
163 | 161 | |
164 | 162 | this.promoAcargar.productos = this.promoAcargar.productos.concat(productosPersonalizados); |
165 | - this.confirmarProducto($event.cantidadPromo); | |
163 | + | |
164 | + this.confirmarProducto(); | |
166 | 165 | } |
167 | 166 | |
168 | 167 | buscarByCodigoBarras(busqueda) { |
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/popover-sinonimos/popover-sinonimos.component.html
... | ... | @@ -8,37 +8,11 @@ |
8 | 8 | </div> |
9 | 9 | </div> |
10 | 10 | |
11 | - <div class="row m-0 pr-2 my-2"> | |
11 | + <div class="row m-0 pr-2"> | |
12 | 12 | <div class="col"> |
13 | - <div class="row mb-2" *ngFor="let sinonimo of popoverContent; let i = index"> | |
13 | + <div class="row" *ngFor="let sinonimo of popoverContent; let i = index"> | |
14 | 14 | <div class="col p-0"> |
15 | 15 | |
16 | - <div class="row py-2 mb-3"> | |
17 | - <div class="col-12"> | |
18 | - <div class="btn-group float-right my-auto" role="group"> | |
19 | - <button | |
20 | - type="button" | |
21 | - class="btn btn-light my-auto border shadow" | |
22 | - (click)="sumarCantidadPromo()"> | |
23 | - <i class="fa fa-plus" aria-hidden="true"></i> | |
24 | - </button> | |
25 | - <div class="bg-white border border-white px-3 py-1 my-auto text-dark h5"> | |
26 | - <small | |
27 | - class="font-weight-bold"> | |
28 | - {{cantidadPromo}} | |
29 | - </small> | |
30 | - </div> | |
31 | - <button | |
32 | - type="button" | |
33 | - class="btn btn-light my-auto border shadow" | |
34 | - (click)="restarCantidadPromo()" | |
35 | - [disabled]="cantidadRestanteSinonimos < cantidadOriginal || cantidadPromo === 1"> | |
36 | - <i class="fa fa-minus" aria-hidden="true"></i> | |
37 | - </button> | |
38 | - </div> | |
39 | - </div> | |
40 | - </div> | |
41 | - | |
42 | 16 | <div class="row bg-white text-dark m-0 py-1 shadow"> |
43 | 17 | <div class="col text-left"> |
44 | 18 | <p class="h5 m-0 card-title"> |
... | ... | @@ -56,7 +30,7 @@ |
56 | 30 | |
57 | 31 | <div class="row m-0 popover-size overflow-scroll"> |
58 | 32 | <div class="col-12 p-0"> |
59 | - <div class="row m-0 my-3 d-flex justify-content-between" *ngFor="let producto of sinonimo.productos"> | |
33 | + <div class="row m-0 my-2 d-flex justify-content-between" *ngFor="let producto of sinonimo.productos"> | |
60 | 34 | <div class="col-7 p-0 h6 text-right"> |
61 | 35 | <p class="m-0 font-weight-normal"> |
62 | 36 | {{producto.DetArt}} |
... | ... | @@ -94,7 +68,7 @@ |
94 | 68 | </div> |
95 | 69 | </div> |
96 | 70 | |
97 | - <div class="row mt-3 justify-content-end"> | |
71 | + <div class="row m-0"> | |
98 | 72 | <div class="col"> |
99 | 73 | <button |
100 | 74 | [disabled]="cantidadRestanteSinonimos > 0" |
src/app/components/popover-sinonimos/popover-sinonimos.component.ts
... | ... | @@ -14,12 +14,8 @@ export class PopoverSinonimosComponent implements OnInit { |
14 | 14 | //Directiva del popover, para poder cerrarlo desde este componente |
15 | 15 | @Input() popover: PopoverDirective; |
16 | 16 | @Input() popoverContent: Sinonimo[]; |
17 | - @Output() productosPersonalizados = new EventEmitter<any>(); | |
18 | - private cantMin: number = 1; | |
19 | - private cantMax: number = 50; | |
17 | + @Output() productosPersonalizados = new EventEmitter<Producto[]>(); | |
20 | 18 | private cantidadRestanteSinonimos: number = 0; |
21 | - private cantidadOriginal: number = 0; | |
22 | - private cantidadPromo: number = 1; | |
23 | 19 | |
24 | 20 | constructor(private productoService: ProductoService) { } |
25 | 21 | |
... | ... | @@ -32,10 +28,8 @@ export class PopoverSinonimosComponent implements OnInit { |
32 | 28 | if (this.productoService.esPromoPersonalizada) { |
33 | 29 | producto.cantidad = producto.cantidad ? producto.cantidad : 0; |
34 | 30 | this.cantidadRestanteSinonimos = 0; |
35 | - this.cantidadOriginal = 0; | |
36 | 31 | } else { |
37 | 32 | this.cantidadRestanteSinonimos += producto.cantidad ? producto.cantidad : 0; |
38 | - this.cantidadOriginal += producto.cantidad ? producto.cantidad : 0; | |
39 | 33 | producto.cantidad = 0; |
40 | 34 | } |
41 | 35 | |
... | ... | @@ -55,13 +49,12 @@ export class PopoverSinonimosComponent implements OnInit { |
55 | 49 | |
56 | 50 | if (producto.cantidad > 0) { |
57 | 51 | producto.idSinonimo = sinonimo.ID_SIN; |
58 | - | |
59 | 52 | productosAenviar.push(producto); |
60 | 53 | } |
61 | 54 | }) |
62 | 55 | }) |
63 | 56 | |
64 | - this.productosPersonalizados.emit({productosAenviar: productosAenviar, cantidadPromo: this.cantidadPromo}); | |
57 | + this.productosPersonalizados.emit(productosAenviar); | |
65 | 58 | this.popover.hide(); |
66 | 59 | } |
67 | 60 | |
... | ... | @@ -79,21 +72,4 @@ export class PopoverSinonimosComponent implements OnInit { |
79 | 72 | producto.cantidad--; |
80 | 73 | this.cantidadRestanteSinonimos++; |
81 | 74 | } |
82 | - | |
83 | - sumarCantidadPromo() { | |
84 | - | |
85 | - if (this.cantidadPromo < this.cantMax) { | |
86 | - this.cantidadPromo++; | |
87 | - this.cantidadRestanteSinonimos += this.cantidadOriginal; | |
88 | - } | |
89 | - } | |
90 | - | |
91 | - restarCantidadPromo() { | |
92 | - | |
93 | - if (this.cantidadPromo > this.cantMin) { | |
94 | - this.cantidadPromo--; | |
95 | - this.cantidadRestanteSinonimos -= this.cantidadOriginal; | |
96 | - } | |
97 | - } | |
98 | - | |
99 | 75 | } |
src/app/components/sidebar/sidebar.component.html
... | ... | @@ -28,8 +28,7 @@ |
28 | 28 | <button |
29 | 29 | type="button" |
30 | 30 | class="btn btn-light btn-sm border shadow" |
31 | - (click)="aumentarCantidad(producto)" | |
32 | - [hidden]="producto.PRO"> | |
31 | + (click)="aumentarCantidad(producto)"> | |
33 | 32 | <i class="fa fa-plus" aria-hidden="true"></i> |
34 | 33 | </button> |
35 | 34 | <div class="bg-white border border-white my-auto px-2 text-dark h5 shadow"> |
... | ... | @@ -38,8 +37,7 @@ |
38 | 37 | <button |
39 | 38 | type="button" |
40 | 39 | class="btn btn-light btn-sm border shadow" |
41 | - (click)="restarCantidad(producto)" | |
42 | - [hidden]="producto.PRO"> | |
40 | + (click)="restarCantidad(producto)"> | |
43 | 41 | <i class="fa fa-minus" aria-hidden="true"></i> |
44 | 42 | </button> |
45 | 43 | </div> |
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 'rxjs/internal/Observable'; |
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 '@angular/common/http'; |
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 | }; |