|
|
@@ -291,12 +291,9 @@
|
|
|
|
|
|
UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
|
|
|
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:self.order_code withScreen:ScreenCodeOrderInfo];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ [RANetwork request_release_order:self.order_code withScreen:ScreenCodeOrderInfo completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* order_json =result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:^{
|
|
|
if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
@@ -315,11 +312,42 @@
|
|
|
{
|
|
|
[RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:self] ;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* order_json = [RANetwork release_Order:self.order_code withScreen:ScreenCodeOrderInfo];
|
|
|
+//
|
|
|
+// 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];
|
|
|
+//
|
|
|
+// // appDelegate.customerInfo=[[self.content_data objectForKey:@"customerInfo"] mutableCopy];
|
|
|
+// //
|
|
|
+// // appDelegate.contact_id=[appDelegate.customerInfo valueForKey:@"customer_cid"];
|
|
|
+// // if(self.selectOrder)
|
|
|
+// // self.selectOrder();
|
|
|
+// [self.navigationController popToRootViewControllerAnimated:false];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
}];
|
|
|
|
|
|
@@ -566,13 +594,9 @@
|
|
|
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Release Order"];
|
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
-
|
|
|
- NSDictionary* order_json = [RANetwork release_Order:appDelegate.order_code withScreen:ScreenCodeOrderInfo];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ [RANetwork request_release_order:appDelegate.order_code withScreen:ScreenCodeOrderInfo completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* order_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:^{
|
|
|
if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
[appDelegate closeOrder];
|
|
|
@@ -581,11 +605,32 @@
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:weakself] ;
|
|
|
+ [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:weakself] ;
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
- });
|
|
|
+ }];
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* order_json = [RANetwork release_Order:appDelegate.order_code withScreen:ScreenCodeOrderInfo];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+// if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// [appDelegate closeOrder];
|
|
|
+//
|
|
|
+// [weakself copyOrder];
|
|
|
+//
|
|
|
+// } else {
|
|
|
+//
|
|
|
+// [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:weakself] ;
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+// });
|
|
|
|
|
|
}];
|
|
|
|
|
|
@@ -679,12 +724,9 @@
|
|
|
|
|
|
{
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Signature"];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-
|
|
|
- NSDictionary* order_json = [RANetwork sign_Order:self.order_code path:img_url_up];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ [RANetwork request_update_order_signature:self.order_code path:img_url_up completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* order_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:^{
|
|
|
if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
@@ -731,7 +773,7 @@
|
|
|
|
|
|
|
|
|
#ifdef BUILD_HMLG
|
|
|
-
|
|
|
+
|
|
|
[self.content_data setValue:img_url_down forKey:@"sign_url"];
|
|
|
#endif
|
|
|
//self.btnSign.enabled = false;
|
|
|
@@ -745,11 +787,84 @@
|
|
|
{
|
|
|
[RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Signature" controller:self] ;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* order_json = [RANetwork sign_Order:self.order_code path:img_url_up];
|
|
|
+//
|
|
|
+// 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 = self.order_code;
|
|
|
+// // [appDelegate SetSo:[self.content_data valueForKey:@"so#"]];
|
|
|
+// //
|
|
|
+// //
|
|
|
+// // appDelegate.customerInfo=[[self.content_data objectForKey:@"customerInfo"] mutableCopy];
|
|
|
+// //
|
|
|
+// // appDelegate.contact_id=[appDelegate.customerInfo valueForKey:@"customer_cid"];
|
|
|
+// // [self.navigationController popViewControllerAnimated:false];
|
|
|
+// //
|
|
|
+// // [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+// // [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
+// // if(self.selectOrder)
|
|
|
+// // self.selectOrder(self.content_data);
|
|
|
+//#if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
|
|
|
+// int count = [[self.content_data objectForKey:@"count"] intValue];
|
|
|
+// for (int i = 0; i < count; i++) {
|
|
|
+// NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+// NSMutableDictionary *section = [[self.content_data objectForKey:key] mutableCopy];
|
|
|
+// NSString *type = [section objectForKey:@"type"];
|
|
|
+// if ([type isEqualToString:@"sign_url"]) {
|
|
|
+// [section setObject:img_url_down forKey:@"data"];
|
|
|
+// [self.content_data setObject:section forKey:key];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//#endif
|
|
|
+//
|
|
|
+//#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
|
|
|
+// int count = [[self.content_data objectForKey:@"count"] intValue];
|
|
|
+// for (int i = 0; i < count; i++) {
|
|
|
+// NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+// NSMutableDictionary *section = [[self.content_data objectForKey:key] mutableCopy];
|
|
|
+// NSString *type = [section objectForKey:@"type"];
|
|
|
+// if ([type isEqualToString:@"sign_url"]) {
|
|
|
+// [section setObject:img_url_down forKey:@"data"];
|
|
|
+// [self.content_data setObject:section forKey:key];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//#endif
|
|
|
+//
|
|
|
+//
|
|
|
+//#ifdef BUILD_HMLG
|
|
|
+//
|
|
|
+// [self.content_data setValue:img_url_down forKey:@"sign_url"];
|
|
|
+//#endif
|
|
|
+// //self.btnSign.enabled = false;
|
|
|
+// [self.detailTable reloadData];
|
|
|
+//
|
|
|
+// [RAUtils message_alert:@"Successful." title:@"Signature" controller:self];
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Signature" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -773,20 +888,18 @@
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Signature"];
|
|
|
|
|
|
__weak typeof(self) weakSelf = self;
|
|
|
- [NetworkUtils upload:imageData FileName:@"test.jpg" Params:params ToHost:URL_UPLOAD_IMG Result:^(NSMutableDictionary *json) {
|
|
|
-
|
|
|
+
|
|
|
+ [RANetwork request_fastupload:params filename:@"test.jpg" data:imageData url:URL_UPLOAD_IMG completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSMutableDictionary *json=result;
|
|
|
if([[json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
NSString* img_url_down = json[@"img_url_aname"];
|
|
|
NSString* img_url_up = json[@"img_url"];
|
|
|
{
|
|
|
-// UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Signature"];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-
|
|
|
- NSDictionary* order_json = [RANetwork sign_Order:weakSelf.order_code path:img_url_up];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ // UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Signature"];
|
|
|
+ [RANetwork request_update_order_signature:self.order_code path:img_url_up completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* order_json =result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:^{
|
|
|
if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
|
|
|
@@ -832,11 +945,69 @@
|
|
|
{
|
|
|
[RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Signature" controller:weakSelf] ;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ //
|
|
|
+ // NSDictionary* order_json = [RANetwork sign_Order:weakSelf.order_code path:img_url_up];
|
|
|
+ //
|
|
|
+ // dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ // [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ // if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+ // {
|
|
|
+ //
|
|
|
+ //#if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
|
|
|
+ // int count = [[weakSelf.content_data objectForKey:@"count"] intValue];
|
|
|
+ // for (int i = 0; i < count; i++) {
|
|
|
+ // NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+ // NSMutableDictionary *section = [[weakSelf.content_data objectForKey:key] mutableCopy];
|
|
|
+ // NSString *type = [section objectForKey:@"type"];
|
|
|
+ // if ([type isEqualToString:@"sign_url"]) {
|
|
|
+ // [section setObject:img_url_down forKey:@"data"];
|
|
|
+ // [weakSelf.content_data setObject:section forKey:key];
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //#endif
|
|
|
+ //
|
|
|
+ //#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
|
|
|
+ // int count = [[weakSelf.content_data objectForKey:@"count"] intValue];
|
|
|
+ // for (int i = 0; i < count; i++) {
|
|
|
+ // NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+ // NSMutableDictionary *section = [[weakSelf.content_data objectForKey:key] mutableCopy];
|
|
|
+ // NSString *type = [section objectForKey:@"type"];
|
|
|
+ // if ([type isEqualToString:@"sign_url"]) {
|
|
|
+ // [section setObject:img_url_down forKey:@"data"];
|
|
|
+ // [weakSelf.content_data setObject:section forKey:key];
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //#endif
|
|
|
+ //
|
|
|
+ //#ifdef BUILD_HMLG
|
|
|
+ // [weakSelf.content_data setValue:img_url_down forKey:@"sign_url"];
|
|
|
+ //#endif
|
|
|
+ // //self.btnSign.enabled = false;
|
|
|
+ // [weakSelf.detailTable reloadData];
|
|
|
+ //
|
|
|
+ // [RAUtils message_alert:@"Successful." title:@"Signature" controller:weakSelf];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Signature" controller:weakSelf] ;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // });
|
|
|
+ // });
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -845,17 +1016,155 @@
|
|
|
{
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
- NSString *msg = [json valueForKey:@"err_msg"];
|
|
|
- if (msg.length == 0) {
|
|
|
- msg = [json objectForKey:@"msg"];
|
|
|
- }
|
|
|
-
|
|
|
- [RAUtils message_alert:msg title:@"Upload Image" controller:weakSelf] ;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:^{
|
|
|
+ NSString *msg = [json valueForKey:@"err_msg"];
|
|
|
+ if (msg.length == 0) {
|
|
|
+ msg = [json objectForKey:@"msg"];
|
|
|
+ }
|
|
|
+
|
|
|
+ [RAUtils message_alert:msg title:@"Upload Image" controller:weakSelf] ;
|
|
|
+ }];
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- } Progress:nil DecryptHandler:nil];
|
|
|
+ }];
|
|
|
+// [NetworkUtils upload:imageData FileName:@"test.jpg" Params:params ToHost:URL_UPLOAD_IMG Result:^(NSMutableDictionary *json) {
|
|
|
+//
|
|
|
+// if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// NSString* img_url_down = json[@"img_url_aname"];
|
|
|
+// NSString* img_url_up = json[@"img_url"];
|
|
|
+// {
|
|
|
+//// UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Signature"];
|
|
|
+// [RANetwork request_update_order_signature:self.order_code path:img_url_up completionHandler:^(NSMutableDictionary *result) {
|
|
|
+// NSDictionary* order_json =result;
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+// if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+//
|
|
|
+//#if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
|
|
|
+// int count = [[weakSelf.content_data objectForKey:@"count"] intValue];
|
|
|
+// for (int i = 0; i < count; i++) {
|
|
|
+// NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+// NSMutableDictionary *section = [[weakSelf.content_data objectForKey:key] mutableCopy];
|
|
|
+// NSString *type = [section objectForKey:@"type"];
|
|
|
+// if ([type isEqualToString:@"sign_url"]) {
|
|
|
+// [section setObject:img_url_down forKey:@"data"];
|
|
|
+// [weakSelf.content_data setObject:section forKey:key];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//#endif
|
|
|
+//
|
|
|
+//#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
|
|
|
+// int count = [[weakSelf.content_data objectForKey:@"count"] intValue];
|
|
|
+// for (int i = 0; i < count; i++) {
|
|
|
+// NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+// NSMutableDictionary *section = [[weakSelf.content_data objectForKey:key] mutableCopy];
|
|
|
+// NSString *type = [section objectForKey:@"type"];
|
|
|
+// if ([type isEqualToString:@"sign_url"]) {
|
|
|
+// [section setObject:img_url_down forKey:@"data"];
|
|
|
+// [weakSelf.content_data setObject:section forKey:key];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//#endif
|
|
|
+//
|
|
|
+//#ifdef BUILD_HMLG
|
|
|
+// [weakSelf.content_data setValue:img_url_down forKey:@"sign_url"];
|
|
|
+//#endif
|
|
|
+// //self.btnSign.enabled = false;
|
|
|
+// [weakSelf.detailTable reloadData];
|
|
|
+//
|
|
|
+// [RAUtils message_alert:@"Successful." title:@"Signature" controller:weakSelf];
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Signature" controller:weakSelf] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// }];
|
|
|
+//
|
|
|
+//// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+////
|
|
|
+//// NSDictionary* order_json = [RANetwork sign_Order:weakSelf.order_code path:img_url_up];
|
|
|
+////
|
|
|
+//// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+//// if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+//// {
|
|
|
+////
|
|
|
+////#if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
|
|
|
+//// int count = [[weakSelf.content_data objectForKey:@"count"] intValue];
|
|
|
+//// for (int i = 0; i < count; i++) {
|
|
|
+//// NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+//// NSMutableDictionary *section = [[weakSelf.content_data objectForKey:key] mutableCopy];
|
|
|
+//// NSString *type = [section objectForKey:@"type"];
|
|
|
+//// if ([type isEqualToString:@"sign_url"]) {
|
|
|
+//// [section setObject:img_url_down forKey:@"data"];
|
|
|
+//// [weakSelf.content_data setObject:section forKey:key];
|
|
|
+//// break;
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+////#endif
|
|
|
+////
|
|
|
+////#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
|
|
|
+//// int count = [[weakSelf.content_data objectForKey:@"count"] intValue];
|
|
|
+//// for (int i = 0; i < count; i++) {
|
|
|
+//// NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+//// NSMutableDictionary *section = [[weakSelf.content_data objectForKey:key] mutableCopy];
|
|
|
+//// NSString *type = [section objectForKey:@"type"];
|
|
|
+//// if ([type isEqualToString:@"sign_url"]) {
|
|
|
+//// [section setObject:img_url_down forKey:@"data"];
|
|
|
+//// [weakSelf.content_data setObject:section forKey:key];
|
|
|
+//// break;
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+////#endif
|
|
|
+////
|
|
|
+////#ifdef BUILD_HMLG
|
|
|
+//// [weakSelf.content_data setValue:img_url_down forKey:@"sign_url"];
|
|
|
+////#endif
|
|
|
+//// //self.btnSign.enabled = false;
|
|
|
+//// [weakSelf.detailTable reloadData];
|
|
|
+////
|
|
|
+//// [RAUtils message_alert:@"Successful." title:@"Signature" controller:weakSelf];
|
|
|
+////
|
|
|
+////
|
|
|
+//// }
|
|
|
+//// else
|
|
|
+//// {
|
|
|
+//// [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Signature" controller:weakSelf] ;
|
|
|
+//// }
|
|
|
+////
|
|
|
+////
|
|
|
+////
|
|
|
+//// });
|
|
|
+//// });
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+// NSString *msg = [json valueForKey:@"err_msg"];
|
|
|
+// if (msg.length == 0) {
|
|
|
+// msg = [json objectForKey:@"msg"];
|
|
|
+// }
|
|
|
+//
|
|
|
+// [RAUtils message_alert:msg title:@"Upload Image" controller:weakSelf] ;
|
|
|
+// });
|
|
|
+// }
|
|
|
+//
|
|
|
+// } Progress:nil DecryptHandler:nil];
|
|
|
|
|
|
// AFHTTPRequestSerializer* serializer=[AFHTTPRequestSerializer serializer] ;
|
|
|
// DebugLog(URL_UPLOAD_IMG);
|
|
|
@@ -1086,40 +1395,42 @@
|
|
|
[RANetwork request_open_order:self.order_code completionHandler:^(NSMutableDictionary *result) {
|
|
|
NSDictionary* order_json = result;
|
|
|
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- appDelegate.order_code = self.order_code;
|
|
|
- appDelegate.order_status = self.order_status;
|
|
|
- [appDelegate SetSo:[self.content_data valueForKey:@"so#"]];
|
|
|
-
|
|
|
-
|
|
|
- appDelegate.customerInfo=[[self.content_data objectForKey:@"customerInfo"] mutableCopy];
|
|
|
-
|
|
|
- appDelegate.contact_id=[appDelegate.customerInfo valueForKey:@"customer_cid"];
|
|
|
-
|
|
|
- // [self.navigationController popViewControllerAnimated:false];
|
|
|
-
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:^{
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ appDelegate.order_code = self.order_code;
|
|
|
+ appDelegate.order_status = self.order_status;
|
|
|
+ [appDelegate SetSo:[self.content_data valueForKey:@"so#"]];
|
|
|
+
|
|
|
+
|
|
|
+ appDelegate.customerInfo=[[self.content_data objectForKey:@"customerInfo"] mutableCopy];
|
|
|
+
|
|
|
+ appDelegate.contact_id=[appDelegate.customerInfo valueForKey:@"customer_cid"];
|
|
|
+
|
|
|
+ // [self.navigationController popViewControllerAnimated:false];
|
|
|
+
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"CartViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ [ActiveViewController Notify:@"CartViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
#else
|
|
|
- // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
|
|
|
+ // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
|
|
|
#endif
|
|
|
-
|
|
|
- if (completionBlk) {
|
|
|
- completionBlk();
|
|
|
+
|
|
|
+ if (completionBlk) {
|
|
|
+ completionBlk();
|
|
|
+ }
|
|
|
+
|
|
|
+ // if(self.selectOrder)
|
|
|
+ // self.selectOrder(self.content_data);
|
|
|
}
|
|
|
-
|
|
|
- // if(self.selectOrder)
|
|
|
- // self.selectOrder(self.content_data);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:self] ;
|
|
|
- }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:self] ;
|
|
|
+ }
|
|
|
+ }];
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1260,94 +1571,68 @@
|
|
|
NSDictionary* order_json = result;
|
|
|
|
|
|
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
- [self.mum stopAnimating];
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- self.detailTable.hidden = false;
|
|
|
- self.content_data = [order_json mutableCopy];
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- else {
|
|
|
- self.content_data = nil;
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
|
|
|
- {
|
|
|
- self.label_net_err.hidden=false;
|
|
|
- self.detailTable.hidden=true;
|
|
|
- }
|
|
|
- else
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:^{
|
|
|
+ [self.mum stopAnimating];
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
- [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Loading Order Detail" controller:self] ;
|
|
|
+ self.detailTable.hidden = false;
|
|
|
+ self.content_data = [order_json mutableCopy];
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- bool web_order =[[self.content_data valueForKey:@"from_online"] boolValue];
|
|
|
- if(web_order)
|
|
|
- self.btnCopy.enabled = false;
|
|
|
- else
|
|
|
- self.btnCopy.enabled = true;
|
|
|
- int status_code = [[self.content_data valueForKey:@"orderStatus"] intValue];
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- int model_count =[[self.content_data valueForKey:@"model_count"] intValue];
|
|
|
- if(model_count>0)/*&& ! appDelegate.offline_mode*/
|
|
|
- {
|
|
|
- if(appDelegate.user_type== USER_ROLE_EMPLOYEE || (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeCustomer))
|
|
|
- self.btnPDF.enabled =true;
|
|
|
- else
|
|
|
- {
|
|
|
- // || appDelegate.user_type==USER_ROLE_CUSTOMER
|
|
|
- if(self.is_shoporder)
|
|
|
+ else {
|
|
|
+ self.content_data = nil;
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
|
|
|
{
|
|
|
- if(status_code==1||status_code==30)
|
|
|
- self.btnPDF.enabled =true;
|
|
|
-
|
|
|
+ self.label_net_err.hidden=false;
|
|
|
+ self.detailTable.hidden=true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(status_code==2)
|
|
|
- self.btnPDF.enabled =true;
|
|
|
+ [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Loading Order Detail" controller:self] ;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- // [self.btnPDF setImage:[[UIImage imageNamed:@"download"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
-
|
|
|
- // NSString* status = [self.content_data valueForKey:@"order_status"];
|
|
|
-
|
|
|
- NSString* lock_user = [self.content_data valueForKey:@"opened_customer"];
|
|
|
-
|
|
|
- bool offline_edit =[[self.content_data valueForKey:@"offline_edit"] boolValue];
|
|
|
- if(status_code==1)//[status isEqualToString:@"Saved Order"])
|
|
|
- {
|
|
|
- // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
- //
|
|
|
- // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
|
|
|
- BOOL condition = offline_edit;
|
|
|
-#ifdef OFFLINE_MODE
|
|
|
- condition = condition || appDelegate.offline_mode==false;
|
|
|
-#else
|
|
|
- condition = YES;
|
|
|
-#endif
|
|
|
- if(condition)
|
|
|
+ bool web_order =[[self.content_data valueForKey:@"from_online"] boolValue];
|
|
|
+ if(web_order)
|
|
|
+ self.btnCopy.enabled = false;
|
|
|
+ else
|
|
|
+ self.btnCopy.enabled = true;
|
|
|
+ int status_code = [[self.content_data valueForKey:@"orderStatus"] intValue];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ int model_count =[[self.content_data valueForKey:@"model_count"] intValue];
|
|
|
+ if(model_count>0)/*&& ! appDelegate.offline_mode*/
|
|
|
{
|
|
|
- self.btnOpen.enabled =true;
|
|
|
-
|
|
|
- self.btnSign.enabled = true;
|
|
|
+ if(appDelegate.user_type== USER_ROLE_EMPLOYEE || (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeCustomer))
|
|
|
+ self.btnPDF.enabled =true;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // || appDelegate.user_type==USER_ROLE_CUSTOMER
|
|
|
+ if(self.is_shoporder)
|
|
|
+ {
|
|
|
+ if(status_code==1||status_code==30)
|
|
|
+ self.btnPDF.enabled =true;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(status_code==2)
|
|
|
+ self.btnPDF.enabled =true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- // if([lock_user isEqualToString:appDelegate.user])
|
|
|
- // {
|
|
|
- // self.btnCommit.enabled =true;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // self.btnCommit.enabled =false;
|
|
|
- }
|
|
|
- else
|
|
|
- if(status_code==0)//[status isEqualToString:@"Quote Saved"])
|
|
|
+ // [self.btnPDF setImage:[[UIImage imageNamed:@"download"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+
|
|
|
+ // NSString* status = [self.content_data valueForKey:@"order_status"];
|
|
|
+
|
|
|
+ NSString* lock_user = [self.content_data valueForKey:@"opened_customer"];
|
|
|
+
|
|
|
+ bool offline_edit =[[self.content_data valueForKey:@"offline_edit"] boolValue];
|
|
|
+ if(status_code==1)//[status isEqualToString:@"Saved Order"])
|
|
|
{
|
|
|
- // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+ // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
//
|
|
|
- // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
+ // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
|
|
|
BOOL condition = offline_edit;
|
|
|
#ifdef OFFLINE_MODE
|
|
|
@@ -1355,44 +1640,72 @@
|
|
|
#else
|
|
|
condition = YES;
|
|
|
#endif
|
|
|
- if (condition)
|
|
|
+ if(condition)
|
|
|
{
|
|
|
self.btnOpen.enabled =true;
|
|
|
|
|
|
self.btnSign.enabled = true;
|
|
|
}
|
|
|
- // self.btnCommit.enabled =false;
|
|
|
+ // if([lock_user isEqualToString:appDelegate.user])
|
|
|
+ // {
|
|
|
+ // self.btnCommit.enabled =true;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // self.btnCommit.enabled =false;
|
|
|
}
|
|
|
- BOOL lock_condition_1 = [lock_user isEqualToString:appDelegate.user];
|
|
|
- BOOL lock_condition_2 = false;
|
|
|
+ else
|
|
|
+ if(status_code==0)//[status isEqualToString:@"Quote Saved"])
|
|
|
+ {
|
|
|
+ // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+ //
|
|
|
+ // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
+
|
|
|
+ BOOL condition = offline_edit;
|
|
|
#ifdef OFFLINE_MODE
|
|
|
- lock_condition_1 = !appDelegate.offline_mode && lock_condition_1;
|
|
|
- lock_condition_2 = appDelegate.offline_mode && [self.order_code isEqualToString:appDelegate.order_code];
|
|
|
+ condition = condition || appDelegate.offline_mode==false;
|
|
|
+#else
|
|
|
+ condition = YES;
|
|
|
+#endif
|
|
|
+ if (condition)
|
|
|
+ {
|
|
|
+ self.btnOpen.enabled =true;
|
|
|
+
|
|
|
+ self.btnSign.enabled = true;
|
|
|
+ }
|
|
|
+ // self.btnCommit.enabled =false;
|
|
|
+ }
|
|
|
+ BOOL lock_condition_1 = [lock_user isEqualToString:appDelegate.user];
|
|
|
+ BOOL lock_condition_2 = false;
|
|
|
+#ifdef OFFLINE_MODE
|
|
|
+ lock_condition_1 = !appDelegate.offline_mode && lock_condition_1;
|
|
|
+ lock_condition_2 = appDelegate.offline_mode && [self.order_code isEqualToString:appDelegate.order_code];
|
|
|
#endif
|
|
|
-
|
|
|
- if((lock_condition_1 || lock_condition_2)&& (status_code==1||status_code==0))
|
|
|
- {
|
|
|
- // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
-
|
|
|
|
|
|
- self.btnRelease.enabled =true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ if((lock_condition_1 || lock_condition_2)&& (status_code==1||status_code==0))
|
|
|
+ {
|
|
|
+ // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+
|
|
|
+
|
|
|
+ self.btnRelease.enabled =true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
+ self.btnRelease.enabled =false;
|
|
|
+ }
|
|
|
|
|
|
+ [self.detailTable reloadData];
|
|
|
+ self.isrefreshing=false;
|
|
|
|
|
|
- // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
- self.btnRelease.enabled =false;
|
|
|
- }
|
|
|
-
|
|
|
- [self.detailTable reloadData];
|
|
|
- self.isrefreshing=false;
|
|
|
+ if (self.order_code == nil) {
|
|
|
+ self.btnCopy.enabled = false;
|
|
|
+ } else {
|
|
|
+ self.btnCopy.enabled = true;
|
|
|
+ }
|
|
|
+ }];
|
|
|
|
|
|
- if (self.order_code == nil) {
|
|
|
- self.btnCopy.enabled = false;
|
|
|
- } else {
|
|
|
- self.btnCopy.enabled = true;
|
|
|
- }
|
|
|
|
|
|
|
|
|
}];
|
|
|
@@ -3749,43 +4062,45 @@
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Copy Order"];
|
|
|
[RANetwork request_copy_order:self.order_code completionHandler:^(NSMutableDictionary *result) {
|
|
|
NSDictionary* order_json = result;
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- // NSString* orderCode = [order_json valueForKey:@"orderCode"];
|
|
|
-
|
|
|
- // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- // if([appDelegate.order_code isEqualToString: self.order_code])
|
|
|
- // {
|
|
|
- // [appDelegate closeOrder];
|
|
|
- //// appDelegate.order_code= nil;
|
|
|
- // [appDelegate SetSo:nil];
|
|
|
- //
|
|
|
- //
|
|
|
- // }
|
|
|
-
|
|
|
- [RAUtils message_alert:[NSString stringWithFormat:@"New order SO#: %@",[order_json valueForKey:@"so_id"]] title:@"Copy successful." controller:self];
|
|
|
-
|
|
|
-// UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Copy successful." message:[NSString stringWithFormat:@"New order SO#: %@",[order_json valueForKey:@"so_id"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
|
|
|
-//
|
|
|
-// [alert show];
|
|
|
-//
|
|
|
-
|
|
|
-
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:^{
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ // NSString* orderCode = [order_json valueForKey:@"orderCode"];
|
|
|
+
|
|
|
+ // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ // if([appDelegate.order_code isEqualToString: self.order_code])
|
|
|
+ // {
|
|
|
+ // [appDelegate closeOrder];
|
|
|
+ //// appDelegate.order_code= nil;
|
|
|
+ // [appDelegate SetSo:nil];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // }
|
|
|
+
|
|
|
+ [RAUtils message_alert:[NSString stringWithFormat:@"New order SO#: %@",[order_json valueForKey:@"so_id"]] title:@"Copy successful." controller:self];
|
|
|
+
|
|
|
+ // UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Copy successful." message:[NSString stringWithFormat:@"New order SO#: %@",[order_json valueForKey:@"so_id"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
|
|
|
+ //
|
|
|
+ // [alert show];
|
|
|
+ //
|
|
|
+
|
|
|
+
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
#else
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
#endif
|
|
|
-
|
|
|
- [self.navigationController popViewControllerAnimated:false];
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Cpoy Order" controller:self] ;
|
|
|
- }
|
|
|
+
|
|
|
+ [self.navigationController popViewControllerAnimated:false];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Cpoy Order" controller:self] ;
|
|
|
+ }
|
|
|
+ }];
|
|
|
+
|
|
|
|
|
|
|
|
|
|