//
//  LoginPopVC.swift
//  Garmentoo
//
//  Created by Vijith on 19/04/22.
//

import UIKit

class LoginPopVC: UIViewController {
    
    
    @IBOutlet weak var outerView: UIView!
    @IBOutlet weak var mobileText: UITextField!
    @IBOutlet weak var mailText: UITextField!
    @IBOutlet weak var nameText: UITextField!
    @IBOutlet weak var proceedBtnOutlet: UIButton!
    @IBOutlet weak var signupHeaderLabel: UILabel!
    @IBOutlet weak var signupBodyLabel: UILabel!
    
    var isMobileEntered = true
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Do any additional setup after loading the view.
        setui()
    }
    
    
    func setui(){
        self.outerView.layer.cornerRadius = 20
        self.outerView.layer.maskedCorners = [.layerMinXMinYCorner,.layerMaxXMinYCorner]
        self.outerView.backgroundColor = UIColor.viewBg
        
    }
    
    @IBAction func proceedBtnAction(_ sender: UIButton) {
        
        if self.proceedBtnOutlet.titleLabel?.text == "Proceed"
        {
            if self.mobileText.text?.count == 10
            {
                self.mailText.isHidden = false
                self.nameText.isHidden = false
                self.mobileText.isUserInteractionEnabled = false
                self.proceedBtnOutlet.setTitle("Signup", for: .normal)
                self.signupHeaderLabel.text = "SignUp"
            }
            else
            {
                self.mobileText.text = ""
                self.mobileText.isUserInteractionEnabled = true
                self.mobileText.placeholder = "Enter OTP"
                self.proceedBtnOutlet.setTitle("Verify", for: .normal)
                self.signupHeaderLabel.text = "OTP Verification"
            }
        }
        else if self.proceedBtnOutlet.titleLabel?.text == "Signup"
        {
            self.mobileText.text = ""
            self.mobileText.isUserInteractionEnabled = true
            self.mobileText.placeholder = "Enter OTP"
            self.mailText.isHidden = true
            self.nameText.isHidden = true
            self.proceedBtnOutlet.setTitle("Verify", for: .normal)
            self.signupHeaderLabel.text = "OTP Verification"
        }
        else if self.proceedBtnOutlet.titleLabel?.text == "Verify"
        {
            self.dismiss(animated: false, completion: nil)
        }
    }
    
    @IBAction func closeBtnTapped(_ sender: Any) {
        self.dismiss(animated: false, completion: nil)
    }
    
    
}
