Преглед изворни кода

1.修改NPD以FormSheet形式呈现的视图大小不正确。
2.修改NPD Cart、Portfolio Customer编辑控制。

Pen Li пре 8 година
родитељ
комит
5251d17831

+ 33 - 2
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -2269,7 +2269,7 @@
     UITableViewRowAction *editRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Edit Price"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
         
         DebugLog(@"edit click");
-        if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
+        if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
             
             
             if (self.currentOrderIsMerged) { // 合并过的订单不能编辑价格
@@ -2668,8 +2668,39 @@
     } else if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
         if (appDelegate.customer_type == CustomerTypeStore) {
             return @[notifyMeAction,deleteRowAction,addWatchAction,editRowAction];
+            
         } else {
-            return @[notifyMeAction,deleteRowAction,addWatchAction];
+            
+            // normal
+//            NSArray *actionArray = @[notifyMeAction,deleteRowAction,addWatchAction];
+            
+            NSMutableArray *actionArray = [NSMutableArray array];
+            
+            // move to backorder
+            NSDictionary *section_json = [self jsonAtSection:indexPath.section];
+            BOOL available = [[section_json objectForKey:@"available"] boolValue]; // available list
+            if (self.back_order_flag && available) {
+//                actionArray = @[move2BackAction,notifyMeAction,deleteRowAction,addWatchAction];
+                [actionArray addObject:move2BackAction];
+            }
+            
+            [actionArray addObjectsFromArray:@[notifyMeAction,deleteRowAction,addWatchAction]];
+            
+            // edit price
+            NSMutableDictionary * item_json = nil;
+            if (self.back_order_flag) {
+                item_json = [[self itemJsonAtIndexPath:indexPath] mutableCopy];
+            } else {
+                item_json = [self.content_arr[indexPath.row] mutableCopy];
+            }
+            NSString* product_id = [item_json valueForKey:@"product_id"];
+            int is_rate = [item_json[@"is_rate"] intValue];
+            if(appDelegate.can_set_cart_price && product_id.length>0&& is_rate==0) {
+//                actionArray = @[move2BackAction,notifyMeAction,deleteRowAction,addWatchAction,editRowAction];
+                [actionArray addObject:editRowAction];
+            }
+            
+            return actionArray;
         }
     }
     else

+ 12 - 0
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m

@@ -1475,6 +1475,18 @@
         return arr;
       //  return @[deleteRowAction, editRowAction];
     }
+    else if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
+        if (appDelegate.customer_type == CustomerTypeStore) {
+            return @[deleteRowAction];
+        } else {
+            
+            if(appDelegate.can_set_tearsheet_price) {
+                return @[deleteRowAction,EditQTYAction];
+            } else {
+                return @[deleteRowAction];
+            }
+        }
+    }
     else
     return @[deleteRowAction];
     

+ 10 - 0
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard

@@ -931,6 +931,7 @@
                             </connections>
                         </barButtonItem>
                     </navigationItem>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
                     <connections>
@@ -1960,6 +1961,7 @@
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
+                    <value key="contentSizeForViewInPopover" type="size" width="540" height="620"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="540" height="620"/>
                     <connections>
@@ -5502,6 +5504,7 @@ Email: redantsupport@united-us.net</string>
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
                     <connections>
@@ -7230,6 +7233,7 @@ Email: redantsupport@united-us.net</string>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
                     <navigationItem key="navigationItem" title="Retrieve password" id="DaL-NM-hQp"/>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
                     <connections>
@@ -7325,6 +7329,7 @@ Email: redantsupport@united-us.net</string>
                             </connections>
                         </barButtonItem>
                     </navigationItem>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
                     <connections>
@@ -8284,6 +8289,7 @@ Email: redantsupport@united-us.net</string>
                             </connections>
                         </barButtonItem>
                     </navigationItem>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
                     <connections>
@@ -8343,6 +8349,7 @@ Email: redantsupport@united-us.net</string>
                             </connections>
                         </barButtonItem>
                     </navigationItem>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
                     <connections>
@@ -8583,6 +8590,7 @@ Email: redantsupport@united-us.net</string>
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
                     <connections>
@@ -8791,6 +8799,7 @@ Email: redantsupport@united-us.net</string>
                             </connections>
                         </barButtonItem>
                     </navigationItem>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="480"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="480"/>
                     <connections>
@@ -8881,6 +8890,7 @@ Email: redantsupport@united-us.net</string>
                             </connections>
                         </barButtonItem>
                     </navigationItem>
+                    <value key="contentSizeForViewInPopover" type="size" width="480" height="320"/>
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="480" height="320"/>
                     <connections>