mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-31 10:37:12 -04:00 
			
		
		
		
	Merge pull request #157 from shamoon/fix/issue-150
Add page number to document toolbar
This commit is contained in:
		
						commit
						86f83f2bc4
					
				| @ -1,4 +1,14 @@ | |||||||
| <app-page-header [(title)]="title"> | <app-page-header [(title)]="title"> | ||||||
|  |     <div class="input-group input-group-sm mr-5" *ngIf="getContentType() == 'application/pdf'"> | ||||||
|  |       <div class="input-group-prepend"> | ||||||
|  |         <div class="input-group-text">Page </div> | ||||||
|  |       </div> | ||||||
|  |       <input class="form-control flex-grow-0 w-auto" type="number" min="1" [max]="previewNumPages" [(ngModel)]="previewCurrentPage" /> | ||||||
|  |       <div class="input-group-append"> | ||||||
|  |         <div class="input-group-text">of {{previewNumPages}}</div> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
|     <button type="button" class="btn btn-sm btn-outline-danger mr-2" (click)="delete()"> |     <button type="button" class="btn btn-sm btn-outline-danger mr-2" (click)="delete()"> | ||||||
|         <svg class="buttonicon" fill="currentColor"> |         <svg class="buttonicon" fill="currentColor"> | ||||||
|             <use xlink:href="assets/bootstrap-icons.svg#trash" /> |             <use xlink:href="assets/bootstrap-icons.svg#trash" /> | ||||||
| @ -128,7 +138,7 @@ | |||||||
| 
 | 
 | ||||||
|     <div class="col-md-6 col-xl-8 mb-3"> |     <div class="col-md-6 col-xl-8 mb-3"> | ||||||
|       <div class="pdf-viewer-container" *ngIf="getContentType() == 'application/pdf'"> |       <div class="pdf-viewer-container" *ngIf="getContentType() == 'application/pdf'"> | ||||||
|         <pdf-viewer [src]="previewUrl" [original-size]="false" [show-borders]="true"></pdf-viewer> |         <pdf-viewer [src]="previewUrl" [original-size]="false" [show-borders]="true" [show-all]="true" [(page)]="previewCurrentPage" (after-load-complete)="pdfPreviewLoaded($event)"></pdf-viewer> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
| </div> | </div> | ||||||
|  | |||||||
| @ -15,6 +15,7 @@ import { DocumentService } from 'src/app/services/rest/document.service'; | |||||||
| import { ConfirmDialogComponent } from '../common/confirm-dialog/confirm-dialog.component'; | import { ConfirmDialogComponent } from '../common/confirm-dialog/confirm-dialog.component'; | ||||||
| import { CorrespondentEditDialogComponent } from '../manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component'; | import { CorrespondentEditDialogComponent } from '../manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component'; | ||||||
| import { DocumentTypeEditDialogComponent } from '../manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component'; | import { DocumentTypeEditDialogComponent } from '../manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component'; | ||||||
|  | import { PDFDocumentProxy } from 'ng2-pdf-viewer'; | ||||||
| 
 | 
 | ||||||
| @Component({ | @Component({ | ||||||
|   selector: 'app-document-detail', |   selector: 'app-document-detail', | ||||||
| @ -47,8 +48,11 @@ export class DocumentDetailComponent implements OnInit { | |||||||
|     tags: new FormControl([]) |     tags: new FormControl([]) | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|  |   previewCurrentPage: number = 1 | ||||||
|  |   previewNumPages: number | ||||||
|  | 
 | ||||||
|   constructor( |   constructor( | ||||||
|     private documentsService: DocumentService,  |     private documentsService: DocumentService, | ||||||
|     private route: ActivatedRoute, |     private route: ActivatedRoute, | ||||||
|     private correspondentService: CorrespondentService, |     private correspondentService: CorrespondentService, | ||||||
|     private documentTypeService: DocumentTypeService, |     private documentTypeService: DocumentTypeService, | ||||||
| @ -126,7 +130,7 @@ export class DocumentDetailComponent implements OnInit { | |||||||
|     }, error => {this.router.navigate(['404'])}) |     }, error => {this.router.navigate(['404'])}) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   save() {     |   save() { | ||||||
|     this.documentsService.update(this.document).subscribe(result => { |     this.documentsService.update(this.document).subscribe(result => { | ||||||
|       this.close() |       this.close() | ||||||
|     }) |     }) | ||||||
| @ -161,7 +165,7 @@ export class DocumentDetailComponent implements OnInit { | |||||||
|     modal.componentInstance.btnCaption = "Delete document" |     modal.componentInstance.btnCaption = "Delete document" | ||||||
|     modal.componentInstance.confirmClicked.subscribe(() => { |     modal.componentInstance.confirmClicked.subscribe(() => { | ||||||
|       this.documentsService.delete(this.document).subscribe(() => { |       this.documentsService.delete(this.document).subscribe(() => { | ||||||
|         modal.close()   |         modal.close() | ||||||
|         this.close() |         this.close() | ||||||
|       }) |       }) | ||||||
|     }) |     }) | ||||||
| @ -171,4 +175,9 @@ export class DocumentDetailComponent implements OnInit { | |||||||
|   hasNext() { |   hasNext() { | ||||||
|     return this.documentListViewService.hasNext(this.documentId) |     return this.documentListViewService.hasNext(this.documentId) | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|  |   pdfPreviewLoaded(pdf: PDFDocumentProxy) { | ||||||
|  |     this.previewNumPages = pdf.numPages | ||||||
|  |   } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user