CartGeneralNotesViewController.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 "iSalesNetwork.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. }
  18. - (void)didReceiveMemoryWarning {
  19. [super didReceiveMemoryWarning];
  20. // Dispose of any resources that can be recreated.
  21. }
  22. - (IBAction)onCloseClicked:(id)sender {
  23. [self dismissViewControllerAnimated:NO
  24. completion:^{
  25. }];
  26. }
  27. - (IBAction)onSaveClicked:(id)sender {
  28. // [self.tv_notes endEditing:true];
  29. self.notes = self.tv_notes.text;
  30. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Update General Notes"];
  31. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  32. NSDictionary* cart_json = nil;
  33. UIApplication * app = [UIApplication sharedApplication];
  34. AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  35. cart_json = [iSalesNetwork cart_setGeneralNote:appDelegate.order_code notes:self.tv_notes.text];
  36. dispatch_async(dispatch_get_main_queue(), ^{
  37. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  38. if([[cart_json valueForKey:@"result"] intValue]==2)
  39. {
  40. [self dismissViewControllerAnimated:NO
  41. completion:^{
  42. if(self.onSetValue)
  43. self.onSetValue(self.notes);
  44. }];
  45. }
  46. else
  47. {
  48. [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update General Notes" controller:self] ;
  49. }
  50. });
  51. });
  52. }
  53. /*
  54. #pragma mark - Navigation
  55. // In a storyboard-based application, you will often want to do a little preparation before navigation
  56. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  57. // Get the new view controller using [segue destinationViewController].
  58. // Pass the selected object to the new view controller.
  59. }
  60. */
  61. @end