|
|
@@ -351,80 +351,229 @@
|
|
|
|
|
|
|
|
|
}
|
|
|
-
|
|
|
else
|
|
|
-
|
|
|
{
|
|
|
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Checking Pending Order"];
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- 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 dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
-
|
|
|
- if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
+ [RANetwork request_pendingorder:appDelegate.contact_id completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSMutableDictionary* return_json =result;
|
|
|
+
|
|
|
+
|
|
|
+ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+
|
|
|
+ if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+
|
|
|
+ bool openPendingOrder= [[return_json valueForKey:@"hasPending"] boolValue];
|
|
|
+ bool createNewOrder=appDelegate.can_create_order;
|
|
|
+
|
|
|
+ if(openPendingOrder&&createNewOrder)
|
|
|
{
|
|
|
-
|
|
|
- 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 cursomer 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;
|
|
|
@@ -434,239 +583,391 @@
|
|
|
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 cursomer 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: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 cursomer 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];
|
|
|
- }
|
|
|
-
|
|
|
+ [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] ;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Check Pending Order" controller:vc] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+// 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 dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+//
|
|
|
+// 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 cursomer 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 cursomer 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] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
|
|
|
}
|