Commit cd58fc31dc25760e48335009f32c42e5fb4929cd
1 parent
6bcc15aa08
Exists in
master
and in
1 other branch
arreglos identacion
Showing
4 changed files
with
7 additions
and
12 deletions
Show diff stats
src/app/components/home/home.component.html
1 | <div class="container-fluid p-0"> | 1 | <div class="container-fluid p-0"> |
2 | <img | 2 | <img |
3 | src="{{apiImagenes}}/imagenes/homeBackground.jpg" | 3 | src="../../../assets/img/homeBackground.jpg" |
4 | class="background-image vh-100 w-100"> | 4 | class="background-image vh-100 w-100"> |
5 | <div | 5 | <div |
6 | class="fade-in vh-100 d-flex align-content-between flex-wrap disable-user-select" | 6 | class="fade-in vh-100 d-flex align-content-between flex-wrap disable-user-select" |
7 | [routerLink]="['/inicio']"> | 7 | [routerLink]="['/inicio']"> |
8 | 8 | ||
9 | <!-- HEADER --> | 9 | <!-- HEADER --> |
10 | <div class="vh-15 row m-0 flex-row w-100 bg-primary-gradient-horizontal"> | 10 | <div class="vh-15 row m-0 flex-row w-100 bg-primary-gradient-horizontal"> |
11 | <div class="h-100 w-50 bg-white rounded-bottom-right"> | 11 | <div class="h-100 w-50 bg-white rounded-bottom-right"> |
12 | <img class="h-100 p-2 m-auto d-block" src="{{apiImagenes}}/imagenes/logoempresa.png"> | 12 | <img class="h-100 p-2 m-auto d-block" src="{{apiImagenes}}/imagenes/logoempresa.png"> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | 15 | ||
16 | <!-- INFO DE BIENVENIDA --> | 16 | <!-- INFO DE BIENVENIDA --> |
17 | <div class="h-50 row flex-row justify-content-around align-items-center w-100 m-3"> | 17 | <div class="h-50 row flex-row justify-content-around align-items-center w-100 m-3"> |
18 | <iframe | 18 | <iframe |
19 | class="w-50 h-100 border-0 rounded fade-in" | 19 | class="w-50 h-100 border-0 rounded fade-in" |
20 | src="https://www.youtube.com/embed/vb8ZcalBDyw?&autoplay=1&loop=1&playlist=vb8ZcalBDyw&controls=0&showinfo=0&mute=1"> | 20 | src="https://www.youtube.com/embed/vb8ZcalBDyw?&autoplay=1&loop=1&playlist=vb8ZcalBDyw&controls=0&showinfo=0&mute=1"> |
21 | </iframe> | 21 | </iframe> |
22 | <div class="w-auto text-center text-white"> | 22 | <div class="w-auto text-center text-white"> |
23 | <p class="display-4 font-weight-bold m-0">¡BIENVENIDO!</p> | 23 | <p class="display-4 font-weight-bold m-0">¡BIENVENIDO!</p> |
24 | <p class="display-4 m-0 font-weight-bold">Toque la pantalla<br>para comenzar</p> | 24 | <p class="display-4 m-0 font-weight-bold">Toque la pantalla<br>para comenzar</p> |
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | 27 | ||
28 | <!-- FOOTER --> | 28 | <!-- FOOTER --> |
29 | <div class="vh-15 row m-0 flex-row-reverse w-100 bg-gray"> | 29 | <div class="vh-15 row m-0 flex-row-reverse w-100 bg-gray"> |
30 | <div class="h-100 w-50 bg-white rounded-top-left"> | 30 | <div class="h-100 w-50 bg-white rounded-top-left"> |
31 | <img class="h-100 p-2 m-auto d-block" src="{{apiImagenes}}/imagenes/logodebo.png"> | 31 | <img class="h-100 p-2 m-auto d-block" src="../../../assets/img/logodebo.png"> |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
34 | 34 | ||
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
37 | 37 |
src/app/components/popover-promos/popover-promos.component.ts
1 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; | 1 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; |
2 | import { PopoverDirective } from 'ngx-bootstrap/popover'; | 2 | import { PopoverDirective } from 'ngx-bootstrap/popover'; |
3 | import { Producto } from 'src/app/wrappers/producto'; | 3 | import { Producto } from 'src/app/wrappers/producto'; |
4 | 4 | ||
5 | @Component({ | 5 | @Component({ |
6 | selector: 'app-popover-promos', | 6 | selector: 'app-popover-promos', |
7 | templateUrl: './popover-promos.component.html', | 7 | templateUrl: './popover-promos.component.html', |
8 | styleUrls: ['./popover-promos.component.scss'] | 8 | styleUrls: ['./popover-promos.component.scss'] |
9 | }) | 9 | }) |
10 | export class PopoverPromosComponent implements OnInit { | 10 | export class PopoverPromosComponent implements OnInit { |
11 | 11 | ||
12 | @Input() popover: PopoverDirective; | 12 | @Input() popover: PopoverDirective; |
13 | @Input() popoverContent: Producto[]; | 13 | @Input() popoverContent: Producto[]; |
14 | @Output() promoSeleccionada = new EventEmitter<Producto>(); | 14 | @Output() promoSeleccionada = new EventEmitter<Producto>(); |
15 | 15 | ||
16 | constructor() { } | 16 | constructor() { } |
17 | 17 | ||
18 | ngOnInit() { | 18 | ngOnInit() { |
19 | } | 19 | } |
20 | 20 | ||
21 | hide() { | 21 | hide() { |
22 | this.popover.hide(); | 22 | this.popover.hide(); |
23 | } | 23 | } |
24 | 24 | ||
25 | seleccionarPromo(promo: Producto) { | 25 | seleccionarPromo(promo: Producto) { |
26 | 26 | ||
27 | this.promoSeleccionada.emit(promo); | 27 | this.promoSeleccionada.emit(promo); |
28 | } | 28 | } |
29 | 29 | ||
30 | calcularPrecioDePromo(promo: Producto) { | 30 | calcularPrecioDePromo(promo: Producto) { |
31 | 31 | ||
32 | promo.PreVen = 0; | 32 | promo.PreVen = 0; |
33 | promo.productos.forEach(producto => { | 33 | promo.productos.forEach(producto => { |
34 | promo.PreVen += producto.PreVen; | 34 | promo.PreVen += producto.PreVen; |
35 | }) | 35 | }) |
36 | return promo.PreVen; | 36 | return promo.PreVen; |
37 | } | 37 | } |
38 | 38 | ||
39 | } | 39 | } |
40 | 40 |
src/app/components/popover-sinonimos/popover-sinonimos.component.ts
1 | import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; | 1 | import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; |
2 | import { PopoverDirective } from 'ngx-bootstrap'; | 2 | import { PopoverDirective } from 'ngx-bootstrap'; |
3 | import { Producto } from 'src/app/wrappers/producto'; | 3 | import { Producto } from 'src/app/wrappers/producto'; |
4 | import { Sinonimo } from 'src/app/wrappers/sinonimo'; | 4 | import { Sinonimo } from 'src/app/wrappers/sinonimo'; |
5 | import { ProductoService } from 'src/app/services/producto.service'; | 5 | import { ProductoService } from 'src/app/services/producto.service'; |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
8 | selector: 'app-popover-sinonimos', | 8 | selector: 'app-popover-sinonimos', |
9 | templateUrl: './popover-sinonimos.component.html', | 9 | templateUrl: './popover-sinonimos.component.html', |
10 | styleUrls: ['./popover-sinonimos.component.scss'] | 10 | styleUrls: ['./popover-sinonimos.component.scss'] |
11 | }) | 11 | }) |
12 | export class PopoverSinonimosComponent implements OnInit { | 12 | export class PopoverSinonimosComponent implements OnInit { |
13 | 13 | ||
14 | //Directiva del popover, para poder cerrarlo desde este componente | 14 | //Directiva del popover, para poder cerrarlo desde este componente |
15 | @Input() popover: PopoverDirective; | 15 | @Input() popover: PopoverDirective; |
16 | @Input() popoverContent: Sinonimo[]; | 16 | @Input() popoverContent: Sinonimo[]; |
17 | @Output() productosPersonalizados = new EventEmitter<any>(); | 17 | @Output() productosPersonalizados = new EventEmitter<any>(); |
18 | private cantMin: number = 1; | 18 | private cantMin: number = 1; |
19 | private cantMax: number = 50; | 19 | private cantMax: number = 50; |
20 | private cantidadRestanteSinonimos: number = 0; | 20 | private cantidadRestanteSinonimos: number = 0; |
21 | private cantidadOriginal: number = 0; | 21 | private cantidadOriginal: number = 0; |
22 | private cantidadPromo: number = 1; | 22 | private cantidadPromo: number = 1; |
23 | 23 | ||
24 | constructor(private productoService: ProductoService) { } | 24 | constructor(private productoService: ProductoService) { } |
25 | 25 | ||
26 | ngOnInit() { | 26 | ngOnInit() { |
27 | 27 | ||
28 | this.popoverContent.forEach(sinonimo => { | 28 | this.popoverContent.forEach(sinonimo => { |
29 | 29 | ||
30 | sinonimo.productos.forEach((producto, index) => { | 30 | sinonimo.productos.forEach((producto, index) => { |
31 | 31 | ||
32 | if (this.productoService.esPromoPersonalizada) { | 32 | if (this.productoService.esPromoPersonalizada) { |
33 | producto.cantidad = producto.cantidad ? producto.cantidad : 0; | 33 | producto.cantidad = producto.cantidad ? producto.cantidad : 0; |
34 | this.cantidadRestanteSinonimos = 0; | 34 | this.cantidadRestanteSinonimos = 0; |
35 | this.cantidadOriginal = 0; | 35 | this.cantidadOriginal = 0; |
36 | } else { | 36 | } else { |
37 | this.cantidadRestanteSinonimos += producto.cantidad ? producto.cantidad : 0; | 37 | this.cantidadRestanteSinonimos += producto.cantidad ? producto.cantidad : 0; |
38 | this.cantidadOriginal += producto.cantidad ? producto.cantidad : 0; | 38 | this.cantidadOriginal += producto.cantidad ? producto.cantidad : 0; |
39 | producto.cantidad = 0; | 39 | producto.cantidad = 0; |
40 | } | 40 | } |
41 | 41 | ||
42 | }) | 42 | }) |
43 | }) | 43 | }) |
44 | } | 44 | } |
45 | 45 | ||
46 | continuar() { | 46 | continuar() { |
47 | 47 | ||
48 | //Si aún quedan articulos que agregar no deja continuar. | 48 | //Si aún quedan articulos que agregar no deja continuar. |
49 | if (this.cantidadRestanteSinonimos > 0) return; | 49 | if (this.cantidadRestanteSinonimos > 0) return; |
50 | var productosAenviar: Producto[] = []; | 50 | var productosAenviar: Producto[] = []; |
51 | 51 | ||
52 | this.popoverContent.forEach(sinonimo => { | 52 | this.popoverContent.forEach(sinonimo => { |
53 | 53 | ||
54 | sinonimo.productos.forEach(producto => { | 54 | sinonimo.productos.forEach(producto => { |
55 | 55 | ||
56 | if (producto.cantidad > 0) { | 56 | if (producto.cantidad > 0) { |
57 | producto.idSinonimo = sinonimo.ID_SIN; | 57 | producto.idSinonimo = sinonimo.ID_SIN; |
58 | 58 | ||
59 | productosAenviar.push(producto); | 59 | productosAenviar.push(producto); |
60 | } | 60 | } |
61 | }) | 61 | }) |
62 | }) | 62 | }) |
63 | 63 | ||
64 | this.productosPersonalizados.emit({productosAenviar: productosAenviar,cantidadPromo: this.cantidadPromo}); | 64 | this.productosPersonalizados.emit({productosAenviar: productosAenviar, cantidadPromo: this.cantidadPromo}); |
65 | this.popover.hide(); | 65 | this.popover.hide(); |
66 | } | 66 | } |
67 | 67 | ||
68 | sumarCantidad(producto: Producto, i: number) { | 68 | sumarCantidad(producto: Producto, i: number) { |
69 | 69 | ||
70 | if (this.cantidadRestanteSinonimos === 0) return; | 70 | if (this.cantidadRestanteSinonimos === 0) return; |
71 | producto.cantidad++; | 71 | producto.cantidad++; |
72 | this.cantidadRestanteSinonimos--; | 72 | this.cantidadRestanteSinonimos--; |
73 | } | 73 | } |
74 | 74 | ||
75 | restarCantidad(producto: Producto, i: number) { | 75 | restarCantidad(producto: Producto, i: number) { |
76 | 76 | ||
77 | if (this.cantidadRestanteSinonimos === this.popoverContent[i].cantidad) return; | 77 | if (this.cantidadRestanteSinonimos === this.popoverContent[i].cantidad) return; |
78 | if (producto.cantidad === 0) return; | 78 | if (producto.cantidad === 0) return; |
79 | producto.cantidad--; | 79 | producto.cantidad--; |
80 | this.cantidadRestanteSinonimos++; | 80 | this.cantidadRestanteSinonimos++; |
81 | } | 81 | } |
82 | 82 | ||
83 | sumarCantidadPromo() { | 83 | sumarCantidadPromo() { |
84 | 84 | ||
85 | if (this.cantidadPromo < this.cantMax) { | 85 | if (this.cantidadPromo < this.cantMax) { |
86 | this.cantidadPromo++; | 86 | this.cantidadPromo++; |
87 | this.cantidadRestanteSinonimos += this.cantidadOriginal; | 87 | this.cantidadRestanteSinonimos += this.cantidadOriginal; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | restarCantidadPromo() { | 91 | restarCantidadPromo() { |
92 | 92 | ||
93 | if (this.cantidadPromo > this.cantMin) { | 93 | if (this.cantidadPromo > this.cantMin) { |
94 | this.cantidadPromo--; | 94 | this.cantidadPromo--; |
95 | this.cantidadRestanteSinonimos -= this.cantidadOriginal; | 95 | this.cantidadRestanteSinonimos -= this.cantidadOriginal; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | } | 99 | } |
100 | 100 |
src/etc/AppSettings..ts
1 | export const appSettings = { | File was deleted | |
2 | apiUrl: 'http://localhost:4705/autoservicio', | ||
3 | apiImagenes: 'http://localhost:5635', | ||
4 | apiClientes: 'http://localhost:1515/clientes' | ||
5 | }; | ||
6 | 1 | export const appSettings = { |