package com.youra.qlicker.Acitvitys.EER.KYC;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.youra.qlicker.R;

public class KYCRecupActivity extends AppCompatActivity {
    CheckBox checkboxId , checkboxRes , checkboxFa , checkboxProf , checkboxAgenc ;
    LinearLayout ly_id , ly_res , ly_sit_fa , ly_sit_prof , ly_agenc;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_kycrecup);

        ImageView btn_back = (ImageView) findViewById(R.id.img_back);
        TextView btn_next = (TextView) findViewById(R.id.btn_next);

        //checkbox
          checkboxId = (CheckBox)findViewById(R.id.checkbox_identifiant);
          checkboxRes = (CheckBox)findViewById(R.id.checkbox_res);
          checkboxFa = (CheckBox)findViewById(R.id.checkbox_sit_fa);
          checkboxProf = (CheckBox)findViewById(R.id.checkbox_sit_prof);
          checkboxAgenc  = (CheckBox)findViewById(R.id.checkbox_agence);

        //Linerlayout

          ly_id  = (LinearLayout)findViewById(R.id.ly_ident);
          ly_res  = (LinearLayout)findViewById(R.id.ly_res);
          ly_sit_fa  = (LinearLayout)findViewById(R.id.ly_sit_fa);
          ly_sit_prof  = (LinearLayout)findViewById(R.id.ly_sit_prof);
          ly_agenc  = (LinearLayout)findViewById(R.id.ly_agence);


        ///traitement is checked show layout
        toggelCheckBox();



        /// click btn continuer
        btn_next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                   startActivity(new Intent(KYCRecupActivity.this ,  KYCAEOIActivity.class ));
            }
        });
        /// click btn for return previous activity
        btn_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                finish();
            }
        });
    }

    private void toggelCheckBox() {
        checkboxId.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    ly_id.setVisibility(View.VISIBLE);
                }else {
                    ly_id.setVisibility(View.GONE);
                }
            }
        });
        checkboxRes.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    ly_res.setVisibility(View.VISIBLE);
                }else {
                    ly_res.setVisibility(View.GONE);
                }
            }
        });
        checkboxFa.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    ly_sit_fa.setVisibility(View.VISIBLE);
                }else {
                    ly_sit_fa.setVisibility(View.GONE);
                }
            }
        });
        checkboxProf.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    ly_sit_prof.setVisibility(View.VISIBLE);
                }else {
                    ly_sit_prof.setVisibility(View.GONE);
                }
            }
        });
        checkboxAgenc.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    ly_agenc.setVisibility(View.VISIBLE);
                }else {
                    ly_agenc.setVisibility(View.GONE);
                }
            }
        });
    }
}