mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
@@ -3,19 +3,19 @@
|
||||
<svg class="buttonicon" fill="currentColor">
|
||||
<use xlink:href="assets/bootstrap-icons.svg#trash" />
|
||||
</svg>
|
||||
Delete
|
||||
<span class="d-none d-lg-inline">Delete</span>
|
||||
</button>
|
||||
<a [href]="downloadUrl" class="btn btn-sm btn-outline-secondary mr-2">
|
||||
<svg class="buttonicon" fill="currentColor">
|
||||
<use xlink:href="assets/bootstrap-icons.svg#download" />
|
||||
</svg>
|
||||
Download
|
||||
<span class="d-none d-lg-inline">Download</span>
|
||||
</a>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" (click)="close()">
|
||||
<svg class="buttonicon" fill="currentColor">
|
||||
<use xlink:href="assets/bootstrap-icons.svg#x" />
|
||||
</svg>
|
||||
Close
|
||||
<span class="d-none d-lg-inline">Close</span>
|
||||
</button>
|
||||
</app-page-header>
|
||||
|
||||
@@ -43,26 +43,9 @@
|
||||
|
||||
<app-input-select [items]="documentTypes" title="Document type" formControlName="document_type_id" allowNull="true" (createNew)="createDocumentType()"></app-input-select>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="exampleFormControlTextarea1">Tags</label>
|
||||
<app-input-tags formControlName="tags_id" title="Tags"></app-input-tags>
|
||||
|
||||
<div class="input-group">
|
||||
<select multiple class="form-control" id="tags" formControlName="tags_id">
|
||||
<option *ngFor="let t of tags" [ngValue]="t.id">{{t.name}}</option>
|
||||
</select>
|
||||
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary" type="button" (click)="createTag()">
|
||||
<svg class="buttonicon" fill="currentColor">
|
||||
<use xlink:href="assets/bootstrap-icons.svg#plus" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<small class="form-text text-muted">Hold CTRL to (de)select multiple tags.</small>
|
||||
|
||||
</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>
|
||||
|
@@ -33,7 +33,6 @@ export class DocumentDetailComponent implements OnInit {
|
||||
|
||||
correspondents: PaperlessCorrespondent[]
|
||||
documentTypes: PaperlessDocumentType[]
|
||||
tags: PaperlessTag[]
|
||||
|
||||
documentForm: FormGroup = new FormGroup({
|
||||
title: new FormControl(''),
|
||||
@@ -50,7 +49,6 @@ export class DocumentDetailComponent implements OnInit {
|
||||
private route: ActivatedRoute,
|
||||
private correspondentService: CorrespondentService,
|
||||
private documentTypeService: DocumentTypeService,
|
||||
private tagService: TagService,
|
||||
private datePipe: DatePipe,
|
||||
private router: Router,
|
||||
private modalService: NgbModal,
|
||||
@@ -64,7 +62,6 @@ export class DocumentDetailComponent implements OnInit {
|
||||
|
||||
this.correspondentService.list(1,100000).subscribe(result => this.correspondents = result.results)
|
||||
this.documentTypeService.list(1,100000).subscribe(result => this.documentTypes = result.results)
|
||||
this.tagService.list(1,100000).subscribe(result => this.tags = result.results)
|
||||
|
||||
this.route.paramMap.subscribe(paramMap => {
|
||||
this.documentId = +paramMap.get('id')
|
||||
@@ -88,17 +85,6 @@ export class DocumentDetailComponent implements OnInit {
|
||||
this.documentForm.patchValue(doc)
|
||||
}
|
||||
|
||||
createTag() {
|
||||
var modal = this.modalService.open(TagEditDialogComponent, {backdrop: 'static'})
|
||||
modal.componentInstance.dialogMode = 'create'
|
||||
modal.componentInstance.success.subscribe(newTag => {
|
||||
this.tagService.list().subscribe(tags => {
|
||||
this.tags = tags.results
|
||||
this.documentForm.get('tags_id').setValue(this.documentForm.get('tags_id').value.concat([newTag.id]))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
createDocumentType() {
|
||||
var modal = this.modalService.open(DocumentTypeEditDialogComponent, {backdrop: 'static'})
|
||||
modal.componentInstance.dialogMode = 'create'
|
||||
@@ -121,28 +107,14 @@ export class DocumentDetailComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
getTag(id: number): PaperlessTag {
|
||||
return this.tags.find(tag => tag.id == id)
|
||||
discard() {
|
||||
this.documentsService.get(this.documentId).subscribe(doc => {
|
||||
Object.assign(this.document, doc)
|
||||
this.title = doc.title
|
||||
this.documentForm.patchValue(doc)
|
||||
}, error => {this.router.navigate(['404'])})
|
||||
}
|
||||
|
||||
getColour(id: number) {
|
||||
return TAG_COLOURS.find(c => c.id == this.getTag(id).colour)
|
||||
}
|
||||
|
||||
addTag(id: number) {
|
||||
if (this.documentForm.value.tags.indexOf(id) == -1) {
|
||||
this.documentForm.value.tags.push(id)
|
||||
}
|
||||
}
|
||||
|
||||
removeTag(id: number) {
|
||||
let index = this.documentForm.value.tags.indexOf(id)
|
||||
if (index > -1) {
|
||||
this.documentForm.value.tags.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
save() {
|
||||
this.documentsService.update(this.document).subscribe(result => {
|
||||
this.close()
|
||||
|
Reference in New Issue
Block a user