ExtDocumentsViewController.m 26 KB

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