From 9a8909160ca21810c3d88e37c29c5763e85e15a6 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Thu, 27 Feb 2020 17:46:08 +0100 Subject: [PATCH] FEAT #12091 TIME 1:30 added warning shipping admin if maileva is not activated --- .../shipping-administration.component.html | 5 ++++- .../shipping-administration.component.ts | 16 ++++++++++++++++ src/frontend/lang/lang-en.ts | 3 ++- src/frontend/lang/lang-fr.ts | 3 ++- src/frontend/lang/lang-nl.ts | 1 + 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/frontend/app/administration/shipping/shipping-administration.component.html b/src/frontend/app/administration/shipping/shipping-administration.component.html index 00038eb0733..09ea0f5d173 100644 --- a/src/frontend/app/administration/shipping/shipping-administration.component.html +++ b/src/frontend/app/administration/shipping/shipping-administration.component.html @@ -10,6 +10,9 @@ <mat-spinner style="margin:auto;"></mat-spinner> </div> <mat-card *ngIf="!loading" class="card-app-content"> + <div *ngIf="!shippingAvailable" class="alert-message alert-message-danger" role="alert" [innerHTML]="lang.shippingUnavailable" style="max-width: 100%"> + </div> + <form class="form-horizontal" (ngSubmit)="onSubmit()" #shippingForm="ngForm"> <div class="form-group"> <div class="col-sm-12"> @@ -135,4 +138,4 @@ </mat-list> </mat-sidenav> </mat-sidenav-container> -</div> \ No newline at end of file +</div> diff --git a/src/frontend/app/administration/shipping/shipping-administration.component.ts b/src/frontend/app/administration/shipping/shipping-administration.component.ts index 3ff4151e973..2e366c2cc64 100644 --- a/src/frontend/app/administration/shipping/shipping-administration.component.ts +++ b/src/frontend/app/administration/shipping/shipping-administration.component.ts @@ -6,6 +6,8 @@ import { NotificationService } from '../../notification.service'; import { HeaderService } from '../../../service/header.service'; import { ActivatedRoute, Router } from '@angular/router'; import { AppService } from '../../../service/app.service'; +import {catchError, tap} from "rxjs/operators"; +import {of} from "rxjs"; declare function $j(selector: any): any; @@ -61,6 +63,8 @@ export class ShippingAdministrationComponent implements OnInit { ]; hidePassword: boolean = true; + shippingAvailable: boolean = false; + constructor( @@ -79,6 +83,18 @@ export class ShippingAdministrationComponent implements OnInit { window['MainHeaderComponent'].setSnav(this.sidenavLeft); window['MainHeaderComponent'].setSnavRight(this.sidenavRight); + this.http.get("../../rest/externalConnectionsEnabled").pipe( + tap((data: any) => { + console.log(data); + this.shippingAvailable = data.connection.maileva === true; + console.log(this.shippingAvailable) + }), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + this.route.params.subscribe(params => { if (typeof params['id'] == "undefined") { this.headerService.setHeader(this.lang.shippingCreation); diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index a18c1efb339..3284be571a6 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -1583,5 +1583,6 @@ export const LANG_EN = { "mustEditAttachmentFirst" : "You must edit the attachment first", "saveAndClose" : "Save and close", "opinionCircuit" : "Opinion circuit", - "visaCircuit" : "Visa circuit", + "visaCircuit" : "Visa circuit", + "shippingUnavailable" : "<b>Warning </b> Shipping is not activated. Check the configuration file mailevaConfig.xml", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index c7dce329448..72abd3825c5 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1622,5 +1622,6 @@ export const LANG_FR = { "mustEditAttachmentFirst" : "Vous devez d'abord éditer la pièce jointe", "saveAndClose" : "Enregistrer et fermer", "opinionCircuit" : "Circuit d'avis", - "visaCircuit" : "Circuit de visa", + "visaCircuit" : "Circuit de visa", + "shippingUnavailable" : "<b>Attention !</b> Maileva n'est pas activé. Veuillez vérifier le fichier de configuration mailevaConfig.xml", }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 0c9d2c01cb9..38ae2ce1264 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1609,4 +1609,5 @@ export const LANG_NL = { "saveAndClose" : "Save and close", //_TO_TRANSLATE "opinionCircuit" : "Opinion circuit", //_TO_TRANSLATE "visaCircuit" : "Visa circuit", //_TO_TRANSLATE + "shippingUnavailable" : "<b>Warning </b> Shipping is not activated. Check the configuration file mailevaConfig.xml", //_TO_TRANSLATE }; -- GitLab