package cn.net.caoyao.cpzshandset.service.presenter.impl.warehouse.out.jinLiquor;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import cn.net.caoyao.cpzshandset.R;
import cn.net.caoyao.cpzshandset.common.config.HandsetOperation;
import cn.net.caoyao.cpzshandset.service.presenter.WarehouseConfigConstact;
import cn.net.caoyao.cpzshandset.service.presenter.base.impl.WarehouseConfigConstactImpl;
import cn.net.caoyao.cpzshandset.ui.dialog.TipsDialog;

public class JinLiquorOutWarehouseConfigPresenter extends WarehouseConfigConstactImpl {

	private final WarehouseConfigConstact.View wView;
	private Context context;
	private HandsetOperation option_type = HandsetOperation.OPERATION_OUT_WAREHOUSE_CONSTANT;
	private TipsDialog tipsDialog;

	public JinLiquorOutWarehouseConfigPresenter(WarehouseConfigConstact.View wView, Context context, Intent intent) {
		this.wView = wView;
		this.context = context;
		start();
		addCustomView();
	}

	private void addCustomView() {
		View customView = LayoutInflater.from(context).inflate(R.layout.custom_warehouse_middle_style, null);
		wView.addMiddleCustomView(customView);
		View lin_custom_warehouse_plan_num = customView.findViewById(R.id.lin_custom_warehouse_plan_num);
		lin_custom_warehouse_plan_num.setVisibility(View.GONE);
		
		View lin_custom_warehouse_no = customView.findViewById(R.id.lin_custom_warehouse_no);
		lin_custom_warehouse_no.setVisibility(View.VISIBLE);
		
		View lin_product_info = customView.findViewById(R.id.lin_product_info);
		lin_product_info.setVisibility(View.VISIBLE);
		
		View lin_dealer_info = customView.findViewById(R.id.lin_dealer_info);
		lin_dealer_info.setVisibility(View.VISIBLE);
	}

	@Override
	public void start() {
		if (!checkViewAvailable())
			return;

		wView.setMoreOptionStr("完成");
		wView.setPageTitle("创建出库单");
		wView.setSaleAreaVisiable(View.GONE);
		wView.setTVWarehousDeclareStr("出库说明：");
		initDataView();
	}

	private void initDataView() {
//		if (isCreate)
//			return;
//		wView.setEtWarehousDeclareStr(currentWarehouseBean.getDescribe());
//		et_warehouse_custom_num.setText(currentWarehouseBean.getPlan_num()+"");
//		if (cityBll == null) cityBll = new CityBll(context);
//		currentCity = cityBll.queryCityByCode(currentWarehouseBean.getSale_area_code());
//		if (currentCity != null) {
//			wView.setSaleAreaStr(SaleAddressUtil.getAddressStrByCity(currentCity));
//		} else {
//			currentCity = new City("全国", 0);
//			wView.setSaleAreaStr("全国");
//		}
//		currentChoiceCityCode = currentWarehouseBean.getSale_area_code();
	}

	@Override
	public boolean checkViewAvailable() {
		boolean b = false;
		if (wView != null && context != null) {
			b = true;
		}
		return b;
	}


	@Override
	public void moreOptionClick() {
		if (!checkViewAvailable())
			return;
		
	}

	@Override
	public void choiceSaleAreaClick() {
		if (!checkViewAvailable())
			return;
	}

}
