| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753 |
- //
- // ExtDocumentsViewController.m
- // Granite Expo eSign
- //
- // Created by Ray on 27/02/2017.
- // Copyright © 2017 United Software Applications, Inc. All rights reserved.
- //
- #import "ExtDocumentsViewController.h"
- #import "PDFViewController.h"
- #import "AddExtDocumentViewController.h"
- @interface ExtDocumentsViewController ()
- @end
- @implementation ExtDocumentsViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.labelDocNumber.text = self.docNumber;
- self.edgesForExtendedLayout = UIRectEdgeNone;
-
-
- UIBarButtonItem *closeButton =nil;
-
-
-
- closeButton=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"close"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
- style:UIBarButtonItemStylePlain
- target:self
- action:@selector( onCloseClick:)];
-
- self.navigationItem.rightBarButtonItem = closeButton;
- // Do any additional setup after loading the view.
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (void)onCloseClick:(UIButton *)sender {
- __weak typeof(self) weakself = self;
-
- [self dismissViewControllerAnimated:false completion:^{
- if(weakself.closeExtDoc)
- weakself.closeExtDoc(false);
- }];
-
- // [self.navigationController popViewControllerAnimated:FALSE];
- }
- - (IBAction)onAddClick:(id)sender {
-
-
- __weak typeof(self) weakself = self;
- AddExtDocumentViewController * addVC = [self.storyboard instantiateViewControllerWithIdentifier:@"AddExtDocumentViewController"];
- addVC.doc_number = self.docNumber;
- addVC.uploadSuccess = ^(NSMutableArray* arr_upload){
- // [weakself.arr_documents addObjectsFromArray:arr_upload];
- // [weakself.tableView reloadData];
- // [weakself dismissViewControllerAnimated:false completion:^{
- //
- // }];
-
- if(weakself.closeExtDoc)
- weakself.closeExtDoc(true);
-
- };
- [self.navigationController pushViewController:addVC animated:false];
-
- }
- #pragma mark - Table view data source
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
- {
- return 44;
-
-
- }
- //- (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
- //{
- //
- // NSString* value =nil;//[DefaultAppearance get_noneappearance_value:@"DefaultTableHeaderView" valuename:@"title_text_color"];
- //
- // if(value==nil)
- // value=@"";
- // unsigned long color = strtoul([value UTF8String],0,16);
- //
- // UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
- // myView.backgroundColor = UIColorFromRGB(0xf7f7f7);
- // myView.layer.shadowPath =[UIBezierPath bezierPathWithRect:myView.bounds].CGPath;
- // myView.layer.shadowColor = [UIColor blackColor].CGColor;
- // myView.layer.shadowOffset = CGSizeMake(0, 0);
- // myView.layer.shadowOpacity = 0.5;
- // myView.layer.shadowRadius = 2.0;
- //
- //
- // UILabel *statuslabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 2, 130, 22)];
- // statuslabel.textColor=UIColorFromRGB(color);
- // statuslabel.backgroundColor = [UIColor clearColor];
- // statuslabel.text=NSLocalizedString(@"Document #", nil);
- // [statuslabel sizeToFit];
- // [myView addSubview:statuslabel];
- //
- // UILabel *solabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 21, 130, 22)];
- // solabel.textColor=UIColorFromRGB(color);
- // solabel.backgroundColor = [UIColor clearColor];
- // solabel.text=NSLocalizedString(@"Address", nil);
- // [solabel sizeToFit];
- // [myView addSubview:solabel];
- //
- // UILabel *userlabel = [[UILabel alloc] initWithFrame:CGRectMake(143, 2, 135, 22)];
- // userlabel.textColor=UIColorFromRGB(color);
- // userlabel.backgroundColor = [UIColor clearColor];
- // userlabel.text=NSLocalizedString(@"Customer", nil);
- // [userlabel sizeToFit];
- // [myView addSubview:userlabel];
- //
- // // UILabel *creatorlabel = [[UILabel alloc] initWithFrame:CGRectMake(155, 21, 135, 22)];
- // // creatorlabel.textColor=UIColorFromRGB(color);
- // // creatorlabel.backgroundColor = [UIColor clearColor];
- // // creatorlabel.text=NSLocalizedString(@"Create by", nil);
- // // [creatorlabel sizeToFit];
- // // [myView addSubview:creatorlabel];
- //
- // UILabel *contactlabel = [[UILabel alloc] initWithFrame:CGRectMake(345, 2, 150, 22)];
- //
- // contactlabel.textColor=UIColorFromRGB(color);
- // contactlabel.backgroundColor = [UIColor clearColor];
- // contactlabel.text=NSLocalizedString(@"Job Date", nil);
- // [contactlabel sizeToFit];
- // [myView addSubview:contactlabel];
- //
- // //
- // // UILabel *modellabel = [[UILabel alloc] initWithFrame:CGRectMake(424, 11, 52, 22)];
- // // modellabel.textColor=[UIColor whiteColor];
- // // modellabel.backgroundColor = [UIColor clearColor];
- // // modellabel.text=NSLocalizedString(@"Model", nil);
- // // [modellabel sizeToFit];
- // // [myView addSubview:modellabel];
- //
- // // UILabel *modellabel = [[UILabel alloc] initWithFrame:CGRectMake(self.table_order.frame.size.width-276, 2, 100, 22)];
- // // modellabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
- // // modellabel.textColor=[UIColor whiteColor];
- // // modellabel.backgroundColor = [UIColor clearColor];
- // // modellabel.text=NSLocalizedString(@"Items/QTY", nil);
- // // [modellabel sizeToFit];
- // // [myView addSubview:modellabel];
- //
- // UILabel *pricelabel = [[UILabel alloc] initWithFrame:CGRectMake(/*492*/self.tableView.frame.size.width-313, 2, 100, 22)];
- // pricelabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
- // pricelabel.textColor=UIColorFromRGB(color);
- // pricelabel.backgroundColor = [UIColor clearColor];
- // pricelabel.text=NSLocalizedString(@"Agent Name", nil);
- // [pricelabel sizeToFit];
- // [myView addSubview:pricelabel];
- //
- // UILabel *timelabel = [[UILabel alloc] initWithFrame:CGRectMake(self.tableView.frame.size.width-111/*605*/,2, 148, 22)];
- // timelabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
- // timelabel.textColor=UIColorFromRGB(color);
- // timelabel.backgroundColor = [UIColor clearColor];
- // // if(self.time_zone==nil)
- // timelabel.text=@"Sign Date";
- // // else
- // // timelabel.text=[NSString stringWithFormat:@"Create time (%@)",self.time_zone];
- // [timelabel sizeToFit];
- // [myView addSubview:timelabel];
- //
- // myView.autoresizesSubviews=true;
- // // [myView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
- //
- //
- //
- //
- // // modellabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
- // // pricelabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
- // // timelabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
- // myView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
- // //
- // 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 1;
- }
- //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- //{
- // return 44;
- //}
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
-
- return self.arr_documents.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
-
-
-
-
-
- NSString *CellIdentifier = @"ADTableViewCell";
- UITableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
- NSDictionary * item_json = self.arr_documents[indexPath.row];
- NSString* type = item_json[@"type"];
- NSString* file_name = item_json[@"file_name"];
- NSString* upload_date = item_json[@"upload_date"];
- NSString* url = item_json[@"url"];
- if([type isEqualToString:@"file"])
- cell.imageView.image = [UIImage imageNamed:@"file_icon"];
- else
- cell.imageView.image = [UIImage imageNamed:@"picture_icon"];
-
-
- cell.textLabel.text = file_name;
- cell.detailTextLabel.text = upload_date;
-
- // cell.labelAgent.text = item_json[@"agent_name"];
- // NSString* job_addr =item_json[@"job_addr"];
- // NSString* job_city =item_json[@"job_city"];
- // NSString* job_state =item_json[@"job_state"];
- // NSString* job_zip =item_json[@"job_zip"];
- // NSString* tel =item_json[@"tel"];
- //
- // NSString* notes =item_json[@"notes"];
- // if(notes.length>0)
- // {
- // cell.Icon_notes.hidden = false;
- // cell.label_notes.hidden = false;
- // }
- // else
- // {
- // cell.Icon_notes.hidden = true;
- // cell.label_notes.hidden = true;
- // }
- // NSMutableArray* arr_doc = [item_json[@"documents"] mutableCopy];
- // int imgcount=0;
- // int filecount=0;
- // for(int d=0;d<arr_doc.count;d++)
- // {
- // NSDictionary* doc= arr_doc[d];
- // NSString* type = doc[@"type"];
- // if([type isEqualToString:@"image"])
- // imgcount++;
- // else if([type isEqualToString:@"file"])
- // filecount++;
- // }
- // if(imgcount>0)
- // {
- // cell.Icon_img.hidden = false;
- // cell.label_img.hidden = false;
- // cell.label_img.text=[NSString stringWithFormat:@"%d",imgcount];
- // }
- // else
- // {
- // cell.Icon_img.hidden = true;
- // cell.label_img.hidden = true;
- // cell.label_img.text=@"";
- //
- // }
- // if(filecount>0)
- // {
- // cell.Icon_file.hidden = false;
- // cell.label_file.hidden = false;
- // cell.label_file.text=[NSString stringWithFormat:@"%d",filecount];
- // }
- // else
- // {
- // cell.Icon_file.hidden = true;
- // cell.label_file.hidden = true;
- // cell.label_file.text=@"";
- //
- // }
- //
- //
- // if(tel.length>0)
- // tel= [@"TEL: " stringByAppendingString:tel];
- //
- //
- // NSMutableArray* arr_ext= [[NSMutableArray alloc] init];
- //
- // [arr_ext addObject:job_addr];
- // [arr_ext addObject:@"\r\n"];
- //
- // [arr_ext addObject:job_city];
- // [arr_ext addObject:job_state];
- // [arr_ext addObject:job_zip];
- // [arr_ext addObject:@"\r\n"];
- // [arr_ext addObject:tel];
- //
- // NSString *nsext=[RAUtils arr2string:arr_ext separator:@", " trim:true];
- //
- //
- // nsext=[nsext stringByReplacingOccurrencesOfString:@", \r\n," withString:@"\r\n"];
- //
- //
- // // if(sss.length==0)
- // // sss=@"";
- // cell.labelDocID.text = item_json[@"doc_number"];//
- // cell.labelExtInfo.text =nsext;
- // cell.labelJobDate.text =item_json[@"job_date"];
- // cell.labelCustomer.text =item_json[@"customer_name"];
- // cell.labelSignDate.text =item_json[@"signed_date"];
- //
- //
-
- 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
- {
-
- NSDictionary * item_json = self.arr_documents[indexPath.row];
- // NSString* type = item_json[@"type"];
- // NSString* file_name = item_json[@"file_name"];
- // NSString* upload_date = item_json[@"upload_date"];
- NSString* url = item_json[@"url"];
-
-
-
- bool isLocalFile= false;//[self.content_data[indexPath.row] valueForKey:@"isLocalFile"];
-
-
-
-
- // ExtDocumentsViewController * docVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"ExtDocumentsViewController"];
- //
- // docVC.docNumber = doc_number;
- // docVC.arr_documents =arr_doc;
- // notesVC.docNotes = notes;
-
-
-
- PDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFViewController"];
- ViewController.url = url;
- ViewController.canSave = false;
- ViewController.isLocalfile=isLocalFile;
- ViewController.defaultStyle = true;
- // ViewController.save_name = title;
- //
- //
- // NSMutableArray* send_to = [[NSMutableArray alloc]init];
- //
- // ViewController.mail_to = send_to;
- //
- //
- // ViewController.mail_subject = subject;
-
- ViewController.hidenavi = false;
-
-
- UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:ViewController] ;
-
-
-
-
-
-
- navi.modalPresentationStyle = UIModalPresentationFullScreen;//有三种状态,自己看看是哪种
- [self presentViewController:navi animated:YES completion:^{
-
- // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-
- // DebugLog(@"filter present.........");
-
- // self.btop = false;
- // <#code#>
- }];
-
-
-
- // [self.navigationController pushViewController:ViewController animated:YES];
-
-
-
- // NSDictionary * item_json = self.arr_documents[indexPath.row];
- //
- // NSString* download_url = item_json[@"pdf_path1"];
- //
- // NSString* subject = [NSString stringWithFormat:@"%@ %@, %@ %@",item_json[@"doc_number"],item_json[@"customer_name"],item_json[@"signed_date"],item_json[@"signed_time"]];
- //
- //
- // [self previewPDF:pdf_url title:item_json[@"doc_number"] subject:subject];
- //
- //
- }
- //
- //- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
- //
- //{
- //
- //
- //
- // NSDictionary * item_json = self.table_data[indexPath.row];
- //
- // NSString* notes = item_json[@"notes"];
- // NSString* doc_number = item_json[@"doc_number"];
- //
- // UITableViewRowAction *docAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Documents"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
- //
- // DebugLog(@"Documents click");
- //
- // [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
- //
- // }];
- //
- //
- // docAction.backgroundColor = UIColorFromRGB(0xff9933);
- //
- //
- // UITableViewRowAction *noteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@" Note " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
- //
- // DebugLog(@"note click");
- //
- //
- // [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
- // DocnotesViewController * notesVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"DocnotesViewController"];
- //
- // notesVC.docNumber = doc_number;
- // notesVC.docNotes = notes;
- //
- // UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:notesVC] ;
- //
- //
- //
- //
- //
- //
- // navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
- // [self presentViewController:navi animated:YES completion:^{
- //
- // // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
- //
- // DebugLog(@"filter present.........");
- //
- // // self.btop = false;
- // // <#code#>
- // }];
- //
- // }];
- //
- // noteAction.backgroundColor = UIColorFromRGB(0x336699);
- //
- // return @[docAction,noteAction];
- //
- //
- //}
- //
- //- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
- //
- // // if(indexPath.row==self.content_data.count)
- // // return NO;
- // //
- // // if(self.init_style==OL_OPEN)
- // // return NO;
- // //
- // // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
- // // // NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
- // // NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
- // //
- // // if(appDelegate.user_type==USER_ROLE_CUSTOMER) {
- // // // saved && ((type==0 && merge_permission) || type == 1 || can_cancel)
- // //
- // // BOOL isSavedOrder = /*[order_status isEqualToString:@"Saved Order"]*/statusCode == 1;
- // // switch (self.orderType) {
- // // case 0:{ // Shop Order
- // //
- // // if (!isSavedOrder) {
- // // return NO;
- // // } else {
- // // if ([Singleton sharedInstance].permissions_merge_order || appDelegate.can_cancel_order) {
- // // return YES;
- // // } else {
- // // return NO;
- // // }
- // // }
- // //
- // // }
- // // break;
- // // case 1:{ // Sales Order
- // // if (isSavedOrder && appDelegate.can_cancel_order) {
- // // return YES;
- // // }
- // // return NO;
- // // }
- // // break;
- // //
- // // default:
- // // break;
- // // }
- // //
- // // } else {
- // // return YES;
- // // }
- // return YES;
- //}
- //
- //- (void)tableView:(UITableView *)tableView
- //commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
- //
- //
- //
- //}
- //
- //- (UITableViewCellEditingStyle)tableView:(UITableView *)tv editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
- //
- // return UITableViewCellEditingStyleDelete;
- //
- // // if(indexPath.row==self.content_data.count)
- // // return UITableViewCellEditingStyleNone;
- // // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
- // // bool offline_edit =[[self.content_data[indexPath.row] valueForKey:@"offline_edit"] boolValue];
- // //
- // // // NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
- // // NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
- // // if(/*![order_status isEqualToString:@"Saved Order"]&&! [order_status isEqualToString:@"Quote Saved"]*/statusCode != 1 && statusCode != 0)
- // // return UITableViewCellEditingStyleNone;
- // // else
- // // {
- // // if(appDelegate.offline_mode==false||offline_edit)
- // // return UITableViewCellEditingStyleDelete;
- // // else
- // // return UITableViewCellEditingStyleNone;
- // // }
- //}
- /*
- #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.
- }
- */
- @end
|