//
//  PwFindViewController.m
//  OneCable
//
//  Created by nComz on 2017. 3. 31..
//  Copyright © 2017년 ntels. All rights reserved.
//

#import "PwFindViewController.h"
#import "CustomButton.h"
#import "CustomLabel.h"
#import "CustomTextField.h"
#import "PwAnswerViewController.h"

@interface PwFindViewController ()

@end

@implementation PwFindViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self initUI];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}

- (void)initUI {
    
    [self.navigationController.navigationBar setHidden:YES];
    self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    
    [_lblStep setColor:kUITextColor03 text:[NSString stringWithFormat:@"%@", @"/ 3"]];
    
    _btnNext.enabled = NO ;
}


- (IBAction)btnCancelTouched:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (IBAction)btnNextTouched:(id)sender {
    
    PwAnswerViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"PwAnswerViewController" storyboardName:@"SignUp"];
    vc.memberId = _txtFindIdInput.text.trim;
    vc.phoneNumber = _txtNumInput.text.trim;
    
    [self.navigationController pushViewController:vc animated:YES];
}


#pragma mark - textfield delegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    
    if ([textField isEqual:_txtFindIdInput]) {
        
        [_txtNumInput becomeFirstResponder] ;
    }
    else {
        [textField resignFirstResponder] ;
    }
    return YES ;
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    
    _btnNext.enabled = _txtFindIdInput.text.length >= 6 && _txtNumInput.text.length >= 10 ;
    
}

@end
