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

FEAT #7737 front admin templates

parent 5bf8ceb1
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
......@@ -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
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