CartGeneralNotesViewController.m 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. self.tv_notes.text = self.notes;
  16. // Do any additional setup after loading the view.
  17. if (@available(iOS 11, *)) {
  18. self.tv_notes.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  19. }
  20. // else {
  21. //
  22. //// self.tv_notes.scrollView.contentInsetAdjustmentBehavior =UIScrollViewContentInsetAdjustmentNever;
  23. //
  24. // self.automaticallyAdjustsScrollViewInsets = NO;
  25. // }
  26. // self.automaticallyAdjustsScrollViewInsets = NO;
  27. self.navigationController.navigationBar.translucent = NO;
  28. self.tv_notes.layer.borderColor = [UIColor lightGrayColor].CGColor;
  29. self.tv_notes.layer.borderWidth = 1.0f;
  30. }
  31. - (void)didReceiveMemoryWarning {
  32. [super didReceiveMemoryWarning];
  33. // Dispose of any resources that can be recreated.
  34. }
  35. - (IBAction)onCloseClicked:(id)sender {
  36. [self dismissViewControllerAnimated:NO
  37. completion:^{
  38. }];
  39. }
  40. - (IBAction)onSaveClicked:(id)sender {
  41. // [self.tv_notes endEditing:true];
  42. self.notes = self.tv_notes.text;
  43. UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update General Notes"];
  44. NSString* notes=self.tv_notes.text;
  45. UIApplication * app = [UIApplication sharedApplication];
  46. AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  47. [RANetwork request_update_cartgeneralnote:appDelegate.order_code notes:notes completionHandler:^(NSMutableDictionary *result) {
  48. NSDictionary* cart_json = result;
  49. [waitalert dismissViewControllerAnimated:YES completion:nil];
  50. // [waitalert dismissViewControllerAnimated:YES completion:nil];
  51. if([[cart_json valueForKey:@"result"] intValue]==2)
  52. {
  53. [self dismissViewControllerAnimated:NO
  54. completion:^{
  55. if(self.onSetValue)
  56. self.onSetValue(self.notes);
  57. }];
  58. }
  59. else
  60. {
  61. [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update General Notes" controller:self] ;
  62. }
  63. }];
  64. // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  65. //
  66. // NSDictionary* cart_json = nil;
  67. //
  68. //
  69. //
  70. //
  71. // cart_json = [RANetwork cart_setGeneralNote:appDelegate.order_code notes:notes];
  72. //
  73. // dispatch_async(dispatch_get_main_queue(), ^{
  74. //
  75. //
  76. // [waitalert dismissViewControllerAnimated:YES completion:nil];
  77. //// [waitalert dismissViewControllerAnimated:YES completion:nil];
  78. // if([[cart_json valueForKey:@"result"] intValue]==2)
  79. // {
  80. // [self dismissViewControllerAnimated:NO
  81. // completion:^{
  82. //
  83. // if(self.onSetValue)
  84. // self.onSetValue(self.notes);
  85. //
  86. // }];
  87. // }
  88. // else
  89. // {
  90. // [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update General Notes" controller:self] ;
  91. // }
  92. //
  93. //
  94. //
  95. //
  96. // });
  97. // });
  98. }
  99. /*
  100. #pragma mark - Navigation
  101. // In a storyboard-based application, you will often want to do a little preparation before navigation
  102. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  103. // Get the new view controller using [segue destinationViewController].
  104. // Pass the selected object to the new view controller.
  105. }
  106. */
  107. @end