mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Singular items dont need removal logic since dropdowns dont support this (yet?)
This commit is contained in:
		| @@ -179,7 +179,7 @@ export class DocumentListComponent implements OnInit { | |||||||
|         } else { |         } else { | ||||||
|           messageFragment += ' and ' |           messageFragment += ' and ' | ||||||
|         } |         } | ||||||
|         messageFragment += `remove the correspondent(s) ${changedTags.itemsToRemove.map(t => t.name).join(', ')} from` |         messageFragment += `remove the tag(s) ${changedTags.itemsToRemove.map(t => t.name).join(', ')} from` | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     modal.componentInstance.message = `This operation will ${messageFragment} all ${this.list.selected.size} selected document(s).` |     modal.componentInstance.message = `This operation will ${messageFragment} all ${this.list.selected.size} selected document(s).` | ||||||
| @@ -203,25 +203,17 @@ export class DocumentListComponent implements OnInit { | |||||||
|   bulkSetCorrespondents(changedCorrespondents: ChangedItems) { |   bulkSetCorrespondents(changedCorrespondents: ChangedItems) { | ||||||
|     let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) |     let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) | ||||||
|     modal.componentInstance.title = "Confirm Correspondent Assignment" |     modal.componentInstance.title = "Confirm Correspondent Assignment" | ||||||
|     let action = 'set_correspondent' |     let correspondent | ||||||
|     let correspondents |     let messageFragment = 'remove all correspondents from' | ||||||
|     let messageFragment |     if (changedCorrespondents && changedCorrespondents.itemsToAdd.length > 0) { | ||||||
|     if (!changedCorrespondents) { |       correspondent = changedCorrespondents.itemsToAdd[0] | ||||||
|       messageFragment = `remove all correspondents from` |       messageFragment = `assign the correspondent ${correspondent.name} to` | ||||||
|     } else if (changedCorrespondents.itemsToAdd.length > 0) { |  | ||||||
|       correspondents = changedCorrespondents.itemsToAdd[0] |  | ||||||
|       messageFragment = `assign the correspondent ${correspondents.name} to` |  | ||||||
|     } else { |  | ||||||
|       // TODO: API endpoint for remove multiple correspondents |  | ||||||
|       action = 'remove_correspondents' |  | ||||||
|       correspondents = changedCorrespondents.itemsToRemove |  | ||||||
|       messageFragment = `remove the correspondent(s) ${correspondents.map(c => c.name).join(', ')} from` |  | ||||||
|     } |     } | ||||||
|     modal.componentInstance.message = `This operation will ${messageFragment} all ${this.list.selected.size} selected document(s).` |     modal.componentInstance.message = `This operation will ${messageFragment} all ${this.list.selected.size} selected document(s).` | ||||||
|     modal.componentInstance.btnClass = "btn-warning" |     modal.componentInstance.btnClass = "btn-warning" | ||||||
|     modal.componentInstance.btnCaption = "Confirm" |     modal.componentInstance.btnCaption = "Confirm" | ||||||
|     modal.componentInstance.confirmClicked.subscribe(() => { |     modal.componentInstance.confirmClicked.subscribe(() => { | ||||||
|       this.executeBulkOperation(action, {"correspondents": correspondents ? correspondents.map(c => c.id) : null}).subscribe( |       this.executeBulkOperation('set_correspondent', {"correspondent": correspondent ? correspondent.id : null}).subscribe( | ||||||
|         response => { |         response => { | ||||||
|           modal.close() |           modal.close() | ||||||
|         } |         } | ||||||
| @@ -231,25 +223,18 @@ export class DocumentListComponent implements OnInit { | |||||||
|  |  | ||||||
|   bulkSetDocumentTypes(changedDocumentTypes: ChangedItems) { |   bulkSetDocumentTypes(changedDocumentTypes: ChangedItems) { | ||||||
|     let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) |     let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) | ||||||
|     let action = 'set_document_type' |     modal.componentInstance.title = "Confirm Document Type Assignment" | ||||||
|     let documentTypes |     let documentType | ||||||
|     let messageFragment |     let messageFragment = 'remove all document types from' | ||||||
|     if (!changedDocumentTypes) { |     if (changedDocumentTypes && changedDocumentTypes.itemsToAdd.length > 0) { | ||||||
|       messageFragment = `remove all document types from` |       documentType = changedDocumentTypes.itemsToAdd[0] | ||||||
|     } else if (changedDocumentTypes.itemsToAdd.length > 0) { |       messageFragment = `assign the document type ${documentType.name} to` | ||||||
|       documentTypes = changedDocumentTypes.itemsToAdd[0] |  | ||||||
|       messageFragment = `assign the document type ${documentTypes.name} to` |  | ||||||
|     } else { |  | ||||||
|       // TODO: API endpoint for remove multiple doc types |  | ||||||
|       action = 'remove_document_types' |  | ||||||
|       documentTypes = changedDocumentTypes.itemsToRemove |  | ||||||
|       messageFragment = `remove the document type(s) ${documentTypes.map(dt => dt.name).join(', ')} from` |  | ||||||
|     } |     } | ||||||
|     modal.componentInstance.message = `This operation will ${messageFragment} all ${this.list.selected.size} selected document(s).` |     modal.componentInstance.message = `This operation will ${messageFragment} all ${this.list.selected.size} selected document(s).` | ||||||
|     modal.componentInstance.btnClass = "btn-warning" |     modal.componentInstance.btnClass = "btn-warning" | ||||||
|     modal.componentInstance.btnCaption = "Confirm" |     modal.componentInstance.btnCaption = "Confirm" | ||||||
|     modal.componentInstance.confirmClicked.subscribe(() => { |     modal.componentInstance.confirmClicked.subscribe(() => { | ||||||
|       this.executeBulkOperation(action, {"document_types": documentTypes ? documentTypes.map(dt => dt.id) : null}).subscribe( |       this.executeBulkOperation('set_document_type', {"document_type": documentType ? documentType.id : null}).subscribe( | ||||||
|         response => { |         response => { | ||||||
|           modal.close() |           modal.close() | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon