Commit 3860f1b8dbd2e31997109c60ce6b8edd1bba7ccc
1 parent
5a2a230170
Exists in
master
alert
Showing
7 changed files
with
98 additions
and
0 deletions
Show diff stats
src/app/modal/modal-alert/modal-alert.component.html
| File was created | 1 | <div class="modal-header"> | |
| 2 | <h4>Atención</h4> | ||
| 3 | </div> | ||
| 4 | <div class="modal-body"> | ||
| 5 | <p class="line-break"> | ||
| 6 | {{textoModal}} | ||
| 7 | </p> | ||
| 8 | </div> | ||
| 9 | <div class="modal-footer"> | ||
| 10 | <button class="btn btn-primary" (click)="aceptar()">Aceptar</button> | ||
| 11 | </div> | ||
| 12 |
src/app/modal/modal-alert/modal-alert.component.scss
src/app/modal/modal-alert/modal-alert.component.spec.ts
| File was created | 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
| 2 | |||
| 3 | import { ModalAlertComponent } from './modal-alert.component'; | ||
| 4 | |||
| 5 | describe('ModalAlertComponent', () => { | ||
| 6 | let component: ModalAlertComponent; | ||
| 7 | let fixture: ComponentFixture<ModalAlertComponent>; | ||
| 8 | |||
| 9 | beforeEach(async(() => { | ||
| 10 | TestBed.configureTestingModule({ | ||
| 11 | declarations: [ ModalAlertComponent ] | ||
| 12 | }) | ||
| 13 | .compileComponents(); | ||
| 14 | })); | ||
| 15 | |||
| 16 | beforeEach(() => { | ||
| 17 | fixture = TestBed.createComponent(ModalAlertComponent); | ||
| 18 | component = fixture.componentInstance; | ||
| 19 | fixture.detectChanges(); | ||
| 20 | }); | ||
| 21 | |||
| 22 | it('should create', () => { | ||
| 23 | expect(component).toBeTruthy(); | ||
| 24 | }); | ||
| 25 | }); | ||
| 26 |
src/app/modal/modal-alert/modal-alert.component.ts
| File was created | 1 | import { Component, OnInit, Input } from '@angular/core'; | |
| 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
| 3 | |||
| 4 | @Component({ | ||
| 5 | templateUrl: './modal-alert.component.html', | ||
| 6 | styleUrls: ['./modal-alert.component.scss'] | ||
| 7 | }) | ||
| 8 | export class ModalAlertComponent implements OnInit { | ||
| 9 | |||
| 10 | textoModal: string; | ||
| 11 | |||
| 12 | constructor(private activeModal: NgbActiveModal) { } | ||
| 13 | |||
| 14 | ngOnInit() { | ||
| 15 | } | ||
| 16 | |||
| 17 | aceptar() { | ||
| 18 | this.activeModal.close(); | ||
| 19 | } | ||
| 20 | } | ||
| 21 |
src/app/modal/modal.service.spec.ts
| File was created | 1 | import { TestBed } from '@angular/core/testing'; | |
| 2 | |||
| 3 | import { ModalService } from './modal.service'; | ||
| 4 | |||
| 5 | describe('ModalService', () => { | ||
| 6 | beforeEach(() => TestBed.configureTestingModule({})); | ||
| 7 | |||
| 8 | it('should be created', () => { | ||
| 9 | const service: ModalService = TestBed.get(ModalService); | ||
| 10 | expect(service).toBeTruthy(); | ||
| 11 | }); | ||
| 12 | }); | ||
| 13 |
src/app/modal/modal.service.ts
| File was created | 1 | import { Injectable, ViewChild } from '@angular/core'; | |
| 2 | import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
| 3 | import { ModalAlertComponent } from './modal-alert/modal-alert.component'; | ||
| 4 | |||
| 5 | @Injectable({ | ||
| 6 | providedIn: 'root' | ||
| 7 | }) | ||
| 8 | export class ModalService { | ||
| 9 | |||
| 10 | constructor(private modalService: NgbModal) { } | ||
| 11 | |||
| 12 | modalComponent: ModalAlertComponent; | ||
| 13 | |||
| 14 | alert(texto: string) { | ||
| 15 | return this.modalService.open(ModalAlertComponent).componentInstance.textoModal = texto; | ||
| 16 | } | ||
| 17 | } | ||
| 18 |
src/app/nombre-empresa/nombre-empresa.service.ts
| File was created | 1 | import { Injectable } from '@angular/core'; | |
| 2 | import { HttpClient } from '@angular/common/http'; | ||
| 3 | import { AppSetings } from '../../etc/AppSetings'; | ||
| 4 | |||
| 5 | @Injectable() | ||
| 6 | export class NombreEmpresaService { | ||
| 7 | |||
| 8 | constructor(private http: HttpClient) { } | ||
| 9 | |||
| 10 | getNombreEmpresa() { | ||
| 11 | return this.http.get(AppSetings.END_POINT + `/nombre-empresa/${localStorage.getItem('gln')}`); | ||
| 12 | }; | ||
| 13 | } | ||
| 14 |