# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1507900188 -19800
#      Fri Oct 13 18:39:48 2017 +0530
# Node ID ea3e765e944cf077e1095c27ef05416409c9b367
# Parent  88b97ce3fcd9556a602457538261762e6a33553e
Related to issue 37044 : Show scrim while calculating receipt for slower POS

* If benchMarkScore is less than 1000, then we need to show scrim for receipt calculations

diff -r 88b97ce3fcd9 -r ea3e765e944c web/org.openbravo.retail.posterminal/js/login/model/login-model.js
--- a/web/org.openbravo.retail.posterminal/js/login/model/login-model.js	Fri Oct 13 10:02:16 2017 +0200
+++ b/web/org.openbravo.retail.posterminal/js/login/model/login-model.js	Fri Oct 13 18:39:48 2017 +0530
@@ -430,6 +430,11 @@
         OB.MobileApp.model.addSyncCheckpointModel(OB.Model.TaxCashUp);
         OB.MobileApp.model.addSyncCheckpointModel(OB.Model.CashUp);
 
+        OB.MobileApp.view.showScrimOnCalculation = false;
+        if (OB.UTIL.localStorage.getItem('benchmarkScore') && parseInt(OB.UTIL.localStorage.getItem('benchmarkScore'), 10) < 1000) {
+          OB.MobileApp.view.showScrimOnCalculation = true;
+        }
+
         var terminal = this.get('terminal');
         OB.UTIL.initCashUp(function () {
           OB.UTIL.calculateCurrentCash(function () {
diff -r 88b97ce3fcd9 -r ea3e765e944c web/org.openbravo.retail.posterminal/js/model/order.js
--- a/web/org.openbravo.retail.posterminal/js/model/order.js	Fri Oct 13 10:02:16 2017 +0200
+++ b/web/org.openbravo.retail.posterminal/js/model/order.js	Fri Oct 13 18:39:48 2017 +0530
@@ -642,6 +642,9 @@
           });
 
           me.adjustPayment();
+          if (OB.MobileApp.view.showScrimOnCalculation && me.calculatingReceipt && OB.MobileApp.view.openedPopup === null) {
+            enyo.$.scrim.hide();
+          }
           if (save) {
             me.save(function () {
               // Reset the flag that protects reentrant invocations to calculateGross().
@@ -741,6 +744,9 @@
       }
       OB.MobileApp.view.waterfall('calculatingReceipt');
       this.calculatingReceipt = true;
+      if (OB.MobileApp.view.showScrimOnCalculation) {
+        enyo.$.scrim.show();
+      }
 
       this.addToListOfCallbacks(callback);
       var executeCallback;
@@ -766,6 +772,9 @@
             me.calculateReceipt();
             return;
           } else {
+            if (OB.MobileApp.view.showScrimOnCalculation && me.calculatingReceipt && OB.MobileApp.view.openedPopup === null) {
+              enyo.$.scrim.hide();
+            }
             if (me.get('calculateReceiptCallbacks') && me.get('calculateReceiptCallbacks').length > 0) {
               executeCallback(me.get('calculateReceiptCallbacks'), function () {
                 me.calculatingReceipt = false;
