//
//  CustomerInfoViewController.m
//  RedAnt ERP Mobile
//
//  Created by Ray on 9/10/15.
//  Copyright (c) 2015 United Software Applications, Inc. All rights reserved.
//

#import "CustomerInfoViewController.h"
#import "iSalesNetwork.h"
#import "CustomerEditViewController.h"
#import "MainViewController.h"
@interface CustomerInfoViewController ()

@end

@implementation CustomerInfoViewController



- (void)onEditClick:(id)sender {
    
    
    NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
    
    
    [params setValue:self.contactId forKey:@"contact_id"];
    CustomerEditViewController * cuseditVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
    
    cuseditVC.bnewcustomer=false;
    cuseditVC.url_type = URL_REMOTE;
    cuseditVC.request_url=URL_EDIT_CUSTOMER;
    
    cuseditVC.params = params;
    
    cuseditVC.delegate=self;

    
    [[self navigationController] setNavigationBarHidden:NO animated:NO];
    [self.navigationController pushViewController:cuseditVC animated:false];
    
}

- (void)onAssignClick:(id)sender {
    [self.lastedit endEditing:true];
    [self.lasttextview endEditing:true];
    
    
    
    
    
    // [self.navigationController popViewControllerAnimated:(false)];
    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
    //    NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
    
    for(int i=0;i<section_count;i++)
    {
        NSDictionary * sectionjson= [self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] ;
        int count = [[sectionjson valueForKey:@"count"] intValue];
        for(int j=0;j<count;j++)
        {
            NSDictionary * itemjson=[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]];
            
            //NSObject* obj=[itemjson valueForKey:@"name"];
            
            NSString* name = itemjson[@"name"];//[[ valueForKey:@"name"] stringValue];
//            DebugLog(@"%@",name.class);
//            DebugLog(@"%@",self.data_init.class);
//            DebugLog(@"%@",NSDictionary.class);
            NSString* value = itemjson[@"value"];//[[itemjson valueForKey:@""] stringValue];
            
            //[self.data_init setValue:value forKey:name];
            self.data_init[name]=value;
            
            
            
        }
        
    }
    //---------------- construct customer_contact----------------------
    NSString* customer_first_name = [self.data_init valueForKey:@"customer_first_name"];
    if(customer_first_name==nil)
        customer_first_name=@"";
    
    NSString* customer_last_name= [self.data_init valueForKey:@"customer_last_name"];
    if(customer_last_name==nil)
        customer_last_name=@"";
    NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
    customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    [self.data_init setValue:customer_contact forKey:@"customer_contact"];
    //---------------- finish construct customer_contact----------------------
    
    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
    if(self.update_order && appDelegate.order_code!=nil)
    {
        
        
        
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            
            NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:self.data_init];
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                
                if([[editor_json valueForKey:@"result"] intValue]==2)
                {
                    
                    [self.navigationController popViewControllerAnimated:false];
                    if(self.returnValue)
                    {
                        
                        self.returnValue(self.data_init);
                    }
                    
                    
                    
                }
                else
                {
                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
                }
                
                
                
            });
        });
        
        
    }
    else
    {
        
        [self.navigationController popViewControllerAnimated:false];
        if(self.returnValue)
        {
            self.returnValue(self.data_init);
            
        }
        
    }
    
    
}

- (void)onResetClick:(id)sender {
    
    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
    
    if(appDelegate.order_code.length>0)
    {
        //当前已打开订单则关闭订单。
        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to release order and reset contact?" message:nil preferredStyle:UIAlertControllerStyleAlert];
        //block代码块取代了delegate
        
        
        
        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
            UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Release Order"];
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                
                NSDictionary* order_json = [iSalesNetwork release_Order:appDelegate.order_code];
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
                    if([[order_json valueForKey:@"result"] intValue]==2)
                    {
                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                        //                    appDelegate.order_code = nil;
                        [appDelegate closeOrder];
                        
                        [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
                        [((MainViewController*)appDelegate.main_vc) reloadContact:false immediately:false];
                        [self.navigationController popToRootViewControllerAnimated:false];
                        
                        

                    }
                    else
                    {
                        [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:self] ;
                    }
                    
                    
                    
                });
            });
            
        }];
        
        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
            DebugLog(@"Cancel");
        }];
        [alertControl addAction:actionOne];
        
        [alertControl addAction:alertthree];
 
        
        
        [self presentViewController:alertControl animated:YES completion:nil];
  
        
        
    }
    else
    {
        //询问并清空当前的全局contact_id、customer
        
        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to reset contact?" message:nil preferredStyle:UIAlertControllerStyleAlert];
        
        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
          
            if(appDelegate.user_type!=USER_ROLE_CUSTOMER)
            {
            appDelegate.contact_id=nil;
            appDelegate.customerInfo = nil;
            }
            
            [self.navigationController popViewControllerAnimated:(false)];

        }];
        
        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
            DebugLog(@"Cancel");
        }];
        [alertControl addAction:actionOne];
        
        [alertControl addAction:alertthree];
        
        
        
        [self presentViewController:alertControl animated:YES completion:nil];
        
    }
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [[self navigationController] setNavigationBarHidden:NO animated:NO];
    
    
    if(self.rightbtn_title!=nil)
        [ self.right_btn setTitle:self.rightbtn_title];
    //    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onBackClick:)];
    //    //    closeButton.title = @"Close";
    
    
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
                                                                   style:UIBarButtonItemStylePlain
                                                                  target:self
                                                                  action:@selector( onBackClick:)];
    
    self.navigationItem.leftBarButtonItem = backButton;
    
    
    NSMutableArray * items = [[NSMutableArray alloc]init];
    self.btn_edit = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
                                                     style:UIBarButtonItemStylePlain
                                                    target:self
                                                    action:@selector(onEditClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
    
    
 //   self.btn_edit.tintColor = UIColorFromRGB(0x996633);
    
    
    
    self.btn_assign = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"assign"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
                                                       style:UIBarButtonItemStylePlain
                                                      target:self
                                                      action:@selector(onAssignClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
    
    
//    self.btn_assign.tintColor = UIColorFromRGB(0x996633);
    
    
    self.btn_reset = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"reset"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
                                                      style:UIBarButtonItemStylePlain
                                                     target:self
                                                     action:@selector(onResetClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
    
    
//    self.btn_reset.tintColor = UIColorFromRGB(0x996633);
    
//     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
    
    if(self.edit_icon)
        [items addObject:self.btn_edit];
    if(self.assig_icon)
        [items addObject:self.btn_assign];
    if(self.reset_icon)
        [items addObject:self.btn_reset];
    
    self.navigationItem.rightBarButtonItems=items;
    
    
    
    if (self.data_init==nil) {
        
        [self request_fill];
    }
    else
    {
        [self fillData];
    }
    
    
    
    
    // Do any additional setup after loading the view.
}
- (void)onBackClick:(UIButton *)sender {

    
    [self.lastedit endEditing:true];
    [self.lasttextview endEditing:true];
    
    
    
    NSMutableDictionary* back_data = [self.data_init mutableCopy];
    
    // [self.navigationController popViewControllerAnimated:(false)];
    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
    //    NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
    
    for(int i=0;i<section_count;i++)
    {
        NSDictionary * sectionjson= [self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] ;
        int count = [[sectionjson valueForKey:@"count"] intValue];
        for(int j=0;j<count;j++)
        {
            NSDictionary * itemjson=[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]];
            
            NSString* name = [itemjson valueForKey:@"name"];
            
            NSString* value = [itemjson valueForKey:@"value"];
            
            [back_data setValue:value forKey:name];
            
            
            
        }
        
    }
    //---------------- construct customer_contact----------------------
    NSString* customer_first_name = [back_data valueForKey:@"customer_first_name"];
    if(customer_first_name==nil)
        customer_first_name=@"";
    
    NSString* customer_last_name= [back_data valueForKey:@"customer_last_name"];
    if(customer_last_name==nil)
        customer_last_name=@"";
    NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
    customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    [back_data setValue:customer_contact forKey:@"customer_contact"];
    
    
    
    
    if(self.onClose)
    {
        
        self.onClose(back_data);
    }
 
 
    [self.navigationController popViewControllerAnimated:(false)];
    //    [self.navigationController dismissViewControllerAnimated:true completion:^{
    //        ;
    //    }];
}
-(void) request_fill
{
    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Loading Contact information"];
    
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSDictionary* editor_json = [iSalesNetwork request_CustomerInfo:self.contactId];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            
            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
            
            if([[editor_json valueForKey:@"result"] intValue]==2)
            {
                self.data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
                
                [self fillData];
                self.btn_assign.enabled=true;
                
            }
            else
            {
                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
                self.btn_assign.enabled=false;
            }
            
            
        });
    });
}
- (void) fillData
{
    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
    
    
    //    NSDictionary* data = [self.data_init objectForKey:@"customerInfo"];
    for(int i=0;i<section_count;i++)
    {
        NSMutableDictionary * sectionjson= [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] mutableCopy];
        int count = [[sectionjson valueForKey:@"count"] intValue];
        for(int j=0;j<count;j++)
        {
            NSMutableDictionary * itemjson=[[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]] mutableCopy];
            
            NSString* control=[itemjson valueForKey:@"control"];
            
            NSString* name = [itemjson valueForKey:@"name"];
            
            NSString* value = [self.data_init valueForKey:name];
            
            [itemjson setValue:value forKey:@"value"];
            
            if([control isEqualToString:@"img"])
            {
                {
                    NSString* img_url = [itemjson valueForKey:@"img_url_0"];
                    
                    NSString* url_value = [self.data_init valueForKey:img_url];
                    [itemjson setValue:url_value forKey:@"img_url_0"];
                }
                {
                    NSString* img_url = [itemjson valueForKey:@"img_url_1"];
                    
                    NSString* url_value = [self.data_init valueForKey:img_url];
                    [itemjson setValue:url_value forKey:@"img_url_1"];
                }
                {
                    NSString* img_url = [itemjson valueForKey:@"img_url_2"];
                    
                    NSString* url_value = [self.data_init valueForKey:img_url];
                    [itemjson setValue:url_value forKey:@"img_url_2"];
                }
            }
            
            [sectionjson setObject:itemjson forKey:[NSString stringWithFormat:@"item_%d",j]];
            
            
        }
        [self.content_data_download setObject:sectionjson forKey:[NSString stringWithFormat:@"section_%d",i]];
    }
    self.content_data_control=[self translate_json:self.content_data_download changed:self.changed_data];
    
    //    self.navigationItem.title =  [self.content_data_download valueForKey:@"title"] ;
    [self.editorTable reloadData];
}
//- (IBAction)onEditClick:(id)sender {
//
//
//    NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
//
//
//    [params setValue:self.contactId forKey:@"contactId"];
//    CustomerEditViewController * cuseditVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
//
//    cuseditVC.bnewcustomer=false;
//    cuseditVC.url_type = URL_REMOTE;
//    cuseditVC.request_url=URL_EDIT_CUSTOMER;
//
//    cuseditVC.params = params;
//
//    cuseditVC.delegate=self;
//    //
//    //    if(checked.count==count)
//    //    {
//    //    orderinfoVC.have_tail = true
//    //    }
//    [[self navigationController] setNavigationBarHidden:NO animated:NO];
//    [self.navigationController pushViewController:cuseditVC animated:false];
//
//}
//- (IBAction)onSetClick:(id)sender {
//
//        [self.lastedit endEditing:true];
//    [self.lasttextview endEditing:true];
//
//
//
//
//
//   // [self.navigationController popViewControllerAnimated:(false)];
//    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
////    NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
//
//    for(int i=0;i<section_count;i++)
//    {
//        NSDictionary * sectionjson= [self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] ;
//        int count = [[sectionjson valueForKey:@"count"] intValue];
//        for(int j=0;j<count;j++)
//        {
//            NSDictionary * itemjson=[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]];
//
//            NSString* name = [itemjson valueForKey:@"name"];
//
//            NSString* value = [itemjson valueForKey:@"value"];
//
//            [self.data_init setValue:value forKey:name];
//
//
//
//        }
//
//    }
//    //---------------- construct customer_contact----------------------
//    NSString* customer_first_name = [self.data_init valueForKey:@"customer_first_name"];
//    if(customer_first_name==nil)
//        customer_first_name=@"";
//
//    NSString* customer_last_name= [self.data_init valueForKey:@"customer_last_name"];
//    if(customer_last_name==nil)
//        customer_last_name=@"";
//    NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
//    customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
//    [self.data_init setValue:customer_contact forKey:@"customer_contact"];
//    //---------------- finish construct customer_contact----------------------
//
//        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
//    if(self.update_order && appDelegate.order_code!=nil)
//    {
//
//
//
//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//
//            NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:self.data_init];
//
//            dispatch_async(dispatch_get_main_queue(), ^{
//
//
//                if([[editor_json valueForKey:@"result"] intValue]==2)
//                {
//
//                    [self.navigationController popViewControllerAnimated:false];
//                    if(self.returnValue)
//                    {
//
//                        self.returnValue(self.data_init);
//                    }
//
//
//
//                }
//                else
//                {
//                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
//                }
//
//
//
//            });
//        });
//
//
//    }
//    else
//    {
//
//        [self.navigationController popViewControllerAnimated:false];
//        if(self.returnValue)
//        {
//            self.returnValue(self.data_init);
//
//        }
//        //    [self.data_init setObject:data forKey:@"customerInfo"];
//
//
//        /*
//         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
//         appDelegate.contact_id=self.contactId;
//         appDelegate.customerInfo = self.data_init;
//         */
//
////        [self.navigationController popToRootViewControllerAnimated:false];
//    }
//
//
//
//}

#pragma mark- img changed

// image 改变时执行
- (void) imgIsChanged:(NSString *)url_down url_up:(NSString *)url_up indexPath: (NSIndexPath *) indexPath{
    
    // int aaa = 0;
    // NSDictionary* aaa = self.content_data_download;
    
    
    
    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Create Order"];
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString* cid=[self getValue:@"customer_cid"];
        NSDictionary* return_json = [iSalesNetwork update_customer_img:cid img_url:url_up];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
            
            
            if([[return_json valueForKey:@"result"] intValue]==2)
            {
                int result=[[return_json valueForKey:@"result"] intValue];
                if(result==2)
                {
                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Upload successful." message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                    
                    [alert show];
                }
            }
            else
            {
                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
            }
            
            
            
            
        });
    });
    
    //    // DebugLog(@"Sender is = %@", url);
    //
    //
    //
    //
    //    NSMutableDictionary* section_json=nil;
    //
    //
    //    //    DebugLog(@"endedit %d_%d",indexPath.section,indexPath.row);
    //    NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
    //
    //    int refresh = [[item_json valueForKey:@"refresh"] intValue];
    //
    //    NSString* subid=[item_json valueForKey:@"subid"];
    //
    //    item_json[@"img_url"]=url_down;
    //    item_json[@"avalue"]=url_up;
    //
    //    if(subid==nil)
    //    {
    //        section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
    //        int count=0;
    //
    //        count=[[section_json valueForKey:@"count"] intValue];
    //
    //        for(int i=0;i<count;i++)
    //        {
    //            NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",i ]];
    //            if([[olditem valueForKey:@"name"] isEqualToString:[item_json valueForKey:@"name" ]])
    //                [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",i ]];
    //
    //
    //        }
    //
    //    }
    //    else
    //    {
    //        NSArray* idarr=[subid componentsSeparatedByString:@"_"];
    //        int section = [(NSString*)idarr[0] intValue];
    //        int item=[(NSString*)idarr[1] intValue];
    //
    //
    //        section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d", section]] mutableCopy];
    //        NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",item ]];
    //        item_json= [self enum_subitem_changed:[olditem mutableCopy] subid:idarr value:item_json step:2];
    //        [item_json setValue:@"true" forKey:@"dirty"];
    //        [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",item ]];
    //    }
    //
    //
    //
    //    [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
    //
    //    self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
    //
    //    NSRange range = NSMakeRange(indexPath.section, 1);
    //    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
    //    //  [self.editorTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
    //
    //
    //    if(refresh==1)
    //    {
    //        [self refresh];
    //    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
