From ec18c6ac577297d6e5cd6baa072a10267e44f97a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 22 Jun 2020 18:04:55 -0400 Subject: [PATCH] LPXXX Angular Volcopy Signed-off-by: Bill Erickson --- .../app/staff/cat/volcopy/config.component.html | 343 ++++++++++----------- .../src/app/staff/cat/volcopy/config.component.ts | 2 +- .../staff/cat/volcopy/copy-attrs.component.html | 18 +- .../app/staff/cat/volcopy/copy-attrs.component.ts | 2 +- .../app/staff/cat/volcopy/vol-edit.component.ts | 2 +- .../src/app/staff/cat/volcopy/volcopy.service.ts | 47 +-- 6 files changed, 202 insertions(+), 212 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html index e32ac7ce99..93b264c47e 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html @@ -1,3 +1,8 @@ +
+
+ +
+

Holdings Defaults

@@ -11,7 +16,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.classification"> @@ -21,7 +26,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.prefix"> @@ -31,7 +36,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.suffix"> @@ -56,9 +61,9 @@
+ (onChange)="volcopy.defaults.values.classification = $event ? $event.id : null"> @@ -74,9 +79,9 @@
+ [startId]="volcopy.defaults.values.prefix || -1" + (onChange)="volcopy.defaults.values.prefix = $event ? $event.id : null"> @@ -95,9 +100,9 @@
+ (onChange)="volcopy.defaults.values.suffix = $event ? $event.id : null"> @@ -133,7 +138,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.status"> @@ -143,7 +148,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.barcode"> @@ -153,7 +158,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.create_date"> @@ -163,7 +168,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.active_date"> @@ -173,7 +178,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.creator"> @@ -183,7 +188,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.edit_date"> @@ -193,7 +198,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.editor"> @@ -212,7 +217,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.location"> @@ -222,7 +227,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.circ_lib"> @@ -232,7 +237,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.owning_lib"> @@ -242,7 +247,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.copy_number"> @@ -262,7 +267,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.circulate"> @@ -272,7 +277,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.holdable"> @@ -282,7 +287,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.age_protect"> @@ -292,7 +297,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.floating"> @@ -302,7 +307,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.loan_duration"> @@ -312,7 +317,7 @@
+ [(ngModel)]="volcopy.defaults.hidden.fine_level"> @@ -322,184 +327,150 @@
+ [(ngModel)]="volcopy.defaults.hidden.circ_as_type">
+
  • +
    + + +
    +
  • + -
    -

    Miscellaneous

    - - -
    - -
    Add Item Alerts
    -
    - -
    -
    - -
    - - - - - - -
    - -
    - - - - - -
    - -
    - - - - - -
    - -
    - - - - - - -
    - -
    - - - - - - -
    - -
    - - - - - -
    - -
    - - - - - - - - +
    +
    Statistics
    +
      +
    • +
      + + +
      +
    • +
    • +
      + + +
      +
    • +
    -
    +
    -
    -

    Statistics

    - -
    - - - - - - - - -
    - --> - +
    +
    +
    diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.ts index f7fe3125bb..5716f9e0a0 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.ts @@ -40,7 +40,7 @@ export class VolCopyConfigComponent implements OnInit, AfterViewInit { ) { } ngOnInit() { - console.log('DEFAULTS', this.volcopy.volCopyDefaults); + console.log('DEFAULTS', this.volcopy.defaults); } ngAfterViewInit() { diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html index d5016f9753..7d1c57920c 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html @@ -117,7 +117,7 @@
    -
    +
    --> -
    +
    Add Item Alerts
    @@ -439,7 +439,19 @@

    Statistics

    - +
    + +
    Add Item Tags
    +
    + +
    +
    + +
    { - if (this.volCopyDefaults) { return Promise.resolve(); } + if (this.defaults) { return Promise.resolve(); } - return this.serverStore.getItem('cat.volcopy.defaults').then( + return this.serverStore.getItem('eg.cat.volcopy.defaults').then( (defaults: VolCopyDefaults) => { - this.volCopyDefaults = defaults || {values: {}, hidden: {}}; + this.defaults = defaults || {values: {}, hidden: {}}; } + ).then(_ => { - // Default to location ID 1 (Stacks) - return this.pcrud.retrieve('acpl', 1).toPromise() - .then(loc => this.volCopyDefaults.values.location = loc); + // Use the first non-deleted copy location within org unit + // range as the default. Typically "Stacks". + + const myOrgs = this.org.fullPath(this.auth.user().ws_ou(), true); + return this.pcrud.search('acpl', + {deleted: 'f', owning_lib: myOrgs}, + {order_by: {acpl: 'id'}, limit: 1} + ).toPromise().then(loc => this.defaultLocation = loc); }); } @@ -207,7 +214,7 @@ export class VolCopyService { return this.net.request( 'open-ils.cat', 'open-ils.cat.biblio.record.marc_cn.retrieve', - id, this.volCopyDefaults.values.classification || null + id, this.defaults.values.classification || null ).toPromise().then(res => { return Object.values(res) .map(blob => Object.values(blob)[0]).sort(); @@ -223,8 +230,8 @@ export class VolCopyService { vol.record(recordId); vol.label(null); vol.owning_lib(Number(orgId)); - vol.prefix(this.volCopyDefaults.values.prefix || -1); - vol.suffix(this.volCopyDefaults.values.suffix || -1); + vol.prefix(this.defaults.values.prefix || -1); + vol.suffix(this.defaults.values.suffix || -1); return vol; } @@ -242,7 +249,7 @@ export class VolCopyService { copy.deposit_amount(0); copy.fine_level(2); // Normal copy.loan_duration(2); // Normal - copy.location(this.volCopyDefaults.values.location); // Stacks / fleshed + copy.location(this.defaultLocation); // Stacks / fleshed copy.circulate('t'); copy.holdable('t'); copy.opac_visible('t'); @@ -275,12 +282,12 @@ export class VolCopyService { let promise = Promise.resolve(); // Serialization - if (this.volCopyDefaults.values.classification) { + if (this.defaults.values.classification) { // Workstation default classification overrides the // classification that might be used at the owning lib. vols.forEach(vol => - vol.label_class(this.volCopyDefaults.values.classification)); + vol.label_class(this.defaults.values.classification)); return promise; @@ -399,20 +406,20 @@ export class VolCopyService { // Scrub unnecessary content before storing. - Object.keys(this.volCopyDefaults.values).forEach(field => { - if (this.volCopyDefaults.values[field] === null) { - delete this.volCopyDefaults.values[field]; + Object.keys(this.defaults.values).forEach(field => { + if (this.defaults.values[field] === null) { + delete this.defaults.values[field]; } }); - Object.keys(this.volCopyDefaults.hidden).forEach(field => { - if (this.volCopyDefaults.hidden[field] !== true) { - delete this.volCopyDefaults.hidden[field]; + Object.keys(this.defaults.hidden).forEach(field => { + if (this.defaults.hidden[field] !== true) { + delete this.defaults.hidden[field]; } }); return this.serverStore.setItem( - 'cat.volcopy.defaults', this.volCopyDefaults); + 'eg.cat.volcopy.defaults', this.defaults); } } -- 2.11.0