DocnotesViewController.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  50. NSMutableDictionary* json=[[RANetwork updateNotes:self.docNumber notes:self.docNotes ] mutableCopy];
  51. dispatch_async(dispatch_get_main_queue(), ^{
  52. // [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  53. [waitalert dismissViewControllerAnimated:YES completion:^{
  54. if([json[@"result"] intValue]==RESULT_TRUE)
  55. {
  56. [self dismissViewControllerAnimated:false completion:nil];
  57. // DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  58. //
  59. // // dvc.templateName = @"debug.json";
  60. // dvc.templateName = @"GEIC - Home Improvement Contract 2017.json";
  61. // dvc.pdfName = @"GEIC - Home Improvement Contract 2017.pdf";
  62. // dvc.docment_id = json[@"doc_number"];
  63. // dvc.OnSave=^(NSString* file, NSString* subject)
  64. // {
  65. //
  66. // [weakSelf previewPDF:file title:json[@"doc_number"] subject:subject];
  67. // };
  68. //
  69. // [self.navigationController pushViewController:dvc animated:true];
  70. }
  71. else
  72. {
  73. [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Create Customer" controller:self] ;
  74. }
  75. }];
  76. });
  77. });
  78. }];
  79. }
  80. - (IBAction)onScanClick:(id)sender {
  81. }
  82. /*
  83. #pragma mark - Navigation
  84. // In a storyboard-based application, you will often want to do a little preparation before navigation
  85. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  86. // Get the new view controller using [segue destinationViewController].
  87. // Pass the selected object to the new view controller.
  88. }
  89. */
  90. @end