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

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

import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.workEnum.PagePermissionType;
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 WorkContactsDetailActivity extends WorkToolBarActivity {

    @BindView(R.id.ll_info)
    LinearLayout llInfo;
    @BindView(R.id.ll_receive)
    LinearLayout llReceive;
    @BindView(R.id.ll_live)
    LinearLayout llLive;
    @BindView(R.id.ll_settle)
    LinearLayout llSettle;
    @BindView(R.id.ll_client)
    LinearLayout llClient;
    @BindView(R.id.ll_order)
    LinearLayout llOrder;
    @BindView(R.id.ll_return)
    LinearLayout llReturn;
    @BindView(R.id.ll_receive_ticket)
    LinearLayout llReceiveTicket;
    @BindView(R.id.ll_open_ticket)
    LinearLayout llOpenTicket;
    @BindView(R.id.ll_pay)
    LinearLayout llPay;

    @Override
    protected void initView() {
        ButterKnife.bind(this);
        if (TextUtils.equals("客户", getIntent().getStringExtra("partTypeNames"))) {
            llReceiveTicket.setVisibility(View.GONE);
            llPay.setVisibility(View.GONE);
        } else if (TextUtils.equals("物流公司", getIntent().getStringExtra("partTypeNames"))) {
            llReceive.setVisibility(View.GONE);
            llReceiveTicket.setVisibility(View.GONE);
            llClient.setVisibility(View.GONE);
        } else {
            llReceive.setVisibility(View.GONE);
            llClient.setVisibility(View.GONE);
            llOpenTicket.setVisibility(View.GONE);
        }
        setTitle(getIntent().getStringExtra("title"));
    }

    @Override
    protected void initData() {
    }

    @Override
    protected void initEvent() {
    }

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


    @OnClick({R.id.ll_pay, R.id.ll_info, R.id.ll_receive, R.id.ll_live, R.id.ll_settle, R.id.ll_receive_ticket, R.id.ll_open_ticket, R.id.ll_order, R.id.ll_return})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_info:
                startActivity(WorkContactsInfoActivity.class, "id", getIntent().getStringExtra("id"));
                break;
            case R.id.ll_receive:
                startActivity(WorkContactsMoneyActivity.class, "type", "1", "id", getIntent().getStringExtra("id"));
                break;
            case R.id.ll_pay:
                if (TextUtils.equals("物流公司", getIntent().getStringExtra("partTypeNames"))) {
                    startActivity(WorkContactsMoneyActivity.class, "type", "3", "id", getIntent().getStringExtra("id"));
                } else {
                    startActivity(WorkContactsMoneyActivity.class, "type", "2", "id", getIntent().getStringExtra("id"));
                }
                break;
            case R.id.ll_live:
                startActivity(WorkContactsLiveStockActivity.class, "title", "现场库", "sign", "SEND", "id", getIntent().getStringExtra("id"));
                break;
            case R.id.ll_settle:
                startActivity(WorkContactsLiveStockActivity.class, "title", "未结算库", "sign", "USED", "id", getIntent().getStringExtra("id"));
                break;
            case R.id.ll_receive_ticket:
                startActivity(WorkContactsReceiveTicketActivity.class, "id", getIntent().getStringExtra("id"));
                break;
            case R.id.ll_open_ticket:
                if (TextUtils.equals("物流公司", getIntent().getStringExtra("partTypeNames"))) {
                    startActivity(ContactsLogisticsActivity.class, "id", getIntent().getStringExtra("id"));
                } else {
                    startActivity(WorkContactsOpenTicketActivity.class, "id", getIntent().getStringExtra("id"));
                }
                break;
            case R.id.ll_order:
                toast("功能正在开发中哦！");
                break;
            case R.id.ll_return:
                startActivity(ContactsReturnActivity.class, "id", getIntent().getStringExtra("id"),
                        _TITLE, getIntent().getStringExtra("title"));
                break;
        }
    }

}
