Przeglądaj źródła

1.修改UWAVER Create Hang Tag使用Dialog填写预览Name、Note。

Pen Li 7 lat temu
rodzic
commit
e1a8029000

+ 151 - 0
RedAnt ERP Mobile/common/Functions/portfolio/Portfolio.storyboard

@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="ipad9_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--Portfolio Input Dialog-->
+        <scene sceneID="GLj-SV-WZ3">
+            <objects>
+                <viewController storyboardIdentifier="RAPortfolioInputDialog" useStoryboardIdentifierAsRestorationIdentifier="YES" id="4AT-7a-mKa" customClass="RAPortfolioInputDialog" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="chD-ji-F46"/>
+                        <viewControllerLayoutGuide type="bottom" id="URz-mp-cJW"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="5cC-E9-TYt">
+                        <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DWa-D5-f6B">
+                                <rect key="frame" x="10" y="30" width="748" height="20.5"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Please Input Name:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RXC-oa-YfN">
+                                <rect key="frame" x="10" y="60.5" width="748" height="20.5"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Lya-k8-I3a">
+                                <rect key="frame" x="10" y="91" width="748" height="30"/>
+                                <nil key="textColor"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <textInputTraits key="textInputTraits"/>
+                            </textField>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Please Input Note:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y7H-Ls-QEd">
+                                <rect key="frame" x="10" y="131" width="748" height="20.5"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="VnX-n5-NuF">
+                                <rect key="frame" x="10" y="161.5" width="748" height="30"/>
+                                <nil key="textColor"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <textInputTraits key="textInputTraits"/>
+                            </textField>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cyS-Hc-YQq">
+                                <rect key="frame" x="0.0" y="196.5" width="768" height="0.5"/>
+                                <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="0.5" id="Zw9-I1-MoG"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="akG-jo-sH8">
+                                <rect key="frame" x="10" y="202" width="748" height="40"/>
+                                <subviews>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2jJ-ZG-toj">
+                                        <rect key="frame" x="0.0" y="0.0" width="374" height="40"/>
+                                        <subviews>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bZf-f4-yOj">
+                                                <rect key="frame" x="163" y="5" width="48" height="30"/>
+                                                <state key="normal" title="Cancel"/>
+                                                <connections>
+                                                    <action selector="cancelBtnClick:" destination="4AT-7a-mKa" eventType="touchUpInside" id="dUP-pQ-gbG"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        <constraints>
+                                            <constraint firstItem="bZf-f4-yOj" firstAttribute="centerX" secondItem="2jJ-ZG-toj" secondAttribute="centerX" id="AMV-tW-eXM"/>
+                                            <constraint firstItem="bZf-f4-yOj" firstAttribute="centerY" secondItem="2jJ-ZG-toj" secondAttribute="centerY" id="JiE-tP-PsU"/>
+                                        </constraints>
+                                    </view>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1C8-Nw-2Y3">
+                                        <rect key="frame" x="374" y="0.0" width="374" height="40"/>
+                                        <subviews>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fCn-Up-Kxk">
+                                                <rect key="frame" x="160" y="5" width="54" height="30"/>
+                                                <state key="normal" title="Preview"/>
+                                                <connections>
+                                                    <action selector="previewBtnClick:" destination="4AT-7a-mKa" eventType="touchUpInside" id="FbT-rC-WKi"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        <constraints>
+                                            <constraint firstItem="fCn-Up-Kxk" firstAttribute="centerX" secondItem="1C8-Nw-2Y3" secondAttribute="centerX" id="SNZ-r5-fbA"/>
+                                            <constraint firstItem="fCn-Up-Kxk" firstAttribute="centerY" secondItem="1C8-Nw-2Y3" secondAttribute="centerY" id="TKU-l3-ENe"/>
+                                        </constraints>
+                                    </view>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstItem="1C8-Nw-2Y3" firstAttribute="width" secondItem="2jJ-ZG-toj" secondAttribute="width" id="1g4-0B-rhm"/>
+                                    <constraint firstAttribute="height" constant="40" id="G7S-ri-PaF"/>
+                                    <constraint firstAttribute="bottom" secondItem="2jJ-ZG-toj" secondAttribute="bottom" id="HPW-MI-Bbp"/>
+                                    <constraint firstAttribute="bottom" secondItem="1C8-Nw-2Y3" secondAttribute="bottom" id="Pyq-1a-PZ8"/>
+                                    <constraint firstAttribute="trailing" secondItem="1C8-Nw-2Y3" secondAttribute="trailing" id="SVK-nX-YOV"/>
+                                    <constraint firstItem="2jJ-ZG-toj" firstAttribute="top" secondItem="akG-jo-sH8" secondAttribute="top" id="fri-By-rHT"/>
+                                    <constraint firstItem="1C8-Nw-2Y3" firstAttribute="top" secondItem="akG-jo-sH8" secondAttribute="top" id="sJB-dO-fKQ"/>
+                                    <constraint firstItem="1C8-Nw-2Y3" firstAttribute="leading" secondItem="2jJ-ZG-toj" secondAttribute="trailing" id="vSO-oU-LP6"/>
+                                    <constraint firstItem="2jJ-ZG-toj" firstAttribute="leading" secondItem="akG-jo-sH8" secondAttribute="leading" id="y2C-0W-A8J"/>
+                                </constraints>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <constraints>
+                            <constraint firstItem="Lya-k8-I3a" firstAttribute="top" secondItem="RXC-oa-YfN" secondAttribute="bottom" constant="10" id="0N6-Wf-LYP"/>
+                            <constraint firstItem="Y7H-Ls-QEd" firstAttribute="top" secondItem="Lya-k8-I3a" secondAttribute="bottom" constant="10" id="2Uj-Ne-ywH"/>
+                            <constraint firstItem="RXC-oa-YfN" firstAttribute="top" secondItem="DWa-D5-f6B" secondAttribute="bottom" constant="10" id="3CY-ZU-gc8"/>
+                            <constraint firstItem="VnX-n5-NuF" firstAttribute="leading" secondItem="Y7H-Ls-QEd" secondAttribute="leading" id="9GC-q6-WXn"/>
+                            <constraint firstItem="Y7H-Ls-QEd" firstAttribute="trailing" secondItem="Lya-k8-I3a" secondAttribute="trailing" id="C3I-HU-2KQ"/>
+                            <constraint firstItem="Y7H-Ls-QEd" firstAttribute="leading" secondItem="Lya-k8-I3a" secondAttribute="leading" id="H3j-Mn-T3Z"/>
+                            <constraint firstItem="DWa-D5-f6B" firstAttribute="top" secondItem="chD-ji-F46" secondAttribute="bottom" constant="10" id="JN8-jE-jXr"/>
+                            <constraint firstItem="cyS-Hc-YQq" firstAttribute="width" secondItem="5cC-E9-TYt" secondAttribute="width" id="Oka-Ok-koI"/>
+                            <constraint firstItem="Lya-k8-I3a" firstAttribute="trailing" secondItem="RXC-oa-YfN" secondAttribute="trailing" id="SsO-JO-tmD"/>
+                            <constraint firstItem="cyS-Hc-YQq" firstAttribute="top" secondItem="VnX-n5-NuF" secondAttribute="bottom" constant="5" id="Tbe-3m-2JZ"/>
+                            <constraint firstItem="akG-jo-sH8" firstAttribute="leading" secondItem="VnX-n5-NuF" secondAttribute="leading" id="UF2-fG-uSd"/>
+                            <constraint firstItem="Lya-k8-I3a" firstAttribute="leading" secondItem="RXC-oa-YfN" secondAttribute="leading" id="Uvg-0i-4LY"/>
+                            <constraint firstItem="DWa-D5-f6B" firstAttribute="leading" secondItem="5cC-E9-TYt" secondAttribute="leading" constant="10" id="W5b-9F-zx8"/>
+                            <constraint firstItem="akG-jo-sH8" firstAttribute="trailing" secondItem="VnX-n5-NuF" secondAttribute="trailing" id="Xfg-Ns-Y8W"/>
+                            <constraint firstItem="VnX-n5-NuF" firstAttribute="trailing" secondItem="Y7H-Ls-QEd" secondAttribute="trailing" id="Z3F-Wn-1oD"/>
+                            <constraint firstAttribute="trailing" secondItem="DWa-D5-f6B" secondAttribute="trailing" constant="10" id="ZUF-d7-yWd"/>
+                            <constraint firstItem="RXC-oa-YfN" firstAttribute="leading" secondItem="DWa-D5-f6B" secondAttribute="leading" id="aPx-gS-xES"/>
+                            <constraint firstItem="VnX-n5-NuF" firstAttribute="top" secondItem="Y7H-Ls-QEd" secondAttribute="bottom" constant="10" id="ajr-9r-nIn"/>
+                            <constraint firstItem="akG-jo-sH8" firstAttribute="top" secondItem="cyS-Hc-YQq" secondAttribute="bottom" constant="5" id="rfi-eF-dI9"/>
+                            <constraint firstItem="cyS-Hc-YQq" firstAttribute="leading" secondItem="5cC-E9-TYt" secondAttribute="leading" id="vyQ-Vo-RG8"/>
+                            <constraint firstItem="RXC-oa-YfN" firstAttribute="trailing" secondItem="DWa-D5-f6B" secondAttribute="trailing" id="xHj-Kc-afb"/>
+                        </constraints>
+                    </view>
+                    <connections>
+                        <outlet property="nameField" destination="Lya-k8-I3a" id="Ju2-P0-glc"/>
+                        <outlet property="nameLabel" destination="RXC-oa-YfN" id="lkp-3p-tfZ"/>
+                        <outlet property="noteField" destination="VnX-n5-NuF" id="xS3-g0-21a"/>
+                        <outlet property="noteLabel" destination="Y7H-Ls-QEd" id="Mhc-IO-spR"/>
+                        <outlet property="titleLabel" destination="DWa-D5-f6B" id="HuD-Ho-wDB"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="BOF-RV-Hik" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-92.1875" y="107.8125"/>
+        </scene>
+    </scenes>
+</document>

+ 218 - 6
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m

@@ -25,6 +25,12 @@
 #import "SortButton.h"
 #import "TextUtils.h"
 
+#ifdef BUILD_UWAVER
+
+#import "RAPortfolioInputDialog.h"
+
+#endif
+
 #define ALERT_DEL 1025
 #define checked_Count @"checkedCount"
 @interface PortfolioViewController ()
@@ -352,6 +358,20 @@
 }
 - (IBAction)onCreateTearSheet:(id)sender {
     
+#ifdef BUILD_UWAVER
+
+    [self createPreviewPortfolio];
+
+#else
+    
+    [self createTearSheet];
+    
+#endif
+    
+}
+
+- (void)createTearSheet {
+    
     
     self.pdf_url= nil;
     NSMutableArray* checked = [[NSMutableArray alloc] init];
@@ -376,7 +396,7 @@
 #ifdef BUILD_UWAVER
         title = @"Cannot Create Hang Tag.";
 #else
-        title:@"Cannot Create Portfolio.";
+    title:@"Cannot Create Portfolio.";
 #endif
         [RAUtils message_alert:@"You must select at least one model." title:title controller:self] ;
         return;
@@ -412,8 +432,8 @@
     };
     VC.onSaved=^(NSString* url,NSString* name,bool isLocalFile)
     {
-       // NSString* name=[self.content_data[indexPath.row] valueForKey:@"tear_name"];
-       // NSString* url= [self.content_data[indexPath.row] valueForKey:@"pdf_path"];
+        // NSString* name=[self.content_data[indexPath.row] valueForKey:@"tear_name"];
+        // NSString* url= [self.content_data[indexPath.row] valueForKey:@"pdf_path"];
         
         RAPDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
         ViewController.url = url;
@@ -443,17 +463,17 @@
         //                    {
         //                        subject = [NSString stringWithFormat:@"Tear sheet for %@",company ];
         //                    }
-//        ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
+        //        ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
         ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:name]];
         ViewController.mail_subject = subject;
         
         ViewController.hidenavi = false;
         [self.navigationController pushViewController:ViewController animated:YES];
     };
-//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     VC.onDismiss=^(NSString* catelog_name)
     {
-          
+        
     };
     
     //
@@ -478,7 +498,199 @@
     }];
     
     [self.btnselect setTitle:@"Select all"];
+}
+
+- (void)createPreviewPortfolio {
     
+    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)
+        {
+            [checked addObject:[NSNumber numberWithInt:[[item_json valueForKey:@"product_id"] intValue]]];
+            [checked_iid addObject:[NSNumber numberWithInt:[[item_json valueForKey:@"item_id"] intValue]]];
+        }
+    }
+    //     disable for debug
+    if(checked.count==0)
+    {
+        NSString *title = @"Cannot Create Portfolio.";
+#ifdef BUILD_UWAVER
+        title = @"Cannot Create Hang Tag.";
+#else
+    title:@"Cannot Create Portfolio.";
+#endif
+        [RAUtils message_alert:@"You must select at least one model." title:title controller:self] ;
+        return;
+    }
+    
+    __weak typeof(self) weakSelf = self;
+    [RAPortfolioInputDialog presentDialogBy:self withCompletion:^(BOOL preview, NSString *name, NSString *note) {
+       
+        if (preview) {
+            [weakSelf createPreviewPortfolio:name Note:note ProductIds:checked ItemIds:checked_iid];
+        }
+        
+    }];
+    
+}
+
+- (void)createPreviewPortfolio:(NSString *)catelog_name Note:(NSString *)internal_note ProductIds:(NSArray *)productIds ItemIds:(NSArray *)itemIds {
+    
+    if (catelog_name.length == 0) {
+        NSString *msg = @"Portfolio name can not be empty";
+#ifdef BUILD_UWAVER
+        msg = @"hang tag name can not be empty";
+#else
+        msg = @"Portfolio name can not be empty";
+#endif
+        [RAUtils message_alert:msg title:@"Warning" controller:self];
+        return;
+    }
+    
+    self.pdf_url= nil;
+    
+    NSString* pdf_url = [self.content_data valueForKey:@"pdf_url"];
+    if (!pdf_url) {
+        pdf_url = @"";
+    }
+    
+    NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
+    
+    NSString * string = [productIds componentsJoinedByString:@","];
+    
+    NSString * string_iid = [itemIds componentsJoinedByString:@","];
+    [params setValue:string forKey:@"product_ids"];
+    [params setValue:string_iid forKey:@"item_ids"];
+    [params setObject:@(self.sortIndex) forKey:@"sort"];
+    [params setObject:pdf_url forKey:@"pdfUrl"];
+    
+    
+    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Processing"];
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        
+        NSDictionary* editor_json = [RANetwork request_TearSheet:params];
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+            
+            
+            if([[editor_json valueForKey:@"result"] intValue]==2)
+            {
+                
+                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 = [self.storyboard instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
+                ViewController.url = url;
+                ViewController.canSave = true;
+                ViewController.isLocalfile=isLocalFile;
+
+                ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
+                ViewController.save_name =catelog_name;
+                ViewController.save_note =internal_note;
+
+                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.onSavePDF=^(NSString* name,NSString* file)
+                {
+                    
+                    
+                    NSString* del_ids = nil;
+                    
+                    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Saving..."];
+                    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+                        
+                        
+#ifdef OFFLINE_MODE
+                        if (appDelegate.offline_mode)
+                        {
+                            [params setValue:url forKey:@"pdfPath"];
+                        }
+                        else
+#endif
+                        {
+                            [params setValue:path forKey:@"pdfPath"];
+                        }
+                        [params setValue:name forKey:@"pdfName"];
+                        [params setValue:internal_note forKey:@"pdfNote"];
+                        [params setValue:del_ids forKey:@"itemIds"];
+                        [params setValue:pdf_url forKey:@"configureParams"];
+                        
+                        
+                        
+                        NSDictionary* json = [RANetwork save_TearSheet:params];
+                        
+                        dispatch_async(dispatch_get_main_queue(), ^{
+                            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                            
+                            
+                            if([[json valueForKey:@"result"] intValue]==2)
+                            {
+                                [RAUtils alert_view:nil title:@"Portfolio saved. You can find it from View Portfolios" ] ;
+                                
+                                [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
+                                }];
+                            }
+                            else
+                            {
+                                [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
+                            }
+                            
+                        });
+                    });
+                    
+                    
+                    
+                };
+
+                ViewController.hidenavi = false;
+                [self.navigationController pushViewController:ViewController animated:YES];
+                
+            }
+            else
+            {
+                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Portfolio" controller:self] ;
+            }
+            
+        });
+    });
     
 }
 

+ 15 - 0
RedAnt ERP Mobile/common/Functions/portfolio/RAPortfolioInputDialog.h

@@ -0,0 +1,15 @@
+//
+//  RAPortfolioInputDialog.h
+//  iSales-UWAVER
+//
+//  Created by Jack on 2018/8/20.
+//  Copyright © 2018年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface RAPortfolioInputDialog : UIViewController
+
++ (void)presentDialogBy:(UIViewController *)viewController withCompletion:(void(^)(BOOL preview, NSString *name, NSString *note))completion;
+
+@end

+ 92 - 0
RedAnt ERP Mobile/common/Functions/portfolio/RAPortfolioInputDialog.m

@@ -0,0 +1,92 @@
+//
+//  RAPortfolioInputDialog.m
+//  iSales-UWAVER
+//
+//  Created by Jack on 2018/8/20.
+//  Copyright © 2018年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "RAPortfolioInputDialog.h"
+#import "config.h"
+
+@interface RAPortfolioInputDialog ()
+
+@property (nonatomic,strong) IBOutlet UILabel *titleLabel;
+@property (nonatomic,strong) IBOutlet UILabel *nameLabel;
+@property (nonatomic,strong) IBOutlet UILabel *noteLabel;
+@property (nonatomic,strong) IBOutlet UITextField *nameField;
+@property (nonatomic,strong) IBOutlet UITextField *noteField;
+
+@property (nonatomic,copy) void (^completion) (BOOL preview, NSString *name, NSString *note);
+
+@end
+
+@implementation RAPortfolioInputDialog
+
++ (instancetype)build {
+    RAPortfolioInputDialog *dialog = [[UIStoryboard storyboardWithName:@"Portfolio" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPortfolioInputDialog"];
+    return dialog;
+}
+
++ (void)presentDialogBy:(UIViewController *)viewController withCompletion:(void(^)(BOOL preview, NSString *name, NSString *note))completion {
+    
+    if (viewController == nil) {
+        return;
+    }
+    
+    RAPortfolioInputDialog *dialog = [self build];
+    dialog.completion = completion;
+    dialog.modalPresentationStyle = UIModalPresentationFormSheet;
+    dialog.preferredContentSize = CGSizeMake(360, 230);
+    
+    [viewController presentViewController:dialog animated:YES completion:nil];
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    
+    
+#ifdef BUILD_UWAVER
+    
+    self.titleLabel.text = @"Create Hang Tag";
+    self.nameLabel.text = @"Hang Tag Name:";
+    self.noteLabel.text = @"Hang Tag Note:";
+    
+#else
+    
+    self.titleLabel.text = @"Create Portfolio";
+    self.nameLabel.text = @"Portfolio Name:";
+    self.noteLabel.text = @"Portfolio Note:";
+    
+#endif
+    
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (IBAction)cancelBtnClick:(id)sender {
+    [self dismissViewControllerAnimated:YES completion:^{
+        if (self.completion) {
+            self.completion(NO, nil, nil);
+        }
+    }];
+}
+
+- (IBAction)previewBtnClick:(id)sender {
+    
+    NSString *name = self.nameField.text;
+    NSString *note = self.noteField.text;
+    
+    [self dismissViewControllerAnimated:YES completion:^{
+        if (self.completion) {
+            self.completion(YES, name, note);
+        }
+    }];
+}
+
+@end

+ 10 - 0
RedAnt ERP Mobile/iSales-UNITED WAVER.xcodeproj/project.pbxproj

@@ -48,6 +48,8 @@
 		42BEF35F1E89FEE300632AB6 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF35E1E89FEE300632AB6 /* CoreData.framework */; };
 		42BEF3621E8A005800632AB6 /* GoogleAnalyst.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BEF3611E8A005800632AB6 /* GoogleAnalyst.m */; };
 		42BF67CC1E5179970081F90A /* ERPUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BF67CB1E5179970081F90A /* ERPUtils.m */; };
+		42C72F67212A55090054722D /* RAPortfolioInputDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = 42C72F66212A55090054722D /* RAPortfolioInputDialog.m */; };
+		42C72F69212A55550054722D /* Portfolio.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 42C72F68212A55550054722D /* Portfolio.storyboard */; };
 		42D3A4A11EFA6D36007A54C1 /* ContentPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D3A49B1EFA6D36007A54C1 /* ContentPreviewController.m */; };
 		42D3A4A21EFA6D36007A54C1 /* PhotoList.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 42D3A49D1EFA6D36007A54C1 /* PhotoList.storyboard */; };
 		42D3A4A31EFA6D36007A54C1 /* PhotoPreviewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D3A4A01EFA6D36007A54C1 /* PhotoPreviewCell.m */; };
@@ -375,6 +377,9 @@
 		42BEF3611E8A005800632AB6 /* GoogleAnalyst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoogleAnalyst.m; sourceTree = "<group>"; };
 		42BF67CA1E5179970081F90A /* ERPUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ERPUtils.h; path = common/ERPUtils.h; sourceTree = SOURCE_ROOT; };
 		42BF67CB1E5179970081F90A /* ERPUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ERPUtils.m; path = common/ERPUtils.m; sourceTree = SOURCE_ROOT; };
+		42C72F65212A55090054722D /* RAPortfolioInputDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RAPortfolioInputDialog.h; path = common/Functions/portfolio/RAPortfolioInputDialog.h; sourceTree = SOURCE_ROOT; };
+		42C72F66212A55090054722D /* RAPortfolioInputDialog.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = RAPortfolioInputDialog.m; path = common/Functions/portfolio/RAPortfolioInputDialog.m; sourceTree = SOURCE_ROOT; };
+		42C72F68212A55550054722D /* Portfolio.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Portfolio.storyboard; path = common/Functions/portfolio/Portfolio.storyboard; sourceTree = SOURCE_ROOT; };
 		42D3A49A1EFA6D36007A54C1 /* ContentPreviewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentPreviewController.h; sourceTree = "<group>"; };
 		42D3A49B1EFA6D36007A54C1 /* ContentPreviewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContentPreviewController.m; sourceTree = "<group>"; };
 		42D3A49D1EFA6D36007A54C1 /* PhotoList.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = PhotoList.storyboard; sourceTree = "<group>"; };
@@ -1180,6 +1185,9 @@
 				7162A5A51C58735900AB630E /* PDFListViewController.m */,
 				7162A5A61C58735900AB630E /* PortfolioViewController.h */,
 				7162A5A71C58735900AB630E /* PortfolioViewController.m */,
+				42C72F65212A55090054722D /* RAPortfolioInputDialog.h */,
+				42C72F66212A55090054722D /* RAPortfolioInputDialog.m */,
+				42C72F68212A55550054722D /* Portfolio.storyboard */,
 				7162A5A81C58735900AB630E /* TearSheetParamViewController.h */,
 				7162A5A91C58735900AB630E /* TearSheetParamViewController.m */,
 				71D0344D1C9BF3C400E0F7AD /* PortfolioEditQTYViewController.h */,
@@ -2048,6 +2056,7 @@
 				7143E21D202FD21F00451903 /* editContact.json in Resources */,
 				7162A5A11C58733400AB630E /* offline_status_filter_cadedate.json in Resources */,
 				42B309791E45BA32007AFC62 /* status_filter_cadedate_po.json in Resources */,
+				42C72F69212A55550054722D /* Portfolio.storyboard in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2064,6 +2073,7 @@
 				71FFBBEA1C60894900D91DC2 /* RANetwork.m in Sources */,
 				428980161E24924D005F1BD8 /* SortItemCell.m in Sources */,
 				7162A59D1C58733400AB630E /* OrderDetailViewController.m in Sources */,
+				42C72F67212A55090054722D /* RAPortfolioInputDialog.m in Sources */,
 				7141DD3B1C5726B700F7DF59 /* DeviceInfo.m in Sources */,
 				71DF74671C575E7900F2789C /* EnumSelectorCell.m in Sources */,
 				712AFEDC1DBA050200254965 /* PDFDrawable.m in Sources */,