| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- //
- // SignatureListViewController.m
- // AntsContract
- //
- // Created by Ray on 12/19/16.
- // Copyright © 2016 United Software Applications, Inc. All rights reserved.
- //
- #import "SignatureListViewController.h"
- #import "SignatureTableViewCell.h"
- @interface SignatureListViewController ()
- @end
- @implementation SignatureListViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (IBAction)onAddClick:(id)sender {
-
-
- [self dismissViewControllerAnimated:false completion:^{
-
-
- if(self.blk_Add)
- self.blk_Add();
-
- }];
-
-
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- #pragma mark - Table view data source
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
- {
- // NSDictionary * item_json = [self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
- // if([item_json objectForKey:@"combine"] == nil)
- // {
- // return 120;
- // }
- // else
- // return 150;
-
-
- return 128;
-
- }
- //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- //{
- // return 0;
- //}
- //- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- //{
- // return 0;
- //}
- //- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
- //{
- // UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
- // return myView;
- //
- //}
- //- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- //{
- // UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
- //// myView.backgroundColor = [UIColor colorWithRed:0.10 green:0.68 blue:0.94 alpha:0.7];
- //// UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 90, 22)];
- //// titleLabel.textColor=[UIColor whiteColor];
- //// titleLabel.backgroundColor = [UIColor clearColor];
- //// if(section==0)
- //// titleLabel.text=NSLocalizedString(@"display_items", nil);
- //// else
- //// titleLabel.text=NSLocalizedString(@"hide_items", nil);
- //// [titleLabel sizeToFit];
- //// [myView addSubview:titleLabel];
- ////
- // return myView;
- //}
- //
- //- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- //{
- //
- //
- // NSString* value =[DefaultAppearance get_noneappearance_value:@"DefaultTableHeaderView" valuename:@"title_text_color"];
- //
- // if(value==nil)
- // value=@"";
- // unsigned long color = strtoul([value UTF8String],0,16);
- //
- //
- // DefaultTableHeaderView* myView = [[DefaultTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
- // // myView.backgroundColor = UIColorFromRGB(0x996633);;
- //
- //
- // myView.layer.shadowPath =[UIBezierPath bezierPathWithRect:myView.bounds].CGPath;
- // // myView.layer.masksToBounds = false;
- // //添加四个边阴影
- //
- // myView.layer.shadowColor = [UIColor blackColor].CGColor;
- // myView.layer.shadowOffset = CGSizeMake(0, 0);
- // myView.layer.shadowOpacity = 0.5;
- // myView.layer.shadowRadius = 2.0;
- //
- //
- // NSString*labeltitle = nil;
- // switch (section) {
- // case 0:
- // labeltitle= @"Order Info";
- // break;
- // case 1:
- // {
- // labeltitle= @"More Info";
- //
- // NSString* btntitle=nil ;
- // if(self.showMore)
- // {
- // btntitle=@"Hide";
- // // [section setValue:@"false" forKey:@"hide"];
- // // [sender setTitle:@"Show" forState:UIControlStateNormal];
- // }
- // else{
- // btntitle=@"Show";
- // }
- //
- //
- // UIButton * btn =[[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width-50-15, 0, 50, 33)];
- // btn.tag=section;
- // [btn addTarget:self action:@selector(HideSction:) forControlEvents:UIControlEventTouchUpInside];
- // [btn setTitle:btntitle forState:UIControlStateNormal];
- // [myView addSubview:btn];
- //
- // }
- // break;
- // case 2:{
- // labeltitle= @"Models";
- //
- // NSString* btntitle=nil ;
- // if(self.showModels)
- // {
- // btntitle=@"Hide";
- // }
- // else{
- // btntitle=@"Show";
- // }
- //
- //
- // UIButton * btn =[[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width-50-15, 0, 50, 33)];
- // btn.tag=section;
- //
- // [btn addTarget:self action:@selector(HideSction:) forControlEvents:UIControlEventTouchUpInside];
- //
- // [btn setTitle:btntitle forState:UIControlStateNormal];
- // [myView addSubview:btn];
- //
- // }
- // break;
- // case 3:
- // labeltitle= @"Price Info";
- // default:
- // break;
- // }
- //
- //
- //
- // UILabel *titlelabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 5.5, 200, 20)];
- // titlelabel.textColor=UIColorFromRGB(color);;
- // titlelabel.backgroundColor = [UIColor clearColor];
- // titlelabel.text=NSLocalizedString(labeltitle, nil);
- // [titlelabel sizeToFit];
- // [myView addSubview:titlelabel];
- //
- // //
- // return myView;
- //}
- - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
-
- return [NSString stringWithFormat:@"Signature%ld",(long)section+1];
-
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return [self.signatureData[@"count"] intValue];
- }
- //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- //{
- // return 33;
- //}
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
-
- return 1;
-
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
-
- NSString *CellIdentifier = @"SignatureTableViewCell";
- SignatureTableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
- NSDictionary * item_json = self.signatureData[[NSString stringWithFormat:@"item_%ld",(long)indexPath.section]];
-
- UIImage* img = [UIImage imageWithContentsOfFile:item_json[@"file"]];
-
- cell.signatureImageView.image = img;
- //
- //
- // cell.webview.tag = indexPath.section;
- //
- // cell.webview.delegate = self;
- // // cell.webView.scrollView.contentSize.height = 0;
- // cell.webview.scrollView.bounces=NO;
- // cell.webview.scrollView.directionalLockEnabled = true;
- // CGSize size= cell.webview.scrollView.contentSize;
- // size.height=10;
- // cell.webview.scrollView.contentSize=size;
- //
- // [cell.webview loadHTMLString:[self.content_data valueForKey:@"order_info"] baseURL:nil];
- //
- // cell.backgroundColor = [UIColor whiteColor];
- return cell;
- // if(tableView==self.itemListTable)
- // {
- // NSString *CellIdentifier = @"CartItemCell";
- // ModelItemCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
- // NSDictionary * item_json = [self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
- // NSDictionary * combine_json =[item_json objectForKey:@"combine"];
- //
- // cell.bundle_item=combine_json;
- // NSString* img_url = [item_json valueForKey:@"img_url"];
- // NSString* description = [item_json valueForKey:@"description"];
- // // NSString* identifier = [item_json valueForKey:@"identifier"];
- // // NSString* attribute = [item_json valueForKey:@"attribute"];
- // NSString* currency = [item_json valueForKey:@"currency"];
- // int count =[[item_json valueForKey:@"count"] intValue];
- //
- // int stockUom =[[item_json valueForKey:@"stockUom"] intValue];
- //
- // double totalprice =[[item_json valueForKey:@"subtotal_price"] doubleValue];
- //
- // double unitprice=[[item_json valueForKey:@"unit_price"] doubleValue];
- // cell.unit_price = unitprice;
- // // cell.labelAttribute.text = attribute;
- // // cell.labelCurrency.text = currency;
- // cell.labelDescription.text = description;
- // // cell.labelIdentifier.text = identifier;
- // cell.labelPrice.text = [NSString stringWithFormat:@"%.2f",totalprice];
- //
- // cell.labelUnitPrice.text = [NSString stringWithFormat:@"%.2f",unitprice];
- //
- //
- //
- // NSString* cart_item_id= [item_json valueForKey:@"cart_item_id"];
- // cell.cart_id = cart_item_id;
- // [cell init_Stepper:stockUom max:9999 min:stockUom value:count];
- //
- //
- //
- // [cell set_Count:count];
- //
- // NSString* file_name=[img_url lastPathComponent];
- // NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url];
- // if(img_data!=nil)
- // {
- //
- // UIImage * img =[UIImage imageWithData:img_data];
- // [cell.btnImage setBackgroundImage:img forState:UIControlStateNormal];
- // }
- // else
- // {
- //
- // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- //
- // NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
- //
- // dispatch_async(dispatch_get_main_queue(), ^{
- //
- //
- //
- // if(downloadimg_data!=nil)
- // {
- // [iSalesDB cache_img:downloadimg_data :file_name ];
- //
- // UIImage * img =[UIImage imageWithData:downloadimg_data];
- // [cell.btnImage setBackgroundImage:img forState:UIControlStateNormal];
- // }
- //
- // });
- // });
- //
- //
- // }
- // return cell;
- // }
- // else
- // {
- // NSString *CellIdentifier = @"OrderInfoListItem";
- // UITableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
- // return cell;
- // }
- }
- #pragma mark tableview delegate
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if(self.blk_Select)
- {
-
- // SignatureTableViewCell * cell= [tableView cellForRowAtIndexPath:indexPath];
-
- NSDictionary * item_json = self.signatureData[[NSString stringWithFormat:@"item_%ld",(long)indexPath.section]];
-
- // UIImage* img = [UIImage imageWithContentsOfFile:item_json[@"file"]];
-
-
- self.blk_Select(item_json[@"file"]);
- }
-
- [self dismissViewControllerAnimated:false completion:nil];
-
- // if (tableView.isEditing) { // 编辑模式下不响应
- // return;
- // }
- // //
- // if(indexPath.row==self.content_data.count)
- // return;
- // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
- //
- // if(appDelegate.user_type==USER_ROLE_CUSTOMER) { // Customer
- // if ([Singleton sharedInstance].global_lock) { // Order list 被锁
- // [RAUtils message_alert:@"App is locked,You can't view the order Detail" title:@"Warning" controller:self];
- // return;
- // }
- // }
- //
- // NSString* orderid= [self.content_data[indexPath.row] valueForKey:@"order_id"];
- // OrderDetailViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"OrderDetailViewController" ];
- //
- // // int i =[[self.content_data[indexPath.row] valueForKey:@"order_code"];
- // dvc.selectOrder=^(NSMutableDictionary* order_detail){
- //
- // [self.navigationController popViewControllerAnimated:false];
- // if(self.selectOrder)
- // self.selectOrder(order_detail);
- //
- //
- //
- // };
- // NSString* order_code =[self.content_data[indexPath.row] valueForKey:@"order_code"];
- //
- // dvc.is_shoporder=(self.orderType == 0);
- // dvc.order_code = order_code;
- // dvc.order_status =[[self.content_data[indexPath.row] valueForKey:@"orderStatus"] intValue];
- // // bool temp_order = false ;
- // // NSString* order_status=[self.content_data[indexPath.row] valueForKey:@"order_status"];
- // // if([order_status isEqualToString:@"Saved"]||[order_status isEqualToString:@"Quoted"])
- // // temp_order=true;
- // //
- // // dvc.isTempOrder = temp_order;
- //
- // // dvc
- //
- // dvc.orderid=orderid;
- // // dvc.category_id=nil;
- // // dvc.ispush=true;
- // // [dvc reload];
- // [self.navigationController pushViewController:dvc animated:true];
-
-
- }
- @end
|