LP1958258 Angular login form shows pending offline xacts
authorBill Erickson <berickxx@gmail.com>
Wed, 19 Jan 2022 16:46:27 +0000 (11:46 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Tue, 14 Feb 2023 14:52:17 +0000 (09:52 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/login.component.html
Open-ILS/src/eg2/src/app/staff/login.component.ts
Open-ILS/src/eg2/src/app/staff/share/offline.service.ts

index 63c8b82..e6c2644 100644 (file)
             <div class="badge badge-warning p-2" i18n>Login Failed</div>
           </div>
         </div>
+
+        <div class="row" *ngIf="pendingXactsDate">
+          <div class="col-lg-8 offset-lg-4 alert alert-warning mt-2">
+            Unprocessed offline transactions waiting for upload.
+            Last transaction added at {{pendingXactsDate | date:'short'}}.
+          </div>
+        </div>
       </form>
     </fieldset>
   </div>
index 956b18c..50ec9c6 100644 (file)
@@ -14,6 +14,7 @@ export class StaffLoginComponent implements OnInit {
     workstations: any[];
     loginFailed: boolean;
     routeTo: string;
+    pendingXactsDate: Date;
 
     args = {
       username : '',
@@ -58,6 +59,8 @@ export class StaffLoginComponent implements OnInit {
             this.args.workstation = def;
             this.applyWorkstation();
         });
+
+        this.offline.pendingXactsDate().then(d => this.pendingXactsDate = d);
     }
 
     applyWorkstation() {
index 4130d24..e9607a7 100644 (file)
@@ -124,4 +124,15 @@ export class OfflineService {
             rows: rows
         });
     }
+
+    // Return promise of cache date when pending transactions exit.
+    pendingXactsDate(): Promise<Date> {
+        return this.db.request({
+            schema: 'cache',
+            table: 'CacheDate',
+            action: 'selectWhereEqual',
+            field: 'type',
+            value: '_offlineXact'
+        }).then(results => results[0] ? results[0].cachedate : null);
+    }
 }