package com.wd.workoffice.ui.activity.user;

import android.text.TextUtils;
import android.view.View;
import android.widget.RelativeLayout;

import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.workEnum.PagePermissionType;
import com.wd.workoffice.util.UserKeeper;
import com.wd.workoffice.util.WorkUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 我的 - 财务
 * author : flexible
 * email : lgd19940421@163.com
 * github: https://github.com/FlexibleXd
 **/
public class UserMoneyActivity extends WorkToolBarActivity {

    @BindView(R.id.rl_dep)
    RelativeLayout rlDep;
    @BindView(R.id.rl_group)
    RelativeLayout rlGroup;
    @BindView(R.id.rl_bank)
    RelativeLayout rlBank;
    @BindView(R.id.rl_tax)
    RelativeLayout rlTax;

    @Override
    protected void initView() {
        ButterKnife.bind(this);
        if (!WorkUtils.hasPermission(PagePermissionType.DEPT_ACCOUNT_BALANCE_TAX.getPermission())) {
            rlTax.setVisibility(View.GONE);
        }
        if (!WorkUtils.hasPermission(PagePermissionType.DEPT_ACCOUNT_BALANCE_EXCHANGE.getPermission())) {
            rlBank.setVisibility(View.GONE);
        }
        if (!WorkUtils.hasPermission(PagePermissionType.DEPT_ACCOUNT_BALANCE_CO.getPermission())) {
            rlGroup.setVisibility(View.GONE);
        }
        if (!TextUtils.equals(UserKeeper.getInstance().getUserDepRuler(), "1")) {
            rlDep.setVisibility(View.GONE);
        }
    }

    @Override
    protected void initData() {
    }


    @Override
    protected void initEvent() {
    }

    @Override
    protected int layoutId() {
        return R.layout.activity_user_money;
    }


    @OnClick({R.id.rl_dep, R.id.rl_group, R.id.rl_bank, R.id.rl_tax})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_dep:
                startActivity(UserMoneyDetailActivity.class, "type", "1", _TITLE, "部门账户");
                break;
            case R.id.rl_group:
                startActivity(UserMoneyDetailActivity.class, "type", "2", _TITLE, "集团账户");
                break;
            case R.id.rl_bank:
                startActivity(UserMoneyDetailActivity.class, "type", "3", _TITLE, "外汇账户");
                break;
            case R.id.rl_tax:
                startActivity(UserMoneyDetailActivity.class, "type", "4", _TITLE, "税务账户");
                break;
        }
    }
}
