diff --git a/src/app/modules/pedidos-salientes/pedidos-salientes.component.html b/src/app/modules/pedidos-salientes/pedidos-salientes.component.html
index bc49af8..4e83bf3 100644
--- a/src/app/modules/pedidos-salientes/pedidos-salientes.component.html
+++ b/src/app/modules/pedidos-salientes/pedidos-salientes.component.html
@@ -9,11 +9,11 @@
-
47
-
48
-
49
-
50
+
4"
+ class="font-weight-bold mb-2 text-muted">
+
{{rellenar(pedido.id.toString().slice(0), 3)}}
@@ -21,8 +21,11 @@
LISTO PARA
retirar
-
46
-
¡Que lo disfrutes!
+
+
+
{{rellenar(pedidosPendientes[0].id.toString().slice(0), 3)}}
+
+
¡Que lo disfrutes!
diff --git a/src/app/modules/pedidos-salientes/pedidos-salientes.component.ts b/src/app/modules/pedidos-salientes/pedidos-salientes.component.ts
index 93ad2f6..4a0e6b2 100644
--- a/src/app/modules/pedidos-salientes/pedidos-salientes.component.ts
+++ b/src/app/modules/pedidos-salientes/pedidos-salientes.component.ts
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
+import { ComandaService } from 'src/app/services/comanda/comanda.service';
@Component({
selector: 'app-pedidos-salientes',
@@ -6,10 +7,42 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./pedidos-salientes.component.scss']
})
export class PedidosSalientesComponent implements OnInit {
+ pedidosPendientes = [];
+ cicloTime;
- constructor() { }
+ constructor(
+ private comandaServices: ComandaService
+ ) { }
ngOnInit() {
+ this.buscarPedidosPendientes();
+ this.ciclo()
+ }
+
+ ngOnDestroy() {
+ clearTimeout(this.cicloTime);
+ }
+
+ buscarPedidosPendientes() {
+ this.comandaServices.getPendientesEntrega()
+ .subscribe((pedidos: []) => {
+ this.pedidosPendientes = pedidos
+ })
+ }
+
+ ciclo() {
+ this.cicloTime = setTimeout(() => {
+ this.buscarPedidosPendientes();
+ this.ciclo();
+ }, 5000)
+ }
+
+ rellenar(relleno, longitud) {
+ relleno = '' + relleno;
+ while (relleno.length < longitud) {
+ relleno = '0' + relleno;
+ }
+ return relleno;
}
}
diff --git a/src/app/services/comanda/comanda.service.spec.ts b/src/app/services/comanda/comanda.service.spec.ts
new file mode 100644
index 0000000..e1230b3
--- /dev/null
+++ b/src/app/services/comanda/comanda.service.spec.ts
@@ -0,0 +1,12 @@
+import { TestBed } from '@angular/core/testing';
+
+import { ComandaService } from './comanda.service';
+
+describe('ComandaService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: ComandaService = TestBed.get(ComandaService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/services/comanda/comanda.service.ts b/src/app/services/comanda/comanda.service.ts
new file mode 100644
index 0000000..3acd7d7
--- /dev/null
+++ b/src/app/services/comanda/comanda.service.ts
@@ -0,0 +1,19 @@
+import { Injectable } from '@angular/core';
+import { HttpClient } from "@angular/common/http";
+import { APP_SETTINGS } from "src/etc/AppSettings";
+
+@Injectable({
+ providedIn: 'root'
+})
+export class ComandaService {
+ urlDeboSuite = APP_SETTINGS.apiDeboSuite;
+
+ constructor(
+ private http: HttpClient,
+ ) { }
+
+ getPendientesEntrega() {
+ return this.http.get(`${this.urlDeboSuite}/comandas/pendientes-entrega`);
+ }
+
+}