|
|
@@ -10,6 +10,8 @@
|
|
|
#import "RATreeView.h"
|
|
|
#import "const.h"
|
|
|
#import "EnumSelectViewController.h"
|
|
|
+#import "DefaultAppearance.h"
|
|
|
+#import "AppDelegate.h"
|
|
|
@interface ItemSearchFilterViewController ()
|
|
|
|
|
|
@end
|
|
|
@@ -71,8 +73,27 @@
|
|
|
alert = nil;
|
|
|
// NSLog(ids);
|
|
|
|
|
|
+
|
|
|
+ NSString* qty = [self.buttonQTY titleForState:UIControlStateNormal];
|
|
|
+ if(qty.length==0 || [qty isEqualToString:@"Click to select"])
|
|
|
+ qty = nil;
|
|
|
+
|
|
|
+ NSString* price = [self.buttonPrice titleForState:UIControlStateNormal];
|
|
|
+ if(price.length==0 || [price isEqualToString:@"Click to select"])
|
|
|
+ price = nil;
|
|
|
+
|
|
|
+ NSString* available = [self.buttonAvailability titleForState:UIControlStateNormal];
|
|
|
+ if(available.length==0 || [available isEqualToString:@"Click to select"])
|
|
|
+ available = nil;
|
|
|
+
|
|
|
+
|
|
|
+ NSString* bestseller = [self.buttonBestSeller titleForState:UIControlStateNormal];
|
|
|
+ if(bestseller.length==0 || [bestseller isEqualToString:@"Click to select"])
|
|
|
+ alert = nil;
|
|
|
+
|
|
|
+
|
|
|
if(self.SearchClick)
|
|
|
- self.SearchClick(ids, modelname, modeldescrip, alert);
|
|
|
+ self.SearchClick(ids, modelname, modeldescrip, alert,available, qty, price,bestseller);
|
|
|
[self dismissViewControllerAnimated:true completion:nil];
|
|
|
}
|
|
|
-(int) is_check:(NSString*) cid source:(NSDictionary*) json
|
|
|
@@ -140,6 +161,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
+ UIApplication * app = [UIApplication sharedApplication];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
+ if(appDelegate.bLogin)
|
|
|
+ {
|
|
|
+ self.labelPrice.hidden=false;
|
|
|
+ self.buttonPrice.hidden=false;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ self.labelPrice.hidden=true;
|
|
|
+ self.buttonPrice.hidden=true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"close"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
|
|
|
style:UIBarButtonItemStylePlain
|
|
|
target:self
|
|
|
@@ -173,8 +212,15 @@
|
|
|
self.treeView.treeHeaderView = line;
|
|
|
*/
|
|
|
|
|
|
+
|
|
|
+ NSString* value =[DefaultAppearance get_noneappearance_value:@"DefaultColor" valuename:@"frontcolor"];
|
|
|
+
|
|
|
+ if(value==nil)
|
|
|
+ value=@"";
|
|
|
+ unsigned long frontcolor = strtoul([value UTF8String],0,16);
|
|
|
+
|
|
|
UILabel *CategoryLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 5.5, self.view.frame.size.width, 33)];
|
|
|
- CategoryLabel.textColor=UIColorFromRGB(0x996633);
|
|
|
+ CategoryLabel.textColor=UIColorFromRGB(frontcolor);
|
|
|
// CategoryLabel.backgroundColor = [UIColor redColor];
|
|
|
CategoryLabel.text=NSLocalizedString(@" Category", nil);
|
|
|
// [CategoryLabel sizeToFit];
|
|
|
@@ -187,39 +233,290 @@
|
|
|
|
|
|
self.textModelDescription.text = self.modeldescrip;
|
|
|
|
|
|
- NSString* alert =@"";
|
|
|
- int count = [[self.alert_cadedate valueForKey:@"count"] intValue];
|
|
|
- for(int i=0;i<count;i++)
|
|
|
+// NSString* alert =@"";
|
|
|
+// int count = [[self.alert_cadedate valueForKey:@"count"] intValue];
|
|
|
+// for(int i=0;i<count;i++)
|
|
|
+// {
|
|
|
+// NSDictionary* val_json =[self.alert_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+// int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+// if(check==1)
|
|
|
+// {
|
|
|
+// alert = [alert stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(alert.length>0)
|
|
|
+// [self.buttonAlert setTitle:alert forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ [treeView setBackgroundColor: [UIColor whiteColor]];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
{
|
|
|
- NSDictionary* val_json =[self.alert_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
- int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
- if(check==1)
|
|
|
+
|
|
|
+ NSString* qty =@"";
|
|
|
+ int count = [[self.qty_cadedate valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
{
|
|
|
- alert = [alert stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
- break;
|
|
|
+ NSDictionary* val_json =[self.qty_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ qty = [qty stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ if(qty.length>0)
|
|
|
+ [self.buttonQTY setTitle:qty forState:UIControlStateNormal];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if(alert.length>0)
|
|
|
- [self.buttonAlert setTitle:alert forState:UIControlStateNormal];
|
|
|
-
|
|
|
- [treeView setBackgroundColor: [UIColor whiteColor]];
|
|
|
-
|
|
|
|
|
|
- self.treeView.layer.shadowPath =[UIBezierPath bezierPathWithRect:self.treeView.bounds].CGPath;
|
|
|
- self.treeView.layer.masksToBounds = false;
|
|
|
- //添加四个边阴影
|
|
|
+ {
|
|
|
+
|
|
|
+ NSString* price =@"";
|
|
|
+ int count = [[self.price_cadedate valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[self.price_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ price = [price stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(price.length>0)
|
|
|
+ [self.buttonPrice setTitle:price forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+
|
|
|
+ NSString* availiablity =@"";
|
|
|
+ int count = [[self.availability_cadedate valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[self.availability_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ availiablity = [availiablity stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(availiablity.length>0)
|
|
|
+ [self.buttonAvailability setTitle:availiablity forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ NSString* alert =@"";
|
|
|
+ int count = [[self.alert_cadedate valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[self.alert_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ alert = [alert stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(alert.length>0)
|
|
|
+ [self.buttonAlert setTitle:alert forState:UIControlStateNormal];
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- self.treeView.layer.shadowColor = [UIColor blackColor].CGColor;
|
|
|
- self.treeView.layer.shadowOffset = CGSizeMake(0, 0);
|
|
|
- self.treeView.layer.shadowOpacity = 0.5;
|
|
|
- self.treeView.layer.shadowRadius = 2.0;
|
|
|
+ {
|
|
|
+ NSString* bestseller =@"";
|
|
|
+ int count = [[self.bestseller_cadedate valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[self.bestseller_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ bestseller = [bestseller stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(bestseller.length>0)
|
|
|
+ [self.buttonBestSeller setTitle:bestseller forState:UIControlStateNormal];
|
|
|
+ }
|
|
|
+
|
|
|
+ self.treeView.layer.borderColor=[UIColor lightGrayColor].CGColor;
|
|
|
+ self.treeView.layer.borderWidth = 0.5;
|
|
|
+
|
|
|
+// self.treeView.layer.shadowPath =[UIBezierPath bezierPathWithRect:self.treeView.bounds].CGPath;
|
|
|
+// self.treeView.layer.masksToBounds = false;
|
|
|
+// //添加四个边阴影
|
|
|
+//
|
|
|
+// self.treeView.layer.shadowColor = [UIColor blackColor].CGColor;
|
|
|
+// self.treeView.layer.shadowOffset = CGSizeMake(0, 0);
|
|
|
+// self.treeView.layer.shadowOpacity = 0.5;
|
|
|
+// self.treeView.layer.shadowRadius = 2.0;
|
|
|
|
|
|
// Do any additional setup after loading the view.
|
|
|
}
|
|
|
- (IBAction)onCloseClick:(id)sender {
|
|
|
[self dismissViewControllerAnimated:true completion:nil];
|
|
|
}
|
|
|
+
|
|
|
+- (IBAction)onAvailabilityClick:(id)sender {
|
|
|
+ EnumSelectViewController* enumvc =[ self.storyboard instantiateViewControllerWithIdentifier:@"EnumSelectorViewController"];
|
|
|
+ // enumvc.delegate = self;
|
|
|
+ enumvc.max_select = 1;
|
|
|
+ //enumvc.updatePosition = indexPath;
|
|
|
+ // if([[required lowercaseString] isEqualToString:@"true"])
|
|
|
+ // enumvc.canbeEmpty = false;
|
|
|
+ // else
|
|
|
+ // enumvc.canbeEmpty =true;
|
|
|
+ enumvc.cadedate = [self.availability_cadedate mutableCopy];
|
|
|
+ enumvc.title = @"";
|
|
|
+ // enumvc.value = [value_json mutableCopy];
|
|
|
+ enumvc.single_select =true;
|
|
|
+
|
|
|
+
|
|
|
+ enumvc.returnValue = ^(NSMutableDictionary* value){
|
|
|
+ self.availability_cadedate = value;
|
|
|
+
|
|
|
+
|
|
|
+ NSString* available =@"";
|
|
|
+ int count = [[value valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[value objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ available = [available stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.buttonAvailability setTitle:available forState:UIControlStateNormal];
|
|
|
+ };
|
|
|
+
|
|
|
+ [self.navigationController pushViewController:enumvc animated:true];
|
|
|
+}
|
|
|
+
|
|
|
+- (IBAction)onBestSellerClick:(id)sender {
|
|
|
+ EnumSelectViewController* enumvc =[ self.storyboard instantiateViewControllerWithIdentifier:@"EnumSelectorViewController"];
|
|
|
+ // enumvc.delegate = self;
|
|
|
+ enumvc.max_select = 1;
|
|
|
+ //enumvc.updatePosition = indexPath;
|
|
|
+ // if([[required lowercaseString] isEqualToString:@"true"])
|
|
|
+ // enumvc.canbeEmpty = false;
|
|
|
+ // else
|
|
|
+ // enumvc.canbeEmpty =true;
|
|
|
+ enumvc.cadedate = [self.bestseller_cadedate mutableCopy];
|
|
|
+ enumvc.title = @"";
|
|
|
+ // enumvc.value = [value_json mutableCopy];
|
|
|
+ enumvc.single_select =true;
|
|
|
+
|
|
|
+
|
|
|
+ enumvc.returnValue = ^(NSMutableDictionary* value){
|
|
|
+ self.bestseller_cadedate = value;
|
|
|
+
|
|
|
+
|
|
|
+ NSString* qty =@"";
|
|
|
+ int count = [[value valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[value objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ qty = [qty stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.buttonBestSeller setTitle:qty forState:UIControlStateNormal];
|
|
|
+ };
|
|
|
+
|
|
|
+ [self.navigationController pushViewController:enumvc animated:true];
|
|
|
+}
|
|
|
+
|
|
|
+- (IBAction)onQTYClick:(id)sender {
|
|
|
+ EnumSelectViewController* enumvc =[ self.storyboard instantiateViewControllerWithIdentifier:@"EnumSelectorViewController"];
|
|
|
+ // enumvc.delegate = self;
|
|
|
+ enumvc.max_select = 1;
|
|
|
+ //enumvc.updatePosition = indexPath;
|
|
|
+ // if([[required lowercaseString] isEqualToString:@"true"])
|
|
|
+ // enumvc.canbeEmpty = false;
|
|
|
+ // else
|
|
|
+ // enumvc.canbeEmpty =true;
|
|
|
+ enumvc.cadedate = [self.qty_cadedate mutableCopy];
|
|
|
+ enumvc.title = @"";
|
|
|
+ // enumvc.value = [value_json mutableCopy];
|
|
|
+ enumvc.single_select =true;
|
|
|
+
|
|
|
+
|
|
|
+ enumvc.returnValue = ^(NSMutableDictionary* value){
|
|
|
+ self.qty_cadedate = value;
|
|
|
+
|
|
|
+
|
|
|
+ NSString* qty =@"";
|
|
|
+ int count = [[value valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[value objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ qty = [qty stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.buttonQTY setTitle:qty forState:UIControlStateNormal];
|
|
|
+ };
|
|
|
+
|
|
|
+ [self.navigationController pushViewController:enumvc animated:true];
|
|
|
+}
|
|
|
+- (IBAction)onPriceClick:(id)sender {
|
|
|
+ EnumSelectViewController* enumvc =[ self.storyboard instantiateViewControllerWithIdentifier:@"EnumSelectorViewController"];
|
|
|
+ // enumvc.delegate = self;
|
|
|
+ enumvc.max_select = 1;
|
|
|
+ //enumvc.updatePosition = indexPath;
|
|
|
+ // if([[required lowercaseString] isEqualToString:@"true"])
|
|
|
+ // enumvc.canbeEmpty = false;
|
|
|
+ // else
|
|
|
+ // enumvc.canbeEmpty =true;
|
|
|
+ enumvc.cadedate = [self.price_cadedate mutableCopy];
|
|
|
+ enumvc.title = @"";
|
|
|
+ // enumvc.value = [value_json mutableCopy];
|
|
|
+ enumvc.single_select =true;
|
|
|
+
|
|
|
+
|
|
|
+ enumvc.returnValue = ^(NSMutableDictionary* value){
|
|
|
+ self.price_cadedate = value;
|
|
|
+
|
|
|
+
|
|
|
+ NSString* price =@"";
|
|
|
+ int count = [[value valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[value objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ price = [price stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.buttonPrice setTitle:price forState:UIControlStateNormal];
|
|
|
+ };
|
|
|
+
|
|
|
+ [self.navigationController pushViewController:enumvc animated:true];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
- (IBAction)onAlertClick:(id)sender {
|
|
|
|
|
|
|
|
|
@@ -240,7 +537,26 @@
|
|
|
enumvc.title = @"Alert";
|
|
|
// enumvc.value = [value_json mutableCopy];
|
|
|
enumvc.single_select =true;
|
|
|
-
|
|
|
+ enumvc.returnValue = ^(NSMutableDictionary* value){
|
|
|
+ self.alert_cadedate = value;
|
|
|
+
|
|
|
+
|
|
|
+ NSString* alert =@"";
|
|
|
+ int count = [[value valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[value objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ alert = [alert stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.buttonAlert setTitle:alert forState:UIControlStateNormal];
|
|
|
+ };
|
|
|
+
|
|
|
[self.navigationController pushViewController:enumvc animated:true];
|
|
|
|
|
|
}
|
|
|
@@ -281,6 +597,8 @@
|
|
|
|
|
|
- (BOOL)treeView:(RATreeView *)treeView shouldItemBeExpandedAfterDataReload:(id)item treeDepthLevel:(NSInteger)treeDepthLevel
|
|
|
{
|
|
|
+ if([item[@"check"] intValue]==1)
|
|
|
+ return YES;
|
|
|
// if ([item isEqual:self.expanded]) {
|
|
|
// return YES;
|
|
|
// }
|
|
|
@@ -415,29 +733,29 @@
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
-#pragma mark EnumSelectViewControllerDelegate
|
|
|
--(void) EnumValueChanged:(NSMutableDictionary *)value indexPath :(NSIndexPath*) indexPath
|
|
|
-{
|
|
|
-
|
|
|
-
|
|
|
- self.alert_cadedate = value;
|
|
|
-
|
|
|
-
|
|
|
- NSString* alert =@"";
|
|
|
- int count = [[value valueForKey:@"count"] intValue];
|
|
|
- for(int i=0;i<count;i++)
|
|
|
- {
|
|
|
- NSDictionary* val_json =[value objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
- int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
- if(check==1)
|
|
|
- {
|
|
|
- alert = [alert stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- [self.buttonAlert setTitle:alert forState:UIControlStateNormal];
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+//#pragma mark EnumSelectViewControllerDelegate
|
|
|
+//-(void) EnumValueChanged:(NSMutableDictionary *)value indexPath :(NSIndexPath*) indexPath
|
|
|
+//{
|
|
|
+//
|
|
|
+//
|
|
|
+// self.alert_cadedate = value;
|
|
|
+//
|
|
|
+//
|
|
|
+// NSString* alert =@"";
|
|
|
+// int count = [[value valueForKey:@"count"] intValue];
|
|
|
+// for(int i=0;i<count;i++)
|
|
|
+// {
|
|
|
+// NSDictionary* val_json =[value objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+// int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+// if(check==1)
|
|
|
+// {
|
|
|
+// alert = [alert stringByAppendingString:[val_json valueForKey:@"value"]];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// [self.buttonAlert setTitle:alert forState:UIControlStateNormal];
|
|
|
+//
|
|
|
+//
|
|
|
+//}
|
|
|
@end
|