LP1816475: Don't show pager on the create reservation grid
authorJane Sandberg <sandbej@linnbenton.edu>
Sat, 30 Mar 2019 22:07:29 +0000 (15:07 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 17 Apr 2019 20:32:07 +0000 (13:32 -0700)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.html
Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.ts
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html
Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html
Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid.component.html
Open-ILS/src/eg2/src/app/share/grid/grid.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid.ts
Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html
Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts

index 891079a..90a777c 100644 (file)
@@ -45,7 +45,7 @@
     (ngModelChange)="modelChanged()"
     [spinners]="true"
     [hourStep]="1"
-    [minuteStep]="minuteStep || 15" >
+    [minuteStep]="minuteStep || 30" >
   </ngb-timepicker>
   <span *ngIf="showTZ" class="badge badge-info">{{ timezone || 'America/Los_Angeles'}}</span>
   <button i18n class="btn btn-success" (click)="dtPicker.close()">Choose time</button>
index a12a84f..825434c 100644 (file)
@@ -52,7 +52,7 @@ export class DateTimeSelectComponent implements OnInit {
         const remainder = this.minuteStep - start.minute() % this.minuteStep,
             final = Moment(start, this.timezone).add(remainder, 'minutes');
 
-        // Seed time model with current, rounding up to nearest granularity minutes (does roll hour over if needed)
+        // Seed time model with current, rounding up to nearest minuteStep (does roll hour over if needed)
         this.timeModel = { hour: final.hour(), minute: final.minute(), second: 0 };
     }
 
@@ -72,7 +72,7 @@ export class DateTimeSelectComponent implements OnInit {
         }
 
         if (newDate && !isNaN(newDate)) {
-            // Set component view value
+            // Set the input field to the current value
             this.stringVersion = this.format.transform({value: newDate, datatype: 'timestamp', datePlusTime: true});
             // Update form passed in view value
             this.onChangeAsMoment.emit(newDate);
@@ -80,9 +80,5 @@ export class DateTimeSelectComponent implements OnInit {
         }
     }
 
-    isDisabled(date: NgbDateStruct, current: { month: number }) {
-        return date.month !== current.month;
-    }
-
 }
 
index 583bef0..a1c728e 100644 (file)
@@ -50,7 +50,7 @@
                 [showTZ]="timezone"
                 [timezone]="timezone"
                 domId="{{idPrefix}}-{{field.name}}"
-                (onChangeAsMoment)="record[field.name]($event)"
+                (onChangeAsMoment)="field.validate(field.name, $event, record)"
                 [validatorError]="field.validatorError"
                 [readOnly]="field.readOnly"
                 initialIso="{{record[field.name]()}}">
index 0c6ddca..bb80e0c 100644 (file)
     </div>
   </div>
 
-  <button [disabled]="gridContext.pager.isFirstPage()" type="button" 
-    class="btn btn-outline-dark mr-1" (click)="gridContext.pager.toFirst()">
-    <span title="First Page" i18n-title 
+  <ng-container *ngIf="!disablePager">
+    <button [disabled]="gridContext.pager.isFirstPage()" type="button" 
+      class="btn btn-outline-dark mr-1" (click)="gridContext.pager.toFirst()">
+      <span title="First Page" i18n-title 
         class="material-icons mat-icon-in-button">first_page</span>
-  </button>
-  <button [disabled]="gridContext.pager.isFirstPage()" type="button" 
-    class="btn btn-outline-dark mr-1" (click)="gridContext.pager.decrement()">
-    <span title="Previous Page" i18n-title 
+    </button>
+    <button [disabled]="gridContext.pager.isFirstPage()" type="button" 
+      class="btn btn-outline-dark mr-1" (click)="gridContext.pager.decrement()">
+      <span title="Previous Page" i18n-title 
         class="material-icons mat-icon-in-button">keyboard_arrow_left</span>
-  </button>
-  <button [disabled]="gridContext.pager.isLastPage()" type="button" 
-    class="btn btn-outline-dark mr-1" (click)="gridContext.pager.increment()">
-    <span title="Next Page" i18n-title 
+    </button>
+    <button [disabled]="gridContext.pager.isLastPage()" type="button" 
+      class="btn btn-outline-dark mr-1" (click)="gridContext.pager.increment()">
+      <span title="Next Page" i18n-title 
         class="material-icons mat-icon-in-button">keyboard_arrow_right</span>
-  </button>
+    </button>
 
-  <!--
-  Hiding jump-to-last since there's no analog in the angularjs grid and
-  it has limited value since the size of the data set is often unknown.
-  <button [disabled]="!gridContext.pager.resultCount || gridContext.pager.isLastPage()" 
-    type="button" class="btn btn-outline-dark mr-1" (click)="gridContext.pager.toLast()">
-    <span title="First Page" i18n-title 
+    <!--
+    Hiding jump-to-last since there's no analog in the angularjs grid and
+    it has limited value since the size of the data set is often unknown.
+    <button [disabled]="!gridContext.pager.resultCount || gridContext.pager.isLastPage()" 
+      type="button" class="btn btn-outline-dark mr-1" (click)="gridContext.pager.toLast()">
+      <span title="First Page" i18n-title 
         class="material-icons mat-icon-in-button">last_page</span>
-  </button>
-  -->
-
-  <div ngbDropdown class="mr-1" placement="bottom-right">
-    <button ngbDropdownToggle class="btn btn-outline-dark text-button">
-      <span title="Select Row Count" i18n-title i18n>
-        Rows {{gridContext.pager.limit}}
-      </span>
     </button>
-    <div class="dropdown-menu" ngbDropdownMenu>
-      <a class="dropdown-item" 
-        *ngFor="let count of [5, 10, 25, 50, 100]"
-        (click)="gridContext.pager.setLimit(count)">
-        <span class="ml-2">{{count}}</span>
-      </a>
+    -->
+
+    <div ngbDropdown class="mr-1" placement="bottom-right">
+      <button ngbDropdownToggle class="btn btn-outline-dark text-button">
+        <span title="Select Row Count" i18n-title i18n>
+          Rows {{gridContext.pager.limit}}
+        </span>
+      </button>
+      <div class="dropdown-menu" ngbDropdownMenu>
+        <a class="dropdown-item" 
+          *ngFor="let count of [5, 10, 25, 50, 100]"
+          (click)="gridContext.pager.setLimit(count)">
+          <span class="ml-2">{{count}}</span>
+        </a>
+      </div>
     </div>
-  </div>
+  </ng-container>
 
   <button type="button" 
     class="btn btn-outline-dark mr-1" 
index 1d33cd2..bb4eaea 100644 (file)
@@ -16,6 +16,7 @@ export class GridToolbarComponent implements OnInit {
     @Input() gridContext: GridContext;
     @Input() colWidthConfig: GridColumnWidthComponent;
     @Input() gridPrinter: GridPrintComponent;
+    @Input() disablePager = false;
     @Input() disableSaveSettings = false;
 
     csvExportInProgress: boolean;
index ad228b0..ae1a07a 100644 (file)
@@ -5,6 +5,7 @@
     [gridContext]="context" 
     [gridPrinter]="gridPrinter"
     [colWidthConfig]="colWidthConfig"
+    [disablePager]="disablePager"
     [disableSaveSettings]="disableSaveSettings">
   </eg-grid-toolbar>
 
index d4f6a7f..d4d07e8 100644 (file)
@@ -7,6 +7,8 @@ import {ServerStoreService} from '@eg/core/server-store.service';
 import {FormatService} from '@eg/core/format.service';
 import {GridContext, GridColumn, GridDataSource, GridRowFlairEntry} from './grid';
 
+const MAX_ALL_ROW_COUNT = 10000;
+
 /**
  * Main grid entry point.
  */
@@ -49,6 +51,9 @@ export class GridComponent implements OnInit, AfterViewInit, OnDestroy {
     // Prevent selection of multiple rows
     @Input() disableMultiSelect: boolean;
 
+    // Don't display the pager
+    @Input() disablePager: boolean;
+
     // Show an extra column in the grid where the caller can apply
     // row-specific flair (material icons).
     @Input() rowFlairIsEnabled: boolean;
@@ -132,6 +137,7 @@ export class GridComponent implements OnInit, AfterViewInit, OnDestroy {
         this.context.disableSelect = this.disableSelect === true;
         this.context.showLinkSelectors = this.showLinkSelectors === true;
         this.context.disableMultiSelect = this.disableMultiSelect === true;
+        this.context.pager.limit = this.disablePager ? MAX_ALL_ROW_COUNT : 10;
         this.context.rowFlairIsEnabled = this.rowFlairIsEnabled  === true;
         this.context.rowFlairCallback = this.rowFlairCallback;
         if (this.showFields) {
index 9cff160..875a457 100644 (file)
@@ -460,7 +460,6 @@ export class GridContext {
         this.store = store;
         this.format = format;
         this.pager = new Pager();
-        this.pager.limit = 10;
         this.rowSelector = new GridRowSelector();
         this.toolbarButtons = [];
         this.toolbarCheckboxes = [];
index dad6540..10fa30f 100644 (file)
   [dataSource]="scheduleSource"
   [rowFlairIsEnabled]="true"
   [rowFlairCallback]="resourceAvailabilityIcon"
+  disablePager="true"
   disableSaveSettings="true"
   [cellClassCallback]="isBooked">
   <eg-grid-column path="time" [index]="true" ></eg-grid-column>
index f48db21..4aabdee 100644 (file)
@@ -111,7 +111,7 @@ export class CreateReservationComponent implements OnInit {
             order_by: 'barcode ASC',
             flesh: 1,
             flesh_fields: {'brsrc': ['curr_rsrcs']},
-            select: {'curr_rsrcs': {'end_time': {'<' : '2019-04-01'}}}
+           select: {'curr_rsrcs': {'end_time': {'<' : '2019-04-01'}}} // TODO: make the time real using idlFormatDate; include all with an end time AFTER 12am AND start time BEFORE 11:59pm
         }).subscribe(
             r => { this.resources.push(r); });