-<eg-staff-banner bannerText="Load MARC Order Records" i18n-bannerText>
+<eg-staff-banner bannerText="Load MARC Order Records" i18n-bannerText *ngIf="mode !== 'getImportParams'">
</eg-staff-banner>
-<div class="row">
+<div class="row" *ngIf="mode !== 'getImportParams'">
<div class="ml-auto mr-3"><a i18n href="/eg/staff/acq/legacy/picklist/upload">Legacy Upload Interface</a></div>
</div>
<div class="common-form striped-odd form-validated ml-3 mr-3">
<div class="row">
<div class="col-lg-3">
- <label for="template-select" i18n>Apply/Create Form Template</label>
+ <label for="template-select" i18n *ngIf="mode !== 'getImportParams'">Apply/Create Form Template</label>
+ <label for="template-select" i18n *ngIf="mode === 'getImportParams'">Apply Form Template</label>
</div>
<div class="col-lg-3">
<eg-combobox #formTemplateSelector
[entries]="formatTemplateEntries()">
</eg-combobox>
</div>
- <div class="col-lg-6">
+ <div class="col-lg-6" *ngIf="mode !== 'getImportParams'">
<button class="btn btn-success"
[disabled]="!selectedTemplate"
(click)="saveTemplate()" i18n>Save As New Template</button>
</div>
</div>
+ <ng-container *ngIf="mode !== 'getImportParams'">
<h2>Purchase Order</h2>
<div class="row">
<div class="col-lg-3">
</eg-combobox>
</div>
</div>
+ </ng-container> <!-- purchase order section -->
-
- <h2>Upload Settings</h2>
+ <h2 *ngIf="mode !== 'getImportParams'">Upload Settings</h2>
<div class="row">
<div class="col-lg-3">
<input type="number" step="0.1" id="min-quality-ratio"
class="form-control" [(ngModel)]="minQualityRatio">
</div>
+ <ng-container *ngIf="mode !== 'getImportParams'">
<div class="col-lg-3">
<label for="load-items" i18n>Load Items for Imported Records</label>
</div>
id="load-items"
[(ngModel)]="loadItems">
</div>
+ </ng-container>
</div>
- <h2>This Upload</h2>
+ <h2 *ngIf="mode !== 'getImportParams'">This Upload</h2>
<div class="row">
<div class="col-lg-3">
<label for="queue-select" i18n>Select or Create a Queue</label>
</eg-combobox>
</div>
</div>
- <div class="row" *ngIf="!importSelection()">
+ <div class="row" *ngIf="!importSelection() && mode !== 'getImportParams'">
<div class="col-lg-3">
<label for="upload-file" i18n>File to Upload:</label>
</div>
</button>
</div>
</div>
- <div class="row">
+ <div class="row" *ngIf="mode !== 'getImportParams'">
<div class="col-lg-6 offset-lg-3">
<button class="btn btn-success btn-lg btn-block font-weight-bold"
[disabled]="isUploading || !hasNeededData()"
(click)="upload()" i18n>Upload</button>
</div>
</div>
+ <div class="row" *ngIf="mode === 'getImportParams'">
+ <div class="col-lg-6 offset-lg-3">
+ <button class="btn btn-success btn-lg btn-block font-weight-bold"
+ [disabled]="customActionProcessing || !hasNeededData()"
+ (click)="performCustomAction()" i18n>Load Bibs and Items</button>
+ </div>
+ </div>
<div class="row" [hidden]="!showProgress || uploadComplete">
<div class="col-lg-3">
<label i18n>Upload File to Server</label>
@Component({
+ selector: 'eg-acq-upload',
templateUrl: './upload.component.html'
})
export class UploadComponent implements OnInit, AfterViewInit, OnDestroy {
+ // mode can be one of
+ // upload: actually upload and process a MARC order file
+ // getImportParams: gather import parameters to use when creating
+ // assets for a purchase order; the invoker
+ // would do the actual asset creation
+ @Input() mode = 'upload';
+
+ @Input() customAction: (args: any) => void;
+ customActionProcessing = false;
+
settings: Object = {};
recordType: string;
selectedQueue: ComboboxEntry;
}
hasNeededData(): boolean {
+ if (this.mode === 'getImportParams') {
+ return this.selectedQueue ? true : false;
+ }
return this.selectedQueue &&
Boolean(this.selectedFile) &&
Boolean(this.selectedFiscalYear) &&
);
}
+ performCustomAction() {
+
+ const vandelayOptions = {
+ import_no_match: this.importNonMatching,
+ auto_overlay_exact: this.mergeOnExact,
+ auto_overlay_best_match: this.mergeOnBestMatch,
+ auto_overlay_1match: this.mergeOnSingleMatch,
+ merge_profile: this.selectedMergeProfile,
+ fall_through_merge_profile: this.selectedFallThruMergeProfile,
+ match_quality_ratio: this.minQualityRatio,
+ bib_source: this.selectedBibSource,
+ create_assets: this.loadItems,
+ queue_name: this.selectedQueue.label
+ };
+
+ const args = {
+ provider: this.selectedProvider,
+ ordering_agency: this.orderingAgency,
+ create_po: this.createPurchaseOrder,
+ activate_po: this.activatePurchaseOrder,
+ fiscal_year: this.selectedFiscalYear,
+ picklist: this.activeSelectionListId,
+ vandelay: vandelayOptions
+ };
+
+ this.customActionProcessing = true;
+ this.customAction(args);
+ }
+
resetProgressBars() {
this.uploadProgress.update({value: 0, max: 1});
}