CartGeneralNotesViewController.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //
  2. // CartGeneralNotesViewController.m
  3. // iSales-NPD
  4. //
  5. // Created by Ray on 2/16/16.
  6. // Copyright © 2016 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "CartGeneralNotesViewController.h"
  9. #import "RANetwork.h"
  10. @interface CartGeneralNotesViewController ()
  11. @end
  12. @implementation CartGeneralNotesViewController
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. #ifdef SCANNER_ORDER
  16. self.title = @"Special Instructions";
  17. #endif
  18. self.tv_notes.text = self.notes;
  19. // Do any additional setup after loading the view.
  20. if (@available(iOS 11, *)) {
  21. self.tv_notes.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  22. }
  23. // else {
  24. //
  25. //// self.tv_notes.scrollView.contentInsetAdjustmentBehavior =UIScrollViewContentInsetAdjustmentNever;
  26. //
  27. // self.automaticallyAdjustsScrollViewInsets = NO;
  28. // }
  29. // self.automaticallyAdjustsScrollViewInsets = NO;
  30. // self.navigationController.navigationBar.translucent = NO;
  31. self.tv_notes.layer.borderColor = [UIColor lightGrayColor].CGColor;
  32. self.tv_notes.layer.borderWidth = 1.0f;
  33. }
  34. - (void)didReceiveMemoryWarning {
  35. [super didReceiveMemoryWarning];
  36. // Dispose of any resources that can be recreated.
  37. }
  38. - (IBAction)onCloseClicked:(id)sender {
  39. [self dismissViewControllerAnimated:NO
  40. completion:^{
  41. }];
  42. }
  43. - (IBAction)onSaveClicked:(id)sender {
  44. // [self.tv_notes endEditing:true];
  45. self.notes = self.tv_notes.text;
  46. NSString* notes=self.tv_notes.text;
  47. UIApplication * app = [UIApplication sharedApplication];
  48. AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  49. // __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update General Notes" completion:^{
  50. PopWaitAlert* pop = [RAUtils waiting_pop:@"Update General Notes" completion:nil];
  51. [RANetwork request_update_cartgeneralnote:appDelegate.order_code notes:notes completionHandler:^(NSMutableDictionary *result) {
  52. NSDictionary* cart_json = result;
  53. // [waitalert dismissViewControllerAnimated:YES completion:^{
  54. [pop hide];
  55. // [waitalert dismissViewControllerAnimated:YES completion:nil];
  56. if([[cart_json valueForKey:@"result"] intValue]==2)
  57. {
  58. [self dismissViewControllerAnimated:NO
  59. completion:^{
  60. if(self.onSetValue)
  61. self.onSetValue(self.notes);
  62. }];
  63. }
  64. else
  65. {
  66. [RAUtils message_box:@"Update General Notes" message:[cart_json valueForKey:@"err_msg"] completion:nil];
  67. }
  68. // }];
  69. }];
  70. // }];
  71. }
  72. /*
  73. #pragma mark - Navigation
  74. // In a storyboard-based application, you will often want to do a little preparation before navigation
  75. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  76. // Get the new view controller using [segue destinationViewController].
  77. // Pass the selected object to the new view controller.
  78. }
  79. */
  80. @end