ExtDocumentsViewController.m 25 KB

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