Răsfoiți Sursa

增加从item search、category、search全选加入到wish list、portfolio、cart数量为0的情况提示,默认按钮可用

Pen Li 9 ani în urmă
părinte
comite
6bc23277d9

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 53 - 21
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -62,9 +62,9 @@
 }
 -(void)begin_select
 {
-    self.addCartBtn.enabled=false;
-    self.addWishBtn.enabled=false;
-    self.addPortfolioBtn.enabled=false;
+//    self.addCartBtn.enabled=false;
+//    self.addWishBtn.enabled=false;
+//    self.addPortfolioBtn.enabled=false;
     
     self.selectToolbar.hidden=false;
     //  self.collectionview.allowsMultipleSelection = YES;
@@ -263,9 +263,9 @@
         [self.selectallBtn setTitle:@"Deselect"];
         if(count>0)
         {
-            self.addWishBtn.enabled = true;
-            self.addCartBtn.enabled = true;
-            self.addPortfolioBtn.enabled=true;
+//            self.addWishBtn.enabled = true;
+//            self.addCartBtn.enabled = true;
+//            self.addPortfolioBtn.enabled=true;
         }
         self.select_count=count;
         checked=@"true";
@@ -274,9 +274,9 @@
     {
         self.selectallBtn.tag = 0;
         [self.selectallBtn setTitle:@"Select"];
-        self.addWishBtn.enabled = false;
-        self.addCartBtn.enabled = false;
-        self.addPortfolioBtn.enabled=false;
+//        self.addWishBtn.enabled = false;
+//        self.addCartBtn.enabled = false;
+//        self.addPortfolioBtn.enabled=false;
         
         checked=@"false";
     }
@@ -616,9 +616,14 @@
     //debug
     //[checked addObject:@"-123"];
     
-    if(checked.count==0)
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to cart." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
-        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add To Cart." controller:self] ;
+        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to cart." controller:self] ;
         return;
     }
     
@@ -723,11 +728,17 @@
         }
     }
     
-    if(checked.count==0)
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to portfolio." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
-        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add To Portfolio." controller:self] ;
+        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to portfolio." controller:self] ;
         return;
     }
+
     
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addPortfolioBtn.enabled =false;
@@ -815,11 +826,17 @@
         }
     }
     
-    if(checked.count==0)
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to Wish List." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
-        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add To Wish List." controller:self] ;
+        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to Wish List." controller:self] ;
         return;
     }
+
     
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addWishBtn.enabled =false;
@@ -1298,6 +1315,10 @@
     self.label_net_err.layer.cornerRadius=15;
     self.label_net_err.layer.masksToBounds=true;
     
+    self.addWishBtn.enabled = true;
+    self.addCartBtn.enabled = true;
+    self.addPortfolioBtn.enabled=true;
+
     
     CGPoint center = self.mum.center;
     self.mum.frame = CGRectMake(0, 0, 100, 100);
@@ -1992,9 +2013,9 @@
             self.select_count--;
             if(self.select_count==0)
             {
-                self.addWishBtn.enabled = false;
-                self.addCartBtn.enabled = false;
-                self.addPortfolioBtn.enabled = false;
+//                self.addWishBtn.enabled = false;
+//                self.addCartBtn.enabled = false;
+//                self.addPortfolioBtn.enabled = false;
             }
             [item setValue:@"false" forKey:@"checked"];
             currentSelecteCell.checkImageView.hidden = true;
@@ -2006,9 +2027,9 @@
         else
         {
             self.select_count++;
-            self.addWishBtn.enabled = true;
-            self.addCartBtn.enabled = true;
-            self.addPortfolioBtn.enabled = true;
+//            self.addWishBtn.enabled = true;
+//            self.addCartBtn.enabled = true;
+//            self.addPortfolioBtn.enabled = true;
             [item setValue:@"true" forKey:@"checked"];
             currentSelecteCell.checkImageView.hidden = false;
             [currentSelecteCell setBackgroundColor: UIColorFromRGB(0x009966)];
@@ -2316,8 +2337,19 @@
     self.addAll = !self.addAll;
     if (self.addAll) {
         [self.addAllCheckBtn setImage:[[UIImage imageNamed:@"check_1_24"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
+        
+//        self.addWishBtn.enabled = true;
+//        self.addCartBtn.enabled = true;
+//        self.addPortfolioBtn.enabled=true;
+        
     } else {
         [self.addAllCheckBtn setImage:[[UIImage imageNamed:@"check_0_24"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
+        
+//        if (!self.select_count) {
+//            self.addWishBtn.enabled = false;
+//            self.addCartBtn.enabled = false;
+//            self.addPortfolioBtn.enabled=false;
+//        }
     }
     
 }

+ 39 - 19
RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m

@@ -71,9 +71,9 @@
 }
 -(void)begin_select
 {
-    self.addCartBtn.enabled=false;
-    self.addWishBtn.enabled=false;
-    self.addPortfolioBtn.enabled=false;
+//    self.addCartBtn.enabled=false;
+//    self.addWishBtn.enabled=false;
+//    self.addPortfolioBtn.enabled=false;
     self.selectToolbar.hidden=false;
     //  self.collectionview.allowsMultipleSelection = YES;
     
@@ -166,9 +166,9 @@
         [self.selectallBtn setTitle:@"Deselect"];
         if(count>0)
         {
-            self.addWishBtn.enabled = true;
-            self.addCartBtn.enabled = true;
-            self.addPortfolioBtn.enabled=true;
+//            self.addWishBtn.enabled = true;
+//            self.addCartBtn.enabled = true;
+//            self.addPortfolioBtn.enabled=true;
         }
         self.select_count=count;
         checked=@"true";
@@ -177,9 +177,9 @@
     {
         self.selectallBtn.tag = 0;
         [self.selectallBtn setTitle:@"Select"];
-        self.addWishBtn.enabled = false;
-        self.addCartBtn.enabled = false;
-        self.addPortfolioBtn.enabled=false;
+//        self.addWishBtn.enabled = false;
+//        self.addCartBtn.enabled = false;
+//        self.addPortfolioBtn.enabled=false;
         
         checked=@"false";
     }
@@ -205,6 +205,10 @@
     self.label_net_err.layer.cornerRadius=15;
     self.label_net_err.layer.masksToBounds=true;
     
+    self.addWishBtn.enabled = true;
+    self.addCartBtn.enabled = true;
+    self.addPortfolioBtn.enabled=true;
+
     
     CGPoint center = self.mum.center;
     self.mum.frame = CGRectMake(0, 0, 100, 100);
@@ -1016,11 +1020,17 @@
         }
     }
     
-    if(checked.count==0)
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to cart." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
         [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to cart." controller:self] ;
         return;
     }
+
     
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addCartBtn.enabled = false;
@@ -1123,7 +1133,12 @@
         }
     }
     
-    if(checked.count==0)
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to portfolio." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
         [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to portfolio." controller:self] ;
         return;
@@ -1212,9 +1227,14 @@
         }
     }
     
-    if(checked.count==0)
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to Wish List." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
-        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add To Wish List." controller:self] ;
+        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to Wish List." controller:self] ;
         return;
     }
     
@@ -1839,9 +1859,9 @@
             self.select_count--;
             if(self.select_count==0)
             {
-                self.addWishBtn.enabled = false;
-                self.addCartBtn.enabled = false;
-                self.addPortfolioBtn.enabled=false;
+//                self.addWishBtn.enabled = false;
+//                self.addCartBtn.enabled = false;
+//                self.addPortfolioBtn.enabled=false;
             }
             [item setValue:@"false" forKey:@"checked"];
             
@@ -1854,9 +1874,9 @@
         else
         {
             self.select_count++;
-            self.addWishBtn.enabled = true;
-            self.addCartBtn.enabled = true;
-            self.addPortfolioBtn.enabled=true;
+//            self.addWishBtn.enabled = true;
+//            self.addCartBtn.enabled = true;
+//            self.addPortfolioBtn.enabled=true;
             [item setValue:@"true" forKey:@"checked"];
             currentSelecteCell.checkImageView.hidden = false;
             [currentSelecteCell setBackgroundColor: UIColorFromRGB(0x009966)];

+ 59 - 22
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -64,9 +64,12 @@
 }
 -(void)begin_select
 {
-    self.addCartBtn.enabled=false;
-    self.addWishBtn.enabled=false;
-    self.addPortfolioBtn.enabled=false;
+    self.addWishBtn.enabled = true;
+    self.addCartBtn.enabled = true;
+    self.addPortfolioBtn.enabled=true;
+//    self.addCartBtn.enabled=false;
+//    self.addWishBtn.enabled=false;
+//    self.addPortfolioBtn.enabled=false;
     self.selectToolbar.hidden=false;
     //  self.collectionview.allowsMultipleSelection = YES;
     
@@ -149,7 +152,12 @@
     self.mum.backgroundColor = [UIColor colorWithHEX:0xA5A5A5 alpha:0.5];
     self.mum.layer.cornerRadius = 5.0f;
     self.mum.layer.masksToBounds = YES;
+    
+    self.addWishBtn.enabled = true;
+    self.addCartBtn.enabled = true;
+    self.addPortfolioBtn.enabled=true;
 
+    
     self.addAll = NO;
     [self.addAllCheckBtn setImage:[[UIImage imageNamed:@"check_0_24"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
     
@@ -296,12 +304,12 @@
     {
         self.selectallBtn.tag = 1;
         [self.selectallBtn setTitle:@"Deselect"];
-        if(count>0)
-        {
-        self.addWishBtn.enabled = true;
-        self.addCartBtn.enabled = true;
-        self.addPortfolioBtn.enabled=true;
-        }
+//        if(count>0)
+//        {
+//        self.addWishBtn.enabled = true;
+//        self.addCartBtn.enabled = true;
+//        self.addPortfolioBtn.enabled=true;
+//        }
         self.select_count=count;
         checked=@"true";
     }
@@ -309,9 +317,9 @@
     {
         self.selectallBtn.tag = 0;
         [self.selectallBtn setTitle:@"Select"];
-        self.addWishBtn.enabled = false;
-        self.addCartBtn.enabled = false;
-        self.addPortfolioBtn.enabled=false;
+//        self.addWishBtn.enabled = false;
+//        self.addCartBtn.enabled = false;
+//        self.addPortfolioBtn.enabled=false;
         
         checked=@"false";
     }
@@ -836,7 +844,12 @@
         }
     }
     
-    if(checked.count==0)
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to cart." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
         [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to cart." controller:self] ;
         return;
@@ -936,7 +949,18 @@
         }
     }
     
-    if(checked.count==0)
+//    if(checked.count==0)
+//    {
+//        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to portfolio." controller:self] ;
+//        return;
+//    }
+    
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to portfolio." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
         [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to portfolio." controller:self] ;
         return;
@@ -1026,11 +1050,23 @@
         }
     }
     
-    if(checked.count==0)
+//    if(checked.count==0)
+//    {
+//        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add To Wish List." controller:self] ;
+//        return;
+//    }
+    
+    if (!count) {
+        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to Wish List." controller:self] ;
+        return;
+    }
+    
+    if(!self.addAll && checked.count==0)
     {
-        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add To Wish List." controller:self] ;
+        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to Wish List." controller:self] ;
         return;
     }
+
     
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addWishBtn.enabled =false;
@@ -1846,9 +1882,9 @@
             self.select_count--;
             if(self.select_count==0)
             {
-                self.addWishBtn.enabled = false;
-                self.addCartBtn.enabled = false;
-                self.addPortfolioBtn.enabled=false;
+//                self.addWishBtn.enabled = false;
+//                self.addCartBtn.enabled = false;
+//                self.addPortfolioBtn.enabled=false;
             }
             [item setValue:@"false" forKey:@"checked"];
             
@@ -1861,9 +1897,9 @@
         else
         {
             self.select_count++;
-            self.addWishBtn.enabled = true;
-            self.addCartBtn.enabled = true;
-            self.addPortfolioBtn.enabled=true;
+//            self.addWishBtn.enabled = true;
+//            self.addCartBtn.enabled = true;
+//            self.addPortfolioBtn.enabled=true;
             [item setValue:@"true" forKey:@"checked"];
             currentSelecteCell.checkImageView.hidden = false;
             [currentSelecteCell setBackgroundColor: UIColorFromRGB(0x009966)];
@@ -2090,6 +2126,7 @@
     self.addAll = !self.addAll;
     if (self.addAll) {
         [self.addAllCheckBtn setImage:[[UIImage imageNamed:@"check_1_24"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
+        
     } else {
         [self.addAllCheckBtn setImage:[[UIImage imageNamed:@"check_0_24"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
     }