lp1857911 Statistical Categories UI port user/mrisher/lp1857911-stat-cat-v3
authorMike Risher <mrisher@catalyte.io>
Fri, 9 Oct 2020 22:42:34 +0000 (22:42 +0000)
committerMike Risher <mrisher@catalyte.io>
Fri, 9 Oct 2020 22:42:34 +0000 (22:42 +0000)
This UI allows editing copy statistical categories (stat cats), patron
statistical categories, and their entries. They are filtered by location
and permissions are needed. A separate page is used when editing,
deleting or adding entries.

Signed-off-by: Mike Risher <mrisher@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/examples/fm_IDL.xml
modified:   Open-ILS/src/eg2/src/app/staff/admin/local/admin-local-splash.component.html
modified:   Open-ILS/src/eg2/src/app/staff/admin/local/routing.module.ts
new file:   Open-ILS/src/eg2/src/app/staff/admin/local/stat_cat/stat_cat.component.html
new file:   Open-ILS/src/eg2/src/app/staff/admin/local/stat_cat/stat_cat.component.ts
new file:   Open-ILS/src/eg2/src/app/staff/admin/local/stat_cat/stat_cat.module.ts
new file:   Open-ILS/src/eg2/src/app/staff/admin/local/stat_cat/stat_cat_entries.component.html
new file:   Open-ILS/src/eg2/src/app/staff/admin/local/stat_cat/stat_cat_entries.component.ts
new file:   Open-ILS/src/eg2/src/app/staff/admin/local/stat_cat/stat_cat_routing.module.ts

Signed-off-by: Mike Risher <mrisher@catalyte.io>
Open-ILS/src/eg2/src/app/staff/admin/local/routing.module.ts
Open-ILS/src/eg2/src/app/staff/admin/local/stat_cat/stat_cat.component.ts

index f2118a2..8562aff 100644 (file)
@@ -17,7 +17,7 @@ const routes: Routes = [{
 }, {
     path: 'actor/address_alert',
     component: AddressAlertComponent
-}, {    
+}, {
     path: 'asset/stat_cat_editor',
     loadChildren: () =>
         import('./stat_cat/stat_cat.module').then(m => m.StatCatModule)
index 037497d..055cc9c 100644 (file)
@@ -89,9 +89,9 @@ export class StatCatComponent implements OnInit {
                 this.setCurrentPerms();
 
                 if (this.route.snapshot.paramMap.get('tab') === 'patron') {
-                    this.onTabChange({nextId: "'patron'"})
-                } else { // if null or copy
-                    this.onTabChange({nextId: "'copy'"})
+                    this.onTabChange({nextId: '\'patron\''});
+                } else { // if null or 'copy'
+                    this.onTabChange({nextId: '\'copy\''});
                 }
         });
     }
@@ -117,7 +117,7 @@ export class StatCatComponent implements OnInit {
 
     onTabChange(event: any) {
         this.currentTab = event.nextId;
-        if (this.currentTab === "'patron'") {
+        if (this.currentTab === '\'patron\'') {
             this.routeToTab('patron');
             this.orgOnChange(this.selectedPatronOrg, 'patron');
         } else {
@@ -220,20 +220,20 @@ export class StatCatComponent implements OnInit {
                 .then(str => this.toast.danger(str));
             return;
         }
-        
+
         // check to see if copy stat cat is in use
         if (idlString === 'asc') {
-            this.checkThenDelete(idlThings, idlString)
+            this.checkThenDelete(idlThings, idlString);
         } else {
             this.doDelete(idlThings, idlString);
         }
     }
 
     checkThenDelete = (idlThings, idlString) => {
-        let promises: any[] = [];
+        const promises: any[] = [];
         idlThings.forEach(idlThing => { // check one at a time to see if it's used
             const id = idlThing.id();
-            let promise : any = new Promise((resolve, reject) => {
+            const promise: any = new Promise((resolve, reject) => {
                 this.pcrud.search('ascecm', {stat_cat: id}, {limit: 1})
                     .toPromise().then(
                     rec => {
@@ -245,13 +245,13 @@ export class StatCatComponent implements OnInit {
                             resolve(true);
                         }
                     });
-            })
+            });
             promises.push(promise);
         });
-        let result = Promise.all(promises);
+        const result = Promise.all(promises);
         result.then(responses => {
             if (!responses.includes(false)) {  // only delete if none in use
-                this.doDelete(idlThings, idlString);  
+                this.doDelete(idlThings, idlString);
             }
         });
     }
@@ -304,7 +304,7 @@ export class StatCatComponent implements OnInit {
             newIdlObject.owner(this.selectedPatronOrg);
         } else {
             currentGrid = this.copyGrid;
-            
+
             currentDialog = this.copyDialog;
             newIdlObject = this.idl.clone(this.newAsc);
             newIdlObject.owner(this.selectedCopyOrg);