package com.wd.workoffice.ui.activity.bat.work;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.FlowBean;
import com.wd.workoffice.util.MathUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 工作台 - 部门
 * author : flexible
 * email : lgd19940421@163.com
 * github: https://github.com/FlexibleXd
 **/
public class WorkContactsMoneyFlowDetailActivity extends WorkToolBarActivity {
    @BindView(R.id.tv_show_type)
    TextView tvShowType;
    @BindView(R.id.tv_id)
    TextView tvId;
    @BindView(R.id.tv_price)
    TextView tvPrice;
    @BindView(R.id.tv_from_account)
    TextView tvFromAccount;
    @BindView(R.id.tv_to_account)
    TextView tvToAccount;
    @BindView(R.id.tv_operating)
    TextView tvOperating;
    @BindView(R.id.tv_time)
    TextView tvTime;
    @BindView(R.id.tv_desc)
    TextView tvDesc;
    @BindView(R.id.rl_show_type)
    RelativeLayout rlShowType;
    @BindView(R.id.rl_id)
    RelativeLayout rlId;
    @BindView(R.id.rl_from_account)
    RelativeLayout rlFromAccount;
    @BindView(R.id.rl_to_account)
    RelativeLayout rlToAccount;
    private FlowBean.RecordsBean dataBean;

    @Override
    protected void initView() {
        ButterKnife.bind(this);
        dataBean = JSON.parseObject(getIntent().getStringExtra("detail"), FlowBean.RecordsBean.class);
        tvShowType.setText(dataBean.getInvoiceTypeName());
        tvId.setText(dataBean.getLinkSerialNumber());
        tvToAccount.setText(dataBean.getTargetName());
        tvFromAccount.setText(dataBean.getSourceName());
        tvPrice.setText(MathUtils.converData(String.valueOf(dataBean.getMoney()), 2));
        tvDesc.setText(dataBean.getRemark());
        tvOperating.setText(dataBean.getCreatedUser());
        tvTime.setText(dataBean.getCreatedTime());
        if (TextUtils.equals(getIntent().getStringExtra("type"), "3")) {
            rlShowType.setVisibility(View.GONE);
            rlToAccount.setVisibility(View.GONE);
            rlFromAccount.setVisibility(View.GONE);
            rlId.setVisibility(View.GONE);
        }
    }

    @Override
    protected void initData() {
    }


    @Override
    protected void initEvent() {
    }

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

}
