From b3f88df912b0294540bb5d6da32351eeec2f5b7e Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Thu, 15 Mar 2018 17:28:09 +0100 Subject: [PATCH] FIX #213 add button --- .../doctypes-administration.component.html | 33 +++++++++++++++---- .../doctypes-administration.component.ts | 27 ++++++++++----- .../js/angular/lang/lang-en.ts | 5 ++- .../js/angular/lang/lang-fr.ts | 5 ++- 4 files changed, 54 insertions(+), 16 deletions(-) diff --git a/apps/maarch_entreprise/Views/doctypes-administration.component.html b/apps/maarch_entreprise/Views/doctypes-administration.component.html index 8b0878a400e..0df3324c7d6 100644 --- a/apps/maarch_entreprise/Views/doctypes-administration.component.html +++ b/apps/maarch_entreprise/Views/doctypes-administration.component.html @@ -18,10 +18,31 @@ <mat-divider></mat-divider> <mat-nav-list> <h3 mat-subheader>{{lang.actions}}</h3> - <a mat-list-item (click)="prepareDoctypeAdd()"> - <mat-icon color="primary" mat-list-icon class="fa fa-plus"></mat-icon> + <a mat-list-item (click)="prepareDoctypeAdd('firstLevel')"> + <mat-icon color="primary" mat-list-icon class="fa-stack fa-fw" style="margin-left:-3px; font-size:18px"> + <i class="fa fa-folder-o"></i> + <i class="fa fa-plus" style="position:absolute"></i> + </mat-icon> <p mat-line> - {{lang.add}} + {{lang.addFirstLevel}} + </p> + </a> + <a mat-list-item (click)="prepareDoctypeAdd('secondLevel')"> + <mat-icon color="primary" mat-list-icon class="fa-stack fa-fw" style="margin-left:-3px; font-size:18px"> + <i class="fa fa-folder-o"></i> + <i class="fa fa-plus" style="position:absolute"></i> + </mat-icon> + <p mat-line> + {{lang.addSecondLevel}} + </p> + </a> + <a mat-list-item (click)="prepareDoctypeAdd('doctype')"> + <mat-icon color="primary" mat-list-icon class="fa-stack fa-fw" style="margin-left:-3px; font-size:18px"> + <i class="fa fa-file-o"></i> + <i class="fa fa-plus" style="position:absolute"></i> + </mat-icon> + <p mat-line> + {{lang.addDoctype}} </p> </a> </mat-nav-list> @@ -47,7 +68,7 @@ <mat-nav-list> <mat-tab-group> - <mat-tab label="{{lang.firstLevelDoctype}}" *ngIf="currentFirstLevel || creationMode"> + <mat-tab label="{{lang.firstLevelDoctype}}" *ngIf="currentFirstLevel || creationMode=='firstLevel'"> <form class="form-horizontal" #firstLevelForm="ngForm" style="overflow:hidden;"> <div class="form-group" *ngIf="!creationMode"> <div class="col-sm-12"> @@ -93,7 +114,7 @@ </form> </mat-tab> - <mat-tab label="{{lang.secondLevelDoctype}}" *ngIf="currentSecondLevel || creationMode"> + <mat-tab label="{{lang.secondLevelDoctype}}" *ngIf="currentSecondLevel || creationMode=='secondeLevel'"> <form class="form-horizontal" #secondLevelForm="ngForm" style="overflow:hidden;"> <div class="form-group" *ngIf="!creationMode"> <div class="col-sm-12"> @@ -139,7 +160,7 @@ </form> </mat-tab> - <mat-tab label="{{lang.doctype}}" *ngIf="currentType || creationMode"> + <mat-tab label="{{lang.doctype}}" *ngIf="currentType || creationMode=='doctype'"> <form class="form-horizontal" #typeForm="ngForm" style="overflow:hidden;"> <div class="form-group" *ngIf="!creationMode"> <div class="col-sm-12"> diff --git a/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.ts index 1e8d7bc878b..3d49c973e9f 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.ts @@ -34,7 +34,7 @@ export class DoctypesAdministrationComponent implements OnInit { models: any = false; loading: boolean = false; - creationMode: boolean = false; + creationMode: any = false; newSecondLevel: any = false; displayedColumns = ['label','use', 'mandatory', 'column']; @@ -335,10 +335,19 @@ export class DoctypesAdministrationComponent implements OnInit { } } - prepareDoctypeAdd() { - this.currentFirstLevel = {}; - this.currentSecondLevel = {}; - this.currentType = {}; + prepareDoctypeAdd(mode: any) { + this.currentFirstLevel = false; + this.currentSecondLevel = false; + this.currentType = false; + if(mode == 'firstLevel'){ + this.currentFirstLevel = {}; + } + if(mode == 'secondLevel'){ + this.currentSecondLevel = {}; + } + if(mode == 'doctype'){ + this.currentType = {}; + } $j('#jstree').jstree('deselect_all'); this.http.get(this.coreUrl + "rest/administration/doctypes/new") .subscribe((data: any) => { @@ -347,12 +356,14 @@ export class DoctypesAdministrationComponent implements OnInit { this.secondLevels = data['secondLevel']; this.processModes = data['processModes']; this.models = data['models']; - this.currentType.indexes = data['indexes']; - this.loadIndexesTable(); + if(mode == 'doctype'){ + this.currentType.indexes = data['indexes']; + this.loadIndexesTable(); + } }, (err) => { this.notify.error(err.error.errors); }); - this.creationMode = true; + this.creationMode = mode; } selectIndexesUse(e: any, index: any) { diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.ts b/apps/maarch_entreprise/js/angular/lang/lang-en.ts index 94400b5b415..bbddff6402a 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.ts @@ -379,6 +379,9 @@ export const LANG_EN = { 'quota' : 'Quota', 'actives' : 'Active(s)', 'inactives' : 'Inactive(s)', - 'quotaExceeded' : 'Quota exceeded' + 'quotaExceeded' : 'Quota exceeded', + "addFirstLevel" : "Add first level", + "addSecondLevel" : "Add second level", + "addDoctype" : "Add document type", }; diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts index c06abf6ebb6..44d96f9547b 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts @@ -404,5 +404,8 @@ export const LANG_FR = { 'quota' : 'Quota', 'actives' : 'Actif(s)', 'inactives' : 'Inactif(s)', - 'quotaExceeded' : 'Quota dépassé' + 'quotaExceeded' : 'Quota dépassé', + "addFirstLevel" : "Ajouter une chemise", + "addSecondLevel" : "Ajouter une sous-chemise", + "addDoctype" : "Ajouter un type de document", }; -- GitLab