ソースを参照

1.修改RedAnt ERP Cart Note输入框。
2.修改RedAnt ERP订单提交后Cart按钮事件检查。

Pen Li 7 年 前
コミット
c77ddaaa7e

+ 4 - 0
RedAnt ERP Mobile/common/Functions/cart/CartGeneralNotesViewController.m

@@ -19,6 +19,10 @@
     [super viewDidLoad];
         self.tv_notes.text = self.notes;
     // Do any additional setup after loading the view.
+    self.automaticallyAdjustsScrollViewInsets = NO;
+    self.navigationController.navigationBar.translucent = NO;
+    self.tv_notes.layer.borderColor = [UIColor lightGrayColor].CGColor;
+    self.tv_notes.layer.borderWidth = 1.0f;
 }
 
 - (void)didReceiveMemoryWarning {

+ 39 - 0
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -1012,6 +1012,9 @@
 
 - (IBAction)onPlaceOrder:(UIButton *)sender {
     
+    if (![self isOrderAvailable]) {
+        return;
+    }
     
     [self placeOrder];
     
@@ -1339,6 +1342,10 @@
 }
 - (IBAction)onEditGeneralNotes:(id)sender {
     
+    if (![self isOrderAvailable]) {
+        return;
+    }
+    
     UIViewController* parentvc=self;
     
     
@@ -1493,6 +1500,9 @@
 //}
 - (IBAction)OnCancelOrderClicked:(id)sender {
     
+    if (![self isOrderAvailable]) {
+        return;
+    }
     
     UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Cancel Order" message:@"Are you sure to cancel the order in cart ?" preferredStyle:UIAlertControllerStyleAlert];
     //block代码块取代了delegate
@@ -1577,6 +1587,27 @@
     
 
 
+}
+
+#pragma mark - Private
+
+- (BOOL)isOrderAvailable {
+
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if (appDelegate.order_code.length == 0) {
+        
+        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"please create a new order first" preferredStyle:UIAlertControllerStyleAlert];
+        UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            
+        }];
+        
+        [alertVC addAction:okAction];
+        
+        [self presentViewController:alertVC animated:YES completion:nil];
+        
+        return NO;
+    }
+    return YES;
 }
 
 #pragma mark - commoneditor controller delegate
@@ -3318,6 +3349,10 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
 
 - (IBAction)emailButtonClick:(UIButton *)sender {
     
+    if (![self isOrderAvailable]) {
+        return;
+    }
+    
     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
 
     JKMessageBoxController *emailAddrVC = [JKMessageBoxController messageBoxControllerWithTip:@"Please enter email address"];
@@ -3386,6 +3421,10 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
 
 - (IBAction)printCartButtonClick:(UIButton *)sender {
     
+    if (![self isOrderAvailable]) {
+        return;
+    }
+    
     RAPDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
     
     ViewController.url = self.print_url;

+ 4 - 0
RedAnt ERP Mobile/common/Functions/cart/ItemNotesViewController.m

@@ -19,6 +19,10 @@
     
     self.tv_notes.text = self.notes;
     // Do any additional setup after loading the view.
+    self.automaticallyAdjustsScrollViewInsets = NO;
+    self.navigationController.navigationBar.translucent = NO;
+    self.tv_notes.layer.borderColor = [UIColor lightGrayColor].CGColor;
+    self.tv_notes.layer.borderWidth = 1.0f;
 }
 
 - (void)didReceiveMemoryWarning {

+ 6 - 20
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard

@@ -8228,23 +8228,16 @@ Email: redantsupport@united-us.net</string>
                         <rect key="frame" x="0.0" y="0.0" width="480" height="320"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Item notes:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="90Q-DQ-Par">
-                                <rect key="frame" x="41" y="48" width="90" height="26"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                                <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                <nil key="highlightedColor"/>
-                            </label>
                             <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" id="uaF-eS-aiA">
-                                <rect key="frame" x="41" y="82" width="419" height="170"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <rect key="frame" x="10" y="10" width="460" height="250"/>
+                                <autoresizingMask key="autoresizingMask" heightSizable="YES"/>
                                 <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"/>
                             </textView>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="2Mn-Q2-gEG" customClass="DefaultImageButton">
                                 <rect key="frame" x="358" y="270" width="102" height="30"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="20"/>
                                 <state key="normal" title="Save" backgroundImage="btn_save">
                                     <color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
@@ -8288,23 +8281,16 @@ Email: redantsupport@united-us.net</string>
                         <rect key="frame" x="0.0" y="0.0" width="480" height="320"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="General notes:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="YNX-KI-Jc2">
-                                <rect key="frame" x="41" y="48" width="112" height="26"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                                <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                <nil key="highlightedColor"/>
-                            </label>
                             <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" id="83p-xc-EHS">
-                                <rect key="frame" x="41" y="82" width="419" height="170"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <rect key="frame" x="10" y="10" width="460" height="250"/>
+                                <autoresizingMask key="autoresizingMask"/>
                                 <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"/>
                             </textView>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="S4A-xz-neh" customClass="DefaultImageButton">
                                 <rect key="frame" x="358" y="270" width="102" height="30"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="20"/>
                                 <state key="normal" title="Save" backgroundImage="btn_save">
                                     <color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>