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

FEAT #9685 front diffusion list component master

parent 92074bad
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,6 @@ export class RedirectActionComponent implements OnInit { ...@@ -19,7 +19,6 @@ export class RedirectActionComponent implements OnInit {
entities: any[] = []; entities: any[] = [];
injectDatasParam = { injectDatasParam = {
modes: ['diffList'],
entities: ['DSI'], entities: ['DSI'],
editable: [true] editable: [true]
}; };
......
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
<mat-spinner style="margin:auto;"></mat-spinner> <mat-spinner style="margin:auto;"></mat-spinner>
</div> </div>
<!--<div style="text-align:center;font-weight:bold;opacity:0.3;">{{data.chrono}} - {{lang.diffusionList}}</div>-->
<mat-list *ngIf="!loading"> <mat-list *ngIf="!loading">
<div *ngIf="diffList.length == 0" style="text-align:center;font-size:24px;font-weight:bold;opacity:0.3;"> <div *ngIf="diffList.length == 0" style="text-align:center;font-size:24px;font-weight:bold;opacity:0.3;">
AUCUNE LISTE DE DIFFUSION AUCUNE LISTE DE DIFFUSION
</div> </div>
<mat-form-field appearance="outline" floatLabel="never" [style.fontSize.px]="10"> <mat-form-field *ngIf="injectDatas.editable" appearance="outline" floatLabel="never" [style.fontSize.px]="10">
<input class="metaSearch" type="text" matInput placeholder="Ajouter une personne / une entité"> <input class="metaSearch" type="text" matInput placeholder="Ajouter une personne / une entité">
</mat-form-field> </mat-form-field>
<div cdkDropListGroup> <div cdkDropListGroup>
...@@ -15,19 +14,19 @@ ...@@ -15,19 +14,19 @@
<h3 mat-subheader>{{role.label}}</h3> <h3 mat-subheader>{{role.label}}</h3>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div cdkDropList [id]="role.id" #dataAvailableList="cdkDropList" [cdkDropListData]="diffList[role.id].items" <div cdkDropList [id]="role.id" #dataAvailableList="cdkDropList" [cdkDropListData]="diffList[role.id].items"
class="cdk-list" (cdkDropListDropped)="drop($event)" [cdkDropListDisabled]="role.id == 'dest'"> class="cdk-list" (cdkDropListDropped)="drop($event)" [cdkDropListDisabled]="role.id == 'dest' || !injectDatas.editable">
<div *ngIf="diffList[role.id].items.length === 0" style="opacity: 0.5;text-align: center;font-size: 10px;padding: 10px;"> <div *ngIf="diffList[role.id].items.length === 0" style="opacity: 0.5;text-align: center;font-size: 10px;padding: 10px;">
Acune personne Acune personne
</div> </div>
<mat-list-item *ngFor="let diffusion of diffList[role.id].items;let i=index" cdkDrag class="columns" <mat-list-item *ngFor="let diffusion of diffList[role.id].items;let i=index" cdkDrag class="columns"
[cdkDragDisabled]="diffusion.item_type == 'entity_id'" [class.notDraggable]="diffusion.item_type == 'entity_id' || role.id == 'dest'"> [cdkDragDisabled]="diffusion.item_type == 'entity_id' || !injectDatas.editable" [class.notDraggable]="(diffusion.item_type == 'entity_id' || role.id == 'dest') && injectDatas.editable" [class.notEditable]="!injectDatas.editable">
<mat-icon *ngIf="diffusion.item_type == 'user_id'" mat-list-icon class="fa fa-2x" [ngClass]="[diffusion.item_mode == 'copy' ? 'fa-users' : 'fa-user']" <mat-icon *ngIf="diffusion.item_type == 'user_id'" mat-list-icon class="fa fa-2x" [ngClass]="[diffusion.item_mode == 'copy' ? 'fa-users' : 'fa-user']"
color="primary"></mat-icon> color="primary"></mat-icon>
<h4 mat-line *ngIf="diffusion.item_type == 'user_id'">{{diffusion.item_firstname}} <h4 mat-line *ngIf="diffusion.item_type == 'user_id'">{{diffusion.item_firstname}}
{{diffusion.item_lastname}}</h4> {{diffusion.item_lastname}}</h4>
<p mat-line *ngIf="diffusion.item_type == 'user_id'" style="opacity:0.5;"> <p mat-line *ngIf="diffusion.item_type == 'user_id'" style="opacity:0.5;">
{{diffusion.item_entity}} </p> {{diffusion.item_entity}} </p>
<button mat-icon-button *ngIf="role.id != 'dest'" (click)="deleteItem(role.id,i)"> <button mat-icon-button *ngIf="role.id != 'dest' && injectDatas.editable" (click)="deleteItem(role.id,i)">
<mat-icon class="fa fa-times" color="warn"></mat-icon> <mat-icon class="fa fa-times" color="warn"></mat-icon>
</button> </button>
<mat-icon *ngIf="diffusion.item_type == 'entity_id'" mat-list-icon class="fa fa-sitemap fa-2x" <mat-icon *ngIf="diffusion.item_type == 'entity_id'" mat-list-icon class="fa fa-sitemap fa-2x"
......
...@@ -33,4 +33,8 @@ ...@@ -33,4 +33,8 @@
.notDraggable { .notDraggable {
cursor: not-allowed; cursor: not-allowed;
}
.notEditable {
cursor: initial;
} }
\ No newline at end of file
...@@ -44,9 +44,8 @@ export class DiffusionsListComponent implements OnInit { ...@@ -44,9 +44,8 @@ export class DiffusionsListComponent implements OnInit {
}; };
} }
}); });
console.log(this.diffList); if (this.injectDatas.resId > 0) {
if (!this.injectDatas) { this.loadListinstance(this.injectDatas.resId);
this.loadListinstance(100);
} else { } else {
this.loadListModel('COU'); this.loadListModel('COU');
...@@ -135,7 +134,21 @@ export class DiffusionsListComponent implements OnInit { ...@@ -135,7 +134,21 @@ export class DiffusionsListComponent implements OnInit {
} }
loadListinstance(resId: number) { loadListinstance(resId: number) {
this.loading = true;
this.http.get("../../rest/res/" + resId + "/listinstance").subscribe((data: any) => {
this.availableRoles.forEach(element => {
this.diffList[element.id].items = [];
});
Object.keys(data).forEach(diffusionRole => {
console.log(data[diffusionRole]);
data[diffusionRole].forEach((line:any) => {
this.diffList[line.item_mode].items.push(line);
});
});
this.loading = false;
}, (err: any) => {
this.notify.handleErrors(err);
});
} }
deleteItem(roleId:string, index: number) { deleteItem(roleId:string, index: number) {
......
...@@ -118,15 +118,27 @@ ...@@ -118,15 +118,27 @@
</table> </table>
</mat-card> </mat-card>
</mat-sidenav-content> </mat-sidenav-content>
<mat-sidenav #snav2 mode="over" [fixedInViewport]="mobileQuery.matches" fixedTopGap="56" position='end' <mat-sidenav #snav2 mode="side" [fixedInViewport]="mobileQuery.matches" fixedTopGap="56" position='end'
[opened]="mobileQuery.matches ? false : false" style="overflow-x:hidden;" [class.docView]="!filtersListService.filterMode" [opened]="mobileQuery.matches ? false : false" style="overflow-x:hidden;" [class.docView]="!filtersListService.filterMode"
[ngStyle]="{'width': mobileMode ? '80%' : '40%'}" autoFocus="false"> [ngStyle]="{'width': mobileMode ? '80%' : '30%'}" autoFocus="false">
<div *ngIf="innerHtml && !filtersListService.filterMode" [matTooltip]="currentChrono" [innerHTML]="innerHtml" <div *ngIf="innerHtml && !filtersListService.filterMode" [matTooltip]="currentChrono" [innerHTML]="innerHtml"
style="height: 100%;overflow: hidden;"></div> style="height: 100%;overflow: hidden;"></div>
<app-filters-list *ngIf="filtersListService.filterMode" [listProperties]="this.listProperties" <app-filters-list *ngIf="filtersListService.filterMode" [listProperties]="this.listProperties"
(refreshEvent)="refreshDao()"></app-filters-list> (refreshEvent)="refreshDao()"></app-filters-list>
<div style="display:flex;">
<button mat-icon-button (click)="snav2.close()" style="font-size: 25px;">
<mat-icon class="fa fa-arrow-right"></mat-icon>
</button>
</div>
<div style="display:flex;justify-content: center;padding: 30px;">
{{this.currentResource.alt_identifier}}
</div>
<mat-tab-group>
<mat-tab label="{{lang.diffusionList}}">
<app-diffusions-list #appDiffusionsList [injectDatas]="injectDatasParam"></app-diffusions-list>
</mat-tab>
</mat-tab-group>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-sidenav> </mat-sidenav>
</mat-sidenav-container> </mat-sidenav-container>
......
...@@ -42,6 +42,12 @@ export class BasketListComponent implements OnInit { ...@@ -42,6 +42,12 @@ export class BasketListComponent implements OnInit {
public innerHtml: SafeHtml; public innerHtml: SafeHtml;
basketUrl: string; basketUrl: string;
homeData: any; homeData: any;
injectDatasParam = {
resId: 0,
editable: false
};
currentResource: any = {};
filtersChange = new EventEmitter(); filtersChange = new EventEmitter();
...@@ -82,6 +88,7 @@ export class BasketListComponent implements OnInit { ...@@ -82,6 +88,7 @@ export class BasketListComponent implements OnInit {
@ViewChild('actionsListContext') actionsList: ActionsListComponent; @ViewChild('actionsListContext') actionsList: ActionsListComponent;
@ViewChild('filtersTool') filtersTool: FiltersToolComponent; @ViewChild('filtersTool') filtersTool: FiltersToolComponent;
@ViewChild('appDiffusionsList') appDiffusionsList: DiffusionsListComponent;
currentSelectedChrono: string = ''; currentSelectedChrono: string = '';
...@@ -205,9 +212,18 @@ export class BasketListComponent implements OnInit { ...@@ -205,9 +212,18 @@ export class BasketListComponent implements OnInit {
} }
openDiffusionSheet(row: any): void { openDiffusionSheet(row: any): void {
this.bottomSheet.open(DiffusionsListComponent, { if(this.injectDatasParam.resId == row.res_id && this.sidenavRight.opened) {
this.sidenavRight.close();
} else {
this.currentResource = row;
this.injectDatasParam.resId = row.res_id;
this.appDiffusionsList.loadListinstance(row.res_id);
this.sidenavRight.open();
}
/*this.bottomSheet.open(DiffusionsListComponent, {
data: { resId: row.res_id, chrono: row.alt_identifier }, data: { resId: row.res_id, chrono: row.alt_identifier },
}); });*/
} }
refreshDao() { refreshDao() {
......
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