LP1859701 Cash reports inline patron info
authorBill Erickson <berickxx@gmail.com>
Wed, 6 Jul 2022 16:26:46 +0000 (12:26 -0400)
committerMichele Morgan <mmorgan@noblenet.org>
Fri, 28 Oct 2022 19:46:50 +0000 (15:46 -0400)
Display patron info in the User Payments grid inline with the grid
instead of requiring an additional click to open a separate dialog.

Make patron barcode a link so the patron can be opened in a new tab.

Adds grid prefs workstation settings.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.ts
Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.module.ts
Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/user-dialog.component.html [deleted file]
Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/user-dialog.component.ts [deleted file]
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-cash-reports.sql [new file with mode: 0644]

index bb136bc..1cf4c64 100644 (file)
@@ -48,6 +48,7 @@
           <div class="col-sm-10">{{deskTotals.credit_card_payment | currency}}</div>
         </div>
         <eg-grid #deskPaymentGrid
+          persistKey="admin.local.cash_reports.desk_payments"
           [disableSelect]="true"
           [disablePaging]="true"
           [dataSource]="deskPaymentDataSource"
           <div class="col-sm-2" i18n>Total Goods Payments</div>
           <div class="col-sm-10">{{userTotals.goods_payment | currency}}</div>
         </div>
+        <ng-template #cardTmpl let-row="row">
+          <a target="_blank" href="/eg/staff/circ/patron/{{row.user.id()}}/checkout">
+            {{row.user.card()}}
+          </a>
+        </ng-template>
         <eg-grid #userPaymentGrid
-          (onRowActivate) = "onRowActivate($event)"
+          persistKey="admin.local.cash_reports.user_payments"
           [disableSelect]="true"
           [disablePaging]="true"
           [dataSource]="userPaymentDataSource"
           <eg-grid-column label="Forgive Payment" name="forgive_payment" i18n-label datatype="money"></eg-grid-column>
           <eg-grid-column label="Work Payment" name="work_payment" i18n-label datatype="money"></eg-grid-column>
           <eg-grid-column label="Goods Payment" name="goods_payment" i18n-label datatype="money"></eg-grid-column>
+          <eg-grid-column label="Patron Card" name="card" i18n-label [cellTemplate]="cardTmpl"></eg-grid-column>
+          <eg-grid-column label="Patron Email" path="user.email" i18n-label></eg-grid-column>
+          <eg-grid-column label="Patron First Name" path="user.first_given_name" i18n-label></eg-grid-column>
+          <eg-grid-column label="Patron Family Name" path="user.family_name" i18n-label></eg-grid-column>
+          <eg-grid-column label="Patron Home OU" path="user.home_ou" i18n-label></eg-grid-column>
         </eg-grid>
       </div>
     </ng-template>
   </li>
 </ul>
 <div [ngbNavOutlet]="cashReportsNav"></div>
-
-<eg-user-dialog #userDialog>
-  <ng-container *ngIf="userDataSource.data && userDataSource.data.length>0">
-    <eg-grid #userGrid
-      [disableSelect]="true"
-      [disablePaging]="true"
-      [dataSource]="userDataSource"
-      [sortable]="false">
-      <eg-grid-column label="Card" name="card" [index]="true" i18n-label></eg-grid-column>
-      <eg-grid-column label="Email" name="email" i18n-label></eg-grid-column>
-      <eg-grid-column label="First Name" name="first_given_name" i18n-label></eg-grid-column>
-      <eg-grid-column label="Family Name" name="family_name" i18n-label></eg-grid-column>
-      <eg-grid-column label="Home OU" name="home_ou" i18n-label></eg-grid-column>
-    </eg-grid>
-  </ng-container>
-</eg-user-dialog>
index e131e1b..f77a147 100644 (file)
@@ -1,11 +1,11 @@
 import {Component, OnInit, Input, ViewChild} from '@angular/core';
 import {GridComponent} from '@eg/share/grid/grid.component';
-import {GridDataSource, GridColumn, GridRowFlairEntry} from '@eg/share/grid/grid';
+import {GridDataSource, GridColumn,
+    GridCellTextGenerator, GridRowFlairEntry} from '@eg/share/grid/grid';
 import {IdlService} from '@eg/core/idl.service';
 import {NetService} from '@eg/core/net.service';
 import {AuthService} from '@eg/core/auth.service';
 import {OrgService} from '@eg/core/org.service';
-import {UserDialogComponent} from './user-dialog.component';
 
 class DeskTotals {
     cash_payment = 0;
@@ -38,10 +38,11 @@ export class CashReportsComponent implements OnInit {
     userTotals = new UserTotals();
     disabledOrgs = [];
     activeTab = 'deskPayments';
+    cellTextGenerator: GridCellTextGenerator;
+
 
     // Default sort field, used when no grid sorting is applied.
     @Input() sortField: string;
-    @ViewChild('userDialog') userDialog: UserDialogComponent;
     @ViewChild('deskPaymentGrid') deskPaymentGrid: GridComponent;
     @ViewChild('userPaymentGrid') userPaymentGrid: GridComponent;
     @ViewChild('userGrid') userGrid: GridComponent;
@@ -55,19 +56,10 @@ export class CashReportsComponent implements OnInit {
     ngOnInit() {
         this.disabledOrgs = this.getFilteredOrgList();
         this.searchForData(this.startDate, this.endDate);
-    }
-
-    onRowActivate(userObject) {
-        if (userObject.user && this.userDataSource.data.length === 0) {
-            this.userDataSource.data = [userObject.user];
-            this.showUserInformation();
-        } else {
-            this.eraseUserGrid();
-        }
-    }
 
-    showUserInformation() {
-        return this.userDialog.open({size: 'lg'}).toPromise();
+        this.cellTextGenerator = {
+            card: row => row.user.card()
+        };
     }
 
     searchForData(start, end) {
@@ -91,6 +83,7 @@ export class CashReportsComponent implements OnInit {
                 result.forEach((userObject, index) => {
                     result[index].user = userObject.usr();
                     result[index].usr(userObject.usr().usrname());
+                    console.log('USER IS', userObject);
                 });
             }
             this[dataSource].data = result;
index 5ab480f..380c710 100644 (file)
@@ -2,13 +2,11 @@ import {NgModule} from '@angular/core';
 import {TreeModule} from '@eg/share/tree/tree.module';
 import {StaffCommonModule} from '@eg/staff/common.module';
 import {CashReportsComponent} from './cash-reports.component';
-import {UserDialogComponent} from './user-dialog.component';
 import {CashReportsRoutingModule} from './routing.module';
 
 @NgModule({
   declarations: [
-    CashReportsComponent,
-    UserDialogComponent
+    CashReportsComponent
   ],
   imports: [
     StaffCommonModule,
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/user-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/user-dialog.component.html
deleted file mode 100644 (file)
index 764b4a6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-
-<ng-template #dialogContent>
-    <div class="modal-header bg-info">
-        <h4 class="modal-title" i18n>User Information</h4>
-
-    </div>
-    <div class="modal-body">
-        <ng-content></ng-content>
-    </div>
-    <div class="modal-footer">
-        <button class="btn btn-success" (click)="closeEditor()" i18n>Close</button>
-    </div>
-</ng-template>
\ No newline at end of file
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/user-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/user-dialog.component.ts
deleted file mode 100644 (file)
index 872aeea..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-import {Component, OnInit, Input, ViewChild} from '@angular/core';
-import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
-import {Observable} from 'rxjs';
-import { DialogComponent } from '@eg/share/dialog/dialog.component';
-
-@Component({
-    selector: 'eg-user-dialog',
-    templateUrl: './user-dialog.component.html'
-})
-export class UserDialogComponent extends DialogComponent implements OnInit {
-
-    ngOnInit() {}
-
-    constructor(
-        private modal: NgbModal) {
-        super(modal);
-      }
-
-      open(args?: NgbModalOptions): Observable<any> {
-          if (!args) {
-              args = {};
-          }
-          return super.open(args);
-      }
-
-      closeEditor() {
-          this.close();
-      }
-}
index 121fb20..93b7481 100644 (file)
@@ -23207,3 +23207,19 @@ UPDATE config.print_template SET template = $TEMPLATE$
 
 $TEMPLATE$ WHERE name = 'renew';
 
+INSERT into config.workstation_setting_type (name, grp, datatype, label)
+VALUES (
+    'eg.grid.admin.local.cash_reports.desk_payments', 'gui', 'object',
+    oils_i18n_gettext(
+        'eg.grid.admin.local.cash_reports.desk_payments',
+        'Grid Config: admin.local.cash_reports.desk_payments',
+        'cwst', 'label'
+    )
+), (
+    'eg.grid.admin.local.cash_reports.user_payments', 'gui', 'object',
+    oils_i18n_gettext(
+        'eg.grid.admin.local.cash_reports.user_payments',
+        'Grid Config: admin.local.cash_reports.user_payments',
+        'cwst', 'label'
+    )
+);
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-cash-reports.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-cash-reports.sql
new file mode 100644 (file)
index 0000000..c8dd55e
--- /dev/null
@@ -0,0 +1,22 @@
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version);
+
+INSERT into config.workstation_setting_type (name, grp, datatype, label)
+VALUES (
+    'eg.grid.admin.local.cash_reports.desk_payments', 'gui', 'object',
+    oils_i18n_gettext(
+        'eg.grid.admin.local.cash_reports.desk_payments',
+        'Grid Config: admin.local.cash_reports.desk_payments',
+        'cwst', 'label'
+    )
+), (
+    'eg.grid.admin.local.cash_reports.user_payments', 'gui', 'object',
+    oils_i18n_gettext(
+        'eg.grid.admin.local.cash_reports.user_payments',
+        'Grid Config: admin.local.cash_reports.user_payments',
+        'cwst', 'label'
+    )
+);
+
+COMMIT;