From 824c55ebdad7c6af8968f703a2e2f7b8b9305bd3 Mon Sep 17 00:00:00 2001 From: Nestor <npegane@hotmail.com> Date: Thu, 5 Jul 2018 16:23:45 +0200 Subject: [PATCH] FEAT #8031 order by in baskets --- .../basket-administration.component.html | 14 ++++++++ .../documents_list_with_attachments.php | 3 +- .../basket-administration.component.ts | 34 ++++++++++++++++--- .../js/angular/lang/lang-en.ts | 4 +++ .../js/angular/lang/lang-fr.ts | 4 +++ src/app/basket/models/BasketModelAbstract.php | 3 +- 6 files changed, 55 insertions(+), 7 deletions(-) diff --git a/apps/maarch_entreprise/Views/basket-administration.component.html b/apps/maarch_entreprise/Views/basket-administration.component.html index 4b3fe5682f6..549dc9a047c 100644 --- a/apps/maarch_entreprise/Views/basket-administration.component.html +++ b/apps/maarch_entreprise/Views/basket-administration.component.html @@ -64,6 +64,20 @@ <mat-icon style="cursor:pointer;" color="primary" matSuffix class="fa fa-info-circle" matTooltip="{{lang.keywordHelper}}" (click)="snav2.toggle()"></mat-icon> </mat-form-field> + <div class="row"> + <div class="col-md-6 col-xs-6 text-center"> + <mat-form-field > + <mat-select placeholder="{{lang.defaultSort}}" [(ngModel)]="orderColumnsSelected" (selectionChange)="onOrderChange()" [formControl]="columnsFormControl" name="basket_res_order" multiple> + <mat-option *ngFor="let column of orderColumns" [value]="column">{{lang[langVarName[orderColumns.indexOf(column)]]}}</mat-option> + </mat-select> + </mat-form-field> + </div> + <div class="col-md-6 col-xs-6 text-center"> + <mat-chip *ngFor="let column of orderColumnsSelected" color="primary"> + <span class="badge badge-pill badge-dark">{{orderColumnsSelected.indexOf(column)+1}}</span> {{lang[langVarName[orderColumns.indexOf(column)]]}} + </mat-chip> + </div> + </div> <div class="col-md-6 col-xs-6 text-center"> <mat-slide-toggle [ngStyle]="{'opacity': basket.isSearchBasket ? '' : '0.3'}" color="primary" matTooltip="{{lang.isSearchBasket}}" name="isSearchBasket" [(ngModel)]="basket.isSearchBasket"> diff --git a/apps/maarch_entreprise/documents_list_with_attachments.php b/apps/maarch_entreprise/documents_list_with_attachments.php index 462ad1f697a..2f37e71d018 100755 --- a/apps/maarch_entreprise/documents_list_with_attachments.php +++ b/apps/maarch_entreprise/documents_list_with_attachments.php @@ -96,7 +96,8 @@ array_push( 'contact_firstname', 'contact_lastname', 'contact_society', 'user_lastname', 'user_firstname', 'priority', 'creation_date', 'admission_date', 'subject', 'process_limit_date', 'entity_label', 'dest_user', 'category_id', 'type_label', - 'address_id', 'exp_user_id', 'doc_custom_n1 as count_attachment', 'alt_identifier', 'is_multicontacts', 'locker_user_id', 'locker_time', 'filename' + 'address_id', 'exp_user_id', 'doc_custom_n1 as count_attachment', 'alt_identifier', 'is_multicontacts', 'locker_user_id', 'locker_time', 'filename', + 'format' ); if ($core_tools->is_module_loaded('cases') == true) { diff --git a/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.ts index 3db7a5e2f37..993b0f3e22f 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.ts @@ -2,7 +2,7 @@ import { ChangeDetectorRef, Component, OnInit, Inject, ViewChild, ElementRef } f import { MediaMatcher } from '@angular/cdk/layout'; import { HttpClient } from '@angular/common/http'; import { Router, ActivatedRoute } from '@angular/router'; -import { MatPaginator, MatTableDataSource, MatSort, MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { MatPaginator, MatTableDataSource, MatSort, MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material'; import { LANG } from '../translate.component'; import { NotificationService } from '../notification.service'; import { AutoCompletePlugin } from '../../plugins/autocomplete.plugin'; @@ -38,8 +38,13 @@ export class BasketAdministrationComponent implements OnInit { resultPages : any[] = []; creationMode : boolean; - displayedColumns = ['label_action', 'actions']; - dataSource : any; + displayedColumns = ['label_action', 'actions']; + orderColumns = ['alt_identifier','creation_date','format','priority','process_limit_date','res_id','subject','title','type_id']; + langVarName = ['chrono','creationDate','format','priority','processLimitDate','id','object','title','type'] + orderColumnsSelected : string[] = []; + selection : string[] = []; + columnsFormControl : FormControl = new FormControl(); + dataSource : any; @ViewChild(MatPaginator) paginator: MatPaginator; @@ -84,7 +89,13 @@ export class BasketAdministrationComponent implements OnInit { this.basket.clause = data.basket.basket_clause; this.basket.isSearchBasket = data.basket.is_visible != "Y"; this.basket.flagNotif = data.basket.flag_notif == "Y"; - + if(this.basket.basket_res_order == '' || this.basket.basket_res_order == null){ + this.orderColumnsSelected = null; + } + else{ + this.orderColumnsSelected = this.basket.basket_res_order.split(','); + } + this.http.get(this.coreUrl + "rest/baskets/" + this.id + "/groups") .subscribe((data: any) => { this.allGroups = data.allGroups; @@ -153,7 +164,12 @@ export class BasketAdministrationComponent implements OnInit { } } - onSubmit() { + onSubmit() { + if(this.orderColumnsSelected !== null){ + this.basket.basket_res_order = this.orderColumnsSelected.join(',') + } else { + this.basket.basket_res_order = ''; + } if (this.creationMode) { this.http.post(this.coreUrl + "rest/baskets", this.basket) .subscribe(() => { @@ -173,6 +189,14 @@ export class BasketAdministrationComponent implements OnInit { } } + onOrderChange(){ + if (this.columnsFormControl.value.length < 3) { + this.selection = this.columnsFormControl.value; + } else { + this.columnsFormControl.setValue(this.selection); + } + } + initAction(groupIndex: number) { this.dataSource = new MatTableDataSource(this.basketGroups[groupIndex].groupActions); this.dataSource.sort = this.sort; diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.ts b/apps/maarch_entreprise/js/angular/lang/lang-en.ts index f0ffb0447e4..2ef2a3fd64e 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.ts @@ -148,6 +148,7 @@ export const LANG_EN = { "folder" : "Folder", "folders" : "Folders", "for" : "for", + "format" : "Format", "friday" : "Friday", "functionnalities" : "Functionnalities", "groupAdded" : "Group added", @@ -369,6 +370,7 @@ export const LANG_EN = { "thesaurus" : "Thesaurus", "thuesday" : "Thuesday", "thursday" : "Thursday", + "title" : "Title", "to" : "to", "toDefault" : "default", "toEntities" : "To entities", @@ -475,6 +477,7 @@ export const LANG_EN = { "tooltipPriorityDelay" : "Use this processing time instead of the one defined in the document type", "tooltipPriorityDefault" : "Set this priority by default when saving a mail", "defaultPriority" : "Default priority", + "defaultSort" : "Default sort", "chooseColor" : "Choose a color", "wednesday" : "Wednesday", 'quota' : 'Quota', @@ -506,6 +509,7 @@ export const LANG_EN = { 'contactsGroups' : 'Contact(s) group(s)', "contactsGroupModification" : "Contacts group modification", "contactGroupCreation" : "Contacts group creation", + "creation_date" : "Creation date", "private" : "Private", "public" : "Public", "contactsGroupDesc" : "If the grouping is public, all the users will be able to use this one. Otherwise it is private, and only the creator can use it", diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts index 76e704a32ac..9a54c12c066 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts @@ -121,6 +121,7 @@ export const LANG_FR = { "default" : "par défaut", "defaultAction" : "Action par défaut", "defaultPriority" : "Priorité par défaut", + "defaultSort" : "Tri par défaut", "delay1" : "Délai relance 1 avant terme (en jours)", "delay2" : "Délai relance 2 après terme (en jours)", "delete" : "Supprimer", @@ -205,6 +206,7 @@ export const LANG_FR = { "folders" : "Dossiers", "folderTypeList" : "Liste des types de dossier", "for" : "pour", + "format" : "Format", "friday" : "Vendredi", "functionnalities" : "Fonctionnalités", "generatedFile" : "Fichier généré", @@ -462,6 +464,7 @@ export const LANG_FR = { "thesaurus" : "Thésaurus", "thuesday" : "Mardi", "thursday" : "Jeudi", + "title" : "Titre", "to" : "vers", "toDefault" : "par défaut", "toEntities" : "Vers les services", @@ -527,6 +530,7 @@ export const LANG_FR = { 'contactsGroups' : 'Groupement(s) de contact(s)', "contactsGroupModification" : "Modification du groupement de contact", "contactGroupCreation" : "Création d'un groupement de contact", + "creationDate" : "Date de création", "private" : "Privé", "public" : "Public", "contactsGroupDesc" : "Si le groupement est public, tous les utilisateurs pourront utiliser celui-ci. Sinon il est privé, et seul le créateur pourra l'utiliser", diff --git a/src/app/basket/models/BasketModelAbstract.php b/src/app/basket/models/BasketModelAbstract.php index a8c57a9a599..b6eb3979c1e 100644 --- a/src/app/basket/models/BasketModelAbstract.php +++ b/src/app/basket/models/BasketModelAbstract.php @@ -85,13 +85,14 @@ abstract class BasketModelAbstract { ValidatorModel::notEmpty($aArgs, ['id', 'basket_name', 'basket_desc', 'clause', 'isVisible', 'flagNotif']); ValidatorModel::stringType($aArgs, ['id', 'basket_name', 'color', 'basket_desc', 'clause', 'isVisible', 'flagNotif']); - + //ValidatorModel::arrayType($aArgs,['basket_res_order']); DatabaseModel::update([ 'table' => 'baskets', 'set' => [ 'basket_name' => $aArgs['basket_name'], 'basket_desc' => $aArgs['basket_desc'], 'basket_clause' => $aArgs['clause'], + 'basket_res_order' => $aArgs['basket_res_order'], 'is_visible' => $aArgs['isVisible'], 'flag_notif' => $aArgs['flagNotif'], 'color' => $aArgs['color'], -- GitLab