Commit ef1b783c125f0552e02085c6f13efc37073f1753
1 parent
192b6d09a2
Exists in
develop
corrijo MR
Showing
3 changed files
with
2 additions
and
6 deletions
 
Show diff stats
src/app/shared/confirmacion/confirmacion.component.html
| 1 | <div class="modal-header bg-primary rounded-top pt-4 px-2"> | 1 | <div class="modal-header bg-primary rounded-top pt-4 px-2"> | 
| 2 | <div class="row mx-0 w-100 justify-content-between"> | 2 | <div class="row mx-0 w-100 justify-content-between"> | 
| 3 | <div class="col-8"> | 3 | <div class="col-8"> | 
| 4 | <p *ngIf="titleMessage" class="h3 text-white">{{titleMessage}}</p> | 4 | <p *ngIf="titleMessage" class="h3 text-white">{{titleMessage}}</p> | 
| 5 | </div> | 5 | </div> | 
| 6 | </div> | 6 | </div> | 
| 7 | <div *ngIf="imagenPath" class="col-4 align-self-center"> | 7 | <div *ngIf="imagenPath" class="col-4 align-self-center"> | 
| 8 | <img | 8 | <img | 
| 9 | draggable="false" | 9 | draggable="false" | 
| 10 | ondragstart="return false;" | 10 | ondragstart="return false;" | 
| 11 | (contextmenu)="false" | 11 | (contextmenu)="false" | 
| 12 | src="{{urlImagenes}}{{imagenPath}}" | 12 | src="{{urlImagenes}}{{imagenPath}}" | 
| 13 | onerror="this.src='assets/img/image-not-found.jpg'" | 13 | onerror="this.src='assets/img/image-not-found.jpg'" | 
| 14 | class="card-img-top img-fluid rounded-circle"> | 14 | class="card-img-top img-fluid rounded-circle"> | 
| 15 | </div> | 15 | </div> | 
| 16 | </div> | 16 | </div> | 
| 17 | <div class=" col-12 modal-body bg-primary rounded-bottom pb-3 px-2"> | 17 | <div class=" col-12 modal-body bg-primary rounded-bottom pb-3 px-2"> | 
| 18 | <div class="row justify-content-between mx-0 w-100"> | 18 | <div class="row justify-content-between mx-0 w-100"> | 
| 19 | <div class="col-8"> | 19 | <div class="col-8"> | 
| 20 | <p *ngIf="footerMessageFirst" class="text-white"><small>{{footerMessageFirst}}</small></p > | 20 | <p *ngIf="footerMessageFirst" class="text-white"><small>{{footerMessageFirst}}</small></p > | 
| 21 | <h1 *ngIf="footerMessageSecond" class="text-white mb-4">{{footerMessageSecond}}</h1> | 21 | <h1 *ngIf="footerMessageSecond" class="text-white mb-4">{{footerMessageSecond}}</h1> | 
| 22 | </div> | 22 | </div> | 
| 23 | <div class="col-4"> | 23 | <div class="col-4"> | 
| 24 | <div | 24 | <div | 
| 25 | class="mx-0" | 25 | class="mx-0" | 
| 26 | (click)="confirmarArticulo(true)"> | 26 | (click)="confirmarArticulo()"> | 
| 27 | <div class="col-auto bg-white badge-pill"> | 27 | <div class="col-auto bg-white badge-pill"> | 
| 28 | <div class="row justify-content-between"> | 28 | <div class="row justify-content-between"> | 
| 29 | <div *ngIf="footerConfirmation" class="col-auto px-0 align-self-center text-primary pl-3"> | 29 | <div *ngIf="footerConfirmation" class="col-auto px-0 align-self-center text-primary pl-3"> | 
| 30 | <p class="font-weight-bold">{{footerConfirmation | currency}}</p> | 30 | <p class="font-weight-bold">{{footerConfirmation | currency}}</p> | 
| 31 | </div> | 31 | </div> | 
| 32 | <div class="col-auto px-0"> | 32 | <div class="col-auto px-0"> | 
| 33 | <img | 33 | <img | 
| 34 | draggable="false" | 34 | draggable="false" | 
| 35 | ondragstart="return false;" | 35 | ondragstart="return false;" | 
| 36 | (contextmenu)="false" | 36 | (contextmenu)="false" | 
| 37 | class="d-block ml-auto my-1 icon-30 pr-2" | 37 | class="d-block ml-auto my-1 icon-30 pr-2" | 
| 38 | src="assets/img/ir-color.svg"> | 38 | src="assets/img/ir-color.svg"> | 
| 39 | </div> | 39 | </div> | 
| 40 | </div> | 40 | </div> | 
| 41 | </div> | 41 | </div> | 
| 42 | </div> | 42 | </div> | 
| 43 | <div *ngIf="footerClose" class="bg-white badge-pill mt-2"> | 43 | <div *ngIf="footerClose" class="bg-white badge-pill mt-2"> | 
| 44 | <div class="row justify-content-between"> | 44 | <div class="row justify-content-between"> | 
| 45 | <div | 45 | <div | 
| 46 | class="col-auto mx-0 " | 46 | class="col-auto mx-0 " | 
| 47 | (click)="close()"> | 47 | (click)="close()"> | 
| 48 | <p class="font-weight-bold text-center text-primary">{{footerClose}}</p> | 48 | <p class="font-weight-bold text-center text-primary">{{footerClose}}</p> | 
| 49 | </div> | 49 | </div> | 
| 50 | <i class="fas fa-undo-alt text-info mr-3 my-auto"></i> | 50 | <i class="fas fa-undo-alt text-info mr-3 my-auto"></i> | 
| 51 | </div> | 51 | </div> | 
| 52 | </div> | 52 | </div> | 
| 53 | </div> | 53 | </div> | 
| 54 | </div> | 54 | </div> | 
| 55 | </div> | 55 | </div> | 
| 56 | 56 | 
src/app/shared/confirmacion/confirmacion.component.ts
| 1 | import { Component, OnInit, HostListener } from '@angular/core'; | 1 | import { Component, OnInit, HostListener } from '@angular/core'; | 
| 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 
| 3 | import { IArticulo } from 'src/app/interfaces/IArticulo'; | 3 | import { IArticulo } from 'src/app/interfaces/IArticulo'; | 
| 4 | import { BsModalRef } from 'ngx-bootstrap/modal'; | 4 | import { BsModalRef } from 'ngx-bootstrap/modal'; | 
| 5 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; | 5 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; | 
| 6 | import { Subject } from 'rxjs'; | 6 | import { Subject } from 'rxjs'; | 
| 7 | 7 | ||
| 8 | @Component({ | 8 | @Component({ | 
| 9 | selector: 'app-confirmacion', | 9 | selector: 'app-confirmacion', | 
| 10 | templateUrl: './confirmacion.component.html', | 10 | templateUrl: './confirmacion.component.html', | 
| 11 | styleUrls: ['./confirmacion.component.scss'] | 11 | styleUrls: ['./confirmacion.component.scss'] | 
| 12 | }) | 12 | }) | 
| 13 | export class ConfirmacionComponent implements OnInit { | 13 | export class ConfirmacionComponent implements OnInit { | 
| 14 | idArticulo: number; | 14 | idArticulo: number; | 
| 15 | imagenArticulo: any; | 15 | imagenArticulo: any; | 
| 16 | detLarArticulo: string; | 16 | detLarArticulo: string; | 
| 17 | preVenArticulo: any; | 17 | preVenArticulo: any; | 
| 18 | onClose: Subject<any>; | 18 | onClose: Subject<any>; | 
| 19 | 19 | ||
| 20 | constructor( | 20 | constructor( | 
| 21 | public modalRef: BsModalRef, | 21 | public modalRef: BsModalRef, | 
| 22 | private articuloService: ArticuloService, | ||
| 23 | private inactiveScreen: InactiveScreenService, | 22 | private inactiveScreen: InactiveScreenService, | 
| 24 | ) { | 23 | ) { | 
| 25 | this.onClose = new Subject(); | 24 | this.onClose = new Subject(); | 
| 26 | } | 25 | } | 
| 27 | 26 | ||
| 28 | ngOnInit() { | 27 | ngOnInit() { | 
| 29 | } | 28 | } | 
| 30 | 29 | ||
| 31 | confirmarArticulo(value) { | 30 | confirmarArticulo() { | 
| 32 | this.onClose.next(); | 31 | this.onClose.next(); | 
| 33 | this.modalRef.hide(); | 32 | this.modalRef.hide(); | 
| 34 | } | 33 | } | 
| 35 | 34 | ||
| 36 | close() { | 35 | close() { | 
| 37 | this.modalRef.hide(); | 36 | this.modalRef.hide(); | 
| 38 | } | 37 | } | 
| 39 | 38 | ||
| 40 | @HostListener('document:click', ['$event']) | 39 | @HostListener('document:click', ['$event']) | 
| 41 | eventListener(event: Event) { | 40 | eventListener(event: Event) { | 
| 42 | clearTimeout(this.inactiveScreen.timerReposo); | 41 | clearTimeout(this.inactiveScreen.timerReposo); | 
| 43 | this.inactiveScreen.startTimeOutInactividad(); | 42 | this.inactiveScreen.startTimeOutInactividad(); | 
| 44 | } | 43 | } | 
| 45 | } | 44 | } | 
| 46 | 45 | 
src/app/shared/header-publicidad/header-publicidad.component.ts
| 1 | import { Component, OnInit, TemplateRef } from '@angular/core'; | 1 | import { Component, OnInit, TemplateRef } from '@angular/core'; | 
| 2 | import { APP_SETTINGS } from 'src/etc/AppSettings'; | 2 | import { APP_SETTINGS } from 'src/etc/AppSettings'; | 
| 3 | import { IPublicidad } from 'src/app/interfaces/IPublicidad'; | 3 | import { IPublicidad } from 'src/app/interfaces/IPublicidad'; | 
| 4 | import { PublicidadService } from 'src/app/services/publicidad/publicidad.service'; | 4 | import { PublicidadService } from 'src/app/services/publicidad/publicidad.service'; | 
| 5 | import { IArticulo } from 'src/app/interfaces/IArticulo'; | 5 | import { IArticulo } from 'src/app/interfaces/IArticulo'; | 
| 6 | import { PromocionComponent } from '../promocion/promocion.component'; | 6 | import { PromocionComponent } from '../promocion/promocion.component'; | 
| 7 | import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; | 7 | import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; | 
| 8 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 8 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 
| 9 | import { ConfirmacionComponent } from '../confirmacion/confirmacion.component'; | 9 | import { ConfirmacionComponent } from '../confirmacion/confirmacion.component'; | 
| 10 | 10 | ||
| 11 | @Component({ | 11 | @Component({ | 
| 12 | selector: 'app-header-publicidad', | 12 | selector: 'app-header-publicidad', | 
| 13 | templateUrl: './header-publicidad.component.html', | 13 | templateUrl: './header-publicidad.component.html', | 
| 14 | styleUrls: ['./header-publicidad.component.scss'] | 14 | styleUrls: ['./header-publicidad.component.scss'] | 
| 15 | }) | 15 | }) | 
| 16 | export class HeaderPublicidadComponent implements OnInit { | 16 | export class HeaderPublicidadComponent implements OnInit { | 
| 17 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; | 17 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; | 
| 18 | publicidades: IPublicidad[] = []; | 18 | publicidades: IPublicidad[] = []; | 
| 19 | modalRef: BsModalRef; | 19 | modalRef: BsModalRef; | 
| 20 | template: any; | ||
| 21 | 20 | ||
| 22 | constructor( | 21 | constructor( | 
| 23 | private publicidadService: PublicidadService, | 22 | private publicidadService: PublicidadService, | 
| 24 | private articuloService: ArticuloService, | 23 | private articuloService: ArticuloService, | 
| 25 | private modalService: BsModalService, | 24 | private modalService: BsModalService, | 
| 26 | ) { } | 25 | ) { } | 
| 27 | 26 | ||
| 28 | ngOnInit() { | 27 | ngOnInit() { | 
| 29 | this.getPublicidades(); | 28 | this.getPublicidades(); | 
| 30 | } | 29 | } | 
| 31 | 30 | ||
| 32 | getPublicidades() { | 31 | getPublicidades() { | 
| 33 | this.publicidadService.getAll() | 32 | this.publicidadService.getAll() | 
| 34 | .subscribe((res: IPublicidad[]) => { | 33 | .subscribe((res: IPublicidad[]) => { | 
| 35 | this.publicidades = res; | 34 | this.publicidades = res; | 
| 36 | }, err => console.error(err)); | 35 | }, err => console.error(err)); | 
| 37 | } | 36 | } | 
| 38 | 37 | ||
| 39 | elegirArticulo(publicidad: IPublicidad) { | 38 | elegirArticulo(publicidad: IPublicidad) { | 
| 40 | if (publicidad.id_articulo) this.getByID(publicidad.id_articulo); | 39 | if (publicidad.id_articulo) this.getByID(publicidad.id_articulo); | 
| 41 | } | 40 | } | 
| 42 | 41 | ||
| 43 | getByID(id: number) { | 42 | getByID(id: number) { | 
| 44 | this.articuloService.getById(id) | 43 | this.articuloService.getById(id) | 
| 45 | .subscribe((res: IArticulo) => { | 44 | .subscribe((res: IArticulo) => { | 
| 46 | if (res.FPP) { | 45 | if (res.FPP) { | 
| 47 | this.openModalPromos(res); | 46 | this.openModalPromos(res); | 
| 48 | return; | 47 | return; | 
| 49 | } else { | 48 | } else { | 
| 50 | this.openModalConfirmacion(res); | 49 | this.openModalConfirmacion(res); | 
| 51 | return; | 50 | return; | 
| 52 | } | 51 | } | 
| 53 | }, err => console.error(err)); | 52 | }, err => console.error(err)); | 
| 54 | } | 53 | } | 
| 55 | 54 | ||
| 56 | openModalPromos(articulo: IArticulo) { | 55 | openModalPromos(articulo: IArticulo) { | 
| 57 | this.modalRef = this.modalService.show(PromocionComponent, | 56 | this.modalRef = this.modalService.show(PromocionComponent, | 
| 58 | { | 57 | { | 
| 59 | initialState: { | 58 | initialState: { | 
| 60 | idArticulo: articulo.id | 59 | idArticulo: articulo.id | 
| 61 | }, | 60 | }, | 
| 62 | class: 'modal-promo modal-dialog-centered' | 61 | class: 'modal-promo modal-dialog-centered' | 
| 63 | }); | 62 | }); | 
| 64 | } | 63 | } | 
| 65 | 64 | ||
| 66 | openModalConfirmacion(articulo: IArticulo) { | 65 | openModalConfirmacion(articulo: IArticulo) { | 
| 67 | this.modalRef = this.modalService.show(ConfirmacionComponent, | 66 | this.modalRef = this.modalService.show(ConfirmacionComponent, | 
| 68 | { | 67 | { | 
| 69 | initialState: { | 68 | initialState: { | 
| 70 | titleMessage: articulo.DET_LAR, | 69 | titleMessage: articulo.DET_LAR, | 
| 71 | imagenPath: articulo.imagenes, | 70 | imagenPath: articulo.imagenes, | 
| 72 | footerMessageFirst: `¿DESEA AGREGAR ESTE ARTÍCULO`, | 71 | footerMessageFirst: `¿DESEA AGREGAR ESTE ARTÍCULO`, | 
| 73 | footerMessageSecond: `a su carrito?`, | 72 | footerMessageSecond: `a su carrito?`, | 
| 74 | footerConfirmation: articulo.PreVen, | 73 | footerConfirmation: articulo.PreVen, | 
| 75 | footerClose: `volver` | 74 | footerClose: `volver` | 
| 76 | }, | 75 | }, | 
| 77 | class: 'modal-promo modal-dialog-centered' | 76 | class: 'modal-promo modal-dialog-centered' | 
| 78 | }); | 77 | }); | 
| 79 | this.modalRef.content.onClose.subscribe(() => { | 78 | this.modalRef.content.onClose.subscribe(() => { | 
| 80 | articulo.cantidad = 1; | 79 | articulo.cantidad = 1; | 
| 81 | this.articuloService.setArticulo(articulo); | 80 | this.articuloService.setArticulo(articulo); | 
| 82 | }); | 81 | }); | 
| 83 | |||
| 84 | |||
| 85 | } | 82 | } | 
| 86 | 83 | ||
| 87 | } | 84 | } | 
| 88 | 85 |