|
|
@@ -21,6 +21,8 @@
|
|
|
#import "DatePickerViewController.h"
|
|
|
|
|
|
#import "RAUtils.h"
|
|
|
+#import "AppDelegate.h"
|
|
|
+
|
|
|
|
|
|
typedef enum {
|
|
|
ScreenOrientationUnknown = 0,
|
|
|
@@ -292,10 +294,10 @@ typedef enum {
|
|
|
return;
|
|
|
// return;
|
|
|
[self clearControlView]; // fill all时未显示。
|
|
|
- int count = [self.controlTemplate[@"count"] intValue];
|
|
|
+ int count = [self.page_controlTemplate[@"count"] intValue];
|
|
|
for(int i=0;i<count;i++)
|
|
|
{
|
|
|
- NSMutableDictionary * control =self.controlTemplate [[NSString stringWithFormat:@"control_%d",i] ];
|
|
|
+ NSMutableDictionary * control =self.page_controlTemplate [[NSString stringWithFormat:@"control_%d",i] ];
|
|
|
if([control[@"type"] isEqualToString:@"TextView"])
|
|
|
{
|
|
|
[self addTextView:control destView:self.editControlView index:i];
|
|
|
@@ -335,11 +337,11 @@ typedef enum {
|
|
|
}
|
|
|
-(void) refreshControl
|
|
|
{
|
|
|
- int count = [self.controlTemplate[@"count"] intValue];
|
|
|
+ int count = [self.page_controlTemplate[@"count"] intValue];
|
|
|
for(int i=0;i<count;i++)
|
|
|
{
|
|
|
NSString* controlname =[NSString stringWithFormat:@"control_%d",i];
|
|
|
- NSMutableDictionary * control =self.controlTemplate [ controlname];
|
|
|
+ NSMutableDictionary * control =self.page_controlTemplate [ controlname];
|
|
|
|
|
|
|
|
|
// if([control[@"type"] isEqualToString:@"TextView"])
|
|
|
@@ -439,9 +441,11 @@ typedef enum {
|
|
|
{
|
|
|
if([condition isEqualToString:@"true"])
|
|
|
return true;
|
|
|
+ if([condition isEqualToString:@"false"])
|
|
|
+ return false;
|
|
|
if([condition isEqualToString:@"control_18:[value]==0"])
|
|
|
{
|
|
|
- NSArray* arr= self.controlTemplate[@"control_18"][@"value"];
|
|
|
+ NSArray* arr= self.page_controlTemplate[@"control_18"][@"value"];
|
|
|
if(arr.count==0)
|
|
|
return false;
|
|
|
else
|
|
|
@@ -465,10 +469,10 @@ typedef enum {
|
|
|
|
|
|
|
|
|
|
|
|
- int count = [self.controlTemplate[@"count"] intValue];
|
|
|
+ int count = [self.page_controlTemplate[@"count"] intValue];
|
|
|
for(long i=index+1;i<count;i++)
|
|
|
{
|
|
|
- NSMutableDictionary * control =self.controlTemplate [[NSString stringWithFormat:@"control_%ld",i] ];
|
|
|
+ NSMutableDictionary * control =self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",i] ];
|
|
|
if(![control[@"type"] isEqualToString:@"TextView"])
|
|
|
{
|
|
|
continue;
|
|
|
@@ -698,7 +702,7 @@ typedef enum {
|
|
|
[destView addSubview:btn];
|
|
|
NSArray* cadedate = template[@"cadedate"];
|
|
|
|
|
|
- NSArray* checkedData = self.controlTemplate [[NSString stringWithFormat:@"control_%d",index] ][@"value"];
|
|
|
+ NSArray* checkedData = self.page_controlTemplate [[NSString stringWithFormat:@"control_%d",index] ][@"value"];
|
|
|
float fontsize = [template[@"size"] floatValue];
|
|
|
if(fontsize==0)
|
|
|
fontsize=10;
|
|
|
@@ -772,6 +776,17 @@ typedef enum {
|
|
|
btn.image = image;
|
|
|
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if([template[@"disable"] boolValue]&& [template[@"required"] boolValue])
|
|
|
+ {
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+ UIImage* img = [UIImage imageNamed:@"na"];
|
|
|
+ btn.image = img;
|
|
|
+ template[@"value"]=appDelegate.na_path;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
btn.backgroundColor = UIColorFromRGB(SIG_BG);
|
|
|
@@ -854,6 +869,12 @@ typedef enum {
|
|
|
|
|
|
long index = sender.tag - CONTROL_BASE;
|
|
|
|
|
|
+
|
|
|
+ if([self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"disable"] boolValue] )
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
__weak __typeof(self)weakSelf = self;
|
|
|
NSDateFormatter * formatter = [[NSDateFormatter alloc]init];
|
|
|
[formatter setDateFormat:@"MM/dd/yyyy"];
|
|
|
@@ -881,8 +902,8 @@ typedef enum {
|
|
|
|
|
|
[sender setTitle:strdate forState:UIControlStateNormal];
|
|
|
|
|
|
- weakSelf.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = strdate;
|
|
|
- weakSelf.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"]=[NSNumber numberWithBool:true];
|
|
|
+ weakSelf.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = strdate;
|
|
|
+ weakSelf.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"]=[NSNumber numberWithBool:true];
|
|
|
};
|
|
|
dpvc.title=@"Please choose a date";
|
|
|
[self.navigationController pushViewController:dpvc animated:true];
|
|
|
@@ -901,10 +922,10 @@ typedef enum {
|
|
|
long index = sender.tag - CONTROL_BASE;
|
|
|
|
|
|
|
|
|
- bool single_select = [self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"single_select"] boolValue];
|
|
|
- bool show_detail = [self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"show_detail"] boolValue];
|
|
|
- NSArray* rowData = self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"cadedate"];
|
|
|
- NSArray* checkedData = self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"];
|
|
|
+ bool single_select = [self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"single_select"] boolValue];
|
|
|
+ bool show_detail = [self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"show_detail"] boolValue];
|
|
|
+ NSArray* rowData = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"cadedate"];
|
|
|
+ NSArray* checkedData = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"];
|
|
|
CheckSelectorViewController *checkVC = [ [UIStoryboard storyboardWithName:@"signature" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"CheckSelectorViewController"];
|
|
|
|
|
|
checkVC.blk_OK = ^(NSArray* checkedData){
|
|
|
@@ -920,115 +941,189 @@ typedef enum {
|
|
|
|
|
|
NSArray* item = rowData[i];
|
|
|
NSArray* checkmarker = item[1];
|
|
|
+
|
|
|
+ // checkmarker 不显示,则显示选项内容文字。
|
|
|
if(checkmarker.count==0)
|
|
|
{
|
|
|
sender.backgroundColor = UIColorFromRGB(CK_BG);
|
|
|
+
|
|
|
if([checkedData containsObject:[NSNumber numberWithLong:i]])
|
|
|
{
|
|
|
[sender setTitle:item[0][0] forState:UIControlStateNormal];
|
|
|
- if(item.count>=3)
|
|
|
+ }
|
|
|
+// continue;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [sender setTitle:@"" forState:UIControlStateNormal];
|
|
|
+ if([checkedData containsObject:[NSNumber numberWithLong:i]])
|
|
|
+ {
|
|
|
+ // [checkedData removeObject:[NSNumber numberWithLong:indexPath.row]];
|
|
|
+
|
|
|
+ [sender.superview viewWithTag:tag].backgroundColor= [UIColor blackColor];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // [self.checkedData addObject:[NSNumber numberWithLong:indexPath.row] ];
|
|
|
+ [sender.superview viewWithTag:tag].backgroundColor= [UIColor clearColor];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ bool checked =[checkedData containsObject:[NSNumber numberWithLong:i]];
|
|
|
+ if(item.count>=3) // 模板有action项
|
|
|
+ {
|
|
|
+ //[sender setTitle:item[0][0] forState:UIControlStateNormal];
|
|
|
+ NSMutableDictionary* action = item[2];
|
|
|
+ if(checked)
|
|
|
+ {
|
|
|
+
|
|
|
+ NSArray* disable_arr = action[@"disable"] ;
|
|
|
+ for(int d = 0 ; d<disable_arr.count;d++)
|
|
|
{
|
|
|
- NSMutableDictionary* action = item[2];
|
|
|
- NSArray* disable_arr = action[@"disable"] ;
|
|
|
- for(int d = 0 ; d<disable_arr.count;d++)
|
|
|
- {
|
|
|
- self.controlTemplate [disable_arr[d] ] [@"disable"] = [NSNumber numberWithBool:true];
|
|
|
- NSString* s_idx =disable_arr[d];
|
|
|
- s_idx=[s_idx stringByReplacingOccurrencesOfString:@"control_" withString:@""];
|
|
|
- int d_idx = [s_idx intValue];
|
|
|
- ((UITextView*)[sender.superview viewWithTag:d_idx+CONTROL_BASE]).editable = false;
|
|
|
- }
|
|
|
- NSArray* enable_arr = action[@"enable"] ;
|
|
|
- for(int e = 0 ; e<enable_arr.count;e++)
|
|
|
- {
|
|
|
- self.controlTemplate [enable_arr[e] ] [@"disable"] = [NSNumber numberWithBool:false];
|
|
|
-
|
|
|
- NSString* s_idx =enable_arr[e];
|
|
|
- s_idx=[s_idx stringByReplacingOccurrencesOfString:@"control_" withString:@""];
|
|
|
- int d_idx = [s_idx intValue];
|
|
|
+ self.page_controlTemplate [disable_arr[d] ] [@"disable"] = [NSNumber numberWithBool:true];
|
|
|
+ NSString* s_idx =disable_arr[d];
|
|
|
+ s_idx=[s_idx stringByReplacingOccurrencesOfString:@"control_" withString:@""];
|
|
|
+ int d_idx = [s_idx intValue];
|
|
|
+ ((UITextView*)[sender.superview viewWithTag:d_idx+CONTROL_BASE]).editable = false;
|
|
|
+ }
|
|
|
+ NSArray* enable_arr = action[@"enable"] ;
|
|
|
+ for(int e = 0 ; e<enable_arr.count;e++)
|
|
|
+ {
|
|
|
+ self.page_controlTemplate [enable_arr[e] ] [@"disable"] = [NSNumber numberWithBool:false];
|
|
|
+
|
|
|
+ NSString* s_idx =enable_arr[e];
|
|
|
+ s_idx=[s_idx stringByReplacingOccurrencesOfString:@"control_" withString:@""];
|
|
|
+ int d_idx = [s_idx intValue];
|
|
|
+
|
|
|
+ ((UITextView*)[sender.superview viewWithTag:d_idx+CONTROL_BASE]).editable = true;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- ((UITextView*)[sender.superview viewWithTag:d_idx+CONTROL_BASE]).editable = true;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ NSMutableDictionary* json_setval=action[@"set_val"] ;
|
|
|
+ for(int i=0;i<[json_setval[@"count"] intValue];i++)
|
|
|
+ {
|
|
|
|
|
|
- NSMutableDictionary* json_setval=action[@"set_val"] ;
|
|
|
- for(int i=0;i<[json_setval[@"count"] intValue];i++)
|
|
|
+ NSMutableDictionary * control = json_setval [[NSString stringWithFormat:@"item_%d",i] ];
|
|
|
+ UITextView* tv = (UITextView*) [self findControl:control[@"control"]];
|
|
|
+ NSString* value = control[@"value"];
|
|
|
+
|
|
|
+ UITextView* tv6 = (UITextView*) [self findControl:@"control_10"];
|
|
|
+ NSString* text = tv6.text;
|
|
|
+ NSString* newvalue = nil;
|
|
|
+ if([value isEqualToString:@"*0.1"])
|
|
|
{
|
|
|
|
|
|
- NSMutableDictionary * control = json_setval [[NSString stringWithFormat:@"item_%d",i] ];
|
|
|
- UITextView* tv = (UITextView*) [self findControl:control[@"control"]];
|
|
|
- NSString* value = control[@"value"];
|
|
|
-
|
|
|
- UITextView* tv6 = (UITextView*) [self findControl:@"control_10"];
|
|
|
- NSString* text = tv6.text;
|
|
|
- NSString* newvalue = nil;
|
|
|
- if([value isEqualToString:@"*0.1"])
|
|
|
- {
|
|
|
-
|
|
|
- NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
- formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
- NSString* prefix_str= self.controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
- if(prefix_str.length==0)
|
|
|
- prefix_str = @"";
|
|
|
- text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
- double f = [[formatter numberFromString:text] doubleValue]*0.1;
|
|
|
- newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
-
|
|
|
- newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
-// float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.1;
|
|
|
-// newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
- self.controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
- self.controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
- }
|
|
|
- else if([value isEqualToString:@"*0.9"])
|
|
|
- {
|
|
|
-// float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
|
|
|
- NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
- formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
- NSString* prefix_str= self.controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
- if(prefix_str.length==0)
|
|
|
- prefix_str = @"";
|
|
|
- text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
- double f = [[formatter numberFromString:text] doubleValue]*0.9;
|
|
|
- newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
- newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
-// newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
- self.controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
- self.controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- tv.text = newvalue;
|
|
|
+ NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
+ formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
+ if(prefix_str.length==0)
|
|
|
+ prefix_str = @"";
|
|
|
+ text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
+ double f = [[formatter numberFromString:text] doubleValue]*0.1;
|
|
|
+ newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
|
|
|
+ newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
+ // float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.1;
|
|
|
+ // newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+ }
|
|
|
+ else if([value isEqualToString:@"*0.9"])
|
|
|
+ {
|
|
|
+ // float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
|
|
|
+ NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
+ formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
+ if(prefix_str.length==0)
|
|
|
+ prefix_str = @"";
|
|
|
+ text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
+ double f = [[formatter numberFromString:text] doubleValue]*0.9;
|
|
|
+ newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
+ newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
+ // newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ tv.text = newvalue;
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- continue;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [sender setTitle:@"" forState:UIControlStateNormal];
|
|
|
- }
|
|
|
-
|
|
|
- // UIView* v= sender;
|
|
|
- if([checkedData containsObject:[NSNumber numberWithLong:i]])
|
|
|
- {
|
|
|
- // [checkedData removeObject:[NSNumber numberWithLong:indexPath.row]];
|
|
|
|
|
|
- [sender.superview viewWithTag:tag].backgroundColor= [UIColor blackColor];
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // [self.checkedData addObject:[NSNumber numberWithLong:indexPath.row] ];
|
|
|
- [sender.superview viewWithTag:tag].backgroundColor= [UIColor clearColor];
|
|
|
+ NSMutableDictionary* json_cd=action[@"conditional_constraint"][checked?@"true":@"false"] ;
|
|
|
+ {
|
|
|
+ for(int i=0;i<[json_cd[@"count"] intValue];i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ NSMutableDictionary * destination = json_cd [[NSString stringWithFormat:@"item_%d",i] ];
|
|
|
+ int page = [destination[@"page"] intValue];
|
|
|
+ NSString* control = destination[@"control"];
|
|
|
+ self.doc_controlTemplate[[NSString stringWithFormat:@"page_%d",page]][control][@"disable"]=destination[@"disable"];
|
|
|
+ id value =destination[@"set_val"];
|
|
|
+ self.doc_controlTemplate[[NSString stringWithFormat:@"page_%d",page]][control][@"value"]=value;
|
|
|
+// UITextView* tv = (UITextView*) [self findControl:destination[@"control"]];
|
|
|
+// NSString* value = control[@"value"];
|
|
|
+//
|
|
|
+// UITextView* tv6 = (UITextView*) [self findControl:@"control_10"];
|
|
|
+// NSString* text = tv6.text;
|
|
|
+// NSString* newvalue = nil;
|
|
|
+// if([value isEqualToString:@"*0.1"])
|
|
|
+// {
|
|
|
+//
|
|
|
+// NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
+// formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
+// NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
+// if(prefix_str.length==0)
|
|
|
+// prefix_str = @"";
|
|
|
+// text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
+// double f = [[formatter numberFromString:text] doubleValue]*0.1;
|
|
|
+// newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
+//
|
|
|
+// newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
+// // float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.1;
|
|
|
+// // newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
+// self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+// self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+// }
|
|
|
+// else if([value isEqualToString:@"*0.9"])
|
|
|
+// {
|
|
|
+// // float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
|
|
|
+// NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
+// formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
+// NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
+// if(prefix_str.length==0)
|
|
|
+// prefix_str = @"";
|
|
|
+// text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
+// double f = [[formatter numberFromString:text] doubleValue]*0.9;
|
|
|
+// newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
+// newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
+// // newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
+// self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+// self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// tv.text = newvalue;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ // UIView* v= sender;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
- self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"]=checkedData;
|
|
|
+ self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"]=checkedData;
|
|
|
|
|
|
- self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+ self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
};
|
|
|
checkVC.rowData = rowData;
|
|
|
checkVC.checkedData = [checkedData mutableCopy];
|
|
|
@@ -1064,7 +1159,7 @@ typedef enum {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- NSString* tv_format=self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"format"];
|
|
|
+ NSString* tv_format=self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"format"];
|
|
|
if([tv_format isEqualToString:@"us_tel"])
|
|
|
{
|
|
|
NSMutableString *newString = [[textView.text stringByReplacingCharactersInRange:range withString:text] mutableCopy];
|
|
|
@@ -1172,7 +1267,7 @@ typedef enum {
|
|
|
|
|
|
bool canChange=true;
|
|
|
|
|
|
- int max_line = [self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"lines"] intValue];
|
|
|
+ int max_line = [self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"lines"] intValue];
|
|
|
if(max_line==0)//默认只能有一行
|
|
|
max_line=1;
|
|
|
long linecount=[TextUtils countOccurencesOfString:oldtext find:@"\n"];
|
|
|
@@ -1185,7 +1280,7 @@ typedef enum {
|
|
|
}
|
|
|
|
|
|
|
|
|
- int lenth = [self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"length"] intValue];
|
|
|
+ int lenth = [self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"length"] intValue];
|
|
|
if(lenth==0)
|
|
|
return canChange;
|
|
|
else
|
|
|
@@ -1205,11 +1300,11 @@ typedef enum {
|
|
|
- (void)textViewDidBeginEditing:(UITextView *)textView
|
|
|
{
|
|
|
long index = textView.tag - CONTROL_BASE;
|
|
|
- NSString* tv_format=self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"format"];
|
|
|
+ NSString* tv_format=self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"format"];
|
|
|
if([tv_format isEqualToString:@"price"])
|
|
|
{
|
|
|
|
|
|
- NSString* prefix_str= self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
if(prefix_str.length==0)
|
|
|
prefix_str = @"";
|
|
|
|
|
|
@@ -1243,6 +1338,20 @@ typedef enum {
|
|
|
|
|
|
NSLog(@"textViewShouldBeginEditing");
|
|
|
|
|
|
+
|
|
|
+// long index = textView.tag - CONTROL_BASE;
|
|
|
+//
|
|
|
+//
|
|
|
+// NSMutableDictionary* control_json = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
+//
|
|
|
+// if([control_json[@"disable"] boolValue] )
|
|
|
+// {
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+//
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
self.hotTextView = textView;//(UITableViewCell*)textView.superview.superview;
|
|
|
|
|
|
|
|
|
@@ -1261,12 +1370,12 @@ typedef enum {
|
|
|
|
|
|
|
|
|
//处理 prefix 和 浮点格式化
|
|
|
- NSString* prefix_str= self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
if(prefix_str.length==0)
|
|
|
prefix_str = @"";
|
|
|
NSString* text =textView.text;// [textView.text stringByReplacingOccurrencesOfString:prefix_str withString:@""];
|
|
|
|
|
|
- NSString* value_type= self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value_type"];
|
|
|
+ NSString* value_type= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value_type"];
|
|
|
if([value_type isEqualToString:@"float"])
|
|
|
text=[NSString stringWithFormat:@"%.2f",[text doubleValue] ];
|
|
|
|
|
|
@@ -1276,7 +1385,7 @@ typedef enum {
|
|
|
|
|
|
|
|
|
|
|
|
- if([self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"format"] isEqualToString:@"price"])
|
|
|
+ if([self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"format"] isEqualToString:@"price"])
|
|
|
{
|
|
|
text =textView.text;
|
|
|
|
|
|
@@ -1299,9 +1408,9 @@ typedef enum {
|
|
|
|
|
|
if(text==nil)
|
|
|
text=@"";
|
|
|
- self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = text;
|
|
|
- self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
- NSDictionary* action = self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"action"];
|
|
|
+ self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = text;
|
|
|
+ self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
+ NSDictionary* action = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"action"];
|
|
|
NSArray* keys=[action allKeys];
|
|
|
for(int k=0;k<keys.count;k++)
|
|
|
{
|
|
|
@@ -1324,7 +1433,7 @@ typedef enum {
|
|
|
NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
|
|
|
- NSString* prefix_str= self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
if(prefix_str.length==0)
|
|
|
prefix_str = @"";
|
|
|
|
|
|
@@ -1351,8 +1460,8 @@ typedef enum {
|
|
|
}
|
|
|
|
|
|
|
|
|
- self.controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
- self.controlTemplate [control[@"control"] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
}
|
|
|
else if([value isEqualToString:@"*0.9"])
|
|
|
{
|
|
|
@@ -1360,7 +1469,7 @@ typedef enum {
|
|
|
NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
|
|
|
- NSString* prefix_str= self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
if(prefix_str.length==0)
|
|
|
prefix_str = @"";
|
|
|
|
|
|
@@ -1376,8 +1485,8 @@ typedef enum {
|
|
|
newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
}
|
|
|
// newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
- self.controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
- self.controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
|
|
|
}
|
|
|
else if([value isEqualToString:@"control_6-control_7"])
|
|
|
@@ -1393,7 +1502,7 @@ typedef enum {
|
|
|
NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
|
|
|
- NSString* prefix_str= self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
|
|
|
if(prefix_str.length==0)
|
|
|
prefix_str = @"";
|
|
|
NSString * text6=[tv6.text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
@@ -1407,8 +1516,8 @@ typedef enum {
|
|
|
newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f6-f7]];
|
|
|
newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
// newvalue = [NSString stringWithFormat:@"$ %.2f",f6-f7];
|
|
|
- self.controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
- self.controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
}
|
|
|
|
|
|
tv.text = newvalue;
|
|
|
@@ -1444,7 +1553,7 @@ typedef enum {
|
|
|
long index = touchImageView.tag - CONTROL_BASE;
|
|
|
|
|
|
|
|
|
- NSMutableDictionary* control_json = self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
+ NSMutableDictionary* control_json = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
|
|
|
|
|
|
// CGRect cellrect_screen = [RAUtils relativeFrameForScreenWithView:trigger];
|
|
|
@@ -1478,8 +1587,8 @@ typedef enum {
|
|
|
touchImageView.image = image;
|
|
|
|
|
|
long index = touchImageView.tag - CONTROL_BASE;
|
|
|
- weakSelf.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = file;
|
|
|
- weakSelf.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+ weakSelf.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = file;
|
|
|
+ weakSelf.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
}
|
|
|
|
|
|
};
|
|
|
@@ -1535,8 +1644,8 @@ typedef enum {
|
|
|
{
|
|
|
NSString* file=[PDFUtils addSignature:signimg to:self.signatureData subType:control_json[@"name"]];
|
|
|
long index = touchImageView.tag - CONTROL_BASE;
|
|
|
- self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = file;
|
|
|
- self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
+ self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = file;
|
|
|
+ self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
|
|
|
touchImageView.image = signimg;
|
|
|
}
|
|
|
@@ -1576,6 +1685,17 @@ typedef enum {
|
|
|
}
|
|
|
- (void) TouchImageViewOnLongPress:(TouchImageView *)touchImageView
|
|
|
{
|
|
|
+
|
|
|
+ long index = touchImageView.tag - CONTROL_BASE;
|
|
|
+
|
|
|
+
|
|
|
+ NSMutableDictionary* control_json = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
+
|
|
|
+ if([control_json[@"disable"] boolValue] )
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if(touchImageView.image!=nil)
|
|
|
{
|
|
|
NSLog(@"long press");
|
|
|
@@ -1616,8 +1736,8 @@ typedef enum {
|
|
|
}
|
|
|
// NSMutableDictionary* control_json = self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
|
|
|
- self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = @"";
|
|
|
- self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
+ self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = @"";
|
|
|
+ self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
}
|
|
|
- (void) touchImageModify:(id) sender
|
|
|
{
|
|
|
@@ -1636,8 +1756,14 @@ typedef enum {
|
|
|
long index = touchImageView.tag - CONTROL_BASE;
|
|
|
|
|
|
|
|
|
- NSMutableDictionary* control_json = self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
+ NSMutableDictionary* control_json = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
|
|
|
+ if([control_json[@"disable"] boolValue] )
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
bool bvalidation=[control_json[@"required_validation"] boolValue];
|
|
|
NSString* pwd= control_json[@"validation_code"];
|
|
|
if(bvalidation&& pwd.length>0)
|