package cn.net.communal.cpzshandset.service.presenter.impl.upload.liqueur;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import cn.net.communal.cpzshandset.common.config.HandsetOperation;
import cn.net.communal.cpzshandset.common.config.TConfig;
import cn.net.communal.cpzshandset.common.util.LogUtil;
import cn.net.communal.cpzshandset.service.bll.UploadStatusBll;
import cn.net.communal.cpzshandset.service.presenter.UploadStatusConstact;
import cn.net.communal.cpzshandset.service.presenter.base.impl.UploadStatusConstactImpl;
import cn.net.communal.cpzshandset.ui.adapter.UploadStatusAdapter;

public class LiqueurUploadStatusPresenter extends UploadStatusConstactImpl{

	private final UploadStatusConstact.View uView;
	private Context context;
	private List<String> dates = new ArrayList<>();
//	private List<HomeBean> homeBeans = new ArrayList<>();
	private List<HandsetOperation> options = new ArrayList<>();
	private UploadStatusBll uploadStatusBll;
	public LiqueurUploadStatusPresenter(UploadStatusConstact.View uView,Context context) {
		this.uView = uView;
		this.context = context;
		start();
	}
	
	@Override
	public void start() {
		if (!checkViewAvailable()) return;
		init();
		uView.setPageTitle("提交状态");
		uView.setAdapter(new UploadStatusAdapter(dates, options, uploadStatusBll));
	}

	private void init() {
		uploadStatusBll = new UploadStatusBll(context);
		options.add(HandsetOperation.OPERATION_ACTIVATE_WITH_RELATION_CONSTANT);
		options.add(HandsetOperation.OPERATION_ACTIVATE_WITH_PACK_CONSTANT);
		options.add(HandsetOperation.OPERATION_ACTIVATE_CONSTANT);
		options.add(HandsetOperation.OPERATION_PACK_CONSTANT);
		options.add(HandsetOperation.OPERATION_OUT_WAREHOUSE_CONSTANT);
		options.add(HandsetOperation.OPERATION_SALE_CONSTANT);
		
		
		dates = uploadStatusBll.queryUploadDateFor7Days();
//		LogUtil.d(TConfig.Echo, "提交状态：" + dates.toString());
	}

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

	


}
