diff --git a/apps/maarch_entreprise/Views/template-administration.component.html b/apps/maarch_entreprise/Views/template-administration.component.html index 09142b3a6ec1a59f79d102da0c822d98a444f41e..d85bf3e3c2f2c0e672fa4e0c75dcae77cc46fb82 100755 --- a/apps/maarch_entreprise/Views/template-administration.component.html +++ b/apps/maarch_entreprise/Views/template-administration.component.html @@ -61,7 +61,7 @@ <div class="col-sm-12"> <mat-form-field> <mat-select id="template_attachment_type" name="template_attachment_type" title="{{lang.attachmentType}}" placeholder="{{lang.attachmentType}}" [(ngModel)]="template.template_attachment_type"> - <mat-option value="all">Tous les attachements</mat-option> + <mat-option value="all">{{lang.allAttachments}}</mat-option> <mat-option *ngFor="let value of attachmentTypesList" [value]="value.id"> {{value.label}} </mat-option> @@ -79,10 +79,10 @@ </div> </div> <div class="form-group" *ngIf="template.template_type=='OFFICE'"> - <div class="col-sm-12" style="overflow:hidden;"> + <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></button> + <button mat-raised-button color="primary" type="button" (click)="clickOnUploader('uploadSignFile')"><i class="fa fa-paperclip fa-2x"></i> {{lang.chooseFile}}</button> </div> </div> <div class="col-md-12"> @@ -93,7 +93,10 @@ </div> </div> </div> - <div class="col-sm-12"> + <div class="col-sm-2" style="margin-top: 10px"> + - ou - + </div> + <div class="col-sm-5"> <mat-form-field> <mat-select id="template_style" [disabled]="!creationMode" name="template_style" title="{{lang.defaultTemplate}}" placeholder="{{lang.defaultTemplate}}" [(ngModel)]="template.template_style"> <mat-option *ngFor="let default of defaultTemplatesList" value="{{default.fileExt}}: {{default.fileName}}"> @@ -101,10 +104,11 @@ </mat-option> </mat-select> </mat-form-field> + <div class="col-sm-12" (click)="startJnlp()" *ngIf="template.template_style" 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> - <div class="col-sm-12" (click)="startJnlp()"> - <i class="fa fa-pencil fa-2x"></i>{{lang.templateEdition}} - </div> + </div> <div class="form-group" *ngIf="template.template_type=='TXT'"> <div class="col-sm-12"> @@ -128,9 +132,9 @@ <mat-form-field> <mat-select id="template_datasource" name="template_datasource" title="{{lang.templateDatasource}}" placeholder="{{lang.templateDatasource}}" [(ngModel)]="template.template_datasource"> <mat-option value="">{{lang.noDatasource}}</mat-option> - <mat-option *ngFor="let datasource of datasourcesList" [value]="datasource.id"> - {{datasource.label}} - </mat-option> + <ng-container *ngFor="let datasource of datasourcesList"> + <mat-option *ngIf="displayDatasources(datasource)" [value]="datasource.id">{{datasource.label}}</mat-option> + </ng-container> </mat-select> </mat-form-field> </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 112c438bb298f7c1d15ec7c43060d3c8cfd11d45..be919b7990f81ea906c306a83e62f98bb375964c 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 @@ -171,6 +171,7 @@ export class TemplateAdministrationComponent implements OnInit { resfreshUpload(b64Content: any) { this.template.uploadedFile.base64 = b64Content.replace(/^data:.*?;base64,/, ""); this.template.uploadedFile.base64ForJs = b64Content; + this.template.template_style = null; } startJnlp() { @@ -187,10 +188,12 @@ export class TemplateAdministrationComponent implements OnInit { } this.jnlpValue.table = 'templates'; this.jnlpValue.uniqueId = 0; + this.jnlpValue.cookies = document.cookie; this.http.post(this.coreUrl + 'rest/jnlp', this.jnlpValue) .subscribe((data: any) => { this.template.userUniqueId = data.userUniqueId; + this.template.uploadedFile = null; window.location.href = this.coreUrl + 'rest/jnlp?fileName=' + data.generatedJnlp; }, (err) => { this.notify.error(err.error.errors); @@ -232,4 +235,14 @@ export class TemplateAdministrationComponent implements OnInit { }); } } + + displayDatasources(datasource:any) + { + if(datasource.target=='notification' && this.template.template_target == 'notifications'){ + return true; + } else if(datasource.target=='document' && this.template.template_target != 'notifications'){ + return true; + } + return false; + } } \ No newline at end of file diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.ts b/apps/maarch_entreprise/js/angular/lang/lang-en.ts index 0cf1777ed010e181ebce1810bebe87b780d22195..e265da3077039873f5e8a958faea15be7c8681e1 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.ts @@ -543,6 +543,8 @@ export const LANG_EN = { "duplicate" : "Duplicate", "confirmDuplicate" : "Do you really want to duplicate this template ?", "noDatasource" : "No datasources", - "templateDuplicated" : "Template duplicated" + "templateDuplicated" : "Template duplicated", + "chooseFile" : "Choose a file", + "allAttachments" : "All attachments" }; diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts index 3c1f40385f5912c50bd63595955dfb730047497e..b54beede8d958d8926ac92b9e0840d6b974b6e43 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts @@ -565,6 +565,8 @@ export const LANG_FR = { "duplicate" : "Dupliquer", "confirmDuplicate" : "Voulez-vous vraiment dupliquer ce template ?", "noDatasource" : "Aucune source de données", - "templateDuplicated" : "Modèle dupliqué" + "templateDuplicated" : "Modèle dupliqué", + "chooseFile" : "Choisissez un fichier", + "allAttachments" : "Tous les attachements" };