//
//  CalendarHeaderView.m
//  Project
//
//  Created by Vae on 2018/9/17.
//

#import "CalendarHeaderView.h"
#import "DrawUtils.h"
#import "Vars.h"
#import "CocoaUtils.h"
#import "SDK.h"
#import "Utility.h"
@interface CalendarHeaderView ()
@property (weak, nonatomic) IBOutlet UIView *leftBottomView;
@property (weak, nonatomic) IBOutlet UIView *rightBottomView;
@property (weak, nonatomic) IBOutlet UIView *leftView;
@property (weak, nonatomic) IBOutlet UIView *rightView;
@end

@implementation CalendarHeaderView

-(void)awakeFromNib{
	[super awakeFromNib];
	
	self.depatureDateLabel.textColor = [Utility defaultTitleColor];
	self.returnDateLabel.textColor = [Utility defaultTitleColor];
	self.depaturePriceLabel.textColor = [Utility defaultSubTitleColor];
	self.returnPriceLabel.textColor= [Utility defaultSubTitleColor];
	self.leftBottomView.backgroundColor = [Vars defaultTintColor];
	self.rightBottomView.backgroundColor = [Vars defaultTintColor];
	
	[self.cancleButton setImage:[DrawUtils imageWithFAKIcon:[FAKIonIcons iosCloseEmptyIconWithSize:36] fillColor:[Vars defaultTintColor]] forState:UIControlStateNormal];
	[self.cancleButton addTarget:self action:@selector(closeView) forControlEvents:UIControlEventTouchUpInside];
	
	self.leftView.userInteractionEnabled = YES;
	UITapGestureRecognizer *leftViewTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapLeftView)];
	self.leftView.gestureRecognizers = @[leftViewTapGesture];
	
	self.rightView.userInteractionEnabled = YES;
	UITapGestureRecognizer *rightViewTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRightView)];
	self.rightView.gestureRecognizers = @[rightViewTapGesture];
}


-(void)tapLeftView{
	self.rightBottomView.hidden = YES;
	self.leftBottomView.hidden = NO;
	self.selectLeftView();
}

-(void)tapRightView{
	self.leftBottomView.hidden = YES;
	self.rightBottomView.hidden = NO;
	self.cancleButton.hidden = NO;
	self.selectRightView();
}

-(void)closeView{
	self.leftBottomView.hidden = NO;
	self.rightBottomView.hidden = YES;
	self.cancleButton.hidden = YES;
	self.close();
}

@end
