|
|
@@ -129,39 +129,71 @@
|
|
|
|
|
|
UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Remove Models From Cart"];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+
|
|
|
+ [RANetwork request_remove_cart:ids completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSMutableDictionary* cart_json =result;
|
|
|
|
|
|
- NSDictionary* cart_json = [RANetwork cart_remove:ids];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+
|
|
|
+ if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+
|
|
|
+ [self end_edit];
|
|
|
+
|
|
|
|
|
|
- [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
-
|
|
|
- [self end_edit];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"CartViewController,CategoryViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ [ActiveViewController Notify:@"CartViewController,CategoryViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
#else
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
#endif
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* cart_json = [RANetwork cart_remove:ids];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//
|
|
|
+// [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+//
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+//
|
|
|
+// [self end_edit];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"CartViewController,CategoryViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+//#endif
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
|
|
|
}];
|
|
|
@@ -327,38 +359,68 @@
|
|
|
|
|
|
UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Remove Models From Cart"];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ [RANetwork request_remove_cart:ids completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSMutableDictionary* cart_json =result;
|
|
|
|
|
|
- NSDictionary* cart_json = [RANetwork cart_remove:ids];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+
|
|
|
+ if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+
|
|
|
+ [self end_edit];
|
|
|
|
|
|
- [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
-
|
|
|
- [self end_edit];
|
|
|
-
|
|
|
-
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"CartViewController,CategoryViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ [ActiveViewController Notify:@"CartViewController,CategoryViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
#else
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
#endif
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* cart_json = [RANetwork cart_remove:ids];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//
|
|
|
+// [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+//
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+//
|
|
|
+// [self end_edit];
|
|
|
+//
|
|
|
+//
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"CartViewController,CategoryViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+//#endif
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
|
|
|
}];
|
|
|
@@ -2848,76 +2910,141 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
}
|
|
|
|
|
|
NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
|
|
|
-
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ [RANetwork request_remove_cart:ids completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSMutableDictionary* cart_json = result;
|
|
|
|
|
|
- NSDictionary* cart_json = [RANetwork cart_remove:ids];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- if (self.back_order_flag) {
|
|
|
-
|
|
|
- NSInteger section_count = [self sectionCount];
|
|
|
- for (int i = 0; i < section_count; i++) {
|
|
|
- NSInteger item_count = [self itemCountInSection:i];
|
|
|
- BOOL ready_break = NO;
|
|
|
-
|
|
|
- for (int j = 0; j < item_count; j++) {
|
|
|
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:j inSection:i];
|
|
|
- NSDictionary* obj_json = [self itemJsonAtIndexPath:indexPath];
|
|
|
- NSString* _id =[obj_json valueForKey:@"cart_item_id"];
|
|
|
- if([_id isEqualToString:ids])
|
|
|
- {
|
|
|
- [self updateItemJson:nil atIndexPath:indexPath];
|
|
|
- ready_break = YES;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (ready_break) {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ if (self.back_order_flag) {
|
|
|
+
|
|
|
+ NSInteger section_count = [self sectionCount];
|
|
|
+ for (int i = 0; i < section_count; i++) {
|
|
|
+ NSInteger item_count = [self itemCountInSection:i];
|
|
|
+ BOOL ready_break = NO;
|
|
|
|
|
|
- } else {
|
|
|
- for(int i=0;i<self.content_arr.count;i++)
|
|
|
- {
|
|
|
- NSDictionary* obj_json = self.content_arr[i];
|
|
|
+ for (int j = 0; j < item_count; j++) {
|
|
|
+ NSIndexPath *indexPath = [NSIndexPath indexPathForRow:j inSection:i];
|
|
|
+ NSDictionary* obj_json = [self itemJsonAtIndexPath:indexPath];
|
|
|
NSString* _id =[obj_json valueForKey:@"cart_item_id"];
|
|
|
if([_id isEqualToString:ids])
|
|
|
{
|
|
|
- [self.content_arr removeObjectAtIndex:i];
|
|
|
- // [self.itemListTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:self.indexPath] withRowAnimation:UITableViewRowAnimationLeft];
|
|
|
+ [self updateItemJson:nil atIndexPath:indexPath];
|
|
|
+ ready_break = YES;
|
|
|
break;
|
|
|
- // appDelegate.cart_count--;
|
|
|
- // [appDelegate update_count_mark];
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ready_break) {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- [self.itemListTable reloadData];
|
|
|
- [self refresh_total];
|
|
|
+
|
|
|
+ } else {
|
|
|
+ for(int i=0;i<self.content_arr.count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* obj_json = self.content_arr[i];
|
|
|
+ NSString* _id =[obj_json valueForKey:@"cart_item_id"];
|
|
|
+ if([_id isEqualToString:ids])
|
|
|
+ {
|
|
|
+ [self.content_arr removeObjectAtIndex:i];
|
|
|
+ // [self.itemListTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:self.indexPath] withRowAnimation:UITableViewRowAnimationLeft];
|
|
|
+ break;
|
|
|
+ // appDelegate.cart_count--;
|
|
|
+ // [appDelegate update_count_mark];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [self.itemListTable reloadData];
|
|
|
+ [self refresh_total];
|
|
|
#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 reload_data];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+ // [self reload_data];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* cart_json = [RANetwork cart_remove:ids];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// if (self.back_order_flag) {
|
|
|
+//
|
|
|
+// NSInteger section_count = [self sectionCount];
|
|
|
+// for (int i = 0; i < section_count; i++) {
|
|
|
+// NSInteger item_count = [self itemCountInSection:i];
|
|
|
+// BOOL ready_break = NO;
|
|
|
+//
|
|
|
+// for (int j = 0; j < item_count; j++) {
|
|
|
+// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:j inSection:i];
|
|
|
+// NSDictionary* obj_json = [self itemJsonAtIndexPath:indexPath];
|
|
|
+// NSString* _id =[obj_json valueForKey:@"cart_item_id"];
|
|
|
+// if([_id isEqualToString:ids])
|
|
|
+// {
|
|
|
+// [self updateItemJson:nil atIndexPath:indexPath];
|
|
|
+// ready_break = YES;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (ready_break) {
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// for(int i=0;i<self.content_arr.count;i++)
|
|
|
+// {
|
|
|
+// NSDictionary* obj_json = self.content_arr[i];
|
|
|
+// NSString* _id =[obj_json valueForKey:@"cart_item_id"];
|
|
|
+// if([_id isEqualToString:ids])
|
|
|
+// {
|
|
|
+// [self.content_arr removeObjectAtIndex:i];
|
|
|
+// // [self.itemListTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:self.indexPath] withRowAnimation:UITableViewRowAnimationLeft];
|
|
|
+// break;
|
|
|
+// // appDelegate.cart_count--;
|
|
|
+// // [appDelegate update_count_mark];
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// [self.itemListTable reloadData];
|
|
|
+// [self refresh_total];
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+//#endif
|
|
|
+// // [self reload_data];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
}
|
|
|
}
|