diff --git a/modules/entities/xml/services.xml b/modules/entities/xml/services.xml index 7073770447ad0f34159d3bb56e8075f7da80421b..2d65a67f7e59c42cecb11cbb9ad2ddeca2ad20c8 100755 --- a/modules/entities/xml/services.xml +++ b/modules/entities/xml/services.xml @@ -142,11 +142,11 @@ <id>entities_print_sep_mlb</id> <name>_ENTITIES_PRINT_SEP_MLB</name> <comment>_ENTITIES_PRINT_SEP_MLB</comment> - <servicepage>index.php?page=print_sep_mlb_form&module=entities</servicepage> + <servicepage>/separators/print</servicepage> <servicetype>menu</servicetype> <system_service>false</system_service> <enabled>true</enabled> <style>fa fa-print</style> - <angular>false</angular> + <angular>true</angular> </SERVICE> </root> diff --git a/src/frontend/app/app-routing.module.ts b/src/frontend/app/app-routing.module.ts index e703b6dea05d52e47edc40ef838af518fc207dbc..cd10fda473523fbf5dfd6233c995aa884553c1c3 100755 --- a/src/frontend/app/app-routing.module.ts +++ b/src/frontend/app/app-routing.module.ts @@ -9,6 +9,7 @@ import { HomeComponent } from './home.component'; import { BasketListComponent } from './list/basket-list.component'; import { SignatureBookComponent } from './signature-book.component'; import { SaveNumericPackageComponent } from './save-numeric-package.component'; +import { PrintSeparatorComponent } from './separator/print-separator/print-separator.component'; @NgModule({ imports: [ @@ -20,6 +21,7 @@ import { SaveNumericPackageComponent } from './save-numeric-package.compone { path: 'home', component: HomeComponent }, { path: 'basketList/users/:userSerialId/groups/:groupSerialId/baskets/:basketId', component: BasketListComponent }, { path: 'saveNumericPackage', component: SaveNumericPackageComponent }, + { path: 'separators/print', component: PrintSeparatorComponent }, { path: 'signatureBook/users/:userId/groups/:groupId/baskets/:basketId/resources/:resId', component: SignatureBookComponent }, { path: '**', redirectTo: 'home', pathMatch: 'full' }, ], { useHash: true }), diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index b8cb4454184c3ff98dc71ee5e89af4a207166645..e67fbcfb46d34139b822b1510502213c80c8f8de 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -54,6 +54,7 @@ import { DiffusionsListComponent } from './diffusions/diffusions-lis import { VisaWorkflowComponent } from './visa/visa-workflow.component'; import { AvisWorkflowComponent } from './avis/avis-workflow.component'; +import { PrintSeparatorComponent } from './separator/print-separator/print-separator.component'; @NgModule({ @@ -105,6 +106,7 @@ import { AvisWorkflowComponent } from './avis/avis-workflow.componen RedirectActionComponent, SendShippingActionComponent, ActionsListComponent, + PrintSeparatorComponent, ], entryComponents: [ CustomSnackbarComponent, diff --git a/src/frontend/app/separator/print-separator/print-separator.component.html b/src/frontend/app/separator/print-separator/print-separator.component.html new file mode 100644 index 0000000000000000000000000000000000000000..169f07e9e5506a33be735722ac801514548db001 --- /dev/null +++ b/src/frontend/app/separator/print-separator/print-separator.component.html @@ -0,0 +1,71 @@ +<mat-sidenav-container class="maarch-container"> + <mat-sidenav #snavLeft mode="side" opened class="panel-left" #snav [mode]="mobileMode ? 'over' : 'side'" + [fixedInViewport]="mobileMode" [opened]="mobileMode ? false : true" autoFocus="false" style="overflow-x:hidden;" + [ngStyle]="{'width': mobileMode ? '80%' : '350px'}"> + <header-panel [snavLeft]="snav"></header-panel> + <menu-shortcut></menu-shortcut> + <menu-nav></menu-nav> + <mat-divider></mat-divider> + </mat-sidenav> + <mat-sidenav-content> + <div class="bg-head"> + <div class="bg-head-title" [class.customContainerRight]="mobileMode"> + <div class="bg-head-title-label"> + <header-left [snavLeft]="snav"></header-left> + </div> + <div class="bg-head-title-tool"> + <header-right></header-right> + </div> + </div> + <div class="bg-head-content" [class.fullContainer]="mobileMode"> + </div> + </div> + <div class="container" [class.fullContainer]="mobileMode"> + <div class="container-content"> + <div style="height:100%;overflow:auto;position:absolute;width:100%;"> + <div class="alert-message alert-message-info" role="alert" style="max-width: 100%;margin: 30px;" + [innerHTML]="lang.printSeparatorInfo"></div> + <div class="col-md-4"> + <mat-form-field> + <mat-label>{{lang.separatorType}}</mat-label> + <mat-select [(ngModel)]="separator.type"> + <mat-option *ngFor="let separatorType of separatorTypes" [value]="separatorType"> + {{lang[separatorType]}} + </mat-option> + </mat-select> + </mat-form-field> + <mat-form-field> + <mat-label>{{lang.separatorTarget}}</mat-label> + <mat-select [(ngModel)]="separator.target" (selectionChange)="changeType($event)"> + <mat-option *ngFor="let separatorTarget of separatorTargets" [value]="separatorTarget"> + {{lang[separatorTarget]}} + </mat-option> + </mat-select> + </mat-form-field> + </div> + <div class="col-md-8"> + <div id="jstree"></div> + </div> + + </div> + <div class="table-head"> + </div> + </div> + </div> + </mat-sidenav-content> + <mat-sidenav #snav2 [fixedInViewport]="mobileMode" position='end' [opened]="mobileMode || docUrl == '' ? false : true" + [mode]="mobileMode ? 'over' : 'side'" class="panel-right" style="overflow-x:hidden;" + [ngStyle]="{'width': mobileMode ? '80%' : '30%'}" autoFocus="false"> + <div class="example-loading-shade" *ngIf="loading"> + <mat-spinner></mat-spinner> + </div> + <div class="titlePanel"> + <span color="primary" style="flex:1;font-size: 20px;font-weight: bold;padding: 10px;">{{lang.separators}}</span> + <span> + <button mat-raised-button color="primary">{{lang.print}}</button> + </span> + </div> + <pdf-viewer class="viewSep" [src]="docUrl" [render-text]="false" [autoresize]="true" [original-size]="false" + [show-all]="true"></pdf-viewer> + </mat-sidenav> +</mat-sidenav-container> \ No newline at end of file diff --git a/src/frontend/app/separator/print-separator/print-separator.component.scss b/src/frontend/app/separator/print-separator/print-separator.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..40e7c4c1f167b701486fd9054e7064b5b3304f58 --- /dev/null +++ b/src/frontend/app/separator/print-separator/print-separator.component.scss @@ -0,0 +1,17 @@ +@import '../../../css/vars.scss'; + +.panel-right { + ::ng-deep.mat-drawer-inner-container { + display: flex; + flex-direction: column; + } + .titlePanel { + display:flex; + align-items: center; + } + .viewSep { + flex: 1; + display: flex; + overflow: auto; + } +} \ No newline at end of file diff --git a/src/frontend/app/separator/print-separator/print-separator.component.ts b/src/frontend/app/separator/print-separator/print-separator.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..ece37654ce99f0e8d25424a3c18c5f10de28f266 --- /dev/null +++ b/src/frontend/app/separator/print-separator/print-separator.component.ts @@ -0,0 +1,125 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { LANG } from '../../translate.component'; +import { HeaderService } from '../../../service/header.service'; +import { NotificationService } from '../../notification.service'; +import { MatSidenav } from '@angular/material'; + +declare function $j(selector: any): any; + + +@Component({ + templateUrl: "print-separator.component.html", + styleUrls: ['print-separator.component.scss'], +}) +export class PrintSeparatorComponent implements OnInit { + + lang: any = LANG; + entities: any[] = []; + entitiesChosen: any[] = []; + loading: boolean = false; + docUrl: string = ''; + separatorTypes: string [] = ['barcode', 'qrcode']; + separatorTargets: string [] = ['entities', 'generic']; + + separator: any = { + type : 'qrcode', + target: 'entities', + entities: [] + } + + @ViewChild('snav') sidenavLeft: MatSidenav; + @ViewChild('snav2') sidenavRight: MatSidenav; + + constructor(public http: HttpClient, private headerService: HeaderService) { + (<any>window).pdfWorkerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.min.js'; + } + + ngOnInit(): void { + + this.headerService.setHeader('Impression des séparateurs'); + + this.http.get("../../rest/entities") + .subscribe((data: any) => { + this.entities = data['entities']; + this.entities.forEach(entity => { + entity.state.disabled = false; + }); + this.loadEntities(); + + }, () => { + location.href = "index.php"; + }); + } + + loadEntities() { + + setTimeout(() => { + $j('#jstree').jstree({ + "checkbox": { + 'deselect_all': true, + "three_state": false //no cascade selection + }, + 'core': { + 'themes': { + 'name': 'proton', + 'responsive': true + }, + 'multiple': true, + 'data': this.entities, + }, + "plugins": ["checkbox", "search", "sort"] + }); + var to: any = false; + $j('#jstree_search').keyup(function () { + if (to) { clearTimeout(to); } + to = setTimeout(function () { + var v = $j('#jstree_search').val(); + $j('#jstree').jstree(true).search(v); + }, 250); + }); + $j('#jstree') + // listen for event + .on('select_node.jstree', (e: any, data: any) => { + this.generateSeparators(); + + }).on('deselect_node.jstree', (e: any, data: any) => { + this.generateSeparators(); + }) + // create the instance + .jstree(); + }, 0); + } + + generateSeparators() { + this.loading = true; + this.entitiesChosen = $j('#jstree').jstree(true).get_checked(); + + if (this.entitiesChosen.length > 0) { + this.docUrl = '../../rest/res/100/content'; + } else { + this.docUrl = ''; + } + } + + changeType(type: any) { + if (type.value == 'entities') { + this.docUrl = ''; + this.entities.forEach(entity => { + entity.state.disabled = false; + }); + $j('#jstree').jstree(true).settings.core.data = this.entities; + $j('#jstree').jstree('deselect_all'); + $j('#jstree').jstree("refresh"); + } else { + this.entities.forEach(entity => { + entity.state.disabled = true; + }); + $j('#jstree').jstree(true).settings.core.data = this.entities; + $j('#jstree').jstree('deselect_all'); + $j('#jstree').jstree("refresh"); + this.sidenavRight.open(); + this.generateSeparators(); + } + } +} diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index f1bd2a997c8c2a86f4ba40881e82a0e30e0d2923..68cc8e42f05031007938dc63472f88de0900c057 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -992,4 +992,11 @@ export const LANG_EN = { "workingDays" : "Working days", "yes" : "Yes", "zipcode" : "Zip code", + "printSeparatorInfo" : "You can print separators <b>by entity</b> or <b>generic</b> in order to use in <b>maarchCapture</b> to record scanned mails in right entity.", + "generic" : "Generic", + "qrcode" : "QR code", + "separatorType" : "Separator type", + "separatorTarget" : "Separator target", + "print" : "print", + "separators" : "Separator(s)", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index adc757cfa0d1f1208a1a8a0472f466afcedf48c6..ae75c016dcad3a7db4bd26d12f9361ff971bdf3f 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1025,4 +1025,11 @@ export const LANG_FR = { "workingDays" : "jour(s) ouvré(s)", "yes" : "Oui", "zipcode" : "Code postal", + "printSeparatorInfo" : "Vous pourrez imprimer les séparateurs <b>par service</b> ou <b>générique</b> afin de pouvoir les utiliser dans <b>maarchCapture</b> afin de verser les courriers numérisés dans les services adéquates.", + "generic" : "Générique", + "qrcode" : "QR code", + "separatorType" : "Type de séparateur", + "separatorTarget" : "Cible de séparateur", + "print" : "Imprimer", + "separators" : "Séparateur(s)", }; \ No newline at end of file diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 407d3736f115dfde7d5de7702294bb8cfebf015a..f7d9f1ffc18edeac7876fb9b2ce2aeb05eb8f14f 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1019,4 +1019,11 @@ export const LANG_NL = { "workingDays" : "werkdag(en)", "yes" : "Ja", "zipcode" : "Postcode", + "printSeparatorInfo" : "You can print separators <b>by entity</b> or <b>generic</b> in order to use in <b>maarchCapture</b> to record scanned mails in right entity.", //_TO_TRANSLATE + "generic" : "Generic", //_TO_TRANSLATE + "qrcode" : "QR code", //_TO_TRANSLATE + "separatorType" : "Separator type", //_TO_TRANSLATE + "separatorTarget" : "Separator target", //_TO_TRANSLATE + "print" : "print", //_TO_TRANSLATE + "separators" : "Separator(s)", //_TO_TRANSLATE };