|
@@ -0,0 +1,397 @@
|
|
|
|
|
+//
|
|
|
|
|
+// CategoryFilterViewController.m
|
|
|
|
|
+// iSales-NPD
|
|
|
|
|
+//
|
|
|
|
|
+// Created by Ray on 3/4/16.
|
|
|
|
|
+// Copyright © 2016 United Software Applications, Inc. All rights reserved.
|
|
|
|
|
+//
|
|
|
|
|
+
|
|
|
|
|
+#import "CategorySearchFilterViewController.h"
|
|
|
|
|
+
|
|
|
|
|
+@interface CategorySearchFilterViewController ()
|
|
|
|
|
+
|
|
|
|
|
+@end
|
|
|
|
|
+
|
|
|
|
|
+@implementation CategorySearchFilterViewController
|
|
|
|
|
+
|
|
|
|
|
+- (void)viewDidLoad {
|
|
|
|
|
+ [super viewDidLoad];
|
|
|
|
|
+
|
|
|
|
|
+ UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"close"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
|
|
|
|
|
+ style:UIBarButtonItemStylePlain
|
|
|
|
|
+ target:self
|
|
|
|
|
+ action:@selector( onCloseClick:)];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ self.navigationItem.rightBarButtonItem = closeButton;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ self.edgesForExtendedLayout = UIRectEdgeNone;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ NSString* qty =@"";
|
|
|
|
|
+ int count = [[self.alert_cadedate valueForKey:@"count"] intValue];
|
|
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ 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];
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ 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];
|
|
|
|
|
+ }
|
|
|
|
|
+ // Do any additional setup after loading the view.
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)didReceiveMemoryWarning {
|
|
|
|
|
+ [super didReceiveMemoryWarning];
|
|
|
|
|
+ // Dispose of any resources that can be recreated.
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/*
|
|
|
|
|
+ #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.
|
|
|
|
|
+ }
|
|
|
|
|
+ */
|
|
|
|
|
+- (IBAction)onResetClick:(id)sender {
|
|
|
|
|
+
|
|
|
|
|
+ if(self.ResetClick)
|
|
|
|
|
+ self.ResetClick();
|
|
|
|
|
+ [self dismissViewControllerAnimated:true completion:nil];
|
|
|
|
|
+}
|
|
|
|
|
+- (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 = @"Select";
|
|
|
|
|
+ // 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)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 = @"Select";
|
|
|
|
|
+ // 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)onAlertClick:(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.alert_cadedate mutableCopy];
|
|
|
|
|
+ enumvc.title = @"Select";
|
|
|
|
|
+ // 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];
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+- (IBAction)onSearchClick:(id)sender {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSString* qty = [self.buttonQTY titleForState:UIControlStateNormal];
|
|
|
|
|
+ if(qty.length==0 || [qty isEqualToString:@"Click to select"])
|
|
|
|
|
+ qty = nil;
|
|
|
|
|
+
|
|
|
|
|
+ NSString* available = [self.buttonAvailability titleForState:UIControlStateNormal];
|
|
|
|
|
+ if(available.length==0 || [available isEqualToString:@"Click to select"])
|
|
|
|
|
+ available = nil;
|
|
|
|
|
+
|
|
|
|
|
+ NSString* alert = [self.buttonAlert titleForState:UIControlStateNormal];
|
|
|
|
|
+ if(alert.length==0 || [alert isEqualToString:@"Click to select"])
|
|
|
|
|
+ alert = nil;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if(self.OkClick)
|
|
|
|
|
+ self.OkClick( available, qty, alert);
|
|
|
|
|
+ [self dismissViewControllerAnimated:true completion:nil];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+//
|
|
|
|
|
+//#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];
|
|
|
|
|
+//
|
|
|
|
|
+// // UITableViewCell *cell = [self.editorTable cellForRowAtIndexPath:indexPath];
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // // if(/*self.cancommit==false &&*/ string.length==0 && (textField.text.length<=1|| textField.text==nil))
|
|
|
|
|
+// // // {
|
|
|
|
|
+// // // CALayer *layer = [cell.contentView layer];
|
|
|
|
|
+// // // // layer.borderColor = [[UIColor redColor] CGColor];
|
|
|
|
|
+// // // // layer.borderWidth = 1.0;
|
|
|
|
|
+// // //
|
|
|
|
|
+// // // layer.shadowColor = [UIColor redColor].CGColor;
|
|
|
|
|
+// // // layer.shadowOffset = CGSizeMake(0, 0);
|
|
|
|
|
+// // // layer.shadowOpacity = 1;
|
|
|
|
|
+// // // layer.shadowRadius = 2.0;
|
|
|
|
|
+// // // }
|
|
|
|
|
+// // // else
|
|
|
|
|
+// // {
|
|
|
|
|
+// // CALayer *layer = [cell.contentView layer];
|
|
|
|
|
+// // // layer.borderColor = [[UIColor redColor] CGColor];
|
|
|
|
|
+// // // layer.borderWidth = 1.0;
|
|
|
|
|
+// //
|
|
|
|
|
+// // layer.shadowColor = [UIColor clearColor].CGColor;
|
|
|
|
|
+// // layer.shadowOffset = CGSizeMake(0, 0);
|
|
|
|
|
+// // layer.shadowOpacity = 1;
|
|
|
|
|
+// // layer.shadowRadius = 2.0;
|
|
|
|
|
+// // }
|
|
|
|
|
+// //
|
|
|
|
|
+// // NSLog(@"enum changed %ld_%ld",(long)indexPath.section,(long)indexPath.row);
|
|
|
|
|
+// //
|
|
|
|
|
+// // NSMutableDictionary* section_json=nil;
|
|
|
|
|
+// //
|
|
|
|
|
+// // NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // // NSString* param_name=[item_json valueForKey:@"name"];
|
|
|
|
|
+// // // NSString* param_val=nil;
|
|
|
|
|
+// // //
|
|
|
|
|
+// // // bool single_select =[[item_json valueForKey:@"single_select"] boolValue];
|
|
|
|
|
+// // //
|
|
|
|
|
+// // // int cade_count = [[value valueForKey:@"count"] intValue];
|
|
|
|
|
+// // //
|
|
|
|
|
+// // // NSMutableArray* arr_val = [[NSMutableArray alloc] init];
|
|
|
|
|
+// // //
|
|
|
|
|
+// // //
|
|
|
|
|
+// // // for(int cc=0;cc<cade_count;cc++)
|
|
|
|
|
+// // // {
|
|
|
|
|
+// // // NSDictionary * valjson=[value objectForKey:[NSString stringWithFormat:@"val_%d",cc ]];
|
|
|
|
|
+// // // if([[valjson valueForKey:@"check"] boolValue])
|
|
|
|
|
+// // // {
|
|
|
|
|
+// // // [arr_val addObject: [valjson valueForKey:@"value_id"]];
|
|
|
|
|
+// // // if(single_select)
|
|
|
|
|
+// // // break;
|
|
|
|
|
+// // // }
|
|
|
|
|
+// // //
|
|
|
|
|
+// // // }
|
|
|
|
|
+// // //
|
|
|
|
|
+// // // param_val = [arr_val componentsJoinedByString:@","];
|
|
|
|
|
+// // //
|
|
|
|
|
+// // // [self.changed_data setObject:param_val forKey:param_name];
|
|
|
|
|
+// //
|
|
|
|
|
+// // int refresh = [[item_json valueForKey:@"refresh"] intValue];
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // NSString* subid=[item_json valueForKey:@"subid"];
|
|
|
|
|
+// //
|
|
|
|
|
+// // [item_json setObject:value forKey:@"cadedate"];
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // if(subid==nil)
|
|
|
|
|
+// // {
|
|
|
|
|
+// // [item_json setValue:@"true" forKey:@"dirty"];
|
|
|
|
|
+// // section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
|
|
|
|
|
+// // int count=0;
|
|
|
|
|
+// //
|
|
|
|
|
+// // count=[[section_json valueForKey:@"count"] intValue];
|
|
|
|
|
+// //
|
|
|
|
|
+// // for(int i=0;i<count;i++)
|
|
|
|
|
+// // {
|
|
|
|
|
+// // NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",i ]];
|
|
|
|
|
+// // if([[olditem valueForKey:@"name"] isEqualToString:[item_json valueForKey:@"name" ]])
|
|
|
|
|
+// // [section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%d",i ]];
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // }
|
|
|
|
|
+// // }
|
|
|
|
|
+// // else
|
|
|
|
|
+// // {
|
|
|
|
|
+// // NSArray* idarr=[subid componentsSeparatedByString:@"_"];
|
|
|
|
|
+// // int section = [(NSString*)idarr[0] intValue];
|
|
|
|
|
+// // int item=[(NSString*)idarr[1] intValue];
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d", section]] mutableCopy];
|
|
|
|
|
+// // NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",item ]];
|
|
|
|
|
+// // item_json= [self enum_subitem_changed:[olditem mutableCopy] subid:idarr value:item_json step:2];
|
|
|
|
|
+// // [item_json setValue:@"true" forKey:@"dirty"];
|
|
|
|
|
+// // [section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%d",item ]];
|
|
|
|
|
+// //
|
|
|
|
|
+// // }
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // // [section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row ]];
|
|
|
|
|
+// //
|
|
|
|
|
+// // [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
|
|
|
|
|
+// //
|
|
|
|
|
+// // self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // if(refresh==1)
|
|
|
|
|
+// // {
|
|
|
|
|
+// // [self refresh] ;
|
|
|
|
|
+// // return ;
|
|
|
|
|
+// // }
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // NSLog(@"CONTENT UPDATE:%@",[iSalesNetwork DataTOjsonString:self.content_data_download]);
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// //
|
|
|
|
|
+// // // NSLog(@"CONTENT translate:%@",[iSalesNetwork DataTOjsonString:self.content_data]);
|
|
|
|
|
+// // [self.editorTable reloadData ];
|
|
|
|
|
+//
|
|
|
|
|
+//}
|
|
|
|
|
+@end
|