- Remove ISBN from search
- Make description text area
This commit is contained in:
+4
-9
@@ -1,21 +1,16 @@
|
||||
<form *ngIf="!selectedFetchedMetadata" class="flex flex-col w-full h-full pt-2" [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<div class="flex w-full gap-x-4 items-end">
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<label for="provider">Providers</label>
|
||||
<div class="flex flex-col gap-1 w-3/12">
|
||||
<label>Providers</label>
|
||||
<p-multiselect id="provider" class="w-full" [filter]="false" showToggleAll="false" [options]="providers" formControlName="provider" placeholder="Select Providers"></p-multiselect>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<label for="isbn">ISBN</label>
|
||||
<input pInputText formControlName="isbn" id="isbn" class="w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 w-2/6">
|
||||
<div class="flex flex-col gap-1 w-5/12">
|
||||
<label for="title">Title</label>
|
||||
<input pInputText formControlName="title" id="title" class="w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 w-2/6">
|
||||
<div class="flex flex-col gap-1 w-4/12">
|
||||
<label for="author">Author</label>
|
||||
<input pInputText formControlName="author" id="author" class="w-full"/>
|
||||
</div>
|
||||
|
||||
+3
-7
@@ -36,7 +36,6 @@ export class MetadataSearcherComponent implements OnInit {
|
||||
constructor() {
|
||||
this.form = this.formBuilder.group({
|
||||
provider: null,
|
||||
isbn: [''],
|
||||
title: [''],
|
||||
author: [''],
|
||||
});
|
||||
@@ -48,19 +47,18 @@ export class MetadataSearcherComponent implements OnInit {
|
||||
this.bookId = metadata.bookId;
|
||||
this.form.patchValue(({
|
||||
provider: Object.values(MetadataProvider),
|
||||
isbn: metadata.isbn10 || null,
|
||||
title: metadata.title || null,
|
||||
author: metadata.authors?.length! > 0 ? metadata.authors[0] : ''
|
||||
}));
|
||||
}
|
||||
}));
|
||||
//this.onSubmit();
|
||||
this.onSubmit();
|
||||
}
|
||||
|
||||
get isSearchEnabled(): boolean {
|
||||
const providerSelected = !!this.form.get('provider')?.value;
|
||||
const isbnOrTitle = this.form.get('isbn')?.value || this.form.get('title')?.value;
|
||||
return providerSelected && isbnOrTitle;
|
||||
const title = this.form.get('title')?.value;
|
||||
return providerSelected && title;
|
||||
}
|
||||
|
||||
onSubmit(): void {
|
||||
@@ -69,14 +67,12 @@ export class MetadataSearcherComponent implements OnInit {
|
||||
(this.form.get('provider')?.value as string[]).includes(MetadataProvider[key as keyof typeof MetadataProvider])
|
||||
);
|
||||
if (!providerKeys) {
|
||||
console.error('Invalid provider selected.');
|
||||
return;
|
||||
}
|
||||
const fetchRequest: FetchMetadataRequest = {
|
||||
bookId: this.bookId,
|
||||
providers: providerKeys,
|
||||
title: this.form.get('title')?.value,
|
||||
isbn: this.form.get('isbn')?.value,
|
||||
author: this.form.get('author')?.value
|
||||
};
|
||||
this.loading = true;
|
||||
|
||||
Reference in New Issue
Block a user