Verified Commit b9a65dd9 authored by Alex ORLUC's avatar Alex ORLUC

FEAT #11296 TIME 3:30 add go to basket in folder list + add symbol for specific search in filter

parent c05201d7
......@@ -422,14 +422,14 @@ abstract class BasketModelAbstract
{
ValidatorModel::arrayType($args, ['select', 'where', 'data']);
$where = ['baskets.basket_id = users_baskets_preferences.basket_id'];
$where = ['(baskets.basket_id = users_baskets_preferences.basket_id AND users_baskets_preferences.group_serial_id = usergroups.id)'];
if (!empty($args['where'])) {
$where = array_merge($where, $args['where']);
}
$baskets = DatabaseModel::select([
'select' => empty($args['select']) ? ['*'] : $args['select'],
'table' => ['baskets, users_baskets_preferences'],
'table' => ['baskets, users_baskets_preferences, usergroups'],
'where' => $where,
'data' => empty($args['data']) ? [] : $args['data']
]);
......
......@@ -536,7 +536,7 @@ class FolderController
}
$baskets = BasketModel::getWithPreferences([
'select' => ['baskets.id', 'baskets.basket_id', 'baskets.basket_clause', 'users_baskets_preferences.group_serial_id'],
'select' => ['baskets.id', 'baskets.basket_id', 'baskets.basket_name', 'baskets.basket_clause', 'users_baskets_preferences.group_serial_id', 'usergroups.group_desc'],
'where' => ['users_baskets_preferences.user_serial_id = ?'],
'data' => [$GLOBALS['id']]
]);
......@@ -563,7 +563,7 @@ class FolderController
'data' => [$group['group_id'], $basket['basket_id']]
]);
if (!empty($groupBasket[0]['list_event'])) {
$events[] = ['groupId' => $basket['group_serial_id'], 'basketId' => $basket['id'], 'event' => $groupBasket[0]['list_event']];
$events[] = ['groupId' => $basket['group_serial_id'], 'groupName' => $basket['group_desc'], 'basketId' => $basket['id'], 'basketName' => $basket['basket_name'], 'event' => $groupBasket[0]['list_event']];
}
}
}
......
......@@ -197,9 +197,15 @@ class ResourceListController
$where[] = 'process_limit_date < CURRENT_TIMESTAMP';
}
if (!empty($args['data']['search']) && mb_strlen($args['data']['search']) >= 2) {
$where[] = '(alt_identifier ilike ? OR translate(subject, \'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ\', \'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr\') ilike translate(?, \'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ\', \'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr\'))';
$queryData[] = "%{$args['data']['search']}%";
$queryData[] = "%{$args['data']['search']}%";
if (preg_match('/^"([^"]+)"$/', $args['data']['search'], $cleanSearch)) {
$where[] = '(alt_identifier like ? OR subject like ?)';
$queryData[] = "{$cleanSearch[1]}";
$queryData[] = "{$cleanSearch[1]}";
} else {
$where[] = '(alt_identifier ilike ? OR translate(subject, \'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ\', \'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr\') ilike translate(?, \'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ\', \'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr\'))';
$queryData[] = "%{$args['data']['search']}%";
$queryData[] = "%{$args['data']['search']}%";
}
}
if (isset($args['data']['priorities'])) {
if (empty($args['data']['priorities'])) {
......
......@@ -9,11 +9,20 @@
style="text-align: center;font-size: 10px;color: white;background: #135F7F;padding: 5px;font-weight: bold;">
{{this.contextMenuTitle}}
</div>
<!--<button *ngFor="let action of actionsList" [disabled]="action.component == '' || this.selectedRes.length == 0"
mat-menu-item (click)="launchEvent(action);">
<span>{{action.label_action}}</span>
<button *ngIf="selectedRes.length == 1" mat-menu-item [matMenuTriggerFor]="baskets" (menuOpened)="getBaskets()">
<span>Accéder à la bannette...</span>
</button>
<mat-divider></mat-divider>-->
<mat-menu #baskets="matMenu" [class]="'folderListMenu'">
<ng-container *ngFor="let group of basketList.groups | sortBy : 'groupName'">
<div class="basketGroupName">{{group.groupName}}</div>
<ng-container *ngFor="let basket of basketList.list | sortBy : 'basketName'">
<button mat-menu-item *ngIf="basket.groupId === group.groupId" class="labelBasket" (click)="goTo(basket)"
title="{{basket.basketName}}">{{basket.basketName}}
</button>
</ng-container>
</ng-container>
</mat-menu>
<mat-divider></mat-divider>
<button mat-menu-item class="folderAction" (click)="unclassify()" [disabled]="selectedRes.length === 0">
<mat-icon class="fa fa-folder-minus fa-2x"></mat-icon>
<span>{{lang.removeFromFolder}}</span>
......
......@@ -22,4 +22,16 @@
font-size:20px;
color: $warn;
}
}
.basketGroupName {
color: $primary;
padding-left: 10px;
padding-right: 10px;
}
.labelBasket {
color: rgb(102, 102, 102);
font-size: 12px;
font-weight: bold;
}
\ No newline at end of file
......@@ -7,7 +7,8 @@ import { MatMenuTrigger } from '@angular/material/menu';
import { Router } from '@angular/router';
import { ConfirmComponent } from '../../../plugins/modal/confirm.component';
import { filter, exhaustMap, tap } from 'rxjs/operators';
import { filter, exhaustMap, tap, map } from 'rxjs/operators';
import { HeaderService } from '../../../service/header.service';
@Component({
selector: 'app-folder-action-list',
......@@ -32,6 +33,10 @@ export class FolderActionListComponent implements OnInit {
arrRes: any[] = [];
actionsList: any[] = [];
basketList: any = {
groups: [],
list: []
};
@Input('selectedRes') selectedRes: any;
@Input('totalRes') totalRes: number;
......@@ -41,7 +46,13 @@ export class FolderActionListComponent implements OnInit {
@Output('refreshEvent') refreshEvent = new EventEmitter<string>();
@Output('refreshPanelFolders') refreshPanelFolders = new EventEmitter<string>();
constructor(public http: HttpClient, private notify: NotificationService, public dialog: MatDialog, private router: Router) { }
constructor(
public http: HttpClient,
private notify: NotificationService,
public dialog: MatDialog,
private router: Router,
private headerService: HeaderService
) { }
dialogRef: MatDialogRef<any>;
......@@ -161,4 +172,18 @@ export class FolderActionListComponent implements OnInit {
})
).subscribe();
}
getBaskets() {
this.http.get('../../rest/folders/' + this.currentFolderInfo.id + '/resources/' + this.selectedRes + '/events').pipe(
tap((data: any) => {
this.basketList.groups = data.events.filter((x: any, i: any, a: any) => x && a.map((info: any) => info.groupId).indexOf(x.groupId) === i);
this.basketList.list = data.events;
})
).subscribe();
}
goTo(basket: any) {
this.router.navigate(['/basketList/users/' + this.headerService.user.id + '/groups/' + basket.groupId + '/baskets/' + basket.basketId], { queryParams: { chrono: '"' + this.contextMenuTitle + '"' } });
}
}
......@@ -86,6 +86,7 @@ export class BasketListComponent implements OnInit {
selectedRes: number[] = [];
allResInBasket: number[] = [];
selectedDiffusionTab: number = 0;
specificChrono: string = '';
private destroy$ = new Subject<boolean>();
......@@ -102,6 +103,7 @@ export class BasketListComponent implements OnInit {
constructor(
private router: Router,
private _activatedRoute: ActivatedRoute,
private route: ActivatedRoute,
public http: HttpClient,
public dialog: MatDialog,
......@@ -112,6 +114,10 @@ export class BasketListComponent implements OnInit {
public overlay: Overlay,
public viewContainerRef: ViewContainerRef,
public appService: AppService) {
_activatedRoute.queryParams.subscribe(
params => this.specificChrono = params.chrono
);
$j("link[href='merged_css.php']").remove();
}
......@@ -126,6 +132,7 @@ export class BasketListComponent implements OnInit {
this.isLoadingResults = false;
this.route.params.subscribe(params => {
this.dragInit = true;
this.destroy$.next(true);
......@@ -142,7 +149,7 @@ export class BasketListComponent implements OnInit {
window['MainHeaderComponent'].setSnav(this.sidenavLeft);
window['MainHeaderComponent'].setSnavRight(null);
this.listProperties = this.filtersListService.initListsProperties(this.currentBasketInfo.ownerId, this.currentBasketInfo.groupId, this.currentBasketInfo.basketId, 'basket');
this.listProperties = this.filtersListService.initListsProperties(this.currentBasketInfo.ownerId, this.currentBasketInfo.groupId, this.currentBasketInfo.basketId, 'basket', this.specificChrono);
setTimeout(() => {
......
......@@ -26,7 +26,7 @@ export class FiltersListService {
constructor() { }
initListsProperties(userId: number, groupId: number, targetId: number, mode: string) {
initListsProperties(userId: number, groupId: number, targetId: number, mode: string, specificChrono: string = '') {
this.listsProperties = JSON.parse(sessionStorage.getItem('propertyList' + mode));
......@@ -45,7 +45,7 @@ export class FiltersListService {
this.listsProperties = [];
}
if (!listProperties) {
if (!listProperties || specificChrono !== '') {
listProperties = {
'id': userId,
'groupId': groupId,
......@@ -53,7 +53,7 @@ export class FiltersListService {
'page': '0',
'order': '',
'orderDir': 'DESC',
'search': '',
'search': specificChrono,
'delayed': false,
'categories': [],
'priorities': [],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment