ExtDocumentsViewController.m 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. //
  2. // ExtDocumentsViewController.m
  3. // Granite Expo eSign
  4. //
  5. // Created by Ray on 27/02/2017.
  6. // Copyright © 2017 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "ExtDocumentsViewController.h"
  9. #import "PDFViewController.h"
  10. #import "AddExtDocumentViewController.h"
  11. @interface ExtDocumentsViewController ()
  12. @end
  13. @implementation ExtDocumentsViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. self.labelDocNumber.text = self.docNumber;
  17. self.edgesForExtendedLayout = UIRectEdgeNone;
  18. UIBarButtonItem *closeButton =nil;
  19. closeButton=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"close"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  20. style:UIBarButtonItemStylePlain
  21. target:self
  22. action:@selector( onCloseClick:)];
  23. self.navigationItem.rightBarButtonItem = closeButton;
  24. // Do any additional setup after loading the view.
  25. }
  26. - (void)didReceiveMemoryWarning {
  27. [super didReceiveMemoryWarning];
  28. // Dispose of any resources that can be recreated.
  29. }
  30. - (void)onCloseClick:(UIButton *)sender {
  31. __weak typeof(self) weakself = self;
  32. [self dismissViewControllerAnimated:false completion:^{
  33. if(weakself.closeExtDoc)
  34. weakself.closeExtDoc(false);
  35. }];
  36. // [self.navigationController popViewControllerAnimated:FALSE];
  37. }
  38. - (IBAction)onAddClick:(id)sender {
  39. __weak typeof(self) weakself = self;
  40. AddExtDocumentViewController * addVC = [self.storyboard instantiateViewControllerWithIdentifier:@"AddExtDocumentViewController"];
  41. addVC.doc_number = self.docNumber;
  42. addVC.uploadSuccess = ^(NSMutableArray* arr_upload){
  43. if(weakself.arr_documents==nil)
  44. weakself.arr_documents=arr_upload;
  45. else
  46. [weakself.arr_documents addObjectsFromArray:arr_upload];
  47. [weakself.tableView reloadData];
  48. // [weakself dismissViewControllerAnimated:false completion:^{
  49. //
  50. // }];
  51. // if(weakself.closeExtDoc)
  52. // weakself.closeExtDoc(true);
  53. };
  54. [self.navigationController pushViewController:addVC animated:false];
  55. }
  56. #pragma mark - Table view data source
  57. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
  58. {
  59. return 44;
  60. }
  61. //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  62. //{
  63. // return 0;
  64. //}
  65. //- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
  66. //{
  67. // return 0;
  68. //}
  69. //- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
  70. //{
  71. // UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
  72. // return myView;
  73. //
  74. //}
  75. //- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  76. //{
  77. //
  78. // NSString* value =nil;//[DefaultAppearance get_noneappearance_value:@"DefaultTableHeaderView" valuename:@"title_text_color"];
  79. //
  80. // if(value==nil)
  81. // value=@"";
  82. // unsigned long color = strtoul([value UTF8String],0,16);
  83. //
  84. // UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
  85. // myView.backgroundColor = UIColorFromRGB(0xf7f7f7);
  86. // myView.layer.shadowPath =[UIBezierPath bezierPathWithRect:myView.bounds].CGPath;
  87. // myView.layer.shadowColor = [UIColor blackColor].CGColor;
  88. // myView.layer.shadowOffset = CGSizeMake(0, 0);
  89. // myView.layer.shadowOpacity = 0.5;
  90. // myView.layer.shadowRadius = 2.0;
  91. //
  92. //
  93. // UILabel *statuslabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 2, 130, 22)];
  94. // statuslabel.textColor=UIColorFromRGB(color);
  95. // statuslabel.backgroundColor = [UIColor clearColor];
  96. // statuslabel.text=NSLocalizedString(@"Document #", nil);
  97. // [statuslabel sizeToFit];
  98. // [myView addSubview:statuslabel];
  99. //
  100. // UILabel *solabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 21, 130, 22)];
  101. // solabel.textColor=UIColorFromRGB(color);
  102. // solabel.backgroundColor = [UIColor clearColor];
  103. // solabel.text=NSLocalizedString(@"Address", nil);
  104. // [solabel sizeToFit];
  105. // [myView addSubview:solabel];
  106. //
  107. // UILabel *userlabel = [[UILabel alloc] initWithFrame:CGRectMake(143, 2, 135, 22)];
  108. // userlabel.textColor=UIColorFromRGB(color);
  109. // userlabel.backgroundColor = [UIColor clearColor];
  110. // userlabel.text=NSLocalizedString(@"Customer", nil);
  111. // [userlabel sizeToFit];
  112. // [myView addSubview:userlabel];
  113. //
  114. // // UILabel *creatorlabel = [[UILabel alloc] initWithFrame:CGRectMake(155, 21, 135, 22)];
  115. // // creatorlabel.textColor=UIColorFromRGB(color);
  116. // // creatorlabel.backgroundColor = [UIColor clearColor];
  117. // // creatorlabel.text=NSLocalizedString(@"Create by", nil);
  118. // // [creatorlabel sizeToFit];
  119. // // [myView addSubview:creatorlabel];
  120. //
  121. // UILabel *contactlabel = [[UILabel alloc] initWithFrame:CGRectMake(345, 2, 150, 22)];
  122. //
  123. // contactlabel.textColor=UIColorFromRGB(color);
  124. // contactlabel.backgroundColor = [UIColor clearColor];
  125. // contactlabel.text=NSLocalizedString(@"Job Date", nil);
  126. // [contactlabel sizeToFit];
  127. // [myView addSubview:contactlabel];
  128. //
  129. // //
  130. // // UILabel *modellabel = [[UILabel alloc] initWithFrame:CGRectMake(424, 11, 52, 22)];
  131. // // modellabel.textColor=[UIColor whiteColor];
  132. // // modellabel.backgroundColor = [UIColor clearColor];
  133. // // modellabel.text=NSLocalizedString(@"Model", nil);
  134. // // [modellabel sizeToFit];
  135. // // [myView addSubview:modellabel];
  136. //
  137. // // UILabel *modellabel = [[UILabel alloc] initWithFrame:CGRectMake(self.table_order.frame.size.width-276, 2, 100, 22)];
  138. // // modellabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
  139. // // modellabel.textColor=[UIColor whiteColor];
  140. // // modellabel.backgroundColor = [UIColor clearColor];
  141. // // modellabel.text=NSLocalizedString(@"Items/QTY", nil);
  142. // // [modellabel sizeToFit];
  143. // // [myView addSubview:modellabel];
  144. //
  145. // UILabel *pricelabel = [[UILabel alloc] initWithFrame:CGRectMake(/*492*/self.tableView.frame.size.width-313, 2, 100, 22)];
  146. // pricelabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
  147. // pricelabel.textColor=UIColorFromRGB(color);
  148. // pricelabel.backgroundColor = [UIColor clearColor];
  149. // pricelabel.text=NSLocalizedString(@"Agent Name", nil);
  150. // [pricelabel sizeToFit];
  151. // [myView addSubview:pricelabel];
  152. //
  153. // UILabel *timelabel = [[UILabel alloc] initWithFrame:CGRectMake(self.tableView.frame.size.width-111/*605*/,2, 148, 22)];
  154. // timelabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
  155. // timelabel.textColor=UIColorFromRGB(color);
  156. // timelabel.backgroundColor = [UIColor clearColor];
  157. // // if(self.time_zone==nil)
  158. // timelabel.text=@"Sign Date";
  159. // // else
  160. // // timelabel.text=[NSString stringWithFormat:@"Create time (%@)",self.time_zone];
  161. // [timelabel sizeToFit];
  162. // [myView addSubview:timelabel];
  163. //
  164. // myView.autoresizesSubviews=true;
  165. // // [myView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
  166. //
  167. //
  168. //
  169. //
  170. // // modellabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  171. // // pricelabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  172. // // timelabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  173. // myView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
  174. // //
  175. // return myView;
  176. //}
  177. //- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  178. //{
  179. //
  180. //
  181. // NSString* value =[DefaultAppearance get_noneappearance_value:@"DefaultTableHeaderView" valuename:@"title_text_color"];
  182. //
  183. // if(value==nil)
  184. // value=@"";
  185. // unsigned long color = strtoul([value UTF8String],0,16);
  186. //
  187. //
  188. // DefaultTableHeaderView* myView = [[DefaultTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
  189. // // myView.backgroundColor = UIColorFromRGB(0x996633);;
  190. //
  191. //
  192. // myView.layer.shadowPath =[UIBezierPath bezierPathWithRect:myView.bounds].CGPath;
  193. // // myView.layer.masksToBounds = false;
  194. // //添加四个边阴影
  195. //
  196. // myView.layer.shadowColor = [UIColor blackColor].CGColor;
  197. // myView.layer.shadowOffset = CGSizeMake(0, 0);
  198. // myView.layer.shadowOpacity = 0.5;
  199. // myView.layer.shadowRadius = 2.0;
  200. //
  201. //
  202. // NSString*labeltitle = nil;
  203. // switch (section) {
  204. // case 0:
  205. // labeltitle= @"Order Info";
  206. // break;
  207. // case 1:
  208. // {
  209. // labeltitle= @"More Info";
  210. //
  211. // NSString* btntitle=nil ;
  212. // if(self.showMore)
  213. // {
  214. // btntitle=@"Hide";
  215. // // [section setValue:@"false" forKey:@"hide"];
  216. // // [sender setTitle:@"Show" forState:UIControlStateNormal];
  217. // }
  218. // else{
  219. // btntitle=@"Show";
  220. // }
  221. //
  222. //
  223. // UIButton * btn =[[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width-50-15, 0, 50, 33)];
  224. // btn.tag=section;
  225. // [btn addTarget:self action:@selector(HideSction:) forControlEvents:UIControlEventTouchUpInside];
  226. // [btn setTitle:btntitle forState:UIControlStateNormal];
  227. // [myView addSubview:btn];
  228. //
  229. // }
  230. // break;
  231. // case 2:{
  232. // labeltitle= @"Models";
  233. //
  234. // NSString* btntitle=nil ;
  235. // if(self.showModels)
  236. // {
  237. // btntitle=@"Hide";
  238. // }
  239. // else{
  240. // btntitle=@"Show";
  241. // }
  242. //
  243. //
  244. // UIButton * btn =[[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width-50-15, 0, 50, 33)];
  245. // btn.tag=section;
  246. //
  247. // [btn addTarget:self action:@selector(HideSction:) forControlEvents:UIControlEventTouchUpInside];
  248. //
  249. // [btn setTitle:btntitle forState:UIControlStateNormal];
  250. // [myView addSubview:btn];
  251. //
  252. // }
  253. // break;
  254. // case 3:
  255. // labeltitle= @"Price Info";
  256. // default:
  257. // break;
  258. // }
  259. //
  260. //
  261. //
  262. // UILabel *titlelabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 5.5, 200, 20)];
  263. // titlelabel.textColor=UIColorFromRGB(color);;
  264. // titlelabel.backgroundColor = [UIColor clearColor];
  265. // titlelabel.text=NSLocalizedString(labeltitle, nil);
  266. // [titlelabel sizeToFit];
  267. // [myView addSubview:titlelabel];
  268. //
  269. // //
  270. // return myView;
  271. //}
  272. //- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
  273. //
  274. // return [NSString stringWithFormat:@"Signature%ld",(long)section+1];
  275. //
  276. //}
  277. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  278. {
  279. return 1;
  280. }
  281. //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  282. //{
  283. // return 44;
  284. //}
  285. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  286. {
  287. return self.arr_documents.count;
  288. }
  289. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  290. {
  291. NSString *CellIdentifier = @"ADTableViewCell";
  292. UITableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  293. NSDictionary * item_json = self.arr_documents[indexPath.row];
  294. NSString* type = item_json[@"type"];
  295. NSString* file_name = item_json[@"file_name"];
  296. NSString* upload_date = item_json[@"upload_date"];
  297. NSString* url = item_json[@"url"];
  298. if([type isEqualToString:@"file"])
  299. cell.imageView.image = [UIImage imageNamed:@"file_icon"];
  300. else
  301. cell.imageView.image = [UIImage imageNamed:@"picture_icon"];
  302. cell.textLabel.text = file_name;
  303. cell.detailTextLabel.text = upload_date;
  304. // cell.labelAgent.text = item_json[@"agent_name"];
  305. // NSString* job_addr =item_json[@"job_addr"];
  306. // NSString* job_city =item_json[@"job_city"];
  307. // NSString* job_state =item_json[@"job_state"];
  308. // NSString* job_zip =item_json[@"job_zip"];
  309. // NSString* tel =item_json[@"tel"];
  310. //
  311. // NSString* notes =item_json[@"notes"];
  312. // if(notes.length>0)
  313. // {
  314. // cell.Icon_notes.hidden = false;
  315. // cell.label_notes.hidden = false;
  316. // }
  317. // else
  318. // {
  319. // cell.Icon_notes.hidden = true;
  320. // cell.label_notes.hidden = true;
  321. // }
  322. // NSMutableArray* arr_doc = [item_json[@"documents"] mutableCopy];
  323. // int imgcount=0;
  324. // int filecount=0;
  325. // for(int d=0;d<arr_doc.count;d++)
  326. // {
  327. // NSDictionary* doc= arr_doc[d];
  328. // NSString* type = doc[@"type"];
  329. // if([type isEqualToString:@"image"])
  330. // imgcount++;
  331. // else if([type isEqualToString:@"file"])
  332. // filecount++;
  333. // }
  334. // if(imgcount>0)
  335. // {
  336. // cell.Icon_img.hidden = false;
  337. // cell.label_img.hidden = false;
  338. // cell.label_img.text=[NSString stringWithFormat:@"%d",imgcount];
  339. // }
  340. // else
  341. // {
  342. // cell.Icon_img.hidden = true;
  343. // cell.label_img.hidden = true;
  344. // cell.label_img.text=@"";
  345. //
  346. // }
  347. // if(filecount>0)
  348. // {
  349. // cell.Icon_file.hidden = false;
  350. // cell.label_file.hidden = false;
  351. // cell.label_file.text=[NSString stringWithFormat:@"%d",filecount];
  352. // }
  353. // else
  354. // {
  355. // cell.Icon_file.hidden = true;
  356. // cell.label_file.hidden = true;
  357. // cell.label_file.text=@"";
  358. //
  359. // }
  360. //
  361. //
  362. // if(tel.length>0)
  363. // tel= [@"TEL: " stringByAppendingString:tel];
  364. //
  365. //
  366. // NSMutableArray* arr_ext= [[NSMutableArray alloc] init];
  367. //
  368. // [arr_ext addObject:job_addr];
  369. // [arr_ext addObject:@"\r\n"];
  370. //
  371. // [arr_ext addObject:job_city];
  372. // [arr_ext addObject:job_state];
  373. // [arr_ext addObject:job_zip];
  374. // [arr_ext addObject:@"\r\n"];
  375. // [arr_ext addObject:tel];
  376. //
  377. // NSString *nsext=[RAUtils arr2string:arr_ext separator:@", " trim:true];
  378. //
  379. //
  380. // nsext=[nsext stringByReplacingOccurrencesOfString:@", \r\n," withString:@"\r\n"];
  381. //
  382. //
  383. // // if(sss.length==0)
  384. // // sss=@"";
  385. // cell.labelDocID.text = item_json[@"doc_number"];//
  386. // cell.labelExtInfo.text =nsext;
  387. // cell.labelJobDate.text =item_json[@"job_date"];
  388. // cell.labelCustomer.text =item_json[@"customer_name"];
  389. // cell.labelSignDate.text =item_json[@"signed_date"];
  390. //
  391. //
  392. return cell;
  393. // if(tableView==self.itemListTable)
  394. // {
  395. // NSString *CellIdentifier = @"CartItemCell";
  396. // ModelItemCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  397. // NSDictionary * item_json = [self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
  398. // NSDictionary * combine_json =[item_json objectForKey:@"combine"];
  399. //
  400. // cell.bundle_item=combine_json;
  401. // NSString* img_url = [item_json valueForKey:@"img_url"];
  402. // NSString* description = [item_json valueForKey:@"description"];
  403. // // NSString* identifier = [item_json valueForKey:@"identifier"];
  404. // // NSString* attribute = [item_json valueForKey:@"attribute"];
  405. // NSString* currency = [item_json valueForKey:@"currency"];
  406. // int count =[[item_json valueForKey:@"count"] intValue];
  407. //
  408. // int stockUom =[[item_json valueForKey:@"stockUom"] intValue];
  409. //
  410. // double totalprice =[[item_json valueForKey:@"subtotal_price"] doubleValue];
  411. //
  412. // double unitprice=[[item_json valueForKey:@"unit_price"] doubleValue];
  413. // cell.unit_price = unitprice;
  414. // // cell.labelAttribute.text = attribute;
  415. // // cell.labelCurrency.text = currency;
  416. // cell.labelDescription.text = description;
  417. // // cell.labelIdentifier.text = identifier;
  418. // cell.labelPrice.text = [NSString stringWithFormat:@"%.2f",totalprice];
  419. //
  420. // cell.labelUnitPrice.text = [NSString stringWithFormat:@"%.2f",unitprice];
  421. //
  422. //
  423. //
  424. // NSString* cart_item_id= [item_json valueForKey:@"cart_item_id"];
  425. // cell.cart_id = cart_item_id;
  426. // [cell init_Stepper:stockUom max:9999 min:stockUom value:count];
  427. //
  428. //
  429. //
  430. // [cell set_Count:count];
  431. //
  432. // NSString* file_name=[img_url lastPathComponent];
  433. // NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url];
  434. // if(img_data!=nil)
  435. // {
  436. //
  437. // UIImage * img =[UIImage imageWithData:img_data];
  438. // [cell.btnImage setBackgroundImage:img forState:UIControlStateNormal];
  439. // }
  440. // else
  441. // {
  442. //
  443. // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  444. //
  445. // NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
  446. //
  447. // dispatch_async(dispatch_get_main_queue(), ^{
  448. //
  449. //
  450. //
  451. // if(downloadimg_data!=nil)
  452. // {
  453. // [iSalesDB cache_img:downloadimg_data :file_name ];
  454. //
  455. // UIImage * img =[UIImage imageWithData:downloadimg_data];
  456. // [cell.btnImage setBackgroundImage:img forState:UIControlStateNormal];
  457. // }
  458. //
  459. // });
  460. // });
  461. //
  462. //
  463. // }
  464. // return cell;
  465. // }
  466. // else
  467. // {
  468. // NSString *CellIdentifier = @"OrderInfoListItem";
  469. // UITableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  470. // return cell;
  471. // }
  472. }
  473. #pragma mark tableview delegate
  474. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  475. {
  476. NSDictionary * item_json = self.arr_documents[indexPath.row];
  477. // NSString* type = item_json[@"type"];
  478. // NSString* file_name = item_json[@"file_name"];
  479. // NSString* upload_date = item_json[@"upload_date"];
  480. NSString* url = item_json[@"url"];
  481. bool isLocalFile= false;//[self.content_data[indexPath.row] valueForKey:@"isLocalFile"];
  482. // ExtDocumentsViewController * docVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"ExtDocumentsViewController"];
  483. //
  484. // docVC.docNumber = doc_number;
  485. // docVC.arr_documents =arr_doc;
  486. // notesVC.docNotes = notes;
  487. PDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFViewController"];
  488. ViewController.url = url;
  489. ViewController.canSave = false;
  490. ViewController.isLocalfile=isLocalFile;
  491. ViewController.defaultStyle = true;
  492. // ViewController.save_name = title;
  493. //
  494. //
  495. // NSMutableArray* send_to = [[NSMutableArray alloc]init];
  496. //
  497. // ViewController.mail_to = send_to;
  498. //
  499. //
  500. // ViewController.mail_subject = subject;
  501. ViewController.hidenavi = false;
  502. UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:ViewController] ;
  503. navi.modalPresentationStyle = UIModalPresentationFullScreen;//有三种状态,自己看看是哪种
  504. [self presentViewController:navi animated:YES completion:^{
  505. // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  506. // DebugLog(@"filter present.........");
  507. // self.btop = false;
  508. // <#code#>
  509. }];
  510. // [self.navigationController pushViewController:ViewController animated:YES];
  511. // NSDictionary * item_json = self.arr_documents[indexPath.row];
  512. //
  513. // NSString* download_url = item_json[@"pdf_path1"];
  514. //
  515. // NSString* subject = [NSString stringWithFormat:@"%@ %@, %@ %@",item_json[@"doc_number"],item_json[@"customer_name"],item_json[@"signed_date"],item_json[@"signed_time"]];
  516. //
  517. //
  518. // [self previewPDF:pdf_url title:item_json[@"doc_number"] subject:subject];
  519. //
  520. //
  521. }
  522. //
  523. //- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
  524. //
  525. //{
  526. //
  527. //
  528. //
  529. // NSDictionary * item_json = self.table_data[indexPath.row];
  530. //
  531. // NSString* notes = item_json[@"notes"];
  532. // NSString* doc_number = item_json[@"doc_number"];
  533. //
  534. // UITableViewRowAction *docAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Documents"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
  535. //
  536. // DebugLog(@"Documents click");
  537. //
  538. // [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
  539. //
  540. // }];
  541. //
  542. //
  543. // docAction.backgroundColor = UIColorFromRGB(0xff9933);
  544. //
  545. //
  546. // UITableViewRowAction *noteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@" Note " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
  547. //
  548. // DebugLog(@"note click");
  549. //
  550. //
  551. // [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
  552. // DocnotesViewController * notesVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"DocnotesViewController"];
  553. //
  554. // notesVC.docNumber = doc_number;
  555. // notesVC.docNotes = notes;
  556. //
  557. // UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:notesVC] ;
  558. //
  559. //
  560. //
  561. //
  562. //
  563. //
  564. // navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
  565. // [self presentViewController:navi animated:YES completion:^{
  566. //
  567. // // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  568. //
  569. // DebugLog(@"filter present.........");
  570. //
  571. // // self.btop = false;
  572. // // <#code#>
  573. // }];
  574. //
  575. // }];
  576. //
  577. // noteAction.backgroundColor = UIColorFromRGB(0x336699);
  578. //
  579. // return @[docAction,noteAction];
  580. //
  581. //
  582. //}
  583. //
  584. //- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
  585. //
  586. // // if(indexPath.row==self.content_data.count)
  587. // // return NO;
  588. // //
  589. // // if(self.init_style==OL_OPEN)
  590. // // return NO;
  591. // //
  592. // // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  593. // // // NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
  594. // // NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
  595. // //
  596. // // if(appDelegate.user_type==USER_ROLE_CUSTOMER) {
  597. // // // saved && ((type==0 && merge_permission) || type == 1 || can_cancel)
  598. // //
  599. // // BOOL isSavedOrder = /*[order_status isEqualToString:@"Saved Order"]*/statusCode == 1;
  600. // // switch (self.orderType) {
  601. // // case 0:{ // Shop Order
  602. // //
  603. // // if (!isSavedOrder) {
  604. // // return NO;
  605. // // } else {
  606. // // if ([Singleton sharedInstance].permissions_merge_order || appDelegate.can_cancel_order) {
  607. // // return YES;
  608. // // } else {
  609. // // return NO;
  610. // // }
  611. // // }
  612. // //
  613. // // }
  614. // // break;
  615. // // case 1:{ // Sales Order
  616. // // if (isSavedOrder && appDelegate.can_cancel_order) {
  617. // // return YES;
  618. // // }
  619. // // return NO;
  620. // // }
  621. // // break;
  622. // //
  623. // // default:
  624. // // break;
  625. // // }
  626. // //
  627. // // } else {
  628. // // return YES;
  629. // // }
  630. // return YES;
  631. //}
  632. //
  633. //- (void)tableView:(UITableView *)tableView
  634. //commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
  635. //
  636. //
  637. //
  638. //}
  639. //
  640. //- (UITableViewCellEditingStyle)tableView:(UITableView *)tv editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
  641. //
  642. // return UITableViewCellEditingStyleDelete;
  643. //
  644. // // if(indexPath.row==self.content_data.count)
  645. // // return UITableViewCellEditingStyleNone;
  646. // // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  647. // // bool offline_edit =[[self.content_data[indexPath.row] valueForKey:@"offline_edit"] boolValue];
  648. // //
  649. // // // NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
  650. // // NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
  651. // // if(/*![order_status isEqualToString:@"Saved Order"]&&! [order_status isEqualToString:@"Quote Saved"]*/statusCode != 1 && statusCode != 0)
  652. // // return UITableViewCellEditingStyleNone;
  653. // // else
  654. // // {
  655. // // if(appDelegate.offline_mode==false||offline_edit)
  656. // // return UITableViewCellEditingStyleDelete;
  657. // // else
  658. // // return UITableViewCellEditingStyleNone;
  659. // // }
  660. //}
  661. /*
  662. #pragma mark - Navigation
  663. // In a storyboard-based application, you will often want to do a little preparation before navigation
  664. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  665. // Get the new view controller using [segue destinationViewController].
  666. // Pass the selected object to the new view controller.
  667. }
  668. */
  669. @end