// // ItemNotesViewController.m // iSales-NPD // // Created by Ray on 2/16/16. // Copyright © 2016 United Software Applications, Inc. All rights reserved. // #import "ItemNotesViewController.h" #import "RANetwork.h" @interface ItemNotesViewController () @end @implementation ItemNotesViewController - (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 Item Notes"]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSDictionary* cart_json = nil; cart_json = [RANetwork cart_setItemNote:self.cart_id 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.onSaveNote) self.onSaveNote(self.notes); }]; } else { [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update Item 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