ExtDocumentsViewController.m 26 KB

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