package com.project.ilsaenterprise;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.project.ilsaenterprise.monitoring.HistoryMonitoring;
import com.project.ilsaenterprise.monitoring.ListData;
import com.project.ilsaenterprise.monitoring.MainBeacon;
import com.project.ilsaenterprise.monitoring.Upload;

public class Monitoring extends Fragment {

    private ProgressBar mProgressBar;
    private CardView BtnUpload, BtnList, BtnHistory, BtnRule;
    private RelativeLayout btnUploadPlant, btnListPlant, btnHistoryPlant, btnBeacon , btnDrone, btnIdentifySeed, btnUploadSeed, btnListSeed, btnHistorySeed, btnIrrigation, btnIdentify, btnProgress, btnSample;

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

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View root = inflater.inflate(R.layout.fragment_monitoring, container, false);
        getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), R.color.Dark));
        ((AppCompatActivity) getActivity()).getSupportActionBar().hide();

        mProgressBar = root.findViewById(R.id.progress_bar);
        btnUploadPlant = root.findViewById(R.id.btnUploadPlant);
        btnListPlant = root.findViewById(R.id.btnListPlant);
        btnHistoryPlant = root.findViewById(R.id.btnHistoryPlant);
        btnBeacon = root.findViewById(R.id.btnBeacon);
        btnDrone = root.findViewById(R.id.btnDrone);
        btnIdentifySeed = root.findViewById(R.id.btnSeed);
        btnUploadSeed = root.findViewById(R.id.btnReportSeed);
        btnListSeed = root.findViewById(R.id.btnListSeed);
        btnHistorySeed = root.findViewById(R.id.btnHistorySeed);
        btnIrrigation = root.findViewById(R.id.btnIrrigation);
        btnIdentify = root.findViewById(R.id.btnIdentify);
        btnProgress = root.findViewById(R.id.btnProgress);
        btnSample = root.findViewById(R.id.btnSample);

        btnUploadPlant.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //Change background color
                Intent intent = new Intent(Monitoring.this.getActivity(), Upload.class);
                startActivity(intent);
            }
        });

        btnListPlant.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Monitoring.this.getActivity(), ListData.class);
                startActivity(intent);
            }
        });

        btnHistoryPlant.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Monitoring.this.getActivity(), HistoryMonitoring.class);
                startActivity(intent);
            }
        });

        btnBeacon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(Monitoring.this.getActivity(), MainBeacon.class));
            }
        });

        btnIdentify.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(Monitoring.this.requireContext(), "UI On Progress.", Toast.LENGTH_SHORT).show();
            }
        });

        btnProgress.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(Monitoring.this.requireContext(), "UI On Progress.", Toast.LENGTH_SHORT).show();
            }
        });

        btnSample.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(Monitoring.this.requireContext(), "UI On Progress.", Toast.LENGTH_SHORT).show();
            }
        });

        return root;
    }
}