//
//  CommonEditorViewController.h
//  RedAnt ERP Mobile
//
//  Created by Ray on 14-7-16.
//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "SignatureViewController.h"
#import "EnumSelectViewController.h"
#import "MonthPickerViewController.h"
#import "JKTimerManager.h"

@interface subitem_data : NSObject
@property (strong, nonatomic) NSMutableDictionary *params;
@property (strong,nonatomic) NSMutableArray * missingfields;
@end


@class CommonEditorViewController;
@protocol CommonEditorViewControllerDelegate <NSObject>

-(void) returnValue:(NSMutableDictionary *)value indexPath :(NSIndexPath*) indexPath;

@end

@interface CommonEditorViewController : UIViewController<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,MonthPickerViewControllerDelegate/*,SignatureViewControllerDelegate*/,EnumSelectViewControllerDelegate,CommonEditorViewControllerDelegate,UITextViewDelegate,UIAlertViewDelegate>
@property (strong,nonatomic) NSMutableDictionary* content_data_download;
@property (strong,nonatomic) NSMutableDictionary* changed_data;

@property (strong,nonatomic) NSMutableArray* content_data_control;
@property int url_type;
@property (strong,nonatomic) NSString* request_url;

//@property (strong,nonatomic) NSString* data_url;
//@property bool data_separate;
@property (strong,nonatomic) NSMutableDictionary* params;
@property (strong,nonatomic) NSString* item_ids;
@property (strong,nonatomic) NSString* product_ids;
@property (strong, nonatomic) IBOutlet UITableView *editorTable;

@property (nonatomic, weak) id<CommonEditorViewControllerDelegate> delegate;
@property (nonatomic , copy) void (^returnValue)(NSMutableDictionary* value);
@property (strong,nonatomic) UITextField* lastedit;
@property (strong,nonatomic) NSIndexPath* lastedit_from;
@property (strong,nonatomic) UITextView* lasttextview;
@property (strong,nonatomic) NSIndexPath* lasttextview_from;
@property (strong,nonatomic) UITableViewCell* editingcell;
@property bool cancommit;
@property bool resize;
@property int ioffset;
@property int keyboard_h;
@property (strong,nonatomic) NSMutableDictionary* requried;
//@property (strong,nonatomic) NSLock *switchlock ;

@property (strong,nonatomic) NSIndexPath* first_miss_pos;

//@property (strong,nonatomic) NSMutableDictionary* data_init;

-(void) prepareReturn:(NSMutableDictionary*) value;
-(NSMutableArray*) translate_json: (NSDictionary*) injson changed:(NSDictionary*) changed_value;
-(NSMutableDictionary*)create_cusromer_info_from_table;
@property (strong,nonatomic) NSIndexPath* from;
-(subitem_data*) subitem_param:(NSDictionary*) itemjson addto:(NSMutableDictionary*) upparam alert:(bool)alert;
-(NSMutableDictionary*) check_cancommit:(bool) alert;

-(NSString*) getValue:(NSString*)name;

@property bool keyboard_show;

//禁止下拉刷新
@property bool disable_dropdown_refresh;

@property (strong,nonatomic) NSString* loading_msg;
@property (strong,nonatomic) NSString* loading_title;
//-(NSMutableDictionary*) translate_json: (NSDictionary*) injson;


//control cell event;

@property (nonatomic,copy) NSString *class_name;
@property (nonatomic,assign) BOOL editable;

- (void)start_urgency_timer;
- (void)cancel_urgency_timer;
//URL_LOCAL 表单填充函数
- (void) request_fill;
@property (strong,nonatomic) NSMutableDictionary* data_init;
@end
