mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Addresses #99 entirely.
This commit is contained in:
		| @@ -46,6 +46,7 @@ import { StatisticsWidgetComponent } from './components/dashboard/widgets/statis | ||||
| import { UploadFileWidgetComponent } from './components/dashboard/widgets/upload-file-widget/upload-file-widget.component'; | ||||
| import { WidgetFrameComponent } from './components/dashboard/widgets/widget-frame/widget-frame.component'; | ||||
| import { WelcomeWidgetComponent } from './components/dashboard/widgets/welcome-widget/welcome-widget.component'; | ||||
| import { YesNoPipe } from './pipes/yes-no.pipe'; | ||||
|  | ||||
| @NgModule({ | ||||
|   declarations: [ | ||||
| @@ -84,7 +85,8 @@ import { WelcomeWidgetComponent } from './components/dashboard/widgets/welcome-w | ||||
|     StatisticsWidgetComponent, | ||||
|     UploadFileWidgetComponent, | ||||
|     WidgetFrameComponent, | ||||
|     WelcomeWidgetComponent | ||||
|     WelcomeWidgetComponent, | ||||
|     YesNoPipe | ||||
|   ], | ||||
|   imports: [ | ||||
|     BrowserModule, | ||||
|   | ||||
| @@ -3,11 +3,10 @@ | ||||
|       <label for="created_date">{{titleDate}}</label> | ||||
|       <input type="date" class="form-control" id="created_date" [(ngModel)]="dateValue" (change)="dateOrTimeChanged()"> | ||||
|   </div> | ||||
|   <div class="form-group col"> | ||||
|   <div class="form-group col" *ngIf="titleTime"> | ||||
|       <label for="created_time">{{titleTime}}</label> | ||||
|       <input type="time" class="form-control" id="created_time" [(ngModel)]="timeValue" (change)="dateOrTimeChanged()"> | ||||
|   </div> | ||||
|  | ||||
| </div> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -40,7 +40,7 @@ export class DateTimeComponent implements OnInit,ControlValueAccessor  { | ||||
|   titleDate: string = "Date" | ||||
|  | ||||
|   @Input() | ||||
|   titleTime: string = "Time" | ||||
|   titleTime: string | ||||
|  | ||||
|   @Input() | ||||
|   disabled: boolean = false | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import { Component, forwardRef, Input, OnInit } from '@angular/core'; | ||||
| import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; | ||||
| import { v4 as uuidv4 } from 'uuid'; | ||||
| import { Component, forwardRef } from '@angular/core'; | ||||
| import { NG_VALUE_ACCESSOR } from '@angular/forms'; | ||||
| import { AbstractInputComponent } from '../abstract-input'; | ||||
|  | ||||
| @Component({ | ||||
|   | ||||
| @@ -36,36 +36,83 @@ | ||||
|  | ||||
| <div class="row"> | ||||
|     <div class="col-xl"> | ||||
|  | ||||
|         <form [formGroup]='documentForm' (ngSubmit)="save()"> | ||||
|  | ||||
|             <app-input-text title="Title" formControlName="title"></app-input-text> | ||||
|             <ul ngbNav #nav="ngbNav" class="nav-tabs"> | ||||
|                 <li [ngbNavItem]="1"> | ||||
|                     <a ngbNavLink>Details</a> | ||||
|                     <ng-template ngbNavContent> | ||||
|  | ||||
|                         <app-input-text title="Title" formControlName="title"></app-input-text> | ||||
|                         <div class="form-group"> | ||||
|                             <label for="archive_serial_number">Archive Serial Number</label> | ||||
|                             <input type="number" class="form-control" id="archive_serial_number" | ||||
|                                 formControlName='archive_serial_number'> | ||||
|                         </div> | ||||
|  | ||||
|             <app-input-date-time title="Date created" titleTime="Time created" formControlName="created"></app-input-date-time> | ||||
|  | ||||
|             <div class="form-group"> | ||||
|                 <label for="content">Content</label> | ||||
|                 <textarea class="form-control" id="content" rows="5" formControlName='content'></textarea> | ||||
|             </div> | ||||
|  | ||||
|             <app-input-select [items]="correspondents" title="Correspondent" formControlName="correspondent" allowNull="true" (createNew)="createCorrespondent()"></app-input-select> | ||||
|  | ||||
|             <app-input-select [items]="documentTypes" title="Document type" formControlName="document_type" allowNull="true" (createNew)="createDocumentType()"></app-input-select> | ||||
|  | ||||
|                         <app-input-date-time titleDate="Date created" formControlName="created"></app-input-date-time> | ||||
|                         <app-input-select [items]="correspondents" title="Correspondent" formControlName="correspondent" | ||||
|                             allowNull="true" (createNew)="createCorrespondent()"></app-input-select> | ||||
|                         <app-input-select [items]="documentTypes" title="Document type" formControlName="document_type" | ||||
|                             allowNull="true" (createNew)="createDocumentType()"></app-input-select> | ||||
|                         <app-input-tags formControlName="tags" title="Tags"></app-input-tags> | ||||
|  | ||||
|                     </ng-template> | ||||
|                 </li> | ||||
|  | ||||
|                 <li [ngbNavItem]="2"> | ||||
|                     <a ngbNavLink>Content</a> | ||||
|                     <ng-template ngbNavContent> | ||||
|                         <div class="form-group"> | ||||
|                             <textarea class="form-control" id="content" rows="20" formControlName='content'></textarea> | ||||
|                         </div> | ||||
|                     </ng-template> | ||||
|                 </li> | ||||
|  | ||||
|                 <li [ngbNavItem]="3"> | ||||
|                     <a ngbNavLink>Metadata</a> | ||||
|                     <ng-template ngbNavContent> | ||||
|                         <table class="table table-borderless"> | ||||
|                             <tbody> | ||||
|                                 <tr> | ||||
|                                     <td>Date modified</td> | ||||
|                                     <td>{{document.modified | date}}</td> | ||||
|                                 </tr> | ||||
|                                 <tr> | ||||
|                                     <td>Date added</td> | ||||
|                                     <td>{{document.added | date}}</td> | ||||
|                                 </tr> | ||||
|                                 <tr> | ||||
|                                     <td>MD5 Checksum</td> | ||||
|                                     <td>{{metadata?.paperless__checksum}}</td> | ||||
|                                 </tr> | ||||
|                                 <tr> | ||||
|                                     <td>Original mime type</td> | ||||
|                                     <td>{{metadata?.paperless__mime_type}}</td> | ||||
|                                 </tr> | ||||
|                                 <tr> | ||||
|                                     <td>Is archived?</td> | ||||
|                                     <td>{{metadata?.paperless__has_archive_version | yesno}}</td> | ||||
|                                 </tr> | ||||
|                                 <tr> | ||||
|                                     <td>Media filename</td> | ||||
|                                     <td>{{metadata?.paperless__filename}}</td> | ||||
|                                 </tr> | ||||
|                             </tbody> | ||||
|                         </table> | ||||
|                     </ng-template> | ||||
|                 </li> | ||||
|             </ul> | ||||
|  | ||||
|             <div [ngbNavOutlet]="nav" class="mt-2"></div> | ||||
|  | ||||
|             <button type="button" class="btn btn-outline-secondary" (click)="discard()">Discard</button>  | ||||
|             <button type="button" class="btn btn-outline-primary" (click)="saveEditNext()" *ngIf="hasNext()">Save & edit next</button>  | ||||
|             <button type="submit" class="btn btn-primary">Save</button>  | ||||
|         </form> | ||||
|     </div> | ||||
|  | ||||
|     <div class="col-xl"> | ||||
|     <div class="col-xl d-none d-xl-block document-preview sticky-top"> | ||||
|         <object [data]="previewUrl | safe" type="application/pdf" width="100%" height="100%"> | ||||
|             <p>Your browser does not support PDFs. | ||||
|                 <a href="previewUrl">Download the PDF</a>.</p> | ||||
|   | ||||
| @@ -0,0 +1,4 @@ | ||||
| .document-preview { | ||||
|   height: calc(100vh - 180px); | ||||
|   top: 70px | ||||
| } | ||||
| @@ -46,8 +46,8 @@ | ||||
|           <tbody> | ||||
|             <tr *ngFor="let config of savedViewConfigService.getConfigs()"> | ||||
|               <td>{{ config.title }}</td> | ||||
|               <td>{{ config.showInDashboard }}</td> | ||||
|               <td>{{ config.showInSideBar }}</td> | ||||
|               <td>{{ config.showInDashboard | yesno }}</td> | ||||
|               <td>{{ config.showInSideBar | yesno }}</td> | ||||
|               <td><button type="button" class="btn btn-sm btn-outline-danger" (click)="deleteViewConfig(config)">Delete</button></td> | ||||
|             </tr> | ||||
|           </tbody> | ||||
|   | ||||
							
								
								
									
										8
									
								
								src-ui/src/app/pipes/yes-no.pipe.spec.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src-ui/src/app/pipes/yes-no.pipe.spec.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| import { YesNoPipe } from './yes-no.pipe'; | ||||
|  | ||||
| describe('YesNoPipe', () => { | ||||
|   it('create an instance', () => { | ||||
|     const pipe = new YesNoPipe(); | ||||
|     expect(pipe).toBeTruthy(); | ||||
|   }); | ||||
| }); | ||||
							
								
								
									
										12
									
								
								src-ui/src/app/pipes/yes-no.pipe.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src-ui/src/app/pipes/yes-no.pipe.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| import { Pipe, PipeTransform } from '@angular/core'; | ||||
|  | ||||
| @Pipe({ | ||||
|   name: 'yesno' | ||||
| }) | ||||
| export class YesNoPipe implements PipeTransform { | ||||
|  | ||||
|   transform(value: boolean): unknown { | ||||
|     return value ? "Yes" : "No" | ||||
|   } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler