package com.example.depanntout;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class ModifInter extends AppCompatActivity {

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

        initialisation();
    }

    private void initialisation() {

        // Get data from Intent
        String date = getIntent().getStringExtra("date");
        String heure = getIntent().getStringExtra("heure");
        String observation = getIntent().getStringExtra("observation");
        int idCli = getIntent().getIntExtra("idCli", -1);

        // Reference TextViews
        TextView tvDate = findViewById(R.id.ptModifDate);
        TextView tvHeure = findViewById(R.id.ptModifHeure);
        TextView tvObservation = findViewById(R.id.ptModifObserv);
        TextView tvIdCli = findViewById(R.id.ptModifIdClient);

        // Set data in TextViews
        tvDate.setText(date);
        tvHeure.setText(heure);
        tvObservation.setText(observation);
        tvIdCli.setText(String.valueOf(idCli));

        // gestion du boutton Quitter
        Button btQuitterInter = (Button) findViewById(R.id.btQuitterInter);
        // Association d'un écouteur d'événement au clic de btQuitter
        btQuitterInter.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                finish();
            }
        });

        Button btnDelete = findViewById(R.id.btnDeleteInter);
        btnDelete.setOnClickListener(v -> supprimer());
    }

    private void  supprimer() {

    }
}
