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