From 1c633c1d04f1850cee12a3242df834c3318dd1c2 Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Wed, 29 Aug 2018 23:02:39 +0200 Subject: [PATCH] FEAT #8218 improve home res list --- .../Views/home.component.html | 151 ++++++++++-------- .../js/angular/app/home.component.ts | 2 +- src/app/home/controllers/HomeController.php | 26 ++- src/app/resource/models/ResModelAbstract.php | 13 +- 4 files changed, 117 insertions(+), 75 deletions(-) diff --git a/apps/maarch_entreprise/Views/home.component.html b/apps/maarch_entreprise/Views/home.component.html index ec1cb4a85c9..a1500f979ae 100755 --- a/apps/maarch_entreprise/Views/home.component.html +++ b/apps/maarch_entreprise/Views/home.component.html @@ -29,75 +29,92 @@ <mat-tab-group> <mat-tab label="Mes derniers courriers"> - <table mat-table [dataSource]="dataSource" matSort matSortActive="res_id" matSortDisableClear matSortDirection="asc" style="width:100%;table-layout: fixed;"> - <ng-container matColumnDef="res_id"> - <td mat-cell *matCellDef="let row" [ngStyle]="{'width': mobileMode ? '30%' : '10%'}" style="text-align:center;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;padding: 5px;vertical-align: top;"> - <div *ngIf="row.closing_date == null && mobileMode" id="{{row.res_id}}_creation_date" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;" - title='{{row.creation_date | date : "le dd/MM/y à HH:mm"}}'> - <i class="fa fa-calendar" title="date d'enregistrement"></i> {{row.creation_date | timeAgo}} - </div> - <div style="overflow: hidden;text-overflow: ellipsis;"> - <mat-icon [ngStyle]="{'color': row.priority_color}" color="primary" class="{{row.status_icon.charAt(0)}}{{row.status_icon.charAt(1)}} {{row.status_icon}} {{row.status_icon.charAt(0)}}{{row.status_icon.charAt(1)}}-2x" - title="{{row.status_label}}"></mat-icon> - </div> - <div style="padding-top: 5px;color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> - {{row.alt_identifier}} - </div> + <table mat-table [dataSource]="dataSource" matSort matSortActive="res_id" matSortDisableClear matSortDirection="asc" + style="width:100%;table-layout: fixed;"> + <!-- Number Column --> + <ng-container matColumnDef="res_id"> + <td mat-cell *matCellDef="let row" [ngStyle]="{'width': mobileMode ? '30%' : '10%'}" style="text-align:center;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;padding: 5px;vertical-align: middle;"> + <div *ngIf="row.closing_date == null && mobileMode" id="{{row.res_id}}_creation_date" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;" + title='{{row.creation_date | date : "le dd/MM/y à HH:mm"}}'> + <i class="fa fa-calendar" title="date d'enregistrement"></i> {{row.creation_date | timeAgo}} + </div> + <div *ngIf="!mobileMode" style="padding-top: 5px;color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;" title="{{lang[row.category_id]}}"> + {{lang[row.category_id]}} + </div> + <div style="overflow: hidden;text-overflow: ellipsis;"> + <mat-icon [ngStyle]="{'color': row.priority_color}" color="primary" class="{{row.status_icon.charAt(0)}}{{row.status_icon.charAt(1)}} {{row.status_icon}} {{row.status_icon.charAt(0)}}{{row.status_icon.charAt(1)}}-2x" title="{{row.status_label}} ({{row.status_id}})"></mat-icon> + </div> + <div style="padding-top: 5px;color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;" title="{{row.alt_identifier}} (n°{{row.res_id}})"> + {{row.alt_identifier}} + </div> - </td> - </ng-container> - <ng-container matColumnDef="subject"> - <td mat-cell *matCellDef="let row" style="width:45%;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;padding: 5px;"> - <div style="overflow: hidden;text-overflow: ellipsis;" title="{{row.subject}}"> - <span class="label" [ngStyle]="{'background': row.priority_color}">{{row.priority_label}}</span> - <span>{{row.subject}}</span> - </div> - <div *ngIf="mobileMode" style="text-align: right"> - <button mat-icon-button (click)="$event.stopPropagation();goTo(row);"> - <mat-icon color="primary" class="fa fa-eye fa-2x"></mat-icon> - </button> - </div> - </td> - </ng-container> - <ng-container matColumnDef="contact_society"> - <td mat-cell *matCellDef="let row" style="width:25%;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;padding: 5px;"> - <div style="overflow: hidden;text-overflow: ellipsis;"> - <i class="fa fa-address-card" color="primary"></i> - <span *ngIf="row.contact_lastname==''">{{row.contact_society}}</span> - <span *ngIf="row.contact_society==''">{{row.contact_lastname}}</span> - <i class="fa fa-arrow-right"></i> - <i class="fa fa-sitemap" color="primary"></i> - <span title="{{row.entity_label}}">{{row.destination}}</span> - </div> - <div style="padding-top: 5px;color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> - {{row.dest_user}} - </div> - </td> - </ng-container> + </td> + </ng-container> + <ng-container matColumnDef="subject"> + <td mat-cell *matCellDef="let row" style="width:50%;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;padding: 5px;vertical-align: middle;"> + <div *ngIf="row.closing_date == null && mobileMode" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;text-align: right;"> + <i class="fa fa-stopwatch" title="date limite de traitement"></i> + <span [innerHTML]="row.process_limit_date | timeLimit" title='{{row.process_limit_date | date : "le dd/MM/y à HH:mm"}}'></span> + </div> + <div style="overflow: hidden;text-overflow: ellipsis;" title="{{row.subject}}"> + <span *ngIf="!mobileMode" class="label" [ngStyle]="{'background': row.priority_color}">{{row.priority_label}}</span> + <span>{{row.subject}}</span> + </div> + <div *ngIf="mobileMode" style="padding-top: 5px;color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;text-align: right;"> + {{row.dest_user}} + </div> + <div style="display:hidden;"> + + </div> + <div *ngIf="!mobileMode && (row.folder_name || row.case_label)"> + <span *ngIf="row.folder_name" class="label label-default" style="background-color:rgba(0,0,0,0.4);margin-left: 5px;margin-right: 5px;" title="Dossier"><i class="fa fa-folder"></i> {{row.folder_name}}</span> + <span *ngIf="row.case_label" class="label label-default" style="background-color:rgba(0,0,0,0.4);margin-left: 5px;margin-right: 5px;" title="Affaire"><i class="fa fa-suitcase"></i> {{row.case_label}}</span> + </div> + </td> + </ng-container> + <ng-container matColumnDef="contact_society"> + <td mat-cell *matCellDef="let row" style="width:25%;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;padding: 5px;vertical-align: middle;"> + <div style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> + <b>De:</b> + <span *ngIf="row.user_firstname">{{row.user_firstname}}</span> + <span *ngIf="row.user_lastname">{{row.user_lastname}}</span> + <span *ngIf="row.contact_lastname==''">{{row.contact_society}}</span> + <span *ngIf="row.contact_society==''">{{row.contact_lastname}}</span> + </div> + <div style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> + <b>Pour:</b> + <span title="{{row.user_dest_firstname}} {{row.user_dest_lastname}} ({{row.entity_destination}})">{{row.user_dest_firstname}} {{row.user_dest_lastname}} ({{row.entity_destination}})</span> + </div> + <div style="padding-top:10px;"> + <i class="fa fa-file" color="primary"></i> {{row.doctype_label}} + </div> + </td> + </ng-container> - <ng-container matColumnDef="creation_date"> - <td mat-cell *matCellDef="let row" style="text-align: right;width:15%;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;padding: 5px;"> - <div *ngIf="row.closing_date == null" id="{{row.res_id}}_creation_date" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;" - title='{{row.creation_date | date : "le dd/MM/y à HH:mm"}}'> - <i class="fa fa-calendar" title="date d'enregistrement"></i> {{row.creation_date | timeAgo}} - </div> - <div *ngIf="row.closing_date == null" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> - <i class="fa fa-stopwatch" title="date limite de traitement"></i> - <span [innerHTML]="row.process_limit_date | timeLimit" title='{{row.process_limit_date | date : "le dd/MM/y à HH:mm"}}'></span> - </div> - <div *ngIf="row.closing_date != null" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> - <i class="fa fa-lock" title="date de clôture"></i> - <span title='{{row.process_limit_date | date : "le dd/MM/y à HH:mm"}}'>{{row.closing_date | timeAgo}}</span> - </div> - <div> - <button mat-icon-button (click)="$event.stopPropagation();goTo(row);" (mouseenter)="viewThumbnail(row);" (mouseleave)="closeThumbnail();"> - <mat-icon color="primary" class="fa fa-eye"></mat-icon> - </button> - </div> - </td> - </ng-container> - <tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="goToDetail(row);" style="cursor: pointer;"></tr> - </table> + <ng-container matColumnDef="creation_date"> + <td mat-cell *matCellDef="let row" style="text-align: right;width:15%;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;padding: 5px;vertical-align: middle;"> + <div *ngIf="row.closing_date == null" id="{{row.res_id}}_creation_date" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;" + title='{{row.creation_date | date : "le dd/MM/y à HH:mm"}}'> + <i class="fa fa-calendar" title="date d'enregistrement"></i> {{row.creation_date | timeAgo}} + </div> + <div *ngIf="row.closing_date == null" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> + <i class="fa fa-stopwatch" title="date limite de traitement"></i> + <span [innerHTML]="row.process_limit_date | timeLimit" title='{{row.process_limit_date | date : "le dd/MM/y à HH:mm"}}'></span> + </div> + <div *ngIf="row.closing_date != null" style="color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> + <i class="fa fa-lock" title="date de clôture"></i> + <span title='{{row.closing_date | date : "le dd/MM/y à HH:mm"}}'>{{row.closing_date | timeAgo}}</span> + </div> + <div> + <button mat-icon-button (click)="$event.stopPropagation();goTo(row);" (mouseenter)="viewThumbnail(row);" (mouseleave)="closeThumbnail();"> + <mat-icon color="primary" class="fa fa-eye"></mat-icon> + </button> + </div> + </td> + </ng-container> + + <tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="goToDetail(row);"></tr> + </table> </mat-tab> </mat-tab-group> </mat-card> diff --git a/apps/maarch_entreprise/js/angular/app/home.component.ts b/apps/maarch_entreprise/js/angular/app/home.component.ts index b527ad0ce47..274f52d2749 100755 --- a/apps/maarch_entreprise/js/angular/app/home.component.ts +++ b/apps/maarch_entreprise/js/angular/app/home.component.ts @@ -38,7 +38,7 @@ export class HomeComponent extends AutoCompletePlugin implements OnInit { @ViewChildren(MatExpansionPanel) viewPanels: QueryList<MatExpansionPanel>; homeData: any; dataSource: any; - displayedColumns: string[] = ['res_id', 'subject', 'creation_date']; + displayedColumns: string[] = ['res_id', 'subject', 'contact_society', 'creation_date']; currentDate : string = ""; diff --git a/src/app/home/controllers/HomeController.php b/src/app/home/controllers/HomeController.php index 6b87e4ff0a0..9ae8746b11a 100644 --- a/src/app/home/controllers/HomeController.php +++ b/src/app/home/controllers/HomeController.php @@ -76,7 +76,31 @@ class HomeController } $lastResources = ResModel::getLastResources([ - 'select' => ['res_letterbox.res_id', 'res_letterbox.subject', 'res_letterbox.creation_date', 'res_letterbox.destination', 'res_letterbox.dest_user', 'mlb_coll_ext.alt_identifier', 'mlb_coll_ext.closing_date', 'mlb_coll_ext.process_limit_date', 'status.label_status as status_label', 'status.img_filename as status_icon', 'priorities.color as priority_color'], + 'select' => [ + 'r.alt_identifier', + 'r.category_id', + 'r.case_label', + 'r.closing_date', + 'r.category_id', + 'r.contact_lastname', + 'r.contact_society', + 'r.creation_date', + 'r.entity_label as entity_destination', + 'r.folder_name', + 'priorities.color as priority_color', + 'priorities.label as priority_label', + 'r.process_limit_date', + 'r.res_id', + 'status.img_filename as status_icon', + 'status.label_status as status_label', + 'status.id as status_id', + 'r.subject', + 'r.type_label as doctype_label', + 'r.user_lastname', + 'r.user_firstname', + 'users.lastname as user_dest_lastname', + 'users.firstname as user_dest_firstname', + ], 'limit' => 5, 'userId' => $GLOBALS['userId'] ]); diff --git a/src/app/resource/models/ResModelAbstract.php b/src/app/resource/models/ResModelAbstract.php index e56570d2c32..d09feb16e76 100644 --- a/src/app/resource/models/ResModelAbstract.php +++ b/src/app/resource/models/ResModelAbstract.php @@ -225,18 +225,19 @@ abstract class ResModelAbstract $resources = DatabaseModel::select([ 'select' => $aArgs['select'], - 'table' => ['history, res_letterbox, mlb_coll_ext, status, priorities'], + 'table' => ['history, res_view_letterbox r, status, priorities, users'], 'where' => [ 'history.user_id = ?', 'history.table_name IN (?)', 'history.record_id IS NOT NULL', 'history.record_id != ?', 'history.event_id != ?', 'history.event_id NOT LIKE ?', - 'CAST(history.record_id AS INT) = res_letterbox.res_id', - 'mlb_coll_ext.res_id = res_letterbox.res_id', 'res_letterbox.status != ?', - 'res_letterbox.status = status.id', - 'res_letterbox.priority = priorities.id', + 'CAST(history.record_id AS INT) = r.res_id', + 'r.res_id = r.res_id', 'r.status != ?', + 'r.status = status.id', + 'r.priority = priorities.id', + 'r.dest_user = users.user_id', ], 'data' => [$aArgs['userId'], ['res_letterbox', 'res_view_letterbox'], 'none', 'linkup', 'attach%', 'DEL'], - 'group_by' => ['res_letterbox.res_id', 'mlb_coll_ext.alt_identifier', 'mlb_coll_ext.closing_date', 'mlb_coll_ext.process_limit_date', 'status.label_status', 'status.img_filename', 'priorities.color'], + 'group_by' => ['users.firstname', 'users.lastname', 'r.user_firstname', 'r.user_lastname', 'r.type_label', 'r.subject', 'r.folder_name', 'r.entity_label', 'r.creation_date', 'r.contact_society', 'r.contact_firstname', 'r.contact_lastname', 'r.case_label', 'r.category_id', 'r.res_id', 'r.alt_identifier', 'r.closing_date', 'r.process_limit_date', 'status.id', 'status.label_status', 'status.img_filename', 'priorities.color', 'priorities.label'], 'order_by' => ['MAX(history.event_date) DESC'], 'limit' => $aArgs['limit'] ]); -- GitLab