//
//  InvitationAnswerPopupView
//  kneet
//
//  Created by Jason Lee on 6/15/15.
//  Copyright (c) 2015 ntels. All rights reserved.
//
#import "JDObject.h"
#import "CustomLabel.h"
#import "CustomCheckBox.h"

#import "InvitationAnswerPopupView.h"
#import "LoginModel.h"
#import "DatePickerButton.h"



@interface InvitationAnswerPopupView () {
}

@end

@implementation InvitationAnswerPopupView

- (id)initFromNib {

    for (UIView *view in [CommonUtil nibViews:@"InvitationAnswerPopupView"]) {
        if ([view isKindOfClass:[InvitationAnswerPopupView class]]) {
            self = (InvitationAnswerPopupView *)view;

            //XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
            self.frame = [UIScreen mainScreen].bounds;

            _btnDate.date = [NSDate date];
            _btnDate.placeHolder = _btnDate.dateString;
            
            [self.btnConfirm setTitle:NSLocalizedString(@"확인", @"확인") forState:UIControlStateNormal];
            [self.btnCancel setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
        }
    }

    return self;
}

- (void)didMoveToSuperview {

}

- (NSString *)selectedDate {
    return _btnDate.dateString ? _btnDate.dateString : ksEmptyString;
}

- (void)btnConfirmTouched:(id)sender {

    //validate
    if (!_btnDate.date) {
        [[JDFacade facade] alert:NSLocalizedString(@"날짜를 선택해주세요", @"날짜를 선택해주세요")];
        return;
    }

    [super btnConfirmTouched:sender];
}

@end
