OrderListViewController.m 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282
  1. //
  2. // OrderListViewController.m
  3. // RedAnt ERP Mobile
  4. //
  5. // Created by Ray on 8/18/15.
  6. // Copyright (c) 2015 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "OrderListViewController.h"
  9. #import "OrderListTableViewCell.h"
  10. #import "iSalesNetwork.h"
  11. #import "OrderDetailViewController.h"
  12. #import "MainViewController.h"
  13. #import "ContactListViewController.h"
  14. @interface OrderListViewController ()
  15. @end
  16. @implementation OrderListViewController
  17. -(void) logout
  18. {
  19. self.offset = 0;
  20. [self.content_data removeAllObjects];
  21. [self.table_order reloadData];
  22. self.status_cadedate = nil;
  23. }
  24. -(void) reload_container_getdata:(bool) update_data
  25. {
  26. [super reload_container_getdata:update_data];
  27. if(update_data)
  28. {
  29. // self.offset = 0;
  30. // [self.content_data removeAllObjects];
  31. self.reset_result=true;
  32. self.norefresh=true;
  33. [self loadpage];
  34. }
  35. else
  36. {
  37. [self.table_order reloadData];
  38. }
  39. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  40. if(appDelegate.can_create_order)
  41. {
  42. [self.btn_newOrder setImage:[UIImage imageNamed:@"neworder"]];
  43. self.btn_newOrder.enabled = true;
  44. }
  45. else
  46. {
  47. [self.btn_newOrder setImage:nil];
  48. self.btn_newOrder.enabled = false;
  49. }
  50. }
  51. -(void) showHidePrice
  52. {
  53. [self reload_container_getdata:false];
  54. }
  55. - (void)viewDidLoad {
  56. [super viewDidLoad];
  57. self.edgesForExtendedLayout = UIRectEdgeNone;
  58. self.loading_queue = dispatch_queue_create("orderlist_loading", NULL);
  59. self.label_net_err.layer.borderColor = [UIColor darkGrayColor].CGColor;
  60. self.label_net_err.layer.borderWidth = 2.0;
  61. self.label_net_err.layer.cornerRadius=15;
  62. self.label_net_err.layer.masksToBounds=true;
  63. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
  64. // tap.minimumPressDuration = 0.8; //定义按的时间
  65. [self.label_net_err addGestureRecognizer:tap];
  66. // Do any additional setup after loading the view.
  67. self.offset = 0;
  68. self.limit = 25;
  69. self.content_data = [[NSMutableArray alloc]init];
  70. UIRefreshControl *ref = [[UIRefreshControl alloc]init];
  71. ref.tag = 201 ;
  72. ref.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
  73. ref.tintColor = [UIColor colorWithRed:0.10 green:0.68 blue:0.94 alpha:0.7];
  74. // ref.hidden = true;
  75. [ref addTarget:self action:@selector(manually_refresh) forControlEvents:UIControlEventValueChanged];
  76. [self.table_order addSubview:ref];
  77. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
  78. NSString *documents = [paths objectAtIndex:0];
  79. NSString *dist_path = [documents stringByAppendingPathComponent:@"status_filter_cadedate.json"];
  80. // if ([[NSFileManager defaultManager] fileExistsAtPath:dist_path]) {
  81. //
  82. // NSLog(@"文件已经存在了");
  83. //
  84. // }
  85. // else
  86. // {
  87. //
  88. //
  89. //
  90. // // NSLog(@"resourceSampleImagesFolderPath=%@",resourceFolderPath);
  91. //
  92. // NSData *mainBundleFile = [NSData dataWithContentsOfFile:order_filter_source_path];
  93. //
  94. // // NSLog(@"mainBundleFile==%@",mainBundleFile);
  95. //
  96. // [[NSFileManager defaultManager] createFileAtPath:dist_path
  97. //
  98. // contents:mainBundleFile
  99. //
  100. // attributes:nil];
  101. //
  102. // }
  103. [self loadfilter];
  104. }
  105. -(void) loadfilter
  106. {
  107. if(self.status_cadedate!=nil)
  108. return;
  109. UIApplication * app = [UIApplication sharedApplication];
  110. AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  111. NSData* json =nil;
  112. if(self.init_style==OL_OPEN)
  113. {
  114. json=[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"status_filter_cadedate_open" ofType:@"json" ]];
  115. NSError *error=nil;
  116. self.status_cadedate = [[NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error] mutableCopy];
  117. }
  118. else
  119. {
  120. // json=//[NSData dataWithContentsOfFile:dist_path];
  121. // NSError *error=nil;
  122. self.status_cadedate = appDelegate.OrderFilter;//[[NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error] mutableCopy];
  123. }
  124. }
  125. - (IBAction)onCancel:(id)sender {
  126. if(self.onCancel)
  127. self.onCancel();
  128. [self.navigationController popViewControllerAnimated:false];
  129. }
  130. - (IBAction)onStatusFilterClick:(id)sender {
  131. EnumSelectViewController* enumvc =[ self.storyboard instantiateViewControllerWithIdentifier:@"EnumSelectorViewController"];
  132. enumvc.delegate = self;
  133. enumvc.max_select = 0;
  134. //enumvc.updatePosition = indexPath;
  135. // if([[required lowercaseString] isEqualToString:@"true"])
  136. // enumvc.canbeEmpty = false;
  137. // else
  138. // enumvc.canbeEmpty =true;
  139. enumvc.cadedate = self.status_cadedate ;
  140. enumvc.title = @"Order Status Selection";
  141. // enumvc.value = [value_json mutableCopy];
  142. enumvc.single_select =false;
  143. [self.navigationController pushViewController:enumvc animated:true];
  144. }
  145. - (void)viewWillAppear:(BOOL)animated
  146. {
  147. [super viewWillAppear:animated];
  148. [self loadfilter];
  149. // UIApplication * app = [UIApplication sharedApplication];
  150. // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  151. // if(appDelegate.bLogin==false)
  152. // {
  153. // LoginViewController * loginvc =[ self.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
  154. //// loginvc.delegate = self;
  155. // // loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
  156. //
  157. // loginvc.returnValue = ^(bool blogin){
  158. //
  159. //
  160. // UIApplication * app = [UIApplication sharedApplication];
  161. // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  162. // MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
  163. //
  164. // [main_vc checklogin:true];
  165. //
  166. //// self.offset = 0;
  167. //// [self.content_data removeAllObjects];
  168. //// [self loadpage];
  169. //
  170. // [[self navigationController] setNavigationBarHidden:!self.showNavibar animated:NO];
  171. //
  172. // };
  173. //
  174. // UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
  175. //
  176. //
  177. //
  178. //
  179. //
  180. // // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
  181. //
  182. // navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
  183. // [self presentViewController:navi animated:YES completion:^{
  184. //
  185. // // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  186. //
  187. // NSLog(@"LoginViewController present.........");
  188. //
  189. // // self.btop = false;
  190. // // <#code#>
  191. // }];
  192. // }
  193. // else
  194. // {
  195. //
  196. // if(!self.norefresh)//避免 多次刷新
  197. // {
  198. // self.norefresh = true;
  199. // self.offset = 0;
  200. // [self.content_data removeAllObjects];
  201. // [self loadpage];
  202. //
  203. // }
  204. //
  205. // }
  206. [[self navigationController] setNavigationBarHidden:!self.showNavibar animated:NO];
  207. }
  208. - (IBAction)onNewOrderClicked:(id)sender {
  209. NSString* msg=@"Do you want to create a new order?";
  210. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  211. if(appDelegate.order_code.length==0)
  212. {
  213. if(appDelegate.contact_id.length>0)
  214. {
  215. msg = [msg stringByAppendingString:@"\n\nCustomer:"];
  216. msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
  217. }
  218. }
  219. UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Attention", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
  220. [alert show];
  221. }
  222. - (void)didReceiveMemoryWarning {
  223. [super didReceiveMemoryWarning];
  224. // Dispose of any resources that can be recreated.
  225. }
  226. -(void)manually_refresh
  227. {
  228. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:201];
  229. if(self.isrefreshing)
  230. {
  231. [reF endRefreshing];
  232. return;
  233. }
  234. reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Refreshing"];
  235. if ([self respondsToSelector:@selector(ReloadData)])
  236. [self performSelector:@selector(ReloadData) withObject:nil afterDelay:1];
  237. }
  238. -(void)ReloadData
  239. {
  240. // [self.content_data removeAllObjects];
  241. // [self.table_order reloadData];
  242. // self.table_order.hidden = true;
  243. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:201];
  244. [reF endRefreshing];
  245. reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
  246. self.keywords=self.searchbar.text;
  247. // self.offset = 0;
  248. self.reset_result=true;
  249. // [self.content_data removeAllObjects];
  250. // [self.table_order reloadData];
  251. [self loadpage];
  252. // [self loadpage];
  253. }
  254. -(void) loadpage
  255. {
  256. dispatch_async(self.loading_queue, ^{
  257. dispatch_sync(dispatch_get_main_queue(), ^{
  258. if(self.reset_result)
  259. {
  260. self.offset = 0;
  261. [self.content_data removeAllObjects];
  262. [self.table_order reloadData];
  263. }
  264. // NSMutableArray* arr_status = [[NSMutableArray alloc] init];
  265. NSMutableArray* arr_statusname = [[NSMutableArray alloc] init];
  266. int count = [[self.status_cadedate valueForKey:@"count"] intValue];
  267. for(int i=0;i<count;i++)
  268. {
  269. NSDictionary* val_json =[self.status_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
  270. int check = [[val_json valueForKey:@"check"] intValue];
  271. if(check==1)
  272. {
  273. // [arr_status addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value_id"]]];
  274. [arr_statusname addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value"]]];
  275. // break;
  276. }
  277. }
  278. // NSString * str_status = [arr_status componentsJoinedByString:@","];
  279. NSString * str_statusname = [arr_statusname componentsJoinedByString:@","];
  280. if(str_statusname.length==0)
  281. str_statusname = @"All";
  282. self.label_filter.text = str_statusname;
  283. if(self.offset==0)
  284. {
  285. self.table_order.hidden = true;
  286. self.mum.center = self.view.center;
  287. self.mum.hidden = false;
  288. [self.mum startAnimating];
  289. }
  290. self.label_net_err.hidden=true;
  291. });
  292. });
  293. dispatch_async(self.loading_queue, ^{
  294. if(self.isrefreshing)
  295. return;
  296. self.isrefreshing=true;
  297. NSMutableArray* arr_status = [[NSMutableArray alloc] init];
  298. // NSMutableArray* arr_statusname = [[NSMutableArray alloc] init];
  299. int count = [[self.status_cadedate valueForKey:@"count"] intValue];
  300. for(int i=0;i<count;i++)
  301. {
  302. NSDictionary* val_json =[self.status_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
  303. int check = [[val_json valueForKey:@"check"] intValue];
  304. if(check==1)
  305. {
  306. [arr_status addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value_id"]]];
  307. // [arr_statusname addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value"]]];
  308. // break;
  309. }
  310. }
  311. NSString * str_status = [arr_status componentsJoinedByString:@","];
  312. NSMutableDictionary* content=nil;
  313. content=[[iSalesNetwork request_OrderList:self.offset limit : self.limit keywords:self.keywords status:str_status customer:self.customer_id] mutableCopy];
  314. dispatch_sync(dispatch_get_main_queue(), ^{
  315. [self.mum stopAnimating];
  316. int result=[[content valueForKey:@"result"] intValue];
  317. if(result==2||result==0)
  318. {
  319. int count = [[content valueForKey:@"count" ] intValue] ;
  320. self.time_zone = [content valueForKey:@"time_zone" ];
  321. self.offset += count;
  322. for(int i=0;i<count;i++)
  323. {
  324. NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
  325. [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
  326. }
  327. if(count<self.limit)
  328. {
  329. // int i =self.btnrefresh.state;
  330. self.load_more_hint=@"All loaded";
  331. // self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
  332. // [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
  333. }
  334. else
  335. {
  336. self.load_more_hint=@"Load more...";
  337. // self.btnrefresh.enabled = true;
  338. // self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
  339. // [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
  340. }
  341. self.table_order.hidden = false;
  342. self.reset_result=false;
  343. [self.table_order reloadData ];
  344. }
  345. else if(result==RESULT_NET_ERROR &&self.offset==0)
  346. {
  347. self.label_net_err.hidden=false;
  348. self.table_order.hidden = true;
  349. }
  350. else
  351. {
  352. [RAUtils message_alert:[content valueForKey:@"err_msg"] title:@"Loading Order List" controller:self] ;
  353. }
  354. self.isrefreshing=false;
  355. // NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  356. // bool autologin =[defaults boolForKey:@"autologin"];
  357. // if(!autologin)
  358. // {
  359. // TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
  360. // [self presentViewController:viewController animated:YES completion:^{
  361. //
  362. // }];
  363. // }
  364. });
  365. });
  366. }
  367. - (void)loadmore
  368. {
  369. // self.btnrefresh.enabled = NO;
  370. // self.btnrefresh.titleLabel.text =NSLocalizedString(@"loading",nil);
  371. // [self.btnrefresh setTitle:@"Loading..." forState:UIControlStateNormal];
  372. [self loadpage];
  373. }
  374. //-(void)changeCell
  375. //{
  376. //// UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
  377. //// reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"refreshing"];
  378. // [self performSelector:@selector(loadmore) withObject:nil afterDelay:1];
  379. // DebugLog(@"refresh!!!!!!!!");
  380. //
  381. //}
  382. -(void) neworder
  383. {
  384. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Create Order"];
  385. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  386. NSDictionary* return_json = [iSalesNetwork new_Order];
  387. dispatch_async(dispatch_get_main_queue(), ^{
  388. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  389. if([[return_json valueForKey:@"result"] intValue]==2)
  390. {
  391. int result=[[return_json valueForKey:@"result"] intValue];
  392. if(result==2)
  393. {
  394. //successed.
  395. NSString* order_code = [return_json valueForKey:@"orderCode"];
  396. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  397. appDelegate.order_code = order_code;
  398. appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
  399. MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
  400. [main_vc reloadCart:true immediately:false];
  401. [self ReloadData];
  402. // [self performSelector:@selector(loadpage) withObject:nil afterDelay:1];
  403. // [self loadpage];
  404. // if(self.shopCartBlock!=nil)
  405. // {
  406. // UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
  407. //
  408. //
  409. // CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
  410. // UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
  411. // iv.image = img;
  412. // // [self.contentView addSubview:iv];
  413. // self.shopCartBlock(iv);
  414. //
  415. // }
  416. }
  417. }
  418. else
  419. {
  420. [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:self] ;
  421. }
  422. });
  423. });
  424. }
  425. #pragma mark - UIAlertViewDelegate
  426. // Called when a button is clicked. The view will be automatically dismissed after this call returns
  427. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  428. {
  429. if(buttonIndex!=alertView.cancelButtonIndex)
  430. {
  431. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  432. if(appDelegate.order_code.length>0)
  433. {
  434. appDelegate.order_code= nil;
  435. [appDelegate SetSo:nil];
  436. // MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
  437. ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
  438. cvc.showNavibar = true;
  439. cvc.contact_type = @"Sales_Order_Customer";
  440. cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
  441. appDelegate.contact_id=[value valueForKey:@"customer_cid"];
  442. appDelegate.customerInfo = value;
  443. self.norefresh = true;
  444. [self neworder];
  445. // [main_vc checklogin:true];
  446. // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
  447. //
  448. // if(self.returnValue)
  449. // self.returnValue(value);
  450. };
  451. cvc.onCancel = ^(){
  452. self.norefresh = true;
  453. if(appDelegate.customerInfo==nil)
  454. {
  455. [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"" controller:self];
  456. }
  457. else
  458. {
  459. [self neworder];
  460. }
  461. // [main_vc checklogin:true];
  462. };
  463. cvc.onReset = ^(){
  464. // [main_vc checklogin:true];
  465. };
  466. [self.navigationController pushViewController:cvc animated:true];
  467. }
  468. else
  469. {
  470. //create new;
  471. if(appDelegate.customerInfo==nil)// select contact if current contact not exist
  472. {
  473. MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
  474. ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
  475. cvc.showNavibar = true;
  476. cvc.contact_type = @"Sales_Order_Customer";
  477. cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
  478. appDelegate.contact_id=[value valueForKey:@"customer_cid"];
  479. appDelegate.customerInfo = value;
  480. if(appDelegate.order_code==nil)
  481. [self neworder];
  482. // [main_vc checklogin:true];
  483. // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
  484. //
  485. // if(self.returnValue)
  486. // self.returnValue(value);
  487. };
  488. cvc.onCancel = ^(){
  489. [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"" controller:self];
  490. };
  491. cvc.onReset = ^(){
  492. [main_vc checklogin:true];
  493. };
  494. [self.navigationController pushViewController:cvc animated:true];
  495. }
  496. else
  497. {
  498. [self neworder];
  499. }
  500. }
  501. }
  502. }
  503. #pragma mark - Table view data source
  504. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
  505. {
  506. return 66;
  507. }
  508. //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  509. //{
  510. // return 0;
  511. //}
  512. //- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
  513. //{
  514. // return 0;
  515. //}
  516. //- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
  517. //{
  518. // UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
  519. // return myView;
  520. //
  521. //}
  522. - (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  523. {
  524. UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
  525. myView.backgroundColor = UIColorFromRGB(0x996633);
  526. myView.layer.shadowPath =[UIBezierPath bezierPathWithRect:myView.bounds].CGPath;
  527. myView.layer.shadowColor = [UIColor blackColor].CGColor;
  528. myView.layer.shadowOffset = CGSizeMake(0, 0);
  529. myView.layer.shadowOpacity = 0.5;
  530. myView.layer.shadowRadius = 2.0;
  531. UILabel *statuslabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 2, 130, 22)];
  532. statuslabel.textColor=[UIColor whiteColor];
  533. statuslabel.backgroundColor = [UIColor clearColor];
  534. statuslabel.text=NSLocalizedString(@"Status", nil);
  535. [statuslabel sizeToFit];
  536. [myView addSubview:statuslabel];
  537. UILabel *solabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 21, 130, 22)];
  538. solabel.textColor=[UIColor whiteColor];
  539. solabel.backgroundColor = [UIColor clearColor];
  540. solabel.text=NSLocalizedString(@"SO#", nil);
  541. [solabel sizeToFit];
  542. [myView addSubview:solabel];
  543. UILabel *userlabel = [[UILabel alloc] initWithFrame:CGRectMake(155, 2, 135, 22)];
  544. userlabel.textColor=[UIColor whiteColor];
  545. userlabel.backgroundColor = [UIColor clearColor];
  546. userlabel.text=NSLocalizedString(@"Sales rep", nil);
  547. [userlabel sizeToFit];
  548. [myView addSubview:userlabel];
  549. UILabel *creatorlabel = [[UILabel alloc] initWithFrame:CGRectMake(155, 21, 135, 22)];
  550. creatorlabel.textColor=[UIColor whiteColor];
  551. creatorlabel.backgroundColor = [UIColor clearColor];
  552. creatorlabel.text=NSLocalizedString(@"Create by", nil);
  553. [creatorlabel sizeToFit];
  554. [myView addSubview:creatorlabel];
  555. UILabel *contactlabel = [[UILabel alloc] initWithFrame:CGRectMake(300, 11, 150, 22)];
  556. contactlabel.textColor=[UIColor whiteColor];
  557. contactlabel.backgroundColor = [UIColor clearColor];
  558. contactlabel.text=NSLocalizedString(@"Contact", nil);
  559. [contactlabel sizeToFit];
  560. [myView addSubview:contactlabel];
  561. //
  562. // UILabel *modellabel = [[UILabel alloc] initWithFrame:CGRectMake(424, 11, 52, 22)];
  563. // modellabel.textColor=[UIColor whiteColor];
  564. // modellabel.backgroundColor = [UIColor clearColor];
  565. // modellabel.text=NSLocalizedString(@"Model", nil);
  566. // [modellabel sizeToFit];
  567. // [myView addSubview:modellabel];
  568. // UILabel *modellabel = [[UILabel alloc] initWithFrame:CGRectMake(self.table_order.frame.size.width-276, 2, 100, 22)];
  569. // modellabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
  570. // modellabel.textColor=[UIColor whiteColor];
  571. // modellabel.backgroundColor = [UIColor clearColor];
  572. // modellabel.text=NSLocalizedString(@"Items/QTY", nil);
  573. // [modellabel sizeToFit];
  574. // [myView addSubview:modellabel];
  575. UILabel *pricelabel = [[UILabel alloc] initWithFrame:CGRectMake(/*492*/self.table_order.frame.size.width-276, 11, 100, 22)];
  576. pricelabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
  577. pricelabel.textColor=[UIColor whiteColor];
  578. pricelabel.backgroundColor = [UIColor clearColor];
  579. pricelabel.text=NSLocalizedString(@"Order Total", nil);
  580. [pricelabel sizeToFit];
  581. [myView addSubview:pricelabel];
  582. UILabel *timelabel = [[UILabel alloc] initWithFrame:CGRectMake(self.table_order.frame.size.width-163/*605*/,11, 148, 22)];
  583. timelabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
  584. timelabel.textColor=[UIColor whiteColor];
  585. timelabel.backgroundColor = [UIColor clearColor];
  586. if(self.time_zone==nil)
  587. timelabel.text=@"Create time";
  588. else
  589. timelabel.text=[NSString stringWithFormat:@"Create time (%@)",self.time_zone];
  590. [timelabel sizeToFit];
  591. [myView addSubview:timelabel];
  592. myView.autoresizesSubviews=true;
  593. // [myView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
  594. // modellabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  595. // pricelabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  596. // timelabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  597. myView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
  598. //
  599. return myView;
  600. }
  601. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  602. {
  603. return 44;
  604. }
  605. //
  606. //- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
  607. // if(section==0)
  608. // return nil;
  609. // else
  610. // return @"detail section";
  611. //}
  612. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  613. {
  614. return 1;
  615. }
  616. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  617. {
  618. // NSDictionary * item_json = [self.content_data objectForKey:@"items"];
  619. if( self.content_data.count==0)
  620. return 0;
  621. return self.content_data.count+1;
  622. }
  623. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  624. {
  625. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  626. // if(tableView==self.itemListTable)
  627. // {
  628. // if(indexPath.row>self.content_data.count)
  629. // {
  630. // int debug=true;
  631. // }
  632. // NSLog(@"row %ld",(long)indexPath.row);
  633. if(indexPath.row==self.content_data.count)
  634. {
  635. UITableViewCell *moreCell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"mores"];
  636. UILabel *moreDataLabel=[[UILabel alloc] init];
  637. moreDataLabel.tag=200;
  638. moreDataLabel.text=self.load_more_hint;
  639. [moreDataLabel setFont:[UIFont systemFontOfSize:14.0f]];
  640. [moreDataLabel setTextAlignment:NSTextAlignmentCenter];
  641. moreDataLabel.frame=CGRectMake(0, 10, self.table_order.bounds.size.width, 20);
  642. [moreDataLabel setBackgroundColor:[UIColor clearColor]];
  643. // [moreDataLabel addTarget:self action:@selector(changeCell) forControlEvents:UIControlEventValueChanged];
  644. [moreCell.contentView addSubview:moreDataLabel];
  645. if([self.load_more_hint isEqualToString:@"Load more..."])
  646. [self performSelector:@selector(loadmore) withObject:nil afterDelay:1];
  647. // NSLog(@"更多...");
  648. moreCell.backgroundColor = [UIColor whiteColor];
  649. return moreCell;
  650. }
  651. else
  652. {
  653. NSString *CellIdentifier = @"OrderListTableViewCell";
  654. OrderListTableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  655. NSString* po= [self.content_data[indexPath.row] valueForKey:@"so#"];
  656. NSString* price= [self.content_data[indexPath.row] valueForKey:@"price"];
  657. if(appDelegate.can_see_price&&appDelegate.price_hidden==false)
  658. {
  659. }
  660. else
  661. {
  662. price=nil;
  663. }
  664. NSString* purchase_time= [self.content_data[indexPath.row] valueForKey:@"purchase_time"];
  665. NSString* status = [self.content_data[indexPath.row] valueForKey:@"order_status"] ;
  666. NSString* customer_name = [self.content_data[indexPath.row] valueForKey:@"customer_name"];
  667. NSString* model_count = [self.content_data[indexPath.row] valueForKey:@"model_count"];
  668. NSString* sales = [self.content_data[indexPath.row] valueForKey:@"sales_rep"];
  669. NSString* creator = [self.content_data[indexPath.row] valueForKey:@"create_by"];
  670. cell.label_so.text=po;
  671. cell.labelprice.text=price;
  672. cell.label_date.text=purchase_time;
  673. cell.label_contact.text=customer_name;
  674. cell.label_model.text = model_count;
  675. cell.label_sales.text = sales;
  676. cell.label_creator.text = creator;
  677. cell.label_status.text=status;
  678. cell.backgroundColor = [UIColor whiteColor];
  679. return cell;
  680. }
  681. // NSDictionary * item_json = [self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
  682. // NSDictionary * combine_json =[item_json objectForKey:@"combine"];
  683. // cell.bundle_item=combine_json;
  684. // NSString* img_url = [item_json valueForKey:@"img_url"];
  685. // NSString* description = [item_json valueForKey:@"description"];
  686. // // NSString* identifier = [item_json valueForKey:@"identifier"];
  687. // // NSString* attribute = [item_json valueForKey:@"attribute"];
  688. // NSString* currency = [item_json valueForKey:@"currency"];
  689. // int count =[[item_json valueForKey:@"count"] intValue];
  690. // double price =[[item_json valueForKey:@"price"] doubleValue];
  691. // // cell.labelAttribute.text = attribute;
  692. // cell.labelCurrency.text = currency;
  693. // cell.labelDescription.text = description;
  694. // // cell.labelIdentifier.text = identifier;
  695. // cell.labelPrice.text = [NSString stringWithFormat:@"%.2f",price];
  696. //
  697. //
  698. //
  699. // [cell set_Count:count];
  700. // NSString* file_name=[img_url lastPathComponent];
  701. // NSData* img_data=[iSalesDB load_cached_img:file_name];
  702. // if(img_data!=nil)
  703. // {
  704. //
  705. // UIImage * img =[UIImage imageWithData:img_data];
  706. // [cell.btnImage setBackgroundImage:img forState:UIControlStateNormal];
  707. // }
  708. // else
  709. // {
  710. //
  711. // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  712. //
  713. // NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
  714. //
  715. // dispatch_async(dispatch_get_main_queue(), ^{
  716. //
  717. //
  718. //
  719. // if(downloadimg_data!=nil)
  720. // {
  721. // [iSalesDB cache_img:downloadimg_data :file_name ];
  722. //
  723. // UIImage * img =[UIImage imageWithData:downloadimg_data];
  724. // [cell.btnImage setBackgroundImage:img forState:UIControlStateNormal];
  725. // }
  726. //
  727. // });
  728. // });
  729. //
  730. //
  731. // }
  732. // }
  733. // else
  734. // {
  735. // NSString *CellIdentifier = @"OrderInfoListItem";
  736. // UITableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  737. // return cell;
  738. // }
  739. }
  740. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  741. {
  742. //
  743. if(indexPath.row==self.content_data.count)
  744. return;
  745. NSString* orderid= [self.content_data[indexPath.row] valueForKey:@"order_id"];
  746. OrderDetailViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"OrderDetailViewController" ];
  747. // int i =[[self.content_data[indexPath.row] valueForKey:@"order_code"];
  748. dvc.selectOrder=^(NSMutableDictionary* order_detail){
  749. [self.navigationController popViewControllerAnimated:false];
  750. if(self.selectOrder)
  751. self.selectOrder(order_detail);
  752. };
  753. NSString* order_code =[self.content_data[indexPath.row] valueForKey:@"order_code"];
  754. dvc.order_code = order_code;
  755. dvc.order_status =[[self.content_data[indexPath.row] valueForKey:@"orderStatus"] intValue];
  756. // bool temp_order = false ;
  757. // NSString* order_status=[self.content_data[indexPath.row] valueForKey:@"order_status"];
  758. // if([order_status isEqualToString:@"Saved"]||[order_status isEqualToString:@"Quoted"])
  759. // temp_order=true;
  760. //
  761. // dvc.isTempOrder = temp_order;
  762. // dvc
  763. dvc.orderid=orderid;
  764. // dvc.category_id=nil;
  765. // dvc.ispush=true;
  766. // [dvc reload];
  767. [self.navigationController pushViewController:dvc animated:true];
  768. }
  769. #pragma mark - searchBar delegate;
  770. - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
  771. {
  772. self.keywords=searchBar.text;
  773. // self.offset = 0;
  774. // [self.content_data removeAllObjects];
  775. self.reset_result=true;
  776. [self loadpage];
  777. }
  778. - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
  779. {
  780. if([searchText isEqualToString:@""] && !self.reset)
  781. {
  782. NSLog(@"clear");
  783. self.reset=true;
  784. self.keywords=nil;
  785. // self.offset = 0;
  786. // [self.content_data removeAllObjects];
  787. self.reset_result=true;
  788. [self loadpage];
  789. }
  790. else
  791. self.reset = false;
  792. }
  793. #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
  794. - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
  795. {
  796. // 添加一个删除按钮
  797. // self.indexPath=indexPath;
  798. if(indexPath.row==self.content_data.count)
  799. return @[];
  800. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  801. if(appDelegate.user_type!=USER_ROLE_EMPLOYEE)
  802. return @[];
  803. NSString* so= [self.content_data[indexPath.row] valueForKey:@"so#"];
  804. NSString* orderid= [self.content_data[indexPath.row] valueForKey:@"order_id"];
  805. NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
  806. UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
  807. NSLog(@"delete click");
  808. NSString * title =[NSString stringWithFormat:@"Are you sure to delete order SO#: %@",so];
  809. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
  810. //block代码块取代了delegate
  811. // [alertControl addTextFieldWithConfigurationHandler:^(UITextField *textField) {
  812. // textField.text = self.save_name;
  813. //
  814. //
  815. // }];
  816. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  817. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Delete Order"];
  818. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  819. NSDictionary* return_json = [iSalesNetwork delete_Order:orderid];
  820. dispatch_async(dispatch_get_main_queue(), ^{
  821. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  822. if([[return_json valueForKey:@"result"] intValue]==2)
  823. {
  824. if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
  825. {
  826. appDelegate.order_code= nil;
  827. [appDelegate SetSo:nil];
  828. }
  829. [RAUtils message_alert:nil title:@"Order Delete" controller:self] ;
  830. [self ReloadData];
  831. }
  832. else
  833. {
  834. [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Delete Order" controller:self] ;
  835. }
  836. });
  837. });
  838. }];
  839. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  840. NSLog(@"Cancel");
  841. }];
  842. [alertControl addAction:actionOne];
  843. [alertControl addAction:alertthree];
  844. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  845. [self presentViewController:alertControl animated:YES completion:nil];
  846. }];
  847. deleteRowAction.backgroundColor = UIColorFromRGB(0x336699);
  848. // 添加一个编辑按钮
  849. UITableViewRowAction *cancelAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Cancel"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
  850. NSLog(@"edit click");
  851. NSString * title =[NSString stringWithFormat:@"Are you sure to cancel order SO#: %@",so];
  852. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
  853. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  854. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Cancel Order"];
  855. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  856. NSDictionary* return_json = [iSalesNetwork cancel_Order:orderid];
  857. dispatch_async(dispatch_get_main_queue(), ^{
  858. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  859. if([[return_json valueForKey:@"result"] intValue]==2)
  860. {
  861. if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
  862. {
  863. appDelegate.order_code= nil;
  864. [appDelegate SetSo:nil];
  865. }
  866. [RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
  867. [self ReloadData];
  868. }
  869. else
  870. {
  871. [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
  872. }
  873. });
  874. });
  875. }];
  876. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  877. NSLog(@"Cancel");
  878. }];
  879. [alertControl addAction:actionOne];
  880. [alertControl addAction:alertthree];
  881. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  882. [self presentViewController:alertControl animated:YES completion:nil];
  883. //
  884. }];
  885. cancelAction.backgroundColor = UIColorFromRGB(0xff9933);
  886. if([order_status isEqualToString:@"Saved Order"]&&appDelegate.can_cancel_order)
  887. return @[cancelAction];
  888. else
  889. {
  890. if([order_status isEqualToString:@"Quote Saved"])
  891. {
  892. NSMutableArray* arr=[@[] mutableCopy];
  893. if(appDelegate.can_delete_order)
  894. [arr addObject:deleteRowAction];
  895. if(appDelegate.can_cancel_order)
  896. [arr addObject:cancelAction];
  897. return arr;
  898. }
  899. }
  900. return @[];
  901. }
  902. - (void)tableView:(UITableView *)tableView
  903. commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
  904. }
  905. - (UITableViewCellEditingStyle)tableView:(UITableView *)tv editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
  906. if(indexPath.row==self.content_data.count)
  907. return UITableViewCellEditingStyleNone;
  908. NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
  909. if(![order_status isEqualToString:@"Saved Order"]&&! [order_status isEqualToString:@"Quote Saved"])
  910. return UITableViewCellEditingStyleNone;
  911. else
  912. return UITableViewCellEditingStyleDelete;
  913. }
  914. /*
  915. #pragma mark - Navigation
  916. // In a storyboard-based application, you will often want to do a little preparation before navigation
  917. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  918. // Get the new view controller using [segue destinationViewController].
  919. // Pass the selected object to the new view controller.
  920. }
  921. */
  922. #pragma mark EnumSelectViewControllerDelegate
  923. -(void) EnumValueChanged:(NSMutableDictionary *)value indexPath :(NSIndexPath*) indexPath
  924. {
  925. self.status_cadedate = value;
  926. UIApplication * app = [UIApplication sharedApplication];
  927. AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  928. appDelegate.OrderFilter = value;
  929. // NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
  930. // NSString *documents = [paths objectAtIndex:0];
  931. // NSString *dist_path = [documents stringByAppendingPathComponent:@"status_filter_cadedate.json"];
  932. //
  933. //
  934. // // if ([[NSFileManager defaultManager] fileExistsAtPath:dist_path]) {
  935. // //
  936. // // NSLog(@"文件已经存在了");
  937. // //
  938. // // }
  939. // // else
  940. // // {
  941. // //
  942. // //
  943. // //
  944. // // NSLog(@"resourceSampleImagesFolderPath=%@",resourceFolderPath);
  945. //
  946. //NSData *data = [NSJSONSerialization dataWithJSONObject:self.status_cadedate options:kNilOptions error:nil];
  947. //
  948. // // NSLog(@"mainBundleFile==%@",mainBundleFile);
  949. //
  950. // [[NSFileManager defaultManager] createFileAtPath:dist_path
  951. //
  952. // contents:data
  953. //
  954. // attributes:nil];
  955. //
  956. // }
  957. // self.keywords=searchBar.text;
  958. // self.offset = 0;
  959. // [self.content_data removeAllObjects];
  960. self.reset_result=true;
  961. [self loadpage];
  962. //[self.btnStatusFilter setTitle:setTitle:alert ];
  963. }
  964. @end