Skip to content
This repository
Browse code

Issue 19453: Changed QuoteStatus to a mix-in in the Quote model.

  • Loading branch information...
commit 06758b0f04bb33da8382f2b3fa2b6ed56ae1b863 1 parent b5a5533
Linda Nichols authored
38  enyo-client/application/source/models/quote.js
@@ -5,6 +5,27 @@ white:true*/
5 5
 
6 6
 (function () {
7 7
   "use strict";
  8
+  
  9
+  /**
  10
+    @namespace
  11
+
  12
+    A mixin shared by project models that share common project status
  13
+    functionality.
  14
+  */
  15
+  XM.QuoteStatus = {
  16
+    /** @scope XM.ProjectStatus */
  17
+
  18
+    /**
  19
+    Returns project status as a localized string.
  20
+
  21
+    @returns {String}
  22
+    */
  23
+    getProjectStatusString: function () {
  24
+      var K = XM.Quote,
  25
+        status = this.get("status");
  26
+      return status === K.OPEN_STATUS ? "_open".loc() : "_closed".loc();
  27
+    }
  28
+  };
8 29
 
9 30
   /**
10 31
     @class
@@ -492,17 +513,6 @@ white:true*/
492 513
     },
493 514
 
494 515
     /**
495  
-    Returns quote status as a localized string.
496  
-
497  
-    @returns {String}
498  
-    */
499  
-    getQuoteStatusString: function () {
500  
-      var K = this.getClass(),
501  
-        status = this.get("status");
502  
-      return status === K.OPEN_STATUS ? "_open".loc() : "_closed".loc();
503  
-    },
504  
-
505  
-    /**
506 516
       If the user changed the freight determine whether they want the automatic calculation
507 517
       turned on or off as a result of their change. This function will trigger a `notify` call
508 518
       asking the question, which must be answered via the attached callback to complete the process.
@@ -818,6 +828,9 @@ white:true*/
818 828
     }
819 829
 
820 830
   });
  831
+  
  832
+  // Add in quote status mixin
  833
+  XM.Quote = XM.Quote.extend(XM.QuoteStatus);
821 834
 
822 835
   // ..........................................................
823 836
   // CLASS METHODS
@@ -1752,6 +1765,9 @@ white:true*/
1752 1765
     }
1753 1766
 
1754 1767
   });
  1768
+  
  1769
+  // Add in quote status mixin
  1770
+  XM.QuoteListItem = XM.QuoteListItem.extend(XM.QuoteStatus);
1755 1771
 
1756 1772
   /**
1757 1773
     @class
12  enyo-client/application/source/widgets/parameter.js
@@ -545,27 +545,27 @@ trailing:true white:true*/
545 545
           return param;
546 546
         }
547 547
       },
548  
-      {name: "excludeProspects", label: "_excludeProspects".loc(), attr: "customer.status", defaultKind: "XV.CheckboxWidget",
  548
+      {name: "showClosed", label: "_showClosed".loc(), attr: "status", defaultKind: "XV.CheckboxWidget",
549 549
         getParameter: function () {
550 550
           var param;
551  
-          if (this.getValue()) {
  551
+          if (!this.getValue()) {
552 552
             param = {
553 553
               attribute: this.getAttr(),
554 554
               operator: '!=',
555  
-              value: "P"
  555
+              value: 'C'
556 556
             };
557 557
           }
558 558
           return param;
559 559
         }
560 560
       },
561  
-      {name: "showClosed", label: "_showClosed".loc(), attr: "status", defaultKind: "XV.CheckboxWidget",
  561
+      {name: "excludeProspects", label: "_excludeProspects".loc(), attr: "customer.status", defaultKind: "XV.CheckboxWidget",
562 562
         getParameter: function () {
563 563
           var param;
564  
-          if (!this.getValue()) {
  564
+          if (this.getValue()) {
565 565
             param = {
566 566
               attribute: this.getAttr(),
567 567
               operator: '!=',
568  
-              value: 'C'
  568
+              value: "P"
569 569
             };
570 570
           }
571 571
           return param;

0 notes on commit 06758b0

Please sign in to comment.
Something went wrong with that request. Please try again.