// // 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. // if (@available(iOS 11, *)) { self.tv_notes.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; // } // else { // // // // self.automaticallyAdjustsScrollViewInsets = NO; // } // self.automaticallyAdjustsScrollViewInsets = NO; // self.navigationController.navigationBar.translucent = NO; self.tv_notes.layer.borderColor = [UIColor lightGrayColor].CGColor; self.tv_notes.layer.borderWidth = 1.0f; } - (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; // __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update Item Notes" completion:^{ PopWaitAlert* pop = [RAUtils waiting_pop:@"Update Item Notes" completion:nil]; [RANetwork request_update_cartitemnote:self.cart_id notes:self.tv_notes.text completionHandler:^(NSMutableDictionary *result) { NSDictionary* cart_json = result; [pop hide]; // [waitalert dismissViewControllerAnimated:YES completion:^{ if([[cart_json valueForKey:@"result"] intValue]==2) { [self dismissViewControllerAnimated:NO completion:^{ if(self.onSaveNote) self.onSaveNote(self.notes); }]; } else { [RAUtils message_box:@"Update Item Notes" message:[cart_json valueForKey:@"err_msg"] completion:nil]; } // }]; }]; // }]; } /* #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