فهرست منبع

增加Notify Me开关,控制Model Detail及Place Order。

Pen Li 9 سال پیش
والد
کامیت
97e2884dc0

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


+ 17 - 10
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -299,19 +299,26 @@
                 }
                 else
                 {
-                    if ([self.class_name isEqualToString:@"CreateOrderViewController"]) {
+                    if (notifyMe_switch) {
                         
-                        NSString *err_msg = [editor_json valueForKey:@"err_msg"];
-                        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:err_msg preferredStyle:UIAlertControllerStyleAlert];
-                        __weak typeof(self) weakself = self;
-                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                        if ([self.class_name isEqualToString:@"CreateOrderViewController"]) {
                             
-                            [weakself.navigationController popViewControllerAnimated:YES];
+                            NSString *err_msg = [editor_json valueForKey:@"err_msg"];
+                            UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:err_msg preferredStyle:UIAlertControllerStyleAlert];
+                            __weak typeof(self) weakself = self;
+                            UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                                
+                                [weakself.navigationController popViewControllerAnimated:YES];
+                                
+                            }];
+                            [alertVC addAction:action];
                             
-                        }];
-                        [alertVC addAction:action];
-                        
-                        [self presentViewController:alertVC animated:YES completion:nil];
+                            [self presentViewController:alertVC animated:YES completion:nil];
+                            
+                        } else {
+                            
+                            [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:weakself] ;
+                        }
                         
                     } else {
                         

+ 63 - 55
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -967,76 +967,84 @@ self.isrefreshing=false;
         if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
             cell.btnaddPortfolio.hidden = YES;
             
-//            cell.btnNotifyMe.hidden = YES;
-//            CGRect wishListFrame = cell.btnaddWish.frame;
-//            CGRect cartFrame = cell.btnaddCart.frame;
-//            cartFrame.origin.x = wishListFrame.origin.x;
-//            cell.btnaddCart.frame = cartFrame;
-            
-            __weak typeof(self) weakself = self;
-            cell.notifyMeBlock = ^{
+            if (!notifyMe_switch) {
                 
-                NSString *emailAddr = [Singleton sharedInstance].customer_email;
+                cell.btnNotifyMe.hidden = YES;
+                CGRect wishListFrame = cell.btnaddWish.frame;
+                CGRect cartFrame = cell.btnaddCart.frame;
+                cartFrame.origin.x = wishListFrame.origin.x;
+                cell.btnaddCart.frame = cartFrame;
+            
+            } else {
                 
-                if (!emailAddr.length) {
+                cell.btnNotifyMe.hidden = NO;
+                __weak typeof(self) weakself = self;
+                cell.notifyMeBlock = ^{
                     
-                    [self showEmailAddrBox];
-                    
-                } else {
+                    NSString *emailAddr = [Singleton sharedInstance].customer_email;
                     
-                    UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waitting"];
-                    dispatch_async(dispatch_get_global_queue(0,0), ^{
-                       
-                        NSDictionary *dic = [iSalesNetwork notifyModel:self.product_id emailAddr:nil];
-                            
-                        dispatch_async(dispatch_get_main_queue(), ^{
+                    if (!emailAddr.length) {
+                        
+                        [self showEmailAddrBox];
+                        
+                    } else {
+                        
+                        UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waitting"];
+                        dispatch_async(dispatch_get_global_queue(0,0), ^{
                             
-                            [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
+                            NSDictionary *dic = [iSalesNetwork notifyModel:self.product_id emailAddr:nil];
                             
-                            if ([[dic valueForKey:@"result"] integerValue] != RESULT_TRUE) {
+                            dispatch_async(dispatch_get_main_queue(), ^{
                                 
-                                NSString *msg = [NSString stringWithFormat:@"The email send to %@ failed",emailAddr];
-                                if ([[dic valueForKey:@"result"] integerValue] == 8) {
-                                    if ([dic valueForKey:@"err_msg"]) {
-                                        msg = [dic valueForKey:@"err_msg"];
-                                    }
-                                }
+                                [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
                                 
-                                UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                                UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                                if ([[dic valueForKey:@"result"] integerValue] != RESULT_TRUE) {
                                     
-                                }];
-                                
-                                [errorAlertVC addAction:action];
-                                [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+                                    NSString *msg = [NSString stringWithFormat:@"The email send to %@ failed",emailAddr];
+                                    if ([[dic valueForKey:@"result"] integerValue] == 8) {
+                                        if ([dic valueForKey:@"err_msg"]) {
+                                            msg = [dic valueForKey:@"err_msg"];
+                                        }
+                                    }
+                                    
+                                    UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
+                                    UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                                        
+                                    }];
+                                    
+                                    [errorAlertVC addAction:action];
+                                    [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+                                    
+                                } else {
+                                    
+                                    [RAUtils message_alert:@"Notification is sent to default email" title:@"Message" controller:weakself];
+                                    
+                                }
+                            });
+                            
                             
-                            } else {
-                                
-                                [RAUtils message_alert:@"Notification is sent to default email" title:@"Message" controller:weakself];
-                                
-                            }
                         });
                         
-                        
-                    });
+                    }
                     
+                };
+                
+                cell.btnNotifyMe.layer.borderColor = [UIColor blackColor].CGColor;
+                cell.btnNotifyMe.layer.borderWidth = 1.0f;
+                cell.btnNotifyMe.layer.cornerRadius = 3.0f;
+                cell.btnNotifyMe.layer.masksToBounds = YES;
+                NSString *qtyStr = [section_json valueForKey:@"Availability"];
+                if (!qtyStr || !qtyStr.length || [qtyStr isEqualToString:@"In Production"] || [qtyStr isEqualToString:@"0"] || [qtyStr isEqualToString:@"Sold Out"]) {
+                    cell.btnaddCart.enabled = NO;
+                    cell.btnNotifyMe.alpha = 1.0;
+                    cell.btnNotifyMe.enabled = YES;
+                } else {
+                    cell.btnNotifyMe.enabled = NO;
+                    cell.btnNotifyMe.alpha = 0.4;
+                    cell.btnaddCart.enabled = YES;
                 }
+
                 
-            };
-            
-            cell.btnNotifyMe.layer.borderColor = [UIColor blackColor].CGColor;
-            cell.btnNotifyMe.layer.borderWidth = 1.0f;
-            cell.btnNotifyMe.layer.cornerRadius = 3.0f;
-            cell.btnNotifyMe.layer.masksToBounds = YES;
-            NSString *qtyStr = [section_json valueForKey:@"Availability"];
-            if (!qtyStr || !qtyStr.length || [qtyStr isEqualToString:@"In Production"] || [qtyStr isEqualToString:@"0"] || [qtyStr isEqualToString:@"Sold Out"]) {
-                cell.btnaddCart.enabled = NO;
-                cell.btnNotifyMe.alpha = 1.0;
-                cell.btnNotifyMe.enabled = YES;
-            } else {
-                cell.btnNotifyMe.enabled = NO;
-                cell.btnNotifyMe.alpha = 0.4;
-                cell.btnaddCart.enabled = YES;
             }
             
         } else {

+ 5 - 6
RedAnt ERP Mobile/iSales-NPD/Singleton.h

@@ -24,19 +24,18 @@ typedef enum {
 @property (nonatomic,assign) BOOL permissions_edit_order;///<编辑订单权限,Place Order
 @property (nonatomic,assign) BOOL permissions_submit_order;///<提交订单权限
 @property (nonatomic,assign) BOOL permissions_merge_order;///<合并订单权限
-
 @property (nonatomic,assign) NSInteger npd_shop_price_type;///<Shop设置的价格类型,0提货价、1统一卖价、 2计算价
-@property (nonatomic,copy) NSString *deliveryString;///<登陆成功后接收的提货价名称
+@property (nonatomic,  copy) NSString *deliveryString;///<登陆成功后接收的提货价名称
 // 使用枚举吗?Customer_Oder_Type
 @property (nonatomic,assign) NSInteger customer_order_type;///< 0 Shop Order/ 1 Sales Order,
-
 @property (nonatomic,assign) BOOL global_lock;///<全局锁,Yes表示订单不能查看Detail,需要密码验证Price Setting,Hide Price
 @property (nonatomic,assign) BOOL customer_can_see_sales_Order;///<是否有权查看Sales Order,控制Order List
 @property (nonatomic,strong) NSMutableDictionary *shop_order_status_filter;///<Shop Order Status
-@property (nonatomic,copy) NSString *specialInstruction;///<登陆时传的Special Instruction,在提交订单时显示
+@property (nonatomic,  copy) NSString *specialInstruction;///<登陆时传的Special Instruction,在提交订单时显示
 @property (nonatomic,assign) BOOL currentOrderIsMerged;///<当前打开的订单是否为Purchas Order
-@property (nonatomic,copy) NSString *customer_email;///<Customer邮箱地址,登录时保存
-#pragma mark - Employee 
+@property (nonatomic,  copy) NSString *customer_email;///<Customer邮箱地址,登录时保存
+
+#pragma mark - Employee
 
 
 

+ 2 - 1
RedAnt ERP Mobile/iSales-NPD/config.h

@@ -10,8 +10,9 @@
 #define RedAnt_ERP_Mobile_config_h
 #define BUILD_NPD
 
-//#define test_server
+#define test_server
 #define exception_switch 1
+#define notifyMe_switch 0
 
 //#define ab_lager @"Delivery price"
 #define flat_price @"MSRP"