package ch.pizzalemon.android.fragment.createOrder;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.BindString;
import butterknife.ButterKnife;
import butterknife.OnClick;
import ch.pizzalemon.android.R;
import ch.pizzalemon.android.activity.BaseActivity;
import ch.pizzalemon.android.activity.CreateOrderActivity;
import ch.pizzalemon.android.helper.SessionHelper;
import ch.pizzalemon.android.helper.SharedPrefsHelper;

/**
 * Created by cimenmus on 17/10/2017.
 */

public class CreateOrderResultFragment extends CreateOrderBaseFragment {

    @BindString(R.string.done_order) String doneOrderText;

    public static final java.lang.String FRAGMENT_NAME = "orderResultFragment";

    public CreateOrderResultFragment() {}

    public static CreateOrderResultFragment newInstance() {
        return new CreateOrderResultFragment();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_create_order_result, container, false);
        ButterKnife.bind(this, view);
        initViews();
        return view;
    }

    @OnClick( R.id.nextTextView)
    protected void onClick(){
        CreateOrderActivity createOrderActivity = (CreateOrderActivity) BaseActivity.currentActivity;
        createOrderActivity.onNextClicked(FRAGMENT_NAME);
    }

    private void initViews(){
        SharedPrefsHelper.setCartItemCount(0);
        SharedPrefsHelper.setCartTotalPrice("0");
        SessionHelper.clearSelectedCoupon();
        previousTextView.setVisibility(View.GONE);
        nextTextView.setText(doneOrderText);
    }
}