|
@@ -31,7 +31,7 @@
|
|
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
-#define ALERT_DEL 1025
|
|
|
|
|
|
|
+//#define ALERT_DEL 1025
|
|
|
#define checked_Count @"checkedCount"
|
|
#define checked_Count @"checkedCount"
|
|
|
@interface PortfolioViewController ()
|
|
@interface PortfolioViewController ()
|
|
|
|
|
|
|
@@ -96,131 +96,131 @@
|
|
|
// [self refresh_total];
|
|
// [self refresh_total];
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
-- (IBAction)onAddtoCart:(id)sender {
|
|
|
|
|
- UIApplication * app = [UIApplication sharedApplication];
|
|
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
- MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
|
|
- if(appDelegate.bLogin==false)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
|
|
|
|
|
- // loginvc.delegate = self;
|
|
|
|
|
- // loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
|
|
|
|
|
-
|
|
|
|
|
- loginvc.returnValue = ^(bool blogin){
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // UIApplication * app = [UIApplication sharedApplication];
|
|
|
|
|
- // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if(blogin)
|
|
|
|
|
- {
|
|
|
|
|
- if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- [main_vc checklogin:false];
|
|
|
|
|
-
|
|
|
|
|
- if(appDelegate.can_create_order)
|
|
|
|
|
- {
|
|
|
|
|
- NSString* msg =@"";
|
|
|
|
|
- if(appDelegate.contact_id.length>0)
|
|
|
|
|
- {
|
|
|
|
|
- msg = [msg stringByAppendingString:@"\n\nCustomer:"];
|
|
|
|
|
- msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil),NSLocalizedString(@"Create new order", nil), nil];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // alert.
|
|
|
|
|
- [alert show];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil), nil];
|
|
|
|
|
-
|
|
|
|
|
- // alert.
|
|
|
|
|
- [alert show];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- [main_vc checklogin:true];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // self.offset = 0;
|
|
|
|
|
- // [self.content_data removeAllObjects];
|
|
|
|
|
- // [self loadpage];
|
|
|
|
|
- //
|
|
|
|
|
- // [[self navigationController] setNavigationBarHidden:YES animated:NO];
|
|
|
|
|
-
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
|
|
|
|
|
-
|
|
|
|
|
- navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
|
|
|
|
|
- [self presentViewController:navi animated:YES completion:^{
|
|
|
|
|
-
|
|
|
|
|
- // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
|
|
|
|
|
-
|
|
|
|
|
- DebugLog(@"LoginViewController present.........");
|
|
|
|
|
-
|
|
|
|
|
- // self.btop = false;
|
|
|
|
|
- // <#code#>
|
|
|
|
|
- }];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if(appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&*/appDelegate.order_code==nil)
|
|
|
|
|
- {
|
|
|
|
|
- [main_vc checklogin:false];
|
|
|
|
|
- if(appDelegate.can_create_order)
|
|
|
|
|
- {
|
|
|
|
|
- NSString* msg =@"";
|
|
|
|
|
- if(appDelegate.contact_id.length>0)
|
|
|
|
|
- {
|
|
|
|
|
- msg = [msg stringByAppendingString:@"\n\nCustomer:"];
|
|
|
|
|
- msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil),NSLocalizedString(@"Create new order", nil), nil];
|
|
|
|
|
-
|
|
|
|
|
- // alert.
|
|
|
|
|
- [alert show];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil), nil];
|
|
|
|
|
-
|
|
|
|
|
- // alert.
|
|
|
|
|
- [alert show];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- if(appDelegate.order_code==nil)
|
|
|
|
|
- [ self neworder];
|
|
|
|
|
- else
|
|
|
|
|
- [self addtocart];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+//- (IBAction)onAddtoCart:(id)sender {
|
|
|
|
|
+// UIApplication * app = [UIApplication sharedApplication];
|
|
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
+// MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
|
|
+// if(appDelegate.bLogin==false)
|
|
|
|
|
+// {
|
|
|
|
|
+//
|
|
|
|
|
+// LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
|
|
|
|
|
+// // loginvc.delegate = self;
|
|
|
|
|
+// // loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
|
|
|
|
|
+//
|
|
|
|
|
+// loginvc.returnValue = ^(bool blogin){
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// // UIApplication * app = [UIApplication sharedApplication];
|
|
|
|
|
+// // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// if(blogin)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
|
|
|
|
|
+// {
|
|
|
|
|
+//
|
|
|
|
|
+// [main_vc checklogin:false];
|
|
|
|
|
+//
|
|
|
|
|
+// if(appDelegate.can_create_order)
|
|
|
|
|
+// {
|
|
|
|
|
+// NSString* msg =@"";
|
|
|
|
|
+// if(appDelegate.contact_id.length>0)
|
|
|
|
|
+// {
|
|
|
|
|
+// msg = [msg stringByAppendingString:@"\n\nCustomer:"];
|
|
|
|
|
+// msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil),NSLocalizedString(@"Create new order", nil), nil];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// // alert.
|
|
|
|
|
+// [alert show];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil), nil];
|
|
|
|
|
+//
|
|
|
|
|
+// // alert.
|
|
|
|
|
+// [alert show];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// [main_vc checklogin:true];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// // self.offset = 0;
|
|
|
|
|
+// // [self.content_data removeAllObjects];
|
|
|
|
|
+// // [self loadpage];
|
|
|
|
|
+// //
|
|
|
|
|
+// // [[self navigationController] setNavigationBarHidden:YES animated:NO];
|
|
|
|
|
+//
|
|
|
|
|
+// };
|
|
|
|
|
+//
|
|
|
|
|
+// UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
|
|
|
|
|
+//
|
|
|
|
|
+// navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
|
|
|
|
|
+// [self presentViewController:navi animated:YES completion:^{
|
|
|
|
|
+//
|
|
|
|
|
+// // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
|
|
|
|
|
+//
|
|
|
|
|
+// DebugLog(@"LoginViewController present.........");
|
|
|
|
|
+//
|
|
|
|
|
+// // self.btop = false;
|
|
|
|
|
+// // <#code#>
|
|
|
|
|
+// }];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// if(appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&*/appDelegate.order_code==nil)
|
|
|
|
|
+// {
|
|
|
|
|
+// [main_vc checklogin:false];
|
|
|
|
|
+// if(appDelegate.can_create_order)
|
|
|
|
|
+// {
|
|
|
|
|
+// NSString* msg =@"";
|
|
|
|
|
+// if(appDelegate.contact_id.length>0)
|
|
|
|
|
+// {
|
|
|
|
|
+// msg = [msg stringByAppendingString:@"\n\nCustomer:"];
|
|
|
|
|
+// msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil),NSLocalizedString(@"Create new order", nil), nil];
|
|
|
|
|
+//
|
|
|
|
|
+// // alert.
|
|
|
|
|
+// [alert show];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil), nil];
|
|
|
|
|
+//
|
|
|
|
|
+// // alert.
|
|
|
|
|
+// [alert show];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+//
|
|
|
|
|
+// if(appDelegate.order_code==nil)
|
|
|
|
|
+// [ self neworder];
|
|
|
|
|
+// else
|
|
|
|
|
+// [self addtocart];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//}
|
|
|
-(void) addtocart
|
|
-(void) addtocart
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -1553,10 +1553,75 @@
|
|
|
|
|
|
|
|
DebugLog(@"delete click");
|
|
DebugLog(@"delete click");
|
|
|
self.deleteIndexPath = indexPath;
|
|
self.deleteIndexPath = indexPath;
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure remove model from portfolio?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
|
|
- alert.tag = ALERT_DEL;
|
|
|
|
|
- // alert.
|
|
|
|
|
- [alert show];
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Delete confirm" message:@"Are you sure remove model from portfolio?" preferredStyle:UIAlertControllerStyleAlert];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertAction *action_2 = [UIAlertAction actionWithTitle:@"YES" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ self.indexPath = self.deleteIndexPath;
|
|
|
|
|
+
|
|
|
|
|
+ int count =[[self.content_data valueForKey:@"count"] intValue];
|
|
|
|
|
+ BOOL delete_last = self.indexPath.row == count - 1 ? YES : NO;
|
|
|
|
|
+
|
|
|
|
|
+ [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
|
|
|
+ NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]];
|
|
|
|
|
+
|
|
|
|
|
+ [RANetwork request_removeportfolio:ids completionHandler:^(NSMutableDictionary *result) {
|
|
|
|
|
+ NSMutableDictionary* cart_json =result;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
+ {
|
|
|
|
|
+ self.deletedRow = delete_last ? -1 : self.indexPath.row;
|
|
|
|
|
+ if (delete_last) {
|
|
|
|
|
+ self.indexPath = [NSIndexPath indexPathForRow:count - 2 inSection:0];
|
|
|
|
|
+ }
|
|
|
|
|
+ [self reload_data];
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ self.deleteIndexPath = nil;
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+ UIAlertAction *action_3 = [UIAlertAction actionWithTitle:@"NO" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
+
|
|
|
|
|
+ self.deleteIndexPath = nil;
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ [alertController addAction:action_2];
|
|
|
|
|
+ [alertController addAction:action_3];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ [self presentViewController:alertController animated:YES completion:nil];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure remove model from portfolio?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
|
|
+// alert.tag = ALERT_DEL;
|
|
|
|
|
+// // alert.
|
|
|
|
|
+// [alert show];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1743,75 +1808,52 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-#pragma mark - UIAlertViewDelegate
|
|
|
|
|
-// Called when a button is clicked. The view will be automatically dismissed after this call returns
|
|
|
|
|
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
|
|
|
-{
|
|
|
|
|
- UIApplication * app = [UIApplication sharedApplication];
|
|
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
- // if(alertView.tag==1234)
|
|
|
|
|
- // {
|
|
|
|
|
- //
|
|
|
|
|
- // // availability warring;
|
|
|
|
|
- //
|
|
|
|
|
- //
|
|
|
|
|
- // if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
- // {
|
|
|
|
|
- // if(appDelegate.order_code==nil)
|
|
|
|
|
- // {
|
|
|
|
|
- // [self neworder];
|
|
|
|
|
- // }
|
|
|
|
|
- // else
|
|
|
|
|
- // {
|
|
|
|
|
- // [self addtocart];
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // return;
|
|
|
|
|
- // }
|
|
|
|
|
- // int count=[self.quantity_text.text intValue];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if(alertView.tag==ALERT_DEL)
|
|
|
|
|
- {
|
|
|
|
|
- if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
- {
|
|
|
|
|
- self.indexPath = self.deleteIndexPath;
|
|
|
|
|
-
|
|
|
|
|
- int count =[[self.content_data valueForKey:@"count"] intValue];
|
|
|
|
|
- BOOL delete_last = self.indexPath.row == count - 1 ? YES : NO;
|
|
|
|
|
-
|
|
|
|
|
- [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
|
|
|
- NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
|
|
|
-
|
|
|
|
|
- NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]];
|
|
|
|
|
-
|
|
|
|
|
- [RANetwork request_removeportfolio:ids completionHandler:^(NSMutableDictionary *result) {
|
|
|
|
|
- NSMutableDictionary* cart_json =result;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
- {
|
|
|
|
|
- self.deletedRow = delete_last ? -1 : self.indexPath.row;
|
|
|
|
|
- if (delete_last) {
|
|
|
|
|
- self.indexPath = [NSIndexPath indexPathForRow:count - 2 inSection:0];
|
|
|
|
|
- }
|
|
|
|
|
- [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), ^{
|
|
|
|
|
|
|
+//#pragma mark - UIAlertViewDelegate
|
|
|
|
|
+//// Called when a button is clicked. The view will be automatically dismissed after this call returns
|
|
|
|
|
+//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
|
|
|
+//{
|
|
|
|
|
+// UIApplication * app = [UIApplication sharedApplication];
|
|
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
+// // if(alertView.tag==1234)
|
|
|
|
|
+// // {
|
|
|
|
|
+// //
|
|
|
|
|
+// // // availability warring;
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
+// // {
|
|
|
|
|
+// // if(appDelegate.order_code==nil)
|
|
|
|
|
+// // {
|
|
|
|
|
+// // [self neworder];
|
|
|
|
|
+// // }
|
|
|
|
|
+// // else
|
|
|
|
|
+// // {
|
|
|
|
|
+// // [self addtocart];
|
|
|
|
|
+// // }
|
|
|
|
|
+// // }
|
|
|
|
|
+// // return;
|
|
|
|
|
+// // }
|
|
|
|
|
+// // int count=[self.quantity_text.text intValue];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// if(alertView.tag==ALERT_DEL)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
+// {
|
|
|
|
|
+// self.indexPath = self.deleteIndexPath;
|
|
|
|
|
+//
|
|
|
|
|
+// int count =[[self.content_data valueForKey:@"count"] intValue];
|
|
|
|
|
+// BOOL delete_last = self.indexPath.row == count - 1 ? YES : NO;
|
|
|
//
|
|
//
|
|
|
-// NSDictionary* cart_json = [RANetwork portfolio_remove:ids];
|
|
|
|
|
|
|
+// [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
|
|
|
|
|
+// NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
|
|
|
|
|
+//
|
|
|
|
|
+// NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]];
|
|
|
|
|
+//
|
|
|
|
|
+// [RANetwork request_removeportfolio:ids completionHandler:^(NSMutableDictionary *result) {
|
|
|
|
|
+// NSMutableDictionary* cart_json =result;
|
|
|
//
|
|
//
|
|
|
-// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
//
|
|
//
|
|
|
//
|
|
//
|
|
|
//
|
|
//
|
|
@@ -1828,95 +1870,118 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
// }
|
|
// }
|
|
|
//
|
|
//
|
|
|
-// });
|
|
|
|
|
-// });
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- self.deleteIndexPath = nil;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
|
|
- if(buttonIndex==alertView.cancelButtonIndex)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else if(buttonIndex==1)
|
|
|
|
|
- {
|
|
|
|
|
- //open exist
|
|
|
|
|
-
|
|
|
|
|
- OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
|
|
|
|
|
- ovc.showNavibar = true;
|
|
|
|
|
- ovc.selectOrder = ^(NSMutableDictionary* order_detail){
|
|
|
|
|
- if(appDelegate.order_code==nil)
|
|
|
|
|
- {
|
|
|
|
|
- [self neworder];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- [self addtocart];
|
|
|
|
|
- [main_vc checklogin:true];
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- };
|
|
|
|
|
- ovc.init_style = OL_OPEN;
|
|
|
|
|
- ovc.onCancel = ^(){
|
|
|
|
|
-
|
|
|
|
|
- [main_vc checklogin:true];
|
|
|
|
|
-
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- [self.navigationController pushViewController:ovc animated:true];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- //create new;
|
|
|
|
|
-
|
|
|
|
|
- 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];
|
|
|
|
|
-
|
|
|
|
|
- // [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:@"" controller:self];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- };
|
|
|
|
|
- cvc.onReset = ^(){
|
|
|
|
|
- [main_vc checklogin:true];
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- [self.navigationController pushViewController:cvc animated:true];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- [self neworder];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+//
|
|
|
|
|
+// }];
|
|
|
|
|
+//// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
+////
|
|
|
|
|
+//// NSDictionary* cart_json = [RANetwork portfolio_remove:ids];
|
|
|
|
|
+////
|
|
|
|
|
+//// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
+////
|
|
|
|
|
+////
|
|
|
|
|
+////
|
|
|
|
|
+//// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
+//// {
|
|
|
|
|
+//// self.deletedRow = delete_last ? -1 : self.indexPath.row;
|
|
|
|
|
+//// if (delete_last) {
|
|
|
|
|
+//// self.indexPath = [NSIndexPath indexPathForRow:count - 2 inSection:0];
|
|
|
|
|
+//// }
|
|
|
|
|
+//// [self reload_data];
|
|
|
|
|
+//// }
|
|
|
|
|
+//// else
|
|
|
|
|
+//// {
|
|
|
|
|
+//// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
|
|
|
|
|
+//// }
|
|
|
|
|
+////
|
|
|
|
|
+//// });
|
|
|
|
|
+//// });
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// self.deleteIndexPath = nil;
|
|
|
|
|
+// return;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
|
|
+// if(buttonIndex==alertView.cancelButtonIndex)
|
|
|
|
|
+// {
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// else if(buttonIndex==1)
|
|
|
|
|
+// {
|
|
|
|
|
+// //open exist
|
|
|
|
|
+//
|
|
|
|
|
+// OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
|
|
|
|
|
+// ovc.showNavibar = true;
|
|
|
|
|
+// ovc.selectOrder = ^(NSMutableDictionary* order_detail){
|
|
|
|
|
+// if(appDelegate.order_code==nil)
|
|
|
|
|
+// {
|
|
|
|
|
+// [self neworder];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// [self addtocart];
|
|
|
|
|
+// [main_vc checklogin:true];
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// };
|
|
|
|
|
+// ovc.init_style = OL_OPEN;
|
|
|
|
|
+// ovc.onCancel = ^(){
|
|
|
|
|
+//
|
|
|
|
|
+// [main_vc checklogin:true];
|
|
|
|
|
+//
|
|
|
|
|
+// };
|
|
|
|
|
+//
|
|
|
|
|
+// [self.navigationController pushViewController:ovc animated:true];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// //create new;
|
|
|
|
|
+//
|
|
|
|
|
+// 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];
|
|
|
|
|
+//
|
|
|
|
|
+// // [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:@"" controller:self];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// };
|
|
|
|
|
+// cvc.onReset = ^(){
|
|
|
|
|
+// [main_vc checklogin:true];
|
|
|
|
|
+// };
|
|
|
|
|
+//
|
|
|
|
|
+// [self.navigationController pushViewController:cvc animated:true];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// [self neworder];
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+//}
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
#pragma mark - Navigation
|
|
#pragma mark - Navigation
|