//
//  MemberRolePopupView.m
//  kneet
//
//  Created by Jason Lee on 6/16/15.
//  Copyright (c) 2015 ntels. All rights reserved.
//
#import "JDObject.h"
#import "LoginModel.h"

#import "CustomLabel.h"
#import "CustomRadioGroup.h"
#import "MemberRolePopupView.h"
#import "ValidateUtil.h"
#import "CustomTextField.h"


@interface MemberRolePopupView () {
    
}

@end

@implementation MemberRolePopupView

- (id)initFromNib {

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

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

            self.lblTitle.text = NSLocalizedString(@"멤버 권한 변경", @"멤버 권한 변경");

            _rdoPower.value = KNEET_MEMBER_POWER;
            _rdoSimple.value= KNEET_MEMBER_SIMPLE;

            [_rdoPower setTitle:NSLocalizedString(@"멤버등급 : 파워", @"멤버등급 : 파워") forState:UIControlStateNormal];
            [_rdoSimple setTitle:NSLocalizedString(@"멤버등급 : 심플", @"멤버등급 : 심플") forState:UIControlStateNormal];
            
            self.rgroup = [[CustomRadioGroup alloc] initWithRadioButtons:_rdoPower, _rdoSimple, nil];
            
            _lblPowerDesc.text = NSLocalizedString(@"홈 셋팅을 제외한 모든 것을 할 수 있습니다", @"홈 셋팅을 제외한 모든 것을 할 수 있습니다");
            _lblSimpleDesc.text = NSLocalizedString(@"단순 사용만 가능합니다", @"단순 사용만 가능합니다");
            
            [self.btnConfirm setTitle:NSLocalizedString(@"확인", @"확인") forState:UIControlStateNormal];
            [self.btnCancel setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
        }
    }

    return self;
}

- (void)didMoveToSuperview {

}

- (void)setMember:(HomeMemberModel *)member {
    _member = member;
    
    if ([_member.gradeCode isEqualToString:KNEET_MEMBER_SIMPLE]) {
        [_rgroup someRadioButtonTouched:_rdoSimple];
    }
}

- (void)btnConfirmTouched:(id)sender {

    [super btnConfirmTouched:sender];
}

@end
