package beyondsoft.bewoklientenapp;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;


public class MainActivityKlient extends ActionBarActivity {
    //##################### Variablen ####################
    protected Button kalenderbutton;
    protected Button kassenbutton;
    protected Button chatbutton;
    protected Button logoutbutton;
    //####################################################


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_activity_klient);


        setzeButtonListener();

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main_activity_klient, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        //R.id.action_settings
        //

        if(id == R.id.action_Logout){
            System.exit(0);
        }

        return super.onOptionsItemSelected(item);
    }

    //########################## Action events der Jeweiligen Buttons
    //########################## Start Kalender
    public void startKalenderActiviti(){

        //Intent intent = new Intent((), CalenderActiviti.class);
        //startActivity(intent);
        startActivity(new Intent(getBaseContext(),CalenderActiviti.class));

    }

    //########################## Start Kasse
    public void startKassenActiviti(){

        startActivity(new Intent(getBaseContext(),kasseActiviti.class));

    }

    //########################## Start Chat
    public void startChatActiviti(){

        startActivity(new Intent(getBaseContext(),chatActiviti.class));

    }

    //########################## Start Logout
    public void startLogoutActiviti(){

        System.exit(0);

    }

    //###############################################################


    //---------------- Gesetzte Listener der Einzelnen Buttons ------------

    public void setzeButtonListener(){

        //################## Kalender Button ######################
        kalenderbutton = (Button) findViewById(R.id.KalenderButton);
        kalenderbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                startKalenderActiviti();

            }
        });

        //################# Kassen Button #########################
        kassenbutton = (Button) findViewById(R.id.KassenButton);
        kassenbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                startKassenActiviti();

            }
        });

        //################## Chat Button ###########################
        chatbutton = (Button) findViewById(R.id.Chatbutton);
        chatbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                startChatActiviti();

            }
        });

        //################## Logout Button ###########################
        logoutbutton = (Button) findViewById(R.id.Logoutbutton);
        logoutbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                startLogoutActiviti();

            }
        });

    }

    //----------------------------------------------------------------------

}
