Skip to content
Commits on Source (5)
......@@ -2,6 +2,8 @@
All notable changes to [ngpr_prodige_contribution](https://gitlab.adullact.net/prodige/ngpr_prodige_contribution) project will be documented in this file.
## [5.0.5](https://gitlab.adullact.net/prodige/ngpr_prodige_contribution/compare/5.0.4...5.0.5) - 2023-03-08
## [5.0.4](https://gitlab.adullact.net/prodige/ngpr_prodige_contribution/compare/5.0.3...5.0.4) - 2023-03-08
## [5.0.3](https://gitlab.adullact.net/prodige/ngpr_prodige_contribution/compare/5.0.2...5.0.3) - 2023-03-07
......
5.0.4
\ No newline at end of file
5.0.5
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { EnvService } from '../../services/env/env.service';
import { ModalConfirmComponent } from '../modal-confirm/modal-confirm.component';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { CasService } from '../../services/cas/cas.service';
import { BaseComponent } from '../base/base.component';
import { UserService } from '../../services/user.service';
import { takeUntil } from 'rxjs';
import { User } from '../../models/user';
import { ModalConfirmComponent } from '../../modals/modal-confirm/modal-confirm.component';
@Component({
selector: `alk-header`,
......
<div class="modal-header">
<h5 class="modal-title">Confirmation</h5>
<button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross click')">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>{{message}}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" (click)="closeModal()">Ok</button>
</div>
.header {
padding: 1rem;
}
.content {
background-color: white;
padding: 2rem;
}
.footer {
padding: 1rem;
text-align: center;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ModalSimpleComponent } from './modal-simple.component';
describe('ModalSimpleComponent', () => {
let component: ModalSimpleComponent;
let fixture: ComponentFixture<ModalSimpleComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ModalSimpleComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ModalSimpleComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: `alk-modal-simple`,
templateUrl: `./modal-simple.component.html`,
styleUrls: [`./modal-simple.component.scss`],
})
export class ModalSimpleComponent {
public message: string = null;
private title: string = null;
private buttonUrl: string = null;
private isSuccess: boolean;
constructor(
private router: Router,
public activeModal: NgbActiveModal,
) { }
public setMessage( newValue: string ) {
if ( newValue ) {
this.message = newValue;
}
}
public setButtonUrl( newValue: string ) {
if ( newValue ) {
this.buttonUrl = newValue;
}
}
public setIsSuccessModal( isSuccess: boolean ) {
this.isSuccess = isSuccess;
if ( !this.message ) {
if ( this.isSuccess ) {
this.message = `La donnée a été publiée.`;
} else {
this.message = `Une erreur est survenue.`;
}
}
}
public setTitle( newValue: string ) {
if ( newValue ) {
this.title = newValue;
}
}
public getMessage() {
return this.message;
}
public getButtonUrl() {
return this.buttonUrl;
}
public getIsSuccessModal() {
return this.isSuccess;
}
public getTitle() {
return this.title;
}
public closeModal() {
console.log( `Close modal` );
if ( this.buttonUrl ) {
// On redirige selon l'URL.
this.router.navigateByUrl( this.buttonUrl ).catch( console.error );
} else {
// On ferme simplement la modal.
this.activeModal.close();
}
}
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ModalSimpleComponent } from './modal-simple.component';
@NgModule({
declarations: [
ModalSimpleComponent,
],
exports: [
ModalSimpleComponent,
],
imports: [
CommonModule,
],
})
export class ModalSimpleModule { }
......@@ -3,7 +3,7 @@ import { HomeService } from "./home.service";
import { Router } from '@angular/router';
import { IFileLoading } from '../../core/models/file-loading-type';
import { BaseComponent } from '../../core/components/base/base.component';
import {from, switchMap, takeUntil} from 'rxjs';
import { from, switchMap, takeUntil } from 'rxjs';
@Component({
selector: `alk-home`,
......@@ -79,10 +79,10 @@ export class HomeComponent extends BaseComponent {
this.finalizeLoading = true;
this.homeService.finaliseFileTransfert().pipe(
takeUntil( this.endSubscriptions ),
switchMap((contributionId) => from(this.router.navigate([ `stepper`, contributionId ])))
switchMap(( contributionId ) => from( this.router.navigate([ `stepper`, contributionId ]))),
)
.subscribe({
next: ( ) => {
next: () => {
},
error: ( err ) => {
console.error( err );
......
......@@ -18,6 +18,8 @@ import { ContextService } from '../../../core/services/context.service';
import { Map } from 'ol';
import { SynthesisAndValidationService } from './synthesis-and-validation.service';
import { AbstractControl, FormArray, FormGroup } from '@angular/forms';
import { ModalSimpleComponent } from '../../../core/modals/modal-simple/modal-simple.component';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: `alk-synthesis-and-validation`,
......@@ -65,6 +67,7 @@ export class SynthesisAndValidationComponent extends BaseComponent implements On
private mapService: MapService,
private mapIdService: MapIdService,
private synthesisService: SynthesisAndValidationService,
private ngbModal: NgbModal,
) {
super();
}
......@@ -138,8 +141,8 @@ export class SynthesisAndValidationComponent extends BaseComponent implements On
takeUntil( this.endSubscriptions ),
)
.subscribe({
next: ( result ) =>{
console.log( result );
next: () =>{
this.displayMessage();
},
complete: () =>{
this.isLoading = false;
......@@ -158,6 +161,16 @@ export class SynthesisAndValidationComponent extends BaseComponent implements On
this.stepperService.setStep$( StepType.DiffusionModality );
}
public displayMessage(){
/** */
const modalSimpleRef = this.ngbModal.open( ModalSimpleComponent );
// On set les différents paramètres.
const modalInstance = <ModalSimpleComponent>modalSimpleRef.componentInstance;
modalInstance.setTitle( $localize`:@@Information:Information` );
modalInstance.setMessage( $localize`:@@ValidateAndPublish:valider et publier` );
}
override ngOnDestroy(): void {
......