diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 97b06f4..dbe787b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -39,6 +39,7 @@ import { PageCreationTeamComponent } from './pages/page-creation-team/page-creat import { AutofocusFixModule } from 'ngx-autofocus-fix'; import { EmoticonComponent } from './emoticon/emoticon.component'; import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular"; +import { AlertComponent } from './components/alert/alert.component'; @NgModule({ declarations: [ @@ -75,6 +76,7 @@ import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular"; PageModifierContactComponent, PageCreationTeamComponent, EmoticonComponent, + AlertComponent, ], imports: [ BrowserModule, diff --git a/src/app/components/alert/alert.component.html b/src/app/components/alert/alert.component.html new file mode 100644 index 0000000..1f67880 --- /dev/null +++ b/src/app/components/alert/alert.component.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/src/app/components/alert/alert.component.scss b/src/app/components/alert/alert.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/alert/alert.component.spec.ts b/src/app/components/alert/alert.component.spec.ts new file mode 100644 index 0000000..8e3decb --- /dev/null +++ b/src/app/components/alert/alert.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AlertComponent } from './alert.component'; + +describe('AlertComponent', () => { + let component: AlertComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AlertComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(AlertComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/alert/alert.component.ts b/src/app/components/alert/alert.component.ts new file mode 100644 index 0000000..84c50f0 --- /dev/null +++ b/src/app/components/alert/alert.component.ts @@ -0,0 +1,20 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; + +@Component({ + selector: 'app-alert', + templateUrl: './alert.component.html', + styleUrls: ['./alert.component.scss'] +}) +export class AlertComponent implements OnInit { + @Input() alert:any; + @Output() eventClose = new EventEmitter(); + constructor() { } + + ngOnInit(): void { + } + + onClickCloseAlert(){ + //console.log('fermeture from component'); + this.eventClose.emit('true'); + } +} diff --git a/src/app/pages/page-agenda/page-agenda.component.html b/src/app/pages/page-agenda/page-agenda.component.html index cbf6a17..511b391 100644 --- a/src/app/pages/page-agenda/page-agenda.component.html +++ b/src/app/pages/page-agenda/page-agenda.component.html @@ -1,12 +1,7 @@ - +
diff --git a/src/app/pages/page-agenda/page-agenda.component.ts b/src/app/pages/page-agenda/page-agenda.component.ts index 14f64da..5fc8593 100644 --- a/src/app/pages/page-agenda/page-agenda.component.ts +++ b/src/app/pages/page-agenda/page-agenda.component.ts @@ -13,14 +13,12 @@ export class PageAgendaComponent implements AfterViewInit { userId : any; teamId : any; - isShow: boolean; alert:any; @ViewChild("navigator") navigator!: DayPilotNavigatorComponent; @ViewChild("calendar") calendar!: DayPilotCalendarComponent; constructor(private evenementService:EvenementService) { - this.isShow = false; this.alert = ""; } @@ -45,9 +43,9 @@ export class PageAgendaComponent implements AfterViewInit { events: DayPilot.EventData[] = []; - onClickCloseAlert(){ - console.log('fermeture'); - this.isShow = ! this.isShow; + closeAlert(value:any){ + //console.log('fermeture'+value); + this.alert=""; } ngAfterViewInit(): void { @@ -88,12 +86,10 @@ export class PageAgendaComponent implements AfterViewInit { next: result => { this.viewChange(); this.alert={"type":"success", "content":"L'évènement à bien été modifié"}; - this.isShow = true; }, error: err => { this.viewChange(); this.alert={"type":"danger", "content":"Problème lors de la modification de l'évenment"}; - this.isShow = true; }, complete: () => console.log('DONE!') } @@ -130,13 +126,11 @@ export class PageAgendaComponent implements AfterViewInit { this.evenementService.addEvenements(event).subscribe({ next: result => { this.viewChange(); - this.alert={"type":"success", "content":"L'évènement à été correctement ajouté au calendrier"}; - this.isShow = true; + this.alert={"type":"success", "content":"L'évènement à correctement été ajouté au calendrier"}; }, error: err => { this.viewChange(); this.alert={"type":"danger", "content":"Problème lors de l'ajout de l'évenment"}; - this.isShow = true; }, complete: () => console.log('DONE!') }); @@ -147,13 +141,11 @@ export class PageAgendaComponent implements AfterViewInit { this.evenementService.deleteEvenements(Number(args.e.id())).subscribe({ next: result => { this.viewChange(); - this.alert={"type":"success", "content":"L'évènement à été correctement supprimé du calendrier"}; - this.isShow = true; + this.alert={"type":"success", "content":"L'évènement à correctement été supprimé du calendrier"}; }, error: err => { this.viewChange(); this.alert={"type":"danger", "content":"Problème lors de la suppression de l'évenment"}; - this.isShow = true; }, complete: () => console.log('DONE!') }) @@ -175,12 +167,10 @@ export class PageAgendaComponent implements AfterViewInit { next: result => { this.viewChange(); this.alert={"type":"success", "content":"L'évènement à bien été modifié"}; - this.isShow = true; }, error: err => { this.viewChange(); this.alert={"type":"danger", "content":"Problème lors de la modification de l'évenment"}; - this.isShow = true; }, complete: () => console.log('DONE!') } diff --git a/src/index.html b/src/index.html index 6ef67b9..be52832 100644 --- a/src/index.html +++ b/src/index.html @@ -6,7 +6,6 @@ -