Skip to content
Snippets Groups Projects
Verified Commit c5621b06 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #9906 fix default action + begin pj list

parent 3f27f9a6
No related branches found
No related tags found
No related merge requests found
<div *ngIf="loading" style="display:flex;height:100%;"> <ng-container *ngIf="!loading">
<mat-spinner style="margin:auto;"></mat-spinner> <div *ngIf="attachments.length == 0" style="text-align:center;font-size:24px;font-weight:bold;opacity:0.3;">
</div> AUCUN ATTACHEMENT
<div style="text-align:center;font-weight:bold;opacity:0.3;">{{data.chrono}} - {{lang.attachments}}</div> </div>
<mat-nav-list *ngIf="!loading" style="min-width:650px;"> <mat-card *ngFor="let attachment of attachments" style="margin: 30px;">
<div class="thumbnailPj">
<img>
</div>
<div class="infosPj">
</div>
</mat-card>
</ng-container>
<!--<mat-nav-list *ngIf="!loading">
<div *ngIf="attachments.length == 0" style="text-align:center;font-size:24px;font-weight:bold;opacity:0.3;"> <div *ngIf="attachments.length == 0" style="text-align:center;font-size:24px;font-weight:bold;opacity:0.3;">
AUCUN ATTACHEMENT AUCUN ATTACHEMENT
</div> </div>
<ng-container *ngFor="let attachment of attachments"> <ng-container *ngFor="let attachment of attachments">
<a target="_blank" href="index.php?display=true&module=attachments&page=view_attachment&res_id_master={{data.resId}}&id={{attachment.res_id}}" mat-list-item (click)="openLink($event)" style="height:auto;"> <a target="_blank" href="index.php?display=true&module=attachments&page=view_attachment&res_id_master={{resIds[0]}}&id={{attachment.res_id}}" mat-list-item (click)="openLink($event)" style="height:auto;">
<span mat-line> <span mat-line>
<div style="display:flex;color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;"> <div style="display:flex;color: rgba(0,0,0,0.4);font-size: 90%;overflow: hidden;text-overflow: ellipsis;">
<span style="flex:1;text-align: center;"> <span style="flex:1;text-align: center;">
...@@ -45,11 +55,8 @@ ...@@ -45,11 +55,8 @@
</div> </div>
</div> </div>
</div> </div>
</span> </span>
</a> </a>
<mat-divider style="margin:10px;"></mat-divider> <mat-divider style="margin:10px;"></mat-divider>
</ng-container> </ng-container>
</mat-nav-list>-->
</mat-nav-list> \ No newline at end of file
\ No newline at end of file
import { Component, AfterViewInit, Inject } from '@angular/core'; import { Component, OnInit, Output, Input, EventEmitter } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { LANG } from '../translate.component'; import { LANG } from '../translate.component';
import { NotificationService } from '../notification.service'; import { NotificationService } from '../notification.service';
import { MAT_BOTTOM_SHEET_DATA } from '@angular/material';
declare function $j(selector: any): any;
@Component({ @Component({
selector: 'app-attachments-list', selector: 'app-attachments-list',
...@@ -12,20 +9,28 @@ declare function $j(selector: any): any; ...@@ -12,20 +9,28 @@ declare function $j(selector: any): any;
styleUrls: ['attachments-list.component.scss'], styleUrls: ['attachments-list.component.scss'],
providers: [NotificationService] providers: [NotificationService]
}) })
export class AttachmentsListComponent implements AfterViewInit { export class AttachmentsListComponent implements OnInit {
lang: any = LANG; lang: any = LANG;
attachments: any; attachments: any;
attachmentTypes: any; attachmentTypes: any;
loading: boolean = true; loading: boolean = true;
resIds: number[] = [];
@Input('injectDatas') injectDatas: any;
@Output('reloadBadgeAttachments') reloadBadgeNotes = new EventEmitter<string>();
constructor(public http: HttpClient) { }
constructor(public http: HttpClient, @Inject(MAT_BOTTOM_SHEET_DATA) public data: any) { } ngOnInit(): void { }
ngAfterViewInit() { loadAttachments(resId: number) {
this.http.get("../../rest/res/" + this.data.resId + "/attachments") this.resIds[0] = resId;
this.loading = true;
this.http.get("../../rest/res/" + this.resIds[0] + "/attachments")
.subscribe((data: any) => { .subscribe((data: any) => {
this.attachments = data.attachments; this.attachments = data.attachments;
this.attachmentTypes = data.attachment_types; this.attachmentTypes = data.attachment_types;
this.reloadBadgeNotes.emit(`${this.attachments.length}`);
this.loading = false; this.loading = false;
}); });
} }
......
...@@ -65,8 +65,8 @@ ...@@ -65,8 +65,8 @@
<ng-container matColumnDef="res_id"> <ng-container matColumnDef="res_id">
<td mat-cell *matCellDef="let row" <td mat-cell *matCellDef="let row"
style="padding:0;border-top: solid 1px rgba(0, 0, 0, 0.12);" style="padding:0;border-top: solid 1px rgba(0, 0, 0, 0.12);cursor:pointer;"
[class.selected-data]="row.checked"> [class.selected-data]="row.checked" (click)="launch(defaultAction,row);">
<div *ngIf="!snav2.opened && !mobileMode && row.display.length > 0" class="sub-info"> <div *ngIf="!snav2.opened && !mobileMode && row.display.length > 0" class="sub-info">
<span class="sub-info-data" [class]="data.cssClasses.join(' ')" <span class="sub-info-data" [class]="data.cssClasses.join(' ')"
*ngFor="let data of row.display" style="flex:1;white-space: pre; *ngFor="let data of row.display" style="flex:1;white-space: pre;
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
</mat-icon> </mat-icon>
</button> </button>
<button mat-icon-button title="{{lang.attachments}}" <button mat-icon-button title="{{lang.attachments}}"
(click)="$event.stopPropagation();openAttachSheet(row)" (click)="$event.stopPropagation();togglePanel('attachment',row)"
[class.noData]="row.countAttachments == 0"> [class.noData]="row.countAttachments == 0">
<mat-icon matBadgeHidden="{{row.countAttachments == 0}}" fontSet="fas" <mat-icon matBadgeHidden="{{row.countAttachments == 0}}" fontSet="fas"
matBadge="{{row.countAttachments}}" fontIcon="fa-paperclip fa-2x"> matBadge="{{row.countAttachments}}" fontIcon="fa-paperclip fa-2x">
......
...@@ -11,15 +11,10 @@ import { startWith, switchMap, map, catchError } from 'rxjs/operators'; ...@@ -11,15 +11,10 @@ import { startWith, switchMap, map, catchError } from 'rxjs/operators';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { HeaderService } from '../../service/header.service'; import { HeaderService } from '../../service/header.service';
import { FiltersListService } from '../../service/filtersList.service'; import { FiltersListService } from '../../service/filtersList.service';
import { NotesListComponent } from '../notes/notes.component';
import { AttachmentsListComponent } from '../attachments/attachments-list.component';
import { DiffusionsListComponent } from '../diffusions/diffusions-list.component';
import { FiltersToolComponent } from './filters/filters-tool.component'; import { FiltersToolComponent } from './filters/filters-tool.component';
import { ActionsListComponent } from '../actions/actions-list.component'; import { ActionsListComponent } from '../actions/actions-list.component';
import { Overlay } from '@angular/cdk/overlay'; import { Overlay } from '@angular/cdk/overlay';
import { VisaWorkflowComponent } from '../visa/visa-workflow.component';
import { AvisWorkflowComponent } from '../avis/avis-workflow.component';
import { BasketHomeComponent } from '../basket/basket-home.component'; import { BasketHomeComponent } from '../basket/basket-home.component';
import { PanelListComponent } from './panel/panel-list.component'; import { PanelListComponent } from './panel/panel-list.component';
...@@ -225,12 +220,10 @@ export class BasketListComponent implements OnInit { ...@@ -225,12 +220,10 @@ export class BasketListComponent implements OnInit {
refreshBadgeNotes(nb: number) { refreshBadgeNotes(nb: number) {
this.currentResource.countNotes = nb; this.currentResource.countNotes = nb;
} }
openAttachSheet(row: any): void { refreshBadgeAttachments(nb: number) {
this.bottomSheet.open(AttachmentsListComponent, { this.currentResource.countAttachments = nb;
data: { resId: row.res_id, chrono: row.alt_identifier },
});
} }
refreshDao() { refreshDao() {
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
title="{{this.currentResource.subject}}"> title="{{this.currentResource.subject}}">
{{this.currentResource.subject | shorten: 50: '...'}} {{this.currentResource.subject | shorten: 50: '...'}}
</div> </div>
<mat-tab-group *ngIf="this.mode == 'diffusion'" [(selectedIndex)]="selectedDiffusionTab" class="diffusionTab"> <mat-tab-group *ngIf="this.mode == 'diffusion'" [(selectedIndex)]="selectedDiffusionTab" class="diffusionTab">
<mat-tab label="{{lang.diffusionList}}"> <mat-tab label="{{lang.diffusionList}}">
<app-diffusions-list #appDiffusionsList [injectDatas]="injectDatasParam"></app-diffusions-list> <app-diffusions-list #appDiffusionsList [injectDatas]="injectDatasParam"></app-diffusions-list>
...@@ -23,5 +22,5 @@ ...@@ -23,5 +22,5 @@
<app-avis-workflow #appAvisWorkflow [injectDatas]="injectDatasParam"></app-avis-workflow> <app-avis-workflow #appAvisWorkflow [injectDatas]="injectDatasParam"></app-avis-workflow>
</mat-tab> </mat-tab>
</mat-tab-group> </mat-tab-group>
<app-notes-list #appNotesList *ngIf="this.mode == 'note'" [injectDatas]="injectDatasParam" (reloadBadgeNotes)="reloadBadgeNotes($event)"></app-notes-list>
<app-notes-list #appNotesList *ngIf="this.mode == 'note'" [injectDatas]="injectDatasParam" (reloadBadgeNotes)="reloadBadgeNotes($event)"></app-notes-list> <app-attachments-list #appAttachmentsList *ngIf="this.mode == 'attachment'" [injectDatas]="injectDatasParam" (reloadBadgeAttachments)="reloadBadgeAttachments($event)"></app-attachments-list>
\ No newline at end of file \ No newline at end of file
...@@ -4,6 +4,7 @@ import { DiffusionsListComponent } from '../../diffusions/diffusions-list.compon ...@@ -4,6 +4,7 @@ import { DiffusionsListComponent } from '../../diffusions/diffusions-list.compon
import { VisaWorkflowComponent } from '../../visa/visa-workflow.component'; import { VisaWorkflowComponent } from '../../visa/visa-workflow.component';
import { AvisWorkflowComponent } from '../../avis/avis-workflow.component'; import { AvisWorkflowComponent } from '../../avis/avis-workflow.component';
import { NotesListComponent } from '../../notes/notes.component'; import { NotesListComponent } from '../../notes/notes.component';
import { AttachmentsListComponent } from '../../attachments/attachments-list.component';
declare function $j(selector: any): any; declare function $j(selector: any): any;
...@@ -29,11 +30,13 @@ export class PanelListComponent implements OnInit { ...@@ -29,11 +30,13 @@ export class PanelListComponent implements OnInit {
currentResource: any = {}; currentResource: any = {};
@Output('refreshBadgeNotes') refreshBadgeNotes = new EventEmitter<string>(); @Output('refreshBadgeNotes') refreshBadgeNotes = new EventEmitter<string>();
@Output('refreshBadgeAttachments') refreshBadgeAttachments = new EventEmitter<string>();
@ViewChild('appDiffusionsList') appDiffusionsList: DiffusionsListComponent; @ViewChild('appDiffusionsList') appDiffusionsList: DiffusionsListComponent;
@ViewChild('appVisaWorkflow') appVisaWorkflow: VisaWorkflowComponent; @ViewChild('appVisaWorkflow') appVisaWorkflow: VisaWorkflowComponent;
@ViewChild('appAvisWorkflow') appAvisWorkflow: AvisWorkflowComponent; @ViewChild('appAvisWorkflow') appAvisWorkflow: AvisWorkflowComponent;
@ViewChild('appNotesList') appNotesList: NotesListComponent; @ViewChild('appNotesList') appNotesList: NotesListComponent;
@ViewChild('appAttachmentsList') appAttachmentsList: AttachmentsListComponent;
constructor() { } constructor() { }
...@@ -65,10 +68,19 @@ export class PanelListComponent implements OnInit { ...@@ -65,10 +68,19 @@ export class PanelListComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
$j('textarea').focus(); $j('textarea').focus();
}, 200); }, 200);
} else if (mode == 'attachment') {
setTimeout(() => {
this.icon = 'fa-paperclip';
this.appAttachmentsList.loadAttachments(this.currentResource.res_id);
}, 0);
} }
} }
reloadBadgeNotes(nb:any) { reloadBadgeNotes(nb:any) {
this.refreshBadgeNotes.emit(nb); this.refreshBadgeNotes.emit(nb);
} }
reloadBadgeAttachments(nb:any) {
this.refreshBadgeAttachments.emit(nb);
}
} }
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