// // CartGeneralNotesViewController.m // iSales-NPD // // Created by Ray on 2/16/16. // Copyright © 2016 United Software Applications, Inc. All rights reserved. // #import "CartGeneralNotesViewController.h" #import "RANetwork.h" @interface CartGeneralNotesViewController () @end @implementation CartGeneralNotesViewController - (void)viewDidLoad { [super viewDidLoad]; self.tv_notes.text = self.notes; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)onCloseClicked:(id)sender { [self dismissViewControllerAnimated:NO completion:^{ }]; } - (IBAction)onSaveClicked:(id)sender { // [self.tv_notes endEditing:true]; self.notes = self.tv_notes.text; UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Update General Notes"]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSDictionary* cart_json = nil; UIApplication * app = [UIApplication sharedApplication]; AppDelegate *appDelegate = (AppDelegate *)[app delegate]; cart_json = [RANetwork cart_setGeneralNote:appDelegate.order_code notes:self.tv_notes.text]; dispatch_async(dispatch_get_main_queue(), ^{ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE]; if([[cart_json valueForKey:@"result"] intValue]==2) { [self dismissViewControllerAnimated:NO completion:^{ if(self.onSetValue) self.onSetValue(self.notes); }]; } else { [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update General Notes" controller:self] ; } }); }); } /* #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