فهرست منبع

All iOS app change to new message box module.
RA Image 1.22. fix some thread issue

Ray Zhang 3 سال پیش
والد
کامیت
e4c0731516
100فایلهای تغییر یافته به همراه2725 افزوده شده و 15466 حذف شده
  1. 31 4
      Ants Contract/Granite Expo eSign/Granite Expo eSign.xcodeproj/project.pbxproj
  2. 1 194
      Ants Contract/Granite Expo eSign/Granite Expo eSign/DocumentTemplateViewController.m
  3. 3 1
      Ants Contract/Granite Expo eSign/Granite Expo eSign/TemplateViewController.m
  4. 17 10
      Ants Contract/common/AddExtDocumentViewController.m
  5. 4 1
      Ants Contract/common/AppDelegate.m
  6. 12 5
      Ants Contract/common/DocnotesViewController.m
  7. 15 8
      Ants Contract/common/DocumentListViewController.m
  8. 17 178
      Ants Contract/common/DocumentPageViewController.m
  9. 26 51
      Ants Contract/common/LoginViewController.m
  10. 3 1
      Ants Contract/common/PageViewController.m
  11. 29 15
      Ants Contract/common/RootViewController.m
  12. 29 2
      RA Image/RA Image.xcodeproj/project.pbxproj
  13. 35 197
      RA Image/RA Image/BasicModeViewController.m
  14. 3 1
      RA Image/RA Image/LoginSettingViewController.m
  15. 16 42
      RA Image/RA Image/LoginViewController.m
  16. 13 39
      RA Image/RA Image/ModelModeViewController.m
  17. 6 3
      RA Image/RA Image/PODModeViewController.m
  18. 5 2
      RA Image/RA Image/PopModeViewController.m
  19. 6 2
      RA Image/RA Image/ReceivingPalletIDViewController.m
  20. 12 28
      RA Image/RA Image/RootViewController.m
  21. 0 91
      RA Image/RA Image/TakePhotoPreviewController.m
  22. 3 2
      RA Image/RA Image/UploadViewController.m
  23. 26 0
      RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/project.pbxproj
  24. 1 1
      RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist
  25. 91 659
      RedAnt ERP Mobile/HMLG Scan Order/CartViewController.m
  26. 23 16
      RedAnt ERP Mobile/HMLG Scan Order/ChangePasswordViewController.m
  27. 24 474
      RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m
  28. 17 0
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/MessageBox.h
  29. 245 0
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/MessageBox.m
  30. 26 0
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/PopWaitAlert.h
  31. 264 0
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/PopWaitAlert.m
  32. 45 0
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/RAPopviewContainer.h
  33. 116 0
      RedAnt ERP Mobile/HMLG Scan Order/MessageBox/RAPopviewContainer.m
  34. 6 151
      RedAnt ERP Mobile/HMLG Scan Order/ScanCartItemCell.m
  35. 2 48
      RedAnt ERP Mobile/HMLG Scan Order/ScanHomeViewController.m
  36. 1 2
      RedAnt ERP Mobile/HMLG Scan Order/ScanListCell.m
  37. 0 75
      RedAnt ERP Mobile/HMLG Scan Order/ScanModelListCell.m
  38. 6 7
      RedAnt ERP Mobile/HMLG Scan Order/ScanOrderModelListViewController.m
  39. 2 2
      RedAnt ERP Mobile/HMLG Scan Order/ScanOrderScanModelViewController.m
  40. 7 31
      RedAnt ERP Mobile/HMLG Scan Order/ScanSearchViewController.m
  41. 30 53
      RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m
  42. 19 150
      RedAnt ERP Mobile/HMLG Scan Order/SetupServerViewController.m
  43. 21 9
      RedAnt ERP Mobile/HMLG Scan Order/SignUpViewController.m
  44. 6 166
      RedAnt ERP Mobile/common/AppDelegateBase.m
  45. 31 381
      RedAnt ERP Mobile/common/CartUtils.m
  46. 27 11
      RedAnt ERP Mobile/common/ERP_Mobile_Cart.storyboard
  47. 43 290
      RedAnt ERP Mobile/common/Functions/MainViewController.m
  48. 18 804
      RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m
  49. 12 88
      RedAnt ERP Mobile/common/Functions/address/AddressEditorViewController.m
  50. 25 252
      RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m
  51. 11 40
      RedAnt ERP Mobile/common/Functions/cart/CartGeneralNotesViewController.m
  52. 76 677
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.m
  53. 9 119
      RedAnt ERP Mobile/common/Functions/cart/EditModelPriceViewController.m
  54. 13 40
      RedAnt ERP Mobile/common/Functions/cart/ItemNotesViewController.m
  55. 11 174
      RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m
  56. 2 1
      RedAnt ERP Mobile/common/Functions/cart/OrderDiscountViewController.m
  57. 80 524
      RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m
  58. 13 212
      RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.m
  59. 11 70
      RedAnt ERP Mobile/common/Functions/contact/CustomerEditViewController.m
  60. 21 217
      RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.m
  61. 2 47
      RedAnt ERP Mobile/common/Functions/home/HomeViewController.m
  62. 31 800
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m
  63. 35 376
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m
  64. 1 193
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m
  65. 26 248
      RedAnt ERP Mobile/common/Functions/offline/OfflineSettingViewController.m
  66. 6 9
      RedAnt ERP Mobile/common/Functions/offline/OfflineUnlockViewController.m
  67. 23 32
      RedAnt ERP Mobile/common/Functions/offline/SelectUploadOrderViewController.m
  68. 3 12
      RedAnt ERP Mobile/common/Functions/offline/SyncControlPanelViewController.m
  69. 88 417
      RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m
  70. 87 725
      RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m
  71. 85 581
      RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m
  72. 20 264
      RedAnt ERP Mobile/common/Functions/order/RAOrderEditorViewController.m
  73. 5 1119
      RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m
  74. 17 75
      RedAnt ERP Mobile/common/Functions/portfolio/PortfolioEditQTYViewController.m
  75. 12 101
      RedAnt ERP Mobile/common/Functions/portfolio/PortfolioListViewController.m
  76. 102 784
      RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m
  77. 32 464
      RedAnt ERP Mobile/common/Functions/portfolio/TearSheetParamViewController.m
  78. 74 647
      RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m
  79. 96 623
      RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m
  80. 8 22
      RedAnt ERP Mobile/common/Functions/sidemenu/CacheViewController.m
  81. 25 63
      RedAnt ERP Mobile/common/Functions/sidemenu/FunctionTestViewController.m
  82. 22 219
      RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m
  83. 8 38
      RedAnt ERP Mobile/common/Functions/sidemenu/RetrievePassViewController.m
  84. 4 17
      RedAnt ERP Mobile/common/Functions/sidemenu/ScannerSettingViewController.m
  85. 7 4
      RedAnt ERP Mobile/common/Functions/sidemenu/UserListViewController.m
  86. 5 14
      RedAnt ERP Mobile/common/Functions/signature/SignatureViewController.m
  87. 46 509
      RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m
  88. 22 57
      RedAnt ERP Mobile/common/Price Setting/PriceSettingViewController.m
  89. 11 56
      RedAnt ERP Mobile/common/Price Setting/SetCategoryPriceController.m
  90. 7 57
      RedAnt ERP Mobile/common/categoryMenu_RATree/RAViewController.m
  91. 12 94
      RedAnt ERP Mobile/common/customUI/ImageUploadViewController.m
  92. 4 7
      RedAnt ERP Mobile/common/customUI/ImageViewController.m
  93. 34 19
      RedAnt ERP Mobile/common/data_provider/RADataProvider.m
  94. 27 0
      RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/project.pbxproj
  95. 1 1
      RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist
  96. 10 146
      RedAnt ERP Mobile/iSales-CONTRAST/ContrastModelItemCell.m
  97. 3 2
      RedAnt ERP Mobile/iSales-CONTRAST/config.h
  98. 29 2
      RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj
  99. 27 0
      RedAnt ERP Mobile/iSales-USAI.xcodeproj/project.pbxproj
  100. 1 1
      Redant Drivers/Apex And Drivers/config.h

+ 31 - 4
Ants Contract/Granite Expo eSign/Granite Expo eSign.xcodeproj/project.pbxproj

@@ -7,6 +7,9 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		3C23B3DC29CACDA7008E7C14 /* PopWaitAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3D929CACDA7008E7C14 /* PopWaitAlert.m */; };
+		3C23B3DD29CACDA7008E7C14 /* MessageBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3DA29CACDA7008E7C14 /* MessageBox.m */; };
+		3C23B3DE29CACDA7008E7C14 /* RAPopviewContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3DB29CACDA7008E7C14 /* RAPopviewContainer.m */; };
 		3C2B045B253D27AD00B52A74 /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2B045A253D27AD00B52A74 /* RAUtils.m */; };
 		3C64CA9D29B8605C00CB0B07 /* GECI - Home Improvement Contract - Tan.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9529B8605B00CB0B07 /* GECI - Home Improvement Contract - Tan.pdf */; };
 		3C64CA9E29B8605C00CB0B07 /* GECI - Home Improvement Contract - Fong Huang.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9629B8605C00CB0B07 /* GECI - Home Improvement Contract - Fong Huang.pdf */; };
@@ -109,6 +112,12 @@
 
 /* Begin PBXFileReference section */
 		3C200FD6248A2165000E2FD5 /* RANetwork.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RANetwork.h; sourceTree = "<group>"; };
+		3C23B3D629CACDA7008E7C14 /* MessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageBox.h; sourceTree = "<group>"; };
+		3C23B3D729CACDA7008E7C14 /* PopWaitAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopWaitAlert.h; sourceTree = "<group>"; };
+		3C23B3D829CACDA7008E7C14 /* RAPopviewContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAPopviewContainer.h; sourceTree = "<group>"; };
+		3C23B3D929CACDA7008E7C14 /* PopWaitAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopWaitAlert.m; sourceTree = "<group>"; };
+		3C23B3DA29CACDA7008E7C14 /* MessageBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageBox.m; sourceTree = "<group>"; };
+		3C23B3DB29CACDA7008E7C14 /* RAPopviewContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAPopviewContainer.m; sourceTree = "<group>"; };
 		3C2B0459253D27AD00B52A74 /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = ../../../common/RAUtils.h; sourceTree = "<group>"; };
 		3C2B045A253D27AD00B52A74 /* RAUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUtils.m; path = ../../../common/RAUtils.m; sourceTree = "<group>"; };
 		3C64CA9529B8605B00CB0B07 /* GECI - Home Improvement Contract - Tan.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Tan.pdf"; sourceTree = "<group>"; };
@@ -298,6 +307,20 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		3C23B3D529CACDA7008E7C14 /* MessageBox */ = {
+			isa = PBXGroup;
+			children = (
+				3C23B3D629CACDA7008E7C14 /* MessageBox.h */,
+				3C23B3D729CACDA7008E7C14 /* PopWaitAlert.h */,
+				3C23B3D829CACDA7008E7C14 /* RAPopviewContainer.h */,
+				3C23B3D929CACDA7008E7C14 /* PopWaitAlert.m */,
+				3C23B3DA29CACDA7008E7C14 /* MessageBox.m */,
+				3C23B3DB29CACDA7008E7C14 /* RAPopviewContainer.m */,
+			);
+			name = MessageBox;
+			path = ../../../common/MessageBox;
+			sourceTree = "<group>";
+		};
 		42D49E531F8DF08400AE39D5 /* Template Attributes  */ = {
 			isa = PBXGroup;
 			children = (
@@ -525,6 +548,7 @@
 		7128C2B91E1250F000FF635B /* utils */ = {
 			isa = PBXGroup;
 			children = (
+				3C23B3D529CACDA7008E7C14 /* MessageBox */,
 				3C2B0459253D27AD00B52A74 /* RAUtils.h */,
 				3C2B045A253D27AD00B52A74 /* RAUtils.m */,
 				3C200FD6248A2165000E2FD5 /* RANetwork.h */,
@@ -745,6 +769,7 @@
 				3C9FFAAF274B908E0067830C /* RTLabel.m in Sources */,
 				42D49E721F8DFF5000AE39D5 /* AttributeTableDataSourceAndDelegate.m in Sources */,
 				42DDB8791F91DCE8002CCE22 /* ControlTemplateCell.m in Sources */,
+				3C23B3DD29CACDA7008E7C14 /* MessageBox.m in Sources */,
 				7128C2B81E1250CA00FF635B /* LineDrawable.m in Sources */,
 				42D49E641F8DFA3100AE39D5 /* PageItemCell.m in Sources */,
 				7128C2DB1E12510900FF635B /* zip.c in Sources */,
@@ -765,6 +790,7 @@
 				42D49E561F8DF13A00AE39D5 /* AttributeTextFieldCell.m in Sources */,
 				7115D4561E1606F700EF4E4C /* GEContractFilterViewController.m in Sources */,
 				7128C2DA1E12510900FF635B /* unzip.c in Sources */,
+				3C23B3DC29CACDA7008E7C14 /* PopWaitAlert.m in Sources */,
 				42D49E671F8DFA4B00AE39D5 /* PageSubItemCell.m in Sources */,
 				3C64CAAD29BB12C800CB0B07 /* RASingleton.m in Sources */,
 				42DDB8741F91C081002CCE22 /* ControlTemplateVC.m in Sources */,
@@ -778,6 +804,7 @@
 				7128C3551E12548C00FF635B /* SignatureListViewController.m in Sources */,
 				3CBB92F2248A26EB0099E429 /* NetworkUtils.m in Sources */,
 				714B37041E70F2BF00E99B90 /* ScannerControllerView.m in Sources */,
+				3C23B3DE29CACDA7008E7C14 /* RAPopviewContainer.m in Sources */,
 				7128C2EA1E12511B00FF635B /* NSData+CommonCrypto.m in Sources */,
 				7128C2B01E1250CA00FF635B /* TextDrawable.m in Sources */,
 				71BBFC371E6419D4008668A7 /* ExtDocumentsViewController.m in Sources */,
@@ -921,12 +948,12 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				CURRENT_PROJECT_VERSION = 53014;
+				CURRENT_PROJECT_VERSION = 53046;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "Granite Expo eSign/Info.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.73;
+				MARKETING_VERSION = 1.74;
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.Granite-Expo-eSign";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};
@@ -936,12 +963,12 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				CURRENT_PROJECT_VERSION = 53014;
+				CURRENT_PROJECT_VERSION = 53046;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "Granite Expo eSign/Info.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.73;
+				MARKETING_VERSION = 1.74;
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.Granite-Expo-eSign";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};

+ 1 - 194
Ants Contract/Granite Expo eSign/Granite Expo eSign/DocumentTemplateViewController.m

@@ -548,200 +548,7 @@
 //    [self.controlTemplate writeToFile:path atomically:NO];
     
     return;
-//    
-//    [self EndEditing];
-//    if(self.no_save)
-//    {
-//        [RAUtils message_alert:@"Can not save pending document under offline mode." title:@"Save document" controller:self] ;
-//        return;
-//    }
-//    
-//    if([self verifyData]==false)
-//    return;
-//    
-//    NSString* pdffile = nil;
-//    NSString* zipfile = nil;
-//    NSString* jsonfile = nil;
-//    // for(int l=0;l<1;l++)
-//    {
-//        
-//        if(self.hide_control)
-//        {
-//            pdffile = self.pdfPath;
-//        }
-//        else
-//        {
-//            pdffile = [PDFUtils SavePDF:self.controlTemplate source:self.document window_rect:CGRectMake(0, 0, 768, 960) name:self.docment_id isnew:self.action==PDFEditActionNew];
-//        }
-//        
-//        zipfile=[ACNetwork prepareUploadFile:pdffile json:self.controlTemplate];
-//        
-//        //jsonfile = [ACNetwork getjsonPath:zip];
-//        
-//    }
-//    
-//    __weak typeof(self) weakSelf = self;
-//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//    if(appDelegate.accessMode == AppAccessModeOffline)
-//    {
-//        
-//        NSMutableDictionary * json = [[NSMutableDictionary alloc]init];
-//        
-//        json[@"json"]=@"json.json";
-//        json[@"pdf"]=pdffile.lastPathComponent;
-//        json[@"zip"]=zipfile.lastPathComponent;
-//        json[@"serial"]=[json[@"zip"] stringByDeletingPathExtension];
-//        
-//        
-//        
-//        json[@"create_by"]=appDelegate.user;
-//        
-//        
-//        json[@"agent_name"]=[self extract_data:@"agent_name"];
-//        json[@"doc_number"]=[self extract_data:@"doc_number"];
-//        json[@"job_date"]=[self extract_data:@"job_date"];
-//        json[@"customer_name"]=[self extract_data:@"customer_name"];
-//        json[@"signed_date"]=[self extract_data:@"signed_date"];
-//        
-//        
-//        
-//        NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-//        NSMutableArray * arr_pending = [[defaults arrayForKey:@"pending_doc"] mutableCopy];
-//        if(arr_pending==nil)
-//        arr_pending = [[NSMutableArray alloc]init];
-//        [arr_pending addObject:json];
-//        [defaults setObject:arr_pending forKey:@"pending_doc"];
-//        [defaults synchronize];
-//        
-//        
-//        [weakSelf.navigationController popViewControllerAnimated:false];
-//        if(weakSelf.OnSave)
-//        weakSelf.OnSave(pdffile,@"");
-//        
-//    }
-//    else
-//    {
-//        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Saving"];
-//        
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* json = nil;
-//            
-//            
-//            
-//            json = [ACNetwork save_document:zipfile isnew:self.action==PDFEditActionNew md5:md5];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                
-//                
-//                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-//                //                if([[logout_json valueForKey:@"result"] intValue]==2)
-//                //                {
-//                //                    self.welcomeLabel.text=@"Not sign in";
-//                //                    //                        [sender setTitle:@"Sign in" forState:UIControlStateNormal];
-//                //                    [bbitem setTitle:@"Sign in"];
-//                //
-//                //                    self.buttonHIC.enabled = false;
-//                //                    self.buttonSRL.enabled = false;
-//                //                    self.coverView.hidden = false;
-//                //                }
-//                //                else
-//                //                {
-//                //                    [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
-//                //                }
-//                
-//                if([[json valueForKey:@"result"] intValue]==2)
-//                {
-//                    
-//                    
-//                    [weakSelf.navigationController popViewControllerAnimated:false];
-//                    if(weakSelf.OnSave)
-//                    weakSelf.OnSave(pdffile,json[@"subject"]);
-//                    
-//                    
-//                }
-//                else
-//                {
-//                    //                    [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save document" controller:self] ;
-//                    
-//                    if(self.hide_control)
-//                    {
-//                        //提交离线合同
-//                        [RAUtils message_alert:@"Can not upload pending documents please try again later." title:@"Save document" controller:self] ;
-//                        return;
-//                    }
-//                    
-//                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Create Customer" message:@"Can not create new customer on server, do you want to create an offline document?" preferredStyle:UIAlertControllerStyleAlert];
-//                    
-//                    
-//                    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-//                        __block NSString* offline_docnumber =[ACNetwork offline_docnumber];
-//                        if(offline_docnumber==nil)
-//                        {
-//                            [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
-//                            return;
-//                        }
-//                        [appDelegate SwitchToOffline:appDelegate.user];
-//                        
-//                        
-//                        NSMutableDictionary * json = [[NSMutableDictionary alloc]init];
-//                        
-//                        json[@"json"]=@"json.json";
-//                        json[@"pdf"]=pdffile.lastPathComponent;
-//                        json[@"zip"]=zipfile.lastPathComponent;
-//                        json[@"serial"]=[json[@"zip"] stringByDeletingPathExtension];
-//                        
-//                        
-//                        
-//                        json[@"create_by"]=appDelegate.user;
-//                        
-//                        
-//                        json[@"agent_name"]=[self extract_data:@"agent_name"];
-//                        json[@"doc_number"]=[self extract_data:@"doc_number"];
-//                        json[@"job_date"]=[self extract_data:@"job_date"];
-//                        json[@"customer_name"]=[self extract_data:@"customer_name"];
-//                        json[@"signed_date"]=[self extract_data:@"signed_date"];
-//                        
-//                        
-//                        
-//                        NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-//                        NSMutableArray * arr_pending = [[defaults arrayForKey:@"pending_doc"] mutableCopy];
-//                        if(arr_pending==nil)
-//                        arr_pending = [[NSMutableArray alloc]init];
-//                        [arr_pending addObject:json];
-//                        [defaults setObject:arr_pending forKey:@"pending_doc"];
-//                        [defaults synchronize];
-//                        
-//                        
-//                        [weakSelf.navigationController popViewControllerAnimated:false];
-//                        if(weakSelf.OnSave)
-//                        weakSelf.OnSave(pdffile,@"");
-//                        
-//                        
-//                    }];
-//                    
-//                    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-//                        DebugLog(@"Cancel");
-//                    }];
-//                    [alertControl addAction:actionOne];
-//                    
-//                    [alertControl addAction:alertthree];
-//                    
-//                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-//                    
-//                    
-//                    [self presentViewController:alertControl animated:YES completion:nil];
-//                    
-//                }
-//                
-//                
-//            });
-//        });
-//    }
-    
-    
-    
-    
+
     
     
 }

+ 3 - 1
Ants Contract/Granite Expo eSign/Granite Expo eSign/TemplateViewController.m

@@ -2011,7 +2011,9 @@ if (!update) {
             UITextField *name = alertControl.textFields.firstObject;
             if(![name.text isEqualToString:pwd])
             {
-                [RAUtils message_alert:@"You are not authorized to change this field" title:@"Authorization verification failed." controller:self];
+//                [RAUtils message_alert:@"You are not authorized to change this field" title:@"Authorization verification failed." controller:self];
+                [RAUtils message_box:@"Authorization verification failed." message:@"You are not authorized to change this field"  completion:nil];
+                
                 return;
             }
             else

+ 17 - 10
Ants Contract/common/AddExtDocumentViewController.m

@@ -231,22 +231,26 @@
     
 }
 - (IBAction)onAddFileClicked:(id)sender {
-    [RAUtils message_alert:@"To upload a file, you must share it from Third Party App." title:@"Upload" controller:self];
-//    [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
+//    [RAUtils message_alert:@"To upload a file, you must share it from Third Party App." title:@"Upload" controller:self];
+    [RAUtils message_box:@"Upload" message:@"To upload a file, you must share it from Third Party App." completion:nil];
+
     return;
 }
 - (IBAction)onUploadClicked:(id)sender {
     
     if(self.arr_documents.count==0)
     {
-        [RAUtils message_alert:@"Upload list is empty." title:@"Upload" controller:self];
+//        [RAUtils message_alert:@"Upload list is empty." title:@"Upload" controller:self];
+        [RAUtils message_box:@"Upload"  message:@"Upload list is empty."  completion:nil];
         return;
     }
     
     NSString* docNumber = self.editDocNumber.text;
     if(docNumber.length==0)
     {
-        [RAUtils message_alert:@"Document number is empty." title:@"Upload" controller:self];
+//        [RAUtils message_alert:@"Document number is empty." title:@"Upload" controller:self];
+        
+        [RAUtils message_box:@"Upload"  message:@"Document number is empty."  completion:nil];
         return;
     }
     
@@ -269,8 +273,8 @@
     
     __weak typeof(self) weakSelf = self;
     
-//    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Upload Documents"];
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Upload Documents" completion:^{
+    PopWaitAlert* pop =[RAUtils waiting_pop:@"Upload Documents" completion:nil];
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Upload Documents" completion:^{
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
             NSDictionary* json = nil;
@@ -285,7 +289,8 @@
                 
 //                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                [pop hide];
                     if([[json valueForKey:@"result"] intValue]==2)
                     {
                         NSMutableArray* arr = [json[@"documents"] mutableCopy];
@@ -308,9 +313,11 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Documents" controller:self] ;
+//                        [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Documents" controller:self] ;
+                        
+                        [RAUtils message_box:@"Upload Documents"  message:[json valueForKey:@"err_msg"]  completion:nil];
                     }
-                }];
+//                }];
 
                 
 
@@ -319,7 +326,7 @@
             });
         });
         
-    }];
+//    }];
     
     
 

+ 4 - 1
Ants Contract/common/AppDelegate.m

@@ -106,7 +106,10 @@
     NSLog(@"URL:%@, OPTIONS:%@",[url absoluteString],[RAConvertor dict2string:options]);
     
     if (self.accessMode == AppAccessModeOffline) {
-        [RAUtils message_alert:@"Cann't upload file on offline mode" title:@"Warning" controller:self.window.rootViewController];
+        
+        [RAUtils message_box:@"Warning" message:@"Cann't upload file on offline mode"  completion:nil];
+        
+//        [RAUtils message_alert:@"Cann't upload file on offline mode" title:@"Warning" controller:self.window.rootViewController];
         return NO;
     }
     

+ 12 - 5
Ants Contract/common/DocnotesViewController.m

@@ -67,7 +67,10 @@
     self.docNotes = self.tvNotes.text;
     
 //    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Update Notes"];
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update Notes" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update Notes" completion:^{
+    
+    
+    PopWaitAlert* pop =[RAUtils waiting_pop:@"Update Notes" completion:nil];
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
             
@@ -76,7 +79,9 @@
             dispatch_async(dispatch_get_main_queue(), ^{
 //                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     if([json[@"result"] intValue]==RESULT_TRUE)
                         
                     {
@@ -97,9 +102,11 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[json valueForKey:@"err_msg"]  title:@"Create Customer" controller:self] ;
+//                        [RAUtils message_alert:[json valueForKey:@"err_msg"]  title:@"Update Notes" controller:self] ;
+                        
+                        [RAUtils message_box:@"Update Notes"  message:[json valueForKey:@"err_msg"]  completion:nil];
                     }
-                }];
+//                }];
                 
                 
 
@@ -107,7 +114,7 @@
                 
             });
         });
-    }];
+//    }];
     
 
     

+ 15 - 8
Ants Contract/common/DocumentListViewController.m

@@ -412,7 +412,9 @@
         }
         else
         {
-            [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Document List" controller:self] ;
+//            [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Document List" controller:self] ;
+            
+            [RAUtils message_box:@"Loading Document List"  message:[content valueForKey:@"err_msg"]  completion:nil];
         }
 
         
@@ -1059,19 +1061,23 @@
          __weak typeof(self) weakSelf = self;
         DebugLog(@"modify click");
         
-//        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Downloading contract"];
+
+        PopWaitAlert* pop =[RAUtils waiting_pop:@"Download contract" completion:nil];
         
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Download contract" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Download contract" completion:^{
             dispatch_async(dispatch_get_global_queue(0, 0), ^{
                 NSData* jsondata= [NSData dataWithContentsOfURL:[NSURL URLWithString:jsonurl]];
                 NSData* pdfdata= [NSData dataWithContentsOfURL:[NSURL URLWithString:pdfurl]];
                 dispatch_async(dispatch_get_main_queue(), ^{
 //                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-                    [waitalert dismissViewControllerAnimated:YES completion:^{
+//                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                    
+                    [pop hide];
                         if(jsondata==nil||pdfdata==nil)
                         {
                             
-                            [RAUtils message_alert:@"Please try again."  title:@"Can not download contract" controller:self];
+//                            [RAUtils message_alert:@"Please try again."  title:@"Can not download contract" controller:self];
+                            [RAUtils message_box:@"Can not download contract"  message:@"Please try again."  completion:nil];
                             return;
                         }
                         
@@ -1086,7 +1092,8 @@
                         if(md51.length>0&&![md51 isEqualToString:md52])
                         {
                             
-                            [RAUtils message_alert:@"Please try again."  title:@"Can not download contract" controller:self];
+//                            [RAUtils message_alert:@"Please try again."  title:@"Can not download contract" controller:self];
+                            [RAUtils message_box:@"Can not download contract"  message:@"Please try again."  completion:nil];
                             return;
                         }
                         
@@ -1105,12 +1112,12 @@
                         };
                         
                         [self.navigationController pushViewController:dvc animated:true];
-                    }];
+//                    }];
 
                 });
 
             });
-        }];
+//        }];
 
         
         

+ 17 - 178
Ants Contract/common/DocumentPageViewController.m

@@ -533,7 +533,9 @@
     [self EndEditing];
     if(self.no_save)
     {
-     [RAUtils message_alert:@"Can not save pending document under offline mode." title:@"Save document" controller:self] ;
+//     [RAUtils message_alert:@"Can not save pending document under offline mode." title:@"Save document" controller:self] ;
+        
+        [RAUtils message_box:@"Save document" message:@"Can not save pending document under offline mode." completion:nil];
         return;
     }
     
@@ -602,8 +604,10 @@
     }
     else
     {
-//        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Saving"];
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving" completion:^{
+
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving" completion:^{
+        
+        PopWaitAlert* pop =[RAUtils waiting_pop:@"Saving..." completion:nil];
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                 
                 NSDictionary* json = nil;
@@ -616,7 +620,8 @@
                     
                     
 //                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-                    [waitalert dismissViewControllerAnimated:YES completion:^{
+//                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                         if([[json valueForKey:@"result"] intValue]==2)
                         {
                             
@@ -634,7 +639,9 @@
                             if(self.hide_control)
                             {
                                 //提交离线合同
-                                [RAUtils message_alert:@"Can not upload pending documents please try again later." title:@"Save document" controller:self] ;
+//                                [RAUtils message_alert:@"Can not upload pending documents please try again later." title:@"Save document" controller:self] ;
+                                
+                                [RAUtils message_box:@"Save document" message:@"Can not upload pending documents please try again later." completion:nil];
                                 return;
                             }
                             
@@ -645,7 +652,9 @@
                                 __block NSString* offline_docnumber =[RANetwork offline_docnumber];
                                 if(offline_docnumber==nil)
                                 {
-                                    [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
+//                                    [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
+                                    
+                                    [RAUtils message_box:@"Create Customer" message:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  completion:nil];
                                     return;
                                 }
                                 [appDelegate SwitchToOffline:RASingleton.sharedInstance.user];
@@ -700,7 +709,7 @@
                             [self presentViewController:alertControl animated:YES completion:nil];
                             
                         }
-                    }];
+//                    }];
                     //                if([[logout_json valueForKey:@"result"] intValue]==2)
                     //                {
                     //                    self.welcomeLabel.text=@"Not sign in";
@@ -721,7 +730,7 @@
                     
                 });
             });
-        }];
+//        }];
         
 
     }
@@ -734,176 +743,6 @@
         
     
 
-  //  return;
-    
-//    {
-//
-//
-//        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Saving"];
-//
-//
-////        self.uploadProgress.progress = 0;
-//        
-//        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//        
-//
-//        {
-//            
-//            //    UIAlertView * waitalert = [[UIAlertView alloc] initWithTitle:@"wait" message:@"uploading" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];
-//            //    [waitalert show];
-//            
-////            NSData *imageData = UIImagePNGRepresentation(self.imgview.image);
-//            
-//            AFHTTPRequestSerializer* serializer=[AFHTTPRequestSerializer serializer] ;
-//            
-//            
-//            
-//            NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
-//            
-////            if(appDelegate.user!=nil)
-////                [params setValue:appDelegate.user forKey:@"user"];
-////            //    if(appDelegate.contact_id!=nil)
-////            //        [params setValue:appDelegate.contact_id forKey:@"contactId"];
-////            if(appDelegate.password!=nil)
-////                [params setValue:appDelegate.password forKey:@"password"];
-//            
-//            
-//            [params setValue:[AESCrypt AES128Encrypt:appDelegate.user  key:@"usai2010"] forKey:@"user"];
-//            [params setValue:[AESCrypt AES128Encrypt:appDelegate.password  key:@"usai2010"] forKey:@"password"];
-//            
-//            [params setValue:@"deviceMain" forKey:@"_operate"];
-//            
-//            
-//            UIDevice * dev = [UIDevice currentDevice];
-//            NSUUID* uuid =dev.identifierForVendor;
-//#if TARGET_IPHONE_SIMULATOR//模拟器
-//            [params setValue:@"simulator_uuid" forKey:@"deviceid"];
-//#elif TARGET_OS_IPHONE//真机
-//            [params setValue:uuid.UUIDString forKey:@"deviceid"];
-//#endif
-//
-//            
-//            
-//            NSMutableString *body=[[NSMutableString alloc]init];
-//            //参数的集合的所有key的集合
-//            NSArray *keys= [params allKeys];
-//            DebugLog(@"================parms==================");
-//            //遍历keys
-//            for(int i=0;i<[keys count];i++)
-//            {
-//                //得到当前key
-//                NSString *key=[keys objectAtIndex:i];
-//                //如果key不是pic,说明value是字符类型,比如name:Boris
-//                if(![key isEqualToString:@"pic"])
-//                {
-////                    //添加分界线,换行
-////                    [body appendFormat:@"%@\r\n",MPboundary];
-//                    //添加字段名称,换2行
-//                    [body appendFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n",key];
-//                    //添加字段的值
-//                    [body appendFormat:@"%@\r\n",[params objectForKey:key]];
-//                    DebugLog(@"parameter: key=%@   value=%@",key,[params objectForKey:key]);
-//                }
-//            }
-//            DebugLog(@"================parms==================");
-//            
-//            NSData* data = [NSData dataWithContentsOfFile: zipfile];
-//            
-//            NSMutableURLRequest *request = [serializer multipartFormRequestWithMethod:@"POST" URLString:URL_UPLOAD_PDF parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
-//                [formData appendPartWithFileData:data name:@"upfile" fileName:[zipfile lastPathComponent] mimeType:@"application/zip"];
-//            } error:nil];
-//            
-//            
-//            //        NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:WEBSERVICE_URL parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
-//            //            [formData appendPartWithFileData:imageData name:@"upfile" fileName:@"test" mimeType:@"image/png"];
-//            //        } error:nil];
-//            //
-//            AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
-//            
-//            
-//            
-//            //manager.responseSerializer.acceptableContentTypes = [self.operationManager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
-//            
-//            //manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
-//            
-//            //
-//            NSProgress *progress = nil;
-//            
-//            NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithStreamedRequest:request progress:&progress completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
-//                
-//                //        [progress removeObserver:self forKeyPath:@"fractionCompleted"];
-//                
-//                
-//                 [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-//                
-//                if (error) {
-//                    
-//                    NSString* err_msg = [error localizedDescription];
-//                    DebugLog(@"%@",err_msg);// [self.view updateWithMessage:[NSString stringWithFormat:@"Error : %@!", error.debugDescription]];
-//                    
-//                    
-//                    NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-//                    
-//                    DebugLog(@"data string: %@",str);
-//                    [RAUtils message_alert:@"Can not connect to server please try again." title:@"Save document" controller:weakSelf] ;
-//                    
-//                } else {
-//                    DebugLog(@"response ");
-//                    
-//                    
-//                    
-//                    NSData *data = [NSJSONSerialization dataWithJSONObject:(NSDictionary*)responseObject options:kNilOptions error:nil];
-//                    
-//                    // 再将NSData转为字符串
-//                    NSString *jsonStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-//                    
-//                    //            NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-//                    
-//                    DebugLog(@"data string: %@",jsonStr);
-//                    
-//                    NSDictionary* json = responseObject;
-//                    
-//                    
-//                    
-//                    
-//                    if([[json valueForKey:@"result"] intValue]==2)
-//                    {
-//
-//                        [weakSelf.navigationController popToRootViewControllerAnimated:false];
-////
-////                        
-//                        if(weakSelf.OnSave)
-//                            weakSelf.OnSave(pdffile);
-//
-//                        
-//                    }
-//                    else
-//                    {
-//                        [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save document" controller:self] ;
-//                    }
-//                    
-//                    
-//                }
-//                //  [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-//            }];
-//            
-//            
-//            
-//            
-//          //  [self.uploadProgress setProgressWithUploadProgressOfTask:uploadTask animated:true];
-//            //
-//            
-//            
-//            
-//            
-//            
-//            
-//            [uploadTask resume];
-//            
-//        }
-//    }
-    
-  //  [PDFUtils savep
 }
 
 

+ 26 - 51
Ants Contract/common/LoginViewController.m

@@ -191,7 +191,9 @@
         
         
 //        [RAUtils alert_view:@"Username or Password cannot be blank." title:@"Cannot sign-in"];
-        [RAUtils message_alert:@"Username or Password cannot be blank." title:@"Cannot sign-in" controller:self];
+//        [RAUtils message_alert:@"Username or Password cannot be blank." title:@"Cannot sign-in" controller:self];
+        
+        [RAUtils message_box:@"Sign in"  message:@"Username or Password cannot be blank."  completion:nil];
         return;
     }
     DebugLog(@"Login...   user= %@ ; password= %@",user,password);
@@ -200,8 +202,13 @@
     
     
     self.btnLogin.enabled = false;
-//    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign in"];
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign in" completion:^{
+
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign in" completion:^{
+    
+    
+    
+    PopWaitAlert* pop =[RAUtils waiting_pop:@"Sign in" completion:nil];
+    
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
             
@@ -209,7 +216,15 @@
             
             dispatch_async(dispatch_get_main_queue(), ^{
 //                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                
+                
+                [pop hide];
+                
+                
+                
+                
                     self.btnLogin.enabled = true;
                     
                     if(ret==RESULT_TRUE)
@@ -218,7 +233,7 @@
                        
                         //
                         //                NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
-                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                         //                appDelegate.contact_id=contactid;
                         //                appDelegate.contact_name =[self.content_data[indexPath.row] valueForKey:@"name"];
                         
@@ -246,61 +261,21 @@
                             
                             [defaults setValue:encryptu forKey:@"user"];
                             [defaults setValue:encryptp forKey:@"password"];
-        //                    sqlite3 *db = [iSalesDB get_db];
-        //
-        //                    int count =[iSalesDB get_recordcount:db table:@"login_info" where:[NSString stringWithFormat:@"name='%@'",encryptu]];
-        //
-        //                    if(count==0)
-        //                    {
-        //
-        //                        NSString * savelogin=[NSString stringWithFormat:@"insert into login_info(name,pwd) values('%@','%@')",encryptu,encryptp];
-        //                        [iSalesDB execSql:savelogin db:db];
-        //                    }
-        //                    else
-        //                    {
-        //                        NSString * savelogin=[NSString stringWithFormat:@"update login_info set pwd='%@' where name='%@'",encryptp,encryptu];
-        //                        [iSalesDB execSql:savelogin db:db];
-        //                    }
-        //
-        //                    [iSalesDB close_db:db];
-                            
-                            //                    [defaults setBool:TRUE forKey:@"autologin"];
+
                         }
-        //                else
-        //                {
-        //                    NSString* sql=[NSString stringWithFormat:@"delete from login_info where name='%@'",encryptu];
-        //                    [iSalesDB execSql:sql];
-        //                }
+
                         [defaults synchronize];
                         
                         [self dismissViewControllerAnimated:YES completion:^{
                             
-        //                    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-                            
-        //                    bool offline_dirty=[defaults boolForKey:@"OFFLINE_DIRTY"];
-        //                    sqlite3* db = [iSalesDB get_db];
-        //                    int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
-        //
-        //                    [iSalesDB close_db:db];
-                            
-                            
-                            
 
-                          //  else
                             {
                             if(self.returnValue)
                                 self.returnValue(true);
-        //                    [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
                             }
                                 }];
 
 
-                        
-                        //                if (self.delegate && [self.delegate respondsToSelector:@selector(LoginViewControllerDidLogin:)]) {
-                        //                    [self.delegate LoginViewControllerDidLogin:self];
-                        //                }
-                        
-        //                [[NSNotificationCenter defaultCenter] postNotificationName:User_LoginOK_Notification object:nil];
                     }
                     else
                     {
@@ -335,19 +310,19 @@
                         
 //                        [RAUtils alert_view:msg title:@"Cannot sign-in"];
                         
-                        [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
-                        
+//                        [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
                         
+                        [RAUtils message_box:@"Cannot sign-in"  message:msg  completion:nil];
                         
                     }
-                }];
+//                }];
                 
                 
                 
                 
             });
         });
-    }];
+//    }];
 
     
     

+ 3 - 1
Ants Contract/common/PageViewController.m

@@ -2173,7 +2173,9 @@ typedef enum {
             UITextField *name = alertControl.textFields.firstObject;
             if(![name.text isEqualToString:pwd])
             {
-                [RAUtils message_alert:@"You are not authorized to change this field" title:@"Authorization verification failed." controller:self];
+//                [RAUtils message_alert:@"You are not authorized to change this field" title:@"Authorization verification failed." controller:self];
+                
+                [RAUtils message_box:@"Authorization verification failed." message:@"You are not authorized to change this field"  completion:nil];
                 return;
             }
             else

+ 29 - 15
Ants Contract/common/RootViewController.m

@@ -276,7 +276,8 @@
         
         if(offline_docnumber==nil)
         {
-            [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
+//            [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
+            [RAUtils message_box:@"Create Customer" message:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  completion:nil];
             return;
         }
         DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
@@ -301,9 +302,9 @@
         
         
         
-//        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Create customer"];
+        PopWaitAlert* pop =[RAUtils waiting_pop:@"Create customer" completion:nil];
         
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create customer" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create customer" completion:^{
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
             
@@ -316,7 +317,9 @@
 //                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
                 
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     if([json[@"result"] intValue]==RESULT_TRUE)
                         
                     {
@@ -345,7 +348,8 @@
                             __block NSString* offline_docnumber =[RANetwork offline_docnumber];
                             if(offline_docnumber==nil)
                             {
-                                [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
+//                                [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
+                                [RAUtils message_box:@"Create Customer" message:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  completion:nil];
                                 return;
                             }
                             [appDelegate SwitchToOffline:RASingleton.sharedInstance.user];
@@ -381,7 +385,7 @@
                         
                         
                     }
-                }];
+//                }];
                 
  
                 
@@ -389,7 +393,7 @@
             });
         });
         
-        }];
+//        }];
         
     }
     
@@ -403,7 +407,9 @@
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     if(appDelegate.accessMode == AppAccessModeOffline)
     {
-        [RAUtils message_alert:@"You can only access this function onder online mode." title:@"Offline mode." controller:self];
+//        [RAUtils message_alert:@"You can only access this function onder online mode." title:@"Offline mode." controller:self];
+        
+        [RAUtils message_box:@"Offline mode." message:@"You can only access this function onder online mode."  completion:nil];
         return;
     }
     
@@ -457,7 +463,8 @@
                     {
                         self.navigationItem.rightBarButtonItem = self.ibSignin;
                         [sw setOn: true];
-                        [RAUtils message_alert:@"User name is required." title:@"Can not switch to offline mode." controller:self];
+//                        [RAUtils message_alert:@"User name is required." title:@"Can not switch to offline mode." controller:self];
+                        [RAUtils message_box:@"Can not switch to offline mode."  message:@"User name is required."  completion:nil];
                     }
                     else
                     {
@@ -587,8 +594,11 @@
         UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
             
             
-//            UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign out"];
-            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+
+//            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+            
+            PopWaitAlert* pop =[RAUtils waiting_pop:@"Sign out" completion:nil];
+
                 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                     
                     NSDictionary* logout_json = nil;
@@ -602,7 +612,9 @@
                         
 //                        [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
                         
-                        [waitalert dismissViewControllerAnimated:YES completion:^{
+//                        [waitalert dismissViewControllerAnimated:YES completion:^{
+                        
+                        [pop hide];
                             if([[logout_json valueForKey:@"result"] intValue]==2)
                             {
                                 self.welcomeLabel.text=@"Not sign in";
@@ -615,9 +627,11 @@
                             }
                             else
                             {
-                                [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
+//                                [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
+                                
+                                [RAUtils message_box:@"Sign out"  message:[logout_json valueForKey:@"err_msg"]  completion:nil];
                             }
-                        }];
+//                        }];
 
                         
                         
@@ -625,7 +639,7 @@
                         
                     });
                 });
-            }];
+//            }];
             
             
             

+ 29 - 2
RA Image/RA Image.xcodeproj/project.pbxproj

@@ -7,6 +7,9 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		3C23B41829D68B4F008E7C14 /* PopWaitAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B41529D68B4F008E7C14 /* PopWaitAlert.m */; };
+		3C23B41929D68B4F008E7C14 /* MessageBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B41629D68B4F008E7C14 /* MessageBox.m */; };
+		3C23B41A29D68B4F008E7C14 /* RAPopviewContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B41729D68B4F008E7C14 /* RAPopviewContainer.m */; };
 		3C9CCF4A247E4B07006A49A5 /* UIImage+RedAnt.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9CCF48247E4B07006A49A5 /* UIImage+RedAnt.m */; };
 		3CBE7AE425469D9E000D520B /* ReceivingPalletIDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CBE7AE325469D9E000D520B /* ReceivingPalletIDViewController.m */; };
 		3CC5BEE0254D10CD00ECBE20 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3CC5BEDF254D10CD00ECBE20 /* Launch Screen.storyboard */; };
@@ -93,6 +96,12 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		3C23B41229D68B4F008E7C14 /* MessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageBox.h; sourceTree = "<group>"; };
+		3C23B41329D68B4F008E7C14 /* PopWaitAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopWaitAlert.h; sourceTree = "<group>"; };
+		3C23B41429D68B4F008E7C14 /* RAPopviewContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAPopviewContainer.h; sourceTree = "<group>"; };
+		3C23B41529D68B4F008E7C14 /* PopWaitAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopWaitAlert.m; sourceTree = "<group>"; };
+		3C23B41629D68B4F008E7C14 /* MessageBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageBox.m; sourceTree = "<group>"; };
+		3C23B41729D68B4F008E7C14 /* RAPopviewContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAPopviewContainer.m; sourceTree = "<group>"; };
 		3C9CCF48247E4B07006A49A5 /* UIImage+RedAnt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImage+RedAnt.m"; path = "../../common/UIImage/UIImage+RedAnt.m"; sourceTree = "<group>"; };
 		3C9CCF49247E4B07006A49A5 /* UIImage+RedAnt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImage+RedAnt.h"; path = "../../common/UIImage/UIImage+RedAnt.h"; sourceTree = "<group>"; };
 		3CBE7AE225469D9E000D520B /* ReceivingPalletIDViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReceivingPalletIDViewController.h; sourceTree = "<group>"; };
@@ -260,6 +269,20 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		3C23B41129D68B4F008E7C14 /* MessageBox */ = {
+			isa = PBXGroup;
+			children = (
+				3C23B41229D68B4F008E7C14 /* MessageBox.h */,
+				3C23B41329D68B4F008E7C14 /* PopWaitAlert.h */,
+				3C23B41429D68B4F008E7C14 /* RAPopviewContainer.h */,
+				3C23B41529D68B4F008E7C14 /* PopWaitAlert.m */,
+				3C23B41629D68B4F008E7C14 /* MessageBox.m */,
+				3C23B41729D68B4F008E7C14 /* RAPopviewContainer.m */,
+			);
+			name = MessageBox;
+			path = "../../RedAnt ERP Mobile/HMLG Scan Order/MessageBox";
+			sourceTree = "<group>";
+		};
 		3CBE7AE125469D36000D520B /* Receiving */ = {
 			isa = PBXGroup;
 			children = (
@@ -575,6 +598,7 @@
 		71114AA71EB1C51200D2200C /* util */ = {
 			isa = PBXGroup;
 			children = (
+				3C23B41129D68B4F008E7C14 /* MessageBox */,
 				42056E7B1EB989AB0010597A /* KeyboardListener */,
 				71114AB91EB1C71E00D2200C /* zip */,
 				71114AA81EB1C5C000D2200C /* aes */,
@@ -822,6 +846,7 @@
 				42CE45C4217D6D0D003ECD01 /* PODModeViewController.m in Sources */,
 				4203E60121BA5E88003E90BD /* RACameraViewController.m in Sources */,
 				71114AF01EB2DEF900D2200C /* RAMenu.m in Sources */,
+				3C23B41A29D68B4F008E7C14 /* RAPopviewContainer.m in Sources */,
 				71114AC61EB1C73B00D2200C /* ioapi.c in Sources */,
 				42056E7E1EB989AB0010597A /* JLKeyboardListener.m in Sources */,
 				71114AF11EB2DEF900D2200C /* ScannerControllerView.m in Sources */,
@@ -830,10 +855,12 @@
 				71114AB51EB1C5C800D2200C /* NSData+CommonCrypto.m in Sources */,
 				71114AC71EB1C73B00D2200C /* mztools.c in Sources */,
 				4203E61321BA65F5003E90BD /* PhotoPreviewCell.m in Sources */,
+				3C23B41829D68B4F008E7C14 /* PopWaitAlert.m in Sources */,
 				426E6B271EB85C4200942BE1 /* ModelModeViewController.m in Sources */,
 				4203E61021BA65F5003E90BD /* RAPhotoPreviewController.m in Sources */,
 				42A829C71EBC0FAC00898B8A /* ManufacturerCell.m in Sources */,
 				71DCDC3F1EAF234E00BA045A /* RootViewController.m in Sources */,
+				3C23B41929D68B4F008E7C14 /* MessageBox.m in Sources */,
 				42BC6FFA1EC1ACF9004A5F30 /* UploadSettingController.m in Sources */,
 				42A829C01EBC027100898B8A /* RootNavigationController.m in Sources */,
 				42CE45D1217D73E6003ECD01 /* SignatureViewController.m in Sources */,
@@ -1013,7 +1040,7 @@
 				INFOPLIST_FILE = "RA Image/Info.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.20;
+				MARKETING_VERSION = 1.22;
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.RA-Image";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1030,7 +1057,7 @@
 				INFOPLIST_FILE = "RA Image/Info.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.20;
+				MARKETING_VERSION = 1.22;
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.RA-Image";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";

+ 35 - 197
RA Image/RA Image/BasicModeViewController.m

@@ -48,7 +48,9 @@
                                    options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld)
                                    context:@"queue_status changed"];
     if (appdelegate.compressFile) {
-        [RAUtils message_alert:@"The photos will be compressed" title:@"Attention" controller:self];
+        
+        
+        [RAUtils message_box:@"Attention" message:@"The photos will be compressed" completion:nil];
     }
     
     self.title = self.name;
@@ -180,21 +182,7 @@
 
 - (void)showScanner {
     __weak typeof(self) weakself = self;
-//    ScannerViewController *scannerVC = [[UIStoryboard storyboardWithName:@"cam_scan" bundle:nil] instantiateViewControllerWithIdentifier:@"NewScannerViewController"];
-//    scannerVC.returnCode = ^(NSString *code) {
-//        // 扫描成功保存扫描值
-//        if (code.length) {
-//
-//            if (weakself) {
-//                __strong typeof(weakself) strongself = weakself;
-//
-//                strongself.barcode = code;
-//            }
-//
-//        }
-//    };
-//    [self presentViewController:scannerVC animated:YES completion:nil];
-    
+
     RAQRCodeScannerViewController *scannerVC = [RAQRCodeScannerViewController viewControllerFromStoryboard];
     scannerVC.QRCodeViewControllerDidCompletion = ^(RAQRCodeScannerViewController *qrcodeViewController, NSString *value) {
 
@@ -220,7 +208,9 @@
 
 - (void)showCamera {
     if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
-        [RAUtils message_alert:@"Camera is not available" title:@"Warning" controller:self];
+        
+        
+        [RAUtils message_box:@"Warning" message:@"Camera is not available" completion:nil];
         return;
     }
     //相机权限
@@ -236,7 +226,9 @@
             NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
             NSString *appName = [infoDict objectForKey:@"CFBundleName"];
             
-            [RAUtils message_alert:[NSString stringWithFormat:@"%@ need Authorization to use Camera",appName] title:@"Warning" controller:self];
+            
+            
+            [RAUtils message_box:@"Warning" message:[NSString stringWithFormat:@"%@ need Authorization to use Camera",appName] completion:nil];
         }
         return;
     }
@@ -273,72 +265,14 @@
     
     [self.navigationController pushViewController:cameraVC animated:YES];
     
-//    UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
-//    imgPicker.delegate = self;
-//    
-//    imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
-//    imgPicker.allowsEditing = YES;
-//    [self presentViewController:imgPicker animated:YES completion:nil];
-
-    
-//    CGFloat w = CGRectGetWidth(self.view.frame);
-//    CGFloat h = CGRectGetHeight(self.view.frame);
-//    if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
-//        // 修复横屏时打开相机Control位置不正确
-//        CGFloat tmp = w;
-//        w = h;
-//        h = tmp;
-//    }
-//    // 自定义相机控制视图
-//    UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
-//    imgPicker.delegate = self;
-//    imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
-//    imgPicker.allowsEditing = NO;
-//    imgPicker.showsCameraControls  = NO;
-//    UIView* overlay = [[UIView alloc]initWithFrame:CGRectMake(0, h - 150 , w, 150)];
-//
-//    // Cancel
-//    UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-//    cancelBtn.frame = CGRectMake(20, (150 - 40) * 0.5, 60, 40);
-//    [cancelBtn setTitle:@"cancel" forState:UIControlStateNormal];
-//    [cancelBtn addTarget:self action:@selector(cancelCameraClick:) forControlEvents:UIControlEventTouchUpInside];
-//    [overlay addSubview:cancelBtn];
-//
-//    // Take
-//    UIButton *takeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-//    takeBtn.frame = CGRectMake((w - 60) * 0.5, (150 - 60) * 0.5, 60, 60);
-////    [takeBtn setTitle:@"take" forState:UIControlStateNormal];
-//    [takeBtn setImage:[UIImage imageNamed:@"take_photo"] forState:UIControlStateNormal];
-//    [takeBtn addTarget:self action:@selector(takePhotoClick:) forControlEvents:UIControlEventTouchUpInside];
-//    [overlay addSubview:takeBtn];
-//
-//    // flash
-//    UIButton *flashBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-//    flashBtn.frame = CGRectMake(w - 80, (150 - 60) * 0.5, 60, 60);
-//    [flashBtn setImage:[UIImage imageNamed:@"flash_auto"] forState:UIControlStateNormal];
-//    [flashBtn addTarget:self action:@selector(flashBtnClick:) forControlEvents:UIControlEventTouchUpInside];
-//    [overlay addSubview:flashBtn];
-//
-////    // camera
-////    UIButton *cameraChangeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-////    cameraChangeBtn.frame = CGRectMake(220, 10, 60, 40);
-////    [cameraChangeBtn setTitle:@"change" forState:UIControlStateNormal];
-////    [cameraChangeBtn addTarget:self action:@selector(cameraChangeClick:) forControlEvents:UIControlEventTouchUpInside];
-////    [overlay addSubview:cameraChangeBtn];
-//
-//
-//    // 相机属性设置得在设置SourceType后设置
-//    imgPicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
-//    //把自定义的view设置到imagepickercontroller的overlay属性中
-//    imgPicker.cameraOverlayView = overlay;
-//
-//    self.imgPicker = imgPicker;
-//    [self presentViewController:imgPicker animated:YES completion:nil];
+
 }
 
 - (void)showPhotoLibrary {
     if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
-        [RAUtils message_alert:@"Photo Library is not available" title:@"Warning" controller:self];
+       
+        
+        [RAUtils message_box:@"Warning" message:@"Photo Library is not available" completion:nil];
         return;
     }
     //相册权限
@@ -351,7 +285,9 @@
         } else {
             NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
             NSString *appName = [infoDict objectForKey:@"CFBundleName"];
-            [RAUtils message_alert:[NSString stringWithFormat:@"%@ need Authorization to use photo library",appName] title:@"Warning" controller:self];
+            
+            
+            [RAUtils message_box:@"Warning" message:[NSString stringWithFormat:@"%@ need Authorization to use photo library",appName] completion:nil];
         }
         return;
     }
@@ -420,34 +356,6 @@
     return nil;
 }
 
-//- (void)loadSavedPhotoCount {
-//    NSString *dir = [NSString stringWithFormat:@"%@/%@",[RAUtils appCacheDirectory],self.name];
-//    NSFileManager *manager = [NSFileManager defaultManager];
-//    NSArray *files = [manager contentsOfDirectoryAtPath:dir error:nil];
-//    if (files.count) {
-//        NSMutableArray *photos = [NSMutableArray array];
-//        for (NSString *name in files) {
-//            if ([name hasSuffix:@".png"]) {
-//                NSString *path = [dir stringByAppendingPathComponent:name];
-//                UIImage *img = [UIImage imageWithContentsOfFile:path];
-//                NSString *md5 = [RAUtils md5WithFile:path];
-//                NSDictionary *photoDic = @{
-//                                           @"photo" : img,
-//                                           @"check" : @(NO),
-//                                           @"path"  : path,
-//                                           @"md5"   : md5
-//                                           };
-//                [photos addObject:photoDic];
-//            }
-//        }
-//        self.photoCount = photos.count;
-//        self.photos = photos;
-//    } else {
-//        self.photoCount = 0;
-//        self.photos = nil;
-//    }
-//}
-
 - (void)clearPhotos {
     [self.photos removeAllObjects];
     self.photoCount = 0;
@@ -456,27 +364,6 @@
 #pragma mark - Public Method
 
 - (void)clickCameraButton {
-//    __weak typeof(self) weakself = self;
-//    
-//    
-//    UIAlertController *aler = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-//    UIAlertAction *library = [UIAlertAction actionWithTitle:@"Camera" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-//        [weakself showCamera];
-//    }];
-//    
-//    UIAlertAction *camera = [UIAlertAction actionWithTitle:@"Photo Library" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-//        [weakself showPhotoLibrary];
-//    }];
-//    
-//    UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
-//        
-//    }];
-//    
-//    [aler addAction:library];
-//    [aler addAction:camera];
-//    [aler addAction:cancel];
-//    
-//    [self presentViewController:aler animated:YES completion:nil];
     [self showCamera];
 }
 
@@ -631,7 +518,9 @@
                             [weakself.photos insertObject:photoDic atIndex:0];
                             weakself.photoCount++;
                         } else {
-                            [RAUtils message_alert:@"Save photo failed, storage full?" title:@"Warning" controller:weakPreVC];
+                            
+                            
+                            [RAUtils message_box:@"Warning" message:@"Save photo failed, storage full?" completion:nil];
                         }
                     });
                     
@@ -663,7 +552,8 @@
                     [self.photos insertObject:photoDic atIndex:0];
                     self.photoCount++;
                 } else {
-                    [RAUtils message_alert:@"Save photo failed, storage full?" title:@"Warning" controller:self];
+                    
+                    [RAUtils message_box:@"Warning" message:@"Save photo failed, storage full?" completion:nil];
                 }
             });
             
@@ -702,10 +592,14 @@
     __weak typeof(self) weakself = self;
     NSString* title=[@"Verify " stringByAppendingString:self.barcodeTitle];
     
-    __block UIAlertController* alertc = [RAUtils waiting_alert:self title:title completion:^{
+//    __block UIAlertController* alertc = [RAUtils waiting_alert:self title:title completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:title completion:nil];
         [RANetwork request_verify:params completionHandler:^(NSMutableDictionary *result_json) {
             //                        [alert dismissWithClickedButtonIndex:0 animated:YES];
-            [alertc dismissViewControllerAnimated:YES completion:^{
+//            [alertc dismissViewControllerAnimated:YES completion:^{
+            
+            [pop hide];
                 int result = [[result_json objectForKey:@"result"] intValue];
                 //                BOOL rememberLogin = [[strongself userDefaultsValue:kRememberLogin] boolValue];
                 //                [self addTasks];
@@ -715,14 +609,17 @@
                     {
                         //code not exist;
                         
-                        [RAUtils message_alert:weakself.verify_msg0 title:@"Warring" controller:weakself];
+                        
+                        
+                        [RAUtils message_box:@"Warning" message:weakself.verify_msg0 completion:nil];
                         //                            [weakself.view makeToast:weakself.verify_msg0 duration:3.0 position:CSToastPositionCenter];
                         break;
                     }
                     case 1:
                     {
                         
-                        [RAUtils message_alert:@"Model/Manufacturer does not match" title:@"Warring" controller:weakself];
+                        
+                        [RAUtils message_box:@"Warning" message:@"Model/Manufacturer does not match" completion:nil];
                         //                                                    [weakself.view makeToast:@"Model/Manufacturer does not match" duration:3.0 position:CSToastPositionCenter];
                         break;
                     }
@@ -751,71 +648,12 @@
                     default:
                         break;
                 }
-            }];
+//            }];
             
             
         }];
         
-//        dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//            //    if (weakself) {
-//        //            __strong typeof(weakself) strongself = weakself;
-//                    NSDictionary *result_json = [RANetwork Verify:params];
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-////                        [alert dismissWithClickedButtonIndex:0 animated:YES];
-//                        [alertc dismissViewControllerAnimated:YES completion:^{
-//                            int result = [[result_json objectForKey:@"result"] intValue];
-//                            //                BOOL rememberLogin = [[strongself userDefaultsValue:kRememberLogin] boolValue];
-//                            //                [self addTasks];
-//                            //                return;
-//                                            switch (result) {
-//                                                case 0:
-//                                                {
-//                                                    //code not exist;
-//
-//                                                    [RAUtils message_alert:weakself.verify_msg0 title:@"Warring" controller:weakself];
-//                            //                            [weakself.view makeToast:weakself.verify_msg0 duration:3.0 position:CSToastPositionCenter];
-//                                                    break;
-//                                                }
-//                                                case 1:
-//                                                {
-//
-//                                                    [RAUtils message_alert:@"Model/Manufacturer does not match" title:@"Warring" controller:weakself];
-//                            //                                                    [weakself.view makeToast:@"Model/Manufacturer does not match" duration:3.0 position:CSToastPositionCenter];
-//                                                    break;
-//                                                }
-//                                                case 2:
-//                                                {
-//                                                    //upload;
-//                                                    [self addTasks];
-//                                                    break;
-//                                                }
-//                                                case RESULT_NET_ERROR:
-//                                                {
-//                                                    __weak typeof(self) weakSelf = self;
-//                                                    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"Can not connect to server,still upload?" preferredStyle:UIAlertControllerStyleAlert];
-//                                                    UIAlertAction *yesAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-//                                                        [weakSelf addTasks];
-//                                                    }];
-//
-//                                                    UIAlertAction *noAction = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
-//
-//                                                    }];
-//                                                    [alertVC addAction:yesAction];
-//                                                    [alertVC addAction:noAction];
-//                                                    [self presentViewController:alertVC animated:yesAction completion:nil];
-//
-//                                                }
-//                                                default:
-//                                                    break;
-//                                            }
-//                        }];
-//
-//
-//                    });
-//
-//              //  }
-//            });
-    }];
+//    }];
 //    UIAlertView *alert = [RAUtils waiting_alert:@"Please wait" title:title];
     
 }

+ 3 - 1
RA Image/RA Image/LoginSettingViewController.m

@@ -201,7 +201,9 @@
         else {
             
             
-            [RAUtils message_alert:@"Wrong QR-CODE?" title:@"Can not setup server" controller:self];
+            
+            
+            [RAUtils message_box:@"Can not setup server" message:@"Wrong QR-CODE?" completion:nil];
             
 //            [RAUtils alert_view:@"Wrong QR-CODE?" title:@"Can not setup server"];
             //                    strongself.nameTextField.text = nil;

+ 16 - 42
RA Image/RA Image/LoginViewController.m

@@ -196,17 +196,20 @@ static NSString *kLoginUserInfo = @"UserInfo";
 - (IBAction)loginBtnClick:(UIButton *)sender {
     [self prepareUserData];
     if (!self.address.length) {
-        [RAUtils message_alert:@"Please choose an address in setting" title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"Please choose an address in setting" completion:nil];
         return;
     }
     
     if (!self.user.length) {
-        [RAUtils message_alert:@"User name cannot be blank" title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"User name cannot be blank" completion:nil];
         return;
     }
     
     if (!self.pwd.length) {
-        [RAUtils message_alert:@"Password cannot be blank" title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"Password cannot be blank" completion:nil];
         return;
     }
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
@@ -214,12 +217,15 @@ static NSString *kLoginUserInfo = @"UserInfo";
 //    __weak typeof(self) weakself = self;
     
 //    UIAlertView *alert = [RAUtils waiting_alert:@"Please wait" title:@"Login"];
-   __block UIAlertController* alert = [RAUtils waiting_alert:self title:@"Login" completion:^{
+//   __block UIAlertController* alert = [RAUtils waiting_alert:self title:@"Login" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Login" completion:nil];
        
        [RANetwork request_login:self.user password:self.pwd completionHandler:^(NSMutableDictionary *result) {
        //                    [alert dismissWithClickedButtonIndex:0 animated:YES];
                            
-                           [alert dismissViewControllerAnimated:YES completion:^{
+//                           [alert dismissViewControllerAnimated:YES completion:^{
+           [pop hide];
                                int result_code = [[result objectForKey:@"result"] intValue];
                                BOOL rememberLogin = [[self userDefaultsValue:kRememberLogin] boolValue];
                                if (result_code == RESULT_TRUE) {
@@ -237,49 +243,17 @@ static NSString *kLoginUserInfo = @"UserInfo";
                                    [appDelegate showNormalRootVC];
                                } else {
                                    NSString *msg = [result objectForKey:@"err_msg"];
-                                   [RAUtils message_alert:msg title:@"Warning" controller:self];
+                                   
+                                   
+                                   [RAUtils message_box:@"Warning" message:msg completion:nil];
                                }
-                           }];
+//                           }];
                            
                            
                        }];
        
        
-//        dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//            if (weakself) {
-//                __strong typeof(weakself) strongself = weakself;
-//                NSDictionary *loginDic = [RANetwork Login:strongself.user password:strongself.pwd];
-//                dispatch_async(dispatch_get_main_queue(), ^{
-////                    [alert dismissWithClickedButtonIndex:0 animated:YES];
-//
-//                    [alert dismissViewControllerAnimated:YES completion:^{
-//                        int result = [[loginDic objectForKey:@"result"] intValue];
-//                        BOOL rememberLogin = [[strongself userDefaultsValue:kRememberLogin] boolValue];
-//                        if (result == RESULT_TRUE) {
-//                            if (!rememberLogin) {
-//                                [self setUserDefaultsValue:nil forKey:kLoginUserInfo];
-//                            } else {
-//                                [strongself setUserDefaultsValue:@{@"address" : strongself.address,@"user" : strongself.user,@"pwd" : strongself.pwd} forKey:kLoginUserInfo];
-//                            }
-//                            appDelegate.bLogin = YES;
-//                            appDelegate.user = strongself.user;
-//                            appDelegate.password = strongself.pwd;
-//                            appDelegate.companyName = [loginDic objectForKey:@"company_name"];
-//                            [appDelegate loadCompanyIcon:[loginDic objectForKey:@"company_icon"]];
-//                            appDelegate.modeList = [loginDic objectForKey:@"modellist"];
-//                            [appDelegate showNormalRootVC];
-//                        } else {
-//                            NSString *msg = [loginDic objectForKey:@"err_msg"];
-//                            [RAUtils message_alert:msg title:@"Warning" controller:strongself];
-//                        }
-//                    }];
-//
-//
-//                });
-//
-//            }
-//        });
-    }];
+//    }];
     
 }
 

+ 13 - 39
RA Image/RA Image/ModelModeViewController.m

@@ -100,16 +100,19 @@
     
     if(self.barcode.length ==0)
     {
-        [RAUtils message_alert:[NSString stringWithFormat:@"%@ cannot be blank",self.barcodeTitle] title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:[NSString stringWithFormat:@"%@ cannot be blank",self.barcodeTitle] completion:nil];
         return;
     }
     if(self.photos.count ==0)
     {
-        [RAUtils message_alert:@"You must take at least one photo." title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"You must take at least one photo." completion:nil];
         return;
     }
     if (self.manufacturerList.count && self.manufacturer.length == 0) {
-        [RAUtils message_alert:@"Manufacturer does not set." title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"Manufacturer does not set." completion:nil];
         return;
     }
 
@@ -242,11 +245,13 @@
     // 从服务器取Manufacture
     if (barcode.length > 0) {
         
-        __block UIAlertController* alertc=[RAUtils waiting_alert:self title:@"Loading model's manufacturers" completion:^{
-            
+//        __block UIAlertController* alertc=[RAUtils waiting_alert:self title:@"Loading model's manufacturers" completion:^{
+            PopWaitAlert* pop = [RAUtils waiting_pop:@"Loading model's manufacturers" completion:nil];
             [RANetwork request_modelmanufacture:barcode completionHandler:^(NSMutableDictionary *modelManufacturs) {
                 //                    [alert dismissWithClickedButtonIndex:0 animated:YES];
-                [alertc dismissViewControllerAnimated:YES completion:^{
+//                [alertc dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     int result = [[modelManufacturs objectForKey:@"result"] intValue];
                     if (result == 2) {
                         NSArray *manufacturs = [modelManufacturs objectForKey:@"manufacturer"];
@@ -267,42 +272,11 @@
                         self.manufacturerList = self.oldManufacturerList;
                         self.manufacturer = nil;
                     }
-                }];
+//                }];
                 
             }];
             
-//            dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//                NSDictionary *modelManufacturs = [RANetwork getModelManufacture:barcode];
-//                dispatch_async(dispatch_get_main_queue(), ^{
-////                    [alert dismissWithClickedButtonIndex:0 animated:YES];
-//                    [alertc dismissViewControllerAnimated:YES completion:^{
-//                        int result = [[modelManufacturs objectForKey:@"result"] intValue];
-//                                           if (result == 2) {
-//                                               NSArray *manufacturs = [modelManufacturs objectForKey:@"manufacturer"];
-//                                               if (manufacturs.count > 0) {
-//                                                   self.manufacturerList = manufacturs;
-//                                                   NSString *manufacter = nil;
-//                                                   if (manufacturs.count == 1) {
-//                                                       manufacter = [manufacturs objectAtIndex:0];
-//                                                   } else {
-//                                                       manufacter = nil;
-//                                                   }
-//                                                   self.manufacturer = manufacter;
-//                                               } else {
-//                                                   self.manufacturerList = manufacturs;
-//                                                   self.manufacturer = nil;
-//                                               }
-//                                           } else {
-//                                               self.manufacturerList = self.oldManufacturerList;
-//                                               self.manufacturer = nil;
-//                                           }
-//                    }];
-//
-//                });
-//
-//
-//            });
-        }];
+//        }];
         
       
         

+ 6 - 3
RA Image/RA Image/PODModeViewController.m

@@ -131,16 +131,19 @@
     // check piid, photo...
     if(self.barcode.length ==0)
     {
-        [RAUtils message_alert:[NSString stringWithFormat:@"%@ cannot be blank",self.barcodeTitle] title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:[NSString stringWithFormat:@"%@ cannot be blank",self.barcodeTitle] completion:nil];
         return;
     }
     if(self.photos.count ==0)
     {
-        [RAUtils message_alert:@"You must take at least one photo." title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"You must take at least one photo." completion:nil];
         return;
     }
     if (self.signature == nil) {
-        [RAUtils message_alert:@"Signature is missing." title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"Signature is missing." completion:nil];
         return;
     }
     

+ 5 - 2
RA Image/RA Image/PopModeViewController.m

@@ -74,12 +74,15 @@
     // check piid, photo...
     if(self.barcode.length ==0)
     {
-    [RAUtils message_alert:[NSString stringWithFormat:@"%@ cannot be blank",self.barcodeTitle] title:@"Warning" controller:self];
+    
+        
+        [RAUtils message_box:@"Warning" message:[NSString stringWithFormat:@"%@ cannot be blank",self.barcodeTitle] completion:nil];
     return;
     }
     if(self.photos.count ==0)
     {
-        [RAUtils message_alert:@"You must take at least one photo." title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"You must take at least one photo." completion:nil];
         return;
     }
     

+ 6 - 2
RA Image/RA Image/ReceivingPalletIDViewController.m

@@ -75,12 +75,16 @@
     // check piid, photo...
     if(self.barcode.length ==0)
     {
-    [RAUtils message_alert:[NSString stringWithFormat:@"%@ cannot be blank",self.barcodeTitle] title:@"Warning" controller:self];
+    
+        
+        [RAUtils message_box:@"Warning" message:[NSString stringWithFormat:@"%@ cannot be blank",self.barcodeTitle] completion:nil];
     return;
     }
     if(self.photos.count ==0)
     {
-        [RAUtils message_alert:@"You must take at least one photo." title:@"Warning" controller:self];
+        
+        
+        [RAUtils message_box:@"Warning" message:@"You must take at least one photo." completion:nil];
         return;
     }
     

+ 12 - 28
RA Image/RA Image/RootViewController.m

@@ -217,7 +217,9 @@ static NSString *kLastMode = @"lastChooseMode";
     //如果是Redant Mobile 集成的,就没有logout
     
     
-    __block UIAlertController* alertcontroller= [RAUtils waiting_alert:self title:@"Logout" completion:^{
+//    __block UIAlertController* alertcontroller= [RAUtils waiting_alert:self title:@"Logout" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Logout" completion:nil];
         __weak typeof(self) weakself = self;
         [RANetwork request_logout:^(NSMutableDictionary *resulti) {
             
@@ -225,17 +227,21 @@ static NSString *kLastMode = @"lastChooseMode";
             int result = [[logoutDic objectForKey:@"result"] intValue];
             dispatch_async(dispatch_get_main_queue(), ^{
                 //                   [alert dismissWithClickedButtonIndex:0 animated:YES];
-                [alertcontroller dismissViewControllerAnimated:true completion:^{
+//                [alertcontroller dismissViewControllerAnimated:true completion:^{
+                
+                [pop hide];
                     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
                     if (result == RESULT_TRUE) {
                         weakself.companyIcon = [UIImage imageNamed:@"AppIcon40x40"];
                         [appDelegate logout];
                     } else {
-                        __strong typeof(weakself) strongself = weakself;
+                        
                         NSString *msg = [logoutDic objectForKey:@"err_msg"];
-                        [RAUtils message_alert:msg title:@"Warning" controller:strongself];
+                        
+                        
+                        [RAUtils message_box:@"Warning" message:msg completion:nil];
                     }
-                }];
+//                }];
                 
             });
             
@@ -250,29 +256,7 @@ static NSString *kLastMode = @"lastChooseMode";
         
         
         
-        //           dispatch_async(dispatch_get_main_queue(), ^{
-        //
-        //               NSDictionary *logoutDic = [RANetwork logout];
-        //               int result = [[logoutDic objectForKey:@"result"] intValue];
-        //               dispatch_async(dispatch_get_main_queue(), ^{
-        ////                   [alert dismissWithClickedButtonIndex:0 animated:YES];
-        //                   [alertcontroller dismissViewControllerAnimated:true completion:^{
-        //                       AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-        //                       if (result == RESULT_TRUE) {
-        //                           weakself.companyIcon = [UIImage imageNamed:@"AppIcon40x40"];
-        //                           [appDelegate logout];
-        //                       } else {
-        //                           __strong typeof(weakself) strongself = weakself;
-        //                           NSString *msg = [logoutDic objectForKey:@"err_msg"];
-        //                           [RAUtils message_alert:msg title:@"Warning" controller:strongself];
-        //                       }
-        //                   }];
-        //
-        //               });
-        //
-        //
-        //           });
-    }];
+//    }];
     //   UIAlertView *alert = [RAUtils waiting_alert:@"Please wait..." title:@"Logout"];
     
     

+ 0 - 91
RA Image/RA Image/TakePhotoPreviewController.m

@@ -149,56 +149,6 @@
     
 }
 
-//-(void) testimg
-//{
-//    UIImageOrientation o =self.preImage.imageOrientation;
-//    
-//    CGRect imgviewRect = self.imgView.frame;
-//    CGRect editRect = self.editContainer.frame;
-//    CGPoint offset= self.previewScroll.contentOffset;
-//    
-//    double sscale=self.previewScroll.zoomScale;
-//    CGSize contentsize=self.previewScroll.contentSize;
-//    
-//    CGRect imgScreenRect = CGRectMake(imgviewRect.origin.x-offset.x, imgviewRect.origin.y-offset.y, imgviewRect.size.width, imgviewRect.size.height);
-//    
-//    double scale = imgScreenRect.size.width/self.preImage.size.width;//1;//self.previewScroll.zoomScale*(imgviewRect.size.width/self.preImage.size.width);
-//    CGRect rectimg = CGRectMake((editRect.origin.x-imgScreenRect.origin.x)/scale, (editRect.origin.y-imgScreenRect.origin.y)/scale, editRect.size.width/scale, editRect.size.height/scale);
-////    UIImage * newimg=[UIImage imageWithCGImage:self.preImage.CGImage scale:1 orientation:UIImageOrientationUp];
-//    UIImage * img= [self captureImageWithImage:self.preImage inRect:rectimg];//
-//    UIImage* img1 =[self getSubImage:rectimg img:self.preImage];
-//    return;
-//}
-//
-//
-//-(UIImage*)getSubImage:(CGRect)rect img:(UIImage*)img
-//{
-//    
-//    //将UIImage转换成CGImageRef
-//    CGImageRef sourceImageRef = [img CGImage];
-//    
-//    //按照给定的矩形区域进行剪裁
-//    CGImageRef newImageRef = CGImageCreateWithImageInRect(sourceImageRef, rect);
-//    
-//    //将CGImageRef转换成UIImage
-//    UIImage *newImage = [UIImage imageWithCGImage:newImageRef];
-//    
-//    //返回剪裁后的图片
-//    return newImage;
-//    
-//    
-//    CGImageRef subImageRef = CGImageCreateWithImageInRect(img.CGImage, rect);
-//    UIImage* debugimg = [UIImage imageWithCGImage:subImageRef];
-//    CGRect smallBounds = CGRectMake(0, 0, CGImageGetWidth(subImageRef), CGImageGetHeight(subImageRef));
-//    
-//    UIGraphicsBeginImageContext(smallBounds.size);
-//    CGContextRef context = UIGraphicsGetCurrentContext();
-//    CGContextDrawImage(context, smallBounds, subImageRef);
-//    UIImage* smallImage = [UIImage imageWithCGImage:subImageRef];
-//    UIGraphicsEndImageContext();
-//    
-//    return smallImage;
-//}
 #pragma mark - UIScrollViewDelegate
 
 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
@@ -213,47 +163,6 @@
     scrollView.contentSize = contentSize;
 }
 
-//#pragma mark - pinch
-//
-//- (void)imageViewPinch:(UIPinchGestureRecognizer *)pinch{
-//    
-//    UIScrollView *scroll = self.previewScroll;
-//    UIImageView *imgv = [scroll.subviews firstObject];
-//    
-//    CGFloat width = scroll.frame.size.width;
-//    CGFloat height = scroll.frame.size.height;
-//    
-//    imgv.transform = CGAffineTransformScale(imgv.transform, pinch.scale, pinch.scale);
-//    CGSize size = scroll.contentSize;
-//    //    size.width = size.width * pinch.scale;
-//    //    size.height = size.height * pinch.scale;
-//    size = imgv.frame.size;// bounds 和 frame 不一致
-//    CGSize itemSize = self.editContainer.frame.size;
-//    DebugLog(@"size %@",[NSValue valueWithCGSize:size]);
-//    if (size.height < itemSize.height || size.width < itemSize.width) { // 禁止缩小得比原图小
-//        imgv.transform = CGAffineTransformIdentity;
-//        size = imgv.frame.size;
-//    }
-//    
-//    
-////    if (size.width < width) {
-////        size.width = width;
-////    }
-////    if (size.height < height) {
-////        size.height = height;
-////    }
-//    
-//    scroll.contentSize = size;
-//    scroll.contentOffset = CGPointMake((size.width - width) * 0.5, (size.height - height) * 0.5);
-//    // 保持在屏幕中心
-//    CGPoint offset = scroll.contentOffset;
-//    CGFloat x = offset.x + width * 0.5;
-//    CGFloat y = offset.y + height * 0.5;
-//    imgv.center = CGPointMake(x, y);
-//    
-//    pinch.scale = 1;
-//}
-
 
 
 @end

+ 3 - 2
RA Image/RA Image/UploadViewController.m

@@ -46,8 +46,9 @@
     if(appdelegate.uploadManager.arr_queue.count==0)
     {
 
-        [RAUtils message_alert:nil title:@"Upload list is empty." controller:self];
-//        [RAUtils alert_view:nil title:@"Upload list is empty."];
+        
+        [RAUtils message_box:@"Upload list is empty." message:nil completion:nil];
+
         return;
     }
     UIAlertController *alert = [UIAlertController alertControllerWithTitle:

+ 26 - 0
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/project.pbxproj

@@ -9,6 +9,9 @@
 /* Begin PBXBuildFile section */
 		3C16916C27FE7E3000026FE5 /* SignUpViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C16916B27FE7E3000026FE5 /* SignUpViewController.m */; };
 		3C16916F280004E000026FE5 /* ChangePasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C16916E280004E000026FE5 /* ChangePasswordViewController.m */; };
+		3C23B3F029CD70F9008E7C14 /* PopWaitAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3ED29CD70F9008E7C14 /* PopWaitAlert.m */; };
+		3C23B3F129CD70F9008E7C14 /* MessageBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3EE29CD70F9008E7C14 /* MessageBox.m */; };
+		3C23B3F229CD70F9008E7C14 /* RAPopviewContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3EF29CD70F9008E7C14 /* RAPopviewContainer.m */; };
 		3C2D0483285B242800423D97 /* ScanDiscountViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2D0482285B242800423D97 /* ScanDiscountViewController.m */; };
 		3C2F437B28B748E800F50E0E /* PriceGroupListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F437A28B748E800F50E0E /* PriceGroupListViewController.m */; };
 		3C2F99B8237BE1790000808F /* PortfolioListTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F99B6237BE1790000808F /* PortfolioListTableViewCell.m */; };
@@ -339,6 +342,12 @@
 		3C16916B27FE7E3000026FE5 /* SignUpViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SignUpViewController.m; sourceTree = "<group>"; };
 		3C16916D280004E000026FE5 /* ChangePasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChangePasswordViewController.h; sourceTree = "<group>"; };
 		3C16916E280004E000026FE5 /* ChangePasswordViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ChangePasswordViewController.m; sourceTree = "<group>"; };
+		3C23B3EA29CD70F9008E7C14 /* MessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageBox.h; sourceTree = "<group>"; };
+		3C23B3EB29CD70F9008E7C14 /* PopWaitAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopWaitAlert.h; sourceTree = "<group>"; };
+		3C23B3EC29CD70F9008E7C14 /* RAPopviewContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAPopviewContainer.h; sourceTree = "<group>"; };
+		3C23B3ED29CD70F9008E7C14 /* PopWaitAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopWaitAlert.m; sourceTree = "<group>"; };
+		3C23B3EE29CD70F9008E7C14 /* MessageBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageBox.m; sourceTree = "<group>"; };
+		3C23B3EF29CD70F9008E7C14 /* RAPopviewContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAPopviewContainer.m; sourceTree = "<group>"; };
 		3C2D0481285B242800423D97 /* ScanDiscountViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScanDiscountViewController.h; sourceTree = "<group>"; };
 		3C2D0482285B242800423D97 /* ScanDiscountViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScanDiscountViewController.m; sourceTree = "<group>"; };
 		3C2F437928B748E800F50E0E /* PriceGroupListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PriceGroupListViewController.h; sourceTree = "<group>"; };
@@ -934,6 +943,19 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		3C23B3E929CD70F9008E7C14 /* MessageBox */ = {
+			isa = PBXGroup;
+			children = (
+				3C23B3EA29CD70F9008E7C14 /* MessageBox.h */,
+				3C23B3EB29CD70F9008E7C14 /* PopWaitAlert.h */,
+				3C23B3EC29CD70F9008E7C14 /* RAPopviewContainer.h */,
+				3C23B3ED29CD70F9008E7C14 /* PopWaitAlert.m */,
+				3C23B3EE29CD70F9008E7C14 /* MessageBox.m */,
+				3C23B3EF29CD70F9008E7C14 /* RAPopviewContainer.m */,
+			);
+			path = MessageBox;
+			sourceTree = "<group>";
+		};
 		3C514975273E07C400F78617 /* EnumSelectAndSort\ */ = {
 			isa = PBXGroup;
 			children = (
@@ -1506,6 +1528,7 @@
 		716387C71953CDB4006E65E6 /* utils */ = {
 			isa = PBXGroup;
 			children = (
+				3C23B3E929CD70F9008E7C14 /* MessageBox */,
 				3C51499A273E0B6400F78617 /* common_const.h */,
 				71DF74311C5757C800F2789C /* CommonUI */,
 				71C1D84C1F456CAA00CEA1C9 /* HWWeakTimer.h */,
@@ -2295,6 +2318,7 @@
 				3C514956273D097E00F78617 /* CommonEditorTableContainerView.m in Sources */,
 				7162A5E61C58781000AB630E /* iSalesNavigationController.m in Sources */,
 				7141DD631C5747CE00F7DF59 /* NSString+Base64.m in Sources */,
+				3C23B3F029CD70F9008E7C14 /* PopWaitAlert.m in Sources */,
 				71E9F6BC1F8B52DD0052C78E /* NetworkUtils.m in Sources */,
 				7162A5C41C5873BB00AB630E /* ItemSearchViewController.m in Sources */,
 				7162A5481C58719D00AB630E /* RATreeView+TableViewDataSource.m in Sources */,
@@ -2322,6 +2346,7 @@
 				428980171E24924D005F1BD8 /* SortItemViewController.m in Sources */,
 				3CF33C8B27BF4936001CBEEC /* ServerSettingViewController.m in Sources */,
 				7162A5711C58728D00AB630E /* DetailImageCell.m in Sources */,
+				3C23B3F229CD70F9008E7C14 /* RAPopviewContainer.m in Sources */,
 				7162A51A1C58704600AB630E /* ModelItemCell.m in Sources */,
 				7141DD511C57459B00F7DF59 /* qrencode.c in Sources */,
 				7162A5451C58719D00AB630E /* RATreeView.m in Sources */,
@@ -2361,6 +2386,7 @@
 				7141DD3C1C5726B700F7DF59 /* ScanApiHelper.mm in Sources */,
 				7162A5261C58706C00AB630E /* CategoryViewController.m in Sources */,
 				7162A50A1C586FC100AB630E /* NSTimer+Addition.m in Sources */,
+				3C23B3F129CD70F9008E7C14 /* MessageBox.m in Sources */,
 				3C3A5AFE27D74E50005F4EFB /* ScanResultViewController.m in Sources */,
 				3C514949273D095900F78617 /* CommonEditorCellEnum.m in Sources */,
 				712AFED91DBA050200254965 /* GroupDrawable.m in Sources */,

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
 		<key>HMLG Scan Order.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>2</integer>
+			<integer>3</integer>
 		</dict>
 	</dict>
 </dict>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 91 - 659
RedAnt ERP Mobile/HMLG Scan Order/CartViewController.m


+ 23 - 16
RedAnt ERP Mobile/HMLG Scan Order/ChangePasswordViewController.m

@@ -24,11 +24,7 @@
     
     UIApplication * app = [UIApplication sharedApplication];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//    if(appDelegate.user.length==0)
-//    {
-//        [RAUtils message_alert:@"You must sign in first." title:@"Delete Account" controller:self];
-//        return;
-//    }
+
     NSString* opwd = self.editopwd.text;
     
     NSString* pwd = self.editnpwd.text;
@@ -36,41 +32,52 @@
     
     if(![opwd isEqualToString: appDelegate.password])
     {
-        [RAUtils message_alert:@"Password incorrect." title:@"Warrning" controller:self];
+        
+        
+        [RAUtils message_box:@"Warrning" message:@"Password incorrect." completion:nil];
         return;
     }
     if(![RAUtils checkPassword:pwd])
     {
-        [RAUtils message_alert:@"Password must be 8-16 characters and contain numbers and letters." title:@"Warrning" controller:self];
+        [RAUtils message_box:@"Warrning" message:@"Password must be 8-16 characters and contain numbers and letters." completion:nil];
+        
+        
         return;
     }
     if(![pwd isEqualToString:cpwd])
     {
-        [RAUtils message_alert:@"Password does not equal" title:@"Warrning" controller:self];
+        [RAUtils message_box:@"Warrning" message:@"Password does not equal" completion:nil];
+        
+        
         return;
     }
-    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Change Password" completion:nil];
-    
+//    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Change Password" completion:nil];
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Change Password" completion:nil];
     dispatch_async(dispatch_get_main_queue(), ^{
         [RADataProvider request_change_password:pwd completionHandler:^(NSMutableDictionary *result) {
-            [waitalert dismissViewControllerAnimated:true completion:^{
+//            [waitalert dismissViewControllerAnimated:true completion:^{
+            [pop hide];
                 NSMutableDictionary* return_json = result;
                 if([[return_json valueForKey:@"result"] intValue]==2)
                 {
 
-                    
-                    [RAUtils message_alert:@"Change password successful" title:@"Change Password" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
+                    [RAUtils message_box:@"Change Password" message:@"Successful" completion:^{
                         appDelegate.password = pwd;
                         [self dismissViewControllerAnimated:true completion:nil];
-                    } completion:nil];
+                        
+                        
+                    }];
+                    
+
 
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Change Password" controller:self] ;
+
+                    [RAUtils message_box:@"Change Password" message:[return_json valueForKey:@"err_msg"] completion:nil];
                 }
 
-            }];
+//            }];
         }];
     });
 }

+ 24 - 474
RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m

@@ -948,11 +948,15 @@
     
     if(appDelegate.bLogin)
     {
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+        
+        PopWaitAlert* pop = [RAUtils waiting_pop:@"Sign out" completion:nil];
             [RANetwork request_logout:^(NSMutableDictionary *result) {
                 NSMutableDictionary* return_json =result;
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     if([[return_json valueForKey:@"result"] intValue]==2)
                     {
                         //                    [self hideMenu];
@@ -985,9 +989,10 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
+                        [RAUtils message_box:@"Sign Out" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
+                        
                     }
-                }];
+//                }];
                                 
                                 
                                 
@@ -998,57 +1003,9 @@
                             
             }];
 
-        }];
+//        }];
         
                 
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* return_json = [RANetwork logout];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                
-//                
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-////                    [self hideMenu];
-////                    [self switchToHome:nil];
-//                    [appDelegate Logout];
-//                    [self checklogin :false];
-//                    if(showlogin)
-//                    {
-//                    LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
-//                    loginvc.returnValue = ^(bool blogin){
-//                        
-//                        [self checklogin :true];
-//                        
-//                    };
-//                    
-//                    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
-//                    
-//                    
-//                    
-//                    
-//                    
-//                    
-//                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-//                    [self presentViewController:navi animated:YES completion:^{
-//                        
-//                        DebugLog(@"login present.........");
-//                        
-//                    }];
-//                    }
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
-//                }
-//                
-//                
-//                
-//                
-//            });
-//        });
     }
     else
     {
@@ -1265,7 +1222,7 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:@"Customer Login does not support this feature." title:@"Contact List" controller:self] ;
+                    [RAUtils message_box:@"Contact List" message:@"Customer Login does not support this feature." completion:nil] ;
                 }
                 
             }
@@ -2058,7 +2015,7 @@
 //
 //                                 cvc.onCancel = ^(){
 //
-//                                     [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+//                                     [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
 //
 //
 //
@@ -2254,7 +2211,7 @@
 //
 //                         cvc.onCancel = ^(){
 //
-//                             [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+//                             [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
 //
 //
 //
@@ -2936,203 +2893,6 @@
 
 #ifdef SCANNER_ORDER
 
-//#pragma mark - Offline Order
-//-(void) CreateOfflineOrder
-//{
-//
-//    RASingleton.sharedInstance.enable_OfflineOrder = true;
-//
-//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//    __block MainViewController *brself= self;
-//    if(appDelegate.contact_id.length<=0)
-//    {
-//
-//        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"New Offline Order" message:nil preferredStyle:UIAlertControllerStyleAlert];
-//        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"With Offline Contact" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-//
-////            if(appDelegate.order_code && appDelegate.order_code.length>0)
-////            {
-////                [RAUtils message_alert:@"Please close current order and try again." title:@"" controller:self];
-////            }
-////            NSLog(@"new click");
-//
-//            NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
-//
-////            NSString *path = [[NSBundle mainBundle] pathForResource:@"editContact.json" ofType:nil];
-//
-//            CustomerEditViewController * cuseditVC = [[CustomerEditViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
-//            cuseditVC.bnewcustomer=true;
-//            cuseditVC.bolocustomer = true;
-//            cuseditVC.url_type = URL_LOCAL;
-//            cuseditVC.request_url=URL_SO_NEW_CONTACT;
-//
-//            cuseditVC.params = params;
-//
-//            cuseditVC.returnValue=^(NSMutableDictionary* value)
-//            {
-//                if(value==nil)
-//                {
-//                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//                }
-//                else
-//                {
-//                    NSString* contact_id=[[NSUUID new] UUIDString];
-//
-//
-//
-//
-//
-//
-//                        value [@"customer_cid"] = contact_id;
-//                        appDelegate.contact_id=contact_id;
-//                        appDelegate.customerInfo = value;
-//                        [brself refreshContactDisplay];
-//                    [self newoloorder];
-////                        [brself switchToCart:nil];
-//
-//                }
-//            };
-//
-//
-//        //    cuseditVC.delegate=self;
-//            //
-//            //    if(checked.count==count)
-//            //    {
-//            //    orderinfoVC.have_tail = true
-//            //    }
-//
-//            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-//            [self.navigationController pushViewController:cuseditVC animated:false];
-//
-////            [self dismissViewControllerAnimated:NO completion:^{
-//////                [(UINavigationController*)[self parentViewController] pushViewController:cuseditVC animated:false];;
-//////                            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-////
-//////                            [self pushViewController:cuseditVC animated:false];
-////            }];
-//
-////            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-////            [self.navigationController pushViewController:cuseditVC animated:false];
-//
-//
-//        }];
-//
-//        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"With Online Contact" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-//            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//            if(appDelegate.order_code && appDelegate.order_code.length>0)
-//            {
-//    //            appDelegate.order_code= nil;
-//    //            [appDelegate SetSo:nil];
-//
-//
-//                    //     MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                    ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//                    cvc.showNavibar = true;
-//                    cvc.contact_type = @"Sales_Order_Customer";
-//                    cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//
-//                        appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                        appDelegate.customerInfo = value;
-//
-////                        self.norefresh = true;
-//                        [self newoloorder];
-//
-//
-//
-//                        //    [main_vc checklogin:true];
-//                        //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//
-//                        //
-//                        //                if(self.returnValue)
-//                        //                    self.returnValue(value);
-//                    };
-//
-//                    cvc.onCancel = ^(){
-////                        self.norefresh = true;
-//                        if(appDelegate.customerInfo==nil)
-//                        {
-//                            [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//                        }
-//                        else
-//                        {
-//                            [self newoloorder];
-//                        }
-//                        //  [main_vc checklogin:true];
-//                    };
-//                    cvc.onReset = ^(){
-//                        //   [main_vc checklogin:true];
-//                    };
-//
-//                    [self.navigationController pushViewController:cvc animated:true];
-//
-//
-//
-//            }
-//            else
-//            {
-//                //create new;
-//
-//                if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//                {
-//                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                    ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//                    cvc.showNavibar = true;
-//                    cvc.contact_type = @"Sales_Order_Customer";
-//                    cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//
-//                        appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                        appDelegate.customerInfo = value;
-//
-//
-//                        if(appDelegate.order_code==nil)
-//                            [self newoloorder];
-//
-//                        //   [main_vc checklogin:true];
-//                        //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//
-//                        //
-//                        //                if(self.returnValue)
-//                        //                    self.returnValue(value);
-//                    };
-//
-//                    cvc.onCancel = ^(){
-//
-//                        [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//
-//
-//
-//                    };
-//                    cvc.onReset = ^(){
-//                        [main_vc checklogin:true];
-//                    };
-//
-//                    [self.navigationController pushViewController:cvc animated:true];
-//                }
-//                else
-//                {
-//                    [self newoloorder];
-//                }
-//            }
-//
-//        }];
-//
-//        UIAlertAction *alertCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-//
-//        }];
-//
-//        [alertControl addAction:actionOne];
-//
-//        [alertControl addAction:alertthree];
-//        [alertControl addAction:alertCancel];
-//
-//        [self presentViewController:alertControl animated:YES completion:nil];
-//    }
-//    else
-//    {
-//        [self newoloorder];
-//    }
-//}
 -(void) scanLogin
 {
     [self onUserButtonClick:nil];
@@ -3209,142 +2969,7 @@
     [RADataProvider default_price_group];
 }
 
-//-(void) newoloorder
-//{
-//    NSString* order_code = [[NSUUID new] UUIDString];
-//                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                                appDelegate.order_code = order_code;
-//    
-//    NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:URL_SO_CART ofType:@"json" ]];
-//    RASingleton.sharedInstance.scan_cart=[[RAConvertor data2dict:json] mutableCopy];
-//
-//    
-////    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
-////        [RANetwork request_create_order:^(NSMutableDictionary *result) {
-////                NSMutableDictionary* return_json =result;
-////
-////                [waitalert dismissViewControllerAnimated:YES completion:^{
-////                    if([[return_json valueForKey:@"result"] intValue]==2)
-////                    {
-////                        int result=[[return_json valueForKey:@"result"] intValue];
-////                        if(result==2)
-////                        {
-////                            //successed.
-////
-////                            NSString* order_code = [return_json valueForKey:@"orderCode"];
-////                            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                            appDelegate.order_code = order_code;
-////                            appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-////
-////
-////        #ifdef RA_NOTIFICATION
-////                            [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-////        #else
-////                            MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-////                            [main_vc reloadCart:true immediately:false];
-////        #endif
-////
-//////                            [self ReloadData];
-////
-////
-////                            //     [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
-////                            //    [self loadpage];
-////
-////
-////                            //                    if(self.shopCartBlock!=nil)
-////                            //                    {
-////                            //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-////                            //
-////                            //
-////                            //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-////                            //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-////                            //                        iv.image = img;
-////                            //                        //                        [self.contentView addSubview:iv];
-////                            //                        self.shopCartBlock(iv);
-////                            //
-////                            //                    }
-////
-////                        }
-////                    }
-////                    else
-////                    {
-////                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
-////                    }
-////                }];
-////        //        [waitalert dismissViewControllerAnimated:YES completion:nil];
-////
-////
-////
-////
-////
-////
-////
-////
-////            }];
-////
-////    }];
-//        
-////    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-////
-////        NSDictionary* return_json = [RANetwork new_Order];
-////
-////        dispatch_async(dispatch_get_main_queue(), ^{
-////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-////
-////
-////            if([[return_json valueForKey:@"result"] intValue]==2)
-////            {
-////                int result=[[return_json valueForKey:@"result"] intValue];
-////                if(result==2)
-////                {
-////                    //successed.
-////
-////                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-////                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                    appDelegate.order_code = order_code;
-////                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-////
-////
-////#ifdef RA_NOTIFICATION
-////                    [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-////#else
-////                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-////                    [main_vc reloadCart:true immediately:false];
-////#endif
-////
-////                    [self ReloadData];
-////
-////
-////                    //     [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
-////                    //    [self loadpage];
-////
-////
-////                    //                    if(self.shopCartBlock!=nil)
-////                    //                    {
-////                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-////                    //
-////                    //
-////                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-////                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-////                    //                        iv.image = img;
-////                    //                        //                        [self.contentView addSubview:iv];
-////                    //                        self.shopCartBlock(iv);
-////                    //
-////                    //                    }
-////
-////                }
-////            }
-////            else
-////            {
-////                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
-////            }
-////
-////
-////
-////
-////        });
-////    });
-//}
+
 #endif
 #pragma mark - Table view delegate
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
@@ -3368,41 +2993,7 @@
         
     }
 #ifdef SCANNER_ORDER
-//    else if([title isEqualToString:@"Scanner Order"])
-//    {
-//
-//        OLOSettingViewController * offlineVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"OLOSettingViewController"];
-//        offlineVC.returnValue=^(int type){
-//            if(type == OOC_CREATE_ORDER){
-//                [self CreateOfflineOrder];
-//            }
-//        };
-//        //    loginvc.delegate = self;
-//        //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-// //       appDelegate.active_controller = gunVC;
-////        gunVC.onDismissVC = ^(){
-////            appDelegate.active_controller = active_vc;
-////        };
-//        UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:offlineVC] ;
-//
-//
-//
-//
-//
-//        //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
-//
-//        navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-//        [self presentViewController:navi animated:YES completion:^{
-//
-//            //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-//
-//            DebugLog(@"about present.........");
-//
-//            //   self.btop = false;
-//            //  <#code#>
-//        }];
-//
-//    }
+
 #endif
     else if([title isEqualToString:@"Scanner Setting"])
     {
@@ -4028,7 +3619,7 @@
 //
 //            cvc.onCancel = ^(){
 //
-//                [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+//                [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
 //
 //
 //
@@ -4049,11 +3640,13 @@
 -(void) neworderforCart
 {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
                 NSMutableDictionary* return_json = result;
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                     if([[return_json valueForKey:@"result"] intValue]==2)
                     {
                         int result=[[return_json valueForKey:@"result"] intValue];
@@ -4082,9 +3675,9 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                        [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                     }
-                }];
+//                }];
                 
                 
                 
@@ -4095,51 +3688,8 @@
                 
             }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//        
-//        NSDictionary* return_json = [RANetwork new_Order];
-//        
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            
-//            
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//                    
-//                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    appDelegate.order_code = order_code;
-//                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-//                    
-//                    self.previous_VC = self.current_VC;
-//                    [self flipFromViewController:self.current_VC toViewController:self.cartViewController withDirection:UIViewAnimationOptionTransitionCrossDissolve];
-//                    
-//                    
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                    [self reloadCart:true immediately:false];
-//                    [self reloadOrder:true immediately:false];
-//#endif
-//                    
-//                    
-//                }
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//            
-//            
-//            
-//            
-//        });
-//    });
+//    }];
+ 
 }
 
 - (void)showPriceAuth:(NSInteger)from {

+ 17 - 0
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/MessageBox.h

@@ -0,0 +1,17 @@
+//
+//  MessageBox.h
+//  PopupViewWrapper
+//
+//  Created by Rui Zhang on 3/20/23.
+//  Copyright © 2023 yangyi. All rights reserved.
+//
+
+#import "PopWaitAlert.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface MessageBox : PopWaitAlert
+@property (strong,nonatomic) UIButton* btnOK;
+@end
+
+NS_ASSUME_NONNULL_END

+ 245 - 0
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/MessageBox.m

@@ -0,0 +1,245 @@
+//
+//  MessageBox.m
+//  PopupViewWrapper
+//
+//  Created by Rui Zhang on 3/20/23.
+//  Copyright © 2023 yangyi. All rights reserved.
+//
+
+#import "MessageBox.h"
+
+@implementation MessageBox
+
+-(void)updateframe
+{
+    
+    int h = 0;
+    h=self.labelTitle.frame.size.height+10+self.labelMessage.frame.size.height+10+_btnOK.frame.size.height+10+10;
+    
+    CGRect newframe = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width,h);
+    self.frame = newframe;
+    
+}
+//+ (instancetype)sharedInstance {
+//
+//    static MessageBox *singleton = nil;
+//    static dispatch_once_t onceToken;
+//    dispatch_once(&onceToken, ^{
+//
+//        singleton = [[MessageBox alloc] init];
+////        [[NSNotificationCenter defaultCenter] addObserver:singleton selector:@selector(handleLogin:) name:User_LoginOK_Notification object:nil];
+//
+//
+//
+////        self addObserver:self forKeyPath:self.scan_cart options:<#(NSKeyValueObservingOptions)#> context:<#(nullable void *)#>
+//    });
+//    return singleton;
+//}
+
+
++ (instancetype)Show:(NSString*) title message:(NSString*) message completion:(void (^ __nullable)(void))completion
+{
+
+    
+    MessageBox *mb =[[MessageBox alloc] init:completion];
+    
+//    [mb setCompletion:completion];
+    [mb setCenter : [UIApplication sharedApplication].keyWindow.center ];
+    [mb setTitle:title];
+    [mb setMessage:message];
+    RAPopviewContainer *wrapper = [[RAPopviewContainer alloc] initWithView:mb];
+    wrapper.modalView=true;
+    wrapper.bgColor = [UIColor colorWithWhite:0 alpha:0.2];
+    [wrapper show:[UIApplication sharedApplication].keyWindow];
+    return mb;
+}
+
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    if (self = [super initWithFrame:frame]) {
+        [self.labelTitle setNumberOfLines:2];
+        
+        [self.labelTitle sizeToFit];
+        
+        
+        [self.labelMessage setNumberOfLines:4];
+        
+        
+        [self.labelMessage sizeToFit];
+        
+//        self.layer.cornerRadius = 5.0f;
+//        self.layer.masksToBounds = YES;
+//
+////        UILabel *clabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, frame.size.width-20, 100)];
+////        clabel.textAlignment = NSTextAlignmentCenter;
+////        clabel.text = @"Title Title Title Title";
+////        clabel.font=[UIFont boldSystemFontOfSize:17.0f];
+////        [clabel setLineBreakMode:NSLineBreakByWordWrapping];
+////
+////        [clabel setNumberOfLines:2];
+////
+////        [clabel sizeToFit];
+////
+//
+//        _labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(30, 10, frame.size.width-60, 40)];
+//        _labelTitle.textAlignment = NSTextAlignmentCenter;
+//        _labelTitle.text = @"Title Title Title Title";
+//        _labelTitle.font=[UIFont boldSystemFontOfSize:20.0f];
+//        [_labelTitle setLineBreakMode:NSLineBreakByWordWrapping];
+//
+//
+//
+//        [self addSubview:_labelTitle];
+//
+//
+//        _labelTitle.translatesAutoresizingMaskIntoConstraints = NO;
+//
+//        NSLayoutConstraint *T_hl = [NSLayoutConstraint constraintWithItem:_labelTitle
+//                                                                    attribute:NSLayoutAttributeLeading
+//                                                                    relatedBy:NSLayoutRelationEqual
+//                                                                       toItem:self
+//                                                                    attribute:NSLayoutAttributeLeading
+//                                                                   multiplier:1
+//                                                                     constant:30];
+//
+//
+//        NSLayoutConstraint *T_ht = [NSLayoutConstraint constraintWithItem:_labelTitle
+//                                                                    attribute:NSLayoutAttributeTrailing
+//                                                                    relatedBy:NSLayoutRelationEqual
+//                                                                       toItem:self
+//                                                                    attribute:NSLayoutAttributeTrailing
+//                                                                   multiplier:1
+//                                                                     constant:-30];
+//
+//        NSLayoutConstraint *T_vt = [NSLayoutConstraint constraintWithItem:_labelTitle
+//                                                                    attribute:NSLayoutAttributeTop
+//                                                                    relatedBy:NSLayoutRelationEqual
+//                                                                       toItem:self
+//                                                                    attribute:NSLayoutAttributeTop
+//                                                                   multiplier:1
+//                                                                     constant:10];
+////        NSLayoutConstraint *width = [NSLayoutConstraint constraintWithItem:hud
+////                                                                 attribute:NSLayoutAttributeWidth
+////                                                                 relatedBy:NSLayoutRelationEqual
+////                                                                    toItem:nil
+////                                                                 attribute:NSLayoutAttributeNotAnAttribute
+////                                                                multiplier:0
+////                                                                  constant:HUDSIZE];
+////        NSLayoutConstraint *height = [NSLayoutConstraint constraintWithItem:hud
+////                                                                  attribute:NSLayoutAttributeHeight
+////                                                                  relatedBy:NSLayoutRelationEqual
+////                                                                     toItem:nil
+////                                                                  attribute:NSLayoutAttributeNotAnAttribute
+////                                                                 multiplier:0
+////                                                                   constant:HUDSIZE];
+//        [self addConstraints:@[T_hl,T_ht,T_vt]];
+//
+        
+//        CGSize maxSizeTitle =[labelTitle sizeThatFits:labelTitle.frame.size];
+
+        
+        
+//        _labelMessage = [[UILabel alloc] initWithFrame:CGRectMake(30, 45, frame.size.width-60, 40)];
+//        _labelMessage.textAlignment = NSTextAlignmentLeft;//NSTextAlignmentCenter;
+//        _labelMessage.text = @"Message";
+//        [_labelMessage setLineBreakMode:NSLineBreakByWordWrapping];
+//
+//
+//        [self addSubview:_labelMessage];
+//
+//
+//        _labelMessage.translatesAutoresizingMaskIntoConstraints = NO;
+//
+//        NSLayoutConstraint *M_hl = [NSLayoutConstraint constraintWithItem:_labelMessage
+//                                                                    attribute:NSLayoutAttributeLeading
+//                                                                    relatedBy:NSLayoutRelationEqual
+//                                                                       toItem:self
+//                                                                    attribute:NSLayoutAttributeLeading
+//                                                                   multiplier:1
+//                                                                     constant:30];
+//
+//
+//        NSLayoutConstraint *M_ht = [NSLayoutConstraint constraintWithItem:_labelMessage
+//                                                                    attribute:NSLayoutAttributeTrailing
+//                                                                    relatedBy:NSLayoutRelationEqual
+//                                                                       toItem:self
+//                                                                    attribute:NSLayoutAttributeTrailing
+//                                                                   multiplier:1
+//                                                                     constant:-30];
+//
+//        NSLayoutConstraint *M_vt = [NSLayoutConstraint constraintWithItem:_labelMessage
+//                                                                    attribute:NSLayoutAttributeTop
+//                                                                    relatedBy:NSLayoutRelationEqual
+//                                                                       toItem:_labelTitle
+//                                                                    attribute:NSLayoutAttributeBottom
+//                                                                   multiplier:1
+//                                                                     constant:10];
+//
+//        [self addConstraints:@[M_hl,M_ht,M_vt]];
+        
+        _btnOK = [[UIButton alloc] initWithFrame:CGRectMake(30, 20, 80, 40)];
+        [_btnOK setTitle:@"OK" forState:UIControlStateNormal];
+        [_btnOK setTitleColor:[UIColor systemBlueColor] forState:UIControlStateNormal];
+        [_btnOK addTarget:self action:@selector(onBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
+        [_btnOK sizeToFit];
+        [self addSubview:_btnOK];
+        
+        
+        
+        _btnOK.translatesAutoresizingMaskIntoConstraints = NO;
+        
+        NSLayoutConstraint *B_h = [NSLayoutConstraint constraintWithItem:_btnOK
+                                                                    attribute:NSLayoutAttributeCenterX
+                                                                    relatedBy:NSLayoutRelationEqual
+                                                                       toItem:self
+                                                                    attribute:NSLayoutAttributeCenterX
+                                                                   multiplier:1
+                                                                     constant:0];
+        
+                NSLayoutConstraint *B_w = [NSLayoutConstraint constraintWithItem:_btnOK
+                                                                         attribute:NSLayoutAttributeWidth
+                                                                         relatedBy:NSLayoutRelationEqual
+                                                                            toItem:nil
+                                                                         attribute:NSLayoutAttributeNotAnAttribute
+                                                                        multiplier:0
+                                                                          constant:60];
+        
+        NSLayoutConstraint *B_vt = [NSLayoutConstraint constraintWithItem:_btnOK
+                                                                    attribute:NSLayoutAttributeTop
+                                                                    relatedBy:NSLayoutRelationEqual
+                                                                       toItem:self.labelMessage
+                                                                    attribute:NSLayoutAttributeBottom
+                                                                   multiplier:1
+                                                                     constant:10];
+
+        [self addConstraints:@[B_h,B_w,B_vt]];
+        
+        
+//                labelTitle.text = @"Title Title Title Title Title Title Title";
+//                [labelTitle sizeToFit];
+        
+
+   
+        [self updateframe];
+//        [self sizeToFit];
+//        self resize
+//        int a=0;
+    }
+    return self;
+}
+
+
+- (void)onBtnClicked:(id)sender {
+    // 可以调用基类的hide方法
+    [super hide];
+}
+
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+
+@end

+ 26 - 0
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/PopWaitAlert.h

@@ -0,0 +1,26 @@
+//
+//  PopWaitAlert.h
+//  PopupViewWrapper
+//
+//  Created by Rui Zhang on 3/20/23.
+//  Copyright © 2023 yangyi. All rights reserved.
+//
+
+#import "RAPopviewContainer.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PopWaitAlert : RAPopView
+@property (strong,nonatomic) UILabel* labelTitle;
+@property (strong,nonatomic) UILabel* labelMessage;
+-(void)setTitle:(NSString*)titleText;
+-(void)setMessage:(NSString*)messageText;
+- (instancetype)init:(void (^ __nullable)(void))completion;
+
+
+
+
++ (instancetype)Show:(NSString*) title message:(NSString*) message completion:(void (^ __nullable)(void))completion;
+@end
+
+NS_ASSUME_NONNULL_END

+ 264 - 0
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/PopWaitAlert.m

@@ -0,0 +1,264 @@
+//
+//  PopWaitAlert.m
+//  PopupViewWrapper
+//
+//  Created by Rui Zhang on 3/20/23.
+//  Copyright © 2023 yangyi. All rights reserved.
+//
+
+#import "PopWaitAlert.h"
+
+@interface PopWaitAlert ()
+
+@property (nonatomic , copy) void (^completion)(void);
+//+ (instancetype)sharedInstance;
+//(void (^ __nullable)(void)) completion;
+@end
+
+
+@implementation PopWaitAlert
+
+
+
+
+
+//+ (instancetype)sharedInstance {
+//
+//    static PopWaitAlert *singleton = nil;
+//    static dispatch_once_t onceToken;
+//    dispatch_once(&onceToken, ^{
+//
+//        singleton = [[PopWaitAlert alloc] init];
+////        [[NSNotificationCenter defaultCenter] addObserver:singleton selector:@selector(handleLogin:) name:User_LoginOK_Notification object:nil];
+//
+//
+//
+////        self addObserver:self forKeyPath:self.scan_cart options:<#(NSKeyValueObservingOptions)#> context:<#(nullable void *)#>
+//    });
+//    return singleton;
+//}
+
++ (instancetype)Show:(NSString*) title message:(NSString*) message completion:(void (^ __nullable)(void))completion
+{
+
+    if(title==nil)
+        title=@"";
+    if(message==nil)
+        message=@"";
+    PopWaitAlert *pa =[[PopWaitAlert alloc] init:completion];
+    
+//    [pa setCompletion:completion];
+    [pa setCenter : [UIApplication sharedApplication].keyWindow.center ];
+    [pa setTitle:title];
+    [pa setMessage:message];
+    RAPopviewContainer *wrapper = [[RAPopviewContainer alloc] initWithView:pa];
+    wrapper.modalView=true;
+    wrapper.bgColor = [UIColor colorWithWhite:0 alpha:0.2];
+    [wrapper show:[UIApplication sharedApplication].keyWindow];
+    return pa;
+}
+
+-(void)updateframe
+{
+    int h = 0;
+    h=_labelTitle.frame.size.height+10+_labelMessage.frame.size.height+10+20;
+    
+    CGRect newframe = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width,h);
+    self.frame = newframe;
+    
+}
+-(void)setMessage:(NSString*)messageText
+{
+    _labelMessage.text = messageText;
+    _labelMessage.frame = CGRectMake(16, 45, self.frame.size.width-32, 40);
+    [_labelMessage sizeToFit];
+    [self updateframe];
+    
+}
+
+-(void)setTitle:(NSString*)titleText
+{
+    _labelTitle.text = titleText;
+    _labelTitle.frame = CGRectMake(30, 10, self.frame.size.width-60, 40);
+    [_labelTitle sizeToFit];
+    [self updateframe];
+    
+}
+
+- (void)hide
+{
+//    [UIView animateWithDuration:0.25 animations:^{
+//        CGRect frame = self.frame;
+//        frame.origin.y = self.superview.frame.size.height;
+//        self.frame = frame;
+//    } completion:^(BOOL finished) {
+        [super hide];
+        
+        if(self.completion)
+            self.completion();
+//    }];
+}
+
+- (instancetype)init:(void (^ __nullable)(void))completion
+{
+    self.completion=completion;
+    return [self init];
+}
+- (instancetype)init
+{
+    return [self initWithFrame:CGRectMake(0, 0, 270, 180)];
+}
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    if (self = [super initWithFrame:frame]) {
+        
+        self.backgroundColor=[UIColor whiteColor];
+        self.layer.cornerRadius = 15.0f;
+        self.layer.masksToBounds = YES;
+        self.layer.borderColor=[UIColor darkGrayColor].CGColor;
+        self.layer.borderWidth=0.2;
+        
+        
+        
+        
+        self.layer.shadowRadius = self.layer.cornerRadius + 5;
+        self.layer.shadowOpacity = 0.1f;
+        self.layer.shadowOffset = CGSizeMake(0 - (self.layer.cornerRadius+5)/2, 0 - (self.layer.cornerRadius+5)/2);
+        self.layer.shadowColor = [UIColor blackColor].CGColor;
+        self.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:self.layer.cornerRadius].CGPath;
+//        UILabel *clabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, frame.size.width-20, 100)];
+//        clabel.textAlignment = NSTextAlignmentCenter;
+//        clabel.text = @"Title Title Title Title";
+//        clabel.font=[UIFont boldSystemFontOfSize:17.0f];
+//        [clabel setLineBreakMode:NSLineBreakByWordWrapping];
+//
+//        [clabel setNumberOfLines:2];
+//
+//        [clabel sizeToFit];
+//
+        
+        _labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(30, 10, frame.size.width-60, 40)];
+        _labelTitle.textAlignment = NSTextAlignmentCenter;
+        _labelTitle.text = @"Please Wait...";
+        _labelTitle.font=[UIFont boldSystemFontOfSize:20.0f];
+        [_labelTitle setLineBreakMode:NSLineBreakByWordWrapping];
+        
+        [_labelTitle setNumberOfLines:1];
+        
+        [_labelTitle sizeToFit];
+        
+        [self addSubview:_labelTitle];
+        
+
+        _labelTitle.translatesAutoresizingMaskIntoConstraints = NO;
+        
+        NSLayoutConstraint *T_hl = [NSLayoutConstraint constraintWithItem:_labelTitle
+                                                                    attribute:NSLayoutAttributeLeading
+                                                                    relatedBy:NSLayoutRelationEqual
+                                                                       toItem:self
+                                                                    attribute:NSLayoutAttributeLeading
+                                                                   multiplier:1
+                                                                     constant:30];
+        
+        
+        NSLayoutConstraint *T_ht = [NSLayoutConstraint constraintWithItem:_labelTitle
+                                                                    attribute:NSLayoutAttributeTrailing
+                                                                    relatedBy:NSLayoutRelationEqual
+                                                                       toItem:self
+                                                                    attribute:NSLayoutAttributeTrailing
+                                                                   multiplier:1
+                                                                     constant:-30];
+        
+        NSLayoutConstraint *T_vt = [NSLayoutConstraint constraintWithItem:_labelTitle
+                                                                    attribute:NSLayoutAttributeTop
+                                                                    relatedBy:NSLayoutRelationEqual
+                                                                       toItem:self
+                                                                    attribute:NSLayoutAttributeTop
+                                                                   multiplier:1
+                                                                     constant:10];
+//        NSLayoutConstraint *width = [NSLayoutConstraint constraintWithItem:hud
+//                                                                 attribute:NSLayoutAttributeWidth
+//                                                                 relatedBy:NSLayoutRelationEqual
+//                                                                    toItem:nil
+//                                                                 attribute:NSLayoutAttributeNotAnAttribute
+//                                                                multiplier:0
+//                                                                  constant:HUDSIZE];
+//        NSLayoutConstraint *height = [NSLayoutConstraint constraintWithItem:hud
+//                                                                  attribute:NSLayoutAttributeHeight
+//                                                                  relatedBy:NSLayoutRelationEqual
+//                                                                     toItem:nil
+//                                                                  attribute:NSLayoutAttributeNotAnAttribute
+//                                                                 multiplier:0
+//                                                                   constant:HUDSIZE];
+        [self addConstraints:@[T_hl,T_ht,T_vt]];
+        
+        
+//        CGSize maxSizeTitle =[labelTitle sizeThatFits:labelTitle.frame.size];
+
+        
+        
+        _labelMessage = [[UILabel alloc] initWithFrame:CGRectMake(16, 45, frame.size.width-32, 40)];
+        _labelMessage.textAlignment = NSTextAlignmentCenter;
+        _labelMessage.text = @"Message";
+        _labelMessage.font=[UIFont systemFontOfSize:16.0f];
+        [_labelMessage setLineBreakMode:NSLineBreakByWordWrapping];
+        
+        [_labelMessage setNumberOfLines:1];
+        
+        
+        [_labelMessage sizeToFit];
+        [self addSubview:_labelMessage];
+        
+        
+        _labelMessage.translatesAutoresizingMaskIntoConstraints = NO;
+        
+        NSLayoutConstraint *M_hl = [NSLayoutConstraint constraintWithItem:_labelMessage
+                                                                    attribute:NSLayoutAttributeLeading
+                                                                    relatedBy:NSLayoutRelationEqual
+                                                                       toItem:self
+                                                                    attribute:NSLayoutAttributeLeading
+                                                                   multiplier:1
+                                                                     constant:16];
+        
+        
+        NSLayoutConstraint *M_ht = [NSLayoutConstraint constraintWithItem:_labelMessage
+                                                                    attribute:NSLayoutAttributeTrailing
+                                                                    relatedBy:NSLayoutRelationEqual
+                                                                       toItem:self
+                                                                    attribute:NSLayoutAttributeTrailing
+                                                                   multiplier:1
+                                                                     constant:-16];
+        
+        NSLayoutConstraint *M_vt = [NSLayoutConstraint constraintWithItem:_labelMessage
+                                                                    attribute:NSLayoutAttributeTop
+                                                                    relatedBy:NSLayoutRelationEqual
+                                                                       toItem:_labelTitle
+                                                                    attribute:NSLayoutAttributeBottom
+                                                                   multiplier:1
+                                                                     constant:10];
+
+        [self addConstraints:@[M_hl,M_ht,M_vt]];
+        
+    
+        
+//                labelTitle.text = @"Title Title Title Title Title Title Title";
+//                [labelTitle sizeToFit];
+        
+
+   
+        [self updateframe];
+//        [self sizeToFit];
+//        self resize
+        int a=0;
+    }
+    return self;
+}
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+
+@end

+ 45 - 0
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/RAPopviewContainer.h

@@ -0,0 +1,45 @@
+//
+//  KKPopupViewWrapper.h
+//  KKTV
+//
+//  Created by yangyi on 2018/7/6.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol RAPopviewProtocol <NSObject>
+
+- (UIView *)show:(UIView *)parentView;
+- (void)hide;
+
+@end
+
+
+// 给弹出视图加一个可点击的背景,点击背景视图隐藏
+@interface RAPopviewContainer : UIButton <RAPopviewProtocol>
+
+- (instancetype)initWithView:(id<RAPopviewProtocol>)popupView;
+
+@property (nonatomic, strong) UIColor * _Nullable bgColor;//默认为nil,表示背景透明
+@property (nonatomic, copy) void (^ _Nullable hideHandler) (void);//背景及视图消失回调
+
+
+@property bool modalView;
+@end
+
+
+// 弹出视图需继承自该类
+@interface RAPopView : UIView <RAPopviewProtocol>
+
+@end
+
+
+//@interface KKPopupObject : NSObject <RAPopviewProtocol>
+//
+//- (void)hide NS_REQUIRES_SUPER;
+//
+//@end
+
+NS_ASSUME_NONNULL_END

+ 116 - 0
RedAnt ERP Mobile/HMLG Scan Order/MessageBox/RAPopviewContainer.m

@@ -0,0 +1,116 @@
+//
+//  KKPopupViewWrapper.m
+//  KKTV
+//
+//  Created by yangyi on 2018/7/6.
+//
+
+#import "RAPopviewContainer.h"
+
+@protocol RAPopviewContainerProtocol <NSObject>
+
+@property (nonatomic, weak) RAPopviewContainer *container;
+
+@end
+
+
+@implementation RAPopviewContainer
+{
+    id<RAPopviewProtocol> _popupView;
+}
+
+- (instancetype)initWithView:(id<RAPopviewProtocol>)popupView
+{
+    if (self = [super init]) {
+        _popupView = popupView;
+        ((id<RAPopviewContainerProtocol>)_popupView).container = self;
+    }
+    return self;
+}
+
+- (UIView *)show:(UIView*)parentView
+{
+//    [parentView setClipsToBounds:false];
+    
+    UIView *view = [_popupView show:parentView];
+    
+    if (self.bgColor) self.backgroundColor = self.bgColor;
+    
+    
+//    return [PopWaitAlert Show: title:title message:@"Please wait..." completion:nil];
+//    ;
+    
+//    CGRect r1 =[UIApplication sharedApplication].keyWindow.bounds;
+//    CGRect r2 =[UIApplication sharedApplication].keyWindow.rootViewController.view.bounds;
+    self.frame = [UIApplication sharedApplication].keyWindow.bounds;//parentView.bounds;
+    [self addTarget:self action:@selector(onBkgButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
+    
+    
+//    [[UIApplication sharedApplication].keyWindow
+//    [[UIApplication sharedApplication].keyWindow addSubview:view];
+    [parentView insertSubview:self belowSubview:view];
+    
+    return nil;
+}
+
+- (void)hide
+{
+    if (self.hideHandler)
+        self.hideHandler();
+    
+    NSLog(@"hide...");
+    [self removeFromSuperview];
+}
+
+- (void)onBkgButtonClicked:(id)sender
+{
+    
+    if(self.modalView)
+        return;
+    [_popupView hide];
+}
+
+@end
+
+@interface RAPopView () <RAPopviewContainerProtocol>
+
+@end
+
+@implementation RAPopView
+
+@synthesize container;
+
+- (UIView*)show:(UIView *)parentView
+{
+    [parentView addSubview:self];
+    return self;
+}
+
+- (void)hide
+{
+    [self removeFromSuperview];
+    
+    [self.container hide];
+}
+
+@end
+////
+////@interface KKPopupObject () <KKPopupViewWrapperProtocol>
+////
+////@end
+////
+////@implementation KKPopupObject
+////
+////@synthesize wrapper;
+////
+////- (UIView *)show:(UIView *)parentView
+////{
+////    return nil;
+////}
+////
+////- (void)hide
+////{
+////    [self.wrapper hide];
+////}
+//
+//@end

+ 6 - 151
RedAnt ERP Mobile/HMLG Scan Order/ScanCartItemCell.m

@@ -66,102 +66,7 @@
     
     DebugLog(@"setpperChanged");
     
-//    int val_change=(int)sender.value-self.pre_val;
-//
-//        _totalchange=_totalchange+val_change;
-    
-    
-//
-//    if(val_change==(int)sender.stepValue)
-//    {
-//
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* cart_json = [iSalesNetwork cart_incresement:self.cart_id increse:true];
-//
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-////
-////                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-////                        [self.delegate returnQTY:sender.value ];
-//                   // }
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//
-//
-//
-//
-//            });
-//        });
-//        //increse;
-//    }
-//    else if(val_change==-(int)sender.stepValue)
-//    {
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* cart_json = [iSalesNetwork cart_incresement:self.cart_id increse:false];
-//
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//
-//
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//
-//
-//            });
-//        });
-//
-//    }
-//    else
-//    {
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* cart_json = [iSalesNetwork cart_setQTY:self.cart_id value:sender.value];
-//
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-////                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-////                        [self.delegate returnQTY:sender.value ];
-////                    }
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//
-//
-//
-//            });
-//        });
-//
-//        //setvalue;
-//    }
-    
+
     
     
     [self cancel_setQTY];
@@ -194,39 +99,14 @@
         {
             UIViewController* vc=[RAUtils getViewController :self];
             [((CartViewController *)vc).itemListTable reloadData];
-            [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+//            [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
+            [RAUtils message_box:@"Change Model Count" message:cart_json[@"err_msg"] completion:nil];
         }
         
         
         
     }];
     
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* cart_json = [RANetwork cart_setQTY:self.cart_id value:self.pre_val];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    self.totalchange=0;
-//                    if([[cart_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        if(self.onReturnQTY)
-//                            self.onReturnQTY(self.pre_val,cart_json);
-//    //                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-//    //                        [self.delegate returnQTY:sender.value ];
-//    //                    }
-//                    }
-//                    else
-//                    {
-//                        UIViewController* vc=[RAUtils getViewController :self];
-//                        [((CartViewController *)vc).itemListTable reloadData];
-//                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                    }
-//
-//
-//
-//                });
-//            });
-    
     
 }
 -(void) set_Count:(int) count
@@ -313,7 +193,7 @@
     if(m!=0)
         
     {
-        [RAUtils message_alert:[NSString stringWithFormat:@"QTY must be a multiple of %d",mpack] title:@"Warrning" controller:[RAUtils getViewController:self]];
+        [RAUtils message_box:@"Warrning" message:[NSString stringWithFormat:@"QTY must be a multiple of %d",mpack] completion:nil];
         textField.text = [NSString stringWithFormat:@"%d",self.pre_val];
         return;
     }
@@ -342,39 +222,14 @@
                 {
                     UIViewController* vc=[RAUtils getViewController :self];
                     [((CartViewController *)vc).itemListTable reloadData];
-                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+//                    [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
+                    [RAUtils message_box:@"Change Model Count" message:cart_json[@"err_msg"] completion:nil];
                 }
                 
                 
                 
             }];
             
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* cart_json = [RANetwork cart_setQTY:self.cart_id value:qty];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                    if([[cart_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        //                if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-//                        //                    [self.delegate returnQTY:qty];
-//                        //                }
-//
-//                        if(self.onReturnQTY)
-//                            self.onReturnQTY(qty,cart_json);
-//                    }
-//                    else
-//                    {
-//                        UIViewController* vc=[RAUtils getViewController :self];
-//                        [((CartViewController *)vc).itemListTable reloadData];
-//                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                    }
-//
-//
-//
-//                });
-//            });
 
         }
         

+ 2 - 48
RedAnt ERP Mobile/HMLG Scan Order/ScanHomeViewController.m

@@ -127,25 +127,7 @@
             
             NSMutableDictionary* return_json = result;
             
-//            [waitalert dismissViewControllerAnimated:YES completion:^{
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-//
-//
-//                    self.newslist = return_json[@"newslist"];
-//
-//                    [self.table reloadData];
-////                    if(self.newslist.count>0)
-////                    {
-////
-////                    }
-//
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Load Site News" controller:self] ;
-//                }
-//            }];
+
             {
                 if([[return_json valueForKey:@"result"] intValue]==2)
                 {
@@ -164,7 +146,6 @@
                 {
                     self.newslist = [NSArray new];
                     [self.table reloadData];
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Load Site News" controller:self] ;
                 }
             }
                
@@ -172,33 +153,6 @@
     }
     
     
-//    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Loading Site News" completion:^{
-//        [RADataProvider request_scan_news:^(NSMutableDictionary *result) {
-//
-//            NSMutableDictionary* return_json = result;
-//
-//            [waitalert dismissViewControllerAnimated:YES completion:^{
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-//
-//
-//                    self.newslist = return_json[@"newslist"];
-//
-//                    [self.table reloadData];
-////                    if(self.newslist.count>0)
-////                    {
-////
-////                    }
-//
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Load Site News" controller:self] ;
-//                }
-//            }];
-//
-//        }];
-//    }];
-  
+
 }
 @end

+ 1 - 2
RedAnt ERP Mobile/HMLG Scan Order/ScanListCell.m

@@ -138,9 +138,8 @@
             
         [OLDataProvider saveScanCart:RASingleton.sharedInstance.scan_cart];
 
-    [RAUtils message_alert:@"Successfully" title:[NSString stringWithFormat: @"%@ added to cart",jitem[@"model"]] controller:[RAUtils getViewController:self]];
-    
     
+    [RAUtils message_box:[NSString stringWithFormat: @"%@ added to cart",jitem[@"model"]] message:@"Successfully" completion:nil];
 }
 
 - (void)setModelJson:(NSMutableDictionary *)modelJson

+ 0 - 75
RedAnt ERP Mobile/HMLG Scan Order/ScanModelListCell.m

@@ -278,79 +278,4 @@
         
     }
 }
-//
-//#pragma mark textField delegate
-//
-//- (BOOL)textFieldShouldReturn:(UITextField *)textField {
-//    [textField resignFirstResponder];
-//    return NO;
-//}
-//-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
-//    
-//    
-////    DebugLog(@"text:%@",textField.text);
-//    
-//    
-//  
-//    NSCharacterSet *cs;
-//    cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS]invertedSet];
-//    
-//    NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs]componentsJoinedByString:@""];
-//    
-//    BOOL canChange = [string isEqualToString:filtered];
-//    
-//    
-//    
-//    
-//    return canChange;
-//}
-//- (void)textFieldDidEndEditing:(UITextField *)textField
-//{
-//    
-//    
-////    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//    int qty = [textField.text intValue];
-//    
-//    if(qty==0)
-//        qty=self.steper.minimumValue;
-//    
-//
-////    if ((int)qty % (int)self.stepper.stepValue != 0) {
-////        UIViewController* vc=[RAUtils getViewController :self];
-////        [((CartViewController *)vc).itemListTable reloadData];
-////        [RAUtils message_alert:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)] title:@"Change Model Count" controller:vc];
-////        return;
-////    }
-////
-//        
-//        int c=qty;
-//        
-//        int m=c%(int)(self.steper.stepValue);
-//        if(m!=0)
-//            
-//        {
-//            [RAUtils message_alert:[NSString stringWithFormat:@"QTY must be a multiple of %d",(int)self.steper.stepValue] title:@"Warrning" controller:[RAUtils getViewController:self]];
-//            textField.text = [NSString stringWithFormat:@"%d",self.pre_val];
-//        }
-//    
-//    self.pre_val = qty;
-//
-//    
-//        
-//    
-//    
-//    
-//    
-//
-//}
-//
-//- (void)textFieldDidBeginEditing:(UITextField *)textField
-//{
-//    NSString* text = textField.text;
-//    if(text.length==0)
-//        text=@"0";
-//    self.pre_val = [textField.text intValue];
-//    
-//   // self.last_edit = textField.text;
-//}
 @end

+ 6 - 7
RedAnt ERP Mobile/HMLG Scan Order/ScanOrderModelListViewController.m

@@ -348,17 +348,16 @@
         
         NSString* models=[RAConvertor arr2string:arrname separator:@"," trim:false];
         
-        [RAUtils message_alert:@"Successfully" title:[NSString stringWithFormat: @"%@ added to cart",models] controller:self action_handler:^(UIAlertAction * _Nonnull action) {
+        
+        [RAUtils message_box:[NSString stringWithFormat: @"%@ added to cart",models] message:@"Successfully" completion:^{
             [self dismissViewControllerAnimated:true completion:^{
                     if(self.returnValue)
                         self.returnValue(self.modellist);
             }];
-        } completion:nil];
-        
-//        [RAUtils message_alert:@"Successful" title:[NSString stringWithFormat: @"%@ added to cart",models] controller:[RAUtils getViewController:self]];
-        
-        
+
+        }];
         
+
     
     
     }
@@ -438,7 +437,7 @@
     if(m!=0)
         
     {
-        [RAUtils message_alert:[NSString stringWithFormat:@"QTY must be a multiple of %d",mpack] title:@"Warrning" controller:self];
+        [RAUtils message_box:@"Warrning" message:[NSString stringWithFormat:@"QTY must be a multiple of %d",mpack] completion:nil];
         textField.text = [NSString stringWithFormat:@"%d",[item[@"count"] intValue]];
         self.edit_check = false;
         return;

+ 2 - 2
RedAnt ERP Mobile/HMLG Scan Order/ScanOrderScanModelViewController.m

@@ -153,7 +153,7 @@
     if ((int)qty % (int)self.stepper.stepValue != 0) {
         UIViewController* vc=[RAUtils getViewController :self];
         [((CartViewController *)vc).itemListTable reloadData];
-        [RAUtils message_alert:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)] title:@"Change Model Count" controller:vc];
+        [RAUtils message_box:@"Change Model Count" message:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)] completion:nil];
         return;
     }
 #endif
@@ -165,7 +165,7 @@
         if(m!=0)
             
         {
-            [RAUtils message_alert:[NSString stringWithFormat:@"QTY must be a multiple of %d",(int)self.qtystepper.stepValue] title:@"Warrning" controller:self];
+            [RAUtils message_box:@"Warrning" message:[NSString stringWithFormat:@"QTY must be a multiple of%d",(int)self.qtystepper.stepValue] completion:nil];
             textField.text = [NSString stringWithFormat:@"%d",self.pre_val];
         }
     

+ 7 - 31
RedAnt ERP Mobile/HMLG Scan Order/ScanSearchViewController.m

@@ -277,19 +277,7 @@
     }
     dispatch_async(dispatch_get_main_queue(), ^{
         
-//        if(self.loadall)
-//        {
-////            if(self.showalert)
-//            {
-////                self.showalert=false;
-//                [RAUtils message_alert:@"All loaded" title:@"Loading items" controller:self] ;
-//            }
-//            return;
-//        }
-//
-//        self.mum.hidden = false;
-//        [self.mum startAnimating];
-//        self.mum.center = self.view.center;
+
         
         self.isrefreshing=true;
         
@@ -350,7 +338,7 @@
             }
             else
             {
-                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+                [RAUtils message_box:@"Search" message:[category_more valueForKey:@"err_msg"] completion:nil];
             }
             self.isrefreshing=false;
             
@@ -423,7 +411,9 @@
                 
                 if(c==0)
                 {
-                    [RAUtils message_alert:@"No results found" title:@"Search" controller:self];
+
+                    
+                    [RAUtils message_box:@"Search" message:@"No results found" completion:nil];
                     return;
                 }
                 self.offset = c;
@@ -453,25 +443,11 @@
                 
                 [self.tableview reloadData];
                 
-//                int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
-//
-//                if(total<2)
-//                {
-//                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
-//                    if(total==1)
-//                    {
-//                        NSDictionary * detail_item = [item_json objectForKey:@"item_0"];
-//                        NSString* detail_id=    [detail_item valueForKey:@"product_id"] ;
-//
-//                        [self showDetailat:detail_id category_id:nil name:[detail_item objectForKey:@"fash_name"] index:0];
-//                    }
-//                }
-//                else
-//                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
+
             }
             else
             {
-                [RAUtils message_alert:[category_data valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+                [RAUtils message_box:@"Search" message:[category_data valueForKey:@"err_msg"] completion:nil];
             }
             
             self.isrefreshing=false;

+ 30 - 53
RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m

@@ -285,7 +285,8 @@
     }
     else
     {
-        [RAUtils message_alert:@"Please setup the server first." title:@"Warrning" controller:self];
+
+        [RAUtils message_box:@"Warrning" message:@"Please setup the server first." completion:nil];
     }
 }
 
@@ -308,7 +309,9 @@
         [RADataProvider load_scan_models];
         
 //        NSString* file_name=[appDelegate.downloadurl lastPathComponent];
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update local data" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update local data" completion:^{
+        
+        PopWaitAlert* pop =[RAUtils waiting_pop:@"Update local data" completion:nil];
             dispatch_async(dispatch_get_global_queue(0, 0), ^{
                 
 
@@ -316,7 +319,8 @@
                 NSData*  download_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:appDelegate.downloadurl]];
                 dispatch_async(dispatch_get_main_queue(), ^{
                     
-                    [waitalert dismissViewControllerAnimated:false completion:^{
+//                    [waitalert dismissViewControllerAnimated:false completion:^{
+                    [pop hide];
                         if(download_data!=nil)
                         {
                             
@@ -354,9 +358,8 @@
                                     [fileManager removeItemAtPath:path error:nil];
                                     [fileManager removeItemAtPath:unZipTo error:nil];
                                     
-                                    [RAUtils message_alert:@"Can not unzip template file, please try download again." title:@"Warrning" controller:self];
-                                    
                                     
+                                    [RAUtils message_box:@"Warrning" message:@"Can not unzip template file, please try download again." completion:nil];
                                     
                                     
                                 }
@@ -367,7 +370,8 @@
                                     
                                     NSFileManager *fileManager = [NSFileManager defaultManager];
                                     [fileManager removeItemAtPath:path error:nil];
-                                    [RAUtils message_alert:@"Update template file successful." title:@"Message" controller:self];
+                                    
+                                    [RAUtils message_box:@"Message" message:@"Update template file successful." completion:nil];
                                     
         //                            [RADataProvider encrypt_scan_models];
 
@@ -385,7 +389,8 @@
                             else
                             {
                                 //打开文件失败,通常是文件路径有问题或密码错误。
-                                [RAUtils message_alert:@"Can not unzip template file, please contact the Administrator." title:@"Warrning" controller:self];
+                                
+                                [RAUtils message_box:@"Warrning" message:@"Can not unzip template file, please contact the Administrator." completion:nil];
                                 
                         //        NSFileManager *fileManager = [NSFileManager defaultManager];
                         //        [fileManager removeItemAtPath:zipFile error:nil];
@@ -398,10 +403,10 @@
         //                    cell.imageView.image=img;
                         }
                         else
-                            [RAUtils message_alert:@"Can not download template file. Please check online ERP setting or contact your administrator." title:@"Warrning" controller:self];
+                        [RAUtils message_box:@"Warrning" message:@"Can not download template file. Please check online ERP setting or contact your administrator." completion:nil];
                         
                         [ActiveViewController Notify:@"ScanSearchViewController" Message:@"Clear"];
-                    }];
+//                    }];
                     
                    
     //                    cell.imageView.image=[UIImage imageNamed:@"notfound_s"];
@@ -409,7 +414,7 @@
                 });
                 
             });
-        }];
+//        }];
 
         
         
@@ -420,42 +425,11 @@
     }
     else
     {
-        [RAUtils message_alert:@"Please setup the server first." title:@"Warrning" controller:self];
+        [RAUtils message_box:@"Warrning" message:@"Please setup the server first." completion:nil];
     }
 }
 - (IBAction)onScanClick:(id)sender {
-//    __weak typeof(self) weakself = self;
-////    ScannerViewController *scannerVC = [[UIStoryboard storyboardWithName:@"cam_scan" bundle:nil] instantiateViewControllerWithIdentifier:@"NewScannerViewController"];
-////    scannerVC.returnCode = ^(NSString *code) {
-////        // 扫描成功保存扫描值
-////        if (weakself) {
-////            __strong typeof(weakself) strongSelf = weakself;
-////            [strongSelf processScanResult:code];
-////        }
-////    };
-////    [self presentViewController:scannerVC animated:YES completion:nil];
-//
-//    RAQRCodeScannerViewController *scannerVC = [[UIStoryboard storyboardWithName:@"QRCode" bundle:nil] instantiateViewControllerWithIdentifier:@"RAQRCodeScannerViewControllerAuto"];
-//
-////    RAQRCodeScannerViewController *scannerVC = [RAQRCodeScannerViewController viewControllerFromStoryboard];
-//    scannerVC.QRCodeViewControllerDidCompletion = ^(RAQRCodeScannerViewController *qrcodeViewController, NSString *value) {
-//
-//        if (weakself) {
-//            __strong typeof(weakself) strongSelf = weakself;
-//            [strongSelf processScanResult:value];
-//
-//
-//        }
-//
-//        [qrcodeViewController dismissViewControllerAnimated:YES completion:nil];
-//    };
-//
-//    scannerVC.QRCodeViewControllerDidCanceled = ^(RAQRCodeScannerViewController *qrcodeViewController) {
-//
-//        [qrcodeViewController dismissViewControllerAnimated:YES completion:nil];
-//    };
-//
-//    [self presentViewController:scannerVC animated:YES completion:nil];
+
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     if(appDelegate.bLogin)
@@ -668,7 +642,7 @@
         else {
             
             
-            [RAUtils message_alert:@"Wrong QR-CODE?" title:@"Can not setup server" controller:self];
+            [RAUtils message_box:@"Can not setup server" message:@"Wrong QR-CODE?" completion:nil];
             
 //            [RAUtils alert_view:@"Wrong QR-CODE?" title:@"Can not setup server"];
             //                    strongself.nameTextField.text = nil;
@@ -809,7 +783,7 @@
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     if(appDelegate.user.length==0)
     {
-        [RAUtils message_alert:@"You must sign in first." title:@"Change Password" controller:self];
+        [RAUtils message_box:@"Change Password" message:@"You must sign in first." completion:nil];
         return;
     }
     
@@ -845,7 +819,7 @@
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     if(appDelegate.user.length==0)
     {
-        [RAUtils message_alert:@"You must sign in first." title:@"Delete Account" controller:self];
+        [RAUtils message_box:@"Delete Account" message:@"You must sign in first." completion:nil];
         return;
     }
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Delete Account" message:@"Are you sure you want to permanently delete your account?" preferredStyle:UIAlertControllerStyleAlert];
@@ -857,11 +831,13 @@
             if([appDelegate.password isEqualToString:titleTextField.text])
             {
                 NSLog(@"%@", @"run process");
-                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Account" completion:^{
+//                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Account" completion:^{
+                PopWaitAlert* pop =[RAUtils waiting_pop:@"Delete Account" completion:nil];
                     [RANetwork request_delete_account:^(NSMutableDictionary *result) {
                         NSMutableDictionary* return_json =result;
                         
-                        [waitalert dismissViewControllerAnimated:YES completion:^{
+//                        [waitalert dismissViewControllerAnimated:YES completion:^{
+                        [pop hide];
                             if([[return_json valueForKey:@"result"] intValue]==2)
                             {
                                 //                    [self hideMenu];
@@ -870,13 +846,13 @@
                                 MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
                                 [main_vc checklogin :false];
 
-                                [RAUtils message_alert:@"Account deleted." title:nil controller:self];
+                                [RAUtils message_box:@"Delete Account" message:@"Account deleted." completion:nil];
                             }
                             else
                             {
-                                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Delete Account" controller:self] ;
+                                [RAUtils message_box:@"Delete Account" message:[return_json valueForKey:@"err_msg"] completion:nil];
                             }
-                        }];
+//                        }];
                                         
                                         
                                         
@@ -886,13 +862,14 @@
                                         
                                     
                     }];
-                }];
+//                }];
                 
                 
             }
             else
             {
-                [RAUtils message_alert:@"Wrong password." title:nil controller:self];
+                
+                [RAUtils message_box:@"Delete Account" message:@"Wrong password." completion:nil];
             }
             
         }]];

+ 19 - 150
RedAnt ERP Mobile/HMLG Scan Order/SetupServerViewController.m

@@ -36,17 +36,22 @@
     
     if(self.editPassword.text.length==0)
     {
-        [RAUtils message_alert:@"Password can't be empty" title:@"verify Server" controller:self];
+        [RAUtils message_box:@"verify Server" message:@"Password can't be empty" completion:nil];
         return;
     }
     
-    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Verify" completion:nil];
+//    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Verify" completion:nil];
+    
+    PopWaitAlert* pop=[RAUtils waiting_pop:@"Verify" completion:nil];
+    
+    
     [RADataProvider request_validate_scan_server:self.server[@"url"] name:self.server[@"name"] password:self.editPassword.text completionHandler:^(NSMutableDictionary *result) {
         
         
         NSMutableDictionary* return_json = result;
         
-        [waitalert dismissViewControllerAnimated:YES completion:^{
+//        [waitalert dismissViewControllerAnimated:YES completion:^{
+        [pop hide];
             if([[return_json valueForKey:@"result"] intValue]==2)
             {
 
@@ -101,9 +106,9 @@
             }
             else
             {
-                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Load Server List" controller:self] ;
+                [RAUtils message_box:@"Load Server List" message:[return_json valueForKey:@"err_msg"] completion:nil];
             }
-        }];
+//        }];
            
     }];
     
@@ -118,146 +123,6 @@
     [userDefaults setValue:value forKey:key];
     [userDefaults synchronize];
 }
-//-(void) updateTemplate
-//{
-//    
-////    if(self.internalTextField.text.length>0)
-//    {
-//        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//        NSString *documents = [paths objectAtIndex:0];
-//        
-//        [RAUtils deletefiles:[documents stringByAppendingPathComponent:@"download"]];
-//        RASingleton.sharedInstance.scan_list = nil;
-//        [RADataProvider load_scan_models];
-////        NSString* file_name=[appDelegate.downloadurl lastPathComponent];
-//        
-//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update local data" completion:^{
-//            dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//                
-//                
-//                
-//                
-//                
-//                NSData*  download_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:appDelegate.downloadurl]];
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    [waitalert dismissViewControllerAnimated:false completion:^{
-//                        if(download_data!=nil)
-//                        {
-//                            NSString* file_name=[appDelegate.downloadurl lastPathComponent];
-//                            NSString* path = [documents stringByAppendingPathComponent:file_name];
-//                            [RAUtils saveData:download_data toPath:path];
-//                            
-//                            ZipArchive* zip = [[ZipArchive alloc] init];
-//                            NSString* unZipTo=[documents stringByAppendingPathComponent:@"download"];
-//        //                    NSFileManager* fileManager=[NSFileManager defaultManager];
-//        //                    [fileManager removeItemAtPath:unZipTo error:nil];
-//        //                    NSString *unZipTo = [temp stringByAppendingPathComponent:unziplocation];
-//                            //
-//                            //    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//                            //    NSString *documentPath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
-//                            //NSString* zipFile = [documentPath stringByAppendingString:@"/images.zip"] ;
-//                            // NSString* unZipTo = img_cache;//[documentPath stringByAppendingString:@"/images"] ;
-//                            
-//                            DebugLog(@"path: %@",unZipTo);
-//                            if( [zip UnzipOpenFile:path Password:nil] ){
-//                                BOOL result = [zip UnzipFileTo:unZipTo overWrite:YES];
-//                                if( NO==result )
-//                                {
-//                                    //            int aaa=0;
-//                                    //解压失败
-//                                  
-//                                    [zip UnzipCloseFile];
-//                                    //文件损坏,删除文件重试
-//                                    
-//                                    
-//                                    NSFileManager* fileManager=[NSFileManager defaultManager];
-//                                    //debug
-//                        //            BOOL blDele= [fileManager removeItemAtPath:zipFile error:nil];
-//                                    [fileManager removeItemAtPath:path error:nil];
-//                                    [fileManager removeItemAtPath:unZipTo error:nil];
-//                                    
-//                                    [RAUtils message_alert:@"Can not unzip template file, please try download again." title:@"Warrning" controller:self];
-//                                    
-//                                    
-//                                    
-//                                    
-//                                }
-//                                else
-//                                {
-//                                    [zip UnzipCloseFile];
-//                                    
-//                                    
-//                                    NSFileManager *fileManager = [NSFileManager defaultManager];
-//                                    [fileManager removeItemAtPath:path error:nil];
-////                                    [RAUtils message_alert:@"Update template file successful." title:@"Message" controller:self];
-//
-//                                    
-//        //                            [RADataProvider encrypt_scan_models];
-//                                    NSMutableDictionary *templateDic = [NSMutableDictionary dictionary];
-//                                    NSString* datetime= [RAUtils current_date_time];
-//                                    templateDic[@"updatetime"]= datetime;
-//                                    [self setUserDefaultsValue:templateDic forKey:@"ScanTemplate"];
-//                                    
-//                                    
-//                                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                                    [main_vc  scanLogin];
-//        //                            [OLDataProvider guestLogin];
-//                                    [RADataProvider load_scan_models];
-//        //                            [self loadTemplate];
-//                                    
-//                                   
-//                                    [RAUtils message_alert:@"Update template file successful." title:@"Message" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
-//                                        [self.navigationController popViewControllerAnimated:false];
-//                                    } completion:nil];
-//                                    
-//                                    
-//                                }
-//                                //[zip UnzipCloseFile];
-//                            }
-//                            else
-//                            {
-//                                //打开文件失败,通常是文件路径有问题或密码错误。
-//                                [RAUtils message_alert:@"Can not unzip template file, please contact the Administrator." title:@"Warrning" controller:self];
-//                                
-//                        //        NSFileManager *fileManager = [NSFileManager defaultManager];
-//                        //        [fileManager removeItemAtPath:zipFile error:nil];
-//                            }
-//                            
-//                            
-//        //                    [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
-//        //
-//        //                    UIImage * img =[UIImage imageWithData:downloadimg_data];
-//        //                    cell.imageView.image=img;
-//                        }
-//                        else
-//                            [RAUtils message_alert:@"Can not update template file, you can update manually in the setting." title:@"Warrning" controller:self];
-//                        
-//                        
-//                        
-//                    }];
-//                    
-//                    
-//
-//    //                    cell.imageView.image=[UIImage imageNamed:@"notfound_s"];
-//                    
-//                });
-//                
-//            });
-//        }];
-//                
-//        
-//        
-// 
-//        
-//        
-////        NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:appDelegate.downloadurl]];
-////        [RADataProvider downloadFileOffset:0 Param:nil from:appDelegate.downloadurl method:@"post" toPath:[documents stringByAppendingPathComponent:file_name] progressHandler:nil completionHandler:^(NSMutableDictionary *result) {
-////            int i=0;    ;
-////        }];
-//    }
-//
-//}
 
 - (IBAction)onSelectServer:(id)sender {
     
@@ -277,12 +142,15 @@
 
 -(void) loadServerList
 {
-    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Loading Server List" completion:^{
+//    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Loading Server List" completion:^{
+    \
+    PopWaitAlert* pop=[RAUtils waiting_pop:@"Loading Server List" completion:nil];
         [RADataProvider request_scan_server:^(NSMutableDictionary *result) {
             
             NSMutableDictionary* return_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 if([[return_json valueForKey:@"result"] intValue]==2)
                 {
 
@@ -297,12 +165,13 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Load Server List" controller:self] ;
+                    [RAUtils message_box:@"Load Server List" message:[return_json valueForKey:@"err_msg"] completion:nil];
+
                 }
-            }];
+//            }];
                
         }];
-    }];
+//    }];
   
 }
 /*

+ 21 - 9
RedAnt ERP Mobile/HMLG Scan Order/SignUpViewController.m

@@ -28,40 +28,52 @@
     
     if(![RAUtils validateEmail:email])
     {
-        [RAUtils message_alert:@"Email invalidate" title:@"Warrning" controller:self];
+        
+        
+        
+        [RAUtils message_box:@"Warrning" message:@"Email invalidate" completion:nil];
+
         return;
     }
     if(![RAUtils checkPassword:pwd])
     {
-        [RAUtils message_alert:@"Password must be 8-16 characters and contain numbers and letters." title:@"Warrning" controller:self];
+
+        [RAUtils message_box:@"Warrning" message:@"Password must be 8-16 characters and contain numbers and letters." completion:nil];
         return;
     }
     if(![pwd isEqualToString:cpwd])
     {
-        [RAUtils message_alert:@"Password does not equal" title:@"Warrning" controller:self];
+
+        [RAUtils message_box:@"Warrning" message:@"Password does not equal" completion:nil];
         return;
     }
-    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Sign Up" completion:nil];
+//    __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Sign Up" completion:nil];
+    
+    PopWaitAlert * pop = [RAUtils waiting_pop:@"Sign Up" completion:nil];
     
     dispatch_async(dispatch_get_main_queue(), ^{
         [RADataProvider request_sign_up:user email:email password:pwd completionHandler:^(NSMutableDictionary *result) {
-            [waitalert dismissViewControllerAnimated:true completion:^{
+//            [waitalert dismissViewControllerAnimated:true completion:^{
+            
+            [pop hide];
                 NSMutableDictionary* return_json = result;
                 if([[return_json valueForKey:@"result"] intValue]==2)
                 {
 
                     
-                    [RAUtils message_alert:@"Sign Up Successful" title:@"Sign Up" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
+                    [RAUtils message_box:@"Sign Up" message:@"Sign Up Successful" completion:^{
                         [self dismissViewControllerAnimated:true completion:nil];
-                    } completion:nil];
+                    }];
+                    
+
 
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Up" controller:self] ;
+                    [RAUtils message_box:@"Sign Up" message:[return_json valueForKey:@"err_msg"] completion:nil];
                 }
 
-            }];
+//            }];
         }];
     });
     

+ 6 - 166
RedAnt ERP Mobile/common/AppDelegateBase.m

@@ -806,53 +806,13 @@ void UncaughtExceptionHandler(NSException *exception) {
                         else
                         {
                             MainViewController *mainVC = [self.window.rootViewController.childViewControllers lastObject];
-                            [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:mainVC] ;
+                            
+                            [RAUtils message_box:@"Open Order" message:[order_json valueForKey:@"err_msg"]  completion:nil];
                         }
                         
                     }];
                     
-                    // 首先通过order code 打开订单
-//                    NSDictionary* order_json = [RANetwork open_Order:order_code];
-                    
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//                        //                [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                        if([[order_json valueForKey:@"result"] intValue]==2)
-//                        {
-//
-//                            self.order_code = order_code;
-//                            self.order_status = order_status;
-//                            [self SetSo:so];
-//
-//                            if (userType != USER_ROLE_CUSTOMER) {
-//
-//                                [RANetwork request_contactinfo:order_customer_id completionHandler:^(NSMutableDictionary *result) {
-//                                    self.customerInfo = [result[@"customerInfo"] mutableCopy];
-//                                    self.contact_id=[self.customerInfo valueForKey:@"customer_cid"];
-//                                }];
-//
-////                                self.customerInfo = [[[RANetwork request_CustomerInfo:order_customer_id] objectForKey:@"customerInfo"] mutableCopy];
-////
-////                                self.contact_id=[self.customerInfo valueForKey:@"customer_cid"];
-//                            }
-//
-//
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                            [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                            [mainVC reloadOrder:true immediately:false];
-//                            [mainVC reloadCart:true immediately:false];
-//#endif
-//
-//                        }
-//                        else
-//                        {
-//                            [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:mainVC] ;
-//                        }
-//                    });
-                    
+
                     
                     
                     // 再place order
@@ -1355,7 +1315,9 @@ void UncaughtExceptionHandler(NSException *exception) {
                     // 清理数据库要放入线程中执行
                      NSString *out_of_stock_ids = [json valueForKey:@"stock_out_so_id"];
                                     if (out_of_stock_ids) {
-                                        [RAUtils message_alert:[NSString stringWithFormat:@"Below orders were not submitted because some models were out of stock. You can check from order history under online mode.\n %@",out_of_stock_ids] title:@"Warning" controller:self.main_vc];
+
+                                        
+                                        [RAUtils message_box:@"Warning" message:[NSString stringWithFormat:@"Below orders were not submitted because some models were out of stock. You can check from order history under online mode.\n %@",out_of_stock_ids]  completion:nil];
                                     }
                                     
                                     [weakSelf add_downloadlog:@"Upload successful."];
@@ -1424,128 +1386,6 @@ void UncaughtExceptionHandler(NSException *exception) {
         } DecryptHandler:nil];
         
         
-        //        AFHTTPRequestSerializer* serializer=[AFHTTPRequestSerializer serializer] ;
-        //
-        //        serializer.timeoutInterval=300;
-        //
-        //        NSMutableURLRequest *request = [serializer multipartFormRequestWithMethod:@"POST" URLString:URL_UPLOAD_OFFLINE parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
-        //            [formData appendPartWithFileData:data name:@"upfile" fileName:[upfile lastPathComponent] mimeType:@"application/zip"];
-        //        } error:nil];
-        //
-        //
-        //
-        //        AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
-        //
-        //        NSProgress *progress = nil;
-        //
-        //        NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithStreamedRequest:request progress:&progress completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
-        //
-        //
-        //
-        //            if (error) {
-        //
-        //                NSString* err_msg = [error localizedDescription];
-        //                DebugLog(@"%@",err_msg);// [self.view updateWithMessage:[NSString stringWithFormat:@"Error : %@!", error.debugDescription]];
-        //
-        //
-        //                NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-        //
-        //                DebugLog(@"data string: %@",str);
-        //                [self add_downloadlog:err_msg];
-        //                [self add_downloadlog:@"Can not connect to server please try again."];
-        //                [self.settingUI onSyncFinish];
-        //
-        //            } else {
-        //                DebugLog(@"response ");
-        //
-        //
-        //
-        //                NSData *data = [NSJSONSerialization dataWithJSONObject:(NSDictionary*)responseObject options:kNilOptions error:nil];
-        //
-        //                // 再将NSData转为字符串
-        //                NSString *jsonStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-        //
-        //                //            NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-        //
-        //                DebugLog(@"data string: %@",jsonStr);
-        //
-        //                NSDictionary* json = responseObject;
-        //
-        //
-        //                if([[json valueForKey:@"result"] intValue]==2)
-        //                {
-        //                    NSString *out_of_stock_ids = [json valueForKey:@"stock_out_so_id"];
-        //                    if (out_of_stock_ids) {
-        //                        [RAUtils message_alert:[NSString stringWithFormat:@"Below orders were not submitted because some models were out of stock. You can check from order history under online mode.\n %@",out_of_stock_ids] title:@"Warning" controller:self.main_vc];
-        //                    }
-        //
-        //                    [self add_downloadlog:@"Upload successful."];
-        //                    [iSalesDB disable_trigger]
-        //                    NSString* so_id=[RAUtils arr2string:arr_order separator:@"," trim:true brackets:@"'"];
-        //
-        //                    [iSalesDB execSql:@"delete from offline_contact where not sync_data is null"];
-        //                    [iSalesDB execSql:@"delete from wishlist"];
-        //                    [iSalesDB execSql:[NSString stringWithFormat:@"delete from offline_order where so_id in(%@)",so_id]];
-        //                    [iSalesDB execSql:[NSString stringWithFormat:@"delete from offline_cart where so_no in(%@)",so_id]];
-        //                    [iSalesDB execSql:@"delete from offline_portfolio"];
-        //                    [iSalesDB execSql:@"delete from offline_pdf"];
-        //                    [OLDataProvider offline_clear_PDFCache];
-        //
-        //                    NSString* contactMap = json[@"contactMap"];
-        //                    if(contactMap.length>0)
-        //                    {
-        //                        NSDictionary* contactjson = [RAUtils string2dict:contactMap];
-        //                        NSArray *keys= [contactjson allKeys];
-        //                        //遍历keys
-        //                        for(int i=0;i<[keys count];i++)
-        //                        {
-        //                            //得到当前key
-        //                            NSString *key=[keys objectAtIndex:i];
-        //                            //如果key不是pic,说明value是字符类型,比如name:Boris
-        //                            NSString* value = [contactjson valueForKey:key];
-        //
-        //                            [iSalesDB execSql:[NSString stringWithFormat:@"update offline_order set customer_cid='%@' where customer_cid='%@' and order_id is null",value,key]];
-        //                            [iSalesDB execSql:[NSString stringWithFormat:@"update offline_order set customer_cid='%@' where receive_cid='%@' and order_id is null",value,key]];
-        //                            [iSalesDB execSql:[NSString stringWithFormat:@"update offline_order set customer_cid='%@' where sender_cid='%@' and order_id is null",value,key]];
-        //                            [iSalesDB execSql:[NSString stringWithFormat:@"update offline_order set customer_cid='%@' where shipping_billto_cid='%@' and order_id is null",value,key]];
-        //                            [iSalesDB execSql:[NSString stringWithFormat:@"update offline_order set customer_cid='%@' where billing_cid='%@' and order_id is null",value,key]];
-        //                            [iSalesDB execSql:[NSString stringWithFormat:@"update offline_order set customer_cid='%@' where returnto_cid='%@' and order_id is null",value,key]];
-        //
-        //                        }
-        //                    }
-        //                    //                    NSDictionary* contactjson= upjson[@"contact"];
-        //                    //                    NSDictionary* wishlistjson= upjson[@"wishlist"];
-        //                    //                    NSDictionary* orderjson= upjson[@"order"];
-        //
-        //                    [iSalesDB enable_trigger]
-        //                    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-        //                    [defaults removeObjectForKey:@"Forcedownload"];
-        //                    [defaults setBool:true forKey:@"Forcedownload"];
-        //                    [defaults synchronize];
-        //
-        //                    [self download_offline:ver useInternalAddress:buseinternaladdress];
-        //
-        //                }
-        //                else
-        //                {
-        //                    [self add_downloadlog:[json valueForKey:@"msg"]];
-        //                    [self add_downloadlog:@"Sync canceled."];
-        //                    [self.settingUI onSyncFinish];
-        //                }
-        //
-        //
-        //            }
-        //            //  [waitalert dismissViewControllerAnimated:YES completion:nil];
-        //        }];
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //        [uploadTask resume];
-        
     }
     
     

+ 31 - 381
RedAnt ERP Mobile/common/CartUtils.m

@@ -18,11 +18,15 @@
 +(void) neworder:(UIViewController*) vc selectorholder:(id)holder selector:(SEL)addtocart
 {
 
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Create Order" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
                 NSMutableDictionary* return_json = result;
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            
+            [pop hide];
                     if([[return_json valueForKey:@"result"] intValue]==2)
                     {
                         int resulti=[[return_json valueForKey:@"result"] intValue];
@@ -48,9 +52,11 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:vc] ;
+
+                        
+                        [RAUtils message_box:@"Create Order" message:[return_json valueForKey:@"err_msg"] completion:nil];
                     }
-                }];
+//                }];
         //        [waitalert dismissViewControllerAnimated:YES completion:nil];
                 
                 
@@ -62,44 +68,8 @@
                 
             }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = [RANetwork new_Order];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//
-//                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    appDelegate.order_code = order_code;
-//                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-//
-//                    [holder performSelector:addtocart];
-//
-//
-//
-//
-//                }
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:vc] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
+//    }];
+
 }
 
 +(void) add_to_cart:(UIViewController*) vc selectorholder:(id)holder selector:(SEL)addtocart
@@ -205,7 +175,9 @@
 
                                 cvc.onCancel = ^(){
 
-                                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order Error" controller:vc];
+                                    [RAUtils message_box:@"New Order Error" message:@"Cannot create order without customer infomation." completion:nil];
+                                    
+                                    
 
                                     // self.disable_refresh = false;
 
@@ -364,7 +336,7 @@
 
                             cvc.onCancel = ^(){
 
-                                [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order Error" controller:vc];
+                                [RAUtils message_box:@"New Order Error" message:@"Cannot create order without customer infomation." completion:nil];
 
                                 // self.disable_refresh = false;
 
@@ -407,12 +379,15 @@
             else
             {
 
-                __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Checking Pending Order" completion:^{
+//                __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Checking Pending Order" completion:^{
+                
+                PopWaitAlert* pop = [RAUtils waiting_pop:@"Checking Pending Order" completion:nil];
                     [RANetwork request_pendingorder:appDelegate.contact_id completionHandler:^(NSMutableDictionary *result) {
                         NSMutableDictionary* return_json =result;
                         
                         
-                        [waitalert dismissViewControllerAnimated:YES completion:^{
+//                        [waitalert dismissViewControllerAnimated:YES completion:^{
+                        [pop hide];
                             if([[return_json valueForKey:@"result"] intValue]==2)
                             {
                                 
@@ -501,7 +476,7 @@
                                                 
                                                 cvc.onCancel = ^(){
                                                     
-                                                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order Error" controller:vc];
+                                                    [RAUtils message_box:@"New Order Error" message:@"Cannot create order without customer infomation." completion:nil];
                                                     
                                                     // self.disable_refresh = false;
                                                     
@@ -660,7 +635,7 @@
                                                     
                                                     cvc.onCancel = ^(){
                                                         
-                                                        [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order Error" controller:vc];
+                                                        [RAUtils message_box:@"New Order Error" message:@"Cannot create order without customer infomation." completion:nil];
                                                         
                                                         // self.disable_refresh = false;
                                                         
@@ -701,7 +676,9 @@
                                     }
                                     else
                                     {
-                                        [RAUtils message_alert:[return_json valueForKey:@"You donot have permission to access order"] title:@"Add To Cart" controller:vc];
+
+                                        
+                                        [RAUtils message_box:@"Add To Cart" message:@"You donot have permission to access order" completion:nil];
                                     }
                                     
                                 }
@@ -711,9 +688,10 @@
                             else
                             {
                                 
-                                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Check Pending Order" controller:vc] ;
+                                
+                                [RAUtils message_box:@"Check Pending Order" message:[return_json valueForKey:@"err_msg"] completion:nil];
                             }
-                        }];
+//                        }];
                         
                         
 
@@ -724,342 +702,14 @@
                         
                     }];
 
-                }];
+//                }];
 
 
                 
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* return_json = [RANetwork request_PendingOrder:appDelegate.contact_id];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//                        if([[return_json valueForKey:@"result"] intValue]==2)
-//                        {
-//
-//                            bool openPendingOrder= [[return_json valueForKey:@"hasPending"] boolValue];
-//                            bool createNewOrder=appDelegate.can_create_order;
-//
-//                            if(openPendingOrder&&createNewOrder)
-//                            {
-//
-//                                NSString* msg =@"";
-//                                if(appDelegate.contact_id.length>0)
-//                                {
-//                                    msg = [msg stringByAppendingString:@"Customer:"];
-//                                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-//
-//                                }
-//
-//                                UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-//                                //block代码块取代了delegate
-//
-//
-//
-//                                UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-//
-//
-//                                    //  vc.disable_refresh = true;
-//                                    OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-//                                    ovc.showNavibar = true;
-//                                    ovc.customer_id = appDelegate.contact_id;
-//                                    ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-//
-//                                        [holder performSelector:addtocart];
-//
-//
-//                                    };
-//                                    ovc.init_style = OL_OPEN;
-//
-//                                    ovc.onCancel = ^(){
-//
-//                                        //  self.disable_refresh = false;
-//
-//
-//
-//                                    };
-//
-//                                    [vc.navigationController pushViewController:ovc animated:true];
-//
-//
-//
-//
-//
-//                                }];
-//
-//                                UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-//
-//
-//                                    {
-//                                        //create new;
-//                                        //    self.disable_refresh = true;
-//                                        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//                                        {
-//                                            ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//                                            cvc.showNavibar = true;
-//                                            cvc.contact_type = @"Sales_Order_Customer";
-//                                            cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//
-//                                                appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                                                appDelegate.customerInfo = value;
-//
-//
-//                                                if(appDelegate.order_code==nil)
-//                                                    [self neworder:vc selectorholder:holder selector:addtocart];
-//                                                //                                                            neworder();
-//
-//                                                //    [main_vc checklogin:true];
-//                                                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//
-//                                                //
-//                                                //                if(self.returnValue)
-//                                                //                    self.returnValue(value);
-//                                            };
-//
-//                                            cvc.onCancel = ^(){
-//
-//                                                [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order Error" controller:vc];
-//
-//                                                // self.disable_refresh = false;
-//
-//                                            };
-//                                            cvc.onReset = ^(){
-//                                                // [main_vc checklogin:true];
-//                                            };
-//
-//                                            [vc.navigationController pushViewController:cvc animated:true];
-//                                        }
-//                                        else
-//                                        {
-//                                            [self neworder:vc selectorholder:holder selector:addtocart];
-//                                        }
-//
-//                                    }
-//
-//
-//                                    DebugLog(@"No");
-//                                }];
-//                                [alertControl addAction:actionOne];
-//
-//                                [alertControl addAction:alertthree];
-//
-//                                UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-//                                }];
-//                                [alertControl addAction:alertcancel];
-//                                //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-//
-//
-//                                [vc presentViewController:alertControl animated:YES completion:nil];
-//
-//
-//
-//
-//
-//
-//                            }
-//                            else
-//                            {
-//                                if(openPendingOrder)
-//                                {
-//                                    NSString* msg =@"";
-//                                    if(appDelegate.contact_id.length>0)
-//                                    {
-//                                        msg = [msg stringByAppendingString:@"Customer:"];
-//                                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-//
-//                                    }
-//
-//                                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-//                                    //block代码块取代了delegate
-//
-//
-//
-//                                    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-//
-//
-//                                        //  vc.disable_refresh = true;
-//                                        OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-//                                        ovc.showNavibar = true;
-//                                        ovc.customer_id = appDelegate.contact_id;
-//                                        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-//
-//                                            [holder performSelector:addtocart];
-//
-//
-//                                        };
-//                                        ovc.init_style = OL_OPEN;
-//
-//                                        ovc.onCancel = ^(){
-//
-//                                            //  self.disable_refresh = false;
-//
-//
-//
-//                                        };
-//
-//                                        [vc.navigationController pushViewController:ovc animated:true];
-//
-//
-//
-//
-//
-//                                    }];
-//
-//
-//                                    [alertControl addAction:actionOne];
-//                                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-//                                    }];
-//                                    [alertControl addAction:alertcancel];
-//
-//                                    //   [alertControl addAction:alertthree];
-//
-//                                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-//
-//
-//                                    [vc presentViewController:alertControl animated:YES completion:nil];
-//
-//
-//
-//
-//
-//
-//
-//                                }
-//                                else if(createNewOrder)
-//                                {
-//                                    NSString* msg =@"";
-//                                    if(appDelegate.contact_id.length>0)
-//                                    {
-//                                        msg = [msg stringByAppendingString:@"Customer:"];
-//                                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-//
-//                                    }
-//
-//                                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-//                                    //block代码块取代了delegate
-//
-//
-//
-//
-//
-//                                    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-//
-//
-//                                        {
-//                                            //create new;
-//                                            //    self.disable_refresh = true;
-//                                            if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//                                            {
-//                                                ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//                                                cvc.showNavibar = true;
-//                                                cvc.contact_type = @"Sales_Order_Customer";
-//                                                cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//
-//                                                    appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                                                    appDelegate.customerInfo = value;
-//
-//
-//                                                    if(appDelegate.order_code==nil)
-//                                                        [self neworder:vc selectorholder:holder selector:addtocart];
-//                                                    //                                                            neworder();
-//
-//                                                    //    [main_vc checklogin:true];
-//                                                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//
-//                                                    //
-//                                                    //                if(self.returnValue)
-//                                                    //                    self.returnValue(value);
-//                                                };
-//
-//                                                cvc.onCancel = ^(){
-//
-//                                                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order Error" controller:vc];
-//
-//                                                    // self.disable_refresh = false;
-//
-//                                                };
-//                                                cvc.onReset = ^(){
-//                                                    // [main_vc checklogin:true];
-//                                                };
-//
-//                                                [vc.navigationController pushViewController:cvc animated:true];
-//                                            }
-//                                            else
-//                                            {
-//                                                [self neworder:vc selectorholder:holder selector:addtocart];
-//                                            }
-//
-//                                        }
-//
-//
-//                                        DebugLog(@"No");
-//                                    }];
-//                                    //                                        [alertControl addAction:actionOne];
-//
-//                                    [alertControl addAction:alertthree];
-//
-//                                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-//                                    }];
-//                                    [alertControl addAction:alertcancel];
-//
-//                                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-//
-//
-//                                    [vc presentViewController:alertControl animated:YES completion:nil];
-//
-//
-//
-//
-//
-//                                }
-//                                else
-//                                {
-//                                    [RAUtils message_alert:[return_json valueForKey:@"You donot have permission to access order"] title:@"Add To Cart" controller:vc];
-//                                }
-//
-//                            }
-//
-//
-//                        }
-//                        else
-//                        {
-//
-//                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Check Pending Order" controller:vc] ;
-//                        }
-//
-//
-//
-//
-//                    });
-//                });
 
 
             }
-            //            // [main_vc checklogin:false];
-            //
-            //            if(appDelegate.can_create_order)
-            //            {
-            //                NSString* msg =@"";
-            //                if(appDelegate.contact_id.length>0)
-            //                {
-            //                    msg = [msg stringByAppendingString:@"\n\nCustomer:"];
-            //                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-            //
-            //                }
-            //                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil),NSLocalizedString(@"Create new order", nil), nil];
-            //
-            //                // alert.
-            //                [alert show];
-            //            }
-            //            else
-            //            {
-            //                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil), nil];
-            //
-            //                // alert.
-            //                [alert show];
-            //            }
+
         }
         else
         {

+ 27 - 11
RedAnt ERP Mobile/common/ERP_Mobile_Cart.storyboard

@@ -1207,13 +1207,13 @@ Stock</string>
         <!--ItemNotesViewController-->
         <scene sceneID="KVI-6t-Fv8">
             <objects>
-                <viewController storyboardIdentifier="ItemNotesViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="aTp-LA-XSM" userLabel="ItemNotesViewController" customClass="ItemNotesViewController" sceneMemberID="viewController">
+                <viewController storyboardIdentifier="ItemNotesViewController" title="Item Notes" useStoryboardIdentifierAsRestorationIdentifier="YES" id="aTp-LA-XSM" userLabel="ItemNotesViewController" customClass="ItemNotesViewController" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="cMB-7O-YB4">
                         <rect key="frame" x="0.0" y="0.0" width="480" height="320"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                             <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="CSd-vz-o8d">
-                                <rect key="frame" x="10" y="10" width="460" height="250"/>
+                                <rect key="frame" x="10" y="24" width="460" height="236"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
@@ -1238,25 +1238,40 @@ Stock</string>
                                     <action selector="onSaveClicked:" destination="aTp-LA-XSM" eventType="touchUpInside" id="V3x-Ke-rGi"/>
                                 </connections>
                             </button>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Dq-HT-M55" userLabel="cancel" customClass="DefaultImageButton">
+                                <rect key="frame" x="216" y="270" width="102" height="30"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="30" id="0oq-xo-q4j"/>
+                                    <constraint firstAttribute="width" constant="102" id="Lfu-R7-9hW"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="20"/>
+                                <state key="normal" title="Save" backgroundImage="btn_cancel">
+                                    <color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                    <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </state>
+                                <userDefinedRuntimeAttributes>
+                                    <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
+                                        <integer key="value" value="19"/>
+                                    </userDefinedRuntimeAttribute>
+                                </userDefinedRuntimeAttributes>
+                                <connections>
+                                    <action selector="onCloseClicked:" destination="aTp-LA-XSM" eventType="touchUpInside" id="WqD-3B-iNQ"/>
+                                </connections>
+                            </button>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="XuB-is-1lr"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
+                            <constraint firstItem="CSd-vz-o8d" firstAttribute="top" secondItem="XuB-is-1lr" secondAttribute="top" id="7Pj-I5-WSR"/>
                             <constraint firstItem="XuB-is-1lr" firstAttribute="trailing" secondItem="CSd-vz-o8d" secondAttribute="trailing" constant="10" id="SZU-ZH-uTS"/>
                             <constraint firstItem="y3C-hl-3ZL" firstAttribute="top" secondItem="CSd-vz-o8d" secondAttribute="bottom" constant="10" id="fVz-44-wfn"/>
                             <constraint firstItem="XuB-is-1lr" firstAttribute="trailing" secondItem="y3C-hl-3ZL" secondAttribute="trailing" constant="30" id="fm1-ih-x4r"/>
                             <constraint firstItem="CSd-vz-o8d" firstAttribute="leading" secondItem="XuB-is-1lr" secondAttribute="leading" constant="10" id="iSh-De-0sd"/>
-                            <constraint firstItem="CSd-vz-o8d" firstAttribute="top" secondItem="cMB-7O-YB4" secondAttribute="top" constant="10" id="jpy-yl-9SL"/>
+                            <constraint firstItem="y3C-hl-3ZL" firstAttribute="leading" secondItem="4Dq-HT-M55" secondAttribute="trailing" constant="30" id="jfY-W7-ey4"/>
+                            <constraint firstItem="y3C-hl-3ZL" firstAttribute="centerY" secondItem="4Dq-HT-M55" secondAttribute="centerY" id="rdy-Wv-f8g"/>
                             <constraint firstAttribute="bottom" secondItem="y3C-hl-3ZL" secondAttribute="bottom" constant="20" id="tsb-om-23i"/>
                         </constraints>
                     </view>
-                    <navigationItem key="navigationItem" title="Item Notes" id="2im-Mr-UtR" userLabel="Item Notes">
-                        <barButtonItem key="rightBarButtonItem" title="Close" id="Sda-hD-o7j">
-                            <connections>
-                                <action selector="onCloseClicked:" destination="aTp-LA-XSM" id="Iz5-Kf-8a7"/>
-                            </connections>
-                        </barButtonItem>
-                    </navigationItem>
                     <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
@@ -1266,7 +1281,7 @@ Stock</string>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="vRC-Kf-Iua" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="3727" y="654"/>
+            <point key="canvasLocation" x="3726.6129032258063" y="653.4863195057369"/>
         </scene>
         <!--Choose a discount rate-->
         <scene sceneID="XUL-zW-RSQ">
@@ -1345,6 +1360,7 @@ Stock</string>
         </scene>
     </scenes>
     <resources>
+        <image name="btn_cancel" width="102" height="30"/>
         <image name="btn_cancelorder" width="30" height="30"/>
         <image name="btn_email_order" width="30" height="30"/>
         <image name="btn_print_order" width="30" height="30"/>

+ 43 - 290
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -680,11 +680,14 @@
     
     if(appDelegate.bLogin)
     {
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+        
+        PopWaitAlert* pop = [RAUtils waiting_pop:@"Sign out" completion:nil];
             [RANetwork request_logout:^(NSMutableDictionary *result) {
                 NSMutableDictionary* return_json =result;
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                [pop hide];
                     if([[return_json valueForKey:@"result"] intValue]==2)
                     {
                         //                    [self hideMenu];
@@ -717,9 +720,9 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
+                        [RAUtils message_box:@"Sign Out" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                     }
-                }];
+//                }];
                                 
                                 
                                 
@@ -730,57 +733,9 @@
                             
             }];
 
-        }];
+//        }];
         
                 
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* return_json = [RANetwork logout];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                
-//                
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-////                    [self hideMenu];
-////                    [self switchToHome:nil];
-//                    [appDelegate Logout];
-//                    [self checklogin :false];
-//                    if(showlogin)
-//                    {
-//                    LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
-//                    loginvc.returnValue = ^(bool blogin){
-//                        
-//                        [self checklogin :true];
-//                        
-//                    };
-//                    
-//                    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
-//                    
-//                    
-//                    
-//                    
-//                    
-//                    
-//                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-//                    [self presentViewController:navi animated:YES completion:^{
-//                        
-//                        DebugLog(@"login present.........");
-//                        
-//                    }];
-//                    }
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
-//                }
-//                
-//                
-//                
-//                
-//            });
-//        });
     }
     else
     {
@@ -979,7 +934,9 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:@"Customer Login does not support this feature." title:@"Contact List" controller:self] ;
+                    [RAUtils message_box:@"Contact List" message:@"Customer Login does not support this feature." completion:nil] ;
+                    
+                    
                 }
                 
             }
@@ -1441,7 +1398,7 @@
                                  
                                  cvc.onCancel = ^(){
                                      
-                                     [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+                                     [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
                                      
                                      
                                      
@@ -1637,7 +1594,7 @@
                          
                          cvc.onCancel = ^(){
                              
-                             [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+                             [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
                              
                              
                              
@@ -1881,36 +1838,11 @@
                 }
             else
             {
-                [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
+                [RAUtils message_box:@"Load Category Menu" message:[category valueForKey:@"err_msg"] completion:nil] ;
             }
         }];
         return;
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//                   
-//                   
-//                   NSDictionary* category=[RANetwork request_Cagegory];
-//                   
-//                   dispatch_async(dispatch_get_main_queue(), ^{
-//                       
-//                       if([[category valueForKey:@"result"] intValue]==2)
-//                       {
-//                           appDelegate.categoryMenu = category;
-//                           [categorymenuVC SetMenu:appDelegate.categoryMenu ];
-//                       }
-//                       else
-//                           if([[category valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-//                           {
-//                               [categorymenuVC SetMenu:nil ];
-//                           }
-//                       else
-//                       {
-//                           [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
-//                       }
-//                       
-//                       
-//                       
-//                   });
-//               });
+
     }
        
     else
@@ -2504,11 +2436,7 @@
         UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"New Offline Order" message:nil preferredStyle:UIAlertControllerStyleAlert];
         UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"With Offline Contact" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
 
-//            if(appDelegate.order_code && appDelegate.order_code.length>0)
-//            {
-//                [RAUtils message_alert:@"Please close current order and try again." title:@"" controller:self];
-//            }
-//            NSLog(@"new click");
+
             
             NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
             
@@ -2526,7 +2454,7 @@
             {
                 if(value==nil)
                 {
-                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+                    [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
                 }
                 else
                 {
@@ -2606,7 +2534,7 @@
 //                        self.norefresh = true;
                         if(appDelegate.customerInfo==nil)
                         {
-                            [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+                            [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
                         }
                         else
                         {
@@ -2652,7 +2580,7 @@
                     
                     cvc.onCancel = ^(){
                         
-                        [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+                        [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
                         
                         
                         
@@ -2688,145 +2616,6 @@
     }
 }
 
-//-(void) newoloorder
-//{
-//    NSString* order_code = [[NSUUID new] UUIDString];
-//                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                                appDelegate.order_code = order_code;
-//
-////    NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:URL_SO_CART ofType:@"json" ]];
-//    NSMutableDictionary* cartTemplate=[OLDataProvider loadScanTemplate:@"scan_cart.json"];
-//    RASingleton.sharedInstance.scan_cart=cartTemplate;//[[RAConvertor data2dict:json] mutableCopy];
-//    appDelegate.user_type = USER_ROLE_EMPLOYEE;
-//    appDelegate.can_set_cart_price = true;
-//    appDelegate.can_see_price = true;
-//
-////    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
-////        [RANetwork request_create_order:^(NSMutableDictionary *result) {
-////                NSMutableDictionary* return_json =result;
-////
-////                [waitalert dismissViewControllerAnimated:YES completion:^{
-////                    if([[return_json valueForKey:@"result"] intValue]==2)
-////                    {
-////                        int result=[[return_json valueForKey:@"result"] intValue];
-////                        if(result==2)
-////                        {
-////                            //successed.
-////
-////                            NSString* order_code = [return_json valueForKey:@"orderCode"];
-////                            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                            appDelegate.order_code = order_code;
-////                            appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-////
-////
-////        #ifdef RA_NOTIFICATION
-////                            [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-////        #else
-////                            MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-////                            [main_vc reloadCart:true immediately:false];
-////        #endif
-////
-//////                            [self ReloadData];
-////
-////
-////                            //     [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
-////                            //    [self loadpage];
-////
-////
-////                            //                    if(self.shopCartBlock!=nil)
-////                            //                    {
-////                            //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-////                            //
-////                            //
-////                            //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-////                            //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-////                            //                        iv.image = img;
-////                            //                        //                        [self.contentView addSubview:iv];
-////                            //                        self.shopCartBlock(iv);
-////                            //
-////                            //                    }
-////
-////                        }
-////                    }
-////                    else
-////                    {
-////                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
-////                    }
-////                }];
-////        //        [waitalert dismissViewControllerAnimated:YES completion:nil];
-////
-////
-////
-////
-////
-////
-////
-////
-////            }];
-////
-////    }];
-//
-////    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-////
-////        NSDictionary* return_json = [RANetwork new_Order];
-////
-////        dispatch_async(dispatch_get_main_queue(), ^{
-////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-////
-////
-////            if([[return_json valueForKey:@"result"] intValue]==2)
-////            {
-////                int result=[[return_json valueForKey:@"result"] intValue];
-////                if(result==2)
-////                {
-////                    //successed.
-////
-////                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-////                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                    appDelegate.order_code = order_code;
-////                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-////
-////
-////#ifdef RA_NOTIFICATION
-////                    [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-////#else
-////                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-////                    [main_vc reloadCart:true immediately:false];
-////#endif
-////
-////                    [self ReloadData];
-////
-////
-////                    //     [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
-////                    //    [self loadpage];
-////
-////
-////                    //                    if(self.shopCartBlock!=nil)
-////                    //                    {
-////                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-////                    //
-////                    //
-////                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-////                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-////                    //                        iv.image = img;
-////                    //                        //                        [self.contentView addSubview:iv];
-////                    //                        self.shopCartBlock(iv);
-////                    //
-////                    //                    }
-////
-////                }
-////            }
-////            else
-////            {
-////                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
-////            }
-////
-////
-////
-////
-////        });
-////    });
-//}
 #endif
 #pragma mark - Table view delegate
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
@@ -2840,9 +2629,7 @@
         PopupNavigationController * navi=[[PopupNavigationController alloc] initWithRootViewController:settingvc];
         navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
-            
-            //DebugLog(@"login.........");
-            //  <#code#>
+
         }];
         
         
@@ -3323,11 +3110,13 @@
                 if([appDelegate.password isEqualToString:titleTextField.text])
                 {
                     NSLog(@"%@", @"run process");
-                    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Account" completion:^{
+//                    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Account" completion:^{
+                    PopWaitAlert* pop = [RAUtils waiting_pop:@"Delete Account" completion:nil];
                         [RANetwork request_delete_account:^(NSMutableDictionary *result) {
                             NSMutableDictionary* return_json =result;
                             
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            [pop hide];
                                 if([[return_json valueForKey:@"result"] intValue]==2)
                                 {
                                     //                    [self hideMenu];
@@ -3335,13 +3124,17 @@
                                     [appDelegate Logout];
                                     [self checklogin :false];
 
-                                    [RAUtils message_alert:@"Account deleted." title:nil controller:self];
+                                    
+                                    
+                                    [RAUtils message_box:nil message:@"Account deleted." completion:nil];
                                 }
                                 else
                                 {
-                                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Delete Account" controller:self] ;
+                                    
+                                    [RAUtils message_box:@"Delete Account" message:[return_json valueForKey:@"err_msg"] completion:nil];
+                                    
                                 }
-                            }];
+//                            }];
                                             
                                             
                                             
@@ -3351,13 +3144,14 @@
                                             
                                         
                         }];
-                    }];
+//                    }];
                     
                     
                 }
                 else
                 {
-                    [RAUtils message_alert:@"Wrong password." title:nil controller:self];
+                    
+                    [RAUtils message_box:nil message:@"Wrong password." completion:nil];
                 }
                 
             }]];
@@ -3597,7 +3391,7 @@
 //
 //            cvc.onCancel = ^(){
 //
-//                [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+//                [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
 //
 //
 //
@@ -3618,11 +3412,14 @@
 -(void) neworderforCart
 {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
                 NSMutableDictionary* return_json = result;
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                     if([[return_json valueForKey:@"result"] intValue]==2)
                     {
                         int result=[[return_json valueForKey:@"result"] intValue];
@@ -3651,9 +3448,9 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                        [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                     }
-                }];
+//                }];
                 
                 
                 
@@ -3664,51 +3461,7 @@
                 
             }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//        
-//        NSDictionary* return_json = [RANetwork new_Order];
-//        
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            
-//            
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//                    
-//                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    appDelegate.order_code = order_code;
-//                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-//                    
-//                    self.previous_VC = self.current_VC;
-//                    [self flipFromViewController:self.current_VC toViewController:self.cartViewController withDirection:UIViewAnimationOptionTransitionCrossDissolve];
-//                    
-//                    
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                    [self reloadCart:true immediately:false];
-//                    [self reloadOrder:true immediately:false];
-//#endif
-//                    
-//                    
-//                }
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//            
-//            
-//            
-//            
-//        });
-//    });
+//    }];
 }
 
 - (void)showPriceAuth:(NSInteger)from {

+ 18 - 804
RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m

@@ -440,23 +440,9 @@
 }
 -(void) newoloorder
 {
-//    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
+
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//    appDelegate.order_code = order_code;
-    
-//    if(appDelegate.user.length==0)
-//    {
-//        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
-//        return;
-//    }
-    
-    //    NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:URL_SO_CART ofType:@"json" ]];
-    //    NSMutableDictionary* cartTemplate=[OLDataProvider loadScanTemplate:@"scan_cart.json"];
-    //    RASingleton.sharedInstance.scan_cart=cartTemplate;//[[RAConvertor data2dict:json] mutableCopy];
-    
-    
-    
-//    appDelegate.user_type = USER_ROLE_EMPLOYEE;
+
     appDelegate.can_set_cart_price = true;
     appDelegate.can_see_price = true;
     RASingleton.sharedInstance.scan_cart = nil;
@@ -468,36 +454,7 @@
         
         
         NSString *orderdir = [OLDataProvider getScanPath];
-        //                NSError *error = nil;
-        //        [ [NSFileManager defaultManager] moveItemAtPath:[OLDataProvider getScanTempPath] toPath:orderdir error:&error];
-        //
-        //
-        
-//        [OLDataProvider moveScanTemp2Order];
-        //        bool bsuccess=[[NSFileManager defaultManager] createDirectoryAtPath:orderdir withIntermediateDirectories:YES attributes:nil error:&error];
-        
-        
-        //        NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
-        //   NSString * string = [checked componentsJoinedByString:@","];
-        //  [params setValue:string forKey:@"cart2Checkbox"];
-        
-        //        NSData* data=[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:URL_SO_ORDER ofType:@"json" ]];
-        
-        //        NSMutableDictionary* dict=[[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error] mutableCopy];
-//        
-//        NSMutableDictionary* dict=[OLDataProvider loadScanTemplate:@"scan_order.json"];
-//        
-//        
-//        
-//        
-//        NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
-//        
-//        
-//        
-//        [RAUtils dicttofile:orderPath dict:dict];
-//        
-        
-        
+
         
         
         NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
@@ -534,11 +491,7 @@
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
-//    if(appDelegate.user.length<=0)
-//    {
-//        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
-//        return;
-//    }
+
     
     if(appDelegate.order_code.length>0)
     {
@@ -548,115 +501,7 @@
         
     }
     
-    
-    //    RASingleton.sharedInstance.enable_OfflineOrder = true;
-    
-    
-    //    __block MainViewController *brself= self;
-//    if(appDelegate.contact_id.length<=0&&false)
-//    {
-//
-//        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"New Offline Order" message:nil preferredStyle:UIAlertControllerStyleAlert];
-//        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"With Offline Contact" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-//
-//            //            if(appDelegate.order_code && appDelegate.order_code.length>0)
-//            //            {
-//            //                [RAUtils message_alert:@"Please close current order and try again." title:@"" controller:self];
-//            //            }
-//            //            NSLog(@"new click");
-//
-//            NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
-//
-//            //            NSString *path = [[NSBundle mainBundle] pathForResource:@"editContact.json" ofType:nil];
-//
-//            CustomerEditViewController * cuseditVC = [[CustomerEditViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
-//            cuseditVC.bnewcustomer=true;
-//            cuseditVC.bolocustomer = true;
-//            cuseditVC.url_type = URL_FILE;
-//            cuseditVC.request_url=[OLDataProvider scanTemplatePath:@"scan_contact.json"];
-//
-//            cuseditVC.params = params;
-//
-//            cuseditVC.returnValue=^(NSMutableDictionary* value)
-//            {
-//                if(value==nil)
-//                {
-//                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//                }
-//                else
-//                {
-//                    NSString* contact_id=[[NSUUID new] UUIDString];
-//
-//
-//                    //---------------- construct customer_contact----------------------
-//                    NSString* customer_first_name = [value valueForKey:@"customer_first_name"];
-//                    if(customer_first_name==nil)
-//                        customer_first_name=@"";
-//
-//                    NSString* customer_last_name= [value valueForKey:@"customer_last_name"];
-//                    if(customer_last_name==nil)
-//                        customer_last_name=@"";
-//                    NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
-//                    customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
-//                    [value setValue:customer_contact forKey:@"customer_contact"];
-//
-//
-//
-//                    value [@"customer_cid"] = contact_id;
-//                    appDelegate.contact_id=contact_id;
-//                    appDelegate.customerInfo = value;
-//
-//
-//
-//
-//
-//
-//                    //                        [brself refreshContactDisplay];
-//                    [self newoloorder];
-//
-//                    //                        [brself switchToCart:nil];
-//
-//                }
-//            };
-//
-//
-//            //    cuseditVC.delegate=self;
-//            //
-//            //    if(checked.count==count)
-//            //    {
-//            //    orderinfoVC.have_tail = true
-//            //    }
-//
-//            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-//            [self.navigationController pushViewController:cuseditVC animated:false];
-//
-//            //            [self dismissViewControllerAnimated:NO completion:^{
-//            ////                [(UINavigationController*)[self parentViewController] pushViewController:cuseditVC animated:false];;
-//            ////                            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-//            //
-//            ////                            [self pushViewController:cuseditVC animated:false];
-//            //            }];
-//
-//            //            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-//            //            [self.navigationController pushViewController:cuseditVC animated:false];
-//
-//
-//        }];
-//
-//
-//
-//        UIAlertAction *alertCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-//
-//        }];
-//
-//        [alertControl addAction:actionOne];
-//
-//        //        [alertControl addAction:alertthree];
-//        [alertControl addAction:alertCancel];
-//
-//        [self presentViewController:alertControl animated:YES completion:nil];
-//    }
-//    else
+
     {
         [self newoloorder];
     }
@@ -767,245 +612,7 @@
         [self.table_submit reloadData ];
     });
     return;
-    //
-    //
-    //
-    ////    dispatch_async(self.loading_queue, ^{
-    //
-    //        dispatch_sync(dispatch_get_main_queue(), ^{
-    //            if(self.reset_result)
-    //            {
-    //                self.offset = 0;
-    //                [self.content_data removeAllObjects];
-    //                [self.table_order reloadData];
-    //            }
-    //
-    //            //            NSMutableArray* arr_status = [[NSMutableArray alloc] init];
-    //
-    //            NSMutableArray* arr_statusname = [[NSMutableArray alloc] init];
-    //            int count = [[self.status_cadedate valueForKey:@"count"] intValue];
-    //            for(int i=0;i<count;i++)
-    //            {
-    //                NSDictionary* val_json =[self.status_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
-    //                int check = [[val_json valueForKey:@"check"] intValue];
-    //                if(check==1)
-    //                {
-    //                    //                    [arr_status addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value_id"]]];
-    //                    [arr_statusname addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value"]]];
-    //
-    //                    // break;
-    //                }
-    //            }
-    //
-    //            //            NSString * str_status = [arr_status componentsJoinedByString:@","];
-    //            NSString * str_statusname = [arr_statusname componentsJoinedByString:@","];
-    //            if(str_statusname.length==0)
-    //                str_statusname = @"All";
-    //            self.label_filter.text = str_statusname;
-    //            if(self.offset==0)
-    //            {
-    //                self.table_order.hidden = true;
-    //
-    //                self.mum.center = self.view.center;
-    //
-    //                self.mum.hidden = false;
-    //                [self.mum startAnimating];
-    //            }
-    //            self.label_net_err.hidden=true;
-    //
-    //        });
-    ////    });
-    ////    dispatch_async(self.loading_queue, ^{
-    //        if(self.isrefreshing)
-    //            return;
-    //        self.isrefreshing=true;
-    //
-    //
-    //
-    //
-    //
-    //
-    //
-    //
-    //
-    //        NSMutableArray* arr_status = [[NSMutableArray alloc] init];
-    //
-    //        //    NSMutableArray* arr_statusname = [[NSMutableArray alloc] init];
-    //        int count = [[self.status_cadedate valueForKey:@"count"] intValue];
-    //        for(int i=0;i<count;i++)
-    //        {
-    //            NSDictionary* val_json =[self.status_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
-    //            int check = [[val_json valueForKey:@"check"] intValue];
-    //            if(check==1)
-    //            {
-    //                [arr_status addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value_id"]]];
-    //                //            [arr_statusname addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value"]]];
-    //
-    //                // break;
-    //            }
-    //        }
-    //
-    //        NSString * str_status = [arr_status componentsJoinedByString:@","];
-    //
-    //
-    //
-    //
-    //
-    //    dispatch_sync(dispatch_get_main_queue(), ^{
-    //        BOOL isMerged = NO;
-    //        AppDelegate *appDelegate = nil;
-    //        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //        if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
-    //            if (self.orderType == 0) {
-    //                isMerged = NO;
-    //            } else {
-    //                isMerged = YES;
-    //            }
-    //        }
-    //
-    //        [RANetwork request_orderlist:self.offset limit:self.limit keywords:self.keywords status:str_status customer:self.customer_id is_merged:isMerged completionHandler:^(NSMutableDictionary *result) {
-    //            NSMutableDictionary* content=result;
-    //
-    //
-    //
-    //
-    //
-    //
-    //            [self.mum stopAnimating];
-    //            self.isrefreshing=false;
-    //            if (self.dataOperationQueue.operationCount > 1) { // 队列后面还有操作
-    //                return ;
-    //            }
-    //            int result_code=[[content valueForKey:@"result"] intValue];
-    //
-    //            if(result_code==2||result_code==0)
-    //            {
-    //
-    //
-    //                int count = [[content valueForKey:@"count" ] intValue] ;
-    //
-    //
-    //                self.time_zone = [content valueForKey:@"time_zone" ];
-    //                self.offset += count;
-    //                for(int i=0;i<count;i++)
-    //                {
-    //
-    //                    NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-    //                    [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
-    //
-    //                }
-    //                if(count<self.limit)
-    //                {
-    //
-    //                    //                    int i =self.btnrefresh.state;
-    //                    self.load_more_hint=@"All loaded";
-    //                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
-    //                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
-    //                }
-    //                else
-    //                {
-    //                    self.load_more_hint=@"Load more...";
-    //                    //                    self.btnrefresh.enabled = true;
-    //                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
-    //                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
-    //                }
-    //
-    //
-    //                self.table_order.hidden = false;
-    //                self.reset_result=false;
-    //                [self.table_order reloadData ];
-    //            }
-    //            else if(result_code==RESULT_NET_ERROR &&self.offset==0)
-    //            {
-    //                self.label_net_err.hidden=false;
-    //                self.table_order.hidden = true;
-    //            }
-    //            else
-    //            {
-    //                [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Order List" controller:self] ;
-    //            }
-    //
-    //
-    //
-    //
-    //
-    //
-    //        }];
-    //
-    //    });
-    //
-    ////
-    ////        NSMutableDictionary* content=nil;
-    ////        content=[[RANetwork request_OrderList:self.offset limit : self.limit keywords:self.keywords status:str_status customer:self.customer_id is_merged:isMerged] mutableCopy];
-    ////
-    ////
-    ////        dispatch_sync(dispatch_get_main_queue(), ^{
-    ////
-    ////
-    ////
-    ////
-    ////
-    ////            [self.mum stopAnimating];
-    ////            self.isrefreshing=false;
-    ////            if (self.dataOperationQueue.operationCount > 1) { // 队列后面还有操作
-    ////                return ;
-    ////            }
-    ////            int result=[[content valueForKey:@"result"] intValue];
-    ////
-    ////            if(result==2||result==0)
-    ////            {
-    ////
-    ////
-    ////                int count = [[content valueForKey:@"count" ] intValue] ;
-    ////
-    ////
-    ////                self.time_zone = [content valueForKey:@"time_zone" ];
-    ////                self.offset += count;
-    ////                for(int i=0;i<count;i++)
-    ////                {
-    ////
-    ////                    NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-    ////                    [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
-    ////
-    ////                }
-    ////                if(count<self.limit)
-    ////                {
-    ////
-    ////                    //                    int i =self.btnrefresh.state;
-    ////                    self.load_more_hint=@"All loaded";
-    ////                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
-    ////                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
-    ////                }
-    ////                else
-    ////                {
-    ////                    self.load_more_hint=@"Load more...";
-    ////                    //                    self.btnrefresh.enabled = true;
-    ////                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
-    ////                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
-    ////                }
-    ////
-    ////
-    ////                self.table_order.hidden = false;
-    ////                self.reset_result=false;
-    ////                [self.table_order reloadData ];
-    ////            }
-    ////            else if(result==RESULT_NET_ERROR &&self.offset==0)
-    ////            {
-    ////                self.label_net_err.hidden=false;
-    ////                self.table_order.hidden = true;
-    ////            }
-    ////            else
-    ////            {
-    ////                [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Order List" controller:self] ;
-    ////            }
-    ////
-    ////
-    ////
-    ////
-    ////        });
-    ////
-    //
-    ////    });
+
 }
 -(void) loadpage
 {
@@ -1043,11 +650,14 @@
 -(void) neworder
 {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
             NSMutableDictionary* return_json =result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 if([[return_json valueForKey:@"result"] intValue]==2)
                 {
                     int result=[[return_json valueForKey:@"result"] intValue];
@@ -1069,32 +679,15 @@
 #endif
                         
                         [self ReloadData];
-                        
-                        
-                        //     [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
-                        //    [self loadpage];
-                        
-                        
-                        //                    if(self.shopCartBlock!=nil)
-                        //                    {
-                        //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-                        //
-                        //
-                        //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-                        //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-                        //                        iv.image = img;
-                        //                        //                        [self.contentView addSubview:iv];
-                        //                        self.shopCartBlock(iv);
-                        //
-                        //                    }
+         
                         
                     }
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
+                    [RAUtils message_box:@"Create Order" message:[return_json valueForKey:@"err_msg"] completion:nil];
                 }
-            }];
+//            }];
             //        [waitalert dismissViewControllerAnimated:YES completion:nil];
             
             
@@ -1106,176 +699,9 @@
             
         }];
         
-    }];
-    
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-    //
-    //        NSDictionary* return_json = [RANetwork new_Order];
-    //
-    //        dispatch_async(dispatch_get_main_queue(), ^{
-    //            [waitalert dismissViewControllerAnimated:YES completion:nil];
-    //
-    //
-    //            if([[return_json valueForKey:@"result"] intValue]==2)
-    //            {
-    //                int result=[[return_json valueForKey:@"result"] intValue];
-    //                if(result==2)
-    //                {
-    //                    //successed.
-    //
-    //                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-    //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //                    appDelegate.order_code = order_code;
-    //                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-    //
-    //
-    //#ifdef RA_NOTIFICATION
-    //                    [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-    //#else
-    //                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-    //                    [main_vc reloadCart:true immediately:false];
-    //#endif
-    //
-    //                    [self ReloadData];
-    //
-    //
-    //                    //     [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
-    //                    //    [self loadpage];
-    //
-    //
-    //                    //                    if(self.shopCartBlock!=nil)
-    //                    //                    {
-    //                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-    //                    //
-    //                    //
-    //                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-    //                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-    //                    //                        iv.image = img;
-    //                    //                        //                        [self.contentView addSubview:iv];
-    //                    //                        self.shopCartBlock(iv);
-    //                    //
-    //                    //                    }
-    //
-    //                }
-    //            }
-    //            else
-    //            {
-    //                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
-    //            }
-    //
-    //
-    //
-    //
-    //        });
-    //    });
+
 }
-//#pragma mark - UIAlertViewDelegate
-//// Called when a button is clicked. The view will be automatically dismissed after this call returns
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-//{
-//    if(buttonIndex!=alertView.cancelButtonIndex)
-//    {
-//        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//        if(appDelegate.order_code && appDelegate.order_code.length>0)
-//        {
-////            appDelegate.order_code= nil;
-////            [appDelegate SetSo:nil];
-//
-//            if (appDelegate.user_type == USER_ROLE_EMPLOYEE) {
-//                //     MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//                cvc.showNavibar = true;
-//                cvc.contact_type = @"Sales_Order_Customer";
-//                cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//
-//                    appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                    appDelegate.customerInfo = value;
-//
-//                    self.norefresh = true;
-//                    [self neworder];
-//
-//
-//
-//                    //    [main_vc checklogin:true];
-//                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//
-//                    //
-//                    //                if(self.returnValue)
-//                    //                    self.returnValue(value);
-//                };
-//
-//                cvc.onCancel = ^(){
-//                    self.norefresh = true;
-//                    if(appDelegate.customerInfo==nil)
-//                    {
-//                        [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//                    }
-//                    else
-//                    {
-//                        [self neworder];
-//                    }
-//                    //  [main_vc checklogin:true];
-//                };
-//                cvc.onReset = ^(){
-//                    //   [main_vc checklogin:true];
-//                };
-//
-//                [self.navigationController pushViewController:cvc animated:true];
-//            }
-//            else if (appDelegate.user_type == USER_ROLE_CUSTOMER){
-//                [self neworder];
-//            }
-//
-//        }
-//        else
-//        {
-//            //create new;
-//
-//            if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//            {
-//                MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//                cvc.showNavibar = true;
-//                cvc.contact_type = @"Sales_Order_Customer";
-//                cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//
-//                    appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                    appDelegate.customerInfo = value;
-//
-//
-//                    if(appDelegate.order_code==nil)
-//                        [self neworder];
-//
-//                    //   [main_vc checklogin:true];
-//                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//
-//                    //
-//                    //                if(self.returnValue)
-//                    //                    self.returnValue(value);
-//                };
-//
-//                cvc.onCancel = ^(){
-//
-//                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//
-//
-//
-//                };
-//                cvc.onReset = ^(){
-//                    [main_vc checklogin:true];
-//                };
-//
-//                [self.navigationController pushViewController:cvc animated:true];
-//            }
-//            else
-//            {
-//                [self neworder];
-//            }
-//        }
-//
-//    }
-//}
+
 #pragma mark - Table view data source
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
 {
@@ -2614,80 +2040,7 @@
     }
     return nil;
 }
-//
-//- (IBAction)mergeListButtonClick:(UIBarButtonItem *)sender {
-//
-//    if (!self.table_order.isEditing) {
-//
-//        [RAUtils message_alert:@"You have to click select firstly then select some saved order" title:@"Warning" controller:self];
-//        return;
-//    }
-//
-//    [self handleSelectedOrders];
-//
-//    if (!self.mergeList.count) {
-//
-//        //        [RAUtils message_alert:@"Combine List is Empty" title:@"Warning" controller:self];
-//        return;
-//    }
-//
-//    SelectUploadOrderViewController *mergeVC = [[UIStoryboard storyboardWithName:@"OLM" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"SelectUploadOrderViewController"];
-//
-//    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:mergeVC];
-//
-//    mergeVC.mergeList = self.mergeList;
-//
-//    mergeVC.title = @"Combine List";
-//
-//    __weak typeof(self) weakself = self;
-//
-//    mergeVC.mergeBlock = ^(NSDictionary *ret) {
-//
-//
-//        if (weakself) {
-//
-//            __strong typeof(weakself) strongself = weakself;
-//
-//            if([[ret objectForKey:@"result"]integerValue] == RESULT_TRUE) {
-//
-//                [weakself.mergeList removeAllObjects];
-//                [strongself.table_order endEditing:YES];
-//                [strongself ReloadData];
-//
-//                if ([RASingleton sharedInstance].customer_can_see_sales_Order) {
-//
-//                    [strongself openOrder:ret];
-//
-//                }
-//
-//            } else {
-//
-//                NSString *msg = [ret objectForKey:@"err_msg"];
-//                [RAUtils message_alert:msg title:nil controller:strongself];
-//            }
-//        }
-//
-//    };
-//
-//    mergeVC.deleteBlock = ^(NSString *orderID){
-//        NSIndexPath *indexPath = [weakself indexPathOfDeleteOrder:orderID];
-//        [weakself.table_order deselectRowAtIndexPath:indexPath animated:YES];
-//    };
-//
-//    mergeVC.clearBlock = ^{
-//        for (NSDictionary *order in self.mergeList) {
-//
-//            NSString *order_id = [NSString stringWithFormat:@"%@",[order objectForKey:@"order_id"]];
-//            NSIndexPath *indexPath = [weakself indexPathOfDeleteOrder:order_id];
-//            [weakself.table_order deselectRowAtIndexPath:indexPath animated:YES];
-//        }
-//    };
-//
-//    nav.modalPresentationStyle = UIModalPresentationFormSheet;
-//
-//    [self presentViewController:nav animated:YES completion:nil];
-//
-//}
+
 
 - (void)handleSelectedOrders {
     
@@ -2723,48 +2076,6 @@
 
 - (IBAction)editOrderListButtonClick:(UIBarButtonItem *)sender {
     
-    //    if ([RASingleton sharedInstance].global_lock) { // Order list 被锁
-    //        [RAUtils message_alert:@"Permission Needed.\nGoto Menu -> Unlock" title:@"Warning" controller:self];
-    //        return;
-    //    }
-    //
-    //    UIImage *gray = [UIImage imageNamed:@"Combinegray"];
-    //    UIImage *green = [[UIImage imageNamed:@"converttopo"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];//converttopo
-    //
-    //    if (self.table_order.isEditing) {
-    //        [self mergeListButtonClick:nil];
-    //        // 结束选择时恢复
-    //        if ([RASingleton sharedInstance].customer_can_see_sales_Order && ![RASingleton sharedInstance].global_lock) { // 有查看Sales order 权限,并且app没有锁
-    //            if (self.orderTypeSegmentControl.numberOfSegments == 1) {
-    //                [self.orderTypeSegmentControl insertSegmentWithTitle:[NSString stringWithFormat:@"Purchase Order to %@",COMPANY_SHORT_NAME] atIndex:1 animated:YES];
-    //            }
-    //        }
-    //
-    //        self.status_cadedate = self.shop_order_filter;
-    //        [self ReloadData];
-    //
-    //        [self.table_order setEditing:NO animated:YES];
-    ////        sender.title = @"Select";
-    ////        [self.mergeList removeAllObjects];
-    //        [sender setImage:gray];
-    //
-    //    } else {
-    //        // 选择时不能选择Sales Order
-    //        if(self.orderTypeSegmentControl.numberOfSegments > 1) {
-    //            [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
-    //            [self changeOrderType:0];
-    //        }
-    //        // 切换filter
-    //        NSData *data=[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"status_filter_cadedate_open" ofType:@"json" ]];
-    //        NSError *error=nil;
-    //        self.status_cadedate = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error] mutableCopy];
-    //        // 刷新,取Saved Order
-    //        [self ReloadData];
-    //
-    //        [self.table_order setEditing:YES animated:YES];
-    ////        sender.title = @"Exit";
-    //        [sender setImage:green];
-    //    }
     
 }
 
@@ -2795,104 +2106,7 @@
 //    }
 //
 }
-//
-//- (void)openOrder:(NSDictionary *)order {
-//    
-//    if (!order) {
-//        return;
-//    }
-//    
-//    NSString *orderCode = [order objectForKey:@"orderCode"];
-//    NSInteger orderStatus = [[order objectForKey:@"orderStatus"] integerValue];
-//    NSString *so = [order objectForKey:@"so#"];
-//    
-//    __weak typeof(self) weakself = self;
-//    
-//    [RANetwork request_open_order:orderCode completionHandler:^(NSMutableDictionary *result) {
-//        NSDictionary* order_json = result ;
-//        
-//        
-//        if([[order_json valueForKey:@"result"] intValue]==2)
-//        {
-//            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//            appDelegate.order_code = orderCode;
-//            appDelegate.order_status = (int)orderStatus;
-//            [appDelegate SetSo:so];
-//            
-//            __weak MainViewController *mainVC = (MainViewController*)appDelegate.main_vc;
-//            
-//#ifdef RA_NOTIFICATION
-//            [ActiveViewController Notify:@"CartViewController,OrderListViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//            
-//            
-//            [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//            [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//            [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
-//#endif
-//            
-//            [((MainViewController*)appDelegate.main_vc) switchToCart];
-//            
-//            mainVC.cartViewController.onFinishLoad=^{
-//                [mainVC.cartViewController placeOrder];
-//                mainVC.cartViewController.onFinishLoad=nil;
-//            };
-//            
-//        }
-//        else
-//        {
-//            [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:weakself] ;
-//        }
-//        
-//        
-//        
-//        
-//    }];
-//    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//    //
-//    //        NSDictionary* order_json = [RANetwork open_Order:orderCode];
-//    //
-//    //        dispatch_async(dispatch_get_main_queue(), ^{
-//    //
-//    //            if([[order_json valueForKey:@"result"] intValue]==2)
-//    //            {
-//    //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//    //                appDelegate.order_code = orderCode;
-//    //                appDelegate.order_status = orderStatus;
-//    //                [appDelegate SetSo:so];
-//    //
-//    //                __weak MainViewController *mainVC = (MainViewController*)appDelegate.main_vc;
-//    //
-//    //#ifdef RA_NOTIFICATION
-//    //                [ActiveViewController Notify:@"CartViewController,OrderListViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//    //#else
-//    //
-//    //
-//    //                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//    //                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//    //                [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
-//    //#endif
-//    //
-//    //                [((MainViewController*)appDelegate.main_vc) switchToCart];
-//    //
-//    //                mainVC.cartViewController.onFinishLoad=^{
-//    //                    [mainVC.cartViewController placeOrder];
-//    //                    mainVC.cartViewController.onFinishLoad=nil;
-//    //                };
-//    //
-//    //            }
-//    //            else
-//    //            {
-//    //                [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:weakself] ;
-//    //            }
-//    //
-//    //
-//    //
-//    //        });
-//    //    });
-//    
-//    
-//}
+
 
 #pragma mark - notification action
 

+ 12 - 88
RedAnt ERP Mobile/common/Functions/address/AddressEditorViewController.m

@@ -61,98 +61,21 @@
     // add params check here.
     [self.lastedit endEditing:true];
      [self.lasttextview endEditing:true];
-//    self.cancommit=true;
-//    NSMutableDictionary* upparams=[[NSMutableDictionary alloc] init];
-//    //[upparams setValue:[self.params valueForKey:@"cart2Checkbox"] forKey:@"cart2Checkbox"];
-//    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
-//    for(int i=0;i<section_count;i++)
-//    {
-//        
-//        NSMutableDictionary * sectionjson = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i ]] mutableCopy];
-//        int item_count = [[sectionjson valueForKey:@"count"] intValue];
-//        for(int j=0;j<item_count;j++)
-//        {
-//            NSMutableDictionary * itemjson=[[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j ]] mutableCopy];
-//            NSString* key = [itemjson valueForKey:@"name"];
-//            if(key==nil || key.length==0)
-//                continue;
-//            if([[itemjson valueForKey:@"control"] isEqualToString:@"enum"])
-//            {
-//                NSString* single_select = [itemjson valueForKey:@"single_select"];
-//                if([single_select isEqualToString:@"true"])
-//                {
-//                    NSDictionary* cadejson=[itemjson objectForKey:@"cadedate"];
-//                    int count = [[cadejson valueForKey:@"count"] intValue];
-//                    bool setvalue = false;
-//                    for(int cc=0;cc<count;cc++)
-//                    {
-//                        NSDictionary* valjson=[cadejson objectForKey:[NSString stringWithFormat:@"val_%d",cc]];
-//                        if([[valjson valueForKey:@"check"]intValue]==1)
-//                        {
-//                            [upparams setValue:[valjson valueForKey:@"value_id"] forKey:[itemjson valueForKey:@"name"]];
-//                            setvalue=true;
-//                            break;
-//                        }
-//                    }
-//                    if([[itemjson valueForKey:@"required"] isEqualToString: @"true"] && setvalue==false)
-//                    {
-//                        self.cancommit = false;
-//                    }
-//                }
-//                else
-//                {
-//                    //not support multi select for now;
-//                }
-//                /*
-//                 upparams setValue:itemjson forKey:<#(NSString *)#>
-//                 
-//                 */
-//            }
-//            else
-//            {
-//                if([itemjson valueForKey:@"value"]!=nil && ![[itemjson valueForKey:@"value"]isEqualToString:@""])
-//                    [upparams setValue:[itemjson valueForKey:@"value"] forKey:[itemjson valueForKey:@"name"]];
-//                else
-//                {
-//                    if([[itemjson valueForKey:@"required"] isEqualToString: @"true"] )
-//                        self.cancommit = false;
-//                }
-//            }
-//            
-//            upparams= [self subitem_param:itemjson addto:upparams ];
-//        }
-//    }
-//    
-//    
-//    if(self.cancommit==false)
-//    {
-////        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Some requried field is missing" message:@"Fields with * mark cannot be empty." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-////        //        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
-////        [alert show];
-//        
-//        
-//        [RAUtils alert_view:@"Fields with * mark cannot be empty." title:@"Some Requried Fields Are Missing."];
-//        
-//        self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
-//        
-//        
-//        //    DebugLog(@"CONTENT translate:%@",[iSalesNetwork DataTOjsonString:self.content_data]);
-////        [self.editorTable reloadData ];
-//        
-//        [self.editorTable reloadData];
-//        return;
-//
-//    }
+
 
     
     NSMutableDictionary* upparams = [self check_cancommit:true];
     if(self.cancommit==false)
         return;
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Save Address" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Save Address" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Save Address" completion:nil];
         [RANetwork request_add_address:upparams completionHandler:^(NSMutableDictionary *result) {
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            
+            [pop hide];
                 NSDictionary* editor_json = result;
                 
                 if([[editor_json valueForKey:@"result"] intValue]==2)
@@ -171,16 +94,17 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Address" controller:self] ;
+                    [RAUtils message_box:@"Create Address" message:[editor_json valueForKey:@"err_msg"] completion:nil] ;
+                    
                 }
-            }];
+//            }];
             
             
             
             
         }];
 
-    }];
+//    }];
     
         
 //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@@ -206,7 +130,7 @@
 //            }
 //            else
 //            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Address" controller:self] ;
+//                [RAUtils message_box:@"Create Address" message:[editor_json valueForKey:@"err_msg"] completion:nil] ;
 //            }
 //
 //

+ 25 - 252
RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m

@@ -766,11 +766,14 @@
 -(void) neworder
 {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
             NSMutableDictionary* return_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 
                 //        [waitalert dismissViewControllerAnimated:YES completion:nil];
                 
@@ -797,9 +800,11 @@
                 else
                 {
                     
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+
+                    
+                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
                 }
-            }];
+//            }];
             
             
             
@@ -808,45 +813,8 @@
             
         }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = [RANetwork new_Order];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//
-//                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    appDelegate.order_code = order_code;
-//                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-//
-//
-//                    [self addtocart];
-//
-//
-//
-//                }
-//            }
-//            else
-//            {
-//
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
+//    }];
+
 }
 -(void) addtocart
 {
@@ -872,10 +840,13 @@
         if(cart_item == nil)
         {
             //二维码不是scan order的格式
-//            [RAUtils message_alert:@"QR CODE incorrect." title:@"Add To Cart" controller:self] ;
-            [RAUtils message_alert:@"QR CODE incorrect." title:@"Add To Cart" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
-                            self.handelOutput = true;
-            } completion:nil];
+
+            [RAUtils message_box:@"Add To Cart" message:@"QR CODE incorrect." completion:^{
+                self.handelOutput = true;
+
+            }];
+            
+
             return;
         }
 
@@ -887,20 +858,7 @@
         
         NSMutableArray* item = [[RADataProvider request_scan_model_by_names:cart_item] mutableCopy];
         
-        
-//        __block NSMutableDictionary* jitem = [NSMutableDictionary new];
-//        jitem[@"product_id"]= item[0];
-//        NSString* model =item[1];
-//        NSString* description =item[2];
-//        jitem[@"model"] =model;
-//        jitem[@"description"] = [NSString stringWithFormat:@"%@ \r\n%@",model,description];
-//        jitem[@"unit_price"] =@( [item[3] doubleValue]);
-//        jitem[@"stockUom"] = @([item[4] intValue]);
-//        jitem[@"count"] = @([item[4] intValue]);
-//        jitem[@"subtotal_price"] = @([item[4] intValue]* [item[3] doubleValue]);
-//
-//        jitem[@"check"]=@(true);
-//
+
          
         self.resultvc.scan_val = item;
         self.resultvc.modalPresentationStyle = UIModalPresentationFullScreen;//有三种状态,自己看看是哪种
@@ -1045,7 +1003,9 @@
             else
             {
                 
-                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+
+                
+                [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
             }
             
             
@@ -1083,7 +1043,9 @@
             else
             {
                 
-                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+
+                
+                [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
             }
             
             
@@ -1095,43 +1057,6 @@
 
 
     
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* return_json = [RANetwork add_toCart_byName: self.scan_val withScreen:ScreenCodeCamScan];
-//
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-//
-//
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//#endif
-//
-//
-//                }
-//                else
-//                {
-//
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//                }
-//
-//
-//
-//
-//            });
-//        });
     
     
 }
@@ -1156,32 +1081,6 @@
         [self.typeButton setTitle:@"Type: Model Name" forState:UIControlStateNormal];
         
         self.type = SCANNER_TYPE_MODELNAME;
-        //        UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Remove Models From Cart"];
-        //        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        //
-        //            NSDictionary* cart_json = [iSalesNetwork cart_remove:ids];
-        //
-        //            dispatch_async(dispatch_get_main_queue(), ^{
-        //
-        //                [waitalert dismissViewControllerAnimated:YES completion:nil];
-        //
-        //                if([[cart_json valueForKey:@"result"] intValue]==2)
-        //                {
-        //
-        //                    [self end_edit];
-        //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        //                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
-        //                    [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
-        //                }
-        //                else
-        //                {
-        //                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
-        //                }
-        //
-        //
-        //
-        //            });
-        //        });
         
         
     }];
@@ -1227,32 +1126,6 @@
         [self.targetButton setTitle:@"Target: Model Detail" forState:UIControlStateNormal];
         
         self.target = SCANNER_TARGET_DETAIL;
-        //        UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Remove Models From Cart"];
-        //        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        //
-        //            NSDictionary* cart_json = [iSalesNetwork cart_remove:ids];
-        //
-        //            dispatch_async(dispatch_get_main_queue(), ^{
-        //
-        //                [waitalert dismissViewControllerAnimated:YES completion:nil];
-        //
-        //                if([[cart_json valueForKey:@"result"] intValue]==2)
-        //                {
-        //
-        //                    [self end_edit];
-        //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        //                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
-        //                    [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
-        //                }
-        //                else
-        //                {
-        //                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
-        //                }
-        //
-        //
-        //
-        //            });
-        //        });
         
         
     }];
@@ -1342,104 +1215,4 @@
     return [translatedPoints copy];
 }
 
-//#pragma mark - UIAlertViewDelegate
-//// Called when a button is clicked. The view will be automatically dismissed after this call returns
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-//{
-//    UIApplication * app = [UIApplication sharedApplication];
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//
-//    
-//    //   int count=[self.quantity_text.text intValue];
-//    
-//    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//    if(buttonIndex==alertView.cancelButtonIndex)
-//    {
-//        
-//        
-//        
-//    }
-//    else if(buttonIndex==1)
-//    {
-//        //open exist
-//                OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-//        ovc.showNavibar = true;
-//        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-//            if(appDelegate.order_code==nil)
-//            {
-//                [self neworder];
-//            }
-//            else
-//            {
-//
-//                
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//#endif
-//                [self addtocart];
-//                [main_vc checklogin:true];
-//                
-//                
-//            }
-//            
-//        };
-//        ovc.init_style = OL_OPEN;
-//        ovc.onCancel = ^(){
-//            
-//            [main_vc checklogin:true];
-//            
-//        };
-//        
-//        [self.navigationController pushViewController:ovc animated:true];
-//    }
-//    else
-//    {
-//        //create new;
-//        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//        {
-//           
-//            
-//            ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//            cvc.showNavibar = true;
-//            cvc.contact_type = @"Sales_Order_Customer";
-//            cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//                
-//                appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                appDelegate.customerInfo = value;
-//                
-//                
-//                if(appDelegate.order_code==nil)
-//                    [self neworder];
-//                
-//                [main_vc checklogin:true];
-//                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//                
-//                //
-//                //                if(self.returnValue)
-//                //                    self.returnValue(value);
-//            };
-//            
-//            cvc.onCancel = ^(){
-//                
-//                UIViewController *vc= [RAUtils getViewController:self];
-//                [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order" controller:vc];
-//                
-//            };
-//            cvc.onReset = ^(){
-//                [main_vc checklogin:true];
-//            };
-//            
-//            [self.navigationController pushViewController:cvc animated:true];
-//        }
-//        else
-//        {
-//            [self neworder];
-//        }
-//        
-//        
-//    }
-//}
 @end

+ 11 - 40
RedAnt ERP Mobile/common/Functions/cart/CartGeneralNotesViewController.m

@@ -59,11 +59,15 @@
     NSString* notes=self.tv_notes.text;
        UIApplication * app = [UIApplication sharedApplication];
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update General Notes" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update General Notes" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Update General Notes" completion:nil];
         [RANetwork request_update_cartgeneralnote:appDelegate.order_code notes:notes completionHandler:^(NSMutableDictionary *result) {
             NSDictionary* cart_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            
+            [pop hide];
                 //            [waitalert dismissViewControllerAnimated:YES completion:nil];
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 {
@@ -77,9 +81,11 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update General Notes" controller:self] ;
+                    
+                    
+                    [RAUtils message_box:@"Update General Notes" message:[cart_json valueForKey:@"err_msg"] completion:nil];
                 }
-            }];
+//            }];
 
             
             
@@ -87,45 +93,10 @@
             
         }];
 
-    }];
+//    }];
     
    
     
-    
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* cart_json = nil;
-//
-//
-//
-//
-//        cart_json = [RANetwork cart_setGeneralNote:appDelegate.order_code notes:notes];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            if([[cart_json valueForKey:@"result"] intValue]==2)
-//            {
-//                [self dismissViewControllerAnimated:NO
-//                                         completion:^{
-//
-//                                             if(self.onSetValue)
-//                                                 self.onSetValue(self.notes);
-//
-//                                         }];
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update General Notes" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
 
 /*

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 76 - 677
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m


+ 9 - 119
RedAnt ERP Mobile/common/Functions/cart/EditModelPriceViewController.m

@@ -66,12 +66,10 @@
     
     if([self.editDiscount.text floatValue]>100.0)
     {
-//        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Discount error" message:@"Discount must less than 100" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-//
-//        
-//        [alert show];
-        [RAUtils message_alert:@"Fields with * mark cannot be empty." title:@"Some Requried Fields Are Missing." controller:self];
-//        [RAUtils alert_view:@"Fields with * mark cannot be empty." title:@"Some Requried Fields Are Missing."];
+
+        
+        [RAUtils message_box:@"Some Requried Fields Are Missing." message:@"Fields with * mark cannot be empty." completion:nil];
+
         
         self.editDiscount.text=@"0";
         
@@ -89,40 +87,7 @@
                                      self.onSetValue( self.price,self.discount);
                                  
                              }];
-    /*
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        NSDictionary* cart_json = nil;
-        
-        if(self.set_watch_list)
-            cart_json= [iSalesNetwork portfolio_setPrice:self.cart_id price:self.price discount:self.discount];
-        else
-            cart_json = [iSalesNetwork cart_setPrice:self.cart_id price:self.price discount:self.discount];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            
-            
-            if([[cart_json valueForKey:@"result"] intValue]==2)
-            {
-                [self dismissViewControllerAnimated:NO
-                                         completion:^{
 
-                                             
-                                         }];
-            }
-            else
-            {
-                [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Price" controller:self] ;
-            }
-            
-            
-
-            
-        });
-    });
-     
-     */
 }
 #pragma mark textField delegate
 - (BOOL)textFieldShouldReturn:(UITextField *)textField {
@@ -131,57 +96,11 @@
 }
 -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
     
-//    int tag = textField.tag;
-//    
-//    int len = textField.text.length;
-//    
-//    if(textField.tag==2&&textField.text.length>=2 && string.length>0)
-//        return false;
+
     
     if(textField.text.length==0 && [string isEqualToString:@"."])
         return false;
         
-//    DebugLog(@"text:%@",textField.text);
-//    
-//    
-//    
-//    
-//    
-//    UITableViewCell *cell = (UITableViewCell *) textField.superview.superview;
-//    
-//    NSIndexPath *   indexPath = [self.editorTable indexPathForCell:cell];
-//    //            DebugLog(@"shouldchangeedit %d_%d",indexPath.section,indexPath.row);
-//    NSDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
-//    
-//    NSString* required = [item_json valueForKey:@"required"];
-//    
-//    if([required isEqualToString:@"true"] && string.length==0 && (textField.text.length<=1|| textField.text==nil))
-//    {
-//        CALayer *layer = [cell.contentView layer];
-//        //            layer.borderColor = [[UIColor redColor] CGColor];
-//        //            layer.borderWidth = 1.0;
-//        
-//        layer.shadowColor = [UIColor redColor].CGColor;
-//        layer.shadowOffset = CGSizeMake(0, 0);
-//        layer.shadowOpacity = 1;
-//        layer.shadowRadius = 2.0;
-//    }
-//    else
-//    {
-//        CALayer *layer = [cell.contentView layer];
-//        //            layer.borderColor = [[UIColor redColor] CGColor];
-//        //            layer.borderWidth = 1.0;
-//        
-//        layer.shadowColor = [UIColor clearColor].CGColor;
-//        layer.shadowOffset = CGSizeMake(0, 0);
-//        layer.shadowOpacity = 1;
-//        layer.shadowRadius = 2.0;
-//    }
-//    
-//    
-//    NSString* keyboard = [item_json valueForKey:@"keyboard"];
-//    if(![keyboard isEqualToString:@"number"])
-//        return TRUE;
     NSCharacterSet *cs;
     cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS]invertedSet];
 //
@@ -215,13 +134,12 @@
         
         if([textField.text floatValue]>100.0)
         {
-//            UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Discount error" message:@"Discount must less than 100" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-//            //        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
-//            [alert show];
+
             
             
-            [RAUtils message_alert:@"Discount must less than 100." title:@"Input Error." controller:self];
-//            [RAUtils alert_view:@"Discount must less than 100." title:@"Input Error."];
+            
+            [RAUtils message_box:@"Input Error." message:@"Discount must less than 100." completion:nil];
+
             textField.text=@"0";
         }
     }
@@ -233,34 +151,6 @@
     
     [self update_newprice];
     
-//    UITableViewCell *cell = (UITableViewCell *) textField.superview.superview;
-//    NSIndexPath *   indexPath = [self.editorTable indexPathForCell:cell];
-//    
-//    
-//    NSMutableDictionary* section_json=nil;
-//    
-//    
-//    //    DebugLog(@"endedit %d_%d",indexPath.section,indexPath.row);
-//    NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
-//    
-//    
-//    [item_json setValue:@"true" forKey:@"dirty"];
-//    [item_json setValue:textField.text forKey:@"value"];
-//    section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
-//    int count=0;
-//    
-//    count=[[section_json valueForKey:@"count"] intValue];
-//    
-//    for(int i=0;i<count;i++)
-//    {
-//        NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",i ]];
-//        if([[olditem valueForKey:@"name"] isEqualToString:[item_json valueForKey:@"name" ]])
-//            [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",i ]];
-//        
-//        
-//    }
-//    
-//    [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
 }
 
 - (void)textFieldDidBeginEditing:(UITextField *)textField

+ 13 - 40
RedAnt ERP Mobile/common/Functions/cart/ItemNotesViewController.m

@@ -21,9 +21,9 @@
     // Do any additional setup after loading the view.
     
     
-    if (@available(iOS 11, *)) {
+//    if (@available(iOS 11, *)) {
         self.tv_notes.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-    }
+//    }
 //    else {
 //
 //
@@ -32,7 +32,7 @@
 //    }
     
 //    self.automaticallyAdjustsScrollViewInsets = NO;
-    self.navigationController.navigationBar.translucent = NO;
+//    self.navigationController.navigationBar.translucent = NO;
     self.tv_notes.layer.borderColor = [UIColor lightGrayColor].CGColor;
     self.tv_notes.layer.borderWidth = 1.0f;
     
@@ -60,11 +60,14 @@
     
     self.notes = self.tv_notes.text;
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update Item Notes" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update Item Notes" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Update Item Notes" completion:nil];
         [RANetwork request_update_cartitemnote:self.cart_id notes:self.tv_notes.text completionHandler:^(NSMutableDictionary *result) {
             
             NSDictionary* cart_json = result;
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 {
                     [self dismissViewControllerAnimated:NO
@@ -77,9 +80,11 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update Item Notes" controller:self] ;
+
+                    
+                    [RAUtils message_box:@"Update Item Notes" message:[cart_json valueForKey:@"err_msg"] completion:nil];
                 }
-            }];
+//            }];
 
             
             
@@ -87,41 +92,9 @@
             
         }];
 
-    }];
+//    }];
     
         
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* cart_json = nil;
-//
-//
-//
-//        cart_json = [RANetwork cart_setItemNote:self.cart_id notes:self.tv_notes.text];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            if([[cart_json valueForKey:@"result"] intValue]==2)
-//            {
-//                [self dismissViewControllerAnimated:NO
-//                                         completion:^{
-//                                             if(self.onSaveNote)
-//
-//                                                 self.onSaveNote(self.notes);
-//
-//                                         }];
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update Item Notes" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
 
 /*

+ 11 - 174
RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m

@@ -63,98 +63,7 @@
     int val_change=(int)sender.value-self.pre_val;
     
         _totalchange=_totalchange+val_change;
-    
-    
-//    
-//    if(val_change==(int)sender.stepValue)
-//    {
-//        
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* cart_json = [iSalesNetwork cart_incresement:self.cart_id increse:true];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                
-//                
-//                
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-////                    
-////                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-////                        [self.delegate returnQTY:sender.value ];
-//                   // }
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//                
-//                
-//
-//                
-//            });
-//        });
-//        //increse;
-//    }
-//    else if(val_change==-(int)sender.stepValue)
-//    {
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* cart_json = [iSalesNetwork cart_incresement:self.cart_id increse:false];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                
-//                
-//                
-//                
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//
-//                
-//            });
-//        });
-//        
-//    }
-//    else
-//    {
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* cart_json = [iSalesNetwork cart_setQTY:self.cart_id value:sender.value];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-////                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-////                        [self.delegate returnQTY:sender.value ];
-////                    }
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//                
-//
-//                
-//            });
-//        });
-//        
-//        //setvalue;
-//    }
+
     self.pre_val = (int)sender.value;
     
     
@@ -188,39 +97,15 @@
         {
             UIViewController* vc=[RAUtils getViewController :self];
             [((CartViewController *)vc).itemListTable reloadData];
-            [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+//            [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
+            
+            [RAUtils message_box:@"Change Model Count" message:[cart_json valueForKey:@"err_msg"] completion:nil];
         }
         
         
         
     }];
     
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* cart_json = [RANetwork cart_setQTY:self.cart_id value:self.pre_val];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    self.totalchange=0;
-//                    if([[cart_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        if(self.onReturnQTY)
-//                            self.onReturnQTY(self.pre_val,cart_json);
-//    //                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-//    //                        [self.delegate returnQTY:sender.value ];
-//    //                    }
-//                    }
-//                    else
-//                    {
-//                        UIViewController* vc=[RAUtils getViewController :self];
-//                        [((CartViewController *)vc).itemListTable reloadData];
-//                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                    }
-//
-//
-//
-//                });
-//            });
-    
     
 }
 
@@ -406,7 +291,7 @@
     if ((int)qty % (int)self.stepper.stepValue != 0) {
         UIViewController* vc=[RAUtils getViewController :self];
         [((CartViewController *)vc).itemListTable reloadData];
-        [RAUtils message_alert:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)] title:@"Change Model Count" controller:vc];
+        [RAUtils message_box:@"Change Model Count" message:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)] completion:nil];
         return;
     }
 #endif
@@ -445,39 +330,15 @@
                     {
                         UIViewController* vc=[RAUtils getViewController :self];
                         [((CartViewController *)vc).itemListTable reloadData];
-                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+//                        [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
+                        
+                        [RAUtils message_box:@"Change Model Count" message:[cart_json valueForKey:@"err_msg"] completion:nil];
                     }
                     
                     
                     
                 }];
                 
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* cart_json = [RANetwork cart_setQTY:self.cart_id value:qty];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                        if([[cart_json valueForKey:@"result"] intValue]==2)
-//                        {
-//                            //                if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-//                            //                    [self.delegate returnQTY:qty];
-//                            //                }
-//
-//                            if(self.onReturnQTY)
-//                                self.onReturnQTY(qty,cart_json);
-//                        }
-//                        else
-//                        {
-//                            UIViewController* vc=[RAUtils getViewController :self];
-//                            [((CartViewController *)vc).itemListTable reloadData];
-//                            [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                        }
-//
-//
-//
-//                    });
-//                });
 
             }];
             
@@ -516,39 +377,15 @@
                 {
                     UIViewController* vc=[RAUtils getViewController :self];
                     [((CartViewController *)vc).itemListTable reloadData];
-                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+//                    [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
+                    
+                    [RAUtils message_box:@"Change Model Count" message:[cart_json valueForKey:@"err_msg"] completion:nil];
                 }
                 
                 
                 
             }];
             
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* cart_json = [RANetwork cart_setQTY:self.cart_id value:qty];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                    if([[cart_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        //                if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-//                        //                    [self.delegate returnQTY:qty];
-//                        //                }
-//
-//                        if(self.onReturnQTY)
-//                            self.onReturnQTY(qty,cart_json);
-//                    }
-//                    else
-//                    {
-//                        UIViewController* vc=[RAUtils getViewController :self];
-//                        [((CartViewController *)vc).itemListTable reloadData];
-//                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                    }
-//
-//
-//
-//                });
-//            });
 
         }
         

+ 2 - 1
RedAnt ERP Mobile/common/Functions/cart/OrderDiscountViewController.m

@@ -34,7 +34,8 @@
     
     if([self.textfieldDiscount.text intValue]>100)
     {
-        [RAUtils message_alert:@"Illegal input" title:@"Warrning" controller:self];
+
+        [RAUtils message_box:@"Warrning" message:@"Illegal input" completion:nil];
         return;
     }
     [self dismissViewControllerAnimated:NO

+ 80 - 524
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -182,12 +182,7 @@
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     
     
-//    if(appDelegate.offline_mode)
-//    {
-//        [RAUtils message_alert:@"offline mode does not support this function." title:@"Category Filter" controller:self] ;
-//        
-//        return;
-//    }
+
     
     NSMutableDictionary* menu =             [appDelegate.categoryMenu mutableCopy];
     
@@ -566,11 +561,13 @@
 -(void) neworder
 {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
             NSMutableDictionary* return_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 if([[return_json valueForKey:@"result"] intValue]==2)
                 {
                     int result=[[return_json valueForKey:@"result"] intValue];
@@ -587,9 +584,9 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                 }
-            }];
+//            }];
             
             
 
@@ -600,44 +597,8 @@
             
         }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = [RANetwork new_Order];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//
-//                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    appDelegate.order_code = order_code;
-//
-//
-//                    [self addtocart];
-//
-//
-//
-//
-//                }
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
+//    }];
+
 }
 - (IBAction)onAddPortfolioClick:(id)sender {
     UIApplication * app = [UIApplication sharedApplication];
@@ -765,13 +726,16 @@
     //[checked addObject:@"-123"];
     
     if (!count) {
-        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to cart." controller:self] ;
+        [RAUtils message_box:@"Cannot Add to cart." message:@"There is no model." completion:nil] ;
+        
+
         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_box:@"Cannot Add to cart." message:@"You must select at least one model." completion:nil] ;
+        
         return;
     }
     
@@ -780,10 +744,10 @@
     
     
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Cart" completion:^{
-        
-    }];
-    
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Cart" completion:^{
+//
+//    }];
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Add Models To Cart" completion:nil];
     
     if (self.addAll) {
         AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
@@ -792,7 +756,8 @@
             
             NSDictionary* return_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 self.addCartBtn.enabled = true;
                 
                 if([[return_json valueForKey:@"result"] intValue]==2)
@@ -802,12 +767,7 @@
                     {
                         //successed.
                         
-                        
-                        
-                        
-                        //      NSString* order_code = [return_json valueForKey:@"order_code"];
-                        
-                        //                    appDelegate.order_code = order_code;
+
                         
 #ifdef RA_NOTIFICATION
                         [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
@@ -836,7 +796,7 @@
                             
                             
                         }
-                        [RAUtils message_alert:nil title:msg controller:self] ;
+                        [RAUtils message_box:msg message:nil completion:nil] ;
                         
                         [self end_select:4];
                         
@@ -858,13 +818,13 @@
 #endif
                     
                     [self end_select:4];
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                 }
-            }];
+//            }];
             
 
             
@@ -881,7 +841,8 @@
             
             NSDictionary* return_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 self.addCartBtn.enabled = true;
                 
                 if([[return_json valueForKey:@"result"] intValue]==2)
@@ -925,7 +886,7 @@
                             
                             
                         }
-                        [RAUtils message_alert:nil title:msg controller:self] ;
+                        [RAUtils message_box:msg message:nil completion:nil] ;
                         
                         [self end_select:2];
                         
@@ -947,13 +908,13 @@
 #endif
                     
                     [self end_select:2];
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                 }
-            }];
+//            }];
 
             
             
@@ -968,109 +929,14 @@
     
     
     
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = nil;
-//        if (self.addAll) {
-//            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-//            return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:appDelegate.order_code  addTo:@"cart"];
-//        } else {
-//            return_json = [RANetwork add_toCart_byName:ids withScreen:ScreenCodeCategory];
-//        }
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            self.addCartBtn.enabled = true;
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//
-//
-//
-//
-//                    //      NSString* order_code = [return_json valueForKey:@"order_code"];
-//
-//                    //                    appDelegate.order_code = order_code;
-//
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                    [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//                    NSString * msg = nil;
-//                    if (self.addAll) {
-//
-//                        unsigned long checkedCount = [return_json[@"count"] integerValue];
-//
-//                         msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
-//                    } else {
-//
-//                        if(checked.count==1)
-//                        {
-//                            msg=@"1 item added to Cart";
-//                        }
-//                        else
-//                        {
-//                            msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
-//                        }
-//
-//
-//                    }
-//                    [RAUtils message_alert:nil title:msg controller:self] ;
-//
-//                    [self end_select:2];
-//
-//
-//
-//                }
-//            }
-//            else  if([[return_json valueForKey:@"result"] intValue]==8)
-//            {
-//
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                //                    appDelegate.order_code = order_code;
-//                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//
-//                [self end_select:2];
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
 -(void) addtoportfolio
 {
-    
-//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-//    if (appDelegate.offline_mode) {
-//        
-//        [RAUtils message_alert:@"offline mode does not support this function." title:@"Add to Portfolio" controller:self] ;
-//        return;
-//    }
+
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
-        [RAUtils message_alert:@"Cannot Add to portfolio." title:@"Warning" controller:self] ;
+        [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil] ;
+        
         return;
     }
     
@@ -1090,13 +956,16 @@
     }
     
     if (!count) {
-        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to portfolio." controller:self] ;
+        [RAUtils message_box:@"Cannot Add to portfolio." message:@"There is no model." completion:nil] ;
+        
+        
         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_box:@"Cannot Add to portfolio." message:@"You must select at least one model." completion:nil] ;
+        
         return;
     }
 
@@ -1105,13 +974,16 @@
     self.addPortfolioBtn.enabled =false;
     
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Portfolio" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Portfolio" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Add Models To Portfolio" completion:nil];
                     if (self.addAll) {
             //            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
                         [RANetwork request_addall_category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:PAGE_ITEM alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil  addTo:@"portfolio" completionHandler:^(NSMutableDictionary *result) {
                             
                             NSDictionary* return_json = result;
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            [pop hide];
                                 self.addPortfolioBtn.enabled =true;
                                 
                                 if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1150,7 +1022,7 @@
                                         }
                                     }
                                     
-                                    [RAUtils message_alert:nil title:msg controller:self] ;
+                                    [RAUtils message_box:msg message:nil completion:nil] ;
                                     
                                     
                                     [self end_select:END_SELECT_PORTFOLIO ];
@@ -1158,9 +1030,10 @@
                                 }
                                 else
                                 {
-                                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
+                                    [RAUtils message_box:@"Add To Portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
+                                    
                                 }
-                            }];
+//                            }];
                             
                             
                             
@@ -1173,7 +1046,8 @@
                         [RANetwork request_addto_portfolio:ids withScreen:ScreenCodeCategory completionHandler:^(NSMutableDictionary *result) {
                             
                             NSDictionary* return_json = result;
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            [pop hide];
                                 self.addPortfolioBtn.enabled =true;
                                 
                                 if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1212,7 +1086,7 @@
                                         }
                                     }
                                     
-                                    [RAUtils message_alert:nil title:msg controller:self] ;
+                                    [RAUtils message_box:msg message:nil completion:nil] ;
                                     
                                     
                                     [self end_select:END_SELECT_PORTFOLIO ];
@@ -1220,9 +1094,9 @@
                                 }
                                 else
                                 {
-                                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
+                                    [RAUtils message_box:@"Add To Portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                                 }
-                            }];
+//                            }];
                             
                             
                             
@@ -1231,77 +1105,10 @@
                         }];
                        
                     }
-    }];
+//    }];
     
     
 
-
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = nil;
-//        if (self.addAll) {
-////            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-//            return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil  addTo:@"portfolio"];
-//        } else {
-//            return_json = [RANetwork add_toPortfolio:ids withScreen:ScreenCodeCategory];
-//        }
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            self.addPortfolioBtn.enabled =true;
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                //                int result=[[return_json valueForKey:@"result"] intValue];
-//                //                if(result==2)
-//                //                {
-//                //                    //successed.
-//
-//
-//
-//
-//                #ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//                #else
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
-//                #endif
-//
-//                NSString * msg = nil;
-//
-//                if (self.addAll) {
-//
-//                    unsigned long checkedCount = [return_json[@"count"] integerValue];
-//
-//                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
-//                } else {
-//
-//                    if(checked.count==1)
-//                    {
-//                        msg=@"1 item added to Portfolio";
-//                    }
-//                    else
-//                    {
-//                        msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
-//                    }
-//                }
-//
-//                [RAUtils message_alert:nil title:msg controller:self] ;
-//
-//
-//                [self end_select:3 ];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
 -(void) addtowish
 {
@@ -1322,13 +1129,15 @@
     }
     
     if (!count) {
-        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to Wish List." controller:self] ;
+        [RAUtils message_box:@"Cannot Add to Wish List." message:@"There is no model." completion:nil] ;
+        
         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_box:@"Cannot Add to Wish List." message:@"You must select at least one model." completion:nil] ;
+        
         return;
     }
 
@@ -1336,12 +1145,14 @@
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addWishBtn.enabled =false;
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Wish List" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Wish List" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Add Models To Wish List" completion:nil];
         if (self.addAll) {
                 
                 [RANetwork request_addall_category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:PAGE_ITEM alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil  addTo:@"wishlist" completionHandler:^(NSMutableDictionary *result) {
                     NSDictionary* return_json = result;
-                    [waitalert dismissViewControllerAnimated:YES completion:^{
+//                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                         self.addWishBtn.enabled =true;
                         
                         if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1379,7 +1190,7 @@
                                 }
                             }
                             
-                            [RAUtils message_alert:nil title:msg controller:self] ;
+                            [RAUtils message_box:msg message:nil completion:nil] ;
                             
                             
                             
@@ -1388,9 +1199,11 @@
                         }
                         else
                         {
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
+                            [RAUtils message_box:@"Add To Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
+                            
+                            
                         }
-                    }];
+//                    }];
                     
                     
                     
@@ -1404,7 +1217,8 @@
                 
                 [RANetwork request_addto_wishlist:ids withScreen:ScreenCodeCategory completionHandler:^(NSMutableDictionary *result) {
                     NSDictionary* return_json = result;
-                    [waitalert dismissViewControllerAnimated:YES completion:^{
+//                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                         self.addWishBtn.enabled =true;
                         
                         if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1442,7 +1256,7 @@
                                 }
                             }
                             
-                            [RAUtils message_alert:nil title:msg controller:self] ;
+                            [RAUtils message_box:msg message:nil completion:nil] ;
                             
                             
                             
@@ -1451,11 +1265,11 @@
                         }
                         else
                         {
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
+                            [RAUtils message_box:@"Add To Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                         }
                         
                         
-                    }];
+//                    }];
                     
                     
                     
@@ -1463,78 +1277,9 @@
                 
                 
             }
-    }];
+//    }];
     
     
-    
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//
-//        NSDictionary* return_json = nil;
-//        if (self.addAll) {
-//            return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil  addTo:@"wishlist"];
-//        } else {
-//            return_json = [RANetwork add_toWatchList:ids withScreen:ScreenCodeCategory];
-//        }
-//
-//
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            self.addWishBtn.enabled =true;
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//                //successed.
-//
-//                //                    NSString* order_code = [return_json valueForKey:@"order_code"];
-//
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//#endif
-//
-//                NSString * msg = nil;
-//
-//                if (self.addAll) {
-//
-//                    unsigned long checkedCount = [return_json[@"count"] integerValue];
-//
-//                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
-//                } else {
-//
-//                    if(checked.count==1)
-//                    {
-//                        msg=@"1 item added to \nWish List";
-//                    }
-//                    else
-//                    {
-//                        msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
-//                    }
-//                }
-//
-//                [RAUtils message_alert:nil title:msg controller:self] ;
-//
-//
-//
-//                [self end_select:1];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
 #pragma mark get data
 -(void)operation_loadMore
@@ -1548,7 +1293,8 @@
             if(self.showalert)
             {
                 self.showalert=false;
-                [RAUtils message_alert:@"All loaded" title:@"Loading Category" controller:self] ;
+                
+                [RAUtils message_box:@"Loading Category" message:@"All loaded" completion:nil];
             }
             return;
             
@@ -1606,7 +1352,8 @@
             }
             else
             {
-                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Loading Category" controller:self] ;
+                
+                [RAUtils message_box:@"Loading Category" message:[category_more valueForKey:@"err_msg"] completion:nil];
             }
             //                self.isrefreshing=false;
             
@@ -1615,60 +1362,6 @@
         
         return;
         
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* category_more=[RANetwork Category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip] ;
-//
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                [self.mum stopAnimating];
-//                self.isrefreshing=false;
-//                if (self.dataOperationQueue.operationCount > 1) {
-//                    return ;
-//                }
-//
-//                NSDictionary* more_items=[category_more objectForKey:@"items"];
-//                if([[category_more valueForKey:@"result"] intValue]==2)
-//                {
-//                    //  self.category_data = category_data;
-//                    NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-//
-//                    int count =[[more_items valueForKey:@"count"] intValue];
-//                    for(int i=0;i<count;i++)
-//                    {
-//
-//                        NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-//                        [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-//
-//
-//                    }
-//                    long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
-//                    [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
-//                    [self.category_data setObject:items_json forKey:@"items"];
-//                    self.offset+=count;
-//
-//                    if(count<20)
-//                    {
-//                        self.loadall=true;
-//
-//                    }
-//                    //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-//
-//
-//
-//
-//                    //   DebugLog(@"%@",self.category_data);
-//
-//                    [self.collectionview reloadData];
-//
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Loading Category" controller:self] ;
-//                }
-////                self.isrefreshing=false;
-//
-//            });
-//        });
     });
 }
 
@@ -1756,58 +1449,14 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[category_data valueForKey:@"err_msg"]  title:@"Loading Category" controller:self] ;
+                    
+                    [RAUtils message_box:@"Loading Category" message:[category_data valueForKey:@"err_msg"] completion:nil];
                 }
                 
             }];
             
             return;
-            
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//                
-//                NSDictionary* category_data=[RANetwork Category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:0 limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip];
-//                
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    
-//                    [self.mum stopAnimating];
-//                    self.isrefreshing=false;
-//                    if (self.dataOperationQueue.operationCount > 1) {
-//                        return ;
-//                    }
-//                    
-//                    //                self.collectionview.userInteractionEnabled = true;
-//                    self.category_data = [category_data mutableCopy];
-//                    [self.collectionview reloadData];
-//                    if([[category_data valueForKey:@"result"] intValue]==2)
-//                    {
-//                        
-//                        self.collectionview.hidden=false;
-//                        NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-//                        self.offset =[[item_json valueForKey:@"count"] intValue];
-//                        
-//                        int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
-//                        
-//                        if(total<2)
-//                            self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
-//                        else
-//                            self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
-//                        
-//                    }
-//                    else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-//                    {
-//                        self.collectionview.hidden=true;
-//                        self.label_net_err.hidden=false;
-//                    }
-//                    else
-//                    {
-//                        [RAUtils message_alert:[category_data valueForKey:@"err_msg"]  title:@"Loading Category" controller:self] ;
-//                    }
-//                    
-//                    
-//                    
-//                    
-//                });
-//            });
+
             
         });
     }
@@ -3005,99 +2654,6 @@
 }
 
 
-//#pragma mark - UIAlertViewDelegate
-//// Called when a button is clicked. The view will be automatically dismissed after this call returns
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-//{
-//    UIApplication * app = [UIApplication sharedApplication];
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//    
-// //   MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//    if(buttonIndex==alertView.cancelButtonIndex)
-//    {
-//        
-//        
-//        
-//    }
-//    else if(buttonIndex==1)
-//    {
-//        //open exist
-//        
-//        self.disable_refresh = true;
-//        OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-//        ovc.showNavibar = true;
-//        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-//            if(appDelegate.order_code==nil)
-//            {
-//                [self neworder];
-//            }
-//            else
-//            {
-//                [self addtocart];
-//              //  [main_vc checklogin:true];
-//                
-//            }
-//            
-//        };
-//        ovc.init_style = OL_OPEN;
-//        
-//        ovc.onCancel = ^(){
-//            
-//             self.disable_refresh = false;
-//            
-////            [main_vc checklogin:true];
-//            
-//            
-//        };
-//        
-//        [self.navigationController pushViewController:ovc animated:true];
-//    }
-//    else
-//    {
-//        //create new;
-//        self.disable_refresh = true;
-//        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//        {
-//            ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//            cvc.showNavibar = true;
-//            cvc.contact_type = @"Sales_Order_Customer";
-//            cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//                
-//                appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                appDelegate.customerInfo = value;
-//                
-//                
-//                if(appDelegate.order_code==nil)
-//                    [self neworder];
-//                
-//            //    [main_vc checklogin:true];
-//                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//                
-//                //
-//                //                if(self.returnValue)
-//                //                    self.returnValue(value);
-//            };
-//            
-//            cvc.onCancel = ^(){
-//                
-//                [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order Error" controller:self];
-//                
-//                self.disable_refresh = false;
-//                
-//            };
-//            cvc.onReset = ^(){
-//               // [main_vc checklogin:true];
-//            };
-//            
-//            [self.navigationController pushViewController:cvc animated:true];
-//        }
-//        else
-//        {
-//            [self neworder];
-//        }
-//        
-//    }
-//}
 #pragma mark - Support scanner
 -(void) onDecodedData:(NSString*) value
 {

+ 13 - 212
RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.m

@@ -345,7 +345,8 @@
             }
             else
             {
-                [RAUtils message_alert:[content valueForKey:@"err_msg"] title:@"Loading Contact List" controller:self] ;
+                
+                [RAUtils message_box:@"Loading Contact List" message:[content valueForKey:@"err_msg"]  completion:nil];
             }
             
             
@@ -358,73 +359,6 @@
         }];
         
         return;
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//
-//            NSMutableDictionary* content=nil;
-//            content=[[RANetwork request_ContactList:self.offset limit : self.limit keywords:self.keywords type:self.contact_type adv_search:self.adv_search] mutableCopy];
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                [self.mum stopAnimating];
-//                self.isrefreshing=false;
-//                if (self.dataOperationQueue.operationCount > 1) {
-//                    return ;
-//                }
-//
-//
-//                if([[content valueForKey:@"result"] intValue]==2)
-//                {
-//                    self.table.hidden =false;
-//                    int count = [[content valueForKey:@"count" ] intValue] ;
-//
-//                    self.offset += count;
-//                    for(int i=0;i<count;i++)
-//                    {
-//
-//                        NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-//                        [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
-//
-//                    }
-//                    if(count<self.limit)
-//                    {
-//
-//                        //                    int i =self.btnrefresh.state;
-//                        self.load_more_hint=@"All loaded";
-//                        //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
-//                        //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
-//                    }
-//                    else
-//                    {
-//                        self.load_more_hint=@"Load more...";
-//                        //                    self.btnrefresh.enabled = true;
-//                        //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
-//                        //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
-//                    }
-//
-//
-//
-//                    [self.table reloadData ];
-//                    NSLog(@"%s reloadData",__FUNCTION__);
-//
-//                }
-//                else if([[content valueForKey:@"result"] intValue]==RESULT_NET_ERROR &&self.offset==0)
-//                {
-//                    self.label_net_err.hidden=false;
-//                    self.table.hidden = true;
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[content valueForKey:@"err_msg"] title:@"Loading Contact List" controller:self] ;
-//                }
-//
-//
-//
-//
-//
-//                self.isrefreshing=false;
-//
-//            });
-//        });
     });
 }
 
@@ -548,39 +482,6 @@
         NSLog(@"%s reloadData",__FUNCTION__);
     }];
 }
-//- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
-//{
-//    DebugLog(@"!!!!!!!!!!!!!!!!!!!!!route!!!!!!!!!!!!!!!!!!!!!");
-//    [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
-//    [self.table reloadData];
-//    NSLog(@"%s reloadData",__FUNCTION__);
-//    //    CGSize contentsize = self.scroll.contentSize;
-//    //    contentsize.height =330+2 * 230+29+20+20 +1 * 230+29+20+20 ;
-//    //    UIInterfaceOrientation orientation =[UIApplication sharedApplication].statusBarOrientation;
-//    //    if(orientation == UIDeviceOrientationLandscapeLeft ||orientation == UIDeviceOrientationLandscapeRight)
-//    //    {
-//    //        contentsize.height+=250;
-//    //    }
-//    //
-//    //    self.scroll.contentSize = contentsize;
-//    //    //     CGRect frame = self.view.frame;
-//    //    //    [self.carouselController.view removeFromSuperview];
-//    //    //    wait(2000);
-//    //    //    self.carouselController = [[FPCarouselNonXIBViewController alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, 400)];
-//    //    //    [self.view addSubview:self.carouselController.view];
-//    //    //    int i = self.view.subviews.count;
-//    //    //    int b = 0;
-//    //    // [self.carouselController updateFrame:CGRectMake(0, 0, self.view.frame.size.width, 400)];
-//}
-//
-//-(void)changeCell
-//{
-//    //    UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
-//    //    reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"refreshing"];
-//    [self performSelector:@selector(loadmore) withObject:nil afterDelay:1];
-//    DebugLog(@"refresh!!!!!!!!");
-//    
-//}
 - (IBAction)onAssignClick:(id)sender {
     
     UIButton* btn = (UIButton*)sender;
@@ -594,12 +495,15 @@
     
     
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Getting Contact information" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Getting Contact information" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Getting Contact information" completion:nil];
         [RANetwork request_contactinfo:contactid completionHandler:^(NSMutableDictionary *result) {
             NSMutableDictionary* editor_json = result;
             
                 
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            
+            [pop hide];
                 if([[editor_json valueForKey:@"result"] intValue]==2)
                 {
                     __block NSMutableDictionary* data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
@@ -628,43 +532,16 @@
                         self.returnValue(data_init,self.from);
                     
                     
-                    //                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                    //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                    //                    NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:data_init];
-                    //
-                    //                    dispatch_async(dispatch_get_main_queue(), ^{
-                    //
-                    //
-                    //                        if([[editor_json valueForKey:@"result"] intValue]==2)
-                    //                        {
-                    //
-                    ////                            [self.navigationController popViewControllerAnimated:false];
-                    ////                            if(self.returnValue)
-                    ////                            {
-                    ////
-                    ////                                self.returnValue(data_init);
-                    ////                            }
-                    //
-                    //
-                    //
-                    //                        }
-                    //                        else
-                    //                        {
-                    //                            [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
-                    //                        }
-                    //
-                    //
-                    //
-                    //                    });
-                    //                });
                     
                 }
                 else
                 {
-                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
+                    [RAUtils message_box:@"Loading Contact Information" message:[editor_json valueForKey:@"err_msg"] completion:nil] ;
+                    
+                    ;
                     //                self.btn_assign.enabled=false;
                 }
-            }];
+//            }];
                 
                 
                 
@@ -673,86 +550,10 @@
         }];
         
 
-    }];
+//    }];
     
         return ;
-    
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* editor_json = [RANetwork request_CustomerInfo:contactid];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//                __block NSMutableDictionary* data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
-//
-//                //---------------- construct customer_contact----------------------
-//                NSString* customer_first_name = [data_init valueForKey:@"customer_first_name"];
-//                if(customer_first_name==nil)
-//                    customer_first_name=@"";
-//
-//                NSString* customer_last_name= [data_init valueForKey:@"customer_last_name"];
-//                if(customer_last_name==nil)
-//                    customer_last_name=@"";
-//                NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
-//                customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
-//                [data_init setValue:customer_contact forKey:@"customer_contact"];
-//
-//                data_init[@"is_subaction"]=self.is_subaction;
-//                data_init[@"subaction_tag"]= self.subaction_tag;
-//                [self.navigationController popToRootViewControllerAnimated:false];
-//
-//
-//                [self.table reloadData];
-//                NSLog(@"%s reloadData",__FUNCTION__);
-//                if(self.returnValue)
-//                    self.returnValue(data_init,self.from);
-//
-//                //                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//                //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                //                    NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:data_init];
-//                //
-//                //                    dispatch_async(dispatch_get_main_queue(), ^{
-//                //
-//                //
-//                //                        if([[editor_json valueForKey:@"result"] intValue]==2)
-//                //                        {
-//                //
-//                ////                            [self.navigationController popViewControllerAnimated:false];
-//                ////                            if(self.returnValue)
-//                ////                            {
-//                ////
-//                ////                                self.returnValue(data_init);
-//                ////                            }
-//                //
-//                //
-//                //
-//                //                        }
-//                //                        else
-//                //                        {
-//                //                            [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
-//                //                        }
-//                //
-//                //
-//                //
-//                //                    });
-//                //                });
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
-//                //                self.btn_assign.enabled=false;
-//            }
-//
-//
-//        });
-//    });
-    
-    
+ 
     
 }
 #pragma mark - Table view data source

+ 11 - 70
RedAnt ERP Mobile/common/Functions/contact/CustomerEditViewController.m

@@ -120,21 +120,16 @@
         return;
     }
     __weak typeof(self) weakself = self;
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving Contact" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving Contact" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Saving Contact" completion:nil];
         resultHandler handler =^(NSMutableDictionary *result) {
                 NSDictionary* editor_json = result;
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                     if([[editor_json valueForKey:@"result"] intValue]==2)
                     {
-                        //                NSMutableDictionary * customerInfo=[self create_cusromer_info_from_table];
-                        //
-                        //
-                        //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                        //                appDelegate.customerInfo = customerInfo;
-                        //                appDelegate.contact_id = [customerInfo valueForKey:@"customer_cid"];
-                        //    //     self.labelContact.text=appDelegate.contact_name;
-                        //
-                        //    NSDictionary * customerinfo = appDelegate.customerInfo;
+
                         [weakself prepareReturn:nil];
                         if(weakself.bnewcustomer  )
                             [weakself.navigationController popViewControllerAnimated:false];
@@ -155,9 +150,10 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Save Order" controller:weakself] ;
+                        
+                        [RAUtils message_box:@"Save Order" message:[editor_json valueForKey:@"err_msg"]  completion:nil];
                     }
-                }];
+//                }];
                 
                 
 
@@ -171,66 +167,11 @@
                 [RANetwork request_add_customer:upparams completionHandler:handler];
             else
                 [RANetwork request_update_customer:upparams completionHandler:handler];
-    }];
-    
-    
+//    }];
     
     
     
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* editor_json = nil;
-//     //   NSString* contactId=[upparams valueForKey:@"contactId"];
-//        if(self.bnewcustomer )
-//            editor_json=[RANetwork save_newCustomer:upparams];
-//        else
-//            editor_json=[RANetwork update_Customer:upparams];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//                //                NSMutableDictionary * customerInfo=[self create_cusromer_info_from_table];
-//                //
-//                //
-//                //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                //                appDelegate.customerInfo = customerInfo;
-//                //                appDelegate.contact_id = [customerInfo valueForKey:@"customer_cid"];
-//                //    //     self.labelContact.text=appDelegate.contact_name;
-//                //
-//                //    NSDictionary * customerinfo = appDelegate.customerInfo;
-//                [weakself prepareReturn:nil];
-//                if(weakself.bnewcustomer  )
-//                    [weakself.navigationController popViewControllerAnimated:false];
-//                else
-//                    [weakself.navigationController popToRootViewControllerAnimated:false];
-//
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//
-//                [ActiveViewController Notify:@"ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
-//#endif
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Save Order" controller:weakself] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
-    
-    
+
 }
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];

+ 21 - 217
RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.m

@@ -125,43 +125,14 @@
             }
             else
             {
-                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
+                
+                [RAUtils message_box:@"Update Order Customer Infomation" message:[editor_json valueForKey:@"err_msg"]  completion:nil];
             }
             
             
             
         }];
-        
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* editor_json = [RANetwork update_OrderCustomer:appDelegate.order_code customerinfo:self.data_init];
-//
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//                if([[editor_json valueForKey:@"result"] intValue]==2)
-//                {
-//
-//                    [self.navigationController popViewControllerAnimated:false];
-//                    if(self.returnValue)
-//                    {
-//
-//                        self.returnValue(self.data_init);
-//                    }
-//
-//
-//
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
-//                }
-//
-//
-//
-//            });
-//        });
-        
+
         
     }
     else
@@ -203,10 +174,13 @@
 #endif
             
             
-            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order" completion:^{
+//            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order" completion:^{
+            
+            PopWaitAlert* pop = [RAUtils waiting_pop:@"Release Order" completion:nil];
                 [RANetwork request_release_order:appDelegate.order_code withScreen:ScreenCodeCustomerInfo  completionHandler:^(NSMutableDictionary *result) {
                                 NSDictionary* order_json = result;
-                                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                                [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                                     if([[order_json valueForKey:@"result"] intValue]==2)
                                     {
                                         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -231,55 +205,19 @@
                                     }
                                     else
                                     {
-                                        [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:self] ;
+                                        
+                                        [RAUtils message_box:@"Release Order" message:[order_json valueForKey:@"err_msg"]  completion:nil];
                                     }
-                                }];
+//                                }];
 
                                 
                                 
                                 
                             }];
 
-            }];
-            
-            //            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* order_json = [RANetwork release_Order:appDelegate.order_code withScreen:ScreenCodeCustomerInfo];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                    if([[order_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                        //                    appDelegate.order_code = nil;
-//                        [appDelegate closeOrder];
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                        [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//                        [ActiveViewController Notify:@"ContactListViewController" Message:RA_NOTIFICATION_REFRESH_UI];
-//#else
-//                        [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                        [((MainViewController*)appDelegate.main_vc) reloadContact:false immediately:false];
-//#endif
-//
-//                        [self.navigationController popToRootViewControllerAnimated:false];
-//
-//
-//
-//                    }
-//                    else
-//                    {
-//                        [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:self] ;
-//                    }
-//
-//
-//
-//                });
-//            });
+//            }];
             
+
         }];
         
         UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
@@ -479,12 +417,14 @@
 }
 -(void) request_fill
 {
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Loading Contact information" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Loading Contact information" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Loading Contact information" completion:nil];
         [RANetwork request_contactinfo:self.contactId completionHandler:^(NSMutableDictionary *result) {
             NSMutableDictionary* editor_json = result;
             
-                
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
                 if([[editor_json valueForKey:@"result"] intValue]==2)
                 {
                     self.data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
@@ -495,14 +435,14 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
+                    [RAUtils message_box:@"Loading Contact Information" message:[editor_json valueForKey:@"err_msg"] completion:nil] ;
                     self.btn_assign.enabled=false;
                 }
-            }];
+//            }];
  
         }];
         return;
-    }];
+//    }];
     
 
 }
@@ -563,142 +503,6 @@
 }
 
 
-//#pragma mark- img changed
-//
-//// image 改变时执行
-//- (void) imgIsChanged:(NSString *)url_down url_up:(NSString *)url_up indexPath: (NSIndexPath *) indexPath{
-//
-//    // int aaa = 0;
-//    // NSDictionary* aaa = self.content_data_download;
-//
-//
-//
-//    UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order"];
-//    NSString* cid=[self getValue:@"customer_cid"];
-//    [RANetwork request_update_customer_img:cid img_url:url_up completionHandler:^(NSMutableDictionary *result) {
-//        NSDictionary* return_json =result;
-//        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    int result=[[return_json valueForKey:@"result"] intValue];
-//                    if(result==2)
-//                    {
-//
-//                        [RAUtils message_alert:nil title:@"Upload successful." controller:self];
-//    //                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Upload successful." message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-//    //
-//    //                    [alert show];
-//                    }
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//                }
-//
-//
-//
-//
-//    }];
-//
-////    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-////        NSString* cid=[self getValue:@"customer_cid"];
-////        NSDictionary* return_json = [RANetwork update_customer_img:cid img_url:url_up];
-////
-////        dispatch_async(dispatch_get_main_queue(), ^{
-////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-////
-////
-////            if([[return_json valueForKey:@"result"] intValue]==2)
-////            {
-////                int result=[[return_json valueForKey:@"result"] intValue];
-////                if(result==2)
-////                {
-////
-////                    [RAUtils message_alert:nil title:@"Upload successful." controller:self];
-//////                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Upload successful." message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-//////
-//////                    [alert show];
-////                }
-////            }
-////            else
-////            {
-////                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-////            }
-////
-////
-////
-////
-////        });
-////    });
-//
-//    //    // DebugLog(@"Sender is = %@", url);
-//    //
-//    //
-//    //
-//    //
-//    //    NSMutableDictionary* section_json=nil;
-//    //
-//    //
-//    //    //    DebugLog(@"endedit %d_%d",indexPath.section,indexPath.row);
-//    //    NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
-//    //
-//    //    int refresh = [[item_json valueForKey:@"refresh"] intValue];
-//    //
-//    //    NSString* subid=[item_json valueForKey:@"subid"];
-//    //
-//    //    item_json[@"img_url"]=url_down;
-//    //    item_json[@"avalue"]=url_up;
-//    //
-//    //    if(subid==nil)
-//    //    {
-//    //        section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
-//    //        int count=0;
-//    //
-//    //        count=[[section_json valueForKey:@"count"] intValue];
-//    //
-//    //        for(int i=0;i<count;i++)
-//    //        {
-//    //            NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",i ]];
-//    //            if([[olditem valueForKey:@"name"] isEqualToString:[item_json valueForKey:@"name" ]])
-//    //                [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",i ]];
-//    //
-//    //
-//    //        }
-//    //
-//    //    }
-//    //    else
-//    //    {
-//    //        NSArray* idarr=[subid componentsSeparatedByString:@"_"];
-//    //        int section = [(NSString*)idarr[0] intValue];
-//    //        int item=[(NSString*)idarr[1] intValue];
-//    //
-//    //
-//    //        section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d", section]] mutableCopy];
-//    //        NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",item ]];
-//    //        item_json= [self enum_subitem_changed:[olditem mutableCopy] subid:idarr value:item_json step:2];
-//    //        [item_json setValue:@"true" forKey:@"dirty"];
-//    //        [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",item ]];
-//    //    }
-//    //
-//    //
-//    //
-//    //    [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
-//    //
-//    //    self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
-//    //
-//    //    NSRange range = NSMakeRange(indexPath.section, 1);
-//    //    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
-//    //    //  [self.editorTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
-//    //
-//    //
-//    //    if(refresh==1)
-//    //    {
-//    //        [self refresh];
-//    //    }
-//}
-
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.

+ 2 - 47
RedAnt ERP Mobile/common/Functions/home/HomeViewController.m

@@ -125,7 +125,8 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[data valueForKey:@"err_msg"] title:@"Loading Home" controller:self] ;
+                    
+                    [RAUtils message_box:@"Loading Home" message:[data valueForKey:@"err_msg"]  completion:nil];
                 }
             
             self.isrefreshing=false;
@@ -133,52 +134,6 @@
             ;
         }];
         return;
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            
-//            //debug
-////            NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"home_template" ofType:@"json" ]];
-////            NSError *error=nil;
-////            NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
-////            
-////            NSMutableDictionary* data=[jsobj mutableCopy];
-//            NSMutableDictionary* data=[[RANetwork load_HomePage:0 customid:0] mutableCopy];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                
-//                
-//                [self.mum stopAnimating];
-//                
-//                self.content = data;
-//                [self.homeTable reloadData];
-//                self.homeTable.hidden=false;
-//                if([[data valueForKey:@"result"] intValue]==2)
-//                {
-//                    DebugLog(@"HOMEVIEW JSON LOADED!");
-//                    
-//                    //debug
-//                    //                NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"button_banner1" ofType:@"json" ]];
-//                    //                NSError *error=nil;
-//                    //                NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
-//                    //                [data setObject:jsobj forKey:@"view_3" ];
-//                    
-//                }
-//                else
-//                if([[data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-//                {
-//                    self.label_net_err.hidden=false;
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[data valueForKey:@"err_msg"] title:@"Loading Home" controller:self] ;
-//                }
-//                
-//                self.isrefreshing=false;
-//                
-//                
-//                
-//            });
-//        });
     });
 }
 -(void) ReloadData

+ 31 - 800
RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m

@@ -98,68 +98,6 @@
 }
 - (IBAction)create_HangTag:(id)sender {
     
-//    DetailViewController *vc= (DetailViewController *)[RAUtils getViewController:self];
-//    
-//    NSString *catelog_name = [NSString stringWithFormat:@"%@ Hang Tag",vc.groupName];
-//    
-//    UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Processing"];
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//        
-//        NSDictionary* editor_json = [RANetwork request_hangTag:vc.groupName];
-//        
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            
-//            
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//                
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                
-//                NSString* url = [editor_json valueForKey:@"pdf_path"];
-//                bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
-//                RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
-//                ViewController.url = url;
-//                ViewController.canSave = false;
-//                ViewController.isLocalfile=isLocalFile;
-//                
-//                ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
-//
-//                
-//                NSString* company=    [appDelegate.customerInfo valueForKey:@"customer_name"];
-//                
-//                if(company==nil)
-//                    company=@"";
-//                
-//                NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
-//                
-//                
-//                NSMutableArray* send_to = [[NSMutableArray alloc]init];
-//                if(customer_email.length>0)
-//                {
-//                    send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
-//                }
-//                ViewController.mail_to = send_to;
-//                
-//                NSString* subject;
-//                
-//                subject =catelog_name;
-//                
-//                ViewController.mail_subject = subject;
-//                
-//                ViewController.hidenavi = false;
-//                [vc.navigationController pushViewController:ViewController animated:YES];
-//                
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Hang Tag" controller:vc];
-//            }
-//            
-//        });
-//    });
-//    
-//    
 }
 - (IBAction)add_toPortfolio:(id)sender {
     
@@ -229,7 +167,8 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add to portfolio" controller:vc] ;
+                        [RAUtils message_box:@"Add to portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
+                        
                     }
                     
                     
@@ -237,46 +176,7 @@
                     
                 }];
                 
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* return_json = [RANetwork add_toPortfolio:self.product_id withScreen:ScreenCodeModelInfo];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                        if([[return_json valueForKey:@"result"] intValue]==2)
-//                        {
-//
-//                            // DebugLog(@"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-//
-//
-//#ifdef RA_NOTIFICATION
-//                            [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                            [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//#endif
-//
-//                            if(self.WatchlistBlock!=nil)
-//                            {
-//                                UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//
-//
-//                                CGRect iv_rect = CGRectMake(self.btnaddPortfolio.center.x-50, self.btnaddPortfolio.center.y-50, 100, 100);
-//                                UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                                iv.image = img;
-//                                //                        [self.contentView addSubview:iv];
-//                                self.PortfolioBlock(iv);
-//
-//                            }
-//                        }
-//                        else
-//                        {
-//                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add to portfolio" controller:vc] ;
-//                        }
-//
-//
-//
-//                    });
-//                });
+
                 
                 
             }
@@ -336,49 +236,12 @@
             else
             {
                 UIViewController *vc= [RAUtils getViewController:self];
-                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add to portfolio" controller:vc] ;
+                [RAUtils message_box:@"Add to portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
             }
             
             
             
         }];
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* return_json = [RANetwork add_toPortfolio:self.product_id withScreen:ScreenCodeModelInfo];
-//
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-//
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                    [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//#endif
-//                    if(self.WatchlistBlock!=nil)
-//                    {
-//                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//
-//
-//                        CGRect iv_rect = CGRectMake(self.btnaddPortfolio.center.x-50, self.btnaddPortfolio.center.y-50, 100, 100);
-//                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                        iv.image = img;
-//                        //                        [self.contentView addSubview:iv];
-//                        self.PortfolioBlock(iv);
-//
-//                    }
-//                }
-//                else
-//                {
-//                    UIViewController *vc= [RAUtils getViewController:self];
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add to portfolio" controller:vc] ;
-//                }
-//
-//
-//
-//            });
-//        });
     }
 }
 
@@ -441,54 +304,14 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add Wish List" controller:vc] ;
+                        [RAUtils message_box:@"Add Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
+                        
                     }
                     
                     
                     
                 }];
-                
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* return_json = [RANetwork add_toWatchList:self.product_id withScreen:ScreenCodeModelInfo];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                        if([[return_json valueForKey:@"result"] intValue]==2)
-//                        {
-//
-//                           // DebugLog(@"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-//
-//
-//#ifdef RA_NOTIFICATION
-//                            [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                            [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//#endif
-//
-//                            if(self.WatchlistBlock!=nil)
-//                            {
-//                                UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//
-//
-//                                CGRect iv_rect = CGRectMake(self.btnaddWish.center.x-50, self.btnaddWish.center.y-50, 100, 100);
-//                                UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                                iv.image = img;
-//                                //                        [self.contentView addSubview:iv];
-//                                self.WatchlistBlock(iv);
-//
-//                            }
-//                        }
-//                        else
-//                        {
-//                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add Wish List" controller:vc] ;
-//                        }
-//
-//
-//
-//                    });
-//                });
-                
+
                 
             }
             
@@ -549,51 +372,13 @@
             else
             {
                 UIViewController *vc= [RAUtils getViewController:self];
-                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add Wish List" controller:vc] ;
+                [RAUtils message_box:@"Add Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
             }
             
             
             
         }];
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* return_json = [RANetwork add_toWatchList:self.product_id withScreen:ScreenCodeModelInfo];
-//
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-//
-//
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                    [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//#endif
-//
-//                    if(self.WatchlistBlock!=nil)
-//                    {
-//                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//
-//
-//                        CGRect iv_rect = CGRectMake(self.btnaddWish.center.x-50, self.btnaddWish.center.y-50, 100, 100);
-//                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                        iv.image = img;
-//                        //                        [self.contentView addSubview:iv];
-//                        self.WatchlistBlock(iv);
-//
-//                    }
-//                }
-//                else
-//                {
-//                    UIViewController *vc= [RAUtils getViewController:self];
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add Wish List" controller:vc] ;
-//                }
-//
-//
-//
-//            });
-//        });
+        
     }
 }
 
@@ -795,7 +580,9 @@
     
     if (count % self.step != 0) {
         UIViewController *vc= [RAUtils getViewController:self];
-        [RAUtils message_alert:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)] title:@"Add to cart" controller:vc];
+        
+        
+        [RAUtils message_box:@"Add to cart" message:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)]  completion:nil];
         return;
     }
     
@@ -953,7 +740,8 @@
                                 self.btnaddCart.enabled = NO;
                             }
                             
-                            [RAUtils message_alert:msg title:title controller:vc] ;
+                            [RAUtils message_box:title message:msg completion:nil] ;
+                            
                         }
                         
                         
@@ -961,70 +749,7 @@
                         
                     }];
                     
-//                    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                        NSDictionary* return_json = [RANetwork add_toCart:self.product_id count:count name:self.model_label.text];
-//
-//                        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//
-//                            if([[return_json valueForKey:@"result"] intValue]==2)
-//                            {
-//
-//                                //    NSString* order_code = [return_json valueForKey:@"order_code"];
-//
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                                [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                                AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-//                                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//                                if(self.shopCartBlock!=nil)
-//                                {
-//                                    UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//
-//
-//                                    CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-//                                    UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                                    iv.image = img;
-//                                    //                        [self.contentView addSubview:iv];
-//                                    self.shopCartBlock(iv);
-//
-//                                    self.cqty +=count;
-//                                    if(self.set_cqty)
-//                                        self.set_cqty(self.cqty);
-//
-//                                }
-//
-//
-//                            }
-//                            else
-//                            {
-//                                UIViewController *vc= [RAUtils getViewController:self];
-//                                NSString *msg = [return_json valueForKey:@"err_msg"];
-//                                NSString *title = @"Add To Cart";
-//                                if ([msg hasPrefix:@"Out of Stock.\n"]) {
-//                                    title = @"Add To Cart: Out of Stock";
-//                                    msg = [msg substringFromIndex:[@"Out of Stock.\n" length]];
-//                                    self.btnNotifyMe.enabled = YES;
-//                                    self.btnaddCart.enabled = NO;
-//                                }
-//
-//                                [RAUtils message_alert:msg title:title controller:vc] ;
-//                            }
-//
-//
-//
-//
-//                        });
-//                    });
-                    
-                    
+            
                 }];
                 
                 UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
@@ -1093,130 +818,18 @@
                             self.btnaddCart.enabled = NO;
                         }
                         
-                        [RAUtils message_alert:msg title:title controller:vc] ;
+                        [RAUtils message_box:title message:msg completion:nil] ;
                     }
                     
                     
                     
                     
                 }];
-//                            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                                NSDictionary* return_json = [RANetwork add_toCart:self.product_id count:count name:self.model_label.text];
-//
-//                                dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//
-//                                    if([[return_json valueForKey:@"result"] intValue]==2)
-//                                    {
-//
-//                                        //    NSString* order_code = [return_json valueForKey:@"order_code"];
-//
-//
-//#ifdef RA_NOTIFICATION
-//                                        [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                                        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-//                                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                                        [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//                                            if(self.shopCartBlock!=nil)
-//                                            {
-//                                                UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//
-//
-//                                                CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-//                                                UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                                                iv.image = img;
-//                                                //                        [self.contentView addSubview:iv];
-//                                                self.shopCartBlock(iv);
-//
-//                                                self.cqty +=count;
-//                                                if(self.set_cqty)
-//                                                    self.set_cqty(self.cqty);
-//
-//                                            }
-//
-//
-//                                    }
-//                                    else
-//                                    {
-//                                        UIViewController *vc= [RAUtils getViewController:self];
-//                                        NSString *msg = [return_json valueForKey:@"err_msg"];
-//                                        NSString *title = @"Add To Cart";
-//                                        if ([msg hasPrefix:@"Out of Stock.\n"]) {
-//                                            title = @"Add To Cart: Out of Stock";
-//                                            msg = [msg substringFromIndex:[@"Out of Stock.\n" length]];
-//                                            self.btnNotifyMe.enabled = YES;
-//                                            self.btnaddCart.enabled = NO;
-//                                        }
-//
-//                                        [RAUtils message_alert:msg title:title controller:vc] ;
-//                                    }
-//
-//
-//
-//
-//                                });
-//                            });
 
             }
             
             
-//            
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//                
-//                NSDictionary* return_json = [iSalesNetwork add_toCart:self.product_id count:count];
-//                
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    
-//                    
-//                    
-//                    if([[return_json valueForKey:@"result"] intValue]==2)
-//                    {
-//
-//                        //    NSString* order_code = [return_json valueForKey:@"order_code"];
-//                            AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-////                            appDelegate.order_code = order_code;
-////                            
-////                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                        appDelegate.order_code = order_code;
-//                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                        
-//                            
-//                            if(self.shopCartBlock!=nil)
-//                            {
-//                                UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//                                
-//                                
-//                                CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-//                                UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                                iv.image = img;
-//                                //                        [self.contentView addSubview:iv];
-//                                self.shopCartBlock(iv);
-//                                
-//                                self.cqty +=count;
-//                                if(self.set_cqty)
-//                                    self.set_cqty(self.cqty);
-//                                
-//                            }
-//                            
-//                        
-//                    }
-//                    else
-//                    {
-//                        UIViewController *vc= [RAUtils getViewController:self];
-//                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:vc] ;
-//                    }
-//                    
-//                    
-//                    
-//                    
-//                });
-//            });
-//            
-            
+
         }];
         
         UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
@@ -1307,79 +920,14 @@
                             self.btnaddCart.enabled = NO;
                         }
                         
-                        [RAUtils message_alert:msg title:title controller:vc] ;
+                        [RAUtils message_box:title message:msg completion:nil] ;
                     }
                     
                     
                     
                     
                 }];
-                
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* return_json = [RANetwork add_toCart:self.product_id count:count name:self.model_label.text];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//
-//                        if([[return_json valueForKey:@"result"] intValue]==2)
-//                        {
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                            [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                            //    NSString* order_code = [return_json valueForKey:@"order_code"];
-//                            AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-//                            //                            appDelegate.order_code = order_code;
-//                            //
-//                            //                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                            //                        appDelegate.order_code = order_code;
-//                            [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                            [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//                            if(self.shopCartBlock!=nil)
-//                            {
-//                                UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//
-//
-//                                CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-//                                UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                                iv.image = img;
-//                                //                        [self.contentView addSubview:iv];
-//                                self.shopCartBlock(iv);
-//
-//                                self.cqty +=count;
-//                                if(self.set_cqty)
-//                                    self.set_cqty(self.cqty);
-//
-//                            }
-//
-//
-//                        }
-//                        else
-//                        {
-//                            UIViewController *vc= [RAUtils getViewController:self];
-//                            NSString *msg = [return_json valueForKey:@"err_msg"];
-//                            NSString *title = @"Add To Cart";
-//                            if ([msg hasPrefix:@"Out of Stock.\n"]) {
-//                                title = @"Add To Cart: Out of Stock";
-//                                msg = [msg substringFromIndex:[@"Out of Stock.\n" length]];
-//                                self.btnNotifyMe.enabled = YES;
-//                                self.btnaddCart.enabled = NO;
-//                            }
-//
-//                            [RAUtils message_alert:msg title:title controller:vc] ;
-//                        }
-//
-//
-//
-//
-//                    });
-//                });
-                
+
                 
             }];
             
@@ -1451,131 +999,17 @@
                         self.btnaddCart.enabled = NO;
                     }
                     
-                    [RAUtils message_alert:msg title:title controller:vc] ;
+                    [RAUtils message_box:title message:msg completion:nil] ;
                 }
                 
                 
                 
                 
             }];
-            
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* return_json = [RANetwork add_toCart:self.product_id count:count name:model_name];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//
-//                    if([[return_json valueForKey:@"result"] intValue]==2)
-//                    {
-//
-//
-//#ifdef RA_NOTIFICATION
-//                        [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-//
-//                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                        [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//                        if(self.shopCartBlock!=nil)
-//                        {
-//                            UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//
-//
-//                            CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-//                            UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                            iv.image = img;
-//                            //                        [self.contentView addSubview:iv];
-//                            self.shopCartBlock(iv);
-//
-//                            self.cqty +=count;
-//                            if(self.set_cqty)
-//                                self.set_cqty(self.cqty);
-//
-//                        }
-//
-//
-//                    }
-//                    else
-//                    {
-//                        UIViewController *vc= [RAUtils getViewController:self];
-//
-//                        NSString *msg = [return_json valueForKey:@"err_msg"];
-//                        NSString *title = @"Add To Cart";
-//                        if ([msg hasPrefix:@"Out of Stock.\n"]) {
-//                            title = @"Add To Cart: Out of Stock";
-//                            msg = [msg substringFromIndex:[@"Out of Stock.\n" length]];
-//                            self.btnNotifyMe.enabled = YES;
-//                            self.btnaddCart.enabled = NO;
-//                        }
-//
-//                        [RAUtils message_alert:msg title:title controller:vc] ;
-//                    }
-//
-//
-//
-//
-//                });
-//            });
-            
+
         }
         
-        
-        //
-        //            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        //
-        //                NSDictionary* return_json = [iSalesNetwork add_toCart:self.product_id count:count];
-        //
-        //                dispatch_async(dispatch_get_main_queue(), ^{
-        //
-        //
-        //
-        //                    if([[return_json valueForKey:@"result"] intValue]==2)
-        //                    {
-        //
-        //                        //    NSString* order_code = [return_json valueForKey:@"order_code"];
-        //                            AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-        ////                            appDelegate.order_code = order_code;
-        ////
-        ////                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        ////                        appDelegate.order_code = order_code;
-        //                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-        //
-        //
-        //                            if(self.shopCartBlock!=nil)
-        //                            {
-        //                                UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-        //
-        //
-        //                                CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-        //                                UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-        //                                iv.image = img;
-        //                                //                        [self.contentView addSubview:iv];
-        //                                self.shopCartBlock(iv);
-        //
-        //                                self.cqty +=count;
-        //                                if(self.set_cqty)
-        //                                    self.set_cqty(self.cqty);
-        //
-        //                            }
-        //
-        //
-        //                    }
-        //                    else
-        //                    {
-        //                        UIViewController *vc= [RAUtils getViewController:self];
-        //                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:vc] ;
-        //                    }
-        //
-        //
-        //
-        //
-        //                });
-        //            });
-        //
-        
+
     }
     
 }
@@ -1748,11 +1182,14 @@
 -(void) neworder
 {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:[RAUtils getViewController:self] title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:[RAUtils getViewController:self] title:@"Create Order" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
             NSMutableDictionary* return_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 if([[return_json valueForKey:@"result"] intValue]==2)
                 {
                     int result=[[return_json valueForKey:@"result"] intValue];
@@ -1768,21 +1205,6 @@
                         [self addtocart:count];
                         
                         
-                        //    [self ReloadData];
-                        
-                        
-                        //                    if(self.shopCartBlock!=nil)
-                        //                    {
-                        //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-                        //
-                        //
-                        //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-                        //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-                        //                        iv.image = img;
-                        //                        //                        [self.contentView addSubview:iv];
-                        //                        self.shopCartBlock(iv);
-                        //
-                        //                    }
                         
                     }
                 }
@@ -1798,9 +1220,9 @@
                         self.btnaddCart.enabled = NO;
                     }
                     
-                    [RAUtils message_alert:msg title:title controller:vc] ;
+                    [RAUtils message_box:title message:msg completion:nil] ;
                 }
-            }];
+//            }];
             
             
             
@@ -1811,200 +1233,9 @@
             
         }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = [RANetwork new_Order];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//
-//                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-//                    appDelegate.order_code = order_code;
-//
-//                    int count=[self.quantity_text.text intValue];
-//                    [self addtocart:count];
-//
-//
-//                    //    [self ReloadData];
-//
-//
-//                    //                    if(self.shopCartBlock!=nil)
-//                    //                    {
-//                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//                    //
-//                    //
-//                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-//                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                    //                        iv.image = img;
-//                    //                        //                        [self.contentView addSubview:iv];
-//                    //                        self.shopCartBlock(iv);
-//                    //
-//                    //                    }
-//
-//                }
-//            }
-//            else
-//            {
-//                UIViewController *vc= [RAUtils getViewController:self];
-//                NSString *msg = [return_json valueForKey:@"err_msg"];
-//                NSString *title = @"Add To Cart";
-//                if ([msg hasPrefix:@"Out of Stock.\n"]) {
-//                    title = @"Add To Cart: Out of Stock";
-//                    msg = [msg substringFromIndex:[@"Out of Stock.\n" length]];
-//                    self.btnNotifyMe.enabled = YES;
-//                    self.btnaddCart.enabled = NO;
-//                }
-//
-//                [RAUtils message_alert:msg title:title controller:vc] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
-}
-//#pragma mark - UIAlertViewDelegate
-//// Called when a button is clicked. The view will be automatically dismissed after this call returns
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-//{
-//    UIApplication * app = [UIApplication sharedApplication];
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//    if(alertView.tag==1234)//库存小于0
-//    {
-//
-//        // availability warring;
-//
-//        int count=[self.quantity_text.text intValue];
-//        if(buttonIndex!=alertView.cancelButtonIndex)
-//        {
-//            if(appDelegate.order_code==nil)
-//            {
-//                [self neworder];
-//            }
-//            else
-//            {
-//                [self addtocart:count];
-//            }
-//        }
-//        return;
-//    }
-//    //   int count=[self.quantity_text.text intValue];
-//
-//    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//    if(buttonIndex==alertView.cancelButtonIndex)
-//    {
-//
-//
-//
-//    }
-//    else if(buttonIndex==1)
-//    {
-//        //open exist
-//        UIViewController *vc= [RAUtils getViewController:self];
-//        OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-//        ovc.showNavibar = true;
-//        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-//            if(appDelegate.order_code==nil)
-//            {
-//                [self neworder];
-//            }
-//            else
-//            {
-//                if(self.set_update_data)
-//                    self.set_update_data(true);
-//
-//                int model_count = [[order_detail valueForKey:@"model_count"] intValue];
-//                for(int i=0;i<model_count;i++)
-//                {
-//                    NSDictionary* item = [order_detail objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-//                    NSString* product_id = [item valueForKey:@"product_id"];
-//                    if([product_id isEqualToString:self.product_id])
-//                    {
-//                        self.cqty = [[item valueForKey:@"QTY"]intValue];
-//                        if(self.set_cqty)
-//                            self.set_cqty(self.cqty);
-//                        break;
-//                    }
-//
-//                }
-//                int count=[self.quantity_text.text intValue];
-//                [self addtocart:count];
-//                [main_vc checklogin:true];
-//
-//
-//            }
-//
-//        };
-//        ovc.init_style = OL_OPEN;
-//        ovc.onCancel = ^(){
-//
-//            [main_vc checklogin:true];
-//
-//        };
-//
-//        [vc.navigationController pushViewController:ovc animated:true];
-//    }
-//    else
-//    {
-//        //create new;
-//        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//        {
-//            UIViewController *vc= [RAUtils getViewController:self];
-//
-//
-//            ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//
-//            cvc.showNavibar = true;
-//            cvc.contact_type = @"Sales_Order_Customer";
-//            cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//
-//                appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                appDelegate.customerInfo = value;
-//
-//
-//                if(appDelegate.order_code==nil)
-//                    [self neworder];
-//
-//                [main_vc checklogin:true];
-//                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//
-//                //
-//                //                if(self.returnValue)
-//                //                    self.returnValue(value);
-//            };
-//
-//            cvc.onCancel = ^(){
-//
-//                UIViewController *vc= [RAUtils getViewController:self];
-//                [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"New Order" controller:vc];
-//
-//            };
-//            cvc.onReset = ^(){
-//                [main_vc checklogin:true];
-//            };
-//
-//            [vc.navigationController pushViewController:cvc animated:true];
-//        }
-//        else
-//        {
-//            [self neworder];
-//        }
-//
-//
-//    }
-//}
+//    }];
 
+}
 - (void)valueChanged:(UIStepper *)sender {
     
     

+ 35 - 376
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -262,13 +262,14 @@ dispatch_async(dispatch_get_main_queue(), ^{
             else if([[detail_json valueForKey:@"result"] intValue]==RESULT_NO_MODEL)
             {
                 self.detailTable.hidden = true;
-                [RAUtils message_alert:[detail_json valueForKey:@"err_msg"] title:@"Model Detail"/*@"Loading Model Detail Failed."*/ controller:self] ;
+                [RAUtils message_box:@"Model Detail" message:[detail_json valueForKey:@"err_msg"] completion:nil] ;
+                
                 if(self.ispush)
                     [ self.navigationController popViewControllerAnimated:true];
             }
             else
             {
-                [RAUtils message_alert:[detail_json valueForKey:@"err_msg"] title:@"Model Detail"/*@"Loading Model Detail Failed."*/ controller:self] ;
+                [RAUtils message_box:@"Model Detail" message:[detail_json valueForKey:@"err_msg"] completion:nil] ;
             }
         
         self.isrefreshing=false;
@@ -278,153 +279,6 @@ dispatch_async(dispatch_get_main_queue(), ^{
     
     return;
     
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//        
-//        NSMutableDictionary* detail_json = [[RANetwork request_ItemDetail:self.product_id model_name:self.model_name category_id:self.category_id use_name:self.use_model_name groupName:self.groupName] mutableCopy];
-//        
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [self.mum stopAnimating];
-//#ifdef BUILD_UWAVER
-//            self.navigationItem.rightBarButtonItem.enabled = true;
-//#endif
-//            self.groupName = nil;
-//            if([[detail_json valueForKey:@"result"] intValue]==2)
-//            {
-//                
-//                self.detail_data = [detail_json mutableCopy];
-//                self.product_id = [NSString stringWithFormat:@"%d",[[detail_json valueForKey:@"product_id"] intValue] ];
-//                NSMutableDictionary* imgsection = [[detail_json objectForKey:@"img_section"] mutableCopy];
-//                //          AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                if(/*appDelegate.user_type==USER_ROLE_CUSTOMER*/true)
-//                    self.quantity =[[imgsection valueForKey:@"stockUom"] intValue];
-//                else
-//                    self.quantity =1;
-//                
-//                if(self.quantity==0)
-//                    self.quantity=1;
-//                self.step=self.quantity;
-//                [self.detailTable reloadData];
-//                
-//                //
-//                self.detailTable.hidden = false;
-//                
-//                NSString* model_name = self.detail_data[@"img_section"][@"model_name"];
-//                
-//                 NSString* img_url = self.detail_data[@"img_section"][@"model_s_img"];
-//                
-//                NSMutableDictionary* images=[self.detail_data[@"img_section"][@"images"] mutableCopy];
-//                NSMutableDictionary* videos=[self.detail_data[@"img_section"][@"videos"] mutableCopy];
-//                
-//                NSMutableDictionary* contents = [NSMutableDictionary new];
-//                int count = 0;
-//                
-//                {
-//                    for(int ic=0;ic<[videos[@"count"] intValue];ic++)
-//                    {
-//                        NSString* videocode = videos[[NSString stringWithFormat:@"video_%d",ic]];
-//                        
-//                        
-//                        //                         NSString*   path=[[NSBundle mainBundle] pathForResource:@"play" ofType:@"jpg"];
-//                        //
-//                        //                        NSMutableDictionary* item =[@{@"type":@"video",@"is_localfile":@(true),@"l":path,@"s":path} mutableCopy];
-//                        //
-//                        //                        contents[[NSString stringWithFormat:@"item_%d",count]]=item ;
-//                        //                        count++;
-//                        
-//                        NSMutableDictionary* item =[@{@"type":@"video",@"code":videocode} mutableCopy];
-//                        
-//                        contents[[NSString stringWithFormat:@"item_%d",count]]=item;
-//                        count++;
-//                    }
-//                }
-//                
-//                {
-//                    for(int ic=0;ic<[images[@"img_count"] intValue];ic++)
-//                    {
-//                        NSMutableDictionary* item = [images[[NSString stringWithFormat:@"img_%d",ic]] mutableCopy];
-//                        item[@"type"]=@"image";
-//                        contents[[NSString stringWithFormat:@"item_%d",count]]=item;
-//                        count++;
-//                    }
-////#ifndef BUILD_HOMER
-//#if !defined(BUILD_HOMER) && !defined(BUILD_GATIT)
-//                    // homer 要求去掉qrcode 2017/12/20
-//                    NSString* qrpath = [ImageUtils generateQRCodeFile:model_name width:350 height:350];
-////                    UIImage* qrimg=[QRCodeGenerator qrImageForString:model_name imageSize:350];
-//                    if(qrpath!=nil)
-//                    {
-//                        NSMutableDictionary* item =[@{@"type":@"image",@"is_localfile":@(true),@"l":qrpath,@"s":qrpath} mutableCopy];
-//                        
-//                        contents[[NSString stringWithFormat:@"item_%d",count]]=item ;
-//                        count++;
-//                    }
-//#endif
-//                }
-//                
-//
-//                
-//                
-//                contents[@"count"]=@(count);
-//                imgsection[@"stack_contents"]=contents;
-//                self.detail_data[@"img_section"]=imgsection;
-////                self.detail_data[@"img_section"][@"stack_contents"]=contents;
-//                
-//                NSMutableDictionary* item = [[NSMutableDictionary alloc]init];
-//                [item setValue:self.product_id forKey:@"product_id"];
-//                [item setValue:self.category_id forKey:@"category"];
-//                [item setValue:model_name forKey:@"fash_name"];
-//                [item setValue:img_url forKey:@"picture_path"];
-//                
-//                [CartUtils add_recent_model:item];
-//                
-//                NSUInteger ii[2] = {0,0};
-//                
-//                [self.detailTable  scrollToRowAtIndexPath:[NSIndexPath indexPathWithIndexes:ii length:2] atScrollPosition:UITableViewScrollPositionTop animated:YES];
-//                
-//                
-////                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                int count=[appDelegate.recent_model[@"count"] intValue];
-////                bool bexist = false;
-////                for(int i=0;i<count;i++)
-////                {
-////                    NSMutableDictionary * mitem= appDelegate.recent_model[[NSString stringWithFormat:@"item_%d",i]];
-////                    if([mitem[@"product_id"] isEqualToString:self.product_id])
-////                    {
-////                        bexist=true;
-////                        break;
-////                    }
-////                }
-////                
-////                if(!bexist)
-////                {
-////                [appDelegate.recent_model setObject:item forKey:[NSString stringWithFormat:@"item_%d",count]];
-////                appDelegate.recent_model[@"count"]=[NSString stringWithFormat:@"%d",count+1];
-////                }
-//                
-//                self.groupName = [detail_json objectForKey:@"groupName"];
-//            }
-//            else
-//                if([[detail_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-//                {
-//                    self.detailTable.hidden = true;
-//                    self.label_net_err.hidden=false;
-//                }
-//            else if([[detail_json valueForKey:@"result"] intValue]==RESULT_NO_MODEL)
-//            {
-//                self.detailTable.hidden = true;
-//                                [RAUtils message_alert:[detail_json valueForKey:@"err_msg"] title:@"Model Detail"/*@"Loading Model Detail Failed."*/ controller:self] ;
-//                if(self.ispush)
-//                  [ self.navigationController popViewControllerAnimated:true];
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[detail_json valueForKey:@"err_msg"] title:@"Model Detail"/*@"Loading Model Detail Failed."*/ controller:self] ;
-//            }
-//            
-//self.isrefreshing=false;
-//            
-//        });
-//    });
         });
 }
 - (void)onBackClick:(UIButton *)sender {
@@ -656,11 +510,14 @@ dispatch_async(dispatch_get_main_queue(), ^{
     
     NSString *catelog_name = [NSString stringWithFormat:@"%@ Hang Tag",vc.groupName];
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Processing" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Processing" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Processing" completion:nil];
         [RANetwork request_hangtag:vc.groupName completionHandler:^(NSMutableDictionary *result) {
             NSMutableDictionary* editor_json =result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 if([[editor_json valueForKey:@"result"] intValue]==2)
                 {
                     
@@ -703,9 +560,11 @@ dispatch_async(dispatch_get_main_queue(), ^{
                 }
                 else
                 {
-                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Hang Tag" controller:vc];
+                    
+                    
+                    [RAUtils message_box:@"Create Hang Tag" message:[editor_json valueForKey:@"err_msg"]  completion:nil];
                 }
-            }];
+//            }];
                 
                 
                 
@@ -713,65 +572,10 @@ dispatch_async(dispatch_get_main_queue(), ^{
             
         }];
 
-    }];
+//    }];
     
         return;
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* editor_json = [RANetwork request_hangTag:vc.groupName];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                NSString* url = [editor_json valueForKey:@"pdf_path"];
-//                bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
-//                RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
-//                ViewController.url = url;
-//                ViewController.canSave = false;
-//                ViewController.isLocalfile=isLocalFile;
-//
-//                ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
-//
-//
-//                NSString* company=    [appDelegate.customerInfo valueForKey:@"customer_name"];
-//
-//                if(company==nil)
-//                company=@"";
-//
-//                NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
-//
-//
-//                NSMutableArray* send_to = [[NSMutableArray alloc]init];
-//                if(customer_email.length>0)
-//                {
-//                    send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
-//                }
-//                ViewController.mail_to = send_to;
-//
-//                NSString* subject;
-//
-//                subject =catelog_name;
-//
-//                ViewController.mail_subject = subject;
-//
-//                ViewController.hidenavi = false;
-//                [vc.navigationController pushViewController:ViewController animated:YES];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Hang Tag" controller:vc];
-//            }
-//
-//        });
-//    });
-    
+ 
 }
 
 #pragma mark - Selector delegate
@@ -1410,12 +1214,14 @@ dispatch_async(dispatch_get_main_queue(), ^{
             __weak typeof(self) weakself = self;
             cell.notifyMeBlock = ^{
                 
-                __block UIAlertController *waitting_alert = [RAUtils waiting_alert:self title:@"Sending Email" completion:^{
+//                __block UIAlertController *waitting_alert = [RAUtils waiting_alert:self title:@"Sending Email" completion:^{
+                PopWaitAlert* pop = [RAUtils waiting_pop:@"Sending Email" completion:nil];
                     [RANetwork request_notifymodel:self.product_id emailAddr:nil withScreen:ScreenCodeModelInfo completionHandler:^(NSMutableDictionary *result) {
                                         NSMutableDictionary *dic =result;
                                         
                                         
-                                        [waitting_alert dismissViewControllerAnimated:YES completion:^{
+//                                        [waitting_alert dismissViewControllerAnimated:YES completion:^{
+                        [pop hide];
                                             int result_code = [[dic valueForKey:@"result"] intValue];
                                             
                                             if (result_code != RESULT_TRUE && result_code != RESULT_NO_EMAIL_ADDRESS) {
@@ -1437,63 +1243,23 @@ dispatch_async(dispatch_get_main_queue(), ^{
                                                 
                                             } else if (result_code == RESULT_TRUE){
                                                 
-                                                [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
+                                                [RAUtils message_box:@"Message" message:@"Notification is sent to default email address." completion:nil];
                                                 
                                             } else if (result_code == RESULT_NO_EMAIL_ADDRESS) {
                                                 
                                                 [self showEmailAddrBox];
                                                 
                                             }
-                                        }];
+//                                        }];
                     //                    [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
                                         
                                        
                                         
                                     }];
 
-                }];
+//                }];
                 
                                 
-                //                dispatch_async(dispatch_get_global_queue(0,0), ^{
-                //
-                //                    NSDictionary *dic = [RANetwork notifyModel:self.product_id emailAddr:nil withScreen:ScreenCodeModelInfo];
-                //
-                //                    dispatch_async(dispatch_get_main_queue(), ^{
-                //
-                //                        [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
-                //
-                //                        NSInteger result = [[dic valueForKey:@"result"] integerValue];
-                //
-                //                        if (result != RESULT_TRUE && result != RESULT_NO_EMAIL_ADDRESS) {
-                //
-                //                            NSString *msg = [NSString stringWithFormat:@"The email send failed"];
-                //
-                //                            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 if (result == RESULT_TRUE){
-                //
-                //                            [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
-                //
-                //                        } else if (result == RESULT_NO_EMAIL_ADDRESS) {
-                //
-                //                            [self showEmailAddrBox];
-                //
-                //                        }
-                //                    });
-                //
-                //
-                //                });
                 
                 
             };
@@ -1637,7 +1403,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
                         
                     } else if (result == RESULT_TRUE){
                         
-                        [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
+                        [RAUtils message_box:@"Message" message:@"Notification is sent to default email address." completion:nil];
                         
                     } else if (result == RESULT_NO_EMAIL_ADDRESS) {
                         
@@ -1650,47 +1416,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
                 }];
                 
                 
-//                dispatch_async(dispatch_get_global_queue(0,0), ^{
-//
-//                    NSDictionary *dic = [RANetwork notifyModel:self.product_id emailAddr:nil withScreen:ScreenCodeModelInfo];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                        [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
-//
-//                        NSInteger result = [[dic valueForKey:@"result"] integerValue];
-//
-//                        if (result != RESULT_TRUE && result != RESULT_NO_EMAIL_ADDRESS) {
-//
-//                            NSString *msg = [NSString stringWithFormat:@"The email send failed"];
-//
-//                            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 if (result == RESULT_TRUE){
-//
-//                            [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
-//
-//                        } else if (result == RESULT_NO_EMAIL_ADDRESS) {
-//
-//                            [self showEmailAddrBox];
-//
-//                        }
-//                    });
-//
-//
-//                });
-                
+
                 
             };
             
@@ -2625,49 +2351,16 @@ dispatch_async(dispatch_get_main_queue(), ^{
                 }
                 else
                 {
-                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:self] ;
+                    
+                    [RAUtils message_box:nil message:[editor_json valueForKey:@"err_msg"]  completion:nil];
                 }
                 
                 
             }];
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* editor_json = [RANetwork commoneditor_partialrefresh:params url:url];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [cell end_refresh ];
-////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//             sender.enabled=true;
-//
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//                [self.detail_data addEntriesFromDictionary:editor_json];
-//
-//                    NSRange range = NSMakeRange(sender.tag, 1);
-//                    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
-//                    [self.detailTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:self] ;
-//            }
-//
-//
-//        });
-//    });
 
     
     
     
-//    self.showMore=!self.showMore;
-//    NSRange range = NSMakeRange(1, 1);
-//    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
-//    [self.detailTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
-    
-    
-    
 }
 #pragma mark - Support scanner
 -(void) onDecodedData:(NSString*) value
@@ -2734,12 +2427,15 @@ dispatch_async(dispatch_get_main_queue(), ^{
             // 验证是邮件地址,发送邮件
             [weakVC dismissViewControllerAnimated:YES completion:^{
                 
-                __block UIAlertController *waitting_alert = [RAUtils waiting_alert:self title:@"Sending Email" completion:^{
+//                __block UIAlertController *waitting_alert = [RAUtils waiting_alert:self title:@"Sending Email" completion:^{
+                
+                PopWaitAlert* pop = [RAUtils waiting_pop:@"Sending Email" completion:nil];
                     [RANetwork request_notifymodel:weakself.product_id emailAddr:text withScreen:ScreenCodeModelInfo completionHandler:^(NSMutableDictionary *result) {
                                         DebugLog(@"email cart result: %@",result);
                                         
                                         
-                                        [waitting_alert dismissViewControllerAnimated:YES completion:^{
+//                                        [waitting_alert dismissViewControllerAnimated:YES completion:^{
+                        [pop hide];
                                             int resultStatus = [[result objectForKey:@"result"] intValue];
                                             if (resultStatus != RESULT_TRUE && resultStatus != RESULT_NO_EMAIL_ADDRESS) {
                                                 
@@ -2759,14 +2455,14 @@ dispatch_async(dispatch_get_main_queue(), ^{
                                                 
                                             }else if(resultStatus == RESULT_TRUE){
                                                 
-                                                [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
+                                                [RAUtils message_box:@"Message" message:@"Notification is sent to default email address." completion:nil];
                                                 
                                             } else if (resultStatus == RESULT_NO_EMAIL_ADDRESS) {
                                                 
                                                 [weakself showEmailAddrBox];
                                                 
                                             }
-                                        }];
+//                                        }];
                     //                    [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
                                         
                                         
@@ -2774,46 +2470,8 @@ dispatch_async(dispatch_get_main_queue(), ^{
                                         
                                     }];
 
-                }];
+//                }];
                                 
-//                dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//
-//                    NSDictionary *result = [RANetwork notifyModel:weakself.product_id emailAddr:text withScreen:ScreenCodeModelInfo];
-//                    DebugLog(@"email cart result: %@",result);
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                        [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
-//
-//                        int resultStatus = [[result objectForKey:@"result"] intValue];
-//                        if (resultStatus != RESULT_TRUE && resultStatus != RESULT_NO_EMAIL_ADDRESS) {
-//
-//                            NSString *msg = [NSString stringWithFormat:@"The email send failed"];
-//                            if ([result valueForKey:@"err_msg"]) {
-//                                    msg = [result 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 if(resultStatus == RESULT_TRUE){
-//
-//                             [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
-//
-//                        } else if (resultStatus == RESULT_NO_EMAIL_ADDRESS) {
-//
-//                            [weakself showEmailAddrBox];
-//
-//                        }
-//
-//                    });
-//
-//                });
                 
             }];
             
@@ -2832,7 +2490,8 @@ dispatch_async(dispatch_get_main_queue(), ^{
 - (void)showIntroducePDF:(NSString *)link {
     
     if (link.length == 0) {
-        [RAUtils message_alert:@"There is no resource to open" title:@"Warning" controller:self];
+        
+        [RAUtils message_box:@"Warning" message:@"There is no resource to open"  completion:nil];
         return;
     }
     

+ 1 - 193
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -1728,192 +1728,6 @@
     return ret;
 }
 
-//+(void) uploadFile:(NSString*) file
-//{
-//    NSData* data = [NSData dataWithContentsOfFile: file];
-//    UIApplication * app = [UIApplication sharedApplication];
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//
-//    
-//    AFHTTPRequestSerializer* serializer=[AFHTTPRequestSerializer serializer] ;
-//    
-//    
-//    
-//    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
-//    
-//    if(appDelegate.user!=nil)
-//        [params setValue:appDelegate.user forKey:@"user"];
-//    //    if(appDelegate.contact_id!=nil)
-//    //        [params setValue:appDelegate.contact_id forKey:@"contactId"];
-//    if(appDelegate.password!=nil)
-//        [params setValue:appDelegate.password forKey:@"password"];
-//    
-//    
-//    NSMutableURLRequest *request = [serializer multipartFormRequestWithMethod:@"POST" URLString:URL_UPLOAD_OFFLINE parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
-//        [formData appendPartWithFileData:data name:@"upfile" fileName:[file lastPathComponent] mimeType:@"application/zip"];
-//    } error:nil];
-//    
-//    
-//
-//    AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
-//    
-//    NSProgress *progress = nil;
-//    
-//    NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithStreamedRequest:request progress:&progress completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
-//        
-//        
-//        
-//        if (error) {
-//            
-//            NSString* err_msg = [error localizedDescription];
-//            DebugLog(@"%@",err_msg);// [self.view updateWithMessage:[NSString stringWithFormat:@"Error : %@!", error.debugDescription]];
-//            
-//            
-//            NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-//            
-//            DebugLog(@"data string: %@",str);
-//            [RAUtils message_alert:@"Can not connect to server please try again." title:@"Upload Image" controller:self] ;
-//            
-//        } else {
-//            DebugLog(@"response ");
-//            
-//            
-//            
-//            NSData *data = [NSJSONSerialization dataWithJSONObject:(NSDictionary*)responseObject options:kNilOptions error:nil];
-//            
-//            // 再将NSData转为字符串
-//            NSString *jsonStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-//            
-//            //            NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-//            
-//            DebugLog(@"data string: %@",jsonStr);
-//            
-//            NSDictionary* json = responseObject;
-//            
-//            
-//            if([[json valueForKey:@"result"] intValue]==2)
-//            {
-////                NSString* img_url_down = json[@"img_url_aname"];
-////                NSString* img_url_up = json[@"img_url"];
-//                
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload file" controller:nil] ;
-//            }
-//            
-//            
-//        }
-//        //  [waitalert dismissViewControllerAnimated:YES completion:nil];
-//    }];
-//    
-//    
-//    
-//    
-//  //  [self.uploadProgress setProgressWithUploadProgressOfTask:uploadTask animated:true];
-//    //
-//    
-//    
-//    
-//    
-//    
-//    
-//    [uploadTask resume];
-//    
-//}
-
-//+(void) saveScanOrder:(NSMutableDictionary*) ordercontent
-//{
-//    
-//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    NSString *documents = [paths objectAtIndex:0];
-//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//        
-//        
-//    NSString *orderdir = [documents stringByAppendingPathComponent:appDelegate.order_code];
-//    
-//    NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
-//    
-//    
-//    
-//    [RAUtils dicttofile:orderPath dict:ordercontent];
-//    
-//    
-//
-//    
-//    
-//    NSString *contactpath = [orderdir stringByAppendingPathComponent:@"contact.json"];
-//    
-//    
-//    
-//    [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
-//    
-//    
-//    NSString *cartpath = [orderdir stringByAppendingPathComponent:@"cart.json"];
-//    
-//    
-//    
-//    [RAUtils dicttofile:cartpath dict:RASingleton.sharedInstance.scan_cart];
-//    
-//    
-//    
-//    
-//    NSMutableDictionary* orderlist = nil;
-//        NSString *orderlistPath = [documents stringByAppendingPathComponent:@"orderlist.json"];
-//    
-//    
-//            if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
-// 
-//                
-//                orderlist = [NSMutableDictionary new];
-//                
-////                    [orderlist addObject:appDelegate.order_code];
-////                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-//                
-//          }
-//            else
-//            {
-//                orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
-//                
-////                    [orderlist insertObject:appDelegate.order_code atIndex:0];
-// 
-////                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-//            }
-//    
-//    NSMutableDictionary* orderitem = [NSMutableDictionary new];
-//    orderitem[@"create_by"] = appDelegate.user;
-//    orderitem[@"price"] = upparams[@"total_price"];
-//    orderitem[@"customer_name"] = upparams[@"customer_contact"];
-//    orderitem[@"purchase_time"] = [RAUtils current_date_time];
-//    orderitem[@"order_status"] = @"Saved Order";
-//    orderitem[@"order_code"] = appDelegate.order_code;
-//    orderitem[@"model_count"] =[ NSString stringWithFormat:@"%@",RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] ];
-//    
-//    
-//    int count = [orderlist[@"count"] intValue];
-//    
-//    NSMutableDictionary* newlist  = [NSMutableDictionary new];
-//    
-//    newlist[@"item_0"]=orderitem;
-//    int newcount = 1;
-//    for(int i=0;i<count;i++)
-//    {
-//        NSMutableDictionary* item = orderlist[[NSString stringWithFormat:@"item_%d",i]];
-//        if([item[@"order_code"] isEqualToString: appDelegate.order_code ])
-//            continue;
-//        else
-//        {
-//            newlist[[NSString stringWithFormat:@"item_%d",newcount]] = item;
-//            newcount++;
-//        }
-//    }
-//    newlist[@"count"] = @(newcount);
-//    [RAUtils dicttofile:orderlistPath dict:newlist];
-//    
-//    return;
-//}
-
 +(void) saveScanSubmitList:(NSMutableDictionary*) submitlist
 {
     
@@ -2386,13 +2200,7 @@
 {
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
-//    if(appDelegate.user.length<=0)
-//    {
-//        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
-//        return;
-//    }
-    
-//    if(appDelegate.order_code.length>0)
+
     {
         //        当前订单先关闭
         //        [OLDataProvider deleteScanOrder:appDelegate.order_code];

+ 26 - 248
RedAnt ERP Mobile/common/Functions/offline/OfflineSettingViewController.m

@@ -74,58 +74,6 @@
         
         
         
-        
-//        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure remove all models from cart?" message:nil preferredStyle:UIAlertControllerStyleAlert];
-//        //block代码块取代了delegate
-//        
-//        
-//        
-//        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-//            UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Remove Models From Cart"];
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//                
-//                NSDictionary* cart_json = [iSalesNetwork cart_remove:ids];
-//                
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    
-//                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                    
-//                    if([[cart_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        
-//                        [self end_edit];
-//                        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-//                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
-//                        [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
-//                    }
-//                    else
-//                    {
-//                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
-//                    }
-//                    
-//                    
-//                    
-//                });
-//            });
-//            
-//            
-//        }];
-//        
-//        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-//            DebugLog(@"No");
-//        }];
-//        [alertControl addAction:actionOne];
-//        
-//        [alertControl addAction:alertthree];
-//        
-//        //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-//        
-//        
-//        [self presentViewController:alertControl animated:YES completion:nil];
-//        
-//        DebugLog(@"%@",self.edit_select_arr);
-//        
-//        
     }];
  
     
@@ -286,7 +234,9 @@
             }
             else
             {
-                [RAUtils message_alert:@"Must login" title:@"Data sync" controller:self];
+
+                
+                [RAUtils message_box:@"Data sync" message:@"Must login" completion:nil];
 //                [RAUtils alert_view:@"Must login" title:@"Data sync"];
             }
             
@@ -337,8 +287,9 @@
             if(!self.bunlock)
             {
                 
-                [RAUtils message_alert:@"Current login account is different from the offline account, to continue with sync, all current offline data will be erased, you must unlock offline lock first. "  title:@"Sync denied." controller:self];
-//            [RAUtils alert_view:@"Current login account is different from the offline account, to continue with sync, all current offline data will be erased, you must unlock offline lock first. " title:@"Sync denied."];
+
+                [RAUtils message_box:@"Sync denied." message:@"Current login account is different from the offline account, to continue with sync, all current offline data will be erased, you must unlock offline lock first. " completion:nil];
+                
             return;
             }
             else
@@ -355,26 +306,7 @@
         if(sender==nil)
         {
             [appDelegate check_offline:ver useInternalAddress:self.switch_internal_address.isOn parentvc:self];
-//            SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
-//            syncVC.action_string=@"Download";
-//            UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;
-//            
-//            
-//            
-//            
-//            
-//            //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
-//            
-//            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-//            [self presentViewController:navi animated:YES completion:^{
-//                
-//                //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-//                
-//                DebugLog(@"about present.........");
-//                
-//                //   self.btop = false;
-//                //  <#code#>
-//            }];
+
         }
         else
         {
@@ -451,11 +383,15 @@
         
         if(appDelegate.bLogin)
         {
-            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+//            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+            
+            PopWaitAlert* pop = [RAUtils waiting_pop:@"Sign out" completion:nil];
                 [RANetwork request_logout:^(NSMutableDictionary *result) {
                                 NSMutableDictionary* return_json=result ;
                                 
-                                [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
+                    
+//                                [waitalert dismissViewControllerAnimated:YES completion:^{
                                     if([[return_json valueForKey:@"result"] intValue]==2)
                                     {
                                         
@@ -497,9 +433,9 @@
                                     }
                                     else
                                     {
-                                        // [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
+                                        // [RAUtils message_box:@"Sign Out" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                                     }
-                                }];
+//                                }];
                                 
                                 
                                 
@@ -510,65 +446,10 @@
                                 
                             }];
 
-            }];
+//            }];
             
                         
             
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* return_json = [RANetwork logout];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//                    if([[return_json valueForKey:@"result"] intValue]==2)
-//                    {
-//
-//                        [appDelegate Logout];
-//                        NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-//                        [defaults removeObjectForKey:@"EnableOfflineMode"];
-//                        [defaults setBool:self.switch_offline.isOn forKey:@"EnableOfflineMode"];
-//
-//                        [defaults synchronize];
-//#ifdef OFFLINE_MODE
-//                        appDelegate.offline_mode =self.switch_offline.isOn;
-//#endif
-//
-//#ifdef RA_NOTIFICATION
-//
-//                        [ActiveViewController Notify:@"PortfolioViewController,WatchListViewController,CategoryViewController,PDFListViewController,CartViewController,OrderListViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                        [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
-//                        [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//
-//                        [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
-//                        [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
-//                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//
-////                        [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
-//
-//                        [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//                        [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
-////                        [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
-//
-//
-//#endif
-//
-//
-//
-//                        [((MainViewController*)appDelegate.main_vc) switchToHome];
-//                    }
-//                    else
-//                    {
-//                       // [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
-//                    }
-//
-//
-//
-//
-//                });
-//            });
         }
         else
         {
@@ -611,11 +492,14 @@
             // have offline data
             if(appDelegate.bLogin)
             {
-                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+//                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+                
+                PopWaitAlert* pop = [RAUtils waiting_pop:@"Sign out" completion:nil];
                     [RANetwork request_logout:^(NSMutableDictionary *result) {
                                         NSMutableDictionary* return_json = result;
                                         
-                                        [waitalert dismissViewControllerAnimated:YES completion:^{
+                        [pop hide];
+//                                        [waitalert dismissViewControllerAnimated:YES completion:^{
                                             if([[return_json valueForKey:@"result"] intValue]==2)
                                             {
                                                 
@@ -653,9 +537,9 @@
                                             }
                                             else
                                             {
-                                                // [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
+                                                // [RAUtils message_box:@"Sign Out" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                                             }
-                                        }];
+//                                        }];
                                         
                                         
                                         
@@ -666,59 +550,8 @@
                                         
                                     }];
 
-                }];
+//                }];
                                 
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* return_json = [RANetwork logout];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//                        if([[return_json valueForKey:@"result"] intValue]==2)
-//                        {
-//
-//                            [appDelegate Logout];
-//
-//                            NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-//                            [defaults removeObjectForKey:@"EnableOfflineMode"];
-//                            [defaults setBool:self.switch_offline.isOn forKey:@"EnableOfflineMode"];
-//
-//                            [defaults synchronize];
-//#ifdef OFFLINE_MODE
-//                            appDelegate.offline_mode =self.switch_offline.isOn;
-//#endif
-//
-//#ifdef RA_NOTIFICATION
-//                            [ActiveViewController Notify:@"PortfolioViewController,WatchListViewController,CategoryViewController,PDFListViewController,CartViewController,OrderListViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                            [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
-//                            [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
-//                            [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
-//                            [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                            [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-////                            [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
-//                            [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//                            [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
-////                            [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
-//#endif
-//
-//
-//
-//
-//                            [((MainViewController*)appDelegate.main_vc) switchToHome];
-//                        }
-//                        else
-//                        {
-//                            // [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
-//                        }
-//
-//
-//
-//
-//                    });
-//                });
             }
         }
         else
@@ -740,7 +573,7 @@
             
             UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                 //                [self.switch_offline setOn:false];
-                //[RAUtils message_alert:@"No item in the cart" title:@"Offline" controller:self] ;
+                
             }];
             
             [alertControl addAction:actionTwo];
@@ -751,62 +584,7 @@
             
             [self presentViewController:alertControl animated:YES completion:nil];
         }
-        
-        //
-        //        UIApplication * app = [UIApplication sharedApplication];
-        //        AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-        //
-        //        NSString*  ver = [defaults stringForKey:@"OfflineVer"] ;
-        //        //
-        //        //        [appDelegate check_offline:ver];
-        //        //        return;
-        //
-        //        //        if(ver.length==0)
-        //        {
-        //
-        //            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Check offline update?" message:nil preferredStyle:UIAlertControllerStyleAlert];
-        //            //block代码块取代了delegate
-        //
-        //
-        //            UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-        //                //   UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Checking offline data"];
-        //                //init offline mode
-        //                //                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        //                //
-        //                //
-        //                //                  //  [self check_offline];
-        //                //                });
-        //                [appDelegate check_offline:ver];
-        //
-        //
-        //
-        //            }];
-        //
-        //            UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-        //                //                [self.switch_offline setOn:false];
-        //                //[RAUtils message_alert:@"No item in the cart" title:@"Offline" controller:self] ;
-        //            }];
-        //
-        //            [alertControl addAction:actionTwo];
-        //            [alertControl addAction:alertthree];
-        //
-        //            //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-        //
-        //
-        //            [self presentViewController:alertControl animated:YES completion:nil];
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //        }
-        //        else
-        //        {
-        //
-        //        }
+
     }
 }
 

+ 6 - 9
RedAnt ERP Mobile/common/Functions/offline/OfflineUnlockViewController.m

@@ -37,14 +37,8 @@
     
     if(user.length==0||password.length==0)
     {
-        //        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Error!" message:@"user or password can not be empty." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];
-        //        //        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
-        //
-        //
-        //        //[[UILabel appearanceWhenContainedIn:UIAlertView.class, nil] setAppearanceFont:[UIFont boldSystemFontOfSize:10]];
-        //        [alert show];
-        
-        [RAUtils message_alert:@"Username or Password cannot be blank." title:@"Unlock offline" controller:self];
+
+        [RAUtils message_box:@"Unlock offline" message:@"Username or Password cannot be blank." completion:nil];
 //        [RAUtils alert_view:@"Username or Password cannot be blank." title:@"Unlock offline"];
         return;
     }
@@ -63,7 +57,10 @@
         }];
     else
     {
-        [RAUtils message_alert:MSG_USERAUTH_ERROR title:@"Unlock offline" controller:self];
+
+        
+        
+        [RAUtils message_box:@"Unlock offline" message:MSG_USERAUTH_ERROR completion:nil];
         //        [RAUtils alert_view:MSG_USERAUTH_ERROR title:@"Unlock offline"];
     }
 

+ 23 - 32
RedAnt ERP Mobile/common/Functions/offline/SelectUploadOrderViewController.m

@@ -120,7 +120,9 @@
     // merge order,一个订单也可以合并(合并订单也就是将shop order转为sales order)
 
     if (self.mergeList.count < 1) {
-        [RAUtils message_alert:@"Please add some order" title:@"Warning" controller:self];
+
+        
+        [RAUtils message_box:@"Warning" message:@"Please add some order" completion:nil];
         return;
     }
     
@@ -163,11 +165,15 @@
                 
                 [alertVC dismissViewControllerAnimated:YES completion:^{
                     // 关闭订单
-                    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order" completion:^{
+//                    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order" completion:^{
+                    
+                    PopWaitAlert* pop=[RAUtils waiting_pop:@"Release Order" completion:nil];
                         [RANetwork request_release_order:order_code withScreen:ScreenCodeOfflineSetting completionHandler:^(NSMutableDictionary *result) {
                             NSDictionary* order_json =result;
                             
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            
+                            [pop hide];
                                 //                    [waitalert dismissViewControllerAnimated:YES completion:nil];
                                 if([[order_json valueForKey:@"result"] intValue]==2)
                                 {
@@ -181,38 +187,19 @@
                                 } else {
                                     // 释放失败
                                     closeOrder = NO;
-                                    [RAUtils message_alert:@"Release Order Failed!" title:@"Warning" controller:weakself];
+
+                                    
+                                    [RAUtils message_box:@"Warning" message:@"Release Order Failed!" completion:nil];
                                 }
-                            }];
+//                            }];
                             
                         }];
 
-                    }];
+//                    }];
                     
                                     }];
                
-                
-//                NSDictionary* order_json = [RANetwork release_Order:order_code withScreen:ScreenCodeOfflineSetting];
-                
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-////                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                    if([[order_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                        [appDelegate closeOrder];
-//                        closeOrder = YES;
-//
-//                        [weakself uploadButtonClicked:weakself.uploadButton];
-//
-//                    } else {
-//                        // 释放失败
-//                        closeOrder = NO;
-//                        [RAUtils message_alert:@"Release Order Failed!" title:@"Warning" controller:weakself];
-//                    }
-//                });
+
             }];
             
             [alertVC addAction:cancelAction];
@@ -232,11 +219,15 @@
         [params setObject:checked_id forKey:@"targetOrderId"];
         [params setObject:[RASingleton sharedInstance].customerInfo forKey:@"customerInfo"];
         
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Merge Order" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Merge Order" completion:^{
+        
+        PopWaitAlert* pop=[RAUtils waiting_pop:@"Merge Order" completion:nil];
             [RANetwork request_mergeorder:params completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary *ret = result;
                 //            [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     [self.navigationController dismissViewControllerAnimated:YES completion:^{
                         
                         if (weakself.mergeBlock) {
@@ -245,11 +236,11 @@
                         
                     }];
                     
-                }];
+//                }];
                 
             }];
 
-        }];
+//        }];
         
         
                 

+ 3 - 12
RedAnt ERP Mobile/common/Functions/offline/SyncControlPanelViewController.m

@@ -67,23 +67,14 @@
     
     if(appDelegate.downloadlog.length==0)
     {
-        [RAUtils message_alert:@"Log is empty sending canceled." title:@"Sending log" controller:self] ;
+
+        [RAUtils message_box:@"Sending log" message:@"Log is empty sending canceled." completion:nil];
         return;
     }
     
     
     
-    //  NSString *path = NSTemporaryDirectory();
-    
-    //    CFUUIDRef uuidObject = CFUUIDCreate(kCFAllocatorDefault);
-    
-    // Get the string representation of CFUUID object.
-    
-//    NSString* filename =[[NSUUID UUID] UUIDString];
-    //  NSString *filePath = [path stringByAppendingPathComponent:filename];
-    
-    
-    
+  
     
     
     MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];

+ 88 - 417
RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m

@@ -398,12 +398,12 @@
             
         } else {
             
-            [RAUtils message_alert:msg title:nil controller:self] ;
+            [RAUtils message_box:nil message:msg completion:nil] ;
         }
         
     } else {
         
-        [RAUtils message_alert:msg title:nil controller:self] ;
+        [RAUtils message_box:nil message:msg completion:nil] ;
     }
 }
 
@@ -804,13 +804,15 @@
             UITextField *password = alertController.textFields[1];
             if(user.text.length<=0)
             {
-                [RAUtils message_alert:@"User can't be empty." title:@"Warring" controller:self];
+                
+                [RAUtils message_box:@"Warring" message:@"User can't be empty." completion:nil];
                 return;
             }
             
             if(password.text.length<=0)
             {
-                [RAUtils message_alert:@"Password can't be empty." title:@"Warring" controller:self];
+                
+                [RAUtils message_box:@"Warring" message:@"Password can't be empty." completion:nil];
                 return;
             }
             self.realuser =user.text;
@@ -1075,13 +1077,9 @@
         //        NSString *documents = [paths objectAtIndex:0];
 
                 [self scanSave:upparams];
-                
-                [RAUtils message_alert:@"Save Successfully" title:@"Message" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
-                    
-//                    [self newScanOrder];
+                [RAUtils message_box:@"Message" message:@"Save Successfully" completion:^{
                     [self.navigationController popViewControllerAnimated:true];
-                    
-                } completion:nil];
+                }];
                 return;
             }
             
@@ -1166,12 +1164,14 @@
             a2Title=@"Close and release order";
         UIAlertAction *action_2 = [UIAlertAction actionWithTitle:a2Title style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
             AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order" completion:^{
+//            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order" completion:^{
+            PopWaitAlert* pop = [RAUtils waiting_pop:@"Release Order" completion:nil];
                 
 #ifdef SCANNER_ORDER
 //      if(RASingleton.sharedInstance.enable_OfflineOrder)
       {
-          [waitalert dismissViewControllerAnimated:YES completion:^{
+          [pop hide];
+//          [waitalert dismissViewControllerAnimated:YES completion:^{
               [OLDataProvider deleteScanOrder:appDelegate.order_code];
               [appDelegate closeOrder];
               
@@ -1185,7 +1185,7 @@
               
               [self.navigationController popViewControllerAnimated:true];
               [((MainViewController*)appDelegate.main_vc) switchToOrder];
-          }];
+//          }];
       
           return;
       }
@@ -1194,7 +1194,9 @@
                 [RANetwork request_release_order:appDelegate.order_code withScreen:nil completionHandler:^(NSMutableDictionary *result) {
                                 NSDictionary* order_json = result;
                                 
-                                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                                [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
+                    
                                     if([[order_json valueForKey:@"result"] intValue]==2)
                                     {
                                         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -1228,64 +1230,20 @@
                                     }
                                     else
                                     {
-                                        [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order"controller:self] ;
+                                        [RAUtils message_box:@"Open Order" message:[order_json valueForKey:@"err_msg"] completion:nil] ;
+                                        
+                                        
                                     }
-                                }];
+//                                }];
                                 
                                 
                                 
                                 
                             }];
 
-            }];
-            
-            //            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* order_json = [RANetwork release_Order:appDelegate.order_code withScreen:nil];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                    if([[order_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                        //                        appDelegate.order_code = nil;
-//
-//                        [appDelegate closeOrder];
-//
-//
-//#ifdef RA_NOTIFICATION
-//                        [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                        [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//
-//                        [((MainViewController*)appDelegate.main_vc) switchToHome];
-//
-//                        if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.submit_order_logout)
-//                        {
-//                            [((MainViewController*)appDelegate.main_vc) Loginout:false];
-//                        }
-//
-//                        [self prepareReturn:nil];
-//
-//
-//                        [self.navigationController popViewControllerAnimated:true];
-//                        //                        [self.navigationController dismissViewControllerAnimated:true completion:^{
-//                        //                            ;
-//                        //                        }];
-//
-//                    }
-//                    else
-//                    {
-//                        [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order"controller:self] ;
-//                    }
-//
-//
-//
-//                });
-//            });
+//            }];
             
+
             
         }];
         UIAlertAction *action_3 = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
@@ -1302,61 +1260,8 @@
         [self presentViewController:alertController animated:YES completion:nil];
         
         
-        //        alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Choose your action", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to cart", nil),@"Switch to order history",NSLocalizedString(@"Close and cancel order", nil), nil];
-        
-    
-//    else
-//    {
-//
-//        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Close" message:@"Choose your action" preferredStyle:UIAlertControllerStyleAlert];
-//
-//
-//        UIAlertAction *action_0 = [UIAlertAction actionWithTitle:@"Switch to cart" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
-//
-//
-//
-//        }];
-//
-//        UIAlertAction *action_1 = [UIAlertAction actionWithTitle:@"Switch to order history" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
-//
-//
-//
-//        }];
-//        UIAlertAction *action_2 = [UIAlertAction actionWithTitle:@"Close and release order" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-//
-//
-//
-//        }];
-//        UIAlertAction *action_3 = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
-//
-//
-//
-//        }];
-//        [alertController addAction:action_0];
-//        [alertController addAction:action_1];
-//        [alertController addAction:action_2];
-//        [alertController addAction:action_3];
-//
-//
-//        [self presentViewController:alertController animated:YES completion:nil];
-//
-//
-////        alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Choose your action", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to cart", nil),@"Switch to order history",NSLocalizedString(@"Close and release order", nil), nil];
-//
-//    }
-    
 
     
-//    alert.tag = CLOSE_ACTION;
-//    // alert.
-//    [alert show];
-    
-    
-    //    if ([[upparams valueForKey:@"close_on_save"] boolValue]) {
-    //        appDelegate.order_code = nil;
-    //
-    //    }
-    
     
 }
 - (void)didReceiveMemoryWarning {
@@ -1596,29 +1501,10 @@
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
-//    if(appDelegate.user.length<=0)
-//    {
-//        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
-//        return;
-//    }
-    
+
     if(appDelegate.order_code.length>0)
     {
-//        //        当前订单先关闭
-//        //        [OLDataProvider deleteScanOrder:appDelegate.order_code];
-//        appDelegate.order_code = nil;
-//        RASingleton.sharedInstance.scan_temp_code = nil;
-//        if(appDelegate.customer_type!=USER_ROLE_CUSTOMER ) //customer 角色不清空customer info
-//        {   appDelegate.customerInfo = nil;
-//            appDelegate.contact_id = nil;
-//        }
-//        RASingleton.sharedInstance.scan_cart = nil;
-//        RASingleton.sharedInstance.price_type = 1;
-//        //        [appDelegate updateScanButton:false];
-//
-//        [appDelegate update_count_mark];
-//        [appDelegate closeOrder];
-        
+
         [OLDataProvider scanCloseOrder];
         
     }
@@ -1689,12 +1575,16 @@
 
         [self scanSave:upparams];
         
-        [RAUtils message_alert:@"Save Successfully" title:@"Message" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
-            
+        
+        [RAUtils message_box:@"Message" message:@"Save Successfully" completion:^{
             [self newScanOrder];
             [self.navigationController popViewControllerAnimated:true];
             
-        } completion:nil];
+            
+        }];
+        
+        
+
         return;
     }
 #endif
@@ -1707,11 +1597,13 @@
     
     
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving Order" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Saving Order" completion:nil];
         [RANetwork request_save_order:upparams completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary* editor_json =result;
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                     if([[editor_json valueForKey:@"result"] intValue]==2)
                     {
                         
@@ -1731,7 +1623,8 @@
                         if ([editor_json objectForKey:@"so#"]) {
                             msg = [@"SO#:" stringByAppendingString:[editor_json objectForKey:@"so#"]];
                         }
-                        [RAUtils message_alert:msg title:@"Order Saved" controller:self] ;
+                        
+                        [RAUtils message_box:@"Order Saved" message:msg  completion:nil];
                         
                         if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.save_order_logout && appDelegate.user_type ==USER_ROLE_EMPLOYEE)
                         {
@@ -1760,27 +1653,14 @@
                             
                         }
                         
-                        
-                        //                if ([[upparams valueForKey:@"close_on_save"] boolValue]) {
-                        //                    appDelegate.order_code = nil;
-                        //
-                        //                }
-                        //    //     self.labelContact.text=appDelegate.contact_name;
-                        //
-                        //    NSDictionary * customerinfo = appDelegate.customerInfo;
-                        // [self prepareReturn:nil];
-                        //                [self.navigationController dismissViewControllerAnimated:true completion:^{
-                        //
-                        //
-                        //                    ;
-                        //                }];
-                        
+
                     }
                     else
                     {
-                        [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Save Order" controller:self] ;
+                        [RAUtils message_box:@"Save Order" message:[editor_json valueForKey:@"err_msg"] completion:nil] ;
+                        
                     }
-                }];
+//                }];
                 
                 
                 
@@ -1791,90 +1671,8 @@
                 
             }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* editor_json = [RANetwork save_Order:upparams];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//
-//
-//                NSMutableDictionary * customerInfo=[self create_cusromer_info_from_table];
-//
-//
-//                if(appDelegate.user_type ==USER_ROLE_EMPLOYEE)
-//                {
-//                appDelegate.customerInfo = customerInfo;
-//                appDelegate.contact_id = [customerInfo valueForKey:@"customer_cid"];
-//                }
-//                NSString *msg = nil;
-//                if ([editor_json objectForKey:@"so#"]) {
-//                    msg = [@"SO#:" stringByAppendingString:[editor_json objectForKey:@"so#"]];
-//                }
-//                [RAUtils message_alert:msg title:@"Order Saved" controller:self] ;
-//
-//                if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.save_order_logout && appDelegate.user_type ==USER_ROLE_EMPLOYEE)
-//                {
-//                    [((MainViewController*)appDelegate.main_vc) Loginout:false];
-//                    [self prepareReturn:nil];
-//                    [self.navigationController popViewControllerAnimated:true];
-//                }
-//                else{
-//
-//
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//                }
-//
-//                if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
-//
-//                    if (![Singleton sharedInstance].currentOrderIsMerged) {
-//                        [self releaseOrderAfterSave];
-//                    }
-//
-//
-//                }
-//
-//
-//                //                if ([[upparams valueForKey:@"close_on_save"] boolValue]) {
-//                //                    appDelegate.order_code = nil;
-//                //
-//                //                }
-//                //    //     self.labelContact.text=appDelegate.contact_name;
-//                //
-//                //    NSDictionary * customerinfo = appDelegate.customerInfo;
-//                // [self prepareReturn:nil];
-//                //                [self.navigationController dismissViewControllerAnimated:true completion:^{
-//                //
-//                //
-//                //                    ;
-//                //                }];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Save Order" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
-    
+//    }];
+
 }
 
 
@@ -2273,8 +2071,8 @@
             }
             else
             {
-                [RAUtils message_alert:@"not impl" title:@"Sorry" controller:self];
-//                [RAUtils alert_view:@"" title:@"not impl"];
+                
+                [RAUtils message_box:@"Sorry" message:@"not impl" completion:nil];
             }
             
             [olditem setValue:@"true" forKey:@"dirty"];
@@ -2624,10 +2422,11 @@
 - (void)customer_commit_order:(NSMutableDictionary *)upparams {
     
     [upparams setValue:@"true" forKey:@"isHold"];
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Order Submission" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Order Submission" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Order Submission" completion:nil];
         [RANetwork request_commit_order:upparams completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary* editor_json =result;
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
                     if([[editor_json valueForKey:@"result"] intValue]==2)
                     {
                         
@@ -2658,7 +2457,8 @@
                             msg=[NSString stringWithFormat:@"Confirmation#: %@",[editor_json valueForKey:@"so#"]];
                         }
                         
-                        [RAUtils message_alert:msg title:title controller:self];
+                        
+                        [RAUtils message_box:title message:msg completion:nil];
                         //                UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                         
                         //                [alert show];
@@ -2670,70 +2470,18 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Order Submission" controller:self] ;
+                        
+                        [RAUtils message_box:@"Order Submission" message:[editor_json valueForKey:@"err_msg"] completion:nil];
                     }
-                }];
+//                }];
                 
                 
             }];
 
-    }];
+//    }];
     
     
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* editor_json = [RANetwork saveandcommit_Order:upparams];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                // appDelegate.customerInfo = customerInfo;
-//
-//                [appDelegate closeOrder];
-//
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//
-//                NSString* title=nil;
-//                NSString* msg=nil;
-//#ifdef OFFLINE_MODE
-//                if(appDelegate.offline_mode)
-//                {
-//                    title=TITLE_OFFLINE_SUBMIT;
-//                    msg=MSG_OFFLINE_SUBMIT;
-//                }
-//                else
-//#endif
-//                {
-//                    title=@"Order submitted sucessfully";
-//                    msg=[NSString stringWithFormat:@"Confirmation#: %@",[editor_json valueForKey:@"so#"]];
-//                }
-//
-//                [RAUtils message_alert:msg title:title controller:self];
-////                UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-//
-////                [alert show];
-//
-//                [self prepareReturn:nil];
-//                [self.navigationController popToRootViewControllerAnimated:true];
-//
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Order Submission" controller:self] ;
-//            }
-//        });
-//    });
+
 }
 #ifdef SCANNER_ORDER
 -(void)addTasks: (NSString*)filename md5:(NSString*) md5
@@ -3366,11 +3114,15 @@
 //        NSLog(@"disable submit button");
         
         
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Order Submission" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Order Submission" completion:^{
+        
+        PopWaitAlert* pop = [RAUtils waiting_pop:@"Order Submission" completion:nil];
             
             [RANetwork request_fastupload:[params mutableCopy] filename:fileName data:file_data url:appDelegate.uploadurl completionHandler:^(NSMutableDictionary *result) {
                 
-                [waitalert dismissViewControllerAnimated:false completion:^{
+//                [waitalert dismissViewControllerAnimated:false completion:^{
+                
+                [pop hide];
                     int iresult = [result[@"result"] intValue];
             if(iresult == RESULT_TRUE)
             {
@@ -3421,7 +3173,7 @@
                 self.fail_submit = true;
                 self.realuser = nil;
                 self.realpassword = nil;
-                [RAUtils message_alert:@"Can not submit the order, wrong password" title:@"Submit Order" controller:self];
+                [RAUtils message_box:@"Submit Order" message:@"Can not submit the order, wrong password" completion:nil];
                 if ([[NSFileManager defaultManager] fileExistsAtPath:zippath]) {
      
                     
@@ -3439,7 +3191,8 @@
                 self.fail_submit = true;
                 self.realuser = nil;
                 self.realpassword = nil;
-                [RAUtils message_alert:@"Order submission failed. Please check your internet and try later." title:@"Submit Order" controller:self];
+               
+                [RAUtils message_box:@"Submit Order" message:@"Order submission failed. Please check your internet and try later." completion:nil];
 //                if ([[NSFileManager defaultManager] fileExistsAtPath:zippath]) {
 //
 //
@@ -3457,7 +3210,8 @@
                 self.fail_submit = true;
                 self.realuser = nil;
                 self.realpassword = nil;
-                [RAUtils message_alert:result[@"err_msg"] title:@"Submit Order" controller:self];
+                
+                [RAUtils message_box:@"Submit Order" message:result[@"err_msg"]  completion:nil];
 
             }
             else
@@ -3465,9 +3219,10 @@
                 self.fail_submit = true;
                 self.realuser = nil;
                 self.realpassword = nil;
-                [RAUtils message_alert:@"Can not submit order, please contact administrator." title:@"Submit Order" controller:self];
+                [RAUtils message_box:@"Submit Order" message:@"Can not submit order, please contact administrator." completion:nil];
+                
             }
-                }];
+//                }];
 //                self.btnSubmitOrder.enabled = true;
 //                NSLog(@"enable submit button");
                 
@@ -3477,7 +3232,7 @@
             }];
 
             
-        }];
+//        }];
         
 
         
@@ -3583,7 +3338,8 @@
                 self.fail_submit = true;
                 self.realuser = nil;
                 self.realpassword = nil;
-                [RAUtils message_alert:@"Can not submit the order, wrong password" title:@"Submit Order" controller:self];
+                
+                [RAUtils message_box:@"Submit Order" message:@"Can not submit the order, wrong password" completion:nil];
 //                if ([[NSFileManager defaultManager] fileExistsAtPath:zippath]) {
 //
 //
@@ -3601,7 +3357,8 @@
                 self.fail_submit = true;
                 self.realuser = nil;
                 self.realpassword = nil;
-                [RAUtils message_alert:@"Order submission failed. Please check your internet and try later." title:@"Submit Order" controller:self];
+                
+                [RAUtils message_box:@"Submit Order" message:@"Order submission failed. Please check your internet and try later."  completion:nil];
 //                if ([[NSFileManager defaultManager] fileExistsAtPath:zippath]) {
 //
 //
@@ -3619,7 +3376,7 @@
                 self.fail_submit = true;
                 self.realuser = nil;
                 self.realpassword = nil;
-                [RAUtils message_alert:@"Can not submit order, please contact administrator." title:@"Submit Order" controller:self];
+                [RAUtils message_box:@"Submit Order" message:@"Can not submit order, please contact administrator." completion:nil];
             }
             
             
@@ -3637,89 +3394,19 @@
     {
         //无contact 直接提交
         [self scan_commit:upparams newmodel:nil];
-//        [RANetwork request_fastupload:[params mutableCopy] filename:fileName data:file_data url:appDelegate.uploadurl completionHandler:^(NSMutableDictionary *result) {
-//                    int iresult = [result[@"result"] intValue];
-//            if(iresult == RESULT_TRUE)
-//            {
-//                NSString* soid = result[@"so_id"];
-//                if(soid.length==0)
-//                    soid=@"N/A";
-////                            upparams[@"soid"]=soid;
-//                [self scanSave:upparams];
-//                NSString* company = upparams[@"customer_name"];
-//                [OLDataProvider save2submitScanOrder:soid company:company];
-//                [appDelegate closeOrder];
-//                RASingleton.sharedInstance.scan_cart = nil;
-//
-//                #ifdef RA_NOTIFICATION
-//                                    [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//                #else
-//                                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                                    [main_vc reloadCart:true immediately:false];
-//                #endif
-//
-//        //
-//
-//
-//                [self prepareReturn:nil];
-//
-//
-//
-//                [self.navigationController popViewControllerAnimated:true];
-//                [((MainViewController*)appDelegate.main_vc) switchToOrder];
-//        //        NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
-//        //        ret[@"result"]=@2;
-//        //        ret[@"file"]=zippath;
-//        //        result(ret);
-//                return;
-//            }
-//            else if(iresult==1)
-//            {
-//                self.fail_submit = true;
-//                self.realuser = nil;
-//                self.realpassword = nil;
-//                [RAUtils message_alert:@"Can not submit the order, wrong password" title:@"Submit Order" controller:self];
-//                if ([[NSFileManager defaultManager] fileExistsAtPath:zippath]) {
-//
-//
-//                    [[NSFileManager defaultManager] removeItemAtPath:zippath error:nil];
-//
-//    //                    [orderlist addObject:appDelegate.order_code];
-//    //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-//
-//              }
-//
-//
-//            }
-//            else
-//            {
-//                self.fail_submit = true;
-//                [RAUtils message_alert:@"Can not submit the order, please check your network" title:@"Submit Order" controller:self];
-//
-//                if ([[NSFileManager defaultManager] fileExistsAtPath:zippath]) {
-//
-//
-//                    [[NSFileManager defaultManager] removeItemAtPath:zippath error:nil];
-//
-//    //                    [orderlist addObject:appDelegate.order_code];
-//    //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-//
-//              }
-//
-//            }
-//        }];
 
-        
     }
     return;
     
 #endif
     
     [upparams setValue:@"false" forKey:@"isHold"];
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Order Submission" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Order Submission" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Order Submission" completion:nil];
         [RANetwork request_commit_order:upparams completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary* editor_json = result;
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                     if([[editor_json valueForKey:@"result"] intValue]==2)
                     {
                         
@@ -3772,9 +3459,7 @@
                         {
                             
                             
-//                            [message_alert dismissViewControllerAnimated:YES completion:^{
-                                //                        [alert dismissWithClickedButtonIndex:0 animated:FALSE];
-//                                [self.navigationController popToRootViewControllerAnimated:true];
+
                                 [appDelegate printPdf:pdf_url company:company send_to:send_to soid:soid content:email_content];
                                 
                                 //  [appDelegate printPdf:pdf_url];
@@ -3784,41 +3469,27 @@
                         }
                         else
                             dispatch_async(dispatch_get_main_queue(), ^{
-//                            UIAlertController* message_alert=
+
+                                
                                 
-                                [RAUtils message_alert:msg title:title controller:message_parent];
+                                [RAUtils message_box:title message:msg completion:nil];
                         });
-//                        __block UIAlertController* message_alert=[RAUtils message_alert:msg title:title controller:self.parentViewController action_handler:^(UIAlertAction * _Nonnull action) {
-//
-//
-//
-//
-////                            [self.navigationController popToRootViewControllerAnimated:true];
-//
-//
-//                        } completion:^{
-//
-//                        }];
-                        
-                        //                UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-                        //
-                        //                [alert show];
-                        //
-                       
+
                         
                         
                     }
                     else
                     {
-                        [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Order Submission" controller:self] ;
+                        
+                        [RAUtils message_box:@"Order Submission" message:[editor_json valueForKey:@"err_msg"]  completion:nil];
                     }
-                }];
+//                }];
                 
                 
                 
             }];
 
-    }];
+//    }];
    
 }
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 87 - 725
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m


+ 85 - 581
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -444,7 +444,9 @@
                          self.norefresh = true;
                          if(appDelegate.customerInfo==nil)
                          {
-                             [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+//                             [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
+                             
+                             [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
                          }
                          else
                          {
@@ -492,9 +494,9 @@
                      
                      cvc.onCancel = ^(){
                          
-                         [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-                         
+//                         [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
                          
+                         [RAUtils message_box:@"" message:@"Cannot create order without customer infomation." completion:nil];
                          
                      };
                      cvc.onReset = ^(){
@@ -735,7 +737,9 @@
             }
             else
             {
-                [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Order List" controller:self] ;
+
+                
+                [RAUtils message_box:@"Loading Order List" message:[content valueForKey:@"err_msg"] completion:nil];
             }
             
             
@@ -747,78 +751,7 @@
         
     });
     
-//
-//        NSMutableDictionary* content=nil;
-//        content=[[RANetwork request_OrderList:self.offset limit : self.limit keywords:self.keywords status:str_status customer:self.customer_id is_merged:isMerged] mutableCopy];
-//
-//
-//        dispatch_sync(dispatch_get_main_queue(), ^{
-//
-//
-//
-//
-//
-//            [self.mum stopAnimating];
-//            self.isrefreshing=false;
-//            if (self.dataOperationQueue.operationCount > 1) { // 队列后面还有操作
-//                return ;
-//            }
-//            int result=[[content valueForKey:@"result"] intValue];
-//
-//            if(result==2||result==0)
-//            {
-//
-//
-//                int count = [[content valueForKey:@"count" ] intValue] ;
-//
-//
-//                self.time_zone = [content valueForKey:@"time_zone" ];
-//                self.offset += count;
-//                for(int i=0;i<count;i++)
-//                {
-//
-//                    NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-//                    [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
-//
-//                }
-//                if(count<self.limit)
-//                {
-//
-//                    //                    int i =self.btnrefresh.state;
-//                    self.load_more_hint=@"All loaded";
-//                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
-//                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
-//                }
-//                else
-//                {
-//                    self.load_more_hint=@"Load more...";
-//                    //                    self.btnrefresh.enabled = true;
-//                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
-//                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
-//                }
-//
-//
-//                self.table_order.hidden = false;
-//                self.reset_result=false;
-//                [self.table_order reloadData ];
-//            }
-//            else if(result==RESULT_NET_ERROR &&self.offset==0)
-//            {
-//                self.label_net_err.hidden=false;
-//                self.table_order.hidden = true;
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Order List" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//
-        
-//    });
+
 }
 -(void) loadpage
 {
@@ -856,11 +789,13 @@
 -(void) neworder
 {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
                 NSMutableDictionary* return_json =result;
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                     if([[return_json valueForKey:@"result"] intValue]==2)
                     {
                         int result=[[return_json valueForKey:@"result"] intValue];
@@ -883,31 +818,17 @@
                             
                             [self ReloadData];
                             
-                            
-                            //     [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
-                            //    [self loadpage];
-                            
-                            
-                            //                    if(self.shopCartBlock!=nil)
-                            //                    {
-                            //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-                            //
-                            //
-                            //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-                            //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-                            //                        iv.image = img;
-                            //                        //                        [self.contentView addSubview:iv];
-                            //                        self.shopCartBlock(iv);
-                            //
-                            //                    }
+                     
                             
                         }
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
+
+                        
+                        [RAUtils message_box:@"Create Order" message:[return_json valueForKey:@"err_msg"] completion:nil];
                     }
-                }];
+//                }];
         //        [waitalert dismissViewControllerAnimated:YES completion:nil];
                 
                 
@@ -919,176 +840,9 @@
                 
             }];
 
-    }];
+//    }];
         
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = [RANetwork new_Order];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//
-//                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    appDelegate.order_code = order_code;
-//                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-//
-//
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                    [main_vc reloadCart:true immediately:false];
-//#endif
-//
-//                    [self ReloadData];
-//
-//
-//                    //     [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
-//                    //    [self loadpage];
-//
-//
-//                    //                    if(self.shopCartBlock!=nil)
-//                    //                    {
-//                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//                    //
-//                    //
-//                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-//                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                    //                        iv.image = img;
-//                    //                        //                        [self.contentView addSubview:iv];
-//                    //                        self.shopCartBlock(iv);
-//                    //
-//                    //                    }
-//
-//                }
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
-//#pragma mark - UIAlertViewDelegate
-//// Called when a button is clicked. The view will be automatically dismissed after this call returns
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-//{
-//    if(buttonIndex!=alertView.cancelButtonIndex)
-//    {
-//        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//        
-//        if(appDelegate.order_code && appDelegate.order_code.length>0)
-//        {
-////            appDelegate.order_code= nil;
-////            [appDelegate SetSo:nil];
-//            
-//            if (appDelegate.user_type == USER_ROLE_EMPLOYEE) {
-//                //     MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//                cvc.showNavibar = true;
-//                cvc.contact_type = @"Sales_Order_Customer";
-//                cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//                    
-//                    appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                    appDelegate.customerInfo = value;
-//                    
-//                    self.norefresh = true;
-//                    [self neworder];
-//                    
-//                    
-//                    
-//                    //    [main_vc checklogin:true];
-//                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//                    
-//                    //
-//                    //                if(self.returnValue)
-//                    //                    self.returnValue(value);
-//                };
-//                
-//                cvc.onCancel = ^(){
-//                    self.norefresh = true;
-//                    if(appDelegate.customerInfo==nil)
-//                    {
-//                        [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//                    }
-//                    else
-//                    {
-//                        [self neworder];
-//                    }
-//                    //  [main_vc checklogin:true];
-//                };
-//                cvc.onReset = ^(){
-//                    //   [main_vc checklogin:true];
-//                };
-//                
-//                [self.navigationController pushViewController:cvc animated:true];
-//            }
-//            else if (appDelegate.user_type == USER_ROLE_CUSTOMER){
-//                [self neworder];
-//            }
-//            
-//        }
-//        else
-//        {
-//            //create new;
-//            
-//            if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//            {
-//                MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//                cvc.showNavibar = true;
-//                cvc.contact_type = @"Sales_Order_Customer";
-//                cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//                    
-//                    appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                    appDelegate.customerInfo = value;
-//                    
-//                    
-//                    if(appDelegate.order_code==nil)
-//                        [self neworder];
-//                    
-//                    //   [main_vc checklogin:true];
-//                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//                    
-//                    //
-//                    //                if(self.returnValue)
-//                    //                    self.returnValue(value);
-//                };
-//                
-//                cvc.onCancel = ^(){
-//                    
-//                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//                    
-//                    
-//                    
-//                };
-//                cvc.onReset = ^(){
-//                    [main_vc checklogin:true];
-//                };
-//                
-//                [self.navigationController pushViewController:cvc animated:true];
-//            }
-//            else
-//            {
-//                [self neworder];
-//            }
-//        }
-//        
-//    }
-//}
 #pragma mark - Table view data source
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
 {
@@ -1423,7 +1177,10 @@
 
     if(appDelegate.user_type==USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) { // Customer
         if ([RASingleton sharedInstance].global_lock) { // Order list 被锁
-            [RAUtils message_alert:@"Permission Needed.\nGoto Menu -> Unlock" title:@"Warning" controller:self];
+
+            
+            
+            [RAUtils message_box:@"Warning" message:@"Permission Needed.\nGoto Menu -> Unlock" completion:nil];
             return;
         }
     }
@@ -1537,11 +1294,15 @@
             
             UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
                 
-                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Order" completion:^{
+//                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Order" completion:^{
+                
+                PopWaitAlert* pop = [RAUtils waiting_pop:@"Delete Order" completion:nil];
                     [RANetwork request_delete_order:orderid completionHandler:^(NSMutableDictionary *result) {
                         NSDictionary* return_json = result;
                         //                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-                        [waitalert dismissViewControllerAnimated:YES completion:^{
+                        
+                        [pop hide];
+//                        [waitalert dismissViewControllerAnimated:YES completion:^{
                             if([[return_json valueForKey:@"result"] intValue]==2)
                             {
                                 if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
@@ -1558,14 +1319,19 @@
                                     //                                appDelegate.order_customer_id = nil;
                                 }
                                 
-                                [RAUtils message_alert:nil title:@"Order Delete" controller:self] ;
+
+                                
+                                
+                                [RAUtils message_box:@"Order Delete" message:nil completion:nil];
                                 [self ReloadData];
                             }
                             else
                             {
-                                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Delete Order" controller:self] ;
+
+                                
+                                [RAUtils message_box:@"Delete Order" message:[return_json valueForKey:@"err_msg"] completion:nil];
                             }
-                        }];
+//                        }];
                         
                         
 
@@ -1575,48 +1341,9 @@
                         
                     }];
 
-                }];
+//                }];
                                 
                 
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* return_json = [RANetwork delete_Order:orderid];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-////                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//                        if([[return_json valueForKey:@"result"] intValue]==2)
-//                        {
-//                            if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
-//                            {
-//                                appDelegate.order_code= nil;
-//                                [appDelegate SetSo:nil];
-//
-//
-//                                appDelegate.cart_count=0;
-//                                [appDelegate update_count_mark];
-//
-////                                appDelegate.customerInfo = nil;
-////                                appDelegate.contact_id = nil;
-////                                appDelegate.order_customer_id = nil;
-//                            }
-//
-//                            [RAUtils message_alert:nil title:@"Order Delete" controller:self] ;
-//                            [self ReloadData];
-//                        }
-//                        else
-//                        {
-//                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Delete Order" controller:self] ;
-//                        }
-//
-//
-//
-//
-//                    });
-//                });
-                
                 
             }];
             
@@ -1657,12 +1384,16 @@
             
             UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
                 
-                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Cancel Order" completion:^{
+//                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Cancel Order" completion:^{
+                
+                PopWaitAlert* pop = [RAUtils waiting_pop:@"Cancel Order" completion:nil];
                     [RANetwork request_cancel_order:orderid order_code:nil completionHandler:^(NSMutableDictionary *result) {
                         
                         NSDictionary* return_json = result;
                         //                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-                        [waitalert dismissViewControllerAnimated:YES completion:^{
+//                        [waitalert dismissViewControllerAnimated:YES completion:^{
+                        
+                        [pop hide];
                             
                             if([[return_json valueForKey:@"result"] intValue]==2)
                             {
@@ -1679,14 +1410,18 @@
                                     
                                     
                                 }
-                                [RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
+
+                                
+                                [RAUtils message_box:@"Order Canceled" message:nil completion:nil];
                                 [self ReloadData];
                             }
                             else
                             {
-                                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
+
+                                
+                                [RAUtils message_box:@"Cancel Order" message:[return_json valueForKey:@"err_msg"] completion:nil];
                             }
-                        }];
+//                        }];
                         
                         
                         
@@ -1696,46 +1431,8 @@
                         
                     }];
 
-                }];
-                //                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* return_json = [RANetwork cancel_Order:orderid order_code:nil];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-////                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//
-//                        if([[return_json valueForKey:@"result"] intValue]==2)
-//                        {
-//                            if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
-//                            {
-//                                appDelegate.order_code= nil;
-//                                //appDelegate.user_type = 0;
-//                                appDelegate.customerInfo = nil;
-//                                appDelegate.contact_id = nil;
-//                                appDelegate.order_customer_id = nil;
-//                                [appDelegate SetSo:nil];
-//                                appDelegate.cart_count=0;
-//                                [appDelegate update_count_mark];
-//
-//
-//                            }
-//                            [RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
-//                            [self ReloadData];
-//                        }
-//                        else
-//                        {
-//                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
-//                        }
-//
-//
-//
-//
-//                    });
-//                });
-                
+//                }];
+
                 
             }];
             
@@ -1788,138 +1485,7 @@
         
     } else if (appDelegate.user_type==USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         
-//        UITableViewRowAction *add2MergeListAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Add To Combine List" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
-//            
-//            NSString *orderCode = [NSString stringWithFormat:@"%@",[self.content_data[indexPath.row] valueForKey:@"order_code"]];
-//            
-//            
-//            NSString *create_by = [self.content_data[indexPath.row] valueForKey:@"create_by"];
-//            NSString *create_time = [self.content_data[indexPath.row] valueForKey:@"purchase_time"];
-//            
-//            __block BOOL contain = NO;
-//            [self.mergeList enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
-//               
-//                NSString *so_id = [(NSDictionary *)obj objectForKey:@"so_id"];
-//                if ([so_id isEqualToString:so]) {
-//                    
-//                    contain = YES;
-//                    
-//                    *stop = YES;
-//                }
-//                
-//            }]; // 避免重复添加
-//            
-//            
-//            if (!contain) {
-//                
-//                __block BOOL closeOrder = NO;
-//                // 检查是否被自己打开
-//                if ([orderCode isEqualToString:appDelegate.order_code]) {
-//                    
-//                    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"can not add to combine list because current order is opened. Do you want to close order and add to combine list?" preferredStyle:UIAlertControllerStyleAlert];
-//                    
-//                    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-//                        
-//                        closeOrder = NO;
-//                        [alertVC dismissViewControllerAnimated:YES completion:nil];
-//                        
-//                    }];
-//                    
-//                    UIAlertAction *closeOrderAction = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-//                        
-//                        
-//                        [alertVC dismissViewControllerAnimated:YES completion:nil];
-//                        // 关闭订单
-//                        UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order"];
-//                        NSDictionary* order_json = [iSalesNetwork release_Order:orderCode];
-//                        
-//                        dispatch_async(dispatch_get_main_queue(), ^{
-//                            
-//                            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                            if([[order_json valueForKey:@"result"] intValue]==2)
-//                            {
-//                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                                [appDelegate closeOrder];
-//                                closeOrder = YES;
-//
-//                                // 锁订单/检查是否被别人锁定
-//                                NSDictionary *lock_dic = [iSalesNetwork lock_order:orderCode]; // 和open一样,只不过不用更新car count
-//
-//                                
-//                                if ([[lock_dic objectForKey:@"result"] integerValue] == RESULT_TRUE) {
-//                                    
-//                                    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-//                                    
-//                                    [dic setValue:orderid forKey:@"order_id"];
-//                                    [dic setValue:so forKey:@"so_id"];
-//                                    [dic setValue:create_by forKey:@"create_by"];
-//                                    [dic setValue:create_time forKey:@"create_time"];
-//                                    [dic setValue:[NSNumber numberWithInteger:0] forKey:@"check"]; // 合并到
-//                                    
-//                                    [self.mergeList addObject:dic];
-//                                    
-//                                } else {
-//                                    
-//                                    [RAUtils message_alert:[lock_dic objectForKey:@"err_msg"] title:@"Warning" controller:self];
-//                                    
-//                                }
-//
-//                                
-//                            }
-//                            else
-//                            {
-//                                closeOrder = NO;
-//                                [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:self] ;
-//                            }
-//                            
-//                            
-//                            
-//                        });
-//
-//                        
-//                        
-//                    }];
-//                    
-//                    [alertVC addAction:cancelAction];
-//                    [alertVC addAction:closeOrderAction];
-//                    
-//                    [self presentViewController:alertVC animated:YES completion:nil];
-//                    
-//                } else {
-//                    
-//                    closeOrder = YES;
-//                    // 锁订单/检查是否被别人锁定
-//                    NSDictionary *lock_dic = [iSalesNetwork lock_order:orderCode]; // 和open一样,只不过不用更新car count
-//                    
-//                    if ([[lock_dic objectForKey:@"result"] integerValue] == RESULT_TRUE) {
-//                        
-//                        NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-//                        
-//                        [dic setValue:orderid forKey:@"order_id"];
-//                        [dic setValue:so forKey:@"so_id"];
-//                        [dic setValue:create_by forKey:@"create_by"];
-//                        [dic setValue:create_time forKey:@"create_time"];
-//                        [dic setValue:[NSNumber numberWithInteger:0] forKey:@"check"]; // 合并到
-//                        
-//                        [self.mergeList addObject:dic];
-//                        
-//                    } else {
-//                        
-//                        [RAUtils message_alert:[lock_dic objectForKey:@"err_msg"] title:@"Warning" controller:self];
-//                        
-//                    }
-//                }
-//                
-//            }
-//            
-//            [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationFade];
-//            
-//            DebugLog(@"%@",self.mergeList);
-//            
-//        }];
-//        add2MergeListAction.backgroundColor = UIColorFromRGB(0x336699);
-        
+
         // Cancel Order Action
         UITableViewRowAction *cancelAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Cancel Order"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
             
@@ -1935,11 +1501,15 @@
             
             UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
                 
-                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Cancel Order" completion:^{
+//                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Cancel Order" completion:^{
+                
+                PopWaitAlert* pop = [RAUtils waiting_pop:@"Cancel Order" completion:nil];
                     [RANetwork request_cancel_order:orderid order_code:nil completionHandler:^(NSMutableDictionary *result) {
                         NSDictionary* return_json =result;
                         //                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-                        [waitalert dismissViewControllerAnimated:YES completion:^{
+//                        [waitalert dismissViewControllerAnimated:YES completion:^{
+                        
+                        [pop hide];
                             if([[return_json valueForKey:@"result"] intValue]==2)
                             {
                                 if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
@@ -1955,14 +1525,17 @@
                                     
                                     
                                 }
-                                [RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
+
+                                
+                                [RAUtils message_box:@"Order Canceled" message:nil completion:nil];
                                 [self ReloadData];
                             }
                             else
                             {
-                                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
+
+                                [RAUtils message_box:@"Cancel Order" message:[return_json valueForKey:@"err_msg"] completion:nil];
                             }
-                        }];
+//                        }];
                         
                         
                         
@@ -1972,46 +1545,9 @@
                         
                     }];
 
-                }];
-                
-                //                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* return_json = [RANetwork cancel_Order:orderid order_code:nil];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-////                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//                        if([[return_json valueForKey:@"result"] intValue]==2)
-//                        {
-//                            if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
-//                            {
-//                                appDelegate.order_code= nil;
-//                                //appDelegate.user_type = 0;
-//                                appDelegate.customerInfo = nil;
-//                                appDelegate.contact_id = nil;
-//                                appDelegate.order_customer_id = nil;
-//                                [appDelegate SetSo:nil];
-//                                appDelegate.cart_count=0;
-//                                [appDelegate update_count_mark];
-//
-//
-//                            }
-//                            [RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
-//                            [self ReloadData];
-//                        }
-//                        else
-//                        {
-//                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
-//                        }
-//
-//
-//
-//
-//                    });
-//                });
+//                }];
                 
+
                 
             }];
             
@@ -2213,7 +1749,10 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     
     if (!self.table_order.isEditing) {
         
-        [RAUtils message_alert:@"You have to click select firstly then select some saved order" title:@"Warning" controller:self];
+
+        
+        
+        [RAUtils message_box:@"Warning" message:@"You have to click select firstly then select some saved order" completion:nil];
         return;
     }
     
@@ -2221,7 +1760,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     
     if (!self.mergeList.count) {
         
-//        [RAUtils message_alert:@"Combine List is Empty" title:@"Warning" controller:self];
+
         return;
     }
     
@@ -2257,7 +1796,10 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
             } else {
                 
                 NSString *msg = [ret objectForKey:@"err_msg"];
-                [RAUtils message_alert:msg title:nil controller:strongself];
+
+                
+                
+                [RAUtils message_box:nil message:msg completion:nil];
             }
         }
         
@@ -2318,7 +1860,10 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
 - (IBAction)editOrderListButtonClick:(UIBarButtonItem *)sender {
 
     if ([RASingleton sharedInstance].global_lock) { // Order list 被锁
-        [RAUtils message_alert:@"Permission Needed.\nGoto Menu -> Unlock" title:@"Warning" controller:self];
+
+        
+        
+        [RAUtils message_box:@"Warning" message:@"Permission Needed.\nGoto Menu -> Unlock" completion:nil];
         return;
     }
     
@@ -2489,57 +2034,16 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
         }
         else
         {
-            [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:weakself] ;
+
+            
+            
+            [RAUtils message_box:@"Open Order" message:[order_json valueForKey:@"err_msg"] completion:nil];
         }
         
         
         
         
     }];
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* order_json = [RANetwork open_Order:orderCode];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//            if([[order_json valueForKey:@"result"] intValue]==2)
-//            {
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                appDelegate.order_code = orderCode;
-//                appDelegate.order_status = orderStatus;
-//                [appDelegate SetSo:so];
-//
-//                __weak MainViewController *mainVC = (MainViewController*)appDelegate.main_vc;
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"CartViewController,OrderListViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//
-//
-//                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
-//#endif
-//
-//                [((MainViewController*)appDelegate.main_vc) switchToCart];
-//
-//                mainVC.cartViewController.onFinishLoad=^{
-//                    [mainVC.cartViewController placeOrder];
-//                    mainVC.cartViewController.onFinishLoad=nil;
-//                };
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:weakself] ;
-//            }
-//
-//
-//
-//        });
-//    });
-
-    
 }
 
 #pragma mark - notification action

+ 20 - 264
RedAnt ERP Mobile/common/Functions/order/RAOrderEditorViewController.m

@@ -196,11 +196,15 @@ static const int totalPage = 3;
                      // close order;
                      
                      AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-             __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order" completion:^{
+//             __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order" completion:^{
+             
+             PopWaitAlert * pop = [RAUtils waiting_pop:@"Release Order" completion:nil];
                  [RANetwork request_release_order:appDelegate.order_code withScreen:nil completionHandler:^(NSMutableDictionary *result) {
                      NSDictionary* order_json = result;
                  //                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-                     [waitalert dismissViewControllerAnimated:YES completion:^{
+//                     [waitalert dismissViewControllerAnimated:YES completion:^{
+                     
+                     [pop hide];
                          if([[order_json valueForKey:@"result"] intValue]==2)
                          {
                              AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -229,9 +233,11 @@ static const int totalPage = 3;
                          }
                          else
                          {
-                             [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order"controller:self] ;
+
+                             
+                             [RAUtils message_box:@"Open Order" message:[order_json valueForKey:@"err_msg"] completion:nil];
                          }
-                     }];
+//                     }];
                                      
 
                                      
@@ -239,51 +245,7 @@ static const int totalPage = 3;
                                      
                  }];
 
-             }];
-             //                     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                         NSDictionary* order_json = [RANetwork release_Order:appDelegate.order_code withScreen:nil];
-//
-//                         dispatch_async(dispatch_get_main_queue(), ^{
-//         //                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                             [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//                             if([[order_json valueForKey:@"result"] intValue]==2)
-//                             {
-//                                 AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                                 [appDelegate closeOrder];
-//
-//
-//         //#ifdef RA_NOTIFICATION
-//         //                        [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//         //#else
-//         //                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//         //#endif
-//                                 [((MainViewController*)appDelegate.main_vc) switchToHome];
-//
-//                                 if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.submit_order_logout)
-//                                 {
-//                                     [((MainViewController*)appDelegate.main_vc) Loginout:false];
-//                                 }
-//
-//                                 [self prepareReturn:nil];
-//
-//
-//                                 [self.navigationController popViewControllerAnimated:true];
-//
-//
-//                             }
-//                             else
-//                             {
-//                                 [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order"controller:self] ;
-//                             }
-//
-//
-//
-//                         });
-//                     });
-                     
+
                      
                  }];
          UIAlertAction *action_3 = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
@@ -299,107 +261,10 @@ static const int totalPage = 3;
          
          [self presentViewController:alertController animated:YES completion:nil];
         
-//
-//        alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Choose your action", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to cart", nil),@"Switch to order history",NSLocalizedString(@"Close and cancel order", nil), nil];
-        
-    
-//    else
-//    {
-        
-       
-        
-//        alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Choose your action", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to cart", nil),@"Switch to order history",NSLocalizedString(@"Close and release order", nil), nil];
-        
-//    }
-    
-//    alert.tag = CLOSE_ACTION;
-//
-//    [alert show];
 
 
-}
 
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
-//
-//    if(alertView.tag == CLOSE_ACTION)
-//    {
-//        if(buttonIndex==1)
-//        {
-//
-//            [self.navigationController popViewControllerAnimated:true];
-//
-//        }
-//        if(buttonIndex==2)
-//        {
-//
-//            [self.navigationController popViewControllerAnimated:false];
-//
-//
-//
-//            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////#ifdef RA_NOTIFICATION
-////            [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-////#else
-////            [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-////#endif
-//            [((MainViewController*)appDelegate.main_vc) switchToOrder];
-//
-//        }
-//        else if(buttonIndex==3)
-//        {
-//            // close order;
-//
-//            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//            UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order"];
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* order_json = [RANetwork release_Order:appDelegate.order_code withScreen:nil];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-////                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//                    if([[order_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                        [appDelegate closeOrder];
-//
-//
-////#ifdef RA_NOTIFICATION
-////                        [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-////#else
-////                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-////#endif
-//                        [((MainViewController*)appDelegate.main_vc) switchToHome];
-//
-//                        if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.submit_order_logout)
-//                        {
-//                            [((MainViewController*)appDelegate.main_vc) Loginout:false];
-//                        }
-//
-//                        [self prepareReturn:nil];
-//
-//
-//                        [self.navigationController popViewControllerAnimated:true];
-//
-//
-//                    }
-//                    else
-//                    {
-//                        [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order"controller:self] ;
-//                    }
-//
-//
-//
-//                });
-//            });
-//
-//
-//        }
-//    }
-//
-//}
+}
 
 - (void)setupPageControlBar {
     
@@ -670,12 +535,15 @@ static const int totalPage = 3;
             
         } else {
             
-            [RAUtils message_alert:msg title:nil controller:self] ;
+//            [RAUtils message_box:nil message:msg completion:nil] ;
+            
+            [RAUtils message_box:nil message:msg completion:nil];
         }
         
     } else {
         
-        [RAUtils message_alert:msg title:nil controller:self] ;
+//        [RAUtils message_box:nil message:msg completion:nil] ;
+        [RAUtils message_box:nil message:msg completion:nil];
     }
 }
 
@@ -999,75 +867,6 @@ static const int totalPage = 3;
     }
 
 }
-//
-//- (IBAction)onSaveClick:(id)sender {
-//
-//    id a = nil;
-//    NSMutableArray *arr = [NSMutableArray array];
-//    [arr addObject:a];
-//
-//    [self.lastedit endEditing:true];
-//    [self.lasttextview endEditing:true];
-//
-//    NSMutableDictionary* upparams = [self check_cancommit:false];
-//
-//    if([upparams[@"shipping"] isEqualToString:@"Shipping To Be Quoted"]||[upparams[@"shipping"] isEqualToString:@"To Be Quoted"])
-//        upparams[@"shipping"] = nil;
-//
-//
-//    UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving Order"];
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* editor_json = [RANetwork save_Order:upparams];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                NSMutableDictionary * customerInfo=[self create_cusromer_info_from_table];
-//
-//                if(appDelegate.user_type ==USER_ROLE_EMPLOYEE)
-//                {
-//                    appDelegate.customerInfo = customerInfo;
-//                    appDelegate.contact_id = [customerInfo valueForKey:@"customer_cid"];
-//                }
-//                NSString *msg = nil;
-//                if ([editor_json objectForKey:@"so#"]) {
-//                    msg = [@"SO#:" stringByAppendingString:[editor_json objectForKey:@"so#"]];
-//                }
-//                [RAUtils message_alert:msg title:@"Order Saved" controller:self] ;
-//
-//                if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.save_order_logout && appDelegate.user_type ==USER_ROLE_EMPLOYEE)
-//                {
-//                    [((MainViewController*)appDelegate.main_vc) Loginout:false];
-//                    [self prepareReturn:nil];
-//                    [self.navigationController popViewControllerAnimated:true];
-//                }
-//
-//                if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
-//
-//                    if (![Singleton sharedInstance].currentOrderIsMerged) {
-//                        [self releaseOrderAfterSave];
-//                    }
-//
-//
-//                }
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Save Order" controller:self] ;
-//            }
-//
-//        });
-//    });
-//
-//}
 
 - (void)releaseOrderAfterSave {
     
@@ -1084,18 +883,7 @@ static const int totalPage = 3;
         [self.navigationController popToRootViewControllerAnimated:false];
     });
 
-//
-//    [RANetwork release_Order:appDelegate.order_code withScreen:nil];
-//
-//    [appDelegate closeOrder];
-//    [appDelegate SetSo:nil];
-//    appDelegate.cart_count=0;
-//    [appDelegate update_count_mark];
-//    [((MainViewController*)appDelegate.main_vc) switchToOrder];
-//
-//    [self prepareReturn:nil];
-//    [self.navigationController popToRootViewControllerAnimated:false];
-    
+
 }
 
 -(NSString* )create_customer_ext:(NSDictionary*)customerinfo
@@ -1303,7 +1091,8 @@ static const int totalPage = 3;
             }
             else
             {
-                [RAUtils message_alert:@"not impl" title:@"Sorry" controller:self];
+
+                [RAUtils message_box:@"Sorry" message:@"not impl" completion:nil];
 //                [RAUtils alert_view:@"" title:@"not impl"];
             }
             
@@ -1318,39 +1107,6 @@ static const int totalPage = 3;
         if(refresh==1)
         {
             
-            //            if(restore_json!=nil)
-            //            {
-            //                int rc=[[restore_json valueForKey:@"count"] intValue];
-            //                for(int ir=0;ir<rc;ir++)
-            //                {
-            //                    NSString* name = [restore_json valueForKey:[NSString stringWithFormat:@"item_%d",ir]];
-            //
-            //
-            //                    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
-            //                    for(int i=0;i<section_count;i++)
-            //                    {
-            //                        NSMutableDictionary * sectionjson = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i ]] mutableCopy];
-            //                        //                    NSMutableDictionary * to_sectionjson = [[to objectForKey:[NSString stringWithFormat:@"section_%d",i ]] mutableCopy];
-            //                        int item_count = [[sectionjson valueForKey:@"count"] intValue];
-            //                        for(int j=0;j<item_count;j++)
-            //                        {
-            //                            NSMutableDictionary * itemjson=[[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j ]] mutableCopy];
-            //                            //             NSMutableDictionary * to_itemjson=[[to_sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j ]] mutableCopy];
-            //
-            //                            if([[itemjson valueForKey:@"name"] isEqualToString:name])
-            //                            {
-            //                                [itemjson removeObjectForKey:@"dirty"];
-            //                                [sectionjson setObject:itemjson forKey:[NSString stringWithFormat:@"item_%d",j ]];
-            //                            }
-            //
-            //                        }
-            //                        [self.content_data_download setObject:sectionjson forKey:[NSString stringWithFormat:@"section_%d",i ]];
-            //                    }
-            //
-            //
-            //                }
-            //
-            //            }
             [self refresh:refresh_trigger discardDirty:discardDirty];
             return ;
         }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 5 - 1119
RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m


+ 17 - 75
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioEditQTYViewController.m

@@ -140,41 +140,19 @@
             
         {
             self.labelQueryQTY.text=@"Tap Refresh to query current QTY";
-            [RAUtils message_alert:[detail_json valueForKey:@"err_msg"] title:@"Request Available QTY"/*@"Loading Model Detail Failed."*/ controller:self] ;
+
+            
+            
+            [RAUtils message_box:@"Request Available QTY" message:[detail_json valueForKey:@"err_msg"] completion:nil];
+            
+            
+            
         }
         
         
         
     }];
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* detail_json = [RANetwork request_model_qty:self.arr_fashion_ids[0]];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            self.buttonRefresh.enabled=true;
-////            NSDictionary* imgsection = [detail_json objectForKey:@"img_section"];
-//            //          AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//            if([[detail_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//                NSString* qty = [detail_json valueForKey:@"quantity_available"];
-//                self.labelQueryQTY.text = [NSString stringWithFormat:@"Current Available QTY: %@",qty];
-//               // self.detailTable.hidden = false;
-//
-//
-//            }
-//            else
-//
-//                {
-//                    self.labelQueryQTY.text=@"Tap Refresh to query current QTY";
-//                    [RAUtils message_alert:[detail_json valueForKey:@"err_msg"] title:@"Request Available QTY"/*@"Loading Model Detail Failed."*/ controller:self] ;
-//                }
-//
-//
-//
-//        });
-//    });
+
 }
 - (IBAction)QTYPercentageValueChanged:(id)sender {
     UISwitch * switchqty =(UISwitch*)sender;
@@ -223,13 +201,11 @@
     
     if([self.editDiscount.text floatValue]>100.0)
     {
-        //        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Discount error" message:@"Discount must less than 100" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-        //
-        //
-        //        [alert show];
+
         
-        [RAUtils message_alert:@"Percentage must less than 100." title:@"Input Error" controller:self];
-//        [RAUtils alert_view:@"Percentage must less than 100." title:@"Input Error"];
+        [RAUtils message_box:@"Input Error" message:@"Percentage must less than 100." completion:nil];
+        
+
         
         self.editDiscount.text=@"0";
         
@@ -237,13 +213,10 @@
     }
     if([self.editQTY.text floatValue]>100.0 && self.switchQTY.isOn)
     {
-        //        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Discount error" message:@"Discount must less than 100" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-        //
-        //
-        //        [alert show];
+
         
-        [RAUtils message_alert:@"Percentage must less than 100." title:@"Input Error" controller:self];
-//        [RAUtils alert_view:@"Percentage must less than 100." title:@"Input Error"];
+        [RAUtils message_box:@"Input Error" message:@"Percentage must less than 100." completion:nil];
+
         
         self.editDiscount.text=@"0";
         
@@ -441,12 +414,9 @@
         
         if([textField.text floatValue]>100.0)
         {
-            //            UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Discount error" message:@"Discount must less than 100" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-            //            //        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
-            //            [alert show];
-            
+
             
-            [RAUtils message_alert:@"Percentage must less than 100." title:@"Input Error" controller:self];
+            [RAUtils message_box:@"Input Error" message:@"Percentage must less than 100." completion:nil];
 //            [RAUtils alert_view:@"Percentage must less than 100." title:@"Input Error."];
             textField.text=@"0";
         }
@@ -467,34 +437,6 @@
     
     [self update_newprice];
     
-    //    UITableViewCell *cell = (UITableViewCell *) textField.superview.superview;
-    //    NSIndexPath *   indexPath = [self.editorTable indexPathForCell:cell];
-    //
-    //
-    //    NSMutableDictionary* section_json=nil;
-    //
-    //
-    //    //    DebugLog(@"endedit %d_%d",indexPath.section,indexPath.row);
-    //    NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
-    //
-    //
-    //    [item_json setValue:@"true" forKey:@"dirty"];
-    //    [item_json setValue:textField.text forKey:@"value"];
-    //    section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
-    //    int count=0;
-    //
-    //    count=[[section_json valueForKey:@"count"] intValue];
-    //
-    //    for(int i=0;i<count;i++)
-    //    {
-    //        NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",i ]];
-    //        if([[olditem valueForKey:@"name"] isEqualToString:[item_json valueForKey:@"name" ]])
-    //            [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",i ]];
-    //        
-    //        
-    //    }
-    //    
-    //    [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
 }
 
 - (void)textFieldDidBeginEditing:(UITextField *)textField

+ 12 - 101
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioListViewController.m

@@ -218,7 +218,9 @@
                       }
                       else
                       {
-                          [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Portfilio List" controller:self] ;
+
+                          
+                          [RAUtils message_box:@"Loading Portfilio List" message:[content valueForKey:@"err_msg"] completion:nil];
                       }
                       
                       
@@ -227,78 +229,6 @@
         }];
         
         return;
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//        
-//        
-//        
-//        
-//        
-//        NSMutableDictionary* content=nil;
-//        content=[[RANetwork request_PDFList:self.offset limit : self.limit keywords:self.keywords] mutableCopy];
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            
-//            
-//            
-//            
-//            
-//            [self.mum stopAnimating];
-//            
-//            int result=[[content valueForKey:@"result"] intValue];
-//            
-//            if(result==2||result==0)
-//            {
-//                self.table.hidden =false;
-//                
-//                int count = [[content valueForKey:@"count" ] intValue] ;
-//                
-//                
-//               // self.time_zone = [content valueForKey:@"time_zone" ];
-//                self.offset += count;
-//                for(int i=0;i<count;i++)
-//                {
-//                    
-//                    NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-//                    [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
-//                    DebugLog(@"content_data: %@",self.content_data);
-//                }
-//                if(count<self.limit)
-//                {
-//                    
-//                    //                    int i =self.btnrefresh.state;
-//                    self.load_more_hint=@"All loaded";
-//                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
-//                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
-//                }
-//                else
-//                {
-//                    self.load_more_hint=@"Load more...";
-//                    //                    self.btnrefresh.enabled = true;
-//                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
-//                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
-//                }
-//                
-//                
-//                
-//                [self.table reloadData ];
-//            }
-//            else if(result==RESULT_NET_ERROR)
-//            {
-//                self.label_net_err.hidden=false;
-//                self.table.hidden=true;
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Portfilio List" controller:self] ;
-//            }
-//            
-//            
-//           
-//            self.isrefreshing=false;
-//            
-//            
-//        });
-//            
-//        });
     });
 }
 
@@ -708,12 +638,15 @@
             
             
             UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Remove Portfilio" completion:^{
+//                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Remove Portfilio" completion:^{
+                
+                PopWaitAlert* pop = [RAUtils waiting_pop:@"Remove Portfilio" completion:nil];
                     [RANetwork request_removeportfoliopdf:listid completionHandler:^(NSMutableDictionary *result) {
                                         NSMutableDictionary* cart_json = result;
                                         
                                         
-                                        [waitalert dismissViewControllerAnimated:YES completion:nil];
+//                                        [waitalert dismissViewControllerAnimated:YES completion:nil];
+                        [pop hide];
                     //                    [waitalert dismissViewControllerAnimated:YES completion:nil];
                                         
                                         if([[cart_json valueForKey:@"result"] intValue]==2)
@@ -723,7 +656,9 @@
                                         }
                                         else
                                         {
-                                            [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Portfolio" controller:self] ;
+
+                                            
+                                            [RAUtils message_box:@"Delete Portfolio" message:[cart_json valueForKey:@"err_msg"] completion:nil];
                                         }
                                         
                                         
@@ -731,31 +666,7 @@
                                         
                                     }];
 
-                }];
-                
-                                
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//                    
-//                    NSMutableDictionary* cart_json =[RANetwork delete_portfoliolist:listid];
-//                    
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//                        
-//                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//                        
-//                        if([[cart_json valueForKey:@"result"] intValue]==2)
-//                        {
-//                            
-//                            [self ReloadData];
-//                        }
-//                        else
-//                        {
-//                            [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Portfolio" controller:self] ;
-//                        }
-//                        
-//                        
-//                        
-//                    });
-//                });
+//                }];
                 
                 
             }];

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 102 - 784
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m


+ 32 - 464
RedAnt ERP Mobile/common/Functions/portfolio/TearSheetParamViewController.m

@@ -284,12 +284,15 @@
     
     
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Processing" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Processing" completion:^{
+    
+    PopWaitAlert * pop = [RAUtils waiting_pop:@"Processing" completion:nil];
         [RANetwork request_portfoliopreview:upparams completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary* editor_json = result;
 
                 //            [waitalert dismissViewControllerAnimated:YES completion:nil];
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                     if([[editor_json valueForKey:@"result"] intValue]==2)
                     {
                         //                    NSMutableDictionary * customerInfo=[self create_cusromer_info_from_table];
@@ -379,14 +382,19 @@
                                                 [upparams setValue:internal_note forKey:@"pdfNote"];
                                                 [upparams setValue:del_ids forKey:@"itemIds"];
                                                 [upparams setValue:pdf_url forKey:@"configureParams"];
-                            __block UIAlertController * waitalert_save = [RAUtils waiting_alert:self title:@"Saving..." completion:^{
+//                            __block UIAlertController * waitalert_save = [RAUtils waiting_alert:self title:@"Saving..." completion:^{
+                            
+                            PopWaitAlert * pop = [RAUtils waiting_pop:@"Saving..." completion:nil];
                                 [RANetwork request_save_portfolio:upparams completionHandler:^(NSMutableDictionary *result) {
                                                         
                                                         NSDictionary* json =result;
-                                                        [waitalert_save dismissViewControllerAnimated:YES completion:^{
+//                                                        [waitalert_save dismissViewControllerAnimated:YES completion:^{
+                                    
+                                    [pop hide];
                                                             if([[json valueForKey:@"result"] intValue]==2)
                                                             {
-                                                                [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
+
+                                                                [RAUtils message_box:@"Portfolio" message:@"Portfolio saved. You can find it from View Portfolios" completion:nil];
                                                                 //                                [RAUtils alert_view:nil title: ] ;
                                                                 
                                                                 [self.navigationController dismissViewControllerAnimated:true completion:^{
@@ -405,73 +413,22 @@
                                                             }
                                                             else
                                                             {
-                                                                [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
+
+                                                                [RAUtils message_box:@"Save Portfolio" message:[json valueForKey:@"err_msg"] completion:nil];
                                                             }
-                                                        }];
+//                                                        }];
                                                         
                                                         
                                                         
                                                         
                                                     }];
 
-                            }];
+//                            }];
                             
         
                             
                                                         
                             
-                            //                    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                            //
-                            //
-                            //#ifdef OFFLINE_MODE
-                            //                        if (appDelegate.offline_mode)
-                            //                        {
-                            //                            [upparams setValue:url forKey:@"pdfPath"];
-                            //                        }
-                            //                        else
-                            //#endif
-                            //                        {
-                            //                            [upparams setValue:path forKey:@"pdfPath"];
-                            //                        }
-                            //                        [upparams setValue:name forKey:@"pdfName"];
-                            //                        [upparams setValue:internal_note forKey:@"pdfNote"];
-                            //                        [upparams setValue:del_ids forKey:@"itemIds"];
-                            //                        [upparams setValue:pdf_url forKey:@"configureParams"];
-                            //
-                            //
-                            //
-                            //                        NSDictionary* json = [RANetwork save_TearSheet:upparams];
-                            //
-                            //                        dispatch_async(dispatch_get_main_queue(), ^{
-                            //                            [waitalert dismissViewControllerAnimated:YES completion:nil];
-                            //
-                            //
-                            //                            if([[json valueForKey:@"result"] intValue]==2)
-                            //                            {
-                            //                                [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
-                            ////                                [RAUtils alert_view:nil title: ] ;
-                            //
-                            //                                [self.navigationController dismissViewControllerAnimated:true completion:^{
-                            //
-                            //
-                            //
-                            //#ifdef RA_NOTIFICATION
-                            //                                    [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-                            //#else
-                            //                                    [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
-                            //                                     [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
-                            //#endif
-                            //                                    //                                            if(self.onDismiss)
-                            //                                    //                                                self.onDismiss(catelog_name);
-                            //                                }];
-                            //                            }
-                            //                            else
-                            //                            {
-                            //                                [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
-                            //                            }
-                            //
-                            //                        });
-                            //                    });
                             
                             
                             
@@ -496,9 +453,9 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Portfolio" controller:self] ;
+                        [RAUtils message_box:@"Create Portfolio" message:[editor_json valueForKey:@"err_msg"] completion:nil];
                     }
-                }];
+//                }];
 
 
 
@@ -510,230 +467,7 @@
 
             }];
 
-    }];
-        
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* editor_json = [RANetwork request_TearSheet:upparams];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//
-//            if([[editor_json valueForKey:@"result"] intValue]==2)
-//            {
-//                //                    NSMutableDictionary * customerInfo=[self create_cusromer_info_from_table];
-//
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                NSString* url = [editor_json valueForKey:@"pdf_path"];
-//                NSString* path = [editor_json valueForKey:@"pdf_real_path"];
-//                bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
-//                RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
-//                ViewController.url = url;
-//                ViewController.canSave = true;
-//                ViewController.isLocalfile=isLocalFile;
-//                //                    ViewController.mail_content = [self.content_data valueForKey:@"email_content"];
-//                ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
-//                ViewController.save_name =catelog_name;
-//                ViewController.save_note =internal_note;
-//                //ViewController.filename = catelog_name;
-//                NSString* company=    [appDelegate.customerInfo valueForKey:@"customer_name"];
-//
-//                if(company==nil)
-//                    company=@"";
-//                //                    NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
-//
-//
-//                //                    NSMutableArray* send_to = [[NSMutableArray alloc]init];
-//                //                    if(customer_email.length>0)
-//                //                        [send_to addObject:customer_email];
-//                //                    ViewController.mail_to = send_to;
-//
-//
-//
-//                //  AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
-//
-//
-//                NSMutableArray* send_to = [[NSMutableArray alloc]init];
-//                if(customer_email.length>0)
-//                {
-//                    send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
-//                    //                            customer_email compo
-//                    //                            [send_to addObject:customer_email];
-//                }
-//                ViewController.mail_to = send_to;
-//
-//                NSString* subject;
-//                //                    if (company.length==0) {
-//
-//       //         NSString* cur_time =[RAUtils current_date];
-//                subject =catelog_name;//[NSString stringWithFormat:@"NPD Product List %@",cur_time];
-//
-//
-//
-//                //                    }
-//                //                    else
-//                //                    {
-//                //                        subject = [NSString stringWithFormat:@"Tear sheet for %@",company ];
-//                //                    }
-////                ViewController.attachment_name = [NSString stringWithFormat:@"%@.pdf",catelog_name];//[NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
-//                ViewController.mail_subject = subject;
-//
-//                //                    ViewController.onLoadSuccess =^(NSString* url)
-//                //                    {
-//                //
-//                //                    };
-//
-//
-//                ViewController.onSavePDF=^(NSString* name,NSString* file)
-//                {
-//
-//
-//                    NSString* del_ids = nil;
-//                    if(bremove)
-//                        del_ids=[self.params valueForKey:@"item_ids"];
-//
-//                    UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving..."];
-//
-//
-//                    #ifdef OFFLINE_MODE
-//                                            if (appDelegate.offline_mode)
-//                                            {
-//                                                [upparams setValue:url forKey:@"pdfPath"];
-//                                            }
-//                                            else
-//                    #endif
-//                                            {
-//                                                [upparams setValue:path forKey:@"pdfPath"];
-//                                            }
-//                                            [upparams setValue:name forKey:@"pdfName"];
-//                                            [upparams setValue:internal_note forKey:@"pdfNote"];
-//                                            [upparams setValue:del_ids forKey:@"itemIds"];
-//                                            [upparams setValue:pdf_url forKey:@"configureParams"];
-//
-//                    [RANetwork request_save_portfolio:upparams completionHandler:^(NSMutableDictionary *result) {
-//
-//                        NSDictionary* json =result;
-//                        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//                        if([[json valueForKey:@"result"] intValue]==2)
-//                        {
-//                            [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
-//                            //                                [RAUtils alert_view:nil title: ] ;
-//
-//                            [self.navigationController dismissViewControllerAnimated:true completion:^{
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                                [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                                [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
-//                                [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
-//#endif
-//                                //                                            if(self.onDismiss)
-//                                //                                                self.onDismiss(catelog_name);
-//                            }];
-//                        }
-//                        else
-//                        {
-//                            [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
-//                        }
-//
-//                    }];
-//
-//
-////                    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-////
-////
-////#ifdef OFFLINE_MODE
-////                        if (appDelegate.offline_mode)
-////                        {
-////                            [upparams setValue:url forKey:@"pdfPath"];
-////                        }
-////                        else
-////#endif
-////                        {
-////                            [upparams setValue:path forKey:@"pdfPath"];
-////                        }
-////                        [upparams setValue:name forKey:@"pdfName"];
-////                        [upparams setValue:internal_note forKey:@"pdfNote"];
-////                        [upparams setValue:del_ids forKey:@"itemIds"];
-////                        [upparams setValue:pdf_url forKey:@"configureParams"];
-////
-////
-////
-////                        NSDictionary* json = [RANetwork save_TearSheet:upparams];
-////
-////                        dispatch_async(dispatch_get_main_queue(), ^{
-////                            [waitalert dismissViewControllerAnimated:YES completion:nil];
-////
-////
-////                            if([[json valueForKey:@"result"] intValue]==2)
-////                            {
-////                                [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
-//////                                [RAUtils alert_view:nil title: ] ;
-////
-////                                [self.navigationController dismissViewControllerAnimated:true completion:^{
-////
-////
-////
-////#ifdef RA_NOTIFICATION
-////                                    [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-////#else
-////                                    [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
-////                                     [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
-////#endif
-////                                    //                                            if(self.onDismiss)
-////                                    //                                                self.onDismiss(catelog_name);
-////                                }];
-////                            }
-////                            else
-////                            {
-////                                [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
-////                            }
-////
-////                        });
-////                    });
-//
-//
-//
-//                };
-//
-//                //    ViewController. = self.function_name;
-//                //    ViewController.behavior =BEHAVIOR_SEARCH;
-//                ViewController.hidenavi = false;
-//                [self.navigationController pushViewController:ViewController animated:YES];
-//              //  [[self navigationController] setNavigationBarHidden:NO animated:NO];
-//
-//
-//                /*
-//                 if(self.return_url)
-//                 self.return_url(url,path,bremove);
-//                 [self.navigationController dismissViewControllerAnimated:true completion:^{
-//                 if(self.onDismiss)
-//                 self.onDismiss(catelog_name);
-//                 }];
-//                 */
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Portfolio" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
-    
-    
+
     
     
 }
@@ -742,127 +476,7 @@
     // add params check here.
     [self.lastedit endEditing:true];
     [self.lasttextview endEditing:true];
-//    self.cancommit=true;
-//    NSMutableDictionary* upparams=[[NSMutableDictionary alloc] init];
-//    //  [upparams setValue:[self.params valueForKey:@"cart2Checkbox"] forKey:@"cart2Checkbox"];
-//    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
-//    for(int i=0;i<section_count;i++)
-//    {
-//        NSMutableDictionary * sectionjson = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i ]] mutableCopy];
-//        int item_count = [[sectionjson valueForKey:@"count"] intValue];
-//        for(int j=0;j<item_count;j++)
-//        {
-//            NSMutableDictionary * itemjson=[[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j ]] mutableCopy];
-//            NSString* key = [itemjson valueForKey:@"name"];
-//            if(key==nil || key.length==0)
-//                continue;
-//            if([[itemjson valueForKey:@"control"] isEqualToString:@"enum"])
-//            {
-//                NSString* single_select = [itemjson valueForKey:@"single_select"];
-//                if([single_select isEqualToString:@"true"])
-//                {
-//                    NSDictionary* cadejson=[itemjson objectForKey:@"cadedate"];
-//                    int count = [[cadejson valueForKey:@"count"] intValue];
-//                    bool setvalue = false;
-//                    for(int cc=0;cc<count;cc++)
-//                    {
-//                        NSDictionary* valjson=[cadejson objectForKey:[NSString stringWithFormat:@"val_%d",cc]];
-//                        if([[valjson valueForKey:@"check"]intValue]==1)
-//                        {
-//                            [upparams setValue:[valjson valueForKey:@"value_id"] forKey:[itemjson valueForKey:@"name"]];
-//                            setvalue=true;
-//                            break;
-//                        }
-//                    }
-//                    if([[itemjson valueForKey:@"required"] isEqualToString: @"true"] && setvalue==false)
-//                    {
-//                        self.cancommit = false;
-//                    }
-//                }
-//                else
-//                {
-//                    //not support multi select for now;
-//                }
-//                /*
-//                 upparams setValue:itemjson forKey:<#(NSString *)#>
-//                 
-//                 */
-//            }else
-//                if([[itemjson valueForKey:@"control"] isEqualToString:@"action"])
-//                {
-//                    if([[itemjson valueForKey:@"required"] isEqualToString: @"true"] && [itemjson objectForKeyedSubscript:@"data"]==nil)
-//                        self.cancommit = false;
-//                }
-//                else if([[itemjson valueForKey:@"control"] isEqualToString:@"switch"])
-//                {
-//                    NSString* valuestr = [itemjson valueForKey:@"value"];
-//                    [upparams setValue:valuestr forKey:[itemjson valueForKey:@"name"]];
-//                    
-//                    NSString* value = [itemjson valueForKey:@"value"];
-//                    NSMutableDictionary* boolitem=nil;
-//                    NSMutableDictionary* subjson=nil;
-//                    if([value isEqualToString:@"true"])
-//                    {
-//                        boolitem =[[itemjson objectForKey:@"true"] mutableCopy];
-//                        
-//                    }
-//                    else
-//                    {
-//                        boolitem =[[itemjson objectForKey:@"false"] mutableCopy];
-//                        
-//                    }
-//                    subjson=[[boolitem objectForKey:@"sub_item"] mutableCopy];
-//                    if( subjson!=nil /*&& !active*/)
-//                    {
-//                        int sub_count = [[subjson valueForKey:@"count"] intValue];
-//                        for(int l=0;l<sub_count;l++)
-//                        {
-//                            NSMutableDictionary * modify_item=[[subjson objectForKey:[NSString stringWithFormat:@"item_%d",l ]] mutableCopy];
-//                            
-//                            
-//                            
-//                            
-//                            if([modify_item valueForKey:@"value"]!=nil && ![[modify_item valueForKey:@"value"]isEqualToString:@""])
-//                                [upparams setValue:[modify_item valueForKey:@"value"] forKey:[modify_item valueForKey:@"name"]];
-//                            else
-//                            {
-//                                if([[modify_item valueForKey:@"required"] isEqualToString: @"true"] )
-//                                    self.cancommit = false;
-//                            }
-//                        }
-//                        
-//                        
-//                        
-//                    }
-//                }
-//                else
-//                {
-//                    if([itemjson valueForKey:@"value"]!=nil && ![[itemjson valueForKey:@"value"]isEqualToString:@""])
-//                        [upparams setValue:[itemjson valueForKey:@"value"] forKey:[itemjson valueForKey:@"name"]];
-//                    else
-//                    {
-//                        if([[itemjson valueForKey:@"required"] isEqualToString: @"true"] )
-//                            self.cancommit = false;
-//                    }
-//                }
-//            upparams= [self subitem_param:itemjson addto:upparams ];
-//        }
-//    }
-//    if(self.cancommit==false)
-//    {
-////        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Some requried field is missing" message:@"Fields with * mark can not be empty." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-////        //UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
-////        [alert show];
-//        
-//        [RAUtils alert_view:@"Fields with * mark cannot be empty." title:@"Some Requried Fields Are Missing."];
-//        self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
-//        //DebugLog(@"CONTENT translate:%@",[iSalesNetwork DataTOjsonString:self.content_data]);
-//        //[self.editorTable reloadData ];
-//        [self.editorTable reloadData];
-//        return;
-//    }
-    
-    
+
     
     NSMutableDictionary* upparams = [self check_cancommit:true];
     if(self.cancommit==false)
@@ -955,7 +569,7 @@
         UITextField *name = alertControl.textFields.firstObject;
         if(name.text.length==0)
         {
-            [RAUtils message_alert:@"Cannot save without name. Save canceled." title:@"Name is missing" controller:self];
+            [RAUtils message_box:@"Name is missing" message:@"Cannot save without name. Save canceled." completion:nil];
         }
         else
         {
@@ -966,10 +580,13 @@
                        [upparams setValue:del_ids forKey:@"itemIds"];
                        [upparams setValue:saveNote forKey:@"pdfNote"];
             
-            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Processing" completion:^{
+//            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Processing" completion:^{
+            
+            PopWaitAlert * pop = [RAUtils waiting_pop:@"Processing" completion:nil];
                 [RANetwork request_save_portfoliodirectly:upparams completionHandler:^(NSMutableDictionary *result) {
                                 NSDictionary* editor_json =result;
-                                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                                [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                                     if([[editor_json valueForKey:@"result"] intValue]==2)
                                     {
                                         
@@ -999,9 +616,11 @@
                                     }
                                     else
                                     {
-                                        [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Portfolio" controller:self] ;
+
+                                        
+                                        [RAUtils message_box:@"Create Portfolio" message:[editor_json valueForKey:@"err_msg"] completion:nil];
                                     }
-                                }];
+//                                }];
                                 
                                 
                                 
@@ -1011,60 +630,9 @@
                                 
                             }];
 
-            }];
+//            }];
            
                         
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//
-//                [upparams setValue:pdf_url forKey:@"pdfUrl"];
-//                [upparams setValue:saveName forKey:@"pdfName"];
-//                [upparams setValue:del_ids forKey:@"itemIds"];
-//                [upparams setValue:saveNote forKey:@"pdfNote"];
-//
-//                NSDictionary* editor_json = [RANetwork direct_save_TearSheet:upparams];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//                    if([[editor_json valueForKey:@"result"] intValue]==2)
-//                    {
-//
-//
-//
-//
-//                     //   [RAUtils alert_view:nil title:@"Portfolio saved. You can find it from View Portfolios" ] ;
-//                        NSString* url = [editor_json valueForKey:@"pdf_path"];
-//                        bool isLocalFile = [editor_json valueForKey:@"isLocalFile"];
-//                        [self.navigationController dismissViewControllerAnimated:true completion:^{
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                            [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                            [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
-//                            [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
-//
-//#endif
-//
-//                            if(self.onSaved)
-//                                self.onSaved(url,saveName,isLocalFile);
-//                        }];
-//
-//                    }
-//                    else
-//                    {
-//                        [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Portfolio" controller:self] ;
-//                    }
-//
-//
-//
-//
-//                });
-//            });
 
         }
     }];

+ 74 - 647
RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m

@@ -361,18 +361,8 @@
 }
 - (IBAction)onFilterClicked:(id)sender {
     
-    
-//    UIApplication * app = [UIApplication sharedApplication];
-    
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    
-    
-//    if(appDelegate.offline_mode)
-//    {
-//        [RAUtils message_alert:@"offline mode does not support this function." title:@"Item Search Filter" controller:self] ;
-//        
-//        return;
-//    }
+
+
 #ifndef BUILD_UWAVER
     ItemSearchFilterViewController * filterVC =[[UIStoryboard storyboardWithName:@"ERP_Mobile_Search" bundle:nil] instantiateViewControllerWithIdentifier:@"ItemSearchFilterViewController"];
 #else
@@ -460,32 +450,7 @@
 }
 -(void)viewWillLayoutSubviews
 {
-    //    if(self.showDetail==true)
-    //    {
-    //        UIInterfaceOrientation orientation =[UIApplication sharedApplication].statusBarOrientation;
-    //        int width=175;
-    //        // int height;
-    //        if(orientation == UIDeviceOrientationLandscapeLeft ||orientation == UIDeviceOrientationLandscapeRight)
-    //        {
-    //            width = 370;
-    //            //      height = 400;
-    //        }
-    //        else
-    //        {
-    //            //      height = 300;
-    //            width = 175;
-    //        }
-    //
-    //
-    //        CGRect frame = CGRectMake(0, 64, width, self.view.bounds.size.height-64);
-    //
-    //        self.collectionview.frame=frame;
-    //
-    //
-    //
-    //        CGRect framedetail = CGRectMake(width,64 ,self.view.bounds.size.width-width,self.view.bounds.size.height-64);
-    //        self.detailView.frame = framedetail;
-    //    }
+
     
     
     self.headerView.layer.shadowPath =[UIBezierPath bezierPathWithRect:self.headerView.bounds].CGPath;
@@ -553,7 +518,8 @@
             if(self.showalert)
             {
                 self.showalert=false;
-            [RAUtils message_alert:@"All loaded" title:@"Loading items" controller:self] ;
+
+                [RAUtils message_box:@"Loading items" message:@"All loaded" completion:nil];
             }
             return;
             
@@ -610,105 +576,12 @@
             }
             else
             {
-                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+                
+                [RAUtils message_box:@"Search" message:[category_more valueForKey:@"err_msg"] completion:nil];
             }
             
             
         }];
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//
-//        NSDictionary* category_more=[RANetwork ItemSearch:self.offset limit:20 covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller
-//                                     ];
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [self.mum stopAnimating];
-//            self.isrefreshing=false;
-//            if (self.dataOperationQueue.operationCount > 1) {
-//                return ;
-//            }
-//            NSDictionary* more_items=[category_more objectForKey:@"items"];
-//            if([[category_more valueForKey:@"result"] intValue]==2)
-//            {
-//                //  self.category_data = category_data;
-//                NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-//
-//                int count =[[more_items valueForKey:@"count"] intValue];
-//                for(int i=0;i<count;i++)
-//                {
-//
-//                    NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-//                    [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-//
-//
-//                }
-//                long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
-//                [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
-//                [self.category_data setObject:items_json forKey:@"items"];
-//                self.offset+=count;
-//
-//                if(count<20)
-//                {
-//                    self.loadall=true;
-//
-//                }
-//
-//                //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-//
-//
-//
-//
-//        //        DebugLog(@"%@",self.category_data);
-//
-//                [self.collectionview reloadData];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Search" controller:self] ;
-//            }
-//
-//
-//        });
-//        //        dispatch_async(dispatch_get_main_queue(), ^{
-//        //            //  self.category_data = category_data;
-//        //
-//        //
-//        //            if([[category_more valueForKey:@"result"] intValue]==2)
-//        //            {
-//        //                NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-//        //
-//        //                int count =[[category_more valueForKey:@"count"] intValue];
-//        //                for(int i=0;i<count;i++)
-//        //                {
-//        //
-//        //                    NSDictionary * item_json = [category_more objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-//        //                    [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-//        //
-//        //
-//        //                }
-//        //                long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
-//        //                [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
-//        //                [self.category_data setObject:items_json forKey:@"items"];
-//        //                self.offset+=count;
-//        //                //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-//        //
-//        //
-//        //
-//        //
-//        //                DebugLog(@"%@",self.category_data);
-//        //
-//        //                [self.collectionview reloadData];
-//        //            }
-//        //            else
-//        //            {
-//        //                [RAUtils error_alert:[category_more valueForKey:@"err_msg"]] ;
-//        //            }
-//        //
-//        //
-//        //
-//        //
-//        //        });
-//    });
     });
 }
 
@@ -784,53 +657,13 @@
            }
            else
            {
-               [RAUtils message_alert:[category_data valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+               
+               [RAUtils message_box:@"Search" message:[category_data valueForKey:@"err_msg"]  completion:nil];
            }
            
            
            
          }];
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* category_data=[RANetwork ItemSearch:0 limit:20 covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller
-//                                                             ];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [self.mum stopAnimating];
-//            self.isrefreshing=false;
-//            if (self.dataOperationQueue.operationCount > 1) {
-//                return ;
-//            }
-//
-//            self.category_data = [category_data mutableCopy];
-//            [self.collectionview reloadData];
-//            if([[category_data valueForKey:@"result"] intValue]==2)
-//            {
-//                self.collectionview.hidden = false;
-//                NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-//                self.offset =[[item_json valueForKey:@"count"] intValue];
-//
-//                int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
-//
-//                if(total<2)
-//                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
-//                else
-//                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
-//            }
-//            else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-//            {
-//                self.label_net_err.hidden=false;
-//                self.collectionview.hidden = true;
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[category_data valueForKey:@"err_msg"] title:@"Search" controller:self] ;
-//            }
-//
-//
-//
-//          });
-//        });
     });
 }
 
@@ -857,16 +690,7 @@
  // Pass the selected object to the new view controller.
  }
  */
-//- (void)reload_container
-//{
-//    
-//    
-//   // self.keywords=nil;
-//    self.offset = 0;
-//    //  [self.content_data removeAllObjects];
-//    [self reload];
-//    DebugLog(@"search");
-//}
+
 - (IBAction)onChangeDisplay:(UIButton *)sender {
     UICollectionViewFlowLayout *flowLayout =(UICollectionViewFlowLayout*)[self.collectionview collectionViewLayout];
     
@@ -1063,11 +887,14 @@
 -(void) neworder
 {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
             NSMutableDictionary* return_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 if([[return_json valueForKey:@"result"] intValue]==2)
                 {
                     int result=[[return_json valueForKey:@"result"] intValue];
@@ -1082,30 +909,14 @@
                         
                         [self addtocart];
                         
-                        
-                        //    [self ReloadData];
-                        
-                        
-                        //                    if(self.shopCartBlock!=nil)
-                        //                    {
-                        //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-                        //
-                        //
-                        //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-                        //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-                        //                        iv.image = img;
-                        //                        //                        [self.contentView addSubview:iv];
-                        //                        self.shopCartBlock(iv);
-                        //
-                        //                    }
-                        
+
                     }
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                 }
-            }];
+//            }];
             
             
             
@@ -1116,58 +927,8 @@
             
         }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = [RANetwork new_Order];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//                int result=[[return_json valueForKey:@"result"] intValue];
-//                if(result==2)
-//                {
-//                    //successed.
-//
-//                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    appDelegate.order_code = order_code;
-//
-//
-//                    [self addtocart];
-//
-//
-//                    //    [self ReloadData];
-//
-//
-//                    //                    if(self.shopCartBlock!=nil)
-//                    //                    {
-//                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-//                    //
-//                    //
-//                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-//                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-//                    //                        iv.image = img;
-//                    //                        //                        [self.contentView addSubview:iv];
-//                    //                        self.shopCartBlock(iv);
-//                    //
-//                    //                    }
-//
-//                }
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
+//    }];
+
 }
 - (IBAction)onAddPortfolioClick:(id)sender {
     UIApplication * app = [UIApplication sharedApplication];
@@ -1291,41 +1052,33 @@
     }
     
     if (!count) {
-        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to cart." controller:self] ;
+        [RAUtils message_box:@"Cannot Add to cart." message:@"There is no model." completion:nil] ;
         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_box:@"Cannot Add to cart." message:@"You must select at least one model." completion:nil] ;
         return;
     }
 
     
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addCartBtn.enabled = false;
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Cart" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Cart" completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Add Models To Cart" completion:nil];
             if (self.addAll) {
                 AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
                 
                 [RANetwork request_addall_itemsearch:self.offset limit:PAGE_ITEM covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller orderCode:appDelegate.order_code addTo:@"cart" completionHandler:^(NSMutableDictionary *result) {
                             NSDictionary* return_json =result;
-                    [waitalert dismissViewControllerAnimated:YES completion:^{
+//                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                         self.addCartBtn.enabled = true;
                         
                         if([[return_json valueForKey:@"result"] intValue]==2)
                         {
-                            //                int result=[[return_json valueForKey:@"result"] intValue];
-                            //                if(result==2)
-                            //                {
-                            //                    //successed.
-                            
-                            //             NSString* order_code = [return_json valueForKey:@"order_code"];
-                            
-                            //                    appDelegate.order_code = order_code;
-                            //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                            //                appDelegate.order_code = order_code;
-                            
+
                             
         #ifdef RA_NOTIFICATION
                             [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
@@ -1356,7 +1109,7 @@
                             }
                             
                             
-                            [RAUtils message_alert:nil title:msg controller:self] ;
+                            [RAUtils message_box:msg message:nil completion:nil] ;
                             
                             [self end_select:4];
                             
@@ -1377,13 +1130,13 @@
         #endif
                             
                             [self end_select:4];
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                            [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                         }
                         else
                         {
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                            [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                         }
-                    }];
+//                    }];
                             
                             
                             
@@ -1395,7 +1148,8 @@
             } else {
                 [RANetwork request_addto_cart_byname:ids withScreen:ScreenCodeParticularCategory completionHandler:^(NSMutableDictionary *result) {
                     NSDictionary* return_json =result;
-                    [waitalert dismissViewControllerAnimated:YES completion:^{
+//                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                         self.addCartBtn.enabled = true;
                         
                         if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1441,7 +1195,7 @@
                             }
                             
                             
-                            [RAUtils message_alert:nil title:msg controller:self] ;
+                            [RAUtils message_box:msg message:nil completion:nil] ;
                             
                             [self end_select:2];
                             
@@ -1462,13 +1216,13 @@
         #endif
                             
                             [self end_select:2];
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                            [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                         }
                         else
                         {
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+                            [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                         }
-                    }];
+//                    }];
                     
                     
                     
@@ -1479,114 +1233,17 @@
                 
                 
             }
-    }];
+//    }];
 
 
-    
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = nil;
-//        if (self.addAll) {
-//            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-//            return_json = [RANetwork ItemSearch_addall:self.offset limit:20 covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller orderCode:appDelegate.order_code addTo:@"cart"];
-//        } else {
-//            return_json = [RANetwork add_toCart_byName:ids withScreen:ScreenCodeParticularCategory];
-//        }
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//            self.addCartBtn.enabled = true;
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-////                int result=[[return_json valueForKey:@"result"] intValue];
-////                if(result==2)
-////                {
-////                    //successed.
-//
-//       //             NSString* order_code = [return_json valueForKey:@"order_code"];
-//
-////                    appDelegate.order_code = order_code;
-////                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                appDelegate.order_code = order_code;
-//
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//#endif
-//
-//
-//                NSString * msg = nil;
-//
-//                if (self.addAll) {
-//
-//                    unsigned long checkedCount = [return_json[@"count"] integerValue];
-//
-//                    msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
-//                } else {
-//
-//
-//                    if(checked.count==1)
-//                    {
-//                        msg=@"1 item added to Cart";
-//                    }
-//                    else
-//                    {
-//                        msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
-//                    }
-//                }
-//
-//
-//                    [RAUtils message_alert:nil title:msg controller:self] ;
-//
-//                [self end_select:2];
-//
-//
-//
-////                }
-//            }
-//            else  if([[return_json valueForKey:@"result"] intValue]==8)
-//            {
-//
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//
-//                [self end_select:2];
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
 -(void) addtoportfolio
 {
     
-//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-//    if (appDelegate.offline_mode) {
-//        
-//        [RAUtils message_alert:@"offline mode does not support this function." title:@"Add to Portfolio" controller:self] ;
-//        return;
-//    }
+
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
-        [RAUtils message_alert:@"Cannot Add to portfolio." title:@"Warning" controller:self] ;
+        [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil] ;
         return;
     }
     
@@ -1607,24 +1264,28 @@
     
     
     if (!count) {
-        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to portfolio." controller:self] ;
+        [RAUtils message_box:@"Cannot Add to portfolio." message:@"There is no model." completion:nil] ;
         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_box:@"Cannot Add to portfolio." message:@"You must select at least one model." completion:nil] ;
         return;
     }
     
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addPortfolioBtn.enabled =false;
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Portfolio" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Portfolio" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Add Models To Portfolio" completion:nil];
                     if (self.addAll) {
                         [RANetwork request_addall_itemsearch:self.offset limit:PAGE_ITEM covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller orderCode:nil addTo:@"portfolio" completionHandler:^(NSMutableDictionary *result) {
                             NSDictionary* return_json = result;
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            
+                            [pop hide];
                                 self.addPortfolioBtn.enabled =true;
                                 
                                 if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1659,7 +1320,7 @@
                                         }
                                     }
                                     
-                                    [RAUtils message_alert:nil title:msg controller:self] ;
+                                    [RAUtils message_box:msg message:nil completion:nil] ;
                                     
                                     
                                     [self end_select:END_SELECT_PORTFOLIO];
@@ -1667,9 +1328,9 @@
                                 }
                                 else
                                 {
-                                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
+                                    [RAUtils message_box:@"Add To Portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                                 }
-                            }];
+//                            }];
                             
                             
                             
@@ -1680,7 +1341,8 @@
                     } else {
                         [RANetwork request_addto_portfolio:ids withScreen:ScreenCodeParticularCategory completionHandler:^(NSMutableDictionary *result) {
                             NSDictionary* return_json = result;
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            [pop hide];
                                 self.addPortfolioBtn.enabled =true;
                                 
                                 if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1715,7 +1377,7 @@
                                         }
                                     }
                                     
-                                    [RAUtils message_alert:nil title:msg controller:self] ;
+                                    [RAUtils message_box:msg message:nil completion:nil] ;
                                     
                                     
                                     [self end_select:END_SELECT_PORTFOLIO];
@@ -1723,9 +1385,9 @@
                                 }
                                 else
                                 {
-                                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
+                                    [RAUtils message_box:@"Add To Portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                                 }
-                            }];
+//                            }];
                             
                             
                             
@@ -1735,76 +1397,10 @@
                         }];
                         
                     }
-    }];
+//    }];
     
 
     
-    
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = nil;
-//        if (self.addAll) {
-////            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-//            return_json = [RANetwork ItemSearch_addall:self.offset limit:20 covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller orderCode:nil addTo:@"portfolio"];
-//        } else {
-//            return_json = [RANetwork add_toPortfolio:ids withScreen:ScreenCodeParticularCategory];
-//        }
-//
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//            self.addPortfolioBtn.enabled =true;
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
-//#endif
-//
-//                NSString * msg = nil;
-//
-//                if (self.addAll) {
-//
-//                    unsigned long checkedCount = [return_json[@"count"] integerValue];
-//
-//                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
-//                } else {
-//
-//                    if(checked.count==1)
-//                    {
-//                        msg=@"1 item added to Portfolio";
-//                    }
-//                    else
-//                    {
-//                        msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
-//                    }
-//                }
-//
-//                    [RAUtils message_alert:nil title:msg controller:self] ;
-//
-//
-//                [self end_select:3];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
 -(void) addtowish
 {
@@ -1825,13 +1421,13 @@
     }
     
     if (!count) {
-        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to Wish List." controller:self] ;
+        [RAUtils message_box:@"Cannot Add to Wish List." message:@"There is no model." completion:nil] ;
         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_box:@"Cannot Add to Wish List." message:@"You must select at least one model." completion:nil] ;
         return;
     }
     
@@ -1839,12 +1435,15 @@
     self.addWishBtn.enabled =false;
     
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Wish List" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Wish List" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Add Models To Wish List" completion:nil];
         if (self.addAll) {
             
                         [RANetwork request_addall_itemsearch:self.offset limit:PAGE_ITEM covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller orderCode:nil addTo:@"wishlist" completionHandler:^(NSMutableDictionary *result) {
                             NSDictionary* return_json = result;
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            [pop hide];
                                 self.addWishBtn.enabled =true;
                                 
                                 if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1881,7 +1480,7 @@
                                         }
                                     }
                                     
-                                    [RAUtils message_alert:nil title:msg controller:self] ;
+                                    [RAUtils message_box:msg message:nil completion:nil] ;
                                     
                                     
                                     [self end_select:3];
@@ -1889,9 +1488,9 @@
                                 }
                                 else
                                 {
-                                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
+                                    [RAUtils message_box:@"Add To Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                                 }
-                            }];
+//                            }];
                             
                             
                             
@@ -1904,7 +1503,8 @@
                         
                         [RANetwork request_addto_wishlist:ids withScreen:ScreenCodeParticularCategory completionHandler:^(NSMutableDictionary *result) {
                             NSDictionary* return_json = result;
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            [pop hide];
                                 self.addWishBtn.enabled =true;
                                 
                                 if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1941,7 +1541,7 @@
                                         }
                                     }
                                     
-                                    [RAUtils message_alert:nil title:msg controller:self] ;
+                                    [RAUtils message_box:msg message:nil completion:nil] ;
                                     
                                     
                                     [self end_select:1];
@@ -1949,9 +1549,9 @@
                                 }
                                 else
                                 {
-                                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
+                                    [RAUtils message_box:@"Add To Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
                                 }
-                            }];
+//                            }];
                             
                             
                             
@@ -1960,76 +1560,10 @@
                         }];
                         
                     }
-    }];
+//    }];
     
             
     
-    
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = nil;
-//        if (self.addAll) {
-////            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-//            return_json = [RANetwork ItemSearch_addall:self.offset limit:20 covertype:self.covertype ctgid:self.ctgid modelname:self.modelname modeldescrip:self.modeldescrip alert:self.alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller orderCode:nil addTo:@"wishlist"];
-//        } else {
-//            return_json = [RANetwork add_toWatchList:ids withScreen:ScreenCodeParticularCategory];
-//        }
-//
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            self.addWishBtn.enabled =true;
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//                [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//#endif
-//                NSString * msg = nil;
-//
-//                if (self.addAll) {
-//
-//                    unsigned long checkedCount = [return_json[@"count"] integerValue];
-//
-//                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
-//                } else {
-//
-//
-//                    if(checked.count==1)
-//                    {
-//                        msg=@"1 item added to \nWish List";
-//                    }
-//                    else
-//                    {
-//                        msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
-//                    }
-//                }
-//
-//                    [RAUtils message_alert:nil title:msg controller:self] ;
-//
-//
-//                [self end_select:1];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
 
 -(void) showCategory
@@ -2739,114 +2273,7 @@
     
 }
 
-//#pragma mark - UIAlertViewDelegate
-//// Called when a button is clicked. The view will be automatically dismissed after this call returns
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-//{
-//    UIApplication * app = [UIApplication sharedApplication];
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//    //    if(alertView.tag==1234)
-//    //    {
-//    //
-//    //        // availability warring;
-//    //
-//    //
-//    //        if(buttonIndex!=alertView.cancelButtonIndex)
-//    //        {
-//    //            if(appDelegate.order_code==nil)
-//    //            {
-//    //                [self neworder];
-//    //            }
-//    //            else
-//    //            {
-//    //                [self addtocart];
-//    //            }
-//    //        }
-//    //        return;
-//    //    }
-//    //   int count=[self.quantity_text.text intValue];
-//    
-//    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//    if(buttonIndex==alertView.cancelButtonIndex)
-//    {
-//        
-//        
-//        
-//    }
-//    else if(buttonIndex==1)
-//    {
-//        //open exist
-//        self.disable_refresh = true;
-//        OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-//        ovc.showNavibar = true;
-//        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-//            if(appDelegate.order_code==nil)
-//            {
-//                [self neworder];
-//            }
-//            else
-//            {
-//                [self addtocart];
-//                [main_vc checklogin:true];
-//                
-//            }
-//            
-//        };
-//        ovc.init_style = OL_OPEN;
-//        ovc.onCancel = ^(){
-//            self.disable_refresh = false;
-//          //  [main_vc checklogin:true];
-//            
-//        };
-//        
-//        [self.navigationController pushViewController:ovc animated:true];
-//    }
-//    else
-//    {
-//        //create new;
-//        self.disable_refresh = true;
-//        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//        {
-//            ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//            cvc.showNavibar = true;
-//            cvc.contact_type = @"Sales_Order_Customer";
-//            cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//                
-//                appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                appDelegate.customerInfo = value;
-//                
-//                
-//                if(appDelegate.order_code==nil)
-//                    [self neworder];
-//                
-//                [main_vc checklogin:true];
-//                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//                
-//                //
-//                //                if(self.returnValue)
-//                //                    self.returnValue(value);
-//            };
-//            
-//            cvc.onCancel = ^(){
-//                
-//                [RAUtils message_alert:@"Can ot create order without cursomer infomation." title:@"" controller:self];
-//                self.disable_refresh = false;
-//                
-//                
-//            };
-//            cvc.onReset = ^(){
-//                [main_vc checklogin:true];
-//            };
-//            
-//            [self.navigationController pushViewController:cvc animated:true];
-//        }
-//        else
-//        {
-//            [self neworder];
-//        }
-//        
-//    }
-//}
+
 /*
 #pragma mark - Navigation
 

+ 96 - 623
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -688,11 +688,15 @@
 {
     
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
+    
+    PopWaitAlert* pop  = [RAUtils waiting_pop:@"Create Order" completion:nil];
         [RANetwork request_create_order:^(NSMutableDictionary *result) {
             NSMutableDictionary* return_json = result;
             
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            
+            [pop hide];
                 
                 //        [waitalert dismissViewControllerAnimated:YES completion:nil];
                 
@@ -732,9 +736,10 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+//                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil] ;
+                    [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
                 }
-            }];
+//            }];
             
             
             
@@ -743,58 +748,6 @@
             
         }];
         
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-    //
-    //        NSDictionary* return_json = [RANetwork new_Order];
-    //
-    //        dispatch_async(dispatch_get_main_queue(), ^{
-    //            [waitalert dismissViewControllerAnimated:YES completion:nil];
-    //
-    //
-    //            if([[return_json valueForKey:@"result"] intValue]==2)
-    //            {
-    //                int result=[[return_json valueForKey:@"result"] intValue];
-    //                if(result==2)
-    //                {
-    //                    //successed.
-    //
-    //                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-    //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //                    appDelegate.order_code = order_code;
-    //                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-    //
-    //                    [self addtocart];
-    //
-    //
-    //                    //    [self ReloadData];
-    //
-    //
-    //                    //                    if(self.shopCartBlock!=nil)
-    //                    //                    {
-    //                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-    //                    //
-    //                    //
-    //                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-    //                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-    //                    //                        iv.image = img;
-    //                    //                        //                        [self.contentView addSubview:iv];
-    //                    //                        self.shopCartBlock(iv);
-    //                    //
-    //                    //                    }
-    //
-    //                }
-    //            }
-    //            else
-    //            {
-    //                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-    //            }
-    //
-    //
-    //
-    //
-    //        });
-    //    });
 }
 - (IBAction)onAddPortfolioClick:(id)sender {
     UIApplication * app = [UIApplication sharedApplication];
@@ -920,13 +873,14 @@
     }
     
     if (!count) {
-        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to cart." controller:self] ;
+
+        [RAUtils message_box:@"Cannot Add to cart." message:@"There is no model." completion:nil];
         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_box:@"Cannot Add to cart." message:@"You must select at least one model." completion:nil];
         return;
     }
     
@@ -934,14 +888,17 @@
     self.addCartBtn.enabled = false;
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Cart" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Cart" completion:^{
+    
+    PopWaitAlert* pop  = [RAUtils waiting_pop:@"Add Models To Cart" completion:nil];
         if (self.addAll)
         {
             [RANetwork request_addall_search:self.offset limit:PAGE_ITEM keywords:self.keywords matchfull:self.loadmore_matchfull orderCode:appDelegate.order_code addTo:@"cart" completionHandler:^(NSMutableDictionary *result) {
                 {
                     
                     NSDictionary* return_json=result;
-                    [waitalert dismissViewControllerAnimated:YES completion:^{
+//                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                    [pop hide];
                         self.addCartBtn.enabled = true;
                         
                         if([[return_json valueForKey:@"result"] intValue]==2)
@@ -975,7 +932,8 @@
                                 }
                             }
                             
-                            [RAUtils message_alert:nil title:msg controller:self] ;
+
+                            [RAUtils message_box:msg message:nil completion:nil];
                             
                             [self end_select:4];
                             
@@ -996,13 +954,15 @@
                             [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
 #endif
                             [self end_select:4];
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+
+                            [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
                         }
                         else
                         {
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+
+                            [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
                         }
-                    }];
+//                    }];
                     
                     
                     
@@ -1018,7 +978,8 @@
             [RANetwork request_addto_cart_byname:ids withScreen:ScreenCodeSearch completionHandler:^(NSMutableDictionary *result) {
                 
                 NSDictionary* return_json=result;
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                [pop hide];
                     self.addCartBtn.enabled = true;
                     
                     if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1052,8 +1013,8 @@
                             }
                         }
                         
-                        [RAUtils message_alert:nil title:msg controller:self] ;
-                        
+
+                        [RAUtils message_box:msg message:nil completion:nil];
                         [self end_select:2];
                         
                         
@@ -1073,14 +1034,16 @@
                         [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
 #endif
                         [self end_select:2];
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+
+                        [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
+
+                        [RAUtils message_box:@"Add To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
                     }
                     
-                }];
+//                }];
                 
                 
                 
@@ -1089,105 +1052,17 @@
                 
             }];
         }
-    }];
+//    }];
+    
     
     
     
     
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-    //
-    //        NSDictionary* return_json = nil;
-    //        if (self.addAll) {
-    //            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    //            return_json = [RANetwork Search_addall:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull orderCode:appDelegate.order_code addTo:@"cart"];
-    //        } else {
-    //            return_json = [RANetwork add_toCart_byName:ids withScreen:ScreenCodeSearch];
-    //        }
-    //
-    //
-    //        dispatch_async(dispatch_get_main_queue(), ^{
-    //
-    ////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-    //            [waitalert dismissViewControllerAnimated:YES completion:nil];
-    //
-    //
-    //            self.addCartBtn.enabled = true;
-    //
-    //            if([[return_json valueForKey:@"result"] intValue]==2)
-    //            {
-    //
-    //
-    //
-    //#ifdef RA_NOTIFICATION
-    //                [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-    //#else
-    //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-    //                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-    //#endif
-    //                NSString * msg = nil;
-    //
-    //                if (self.addAll) {
-    //
-    //                    unsigned long checkedCount = [return_json[@"count"] integerValue];
-    //
-    //                    msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
-    //                } else {
-    //
-    //                    if(checked.count==1)
-    //                    {
-    //                        msg=@"1 item added to Cart";
-    //                    }
-    //                    else
-    //                    {
-    //                        msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
-    //                    }
-    //                }
-    //
-    //                    [RAUtils message_alert:nil title:msg controller:self] ;
-    //
-    //                [self end_select:2];
-    //
-    //
-    //
-    ////                }
-    //            }
-    //            else  if([[return_json valueForKey:@"result"] intValue]==8)
-    //            {
-    //
-    //
-    //#ifdef RA_NOTIFICATION
-    //                [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-    //#else
-    //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //                //                    appDelegate.order_code = order_code;
-    //                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-    //                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-    //#endif
-    //                [self end_select:2];
-    //                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-    //            }
-    //            else
-    //            {
-    //                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-    //            }
-    //
-    //
-    //
-    //
-    //        });
-    //    });
 }
 -(void) addtoportfolio
 {
     
-    //    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    //    if (appDelegate.offline_mode) {
-    //
-    //        [RAUtils message_alert:@"offline mode does not support this function." title:@"Add to Portfolio" controller:self] ;
-    //        return;
-    //    }
-    
+
     NSMutableDictionary* items =[[self.category_data objectForKey:@"items"] mutableCopy];
     
     int count = [[items valueForKey:@"count"] intValue];
@@ -1203,37 +1078,39 @@
         }
     }
     
-    //    if(checked.count==0)
-    //    {
-    //        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to portfolio." controller:self] ;
-    //        return;
-    //    }
+
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
-        [RAUtils message_alert:@"Cannot Add to portfolio." title:@"Warning" controller:self] ;
+
+        [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil];
         return;
     }
     
     if (!count) {
-        [RAUtils message_alert:@"There is no model." title:@"Cannot Add to portfolio." controller:self] ;
+
+        [RAUtils message_box:@"Cannot Add to portfolio." message:@"There is no model." completion:nil];
         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_box:@"Cannot Add to portfolio." message:@"You must select at least one model." completion:nil];
         return;
     }
     
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addPortfolioBtn.enabled =false;
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Portfolio" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Portfolio" completion:^{
+    
+    PopWaitAlert* pop  = [RAUtils waiting_pop:@"Add Models To Portfolio" completion:nil];
         if (self.addAll) {
             [RANetwork request_addall_search:self.offset limit:PAGE_ITEM keywords:self.keywords matchfull:self.loadmore_matchfull orderCode:nil addTo:@"portfolio" completionHandler:^(NSMutableDictionary *result) {
                 NSMutableDictionary* return_json = result;
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                [pop hide];
                     self.addPortfolioBtn.enabled =true;
                     
                     if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1270,7 +1147,8 @@
                             }
                         }
                         
-                        [RAUtils message_alert:nil title:msg controller:self] ;
+
+                        [RAUtils message_box:msg message:nil completion:nil];
                         
                         
                         [self end_select:END_SELECT_PORTFOLIO];
@@ -1278,9 +1156,10 @@
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
+
+                        [RAUtils message_box:@"Add To Portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil];
                     }
-                }];
+//                }];
                 
                 
                 
@@ -1291,7 +1170,9 @@
         } else {
             [RANetwork request_addto_portfolio:ids withScreen:ScreenCodeSearch completionHandler:^(NSMutableDictionary *result) {
                 NSMutableDictionary* return_json = result;
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     self.addPortfolioBtn.enabled =true;
                     
                     if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1328,17 +1209,18 @@
                             }
                         }
                         
-                        [RAUtils message_alert:nil title:msg controller:self] ;
-                        
+
+                        [RAUtils message_box:msg message:nil completion:nil];
                         
                         [self end_select:END_SELECT_PORTFOLIO];
                         
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
+
+                        [RAUtils message_box:@"Add To Portfolio" message:[return_json valueForKey:@"err_msg"] completion:nil];
                     }
-                }];
+//                }];
                 
                 
                 
@@ -1348,78 +1230,11 @@
             }];
             
         }
-    }];
+//    }];
     
     
     
     
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-    //
-    //        NSDictionary* return_json = nil;
-    //        if (self.addAll) {
-    ////            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    //            return_json = [RANetwork Search_addall:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull orderCode:nil addTo:@"portfolio"];
-    //        } else {
-    //            return_json = [RANetwork add_toPortfolio:ids withScreen:ScreenCodeSearch];
-    //        }
-    //
-    //
-    //        dispatch_async(dispatch_get_main_queue(), ^{
-    ////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-    //            [waitalert dismissViewControllerAnimated:YES completion:nil];
-    //
-    //            self.addPortfolioBtn.enabled =true;
-    //
-    //            if([[return_json valueForKey:@"result"] intValue]==2)
-    //            {
-    //
-    //
-    //
-    //
-    //
-    //
-    //#ifdef RA_NOTIFICATION
-    //                [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-    //#else
-    //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //                [((MainViewController*)appDelegate.main_vc) reloadPortfolio :true immediately:false];
-    //#endif
-    //
-    //                NSString * msg = nil;
-    //
-    //                if (self.addAll) {
-    //
-    //                    unsigned long checkedCount = [return_json[@"count"] integerValue];
-    //
-    //                    msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
-    //                } else {
-    //
-    //                    if(checked.count==1)
-    //                    {
-    //                        msg=@"1 item added to Portfolio";
-    //                    }
-    //                    else
-    //                    {
-    //                        msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
-    //                    }
-    //                }
-    //
-    //                    [RAUtils message_alert:nil title:msg controller:self] ;
-    //
-    //
-    //                [self end_select:3];
-    //
-    //            }
-    //            else
-    //            {
-    //                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
-    //            }
-    //
-    //
-    //
-    //
-    //        });
-    //    });
 }
 -(void) addtowish
 {
@@ -1438,21 +1253,17 @@
             
         }
     }
-    
-    //    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] ;
+
+        [RAUtils message_box:@"Cannot Add to Wish List." message:@"There is no model." completion:nil];
         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_box:@"Cannot Add to Wish List." message:@"You must select at least one model." completion:nil];
         return;
     }
     
@@ -1460,13 +1271,17 @@
     NSString * ids = [checked componentsJoinedByString:@","];
     self.addWishBtn.enabled =false;
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Wish List" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Wish List" completion:^{
+    
+    PopWaitAlert* pop  = [RAUtils waiting_pop:@"Add Models To Wish List" completion:nil];
         if (self.addAll) {
             
             [RANetwork request_addall_search:self.offset limit:PAGE_ITEM keywords:self.keywords matchfull:self.loadmore_matchfull orderCode:nil addTo:@"wishlist" completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary* return_json =result;
                 //            [waitalert dismissViewControllerAnimated:YES completion:nil];
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     self.addWishBtn.enabled =true;
                     
                     if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1502,17 +1317,18 @@
                             }
                         }
                         
-                        [RAUtils message_alert:nil title:@" Multiple items added to \nWish List" controller:self] ;
-                        
                         
+                        [RAUtils message_box:@" Multiple items added to \nWish List" message:nil completion:nil];
                         [self end_select:3];
                         
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
+
+                        
+                        [RAUtils message_box:@"Add To Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil];
                     }
-                }];
+//                }];
                 
                 
                 
@@ -1525,7 +1341,9 @@
             [RANetwork request_addto_wishlist:ids withScreen:ScreenCodeSearch completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary* return_json =result;
                 //            [waitalert dismissViewControllerAnimated:YES completion:nil];
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     self.addWishBtn.enabled =true;
                     
                     if([[return_json valueForKey:@"result"] intValue]==2)
@@ -1561,17 +1379,16 @@
                             }
                         }
                         
-                        [RAUtils message_alert:nil title:@" Multiple items added to \nWish List" controller:self] ;
-                        
-                        
+                        [RAUtils message_box:@" Multiple items added to \nWish List" message:nil completion:nil];
                         [self end_select:1];
                         
                     }
                     else
                     {
-                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
+
+                        [RAUtils message_box:@"Add To Wish List" message:[return_json valueForKey:@"err_msg"] completion:nil];
                     }
-                }];
+//                }];
                 
                 
                 
@@ -1581,77 +1398,10 @@
             }];
             
         }
-    }];
+//    }];
     
     
     
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-    //
-    //        NSDictionary* return_json = nil;
-    //        if (self.addAll) {
-    ////            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    //            return_json = [RANetwork Search_addall:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull orderCode:nil addTo:@"wishlist"];
-    //        } else {
-    //            return_json = [RANetwork add_toWatchList:ids withScreen:ScreenCodeSearch];
-    //        }
-    //
-    //
-    //        dispatch_async(dispatch_get_main_queue(), ^{
-    //
-    ////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-    //            [waitalert dismissViewControllerAnimated:YES completion:nil];
-    //
-    //            self.addWishBtn.enabled =true;
-    //
-    //            if([[return_json valueForKey:@"result"] intValue]==2)
-    //            {
-    //
-    //
-    //
-    //
-    //#ifdef RA_NOTIFICATION
-    //                [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-    //#else
-    //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //
-    //                [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-    //#endif
-    //
-    //                NSString * msg = nil;
-    //
-    //                if (self.addAll) {
-    //
-    //                    unsigned long checkedCount = [return_json[@"count"] integerValue];
-    //
-    //                    msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
-    //                } else {
-    //
-    //                    if(checked.count==1)
-    //                    {
-    //                        msg=@"1 item added to \nWish List";
-    //                    }
-    //                    else
-    //                    {
-    //                        msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
-    //                    }
-    //                }
-    //
-    //                    [RAUtils message_alert:nil title:@" Multiple items added to \nWish List" controller:self] ;
-    //
-    //
-    //                [self end_select:1];
-    //
-    //            }
-    //            else
-    //            {
-    //                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
-    //            }
-    //
-    //
-    //
-    //
-    //        });
-    //    });
 }
 
 -(void) operation_loadMore
@@ -1666,7 +1416,9 @@
             if(self.showalert)
             {
                 self.showalert=false;
-                [RAUtils message_alert:@"All loaded" title:@"Loading items" controller:self] ;
+
+                
+                [RAUtils message_box:@"Loading items" message:@"All loaded" completion:nil];
             }
             return;
         }
@@ -1722,7 +1474,7 @@
             }
             else
             {
-                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+                [RAUtils message_box:@"Search" message:[category_more valueForKey:@"err_msg"] completion:nil];
             }
             self.isrefreshing=false;
             
@@ -1731,99 +1483,7 @@
         
         return;
         
-        //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        //
-        //
-        //
-        //        NSDictionary* category_more=[RANetwork Search:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull];
-        //        dispatch_async(dispatch_get_main_queue(), ^{
-        //            [self.mum stopAnimating];
-        //            self.isrefreshing=false;
-        //            if (self.dataOperationQueue.operationCount > 1) {
-        //                return;
-        //            }
-        //
-        //            NSDictionary* more_items=[category_more objectForKey:@"items"];
-        //            if([[category_more valueForKey:@"result"] intValue]==2)
-        //            {
-        //                //  self.category_data = category_data;
-        //                NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-        //
-        //                int count =[[more_items valueForKey:@"count"] intValue];
-        //                for(int i=0;i<count;i++)
-        //                {
-        //
-        //                    NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-        //                    [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-        //
-        //
-        //                }
-        //                long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
-        //                [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
-        //                [self.category_data setObject:items_json forKey:@"items"];
-        //                self.offset+=count;
-        //                if(count<20)
-        //                {
-        //                    self.loadall=true;
-        //
-        //                }
-        //                //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-        //
-        //
-        //
-        //
-        //        //        DebugLog(@"%@",self.category_data);
-        //
-        //                [self.collectionview reloadData];
-        //
-        //            }
-        //            else
-        //            {
-        //                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Search" controller:self] ;
-        //            }
-        //            self.isrefreshing=false;
-        //
-        //        });
-        ////        dispatch_async(dispatch_get_main_queue(), ^{
-        ////            //  self.category_data = category_data;
-        ////
-        ////
-        ////            if([[category_more valueForKey:@"result"] intValue]==2)
-        ////            {
-        ////                NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-        ////
-        ////                int count =[[category_more valueForKey:@"count"] intValue];
-        ////                for(int i=0;i<count;i++)
-        ////                {
-        ////
-        ////                    NSDictionary * item_json = [category_more objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-        ////                    [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-        ////
-        ////
-        ////                }
-        ////                long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
-        ////                [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
-        ////                [self.category_data setObject:items_json forKey:@"items"];
-        ////                self.offset+=count;
-        ////                //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-        ////
-        ////
-        ////
-        ////
-        ////                DebugLog(@"%@",self.category_data);
-        ////
-        ////                [self.collectionview reloadData];
-        ////            }
-        ////            else
-        ////            {
-        ////                [RAUtils error_alert:[category_more valueForKey:@"err_msg"]] ;
-        ////            }
-        ////
-        ////
-        ////
-        ////
-        ////        });
-        //    });
+        
     });
 }
 
@@ -1907,7 +1567,9 @@
             }
             else
             {
-                [RAUtils message_alert:[category_data valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+
+                
+                [RAUtils message_box:@"Search" message:[category_data valueForKey:@"err_msg"] completion:nil];
             }
             
             self.isrefreshing=false;
@@ -1917,57 +1579,7 @@
         
         return;
         
-        //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        //
-        //        NSDictionary* category_data=[RANetwork Search:0 limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull];
-        //
-        //        dispatch_async(dispatch_get_main_queue(), ^{
-        //
-        //            [self.mum stopAnimating];
-        //            self.isrefreshing=false;
-        //            if (self.dataOperationQueue.operationCount > 1) {
-        //                return;
-        //            }
-        //
-        //            self.category_data = [category_data mutableCopy];
-        //            [self.collectionview reloadData];
-        //
-        //            if([[category_data valueForKey:@"result"] intValue]==2)
-        //            {
-        //                self.collectionview.hidden=false;
-        //                NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-        //                self.offset =[[item_json valueForKey:@"count"] intValue];
-        //
-        //                int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
-        //
-        //                if(total<2)
-        //                {
-        //                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
-        //                    if(total==1)
-        //                    {
-        //                        NSDictionary * detail_item = [item_json objectForKey:@"item_0"];
-        //                        NSString* detail_id=    [detail_item valueForKey:@"product_id"] ;
-        //
-        //                        [self showDetailat:detail_id category_id:nil name:[detail_item objectForKey:@"fash_name"] index:0];
-        //                    }
-        //                }
-        //                else
-        //                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
-        //            }
-        //            else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-        //            {
-        //                self.collectionview.hidden=true;
-        //                self.label_net_err.hidden=false;
-        //            }
-        //            else
-        //            {
-        //                [RAUtils message_alert:[category_data valueForKey:@"err_msg"] title:@"Search" controller:self] ;
-        //            }
-        //
-        //            self.isrefreshing=false;
-        //
-        //            });
-        //        });
+        
     });
 }
 
@@ -1985,30 +1597,7 @@
     [self.dataOperationQueue addOperation:operation];
 }
 
-//-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
-//{
-//    [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
-//    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
-//    if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
-//    {
-//       // self.orientation = orientation;
-//        [self.collectionview.collectionViewLayout invalidateLayout];
-//        DebugLog(@"routed");
-//    }
-//    
-//    
-//    
-//    
-//}
 
-//- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
-//
-//    [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
-//
-//    self.toOrientation = toInterfaceOrientation;
-//    [self.collectionview.collectionViewLayout invalidateLayout];
-//
-//}
 
 
 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
@@ -2033,15 +1622,7 @@
  */
 - (IBAction)onMatchFullChanged:(id)sender {
     
-    //    NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-    //    int count =[[item_json valueForKey:@"count"] intValue];
-    
-    //    if(count!=0)
-    //    {
-    //        self.offset = 0;
-    //        [self reload];
-    //    }
-    //
+
 }
 
 #pragma mark - searchBar delegate;
@@ -2703,114 +2284,6 @@
 
 
 
-//#pragma mark - UIAlertViewDelegate
-//// Called when a button is clicked. The view will be automatically dismissed after this call returns
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-//{
-//    UIApplication * app = [UIApplication sharedApplication];
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//    //    if(alertView.tag==1234)
-//    //    {
-//    //
-//    //        // availability warring;
-//    //
-//    //
-//    //        if(buttonIndex!=alertView.cancelButtonIndex)
-//    //        {
-//    //            if(appDelegate.order_code==nil)
-//    //            {
-//    //                [self neworder];
-//    //            }
-//    //            else
-//    //            {
-//    //                [self addtocart];
-//    //            }
-//    //        }
-//    //        return;
-//    //    }
-//    //   int count=[self.quantity_text.text intValue];
-//    
-// //   MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//    if(buttonIndex==alertView.cancelButtonIndex)
-//    {
-//        
-//        
-//        
-//    }
-//    else if(buttonIndex==1)
-//    {
-//        //open exist
-//        self.disable_refresh = true;
-//        OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-//        ovc.showNavibar = true;
-//        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-//            if(appDelegate.order_code==nil)
-//            {
-//                [self neworder];
-//            }
-//            else
-//            {
-//                [self addtocart];
-//             //   [main_vc checklogin:true];
-//                
-//            }
-//            
-//        };
-//        ovc.init_style = OL_OPEN;
-//        ovc.onCancel = ^(){
-//            self.disable_refresh = false;
-//         //   [main_vc checklogin:true];
-//            
-//        };
-//        
-//        [self.navigationController pushViewController:ovc animated:true];
-//    }
-//    else
-//    {
-//        //create new;
-//        self.disable_refresh = true;
-//        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//        {
-//            ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//            cvc.showNavibar = true;
-//            cvc.contact_type = @"Sales_Order_Customer";
-//            cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//                
-//                appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                appDelegate.customerInfo = value;
-//                
-//                
-//                if(appDelegate.order_code==nil)
-//                    [self neworder];
-//                
-//             //   [main_vc checklogin:true];
-//                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//                
-//                //
-//                //                if(self.returnValue)
-//                //                    self.returnValue(value);
-//            };
-//            
-//            cvc.onCancel = ^(){
-//                
-//                [RAUtils message_alert:@"Can ot create order without cursomer infomation." title:@"" controller:self];
-//                
-//                self.disable_refresh = false;
-//                
-//            };
-//            cvc.onReset = ^(){
-//              //  [main_vc checklogin:true];
-//            };
-//            
-//            [self.navigationController pushViewController:cvc animated:true];
-//        }
-//        else
-//        {
-//            [self neworder];
-//        }
-//        
-//    }
-//}
 
 #pragma mark - Support scanner
 -(void) onDecodedData:(NSString*) value

+ 8 - 22
RedAnt ERP Mobile/common/Functions/sidemenu/CacheViewController.m

@@ -100,7 +100,8 @@
     
     
     
-    __block UIAlertController * alert = [RAUtils waiting_alert:self message:@"Deleting..." title:nil completion:^{
+//    __block UIAlertController * alert = [RAUtils waiting_alert:self message:@"Deleting..." title:nil completion:^{
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Deleting..." completion:nil];
          NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
             NSString *cachefolder = [paths objectAtIndex:0];
                 NSString *img_cache = [cachefolder stringByAppendingPathComponent:@"img_cache"];
@@ -108,17 +109,10 @@
             
             [RAUtils deletefiles:img_cache];
             [RAUtils deletefiles: cachefolder];
-            //    DebugLog(@"%@",cachefolder);
-            //     DebugLog(@"%@",img_cache);
-        //    float size=[RAUtils fileSizeForDir:cachefolder];
-        //    // float size1=[RAUtils fileSizeForDir:img_cache];
-        //
-        //    self.sizeLabel.text = [NSString stringWithFormat:@"Cache size: %.2f MB",size];
-        //
-        //    [self.mum stopAnimating];
-            
+
             
-            [alert dismissViewControllerAnimated:YES completion:^{
+//            [alert dismissViewControllerAnimated:YES completion:^{
+    [pop hide];
                 //     [alert dismissWithClickedButtonIndex:0 animated:FALSE];
                 
                 [self.mum startAnimating];
@@ -128,20 +122,12 @@
                 self.sizeLabel.text = [NSString stringWithFormat:@"Cache size: %.2f MB",size];
                 
                 [self.mum stopAnimating];
-            }];
-    }];
-    
-//    UIAlertView * alert=[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Deleting", nil) message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];
-    
-    
-    //   alert.tag = AL_CACHE;
-    
-    
-    
-//    [alert show];
+//            }];
+//    }];
     
 
 
+
     
    
 

+ 25 - 63
RedAnt ERP Mobile/common/Functions/sidemenu/FunctionTestViewController.m

@@ -40,18 +40,20 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
 
 -(void)testUI
 {
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"waiting" completion:^{
-        dispatch_async(dispatch_get_global_queue(0, 0), ^{
-            sleep(2);
-            dispatch_async(dispatch_get_main_queue(), ^{
-                [waitalert dismissViewControllerAnimated:false completion:^{
-                    
-                    [RAUtils message_alert:@"message" title:@"message" controller:self];
-                }];
-                
-            });
-        });
-    }];
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"waiting" completion:^{
+//        dispatch_async(dispatch_get_global_queue(0, 0), ^{
+//            sleep(2);
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//                [waitalert dismissViewControllerAnimated:false completion:^{
+//
+//
+//
+//                    [RAUtils message_box:@"title" message:@"message"  completion:nil];
+//                }];
+//
+//            });
+//        });
+//    }];
 }
 - (void)startAirPrintWithData:(id )data
 {
@@ -92,25 +94,14 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
      }];
     
     
-//    [airPrinter contactPrinter:^(BOOL available)
-//    {
-//        if (available) {
-//           self.printerdisplayName= airPrinter.displayName;
-////        self.printerNameLabel.text = self.savedPrinter.displayName;
-////            self.printerLocationLabel.text = self.savedPrinter.displayLocation;
-//    }
-//    else {
-//        NSLog(@"cannot connect to printer");
-////        self.printerConnectionGoneIndicator.hidden = NO;
-//    }
-//    }];
- //   [self.airPrinterController printToPrinter:airPrinter completionHandler:completionHandler];
+
 }
 - (void)startAirPrintWithData1:(id )data
 {
     
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"preparing print..." completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"preparing print..." completion:^{
+        PopWaitAlert* pop = [RAUtils waiting_pop:@"preparing print..." completion:nil];
             UIPrintInteractionController* airPrinterController=[UIPrintInteractionController sharedPrintController];
             UIPrintInfo *printInfo = [UIPrintInfo printInfo];
             printInfo.outputType = UIPrintInfoOutputGeneral;
@@ -141,7 +132,8 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
             
             if(appDelegate.printerURL==nil)
             {
-                [waitalert dismissViewControllerAnimated:YES completion:nil];
+//                [waitalert dismissViewControllerAnimated:YES completion:nil];
+                [pop hide];
                 if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1)
                 {
                     UIPrinterPickerController *printPicker = [UIPrinterPickerController printerPickerControllerWithInitiallySelectedPrinter:nil];
@@ -179,17 +171,7 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
                          }
                          else
                          {
-                             
-                             
-                             //                          AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                             //                          if([appDelegate.mode isEqualToString:@"Trade Show Mode"]&& appDelegate.submit_order_logout)
-                             //                          {
-                             //
-                             //                              [((MainViewController*)appDelegate.main_vc) Loginout:false];
-                             //                          }
-                             //                          [self prepareReturn:nil];
-                             
-                             //[self.navigationController popViewControllerAnimated:true];
+
                          }
                      }];
                 }
@@ -199,7 +181,8 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
                 UIPrinter *airPrinter = [UIPrinter printerWithURL:[NSURL URLWithString:appDelegate.printerURL] ];///*self.printer;*/
                 [airPrinter contactPrinter:^(BOOL available)
                  {
-                     [waitalert dismissViewControllerAnimated:YES completion:nil];
+//                     [waitalert dismissViewControllerAnimated:YES completion:nil];
+                    [pop hide];
                      
                      if (available&& appDelegate.printerURL.length>0)
                      {
@@ -212,20 +195,7 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
                      {
                          appDelegate.printerURL = nil;
                          
-                         //             [airPrinterController presentFromRect:CGRectMake(0, 0, 300, 500) inView:self.view animated:YES completionHandler:
-                         //
-                         //
-                         //
-                         //              //        [printPicker presentAnimated:YES completionHandler:
-                         //              ^(UIPrintInteractionController *printerController, BOOL userDidSelect, NSError *error)
-                         //              {
-                         //                  if (userDidSelect)
-                         //                  {
-                         //                      NSString* sid= printerController.printInfo.printerID;
-                         //                      UIPrintPaper*paper=  printerController.printPaper;
-                         //
-                         //                  }
-                         //              }];
+ 
                          
                          
                          DebugLog(@"AIRPRINTER NOT AVAILABLE");
@@ -271,15 +241,7 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
                                   {
                                       appDelegate.printerURL = nil;
                                       
-                                      //                          AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                                      //                          if([appDelegate.mode isEqualToString:@"Trade Show Mode"]&& appDelegate.submit_order_logout)
-                                      //                          {
-                                      //
-                                      //                              [((MainViewController*)appDelegate.main_vc) Loginout:false];
-                                      //                          }
-                                      //                          [self prepareReturn:nil];
-                                      
-                                      //[self.navigationController popViewControllerAnimated:true];
+          
                                   }
                               }];
                          }
@@ -294,7 +256,7 @@ self.airPrinterController = [UIPrintInteractionController sharedPrintController]
             
 
             
-    }];
+//    }];
     
 
     

+ 22 - 219
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -143,7 +143,9 @@
                 {
                     btn.selected = !btn.selected;
                     
-                    [RAUtils message_alert:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync" controller:self];
+
+                    
+                    [RAUtils message_box:@"Incomplete sync" message:@"Detected incomplete sync, please finish sync first." completion:nil];
 
                     [defaults removeObjectForKey:@"EnableOfflineMode"];
                     [defaults setBool:false forKey:@"EnableOfflineMode"];
@@ -173,7 +175,9 @@
             {
                 btn.selected = !btn.selected;
                 
-                [RAUtils message_alert:@"Offline data not found, you must login online and download offline data first." title:@"Offline data not found" controller:self];
+
+                
+                [RAUtils message_box:@"Offline data not found" message:@"Offline data not found, you must login online and download offline data first." completion:nil];
 //                [RAUtils alert_view:@"Offline data not found, you must login online and download offline data first." title:@"Offline data not found"];
             }
         }
@@ -251,9 +255,9 @@
     {
         self.checkOfflineMode.selected = !self.checkOfflineMode.selected;
         
-        [RAUtils message_alert:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync" controller:self];
+
         
-        [RAUtils message_alert:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync" controller:self];
+        [RAUtils message_box:@"Incomplete sync" message:@"Detected incomplete sync, please finish sync first." completion:nil];
 
         [defaults removeObjectForKey:@"EnableOfflineMode"];
         [defaults setBool:false forKey:@"EnableOfflineMode"];
@@ -269,14 +273,8 @@
     
     if(user.length==0||password.length==0)
     {
-        //        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Error!" message:@"user or password can not be empty." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];
-        //        //        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
-        //
-        //
-        //        //[[UILabel appearanceWhenContainedIn:UIAlertView.class, nil] setAppearanceFont:[UIFont boldSystemFontOfSize:10]];
-        //        [alert show];
-        
-        [RAUtils message_alert:@"Username or Password cannot be blank." title:@"Cannot sign-in" controller:self];
+
+        [RAUtils message_box:@"Cannot sign-in" message:@"Username or Password cannot be blank." completion:nil];
 //        [RAUtils alert_view:@"Username or Password cannot be blank." title:@"Cannot sign-in"];
         return;
     }
@@ -289,11 +287,14 @@
 //    UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign in"];
     
   
-    __block UIAlertController* waitalert= [RAUtils waiting_alert:self title:@"Sign in" completion:^{
+//    __block UIAlertController* waitalert= [RAUtils waiting_alert:self title:@"Sign in" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Sign in" completion:nil];
         [RANetwork request_login:user password:password completionHandler:^(NSMutableDictionary *result) {
                 
                 
-                [waitalert dismissViewControllerAnimated:true completion:^{
+            [pop hide];
+//                [waitalert dismissViewControllerAnimated:true completion:^{
                     int ret=[result[@"result"] intValue];
                     self.btnLogin.enabled = true;
                     
@@ -485,13 +486,16 @@
                                 break;
                         }
                         
-                        [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
+
+                        
+                        
+                        [RAUtils message_box:@"Cannot sign-in" message:msg completion:nil];
                         //            [RAUtils alert_view:msg title:@"Cannot sign-in"];
                         
                         
                         
                     }
-                }];
+//                }];
                 
         //        [waitalert dismissViewControllerAnimated:YES completion:nil];
 
@@ -501,210 +505,9 @@
             }];
             
 
-    }];
+//    }];
     return;
-//        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Sign in" message:@"Please wait..." preferredStyle:UIAlertControllerStyleAlert];
-//        [self presentViewController:alertController animated:YES completion:nil];
-    
-    
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//        
-//        
-//        int ret=[RANetwork  Authorize:user password:password];
-//        
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [waitalert dismissViewControllerAnimated:YES completion:nil];
-//            self.btnLogin.enabled = true;
-//            
-//            if(ret==RESULT_TRUE)
-//                
-//            {
-//               
-//                //
-//                //                NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                //                appDelegate.contact_id=contactid;
-//                //                appDelegate.contact_name =[self.content_data[indexPath.row] valueForKey:@"name"];
-//                
-//                NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-//                [defaults removeObjectForKey:@"user"];
-//                [defaults removeObjectForKey:@"password"];
-//                NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
-//                NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
-//                if(self.checkSavePassword.selected)
-//                {
-//                    
-//                    [defaults setValue:encryptu forKey:@"user"];
-//                    [defaults setValue:encryptp forKey:@"password"];
-//                    sqlite3 *db = [iSalesDB get_db];
-//                    
-//                    int count =[iSalesDB get_recordcount:db table:@"login_info" where:[NSString stringWithFormat:@"name='%@'",encryptu]];
-//                    
-//                    if(count==0)
-//                    {
-//                        
-//                        NSString * savelogin=[NSString stringWithFormat:@"insert into login_info(name,pwd) values('%@','%@')",encryptu,encryptp];
-//                        [iSalesDB execSql:savelogin db:db];
-//                    }
-//                    else
-//                    {
-//                        NSString * savelogin=[NSString stringWithFormat:@"update login_info set pwd='%@' where name='%@'",encryptp,encryptu];
-//                        [iSalesDB execSql:savelogin db:db];
-//                    }
-//                    
-//                    [iSalesDB close_db:db];
-//                    
-//                    //                    [defaults setBool:TRUE forKey:@"autologin"];
-//                }
-//                else
-//                {
-//                    NSString* sql=[NSString stringWithFormat:@"delete from login_info where name='%@'",encryptu];
-//                    [iSalesDB execSql:sql];
-//                }
-//                [defaults synchronize];
-//                
-//                [self dismissViewControllerAnimated:YES completion:^{
-//                    
-//                    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-//                    
-//                    bool offline_dirty=[defaults boolForKey:@"OFFLINE_DIRTY"];
-//                    sqlite3* db = [iSalesDB get_db];
-//                    int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
-//                    
-//                    [iSalesDB close_db:db];
-//                    
-//                    
-//                    BOOL condition = offline_dirty && offline_user_exist>0;
-//                    
-//#ifdef OFFLINE_MODE
-//                    condition = condition && !appDelegate.offline_mode;
-//#endif
-//                    if(condition)
-//                    {
-//                        
-//                        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Detected new offline data" message:@"Do you want to sync with server?" preferredStyle:UIAlertControllerStyleAlert];
-//                        //block代码块取代了delegate
-//                        
-//                        
-//                        UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"Yes(Recommended)" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-//                            
-//                            
-//                            
-//                            
-//                            UIApplication * app = [UIApplication sharedApplication];
-//                            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//                            //UIViewController* active_vc = appDelegate.active_controller;
-//                            OfflineSettingViewController * offlineVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"OfflineSettingViewController"];
-//                            //    loginvc.delegate = self;
-//                            //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-//                            //       appDelegate.active_controller = gunVC;
-//                            //        gunVC.onDismissVC = ^(){
-//                            //            appDelegate.active_controller = active_vc;
-//                            //        };
-//                            UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:offlineVC] ;
-//                            
-//                            
-//                            
-//                            
-//                            
-//                            //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
-//                            
-//                            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-//                            [appDelegate.main_vc presentViewController:navi animated:YES completion:^{
-//                                
-//                                
-//                                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//                                
-//                                [main_vc checklogin:true];
-//                                //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-//                                
-//                                DebugLog(@"about present.........");
-//                                
-//                                //   self.btop = false;
-//                                //  <#code#>
-//                            }];
-//                            
-//                            
-//                            
-//                            
-//                        }];
-//                        
-//                        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-//                            
-//                            if(self.returnValue)
-//                                self.returnValue(true);
-//                            [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
-//                            
-//                        }];
-//                        
-//                        [alertControl addAction:actionTwo];
-//                        [alertControl addAction:alertthree];
-//                        
-//                        
-//                        
-//                        [appDelegate.main_vc presentViewController:alertControl animated:YES completion:nil];
-//                        
-//                        
-//                        
-//                        
-//                    }
-//                    else
-//                    {
-//                    if(self.returnValue)
-//                        self.returnValue(true);
-//                    [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
-//                    }
-//                        }];
-//
-//
-//                
-//                //                if (self.delegate && [self.delegate respondsToSelector:@selector(LoginViewControllerDidLogin:)]) {
-//                //                    [self.delegate LoginViewControllerDidLogin:self];
-//                //                }
-//                
-//                [[NSNotificationCenter defaultCenter] postNotificationName:User_LoginOK_Notification object:nil];
-//            }
-//            else
-//            {
-//                NSString* msg=nil;
-//                
-//                switch (ret) {
-//                        
-//                    case RESULT_NET_NOTAVAILABLE:
-//                        msg = MSG_NET_NOTAVAILABLE;
-//                        break;
-//                        
-//                        
-//                    case RESULT_NET_ERROR:
-//                        msg = MSG_NET_ERROR;
-//                        break;
-//                        
-//                        
-//                    case RESULT_FALSE:
-//                        msg = MSG_USERAUTH_ERROR;
-//                        break;
-//                        
-//                    case RESULT_VER_LOW:
-//                        msg = MSG_VER_LOW;
-//                        break;
-//                        
-//                    case RESULT_LOGIN_DEVICE:
-//                        msg= MSG_LOGIN_DEVICE;
-//                        break;
-//                    default:
-//                        break;
-//                }
-//                
-//                [RAUtils alert_view:msg title:@"Cannot sign-in"];
-//                
-//                
-//                
-//            }
-//            
-//            
-//        });
-//    });
-    
+
     
     
 }

+ 8 - 38
RedAnt ERP Mobile/common/Functions/sidemenu/RetrievePassViewController.m

@@ -31,15 +31,10 @@
     
     if(user.length==0||email.length==0)
     {
-//        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Error!" message:@"user or email can not be empty." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];
-//        //        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
-//        
-//        
-//        //[[UILabel appearanceWhenContainedIn:UIAlertView.class, nil] setAppearanceFont:[UIFont boldSystemFontOfSize:10]];
-//        [alert show];
+
+
         
-        [RAUtils message_alert:@"User or email cannot be empty." title:@"Input Error!" controller:self];
-//        [RAUtils alert_view:title:];
+        [RAUtils message_box:@"Input Error!" message:@"User or email cannot be empty." completion:nil];
         return;
     }
     
@@ -55,44 +50,19 @@
         if([[json valueForKey:@"result"] intValue]==2)
         {
             
-            [RAUtils message_alert:@"Please Check email later." title:@"Successful!" controller:self];
+
+            [RAUtils message_box:@"Successful!" message:@"Please Check email later." completion:nil];
             
-            //        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Successful!" message:@"Please Check email later." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];
-            //             [alert show];
             
         }
         else
         {
-            [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Retrieve Password" controller:self] ;
+
+            [RAUtils message_box:@"Retrieve Password" message:[json valueForKey:@"err_msg"] completion:nil];
         }
         
     }];
-    
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//
-//        NSDictionary* json=[RANetwork  retrieve_password:user email:email];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//            self.buttonRetrieve.enabled = true;
-//
-//            if([[json valueForKey:@"result"] intValue]==2)
-//            {
-//
-//                [RAUtils message_alert:@"Please Check email later." title:@"Successful!" controller:self];
-//
-////        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Successful!" message:@"Please Check email later." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];
-////             [alert show];
-//
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Retrieve Password" controller:self] ;
-//            }
-//
-//        });
-//    });
+
     
 
 }

+ 4 - 17
RedAnt ERP Mobile/common/Functions/sidemenu/ScannerSettingViewController.m

@@ -183,20 +183,13 @@
         title=[NSString stringWithFormat:@"%@\n\n%@",title,msg];
     }
     
-    [RAUtils message_alert:nil title:title controller:self];
-//    UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
-//    [alert show];
+    [RAUtils message_box:title message:nil completion:nil];
+
 }
 - (IBAction)onEmailClicked:(id)sender {
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//
-//    [appDelegate test_onDecodedDataResult:@"SCANNER TEST"];
-//    return;
-    
-//    UIApplication * app = [UIApplication sharedApplication];
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    
+
     
     if(appDelegate.log.length==0)
     {
@@ -210,13 +203,7 @@
         [self alert_view:nil title:@"Disable scanner first."];
         return;
     }
-    
-  //  NSString *path = NSTemporaryDirectory();
-    
-//    CFUUIDRef uuidObject = CFUUIDCreate(kCFAllocatorDefault);
-    
-    // Get the string representation of CFUUID object.
-    
+
     NSString* filename =[[NSUUID UUID] UUIDString];
   //  NSString *filePath = [path stringByAppendingPathComponent:filename];
     

+ 7 - 4
RedAnt ERP Mobile/common/Functions/sidemenu/UserListViewController.m

@@ -110,7 +110,9 @@
             return;
         }
         
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Switch user" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Switch user" completion:^{
+        
+        PopWaitAlert* pop=[RAUtils waiting_pop:@"Switch user" completion:nil];
             [RANetwork request_logout:^(NSMutableDictionary *result) {
                         
                         
@@ -154,7 +156,8 @@
                             int ret=[result[@"result"]intValue];
                             
                             
-                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                            [pop hide];
+//                            [waitalert dismissViewControllerAnimated:YES completion:^{
                                 if(ret==RESULT_TRUE)
                                 {
                                     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -234,7 +237,7 @@
                                     [self presentViewController:alertControl animated:YES completion:nil];
                                     
                                 } // 登陆失败
-                            }];
+//                            }];
             //                [waitalert dismissViewControllerAnimated:YES completion:nil];
                             
                             
@@ -338,7 +341,7 @@
                         
                     }];
 
-        }];
+//        }];
         
                 
 //        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

+ 5 - 14
RedAnt ERP Mobile/common/Functions/signature/SignatureViewController.m

@@ -188,23 +188,14 @@
                 self.linewidth = 1;
                 newlinewidth=1;
             }
-            [RAUtils message_alert:[NSString stringWithFormat:@"Line width has been set to %d.",newlinewidth] title:@"Line width should between 1 and 16" controller:self ];
+
+            
+            
+            [RAUtils message_box:@"Line width should between 1 and 16" message:[NSString stringWithFormat:@"Line width has been set to %d.",newlinewidth]  completion:nil];
         }
         
             [self.signatureView setLineWidth:self.linewidth];
-//        UITextField *name = alertControl.textFields.firstObject;
-//        if(name.text.length==0)
-//        {
-//            [RAUtils message_alert:@"Cannot save without name. Save canceled." title:@"Name is missing" controller:self];
-//        }
-//        else
-//        {
-//            self.save_name = name.text;
-//            self.btnsave.enabled =false;
-//            //  NSMutableDictionary * info =
-//            if(self.onSavePDF)
-//                self.onSavePDF(self.save_name,self.filename);
-//        }
+
     }];
     
     UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {

+ 46 - 509
RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m

@@ -96,14 +96,7 @@
            bool check = [[item_json valueForKey:@"check"] boolValue];
            if(check)
            {
-               /*
-               if ([[item_json valueForKey:@"available"] isEqualToString:@"In Production"] || [[item_json valueForKey:@"available"] integerValue] == 0) {
-                   
-                   [RAUtils message_alert:@"There ars some products is not available" title:@"Warning" controller:self];
-                   return;
-                   
-               }
-                */
+
                [self.checked_cart addObject:[NSNumber numberWithInt:[[item_json valueForKey:@"product_id"] intValue]]];
                [self.checked_iid_cart addObject:[NSNumber numberWithInt:[[item_json valueForKey:@"item_id"] intValue]]];
            }
@@ -247,34 +240,13 @@
 -(void) addtocart:(NSMutableArray*) checked checked_iid:(NSMutableArray*)checked_iid
 {
     
-//
-//    NSMutableArray* checked = [[NSMutableArray alloc] init];
-//
-//    NSMutableArray* checked_iid = [[NSMutableArray alloc] init];
-//
-//    int count = [[self.content_data valueForKey:@"count"] intValue];
-//    for(int i=0;i<count;i++)
-//    {
-//        NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%d",i]] mutableCopy];
-//        bool check = [[item_json valueForKey:@"check"] boolValue];
-//        if(check)
-//        {
-//            /*
-//            if ([[item_json valueForKey:@"available"] isEqualToString:@"In Production"] || [[item_json valueForKey:@"available"] integerValue] == 0) {
-//
-//                [RAUtils message_alert:@"There ars some products is not available" title:@"Warning" controller:self];
-//                return;
-//
-//            }
-//             */
-//            [checked addObject:[NSNumber numberWithInt:[[item_json valueForKey:@"product_id"] intValue]]];
-//            [checked_iid addObject:[NSNumber numberWithInt:[[item_json valueForKey:@"item_id"] intValue]]];
-//        }
-//    }
+
 
     if(checked.count==0)
     {
-        [RAUtils message_alert:@"You must select at least one model." title:@"Cannot Add to cart." controller:self] ;
+
+        
+        [RAUtils message_box:@"Cannot Add to cart." message:@"You must select at least one model." completion:nil];
         return;
     }
     
@@ -300,13 +272,17 @@
             [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
             [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
 #endif
-            [RAUtils message_alert:nil title:@" Multiple items moved to Cart" controller:self] ;
+
+            
+            [RAUtils message_box:@" Multiple items moved to Cart" message:@"" completion:nil];
             
         }
         else
         {
             [self reload_data];
-            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Move To Cart" controller:self] ;
+
+            
+            [RAUtils message_box:@"Move To Cart" message:[return_json valueForKey:@"err_msg"] completion:nil];
         }
         
         
@@ -315,157 +291,7 @@
         
     }];
     
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* return_json = [RANetwork move_wish2cart:ids];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//            self.btnAddtoCart.enabled = true;
-//
-//            if([[return_json valueForKey:@"result"] intValue]==2)
-//            {
-////                int result=[[return_json valueForKey:@"result"] intValue];re
-////                if(result==2)
-////                {
-//                    //successed.
-//
-//            //        NSString* order_code = [return_json valueForKey:@"order_code"];
-//
-////                    appDelegate.order_code = order_code;
-////                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                    appDelegate.order_code = order_code;
-//
-//
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//                [ActiveViewController Notify:@"WatchListViewController,CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
-//                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
-//                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-//#endif
-//                    [RAUtils message_alert:nil title:@" Multiple items moved to Cart" controller:self] ;
-//
-////                    [self end_select];
-//
-//
-//
-////                }
-//            }
-//            else
-//            {
-//                [self reload_data];
-//                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Move To Cart" controller:self] ;
-//            }
-//
-//
-//
-//
-//        });
-//    });
 }
-//-(void) neworder
-//{
-//
-//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create Order" completion:^{
-//        [RANetwork request_create_order:^(NSMutableDictionary *result) {
-//            NSMutableDictionary* return_json =result;
-//
-//            [waitalert dismissViewControllerAnimated:YES completion:^{
-//                //        [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    int result=[[return_json valueForKey:@"result"] intValue];
-//                    if(result==2)
-//                    {
-//                        //successed.
-//
-//                        NSString* order_code = [return_json valueForKey:@"orderCode"];
-//                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                        appDelegate.order_code = order_code;
-//                        appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-//
-//                        [self addtocart];
-//
-//
-//
-//                    }
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-//                }
-//            }];
-//
-//
-//
-//
-//
-//
-//
-//        }];
-//
-//    }];
-//
-//    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-////
-////        NSDictionary* return_json = [RANetwork new_Order];
-////
-////        dispatch_async(dispatch_get_main_queue(), ^{
-////            [waitalert dismissViewControllerAnimated:YES completion:nil];
-////
-////
-////            if([[return_json valueForKey:@"result"] intValue]==2)
-////            {
-////                int result=[[return_json valueForKey:@"result"] intValue];
-////                if(result==2)
-////                {
-////                    //successed.
-////
-////                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-////                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                    appDelegate.order_code = order_code;
-////                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-////
-////                    [self addtocart];
-////
-////
-////                    //    [self ReloadData];
-////
-////
-////                    //                    if(self.shopCartBlock!=nil)
-////                    //                    {
-////                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-////                    //
-////                    //
-////                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-////                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-////                    //                        iv.image = img;
-////                    //                        //                        [self.contentView addSubview:iv];
-////                    //                        self.shopCartBlock(iv);
-////                    //
-////                    //                    }
-////
-////                }
-////            }
-////            else
-////            {
-////                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
-////            }
-////
-////
-////
-////
-////        });
-////    });
-//}
-
 
 - (void)viewDidLoad
 {
@@ -582,10 +408,13 @@
     
     //    NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
     NSString * string = [checked componentsJoinedByString:@","];
-    __block UIAlertController* wait_alert = [RAUtils waiting_alert:self title:@"Remove Models From Wishlist" completion:^{
+//    __block UIAlertController* wait_alert = [RAUtils waiting_alert:self title:@"Remove Models From Wishlist" completion:^{
+    
+    PopWaitAlert* pop=[RAUtils waiting_pop:@"Remove Models From Wishlist" completion:nil];
         [RANetwork request_remove_wishlist:string completionHandler:^(NSMutableDictionary *result) {
             NSMutableDictionary* cart_json = result;
-            [wait_alert dismissViewControllerAnimated:YES completion:^{
+//            [wait_alert dismissViewControllerAnimated:YES completion:^{
+            [pop hide];
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 {
                     [self reload_data];
@@ -593,36 +422,16 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Remove Model From Wish List" controller:self] ;
+
+                    [RAUtils message_box:@"Remove Model from Withlist" message:cart_json[@"err_msg"] completion:nil];
                 }
-            }];
+//            }];
 
             
         }];
 
-    }];
-    //    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//        NSDictionary* cart_json = [RANetwork watchlist_remove:string];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//
-//
-//            if([[cart_json valueForKey:@"result"] intValue]==2)
-//            {
-//                [self reload_data];
-//
-//                        [self.btnselect setTitle:@"Select all"];
-//            }
-//            else
-//            {
-//                [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Remove Model From Wish List" controller:self] ;
-//            }
-//
-//        });
-//    });
-    
+//    }];
+
     
 }
 -(void) viewWillAppear:(BOOL)animated
@@ -698,7 +507,8 @@
                     }
                 else
                 {
-                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Loading Wish list" controller:self] ;
+
+                    [RAUtils message_box:@"Loading Wish list" message:[cart_json valueForKey:@"err_msg"] completion:nil];
                 }
                 
                 self.isrefreshing=false;
@@ -708,44 +518,6 @@
         
         return;
         
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//        
-//        NSDictionary* cart_json = [RANetwork request_WatchList:self.sortIndex];
-//        
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            
-//            [self.mum stopAnimating];
-//            self.isrefreshing=false;
-//            if (self.dataOperationQueue.operationCount > 1) {
-//                return ;
-//            }
-//            
-//            int result=[[cart_json valueForKey:@"result"] intValue];
-//            self.content_data = [cart_json mutableCopy];
-//            [self.itemListTable reloadData];
-//            self.print_url = [cart_json objectForKey:@"wishlist_print_url"];
-//            
-//            if(result==2||result==1||result==0)
-//            {
-//                self.itemListTable.hidden=false;
-//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                appDelegate.wish_count =[[self.content_data valueForKey:@"count"] intValue];
-//            }
-//            else
-//                if(result==RESULT_NET_ERROR)
-//                {
-//                    self.label_net_err.hidden=false;
-//                    self.itemListTable.hidden=true;
-//                }
-//            else
-//            {
-//                [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Loading Wish list" controller:self] ;
-//            }
-//            
-//            self.isrefreshing=false;
-//            
-//        });
-//    });
         });
 }
 
@@ -757,58 +529,9 @@
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
 }
-//-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
-//{
-//
-//    [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
-//    
-//   
-//    
-////    [self.itemListTable reloadData];
-//  DebugLog(@"%@",NSStringFromCGRect(self.itemListTable.frame));
-//    
-//    
-//}
 #pragma mark - Table view data source
 
-//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
-//{
-//    return 0;
-//}
-//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
-//{
-//    return 0;
-//}
-//- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
-//{
-//        UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
-//    return myView;
-//
-//}
 
-//- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
-//{
-//    UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
-////    myView.backgroundColor = [UIColor colorWithRed:0.10 green:0.68 blue:0.94 alpha:0.7];
-////    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 90, 22)];
-////    titleLabel.textColor=[UIColor whiteColor];
-////    titleLabel.backgroundColor = [UIColor clearColor];
-////    if(section==0)
-////        titleLabel.text=NSLocalizedString(@"display_items", nil);
-////    else
-////        titleLabel.text=NSLocalizedString(@"hide_items", nil);
-////    [titleLabel sizeToFit];
-////    [myView addSubview:titleLabel];
-////
-//    return myView;
-//}
-//
-//- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
-//    if(section==0)
-//        return nil;
-//    else
-//        return @"detail section";
-//}
 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
 {
 
@@ -1056,28 +779,31 @@
                      NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
                      
                      NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]];
-             __block UIAlertController* wait_alert = [RAUtils waiting_alert:self title:@"Remove Model" completion:^{
+//             __block UIAlertController* wait_alert = [RAUtils waiting_alert:self title:@"Remove Model" completion:^{
+             PopWaitAlert* pop=[RAUtils waiting_pop:@"Remove Model" completion:nil];
                  [RANetwork request_remove_wishlist:ids completionHandler:^(NSMutableDictionary *result) {
                      NSMutableDictionary* cart_json = result;
                      
                      
-                     [wait_alert dismissViewControllerAnimated:YES completion:^{
+//                     [wait_alert dismissViewControllerAnimated:YES completion:^{
+                     [pop hide];
                          if([[cart_json valueForKey:@"result"] intValue]==2)
                          {
                              [self reload_data];
                          }
                          else
                          {
-                             [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
+                             [RAUtils message_box:@"Delete Model" message:cart_json[@"err_msg"] completion:nil];
+
                          }
-                     }];
+//                     }];
                      
 
                      
                      
                  }];
 
-             }];
+//             }];
                       
              
                      
@@ -1092,14 +818,7 @@
          
          
          [self presentViewController:alertController animated:YES completion:nil];
-        
-//        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure remove model from wishlist?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
-//        alert.tag = ALERT_DEL;
-//        // alert.
-//        [alert show];
-//
-        
-        
+
         
         
         
@@ -1130,166 +849,6 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
    
     
 }
-//#pragma mark - UIAlertViewDelegate
-//// Called when a button is clicked. The view will be automatically dismissed after this call returns
-//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-//{
-//    UIApplication * app = [UIApplication sharedApplication];
-//    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//    //    if(alertView.tag==1234)
-//    //    {
-//    //
-//    //        // availability warring;
-//    //
-//    //
-//    //        if(buttonIndex!=alertView.cancelButtonIndex)
-//    //        {
-//    //            if(appDelegate.order_code==nil)
-//    //            {
-//    //                [self neworder];
-//    //            }
-//    //            else
-//    //            {
-//    //                [self addtocart];
-//    //            }
-//    //        }
-//    //        return;
-//    //    }
-//    //   int count=[self.quantity_text.text intValue];
-//
-//
-//
-//    if(alertView.tag==ALERT_DEL)
-//    {
-//        if(buttonIndex!=alertView.cancelButtonIndex)
-//        {
-//            [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
-//            NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
-//
-//            NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]];
-//
-//            [RANetwork request_remove_wishlist:ids completionHandler:^(NSMutableDictionary *result) {
-//                NSMutableDictionary* cart_json = result;
-//
-//
-//
-//
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    [self reload_data];
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
-//                }
-//
-//
-//            }];
-////            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-////
-////                NSDictionary* cart_json = [RANetwork watchlist_remove:ids];
-////
-////                dispatch_async(dispatch_get_main_queue(), ^{
-////
-////
-////
-////                    if([[cart_json valueForKey:@"result"] intValue]==2)
-////                    {
-////                        [self reload_data];
-////                    }
-////                    else
-////                    {
-////                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
-////                    }
-////
-////                });
-////            });
-//
-//        }
-//        return;
-//    }
-//
-//    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-//    if(buttonIndex==alertView.cancelButtonIndex)
-//    {
-//
-//
-//
-//    }
-//    else if(buttonIndex==1)
-//    {
-//        //open exist
-//
-//        OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-//        ovc.showNavibar = true;
-//        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-//            if(appDelegate.order_code==nil)
-//            {
-//                [self neworder];
-//            }
-//            else
-//            {
-//                [self addtocart];
-//                [main_vc checklogin:true];
-//
-//            }
-//
-//        };
-//        ovc.init_style = OL_OPEN;
-//        ovc.onCancel = ^(){
-//
-//            [main_vc checklogin:true];
-//
-//        };
-//
-//        [self.navigationController pushViewController:ovc animated:true];
-//    }
-//    else
-//    {
-//        //create new;
-//
-//        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-//        {
-//            ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-//            cvc.showNavibar = true;
-//            cvc.contact_type = @"Sales_Order_Customer";
-//            cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-//
-//                appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-//                appDelegate.customerInfo = value;
-//
-//
-//                if(appDelegate.order_code==nil)
-//                    [self neworder];
-//
-//             //   [main_vc checklogin:true];
-//                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-//
-//                //
-//                //                if(self.returnValue)
-//                //                    self.returnValue(value);
-//            };
-//
-//            cvc.onCancel = ^(){
-//
-//                [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-//
-//
-//
-//            };
-//            cvc.onReset = ^(){
-//                [main_vc checklogin:true];
-//            };
-//
-//            [self.navigationController pushViewController:cvc animated:true];
-//        }
-//        else
-//        {
-//            [self neworder];
-//        }
-//
-//    }
-//}
 
 #pragma mark - sort button
 
@@ -1418,12 +977,14 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
 - (IBAction)printWishlistClick:(UIBarButtonItem *)sender {
     
     if ([[self.content_data valueForKey:@"count"] intValue] < 1) {
-        [RAUtils message_alert:@"Please add wishlist first" title:@"Warning" controller:self];
+
+        [RAUtils message_box:@"Warning" message:@"Please add wishlist first" completion:nil];
         return;
     }
     
     if (self.print_url.length == 0) {
-        [RAUtils message_alert:@"There is no resource to print" title:@"Warning" controller:self];
+
+        [RAUtils message_box:@"Warning" message:@"There is no resource to print" completion:nil];
     }
     
     RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
@@ -1469,7 +1030,8 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
 - (IBAction)emailWishlistClick:(UIBarButtonItem *)sender {
     
     if ([[self.content_data valueForKey:@"count"] intValue] < 1) {
-        [RAUtils message_alert:@"Please add wishlist first" title:@"Warning" controller:self];
+
+        [RAUtils message_box:@"Warning" message:@"Please add wishlist first" completion:nil];
         return;
     }
     
@@ -1492,12 +1054,14 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
             // 验证是邮件地址,发送邮件
             [weakVC dismissViewControllerAnimated:YES completion:^{
                 
-                __block UIAlertController *waitting_alert = [RAUtils waiting_alert:self title:@"Sending Email" completion:^{
+//                __block UIAlertController *waitting_alert = [RAUtils waiting_alert:self title:@"Sending Email" completion:^{
+                PopWaitAlert* pop=[RAUtils waiting_pop:@"Sending Email" completion:nil];
                     [RANetwork request_emailwishlist:text completionHandler:^(NSMutableDictionary *result) {
                         DebugLog(@"email wishlist result: %@",result);
                         
                             
-                        [waitting_alert dismissViewControllerAnimated:YES completion:^{
+//                        [waitting_alert dismissViewControllerAnimated:YES completion:^{
+                        [pop hide];
                             //                        [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
                             
                             if ([[result objectForKey:@"result"] integerValue] != RESULT_TRUE) {
@@ -1512,47 +1076,20 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
                                 
                             }else {
                                 
-                                [RAUtils message_alert:nil title:@"Email was sent successfully" controller:weakself];
+
+                                [RAUtils message_box:@"Email was sent successfully" message:@"" completion:nil];
                                 
                             }
-                        }];
+//                        }];
 
                             
                         
                     }];
 
-                }];
+//                }];
                 
                                 
                 
-//                dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//
-//                    NSDictionary *result = [RANetwork quoteWishlist2EmailAddr:text];
-//                    DebugLog(@"email wishlist result: %@",result);
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                        [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
-//
-//                        if ([[result objectForKey:@"result"] integerValue] != RESULT_TRUE) {
-//
-//                            UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"The email send to %@ failed",text] 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:nil title:@"Email was sent successfully" controller:weakself];
-//
-//                        }
-//
-//                    });
-//
-//                });
-                
             }];
             
         } else {

+ 22 - 57
RedAnt ERP Mobile/common/Price Setting/PriceSettingViewController.m

@@ -119,12 +119,16 @@
 
 - (IBAction)calculatePriceButtonClick:(UIButton *)sender {
 
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Load Data" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Load Data" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Load Data" completion:nil];
         [RANetwork request_npd_shop_givenprice:^(NSMutableDictionary *result) {
                 NSDictionary *dic = result;
 
             //    [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-            [waitalert dismissViewControllerAnimated:YES completion:^{
+//            [waitalert dismissViewControllerAnimated:YES completion:^{
+            
+            [pop hide];
                 if ([[dic objectForKey:@"result"] integerValue] == 2) {
                     
                     CategoryPriceViewController *categoryPriceVC =[ [UIStoryboard storyboardWithName:@"CUL" bundle:nil] instantiateViewControllerWithIdentifier:@"CategoryPriceViewController"];
@@ -138,40 +142,22 @@
                     if (!msg) {
                         msg = @"Some Error Occured,Please Try Again";
                     }
-                    [RAUtils message_alert:msg title:@"Set Store Price" controller:self];
+                    
+                    [RAUtils message_box:@"Set Store Price" message:msg completion:nil];
+                    
+                    
+                    
                     
                 };
-            }];
+//            }];
                 
                 
 
         }];
 
-    }];
+//    }];
     
         
-//    NSDictionary *dic = [RANetwork get_npd_shop_givenPrice];
-//
-////    [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-//    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//    
-//    
-//    if ([[dic objectForKey:@"result"] integerValue] == 2) {
-//    
-//        CategoryPriceViewController *categoryPriceVC =[ [UIStoryboard storyboardWithName:@"CUL" bundle:nil] instantiateViewControllerWithIdentifier:@"CategoryPriceViewController"];
-//        
-//        categoryPriceVC.categoryGivenPrice = dic.mutableCopy;
-//        
-//        [self.navigationController pushViewController:categoryPriceVC animated:YES];
-//    } else {
-//        
-//        NSString *msg = [dic objectForKey:@"msg"];
-//        if (!msg) {
-//            msg = @"Some Error Occured,Please Try Again";
-//        }
-//        [RAUtils message_alert:msg title:@"Set Store Price" controller:self];
-//        
-//    }
 }
 
 - (NSString *)checkPriceType:(NSInteger)priceType {
@@ -240,10 +226,14 @@
 
 - (IBAction)saveButtonClick:(UIButton *)sender {
     
-    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Set PriceType" completion:^{
+//    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Set PriceType" completion:^{
+    
+    PopWaitAlert* pop = [RAUtils waiting_pop:@"Set PriceType" completion:nil];
         [RANetwork request_update_npd_shop_price_type:self.priceType completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary *dic=result;
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+            
+            [pop hide];
                     // 成功
                     if ([[dic objectForKey:@"result"] integerValue] == 2) {
                         
@@ -264,39 +254,14 @@
                     }
                     
                     [self dismissViewControllerAnimated:YES completion:nil];;
-                }];
+//                }];
                 
 
             }];
             
 
-    }];
-    
-    //    NSDictionary *dic = [RANetwork set_npd_shop_price_type:self.priceType];
-//
-////    [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-//    [waitalert dismissViewControllerAnimated:YES completion:nil];
-//
-//    // 成功
-//    if ([[dic objectForKey:@"result"] integerValue] == 2) {
-//
-//        [Singleton sharedInstance].npd_shop_price_type = self.priceType;
-//
-//
-//
-//#ifdef RA_NOTIFICATION
-//        [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//        // 刷新 Cart、Order List
-//        [[NSNotificationCenter defaultCenter] postNotificationName:Change_Price_Type_Notification object:nil];
-//#endif
-//
-//    } else { // 失败
-//
-//        DebugLog(@"set price type failure");
-//    }
-//
-//    [self dismissViewControllerAnimated:YES completion:nil];
+//    }];
+
 }
 
 @end

+ 11 - 56
RedAnt ERP Mobile/common/Price Setting/SetCategoryPriceController.m

@@ -223,11 +223,14 @@
     
     if (rightDiscount) {
         
-        __block UIAlertController* waitalert = [RAUtils waiting_alert:self title:@"Set Price" completion:^{
+//        __block UIAlertController* waitalert = [RAUtils waiting_alert:self title:@"Set Price" completion:^{
+        PopWaitAlert * pop = [RAUtils waiting_pop:@"Set Price" completion:nil];
             [RANetwork request_update_npd_shop_givenprice:@{@"base_price" : [NSString stringWithFormat:@"%ld",self.priceType],@"discount" : discount,@"category_id" : @(self.categoryID)}.mutableCopy completionHandler:^(NSMutableDictionary *result) {
                 NSDictionary *dic = result;
                 
-                [waitalert dismissViewControllerAnimated:YES completion:^{
+//                [waitalert dismissViewControllerAnimated:YES completion:^{
+                
+                [pop hide];
                     //        [waitalert dismissWithClickedButtonIndex:0 animated:YES];
                     
                     if ([[dic objectForKey:@"result"] integerValue] == 2) {
@@ -241,10 +244,10 @@
                     }
                     
                     [self.navigationController popViewControllerAnimated:YES];
-                }];
+//                }];
                 
             }];
-        }];
+//        }];
         //        UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Set Price"];
         
         
@@ -269,7 +272,9 @@
         
     } else {
         
-        [RAUtils message_alert:@"Please write a correct value" title:@"Warning" controller:self];
+
+        
+        [RAUtils message_box:@"Warning" message:@"Please write a correct value" completion:nil];
         
     }
     
@@ -284,57 +289,7 @@
     if (newText.length == 0)
         return YES;
 
-//    // 第一个字符不能为小数点
-//    if ([newText isEqualToString:@"."])
-//        return NO;
-//    if ([newText componentsSeparatedByString:@"."].count > 2) {
-//        return NO;
-//    } // 不能有多个小数点
-//    
-//    // 只能第一个字符为减号
-//    if (newText.length > 1 && [string isEqualToString:@"-"]) {
-//        return NO;
-//    }
-//    // 不能为 0123
-//    if (newText.length > 1 && [newText hasPrefix:@"0"] && [newText characterAtIndex:1] != '.') {
-//        return NO;
-//    }
-//    // 不能为 -0123
-//    if (newText.length > 2 && [newText hasPrefix:@"-0"] && [newText characterAtIndex:2] != '.') {
-//        return NO;
-//    }
-//
-//    // 校验正数
-//    NSCharacterSet *cs;
-//    cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS]invertedSet];
-//    NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs]componentsJoinedByString:@""];
-//    BOOL canChange = [string isEqualToString:filtered];
-//    
-//    if ([textField isEqual:self.floatTextField]) {
-//
-//        // 校验负数
-//        NSCharacterSet *negative_cs;
-//        
-//        negative_cs = [[NSCharacterSet characterSetWithCharactersInString:NEGATIVE_NUMBERS]invertedSet];
-//        NSString *negative_filtered = [[string componentsSeparatedByCharactersInSet:negative_cs]componentsJoinedByString:@""];
-//        
-//        BOOL negative_canChange = [string isEqualToString:negative_filtered];
-//        
-//        // 只能第一个字符为减号
-//        if ([string isEqualToString:@"-"]) {
-//            
-//            if (newText.length == 1 && [string isEqualToString:@"-"]) {
-//                negative_canChange = YES && negative_canChange;
-//            } else {
-//                negative_canChange = NO;
-//            }
-//        }
-//
-//        
-//        return canChange || negative_canChange;
-//    } else {
-//        return canChange;
-//    }
+
     
 
     // 正则表达式

+ 7 - 57
RedAnt ERP Mobile/common/categoryMenu_RATree/RAViewController.m

@@ -74,7 +74,8 @@
             }
             else
             {
-                [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
+                [RAUtils message_box:@"Load Category Menu" message:[category valueForKey:@"err_msg"] completion:nil] ;
+                
             }
     }];
     
@@ -94,7 +95,7 @@
             }
             else
             {
-                [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
+                [RAUtils message_box:@"Load Category Menu" message:[category valueForKey:@"err_msg"] completion:nil] ;
             }
         
         
@@ -102,33 +103,7 @@
         
     }];
     
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//
-//        NSDictionary* category=[RANetwork request_Cagegory];
-//
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//
-//            if([[category valueForKey:@"result"] intValue]==2)
-//            {
-//                appDelegate.categoryMenu = category;
-//                [self SetMenu:appDelegate.categoryMenu ];
-//            }
-//            else
-//                if([[category valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-//                {
-//                    [self SetMenu:nil ];
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
-//                }
-//
-//
-//
-//        });
-//    });
-    
+
     
     
 }
@@ -415,37 +390,12 @@
             }
             else
             {
-                [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
+
+                [RAUtils message_box:@"Load Category Menu" message:[category valueForKey:@"err_msg"] completion:nil];
             }
     }];
     
     return;
-    
-//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//        
-//        
-//        NSDictionary* category=[RANetwork request_Cagegory];
-//        
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            
-//            if([[category valueForKey:@"result"] intValue]==2)
-//            {
-//                appDelegate.categoryMenu = category;
-//                [self SetMenu:appDelegate.categoryMenu ];
-//            }
-//            else
-//                if([[category valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-//                {
-//                    [self SetMenu:nil ];
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
-//                }
-//            
-//            
-//            
-//        });
-//    });
+   
 }
 @end

+ 12 - 94
RedAnt ERP Mobile/common/customUI/ImageUploadViewController.m

@@ -207,7 +207,9 @@
     if(self.dirty==false)
     {
         
-        [RAUtils message_alert:@"Please set a photo first." title:@"Upload" controller:self];
+
+        
+        [RAUtils message_box:@"Upload" message:@"Please set a photo first." completion:nil];
         
 //        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Upload", nil) message:NSLocalizedString(@"Please set a photo first.", nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"Ok", nil) otherButtonTitles:nil, nil];
 //
@@ -248,7 +250,9 @@
         }
         else
         {
-            [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Image" controller:self] ;
+ ;
+            
+            [RAUtils message_box:@"Upload Image" message:[json valueForKey:@"err_msg"] completion:nil];
         }
         
         return;
@@ -283,7 +287,8 @@
         }
         else
         {
-            [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Image" controller:self] ;
+ ;
+            [RAUtils message_box:@"Upload Image" message:[json valueForKey:@"err_msg"] completion:nil];
         }
     }
     else
@@ -307,96 +312,7 @@
         if(appDelegate.password!=nil)
             [params setValue:appDelegate.password forKey:@"password"];
         
-//        AFHTTPRequestSerializer* serializer=[AFHTTPRequestSerializer serializer] ;
-//
-//        NSMutableURLRequest *request = [serializer multipartFormRequestWithMethod:@"POST" URLString:URL_UPLOAD_IMG parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
-//            [formData appendPartWithFileData:imageData name:@"upfile" fileName:@"test.jpg" mimeType:@"image/png"];
-//        } error:nil];
-//
-//
-//        //        NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:WEBSERVICE_URL parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
-//        //            [formData appendPartWithFileData:imageData name:@"upfile" fileName:@"test" mimeType:@"image/png"];
-//        //        } error:nil];
-//        //
-//        AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
-//
-//
-//
-//        //manager.responseSerializer.acceptableContentTypes = [self.operationManager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
-//
-//
-//
-//        //
-//        NSProgress *progress = nil;
-//
-//        NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithStreamedRequest:request progress:&progress completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
-//
-//            //        [progress removeObserver:self forKeyPath:@"fractionCompleted"];
-//
-//
-//
-//
-//            if (error) {
-//
-//                NSString* err_msg = [error localizedDescription];
-//                DebugLog(@"%@",err_msg);// [self.view updateWithMessage:[NSString stringWithFormat:@"Error : %@!", error.debugDescription]];
-//
-//
-//                NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-//
-//                DebugLog(@"data string: %@",str);
-//                [RAUtils message_alert:@"Can not connect to server please try again." title:@"Upload Image" controller:self] ;
-//
-//            } else {
-//                DebugLog(@"response ");
-//
-//
-//
-//                NSData *data = [NSJSONSerialization dataWithJSONObject:(NSDictionary*)responseObject options:kNilOptions error:nil];
-//
-//                // 再将NSData转为字符串
-//                NSString *jsonStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-//
-//                //            NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-//
-//                DebugLog(@"data string: %@",jsonStr);
-//
-//                NSDictionary* json = responseObject;
-//
-//
-//                if([[json valueForKey:@"result"] intValue]==2)
-//                {
-//                    NSString* img_url_down = json[@"img_url_aname"];
-//                    NSString* img_url_up = json[@"img_url"];
-//
-//                    if(self.returnValue)
-//                        self.returnValue(img_url_down,img_url_up,self.imgview.image);
-//
-//                    [self.navigationController popViewControllerAnimated:false];
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Image" controller:self] ;
-//                }
-//
-//
-//            }
-//            //  [waitalert dismissViewControllerAnimated:YES completion:nil];
-//        }];
-//
-//
-//
-//
-//        [self.uploadProgress setProgressWithUploadProgressOfTask:uploadTask animated:true];
-//        //
-//
-//
-//
-//
-//
-//
-//        [uploadTask resume];
-        
+       
         __weak typeof(self) weakSelf = self;
         
         [NetworkUtils upload:imageData FileName:@"test.jpg" Params:params ToHost:URL_UPLOAD_IMG Result:^(NSMutableDictionary *result) {
@@ -414,7 +330,9 @@
                 }
                 else
                 {
-                    [RAUtils message_alert:[result valueForKey:@"err_msg"] title:@"Upload Image" controller:weakSelf] ;
+
+                    
+                    [RAUtils message_box:@"Upload Image" message:[result valueForKey:@"err_msg"] completion:nil];
                 }
            
         } Progress:^(NSURLSessionTask *task, double progress) {

+ 4 - 7
RedAnt ERP Mobile/common/customUI/ImageViewController.m

@@ -54,14 +54,11 @@
     }
     
     
-    [RAUtils message_alert:msg title:@"Save Image" controller:self];
+
+    
+    [RAUtils message_box:@"Save Image" message:msg completion:nil];
     
-//    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Save Image"
-//                                                    message:msg
-//                                                   delegate:self
-//                                          cancelButtonTitle:@"OK"
-//                                          otherButtonTitles:nil];
-//    [alert show];
+
 }
 - (void)onDownloadClick:(UIButton *)sender {
     

+ 34 - 19
RedAnt ERP Mobile/common/data_provider/RADataProvider.m

@@ -206,19 +206,19 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
 
     if(user.length==0||[user.lowercaseString isEqualToString:@"guest"])
     {
-        [RAUtils message_alert:@"Can not update inventory, you must login first." title:@"Warrning" controller:vc];
+
+        
+        [RAUtils message_box:@"Warrning" message:@"Can not update inventory, you must login first." completion:nil];
         return;
     }
     
     bool haserp = [self getSiteHasERP];
     if(!haserp)
     {
-        [RAUtils message_alert:@"Can not update inventory, current site dosen't have ERP." title:@"Warrning" controller:vc];
+        [RAUtils message_box:@"Warrning" message:@"Can not update inventory, current site dosen't have ERP." completion:nil];
         return;
     }
     
-//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    NSString *documents = [paths objectAtIndex:0];
     NSString* serverpath = [OLDataProvider getServerPath];
     [RAUtils deletefiles:[serverpath stringByAppendingPathComponent:@"stock.json"]];
     
@@ -230,15 +230,18 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
         
         
         
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Update stock" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Update stock" completion:^{
             
             
+        PopWaitAlert * pop = [RAUtils waiting_pop:@"Update stock" completion:nil];
             
             [RADataProvider request_scan_stock:^(NSMutableDictionary *result) {
                 
                 NSMutableDictionary* return_json = result;
                 
-                [waitalert dismissViewControllerAnimated:false completion:^{
+//                [waitalert dismissViewControllerAnimated:false completion:^{
+                
+                [pop hide];
                     
                     if([[return_json valueForKey:@"result"] intValue]==2)
                     {
@@ -265,14 +268,14 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
           
                     }
                     else
-                        [RAUtils message_alert:@"Can not update inventory, you can try again later." title:@"Warrning" controller:vc];
-                    
+
+                    [RAUtils message_box:@"Warrning" message:@"Can not update inventory, you can try again later." completion:nil];
                     
                     [ActiveViewController Notify:@"ScanSearchViewController" Message:@"Clear"];
                     [ActiveViewController Notify:@"ServerSettingViewController" Message:RA_NOTIFICATION_REFRESH_UI];
                     
                     
-                }];
+//                }];
 
                 
                    
@@ -282,7 +285,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
 
             
             
-        }];
+//        }];
         
     }];
      UIAlertAction *action_2 = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
@@ -318,13 +321,18 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
         [RAUtils deletefiles:[documents stringByAppendingPathComponent:@"download"]];
         RASingleton.sharedInstance.scan_list = nil;
         [RADataProvider load_scan_models];
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Update local data" completion:^{
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Update local data" completion:^{
+        
+        
+        PopWaitAlert * pop = [RAUtils waiting_pop:@"Update local data" completion:nil];
             dispatch_async(dispatch_get_global_queue(0, 0), ^{
                 
                 NSData*  download_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:appDelegate.downloadurl]];
                 dispatch_async(dispatch_get_main_queue(), ^{
                     
-                    [waitalert dismissViewControllerAnimated:false completion:^{
+//                    [waitalert dismissViewControllerAnimated:false completion:^{
+                    
+                    [pop hide];
                         
                         if(download_data!=nil)
                         {
@@ -361,9 +369,9 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
                                     [fileManager removeItemAtPath:path error:nil];
                                     [fileManager removeItemAtPath:unZipTo error:nil];
                                     
-                                    [RAUtils message_alert:@"Can not unzip template file, please try download again." title:@"Warrning" controller:vc];
-                                    
+
                                     
+                                    [RAUtils message_box:@"Warrning" message:@"Can not unzip template file, please try download again." completion:nil];
                                     
                                     
                                 }
@@ -374,7 +382,9 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
                                     
                                     NSFileManager *fileManager = [NSFileManager defaultManager];
                                     [fileManager removeItemAtPath:path error:nil];
-                                    [RAUtils message_alert:@"Update template file successful." title:@"Message" controller:vc];
+
+                                    
+                                    [RAUtils message_box:@"Message" message:@"Update template file successful." completion:nil];
                                     
         //                            [RADataProvider encrypt_scan_models];
                                     NSMutableDictionary *templateDic = [NSMutableDictionary dictionary];
@@ -402,7 +412,9 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
                             else
                             {
                                 //打开文件失败,通常是文件路径有问题或密码错误。
-                                [RAUtils message_alert:@"Can not unzip template file, please contact the Administrator." title:@"Warrning" controller:vc];
+
+                                
+                                [RAUtils message_box:@"Warrning" message:@"Can not unzip template file, please contact the Administrator." completion:nil];
                                 
                         //        NSFileManager *fileManager = [NSFileManager defaultManager];
                         //        [fileManager removeItemAtPath:zipFile error:nil];
@@ -415,7 +427,10 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
         //                    cell.imageView.image=img;
                         }
                         else
-                            [RAUtils message_alert:@"Can not update template file, you can update manually in the setting." title:@"Warrning" controller:vc];
+
+                        
+                        
+                        [RAUtils message_box:@"Warrning" message:@"Can not update template file, you can update manually in the setting." completion:nil];
         //                    cell.imageView.image=[UIImage imageNamed:@"notfound_s"];
                         
                         
@@ -423,7 +438,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
                         [ActiveViewController Notify:@"ServerSettingViewController" Message:RA_NOTIFICATION_REFRESH_UI];
                         
                         
-                    }];
+//                    }];
                     
                     
                 });
@@ -431,7 +446,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-1-21"];
             });
             
             
-        }];
+//        }];
         
         
 //        NSString* file_name=[appDelegate.downloadurl lastPathComponent];

+ 27 - 0
RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/project.pbxproj

@@ -7,6 +7,9 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		3C23B3FA29D4202A008E7C14 /* PopWaitAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3F729D4202A008E7C14 /* PopWaitAlert.m */; };
+		3C23B3FB29D4202A008E7C14 /* MessageBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3F829D4202A008E7C14 /* MessageBox.m */; };
+		3C23B3FC29D4202A008E7C14 /* RAPopviewContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B3F929D4202A008E7C14 /* RAPopviewContainer.m */; };
 		3C284E5E29753C9900E5491B /* wrong.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3C284E5D29753C9900E5491B /* wrong.wav */; };
 		3C284E6029753EAE00E5491B /* add.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3C284E5F29753EAD00E5491B /* add.wav */; };
 		3C2F99B8237BE1790000808F /* PortfolioListTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F99B6237BE1790000808F /* PortfolioListTableViewCell.m */; };
@@ -307,6 +310,12 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		3C23B3F429D4202A008E7C14 /* MessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageBox.h; sourceTree = "<group>"; };
+		3C23B3F529D4202A008E7C14 /* PopWaitAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopWaitAlert.h; sourceTree = "<group>"; };
+		3C23B3F629D4202A008E7C14 /* RAPopviewContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAPopviewContainer.h; sourceTree = "<group>"; };
+		3C23B3F729D4202A008E7C14 /* PopWaitAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopWaitAlert.m; sourceTree = "<group>"; };
+		3C23B3F829D4202A008E7C14 /* MessageBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageBox.m; sourceTree = "<group>"; };
+		3C23B3F929D4202A008E7C14 /* RAPopviewContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAPopviewContainer.m; sourceTree = "<group>"; };
 		3C284E5D29753C9900E5491B /* wrong.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = wrong.wav; path = ../../../../../Downloads/wrong.wav; sourceTree = "<group>"; };
 		3C284E5F29753EAD00E5491B /* add.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = add.wav; sourceTree = "<group>"; };
 		3C2F99B6237BE1790000808F /* PortfolioListTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListTableViewCell.m; path = common/Functions/portfolio/PortfolioListTableViewCell.m; sourceTree = SOURCE_ROOT; };
@@ -851,6 +860,20 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		3C23B3F329D4202A008E7C14 /* MessageBox */ = {
+			isa = PBXGroup;
+			children = (
+				3C23B3F429D4202A008E7C14 /* MessageBox.h */,
+				3C23B3F529D4202A008E7C14 /* PopWaitAlert.h */,
+				3C23B3F629D4202A008E7C14 /* RAPopviewContainer.h */,
+				3C23B3F729D4202A008E7C14 /* PopWaitAlert.m */,
+				3C23B3F829D4202A008E7C14 /* MessageBox.m */,
+				3C23B3F929D4202A008E7C14 /* RAPopviewContainer.m */,
+			);
+			name = MessageBox;
+			path = "HMLG Scan Order/MessageBox";
+			sourceTree = SOURCE_ROOT;
+		};
 		3C3300B529430F0A005CFE7C /* common Scanner */ = {
 			isa = PBXGroup;
 			children = (
@@ -1372,6 +1395,7 @@
 		716387C71953CDB4006E65E6 /* utils */ = {
 			isa = PBXGroup;
 			children = (
+				3C23B3F329D4202A008E7C14 /* MessageBox */,
 				3C51499A273E0B6400F78617 /* common_const.h */,
 				71C1D84C1F456CAA00CEA1C9 /* HWWeakTimer.h */,
 				71C1D84D1F456CAA00CEA1C9 /* HWWeakTimer.m */,
@@ -2046,6 +2070,7 @@
 				7162A5991C58733400AB630E /* OrderDetailHtmlCell.m in Sources */,
 				7162A5091C586FC100AB630E /* CycleScrollView.m in Sources */,
 				715F30BD1DAB37EB00490EED /* OfflineUnlockViewController.m in Sources */,
+				3C23B3FB29D4202A008E7C14 /* MessageBox.m in Sources */,
 				7162A5161C58704600AB630E /* BundleModelCell.m in Sources */,
 				42DC12F11F0CD98E00A4C011 /* OrderDetailPickInfoCell.m in Sources */,
 				3C51494A273D095900F78617 /* CommonEditorCellEdit.m in Sources */,
@@ -2055,6 +2080,7 @@
 				71DF74891C57608F00F2789C /* RadioButton.m in Sources */,
 				3CDDB26B273A5A1500681F78 /* CustomIOSAlertView.m in Sources */,
 				7162A5DF1C5876E300AB630E /* ScannerSettingViewController.m in Sources */,
+				3C23B3FC29D4202A008E7C14 /* RAPopviewContainer.m in Sources */,
 				71DF74831C57608F00F2789C /* ImageScrollerView.m in Sources */,
 				71DF74871C57608F00F2789C /* NIDropDown.m in Sources */,
 				710274251CC606C4009FD219 /* UserListViewController.m in Sources */,
@@ -2094,6 +2120,7 @@
 				7141DD4F1C57459B00F7DF59 /* mask.c in Sources */,
 				7162A54E1C58722200AB630E /* CreditCardEditorViewController.m in Sources */,
 				7162A5C31C5873BB00AB630E /* ItemSearchFilterViewController.m in Sources */,
+				3C23B3FA29D4202A008E7C14 /* PopWaitAlert.m in Sources */,
 				3C51497F273E07D600F78617 /* EnumSelectAndSortCell.m in Sources */,
 				71D30A2D1CFC0EF8006F9477 /* DefaultImageButton.m in Sources */,
 				7162A5841C5872EF00AB630E /* HomeTableViewCellTopic.m in Sources */,

+ 1 - 1
RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
 		<key>iSales-CONTRAST.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>1</integer>
+			<integer>2</integer>
 		</dict>
 		<key>iSales-USAI.xcscheme_^#shared#^_</key>
 		<dict>

+ 10 - 146
RedAnt ERP Mobile/iSales-CONTRAST/ContrastModelItemCell.m

@@ -65,96 +65,6 @@
         _totalchange=_totalchange+val_change;
     
     
-//    
-//    if(val_change==(int)sender.stepValue)
-//    {
-//        
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* cart_json = [iSalesNetwork cart_incresement:self.cart_id increse:true];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                
-//                
-//                
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-////                    
-////                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-////                        [self.delegate returnQTY:sender.value ];
-//                   // }
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//                
-//                
-//
-//                
-//            });
-//        });
-//        //increse;
-//    }
-//    else if(val_change==-(int)sender.stepValue)
-//    {
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* cart_json = [iSalesNetwork cart_incresement:self.cart_id increse:false];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                
-//                
-//                
-//                
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//
-//                
-//            });
-//        });
-//        
-//    }
-//    else
-//    {
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//            
-//            NSDictionary* cart_json = [iSalesNetwork cart_setQTY:self.cart_id value:sender.value];
-//            
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                
-//                if([[cart_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    if(self.onReturnQTY)
-//                        self.onReturnQTY(sender.value,cart_json);
-////                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-////                        [self.delegate returnQTY:sender.value ];
-////                    }
-//                }
-//                else
-//                {
-//                    UIViewController* vc=[RAUtils getViewController :self];
-//                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                }
-//                
-//
-//                
-//            });
-//        });
-//        
-//        //setvalue;
-//    }
     self.pre_val = (int)sender.value;
     
     
@@ -188,38 +98,16 @@
         {
             UIViewController* vc=[RAUtils getViewController :self];
             [((CartViewController *)vc).itemListTable reloadData];
-            [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+            [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
+            
+            ;
         }
         
         
         
     }];
     
-//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                NSDictionary* cart_json = [RANetwork cart_setQTY:self.cart_id value:self.pre_val];
-//
-//                dispatch_async(dispatch_get_main_queue(), ^{
-//                    self.totalchange=0;
-//                    if([[cart_json valueForKey:@"result"] intValue]==2)
-//                    {
-//                        if(self.onReturnQTY)
-//                            self.onReturnQTY(self.pre_val,cart_json);
-//    //                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-//    //                        [self.delegate returnQTY:sender.value ];
-//    //                    }
-//                    }
-//                    else
-//                    {
-//                        UIViewController* vc=[RAUtils getViewController :self];
-//                        [((CartViewController *)vc).itemListTable reloadData];
-//                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                    }
-//
-//
-//
-//                });
-//            });
+
     
     
 }
@@ -406,7 +294,9 @@
     if ((int)qty % (int)self.stepper.stepValue != 0) {
         UIViewController* vc=[RAUtils getViewController :self];
         [((CartViewController *)vc).itemListTable reloadData];
-        [RAUtils message_alert:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)] title:@"Change Model Count" controller:vc];
+        [RAUtils message_box:@"Change Model Count" message:[NSString stringWithFormat:@"Sold in quantities of %d",(int)(self.stepper.stepValue)] completion:nil];
+        
+        
         return;
     }
 #endif
@@ -445,39 +335,13 @@
                     {
                         UIViewController* vc=[RAUtils getViewController :self];
                         [((CartViewController *)vc).itemListTable reloadData];
-                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+                        [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
                     }
                     
                     
                     
                 }];
                 
-//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//                    NSDictionary* cart_json = [RANetwork cart_setQTY:self.cart_id value:qty];
-//
-//                    dispatch_async(dispatch_get_main_queue(), ^{
-//
-//                        if([[cart_json valueForKey:@"result"] intValue]==2)
-//                        {
-//                            //                if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
-//                            //                    [self.delegate returnQTY:qty];
-//                            //                }
-//
-//                            if(self.onReturnQTY)
-//                                self.onReturnQTY(qty,cart_json);
-//                        }
-//                        else
-//                        {
-//                            UIViewController* vc=[RAUtils getViewController :self];
-//                            [((CartViewController *)vc).itemListTable reloadData];
-//                            [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
-//                        }
-//
-//
-//
-//                    });
-//                });
 
             }];
             
@@ -516,7 +380,7 @@
                 {
                     UIViewController* vc=[RAUtils getViewController :self];
                     [((CartViewController *)vc).itemListTable reloadData];
-                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+                    [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
                 }
                 
                 
@@ -542,7 +406,7 @@
 //                    {
 //                        UIViewController* vc=[RAUtils getViewController :self];
 //                        [((CartViewController *)vc).itemListTable reloadData];
-//                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Change Model Count" controller:vc] ;
+//                        [RAUtils message_box:[cart_json valueForKey:@"err_msg"] message:[cart_json valueForKey:@"err_msg"] completion:nil] ;
 //                    }
 //
 //

+ 3 - 2
RedAnt ERP Mobile/iSales-CONTRAST/config.h

@@ -20,7 +20,7 @@
 #define RA_NOTIFICATION
 
 # ifdef DEBUG
-
+    # define test_server
 # endif
 
 #define exception_switch 1
@@ -154,7 +154,8 @@
 #define URL_CHANGE_PASSWORD @""
 #define URL_SIGN_UP @""
 
-#define  URL_ORDER_DISCOUNT  @"http://192.168.0.133:80/pjHmlg/isales/setOrderItemDiscount.htm"
+//#define  URL_ORDER_DISCOUNT  @"http://192.168.0.133:80/pjHmlg/isales/setOrderItemDiscount.htm"
+#define  URL_ORDER_DISCOUNT  @"http://192.168.0.133:80/pjHmlg/isales/setOrderDiscount.htm"
 
 #define  URL_ERR_LOG  @"http://192.168.0.133:80/pjHmlg/isales/er_log.htm"
 

+ 29 - 2
RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj

@@ -7,6 +7,9 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		3C23B40429D4226F008E7C14 /* PopWaitAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B40129D4226F008E7C14 /* PopWaitAlert.m */; };
+		3C23B40529D4226F008E7C14 /* MessageBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B40229D4226F008E7C14 /* MessageBox.m */; };
+		3C23B40629D4226F008E7C14 /* RAPopviewContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B40329D4226F008E7C14 /* RAPopviewContainer.m */; };
 		3C2F99BB237BE1880000808F /* PortfolioListTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F99BA237BE1880000808F /* PortfolioListTableViewCell.m */; };
 		3C2F99BF237BE7190000808F /* NPD_Mobile.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3C2F99BE237BE7190000808F /* NPD_Mobile.storyboard */; };
 		3C3E26B527CDF87000EF6F5C /* UIView+Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3E26B327CDF87000EF6F5C /* UIView+Toast.m */; };
@@ -301,6 +304,12 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		3C23B3FE29D4226F008E7C14 /* MessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageBox.h; sourceTree = "<group>"; };
+		3C23B3FF29D4226F008E7C14 /* PopWaitAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopWaitAlert.h; sourceTree = "<group>"; };
+		3C23B40029D4226F008E7C14 /* RAPopviewContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAPopviewContainer.h; sourceTree = "<group>"; };
+		3C23B40129D4226F008E7C14 /* PopWaitAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopWaitAlert.m; sourceTree = "<group>"; };
+		3C23B40229D4226F008E7C14 /* MessageBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageBox.m; sourceTree = "<group>"; };
+		3C23B40329D4226F008E7C14 /* RAPopviewContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAPopviewContainer.m; sourceTree = "<group>"; };
 		3C2F99B9237BE1880000808F /* PortfolioListTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PortfolioListTableViewCell.h; path = common/Functions/portfolio/PortfolioListTableViewCell.h; sourceTree = SOURCE_ROOT; };
 		3C2F99BA237BE1880000808F /* PortfolioListTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListTableViewCell.m; path = common/Functions/portfolio/PortfolioListTableViewCell.m; sourceTree = SOURCE_ROOT; };
 		3C2F99BE237BE7190000808F /* NPD_Mobile.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NPD_Mobile.storyboard; sourceTree = "<group>"; };
@@ -836,6 +845,20 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		3C23B3FD29D4226F008E7C14 /* MessageBox */ = {
+			isa = PBXGroup;
+			children = (
+				3C23B3FE29D4226F008E7C14 /* MessageBox.h */,
+				3C23B3FF29D4226F008E7C14 /* PopWaitAlert.h */,
+				3C23B40029D4226F008E7C14 /* RAPopviewContainer.h */,
+				3C23B40129D4226F008E7C14 /* PopWaitAlert.m */,
+				3C23B40229D4226F008E7C14 /* MessageBox.m */,
+				3C23B40329D4226F008E7C14 /* RAPopviewContainer.m */,
+			);
+			name = MessageBox;
+			path = "HMLG Scan Order/MessageBox";
+			sourceTree = SOURCE_ROOT;
+		};
 		3CA2109D2761DA66000FC2F3 /* PhotoList */ = {
 			isa = PBXGroup;
 			children = (
@@ -1326,6 +1349,7 @@
 		716387C71953CDB4006E65E6 /* utils */ = {
 			isa = PBXGroup;
 			children = (
+				3C23B3FD29D4226F008E7C14 /* MessageBox */,
 				3CA2110F2761EBC8000FC2F3 /* common_const.h */,
 				3CA211062761E9F8000FC2F3 /* DBUtil.h */,
 				3CA211052761E9F8000FC2F3 /* DBUtil.m */,
@@ -2051,6 +2075,7 @@
 				712AFEE21DBA077F00254965 /* pdfCreator.m in Sources */,
 				71BBA2401CEAEF0700C91DED /* ioapi.c in Sources */,
 				71CB63E62109B8CC00DC90F9 /* MainHeaderViewColorPanel.m in Sources */,
+				3C23B40629D4226F008E7C14 /* RAPopviewContainer.m in Sources */,
 				7162A5461C58719D00AB630E /* RATreeView+Enums.m in Sources */,
 				7162A54B1C58719D00AB630E /* RAViewController.m in Sources */,
 				71BBA2411CEAEF0700C91DED /* mztools.c in Sources */,
@@ -2068,6 +2093,7 @@
 				3CA211072761E9F8000FC2F3 /* DBUtil.m in Sources */,
 				3CA210B42761DAF2000FC2F3 /* RAUtils.m in Sources */,
 				428980481E249339005F1BD8 /* JKMessageBoxController.m in Sources */,
+				3C23B40429D4226F008E7C14 /* PopWaitAlert.m in Sources */,
 				7162A5741C58728D00AB630E /* DetailViewController.m in Sources */,
 				7162A52A1C58713200AB630E /* CategoryCellNPD.m in Sources */,
 				71DF748E1C57608F00F2789C /* UILabel+FontAppearance.m in Sources */,
@@ -2123,6 +2149,7 @@
 				71DF74841C57608F00F2789C /* ImageScrollerViewController.m in Sources */,
 				3C7E5A91237BDB26006D0105 /* PortfolioListViewController.m in Sources */,
 				3CA2110E2761EA7E000FC2F3 /* RAProgressHUD.m in Sources */,
+				3C23B40529D4226F008E7C14 /* MessageBox.m in Sources */,
 				71DF74861C57608F00F2789C /* ImageViewController.m in Sources */,
 				3CA211032761DC95000FC2F3 /* EnumSelectorCell.m in Sources */,
 				7162A5821C5872EF00AB630E /* HomeTableViewCellButtonBanner.m in Sources */,
@@ -2309,7 +2336,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 230309;
+				CURRENT_PROJECT_VERSION = 2352985;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2353,7 +2380,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 230309;
+				CURRENT_PROJECT_VERSION = 2352985;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",

+ 27 - 0
RedAnt ERP Mobile/iSales-USAI.xcodeproj/project.pbxproj

@@ -7,6 +7,9 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		3C23B40E29D422B7008E7C14 /* PopWaitAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B40B29D422B6008E7C14 /* PopWaitAlert.m */; };
+		3C23B40F29D422B7008E7C14 /* MessageBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B40C29D422B6008E7C14 /* MessageBox.m */; };
+		3C23B41029D422B7008E7C14 /* RAPopviewContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C23B40D29D422B6008E7C14 /* RAPopviewContainer.m */; };
 		3C2F99B8237BE1790000808F /* PortfolioListTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F99B6237BE1790000808F /* PortfolioListTableViewCell.m */; };
 		3C51492F273CF9B900F78617 /* DBUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C51492E273CF9B900F78617 /* DBUtil.m */; };
 		3C514932273D092A00F78617 /* EnumSelectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C514931273D092A00F78617 /* EnumSelectViewController.m */; };
@@ -311,6 +314,12 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		3C23B40829D422B6008E7C14 /* MessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageBox.h; sourceTree = "<group>"; };
+		3C23B40929D422B6008E7C14 /* PopWaitAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopWaitAlert.h; sourceTree = "<group>"; };
+		3C23B40A29D422B6008E7C14 /* RAPopviewContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAPopviewContainer.h; sourceTree = "<group>"; };
+		3C23B40B29D422B6008E7C14 /* PopWaitAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopWaitAlert.m; sourceTree = "<group>"; };
+		3C23B40C29D422B6008E7C14 /* MessageBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageBox.m; sourceTree = "<group>"; };
+		3C23B40D29D422B6008E7C14 /* RAPopviewContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAPopviewContainer.m; sourceTree = "<group>"; };
 		3C2F99B6237BE1790000808F /* PortfolioListTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListTableViewCell.m; path = common/Functions/portfolio/PortfolioListTableViewCell.m; sourceTree = SOURCE_ROOT; };
 		3C2F99B7237BE1790000808F /* PortfolioListTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PortfolioListTableViewCell.h; path = common/Functions/portfolio/PortfolioListTableViewCell.h; sourceTree = SOURCE_ROOT; };
 		3C51492D273CF9B900F78617 /* DBUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DBUtil.h; path = common/DBUtil.h; sourceTree = SOURCE_ROOT; };
@@ -886,6 +895,20 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		3C23B40729D422B6008E7C14 /* MessageBox */ = {
+			isa = PBXGroup;
+			children = (
+				3C23B40829D422B6008E7C14 /* MessageBox.h */,
+				3C23B40929D422B6008E7C14 /* PopWaitAlert.h */,
+				3C23B40A29D422B6008E7C14 /* RAPopviewContainer.h */,
+				3C23B40B29D422B6008E7C14 /* PopWaitAlert.m */,
+				3C23B40C29D422B6008E7C14 /* MessageBox.m */,
+				3C23B40D29D422B6008E7C14 /* RAPopviewContainer.m */,
+			);
+			name = MessageBox;
+			path = "HMLG Scan Order/MessageBox";
+			sourceTree = SOURCE_ROOT;
+		};
 		3C514975273E07C400F78617 /* EnumSelectAndSort\ */ = {
 			isa = PBXGroup;
 			children = (
@@ -1539,6 +1562,7 @@
 		716387C71953CDB4006E65E6 /* utils */ = {
 			isa = PBXGroup;
 			children = (
+				3C23B40729D422B6008E7C14 /* MessageBox */,
 				3C51499A273E0B6400F78617 /* common_const.h */,
 				71DF74311C5757C800F2789C /* CommonUI */,
 				71C1D84C1F456CAA00CEA1C9 /* HWWeakTimer.h */,
@@ -2177,6 +2201,7 @@
 				3C2F99B8237BE1790000808F /* PortfolioListTableViewCell.m in Sources */,
 				71DF742B1C57560600F2789C /* Reachability.m in Sources */,
 				7162A5701C58728D00AB630E /* DetailHeaderCell.m in Sources */,
+				3C23B40F29D422B7008E7C14 /* MessageBox.m in Sources */,
 				71BBA2271CEAC16000C91DED /* ZipArchive.mm in Sources */,
 				7162A5491C58719D00AB630E /* RATreeView+TableViewDelegate.m in Sources */,
 				3C514950273D095900F78617 /* CommonEditorCellModel.m in Sources */,
@@ -2202,6 +2227,7 @@
 				3C514947273D095900F78617 /* CommonEditorCellSwitch.m in Sources */,
 				7162A5251C58706C00AB630E /* CategoryCellSmall.m in Sources */,
 				712AFEDA1DBA050200254965 /* ImageDrawable.m in Sources */,
+				3C23B40E29D422B7008E7C14 /* PopWaitAlert.m in Sources */,
 				428980721E24B1E9005F1BD8 /* RASingleton.m in Sources */,
 				3C514953273D096A00F78617 /* CommonEditorViewController.m in Sources */,
 				71E9F6C21F8B57E40052C78E /* RANetworkTaskDelegate.m in Sources */,
@@ -2300,6 +2326,7 @@
 				7162A5601C58724700AB630E /* CustomerEditViewController.m in Sources */,
 				7162A5DC1C5876E300AB630E /* LoginViewController.m in Sources */,
 				3C51495F273D09B800F78617 /* MonthPickerViewController.m in Sources */,
+				3C23B41029D422B7008E7C14 /* RAPopviewContainer.m in Sources */,
 				4289805D1E249375005F1BD8 /* UIColor+JK_HEX.m in Sources */,
 				7162A5811C5872EF00AB630E /* HomeTableViewCellBanner.m in Sources */,
 				3C514956273D097E00F78617 /* CommonEditorTableContainerView.m in Sources */,

+ 1 - 1
Redant Drivers/Apex And Drivers/config.h

@@ -21,7 +21,7 @@
 #define GET_JSON
 
 # ifdef DEBUG
-#define test_server
+//#define test_server
 # endif
 
 #ifdef test_server

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است