A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Support passing current term from input-select search to create dialog e.g. for doc type / correspondent
Michael Shamoon52bc1a62e152
diff --git a/src-ui/src/app/components/common/input/select/select.component.html b/src-ui/src/app/components/common/input/select/select.component.htmlindex 540429e89..59d0f9ca3 100644--- a/src-ui/src/app/components/common/input/select/select.component.html+++ b/src-ui/src/app/components/common/input/select/select.component.html@@ -10,11 +10,12 @@bindLabel="name"bindValue="id"(change)="onChange(value)"- (blur)="onTouched()">+ (search)="onSearch($event)"+ (focus)="onFocus()"></ng-select><div *ngIf="showPlusButton()" class="input-group-append">- <button class="btn btn-outline-secondary" type="button" (click)="createNew.emit()">+ <button class="btn btn-outline-secondary" type="button" (click)="clickNew()"><svg class="buttonicon" fill="currentColor"><use xlink:href="assets/bootstrap-icons.svg#plus" /></svg>@@ -27,7 +28,7 @@<ng-container *ngFor="let s of getSuggestions()"><a (click)="value = s.id; onChange(value)" [routerLink]="">{{s.name}}</a> </ng-container>--++</small></div>diff --git a/src-ui/src/app/components/common/input/select/select.component.ts b/src-ui/src/app/components/common/input/select/select.component.tsindex e02aaab72..6eaf7795f 100644--- a/src-ui/src/app/components/common/input/select/select.component.ts+++ b/src-ui/src/app/components/common/input/select/select.component.ts@@ -34,7 +34,9 @@ export class SelectComponent extends AbstractInputComponent<number> {suggestions: number[]@Output()- createNew = new EventEmitter()+ createNew = new EventEmitter<string>()++ private _lastSearchTerm: stringshowPlusButton(): boolean {return this.createNew.observers.length > 0@@ -48,4 +50,17 @@ export class SelectComponent extends AbstractInputComponent<number> {}}+ clickNew() {+ this.createNew.next(this._lastSearchTerm)+ this._lastSearchTerm = null+ }++ onFocus() {+ this._lastSearchTerm = null+ }++ onSearch($event) {+ this._lastSearchTerm = $event.term+ }+}diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.htmlindex f9b87aee3..1286225fb 100644--- a/src-ui/src/app/components/document-detail/document-detail.component.html+++ b/src-ui/src/app/components/document-detail/document-detail.component.html@@ -60,9 +60,9 @@<app-input-number i18n-title title="Archive serial number" [error]="error?.archive_serial_number" formControlName='archive_serial_number'></app-input-number><app-input-date i18n-title title="Date created" formControlName="created" [error]="error?.created"></app-input-date><app-input-select [items]="correspondents" i18n-title title="Correspondent" formControlName="correspondent" [allowNull]="true"- (createNew)="createCorrespondent()" [suggestions]="suggestions?.correspondents"></app-input-select>+ (createNew)="createCorrespondent($event)" [suggestions]="suggestions?.correspondents"></app-input-select><app-input-select [items]="documentTypes" i18n-title title="Document type" formControlName="document_type" [allowNull]="true"- (createNew)="createDocumentType()" [suggestions]="suggestions?.document_types"></app-input-select>+ (createNew)="createDocumentType($event)" [suggestions]="suggestions?.document_types"></app-input-select><app-input-tags formControlName="tags" [suggestions]="suggestions?.tags"></app-input-tags></ng-template>diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.tsindex af98a6f7f..7dd5dd80d 100644--- a/src-ui/src/app/components/document-detail/document-detail.component.ts+++ b/src-ui/src/app/components/document-detail/document-detail.component.ts@@ -127,9 +127,10 @@ export class DocumentDetailComponent implements OnInit {this.documentForm.patchValue(doc)}- createDocumentType() {+ createDocumentType(newName: string) {var modal = this.modalService.open(DocumentTypeEditDialogComponent, {backdrop: 'static'})modal.componentInstance.dialogMode = 'create'+ if (newName) modal.componentInstance.object = { name: newName }modal.componentInstance.success.subscribe(newDocumentType => {this.documentTypeService.listAll().subscribe(documentTypes => {this.documentTypes = documentTypes.results@@ -138,9 +139,10 @@ export class DocumentDetailComponent implements OnInit {})}- createCorrespondent() {+ createCorrespondent(newName: string) {var modal = this.modalService.open(CorrespondentEditDialogComponent, {backdrop: 'static'})modal.componentInstance.dialogMode = 'create'+ if (newName) modal.componentInstance.object = { name: newName }modal.componentInstance.success.subscribe(newCorrespondent => {this.correspondentService.listAll().subscribe(correspondents => {this.correspondents = correspondents.results