diff --git a/apps/maarch_entreprise/Views/template-administration.component.html b/apps/maarch_entreprise/Views/template-administration.component.html index 8e815488d631aba1bc25524c50d2d7fdb1895157..652253bf8a7328ce702498579bf6bdef827b30f2 100755 --- a/apps/maarch_entreprise/Views/template-administration.component.html +++ b/apps/maarch_entreprise/Views/template-administration.component.html @@ -82,8 +82,7 @@ <div class="col-sm-5" style="overflow:hidden"> <div class="form-group"> <div class="col-sm-12" style="text-align:center;"> - <button mat-raised-button color="primary" type="button" (click)="clickOnUploader('uploadSignFile')"><i class="fa fa-paperclip fa-2x"></i> {{lang.importFile}}</button> - <div *ngIf="template.uploadedFile"><h5>Fichier importé</h5></div> + <button mat-raised-button color="primary" type="button" (click)="clickOnUploader('uploadSignFile')"><i class="fa fa-paperclip fa-2x"></i> {{buttonFileName}}</button> </div> </div> <div class="col-md-12"> @@ -94,18 +93,18 @@ </div> </div> </div> - <div class="col-sm-2" style="margin-top: 10px"> + <div class="col-sm-2" style="margin-top: 10px" *ngIf="creationMode || (!creationMode && !template.uploadedFile)"> - ou - </div> <div class="col-sm-5"> <mat-form-field *ngIf="creationMode || template.template_style"> - <mat-select id="template_style" [disabled]="!creationMode" name="template_style" title="{{lang.defaultTemplate}}" placeholder="{{lang.defaultTemplate}}" [(ngModel)]="template.template_style"> + <mat-select id="template_style" [disabled]="!creationMode" name="template_style" title="{{lang.defaultTemplate}}" placeholder="{{lang.defaultTemplate}}" [(ngModel)]="template.template_style" (ngModelChange)="resetFileUploaded()"> <mat-option *ngFor="let default of defaultTemplatesList" value="{{default.fileExt}}: {{default.fileName}}"> {{default.fileExt}}: {{default.fileName}} </mat-option> </mat-select> </mat-form-field> - <div class="col-sm-12" (click)="startJnlp()" *ngIf="(creationMode && template.template_style) || !creationMode" style="text-align: center"> + <div class="col-sm-12" (click)="startJnlp()" *ngIf="(creationMode && template.template_style) || (!creationMode && !template.uploadedFile)" style="text-align: center"> <button mat-raised-button color="primary" type="button"><i class="fas fa-pencil-alt fa-2x"></i> {{lang.templateEdition}}</button> </div> </div> diff --git a/apps/maarch_entreprise/js/angular/app/administration/template-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/template-administration.component.ts index 6848943ef9ef7edda6bfe5700ff4f25a89d680b1..6c4aa9075054aaf057e06623e294fabe4b2c5672 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/template-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/template-administration.component.ts @@ -29,6 +29,7 @@ export class TemplateAdministrationComponent implements OnInit { attachmentTypesList: any; datasourcesList: any; jnlpValue: any = {}; + buttonFileName: any = this.lang.importFile; loading: boolean = false; @@ -171,6 +172,7 @@ export class TemplateAdministrationComponent implements OnInit { resfreshUpload(b64Content: any) { this.template.uploadedFile.base64 = b64Content.replace(/^data:.*?;base64,/, ""); this.template.template_style = null; + this.fileImported(); } startJnlp() { @@ -192,7 +194,7 @@ export class TemplateAdministrationComponent implements OnInit { this.http.post(this.coreUrl + 'rest/jnlp', this.jnlpValue) .subscribe((data: any) => { this.template.userUniqueId = data.userUniqueId; - this.template.uploadedFile = null; + this.fileToImport(); window.location.href = this.coreUrl + 'rest/jnlp?fileName=' + data.generatedJnlp; }, (err) => { this.notify.error(err.error.errors); @@ -263,4 +265,20 @@ export class TemplateAdministrationComponent implements OnInit { this.template.template_type='TXT'; } } + + fileImported() + { + this.buttonFileName = this.template.uploadedFile.name; + } + + fileToImport() + { + this.buttonFileName = this.lang.importFile; + } + + resetFileUploaded() + { + this.fileToImport(); + this.template.uploadedFile = null; + } } \ No newline at end of file diff --git a/package.json b/package.json index a941ae21dc437b340d774cb1081df7ab4c220743..d11895e49864c43965ff2e6c15208f44be4b6602 100755 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@angular/router": "6.0.0", "@types/datatables.net": "^1.10.11", "@types/jquery": "^2.0.49", - "@types/node": "^7.0.65", + "@types/node": "^7.0.66", "hammerjs": "^2.0.8", "ng2-dnd": "^5.0.2", "node-sass": "^4.9.0",