visa-workflow.component.html 7.95 KB
Newer Older
1
2
3
<ion-header [translucent]="true">
    <ion-toolbar color="primary">
        <ion-buttons slot="start">
4
            <ion-button disabled>
5
6
7
8
9
10
                <ion-icon slot="icon-only" name="list-outline"></ion-icon>
            </ion-button>
        </ion-buttons>
        <ion-title class="ion-text-center">{{'lang.circuit' | translate}}</ion-title>
    </ion-toolbar>
</ion-header>
11
12
13
<ion-content (click)="resetVisaUsersList();">
    <ng-container *ngIf="editMode">
        <ion-item lines="none">
14
15
            <ion-searchbar #searchInput [(ngModel)]="visaUsersSearchVal" [placeholder]="'lang.searchUser' | translate"
                (ionChange)="getVisaUsers($event)" (ionFocus)="visaUsersSearchVal=''"></ion-searchbar>
16
17
18
19
            <ion-buttons *ngIf="!hasConnector; else elseHasConnector" slot="end">
                 <ion-button fill="clear" slot="icon-only" shape="round" color="primary"
                    (click)="openVisaWorkflowModels($event)" [title]="'lang.circuitModels' | translate">
                    <ion-icon slot="icon-only" name="albums-outline"></ion-icon>
20
21
                </ion-button>
            </ion-buttons>
22
23
24
25
26
27
28
29
30
31
32
33
            <ng-template #elseHasConnector>
                <ion-buttons slot="end">
                    <ion-button fill="clear" slot="icon-only" shape="round" color="primary" [matMenuTriggerFor]="menu">
                        <ion-icon slot="icon-only" name="ellipsis-vertical-outline"></ion-icon>
                    </ion-button>
                </ion-buttons>
                <mat-menu #menu="matMenu">
                    <ion-item *ngIf="hasConnector" button (click)="openOtpModal()" lines="none">
                        <ion-icon name="person-circle-outline" slot="start" color="primary"></ion-icon>
                        <ion-label style="font-size: 14px;">{{'lang.newOtp' | translate}}</ion-label>
                    </ion-item>
                    <button mat-menu-item [matMenuTriggerFor]="model"
34
                        (menuOpened)="visaWorkflowService.getVisaUserModels(visaWorkflow)">{{'lang.circuitModels' | translate}}</button>
35
36
                </mat-menu>
                <mat-menu #model="matMenu">
37
                    <ion-item button lines="none" *ngFor="let model of visaWorkflowService.visaWorkflowModels" (click)="loadVisaWorkflow(model)">
38
39
40
                        <ion-label style="font-size: 14px;">{{model.title}}</ion-label>
                        <ion-buttons slot="end">
                            <ion-button fill="clear" slot="icon-only" shape="round" color="danger"
41
                                (click)="$event.stopPropagation(); visaWorkflowService.removeModel(model)">
42
43
44
45
                                <ion-icon slot="icon-only" name="trash-outline"></ion-icon>
                            </ion-button>
                        </ion-buttons>
                    </ion-item>
46
                    <ion-item button (click)="visaWorkflowService.createModel(visaWorkflow)" [disabled]="visaWorkflow.length === 0 || visaWorkflowService.notExternalUsers === 0">
47
48
49
50
                        <ion-label style="font-size: 14px;">{{'lang.newTemplate' | translate}}</ion-label>
                    </ion-item>
                </mat-menu>
            </ng-template>
51
        </ion-item>
52
        <ion-list *ngIf="visaUsersList.length > 0"
53
            style="position: absolute;z-index: 2;width: 100%;box-shadow: 0 4px 2px -2px gray;">
54
            <ion-item *ngFor="let user of visaUsersList">
55
56
                <ion-checkbox color="primary" slot="start" [value]="user"
                    (ionChange)="addUser($event.detail.value, searchInput)"></ion-checkbox>
57
58
59
60
61
62
63
                <ion-label>{{ user.firstname }} {{ user.lastname }}</ion-label>
                <ion-note slot="end">{{ user.email }}</ion-note>
            </ion-item>
        </ion-list>
    </ng-container>
    <ion-list *ngIf="visaWorkflow.length === 0">
        <ion-item lines="none">
64
            <ion-label class="ion-text-center" color="medium">{{'lang.noUserInWorkflow' | translate}}</ion-label>
65
66
        </ion-item>
    </ion-list>
67
68
69
    <ion-reorder-group (ionItemReorder)="doReorder($event)" [disabled]="!editMode">
        <ion-item class="no-ripple" *ngFor="let diffusion of visaWorkflow;let i=index"
            [class.current]="diffusion.current">
70
            <ion-reorder slot="start">
71
                <ion-icon [title]="'lang.reorder' | translate" name="reorder-three" style="font-size: 30px;"></ion-icon>
72
            </ion-reorder>
73
            <ion-avatar slot="start" class="avatar-user" style="cursor: grab;" (click)="$event.stopPropagation();">
74
75
                <img [src]="diffusion.userPicture">
            </ion-avatar>
76
            <ion-label>
77
                <p class="secondary" *ngIf="diffusion.current && (diffusion.userId !== null && diffusion.userId !== authService.user.id)">
78
                    {{'lang.substituteMsg' | translate}}</p>
79
                <h2 [class.interrupt]="diffusion.noConnector !== undefined && diffusion.noConnector === true" [title]="diffusion.userDisplay" *ngIf="diffusion.userDisplay !== ''">{{diffusion.userDisplay}}</h2>
80
81
                <h2 [title]="diffusion.userDisplay" class="danger" *ngIf="diffusion.userDisplay === ''">
                    {{'lang.userDeleted' | translate}}</h2>
82
                <p *ngIf="diffusion.noConnector === undefined && diffusion.processDate === null" style="display: flex;justify-content: start;">
83
                    <ion-select [(ngModel)]="diffusion.role" (ionChange)="checkRole(diffusion, i, $event.detail.value)" [title]="diffusion.userDisplay"
84
85
86
                        interface="popover" [interfaceOptions]="customPopoverOptions"
                        [style.color]="getRole(diffusion.role)?.color" [disabled]="!editMode"
                        style="width: auto;max-width: 100%;padding-left:0px;">
87
88
                        <ion-select-option [value]="mode" *ngFor="let mode of diffusion.modes"
                            [disabled]="!isValidRole(i,mode, diffusion.role)">
89
90
91
92
                            {{'lang.' + mode + 'User' | translate}}
                        </ion-select-option>
                    </ion-select>
                </p>
93
94
95
96
97
98
99
100
101
102
103
104
105
                <p *ngIf="diffusion.processDate !== null" [title]="diffusion.processDate">
                    <ion-note *ngIf="diffusion.status === 'VAL'" class="valProcess">
                        {{'lang.'+diffusion.mode+'ProcessInfo' | translate}}
                        {{diffusion.processDate}}
                    </ion-note>
                    <ion-note *ngIf="diffusion.status === 'REF'" class="refProcess">
                        {{'lang.refProcessInfo' | translate}}
                        {{diffusion.processDate}}
                    </ion-note>
                    <ion-note *ngIf="diffusion.status === 'STOP'" class="stopProcess">
                        {{'lang.stopProcessInfo' | translate}}
                        {{diffusion.processDate}}
                    </ion-note>
106
                </p>
107
                <ion-note *ngIf="diffusion.noConnector !== undefined && diffusion.noConnector === true" style="color: red; font-size: 10px;">{{ 'lang.noConnector' | translate }}</ion-note>
108
            </ion-label>
109
110
            <ion-icon *ngIf="!editMode && diffusion.current" color="success" slot="end" name="caret-back-outline">
            </ion-icon>
111
            <ion-buttons slot="end">
112
                <ion-button style="z-index: 9999" *ngIf="editMode && diffusion.userId === null && hasConnector" fill="clear" slot="icon-only" shape="round"
113
                    color="primary" (click)="$event.stopPropagation();openOtpModal(diffusion, i)" [title]="'lang.updateOtp' | translate">
114
115
                    <ion-icon name="create-outline"></ion-icon>
                </ion-button>
116
117
                <ion-button style="z-index: 9999" *ngIf="editMode" fill="clear" slot="icon-only" shape="round"
                    color="danger" (click)="$event.stopPropagation();removeUser(i)">
118
119
120
                    <ion-icon slot="icon-only" name="trash-outline"></ion-icon>
                </ion-button>
            </ion-buttons>
121
        </ion-item>
122
    </ion-reorder-group>
123
</ion-content>