Skip to content
Snippets Groups Projects
Commit 9ac2c6f2 authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX rm id 1 in route

parent 13eefeeb
No related branches found
No related tags found
No related merge requests found
...@@ -19,21 +19,20 @@ ...@@ -19,21 +19,20 @@
"author": "Maarch", "author": "Maarch",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@angular/animations": "^7.0.4", "@angular/animations": "^7.1.0",
"@angular/cdk": "^7.0.4", "@angular/cdk": "^7.0.4",
"@angular/common": "^7.0.4", "@angular/common": "^7.1.0",
"@angular/compiler": "^7.0.4", "@angular/compiler": "^7.1.0",
"@angular/core": "^7.0.4", "@angular/core": "^7.1.0",
"@angular/forms": "^7.0.4", "@angular/forms": "^7.1.0",
"@angular/http": "^7.0.4", "@angular/http": "^7.1.0",
"@angular/material": "^7.0.4", "@angular/material": "^7.0.4",
"@angular/platform-browser": "^7.0.4", "@angular/platform-browser": "^7.1.0",
"@angular/platform-browser-dynamic": "^7.0.4", "@angular/platform-browser-dynamic": "^7.1.0",
"@angular/router": "^7.0.4", "@angular/router": "^7.1.0",
"@fortawesome/fontawesome-free": "^5.4.1", "@fortawesome/fontawesome-free": "^5.4.1",
"@ngrx/store": "^6.1.0", "@ngrx/store": "^6.1.0",
"@ngrx/store-devtools": "^6.1.0", "@ngrx/store-devtools": "^6.1.0",
"@types/node": "^10.11.7",
"angular2-draggable": "^2.1.8", "angular2-draggable": "^2.1.8",
"angular2-signaturepad": "^2.8.0", "angular2-signaturepad": "^2.8.0",
"core-js": "^2.5.4", "core-js": "^2.5.4",
...@@ -52,13 +51,13 @@ ...@@ -52,13 +51,13 @@
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~0.8.5", "@angular-devkit/build-angular": "~0.8.5",
"@angular/cli": "~6.2.5", "@angular/cli": "~6.2.5",
"@angular/compiler-cli": "^7.0.4", "@angular/compiler-cli": "^7.1.0",
"@angular/language-service": "^7.0.4", "@angular/language-service": "^7.1.0",
"@types/hammerjs": "^2.0.36", "@types/hammerjs": "^2.0.36",
"@types/jasmine": "^2.8.12", "@types/jasmine": "^2.8.12",
"@types/jasminewd2": "^2.0.5", "@types/jasminewd2": "^2.0.5",
"@types/jquery": "^3.3.22", "@types/jquery": "^3.3.22",
"@types/node": "~10.11.7", "@types/node": "^10.12.10",
"codelyzer": "~4.2.1", "codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1", "jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1", "jasmine-spec-reporter": "~4.2.1",
......
...@@ -17,6 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router'; ...@@ -17,6 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { NotificationService } from '../service/notification.service'; import { NotificationService } from '../service/notification.service';
import { trigger, transition, style, animate } from '@angular/animations'; import { trigger, transition, style, animate } from '@angular/animations';
import { CookieService } from 'ngx-cookie-service';
import { PDFDocumentProxy } from 'ng2-pdf-viewer'; import { PDFDocumentProxy } from 'ng2-pdf-viewer';
@Component({ @Component({
...@@ -114,11 +115,13 @@ export class DocumentComponent implements OnInit { ...@@ -114,11 +115,13 @@ export class DocumentComponent implements OnInit {
constructor(private router: Router, private route: ActivatedRoute, public http: HttpClient, constructor(private router: Router, private route: ActivatedRoute, public http: HttpClient,
public signaturesService: SignaturesContentService, public signaturesService: SignaturesContentService,
public notificationService: NotificationService, public notificationService: NotificationService,
private sanitization: DomSanitizer, public dialog: MatDialog, private bottomSheet: MatBottomSheet) { private sanitization: DomSanitizer, public dialog: MatDialog, private bottomSheet: MatBottomSheet,
private cookieService: CookieService) {
this.draggable = false; this.draggable = false;
} }
ngOnInit(): void { ngOnInit(): void {
const cookieInfo = JSON.parse(atob(this.cookieService.get('maarchParapheurAuth')));
setTimeout(() => { setTimeout(() => {
this.enterApp = false; this.enterApp = false;
}, 500); }, 500);
...@@ -133,7 +136,7 @@ export class DocumentComponent implements OnInit { ...@@ -133,7 +136,7 @@ export class DocumentComponent implements OnInit {
this.signaturesService.mainDocumentId = this.mainDocument.id; this.signaturesService.mainDocumentId = this.mainDocument.id;
this.actionsList = data.document.actionsAllowed; this.actionsList = data.document.actionsAllowed;
if (this.signaturesService.signaturesList.length === 0) { if (this.signaturesService.signaturesList.length === 0) {
this.http.get('../rest/users/' + '1' + '/signatures') this.http.get('../rest/users/' + cookieInfo.id + '/signatures')
.subscribe((dataSign: any) => { .subscribe((dataSign: any) => {
this.signaturesService.signaturesList = dataSign.signatures; this.signaturesService.signaturesList = dataSign.signatures;
this.signaturesService.loadingSign = false; this.signaturesService.loadingSign = false;
......
...@@ -4,6 +4,7 @@ import { Observable } from 'rxjs'; ...@@ -4,6 +4,7 @@ import { Observable } from 'rxjs';
import { SignaturesContentService } from '../service/signatures.service'; import { SignaturesContentService } from '../service/signatures.service';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { NotificationService } from '../service/notification.service'; import { NotificationService } from '../service/notification.service';
import { CookieService } from 'ngx-cookie-service';
interface AfterViewInit { interface AfterViewInit {
ngAfterViewInit(): void; ngAfterViewInit(): void;
...@@ -36,7 +37,7 @@ export class SignaturePadPageComponent implements AfterViewInit { ...@@ -36,7 +37,7 @@ export class SignaturePadPageComponent implements AfterViewInit {
canvasHeight: 315 canvasHeight: 315
}; };
constructor(public http: HttpClient, public signaturesService: SignaturesContentService, public notificationService: NotificationService) { } constructor(public http: HttpClient, public signaturesService: SignaturesContentService, public notificationService: NotificationService, private cookieService: CookieService) { }
ngAfterViewInit() { ngAfterViewInit() {
// this.signaturePad.clear(); // this.signaturePad.clear();
...@@ -84,7 +85,8 @@ export class SignaturePadPageComponent implements AfterViewInit { ...@@ -84,7 +85,8 @@ export class SignaturePadPageComponent implements AfterViewInit {
'encodedSignature': newEncodedSign, 'encodedSignature': newEncodedSign,
'format': 'png' 'format': 'png'
}; };
this.http.post('../rest/users/' + '1' + '/signatures', newSign) const cookieInfo = JSON.parse(atob(this.cookieService.get('maarchParapheurAuth')));
this.http.post('../rest/users/' + cookieInfo.id + '/signatures', newSign)
.subscribe((data: any) => { .subscribe((data: any) => {
newSign.id = data.signatureId; newSign.id = data.signatureId;
this.signaturesService.newSign = newSign; this.signaturesService.newSign = newSign;
......
...@@ -7,6 +7,7 @@ import * as $ from 'jquery'; ...@@ -7,6 +7,7 @@ import * as $ from 'jquery';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { trigger, transition, style, animate, stagger, query } from '@angular/animations'; import { trigger, transition, style, animate, stagger, query } from '@angular/animations';
import { NotificationService } from '../service/notification.service'; import { NotificationService } from '../service/notification.service';
import { CookieService } from 'ngx-cookie-service';
@Component({ @Component({
selector: 'app-signatures', selector: 'app-signatures',
...@@ -31,7 +32,7 @@ export class SignaturesComponent implements OnInit { ...@@ -31,7 +32,7 @@ export class SignaturesComponent implements OnInit {
count : number = 0; count : number = 0;
constructor(public http: HttpClient, public signaturesService: SignaturesContentService, private bottomSheetRef: MatBottomSheet, constructor(public http: HttpClient, public signaturesService: SignaturesContentService, private bottomSheetRef: MatBottomSheet,
private sanitization: DomSanitizer, public notificationService: NotificationService) { private sanitization: DomSanitizer, public notificationService: NotificationService, private cookieService: CookieService) {
} }
ngOnInit() { ngOnInit() {
...@@ -87,7 +88,8 @@ export class SignaturesComponent implements OnInit { ...@@ -87,7 +88,8 @@ export class SignaturesComponent implements OnInit {
let r = confirm('Voulez-vous supprimer cette signature ?'); let r = confirm('Voulez-vous supprimer cette signature ?');
if (r) { if (r) {
this.http.delete('../rest/users/ ' + '1' + '/signatures/' + signature.id) const cookieInfo = JSON.parse(atob(this.cookieService.get('maarchParapheurAuth')));
this.http.delete('../rest/users/ ' + cookieInfo.id + '/signatures/' + signature.id)
.subscribe(() => { .subscribe(() => {
this.signaturesService.signaturesList.splice(i, 1); this.signaturesService.signaturesList.splice(i, 1);
this.notificationService.success('Signature supprimée'); this.notificationService.success('Signature supprimée');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment