package BWP.MobileSale.Return;

import java.util.HashMap;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import BWP.MobileSale.LoginedActivity;
import BWP.MobileSale.R;
import BWP.MobileSale.Order.OrderDetailEditActivity;
import BWP.MobileSale.Util.ActivityUtil;
import BWP.MobileSale.Util.StringUtil;

public class ReturnDetailEditActivity extends LoginedActivity {
	private TextView textViewGoodsName;
	private EditText editTextNumber;
	private int position;
	//private HashMap<String,Object> detail;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.return_detail_edit);
		//GoodsDetails
		
		Intent intent = getIntent();
		position = intent.getIntExtra("Position", -1);
		//detail = (HashMap<String, Object>) intent.getSerializableExtra("GoodsDetails");
		
		
		textViewGoodsName = ActivityUtil.Find(this, R.id.TextView_Goods_Name);
		editTextNumber = ActivityUtil.Find(this, R.id.EditText_Number);
		
		textViewGoodsName.setText(StringUtil.ToString(intent.getStringExtra("Goods_Name")));
		editTextNumber.setText(StringUtil.ToString(intent.getStringExtra("UnitNum")));
		Button buttonOK = ActivityUtil.Find(this, R.id.Button_OK);
		Button buttonCancel = ActivityUtil.Find(this, R.id.Button_Cancel);
		buttonOK.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
			
				Intent intent =new Intent();
				intent.putExtra("UnitNum", editTextNumber.getText().toString());				
				intent.putExtra("Position", position);
				ActivityUtil.Finish(ReturnDetailEditActivity.this, intent);				
			}
		});
		
		buttonCancel.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				finish();				
			}
		});
		
	}
}
