WIP: provider search/result stub and required IDL change
authorMike Rylander <mrylander@gmail.com>
Thu, 5 Mar 2020 20:32:48 +0000 (15:32 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 6 Mar 2020 15:42:42 +0000 (10:42 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.css [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.module.ts
Open-ILS/src/eg2/src/app/staff/acq/provider/provider-results.component.html [new file with mode: 0644]

index 56bc477..7f96239 100644 (file)
@@ -8748,12 +8748,14 @@ SELECT  usr,
                        <field reporter:label="Fax Phone" name="fax_phone" reporter:datatype="text" />
                        <field reporter:label="Default Claim Policy" name="default_claim_policy" reporter:datatype="link" />
                        <field reporter:label="Default # Copies" name="default_copy_count" reporter:datatype="int" />
+                       <field reporter:label="Contacts" name="contacts" oils_persist:virtual="true" reporter:datatype="link" />
                        <field reporter:label="Notes" name="provider_notes" oils_persist:virtual="true" reporter:datatype="link" />
                </fields>
                <links>
                        <link field="currency_type" reltype="has_a" key="code" map="" class="acqct"/>
                        <link field="owner" reltype="has_a" key="id" map="" class="aou"/>
             <link field="addresses" reltype="has_many" map="" key="provider" class="acqpa"/>
+            <link field="contacts" reltype="has_many" map="" key="provider" class="acqpc"/>
             <link field="edi_default" reltype="has_a" map="" key="id" class="acqedi"/>
                        <link field="default_claim_policy" reltype="has_a" map="" key="id" class="acqclp"/>
                        <link field="provider_notes" reltype="has_many" map="" key="provider" class="acqpron"/>
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.css b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.css
new file mode 100644 (file)
index 0000000..435a067
--- /dev/null
@@ -0,0 +1,5 @@
+#acq-provider-search-form {
+  border-radius: 0px 0px 7px 7px;
+  background-color: rgb(247, 247, 247);
+  box-shadow: 1px 2px 3px -1px rgba(0, 0, 0, .2);
+}
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.html b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.html
new file mode 100644 (file)
index 0000000..3ef2995
--- /dev/null
@@ -0,0 +1,53 @@
+<div id="acq-provider-search-form" class="pl-3 pr-3 pt-3 pb-3 mb-3">
+<form>
+  <div class="row mb-1">
+    <div class="col-lg-2">
+      <input i18n-placeholder placeholder="Provider Name" [(ngModel)]="providerName" type="text" class="form-control" />
+    </div>
+    <div class="col-lg-2">
+      <input i18n-placeholder placeholder="Code" [(ngModel)]="providerCode" type="text" class="form-control" />
+    </div>
+    <div class="col-lg-2">
+      <eg-org-family-select i18n-labelText labelText="Owning Library" ngModel #providerOwners="ngModel"></eg-org-family-select>
+    </div>
+    <div class="col-lg-2">
+      <button class="btn btn-primary" (click)="submitSearch()" type="submit" i18n>Search</button>
+    </div>
+    <div class="col-lg-2">
+      <button class="btn btn-default" (click)="clearSearch()" type="button" i18n>Clear Form</button>
+    </div>
+  </div>
+
+  <div class="row mb-1">
+    <div class="col-lg-2">
+      <input i18n-placeholder placeholder="Contact Name" [(ngModel)]="contactName" type="text" class="form-control" />
+    </div>
+    <div class="col-lg-2">
+      <input i18n-placeholder placeholder="Provider Email" [(ngModel)]="providerEmail" type="text" class="form-control" />
+    </div>
+    <div class="col-lg-2">
+      <input i18n-placeholder placeholder="Provider Phone" [(ngModel)]="providerPhone" type="text" class="form-control" />
+    </div>
+    <div class="col-lg-2">
+      <eg-combobox idlClass="acqct" (onChange)="providerCurrencyType = $event ? $event.code : null"></eg-combobox>
+    </div>
+  </div>
+
+  <div class="row mb-1">
+    <div class="col-lg-2">
+      <input i18n-placeholder placeholder="SAN" [(ngModel)]="providerSAN" type="text" class="form-control" />
+    </div>
+    <div class="col-lg-2">
+      <!-- edi default account link -->
+      <eg-combobox idlClass="acqedi" (onChange)="providerEDIDefault = $event ? $event.id : null"></eg-combobox>
+    </div>
+    <div class="col-lg-2">
+      <input i18n-placeholder placeholder="URL" [(ngModel)]="providerURL" type="text" class="form-control" />
+    </div>
+    <div class="col-lg-2">
+      <input class="form-check-input" type="checkbox" id="acqproIsActive" [(ngModel)]="providerActive"/>
+      <label for="acqproIsActive" class="form-check-label" i18n>Active?</label>
+    </div>
+  </div>
+</form>
+</div>
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.ts
new file mode 100644 (file)
index 0000000..66648f7
--- /dev/null
@@ -0,0 +1,76 @@
+import {Component, OnInit, AfterViewInit, Input, Output, EventEmitter, ViewChild,
+        OnChanges, SimpleChanges} from '@angular/core';
+import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {Router, ActivatedRoute} from '@angular/router';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {StringComponent} from '@eg/share/string/string.component';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {AcqProviderSearchTerm, AcqProviderSearch} from './acq-provider.service';
+import {ServerStoreService} from '@eg/core/server-store.service';
+
+@Component({
+  selector: 'eg-acq-provider-search-form',
+  styleUrls: ['acq-provider-search-form.component.css'],
+  templateUrl: './acq-provider-search-form.component.html'
+})
+
+export class AcqProviderSearchFormComponent implements OnInit, AfterViewInit, OnChanges {
+
+    @Output() searchSubmitted = new EventEmitter<AcqProviderSearch>();
+
+    providerName = '';
+    providerCode = '';
+    providerOwners = [];
+    contactName = '';
+    providerEmail = '';
+    providerPhone = '';
+    providerCurrencyType = '';
+    providerSAN = '';
+    providerEDIDefault = null
+    providerURL = '';
+    providerIsActive = true;
+
+    constructor(
+        private router: Router,
+        private route: ActivatedRoute,
+        private pcrud: PcrudService,
+        private store: ServerStoreService,
+        private idl: IdlService,
+        private toast: ToastService,
+    ) {}
+
+    ngOnInit() {
+        const self = this;
+
+    }
+
+    ngAfterViewInit() {}
+
+    clearSearch() {
+        this.providerName = '';
+        this.providerCode = '';
+        this.providerOwners = [];
+        this.contactName = '';
+        this.providerEmail = '';
+        this.providerPhone = '';
+        this.providerCurrencyType = '';
+        this.providerSAN = '';
+        this.providerEDIDefault = null
+        this.providerURL = '';
+        this.providerIsActive = true;
+    }
+
+    submitSearch() {
+        // tossing setTimeout here to ensure that the
+        // grid data source is fully initialized
+        setTimeout(() => {
+            this.searchSubmitted.emit({
+                terms: this.searchTerms,
+                conjunction: this.searchConjunction
+            });
+        });
+    }
+
+}
index 85b08ba..e20d667 100644 (file)
@@ -2,10 +2,12 @@ import {NgModule} from '@angular/core';
 import {StaffCommonModule} from '@eg/staff/common.module';
 import {AcqProviderRoutingModule} from './routing.module';
 import {AcqProviderComponent} from './acq-provider.component';
+import {AcqProviderSearchFormComponent} from './acq-provider-search-form.component';
 
 @NgModule({
   declarations: [
     AcqProviderComponent,
+    AcqProviderSearchFormComponent,
   ],
   imports: [
     StaffCommonModule,
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/provider-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/provider/provider-results.component.html
new file mode 100644 (file)
index 0000000..127b7a5
--- /dev/null
@@ -0,0 +1,19 @@
+<ng-template #contactTmpl let-provider="row">
+  <ul>
+    <li *ngFor="let c of provider.contacts()">{{c.name()}}</li>
+  </ul>
+</ng-template>
+
+<eg-grid #acqSearchProviderGrid
+  persistKey="acq.provider.search.result_grid"
+  idlClass="acqpro" [dataSource]="gridSource"
+  [stickyHeader]="true"
+  [filterable]="true"
+  [sortable]="true"
+  [cellTextGenerator]="cellTextGenerator">
+
+  <eg-grid-column [asyncSupportsEmptyTermClick]="true" path="currency_type" [hidden]="true"></eg-grid-column>
+  <eg-grid-column [asyncSupportsEmptyTermClick]="true" path="default_claim_policy" [hidden]="true"></eg-grid-column>
+  <eg-grid-column path="contacts" [cellTemplate]="contactTmpl" [filterable]="false" [sortable]="false" [hidden]="true" [disableTooltip]="true"></eg-grid-column>
+</eg-grid>
+