DocnotesViewController.m 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //
  2. // NotesViewController.m
  3. // Granite Expo eSign
  4. //
  5. // Created by Ray on 28/02/2017.
  6. // Copyright © 2017 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "DocnotesViewController.h"
  9. #import "RANetwork.h"
  10. #import "RAUtils.h"
  11. @interface DocnotesViewController ()
  12. @end
  13. @implementation DocnotesViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. self.editDocNumber.text = self.docNumber;
  17. self.tvNotes.text = self.docNotes;
  18. if(self.docNumber.length>0)
  19. {
  20. self.editDocNumber.enabled = false;
  21. self.btnScan.enabled = false;
  22. }
  23. // self.edgesForExtendedLayout = UIRectEdgeNone;
  24. self.tvNotes.layer.borderColor = [UIColor darkGrayColor].CGColor;
  25. self.tvNotes.layer.borderWidth = 0.5;
  26. UIBarButtonItem *closeButton =nil;
  27. closeButton=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"close"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  28. style:UIBarButtonItemStylePlain
  29. target:self
  30. action:@selector( onCloseClick:)];
  31. //[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Close", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onCloseClick:)];
  32. // closeButton.title = @"Close";
  33. self.navigationItem.rightBarButtonItem = closeButton;
  34. // Do any additional setup after loading the view.
  35. }
  36. - (void)didReceiveMemoryWarning {
  37. [super didReceiveMemoryWarning];
  38. // Dispose of any resources that can be recreated.
  39. }
  40. - (void)onCloseClick:(UIButton *)sender {
  41. [self dismissViewControllerAnimated:false completion:nil];
  42. // [self.navigationController popViewControllerAnimated:FALSE];
  43. }
  44. - (IBAction)onUpdateClick:(id)sender {
  45. self.docNumber = self.editDocNumber.text;
  46. self.docNotes = self.tvNotes.text;
  47. // UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Update Notes"];
  48. // __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update Notes" completion:^{
  49. PopWaitAlert* pop =[RAUtils waiting_pop:@"Update Notes" completion:nil];
  50. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  51. NSMutableDictionary* json=[[RANetwork updateNotes:self.docNumber notes:self.docNotes ] mutableCopy];
  52. dispatch_async(dispatch_get_main_queue(), ^{
  53. // [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  54. // [waitalert dismissViewControllerAnimated:YES completion:^{
  55. [pop hide];
  56. if([json[@"result"] intValue]==RESULT_TRUE)
  57. {
  58. [self dismissViewControllerAnimated:false completion:nil];
  59. // DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  60. //
  61. // // dvc.templateName = @"debug.json";
  62. // dvc.templateName = @"GEIC - Home Improvement Contract 2017.json";
  63. // dvc.pdfName = @"GEIC - Home Improvement Contract 2017.pdf";
  64. // dvc.docment_id = json[@"doc_number"];
  65. // dvc.OnSave=^(NSString* file, NSString* subject)
  66. // {
  67. //
  68. // [weakSelf previewPDF:file title:json[@"doc_number"] subject:subject];
  69. // };
  70. //
  71. // [self.navigationController pushViewController:dvc animated:true];
  72. }
  73. else
  74. {
  75. // [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Update Notes" controller:self] ;
  76. [RAUtils message_box:@"Update Notes" message:[json valueForKey:@"err_msg"] completion:nil];
  77. }
  78. // }];
  79. });
  80. });
  81. // }];
  82. }
  83. - (IBAction)onScanClick:(id)sender {
  84. }
  85. /*
  86. #pragma mark - Navigation
  87. // In a storyboard-based application, you will often want to do a little preparation before navigation
  88. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  89. // Get the new view controller using [segue destinationViewController].
  90. // Pass the selected object to the new view controller.
  91. }
  92. */
  93. @end