Эх сурвалжийг харах

Process claims - auto-refresh every 1 minute

Vijayakrishnan 3 жил өмнө
parent
commit
d2423c240c

+ 18 - 0
resources/views/app/practice-management/process-claims.blade.php

@@ -390,6 +390,7 @@
                         },
                         setCurrentClaim: function(_index) {
                             let claim = this.claims[_index];
+                            localStorage.currentClaimUid = claim.uid;
                             if(this.currentClaim && this.currentClaim.uid === claim.uid) return;
                             this.currentMBClaim = null;
                             this.currentClaimLines = null;
@@ -425,6 +426,18 @@
                         },
                         resetCurrentClaim: function() {
                             if(this.claims && this.claims.length) {
+
+                                let storedClaimUid = localStorage.currentClaimUid;
+                                if(storedClaimUid) {
+                                    for (let i = 0; i < this.claims.length; i++) {
+                                        if (storedClaimUid === this.claims[i].uid && (!this.claims[i].status || this.claims[i].status === 'NEW' ||
+                                            (this.claims[i].status === 'PICKED_UP' && this.claims[i].status_pro_id === this.proId))) {
+                                            this.setCurrentClaim(i);
+                                            return;
+                                        }
+                                    }
+                                }
+
                                 for (let i = 0; i < this.claims.length; i++) {
                                     if (!this.claims[i].status || this.claims[i].status === 'NEW' ||
                                         (this.claims[i].status === 'PICKED_UP' && this.claims[i].status_pro_id === this.proId)) {
@@ -512,6 +525,11 @@
                                 });
                                 return false;
                             });
+
+                        // auto-reload every minute
+                        window.setTimeout(() => {
+                            fastReload();
+                        }, 60000);
                     }
                 })