Skip to content
Snippets Groups Projects
signature-position.component.html 4.66 KiB
Newer Older
  • Learn to ignore specific revisions
  • <ion-header [translucent]="true">
        <ion-toolbar color="primary">
    
            <ion-title>{{'lang.adminSignaturesPositions' | translate}}</ion-title>
    
            <ion-item lines="none" slot="end" color="primary">
                <ion-label>{{'lang.page' | translate | titlecase}}</ion-label>
                <ion-select interface="popover" [(ngModel)]="currentPage" (ionChange)="changePage($event.detail.value)">
                    <ion-select-option *ngFor="let page of pages" [value]="page">{{page}}</ion-select-option>
                </ion-select>
            </ion-item>
        </ion-toolbar>
        <ion-toolbar color="primary">
    
            <ion-segment color="warning" scrollable [value]="currentUser" (ionChange)="selectUser($event.detail.value)"
                style="justify-content: center;">
    
                <ion-segment-button *ngFor="let user of workflow;let i=index" [value]="i" layout="icon-start">
                    <ion-label>
                        <h2>{{user.userDisplay}}</h2>
                        <p class="chip-item-content">
                            <ng-container *ngFor="let sign of signList">
                                <ion-chip class="chip-item" *ngIf="sign.sequence == i" outline
                                    [title]="('lang.accessToPage' | translate) + ' ' + sign.page"
                                    [color]="(i=== currentUser && sign.page === currentPage) ? 'primary' : 'medium'"
                                    (click)="goToSignUserPage(i,sign.page)">
                                    <ion-label>{{sign.page}}</ion-label>
                                </ion-chip>
                            </ng-container>
                        </p>
                    </ion-label>
                    <ion-icon [name]="user.mode === 'sign' ? 'pencil-outline' : 'checkmark-done-outline'"></ion-icon>
                </ion-segment-button>
            </ion-segment>
    
        </ion-toolbar>
    </ion-header>
    <ion-content>
    
        <drag-scroll style="overflow:auto;height: 100%;width: 100%;margin: auto;"
            [drag-disabled]="dragging && !signaturesService.mobileMode"
            [drag-scroll-disabled]="dragging && signaturesService.mobileMode">
            <div id="myBounds" #myBounds style="margin:auto;position: relative;box-shadow: 0px 0px 5px 0px #656565;"
                [style.width.px]="workingAreaWidth" [style.height.px]="workingAreaHeight">
                <ng-container *ngFor="let sign of signList;let indexSign=index;">
                    <div *ngIf="sign.page === currentPage" [class.signDisabled]="currentUser!==sign.sequence"
                        [position]="{x: (sign.position.positionX*workingAreaWidth)/100, y:(sign.position.positionY*workingAreaHeight)/100}"
                        [style.width.%]="25" [ngDraggable]="currentUser===sign.sequence" (movingOffset)="dragging=true"
                        (endOffset)="moveSign($event, i);" [preventDefaultEvent]="false" [bounds]="myBounds"
                        [inBounds]="true" class="signature"
                        (click)="currentUser!=sign.sequence ? goToSignUserPage(sign.sequence, currentPage) : false">
                        <ion-buttons style="position: absolute;top: -50px;right: 0px;">
                            <ion-button fill="clear" slot="icon-only" shape="round" size="small" color="danger"
                                [title]="'lang.delete' | translate" (click)="deleteSign(indexSign)">
                                <ion-icon slot="icon-only" name="trash-outline"></ion-icon>
                            </ion-button>
                        </ion-buttons>
                        <span class="signUserName">{{getUserName(sign.sequence)}}</span>
                        {{'lang.signature' | translate | uppercase}}
                    </div>
                </ng-container>
                <ion-img class="img-content" [src]="imgContent" (ionImgDidLoad)="imageLoaded($event)"></ion-img>
                <ion-button color="primary" *ngIf="emptySign()" (click)="initSign()"
                    style="position: fixed;top: 50%;left: 50%;transform: translate(-50%,-50%);font-size:20px;">
                    {{'lang.createSignaturePosition' | translate}}</ion-button>
    
        <ngx-extended-pdf-viewer style="display: none;" [src]="pdfContent" [useBrowserLocale]="true" [textLayer]="false"
            (pdfLoaded)="onPagesLoaded($event)">
        </ngx-extended-pdf-viewer>
    </ion-content>
    
    <ion-footer class="ion-no-border footer-buttons">
        <div>
            <ion-button type="button" color="primary" fill="outline" shape="round" size="large" (click)="onSubmit()">
                <ion-label>{{'lang.save' | translate}}</ion-label>
            </ion-button>
            <ion-button type="button" color="medium" fill="outline" shape="round" size="large"
                (click)="modalController.dismiss()">
                <ion-label>{{'lang.cancel' | translate}}</ion-label>
            </ion-button>
        </div>