ja acabei
This commit is contained in:
@@ -13,17 +13,19 @@ public class Appointment {
|
||||
public String reason;
|
||||
public boolean isPast;
|
||||
public String userId;
|
||||
public String status; // "Pendente", "Aceite", "Rejeitada"
|
||||
|
||||
// Required empty constructor for Firestore deserialization
|
||||
public Appointment() {
|
||||
}
|
||||
|
||||
public Appointment(String type, String date, String time, String reason, boolean isPast, String userId) {
|
||||
public Appointment(String type, String date, String time, String reason, boolean isPast, String userId, String status) {
|
||||
this.type = type;
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
this.reason = reason;
|
||||
this.isPast = isPast;
|
||||
this.userId = userId;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,21 @@ public class AppointmentAdapter extends RecyclerView.Adapter<AppointmentAdapter.
|
||||
holder.textDate.setText(appointment.date);
|
||||
holder.textTime.setText(appointment.time);
|
||||
holder.textReason.setText("Motivo: " + (appointment.reason != null ? appointment.reason : "--"));
|
||||
|
||||
String status = appointment.status != null ? appointment.status : "Pendente";
|
||||
holder.textStatus.setText(status);
|
||||
|
||||
if ("Aceite".equalsIgnoreCase(status)) {
|
||||
holder.textStatus.setTextColor(android.graphics.Color.parseColor("#388E3C")); // Green
|
||||
holder.textStatus.setBackgroundColor(android.graphics.Color.parseColor("#C8E6C9"));
|
||||
} else if ("Rejeitada".equalsIgnoreCase(status)) {
|
||||
holder.textStatus.setTextColor(android.graphics.Color.parseColor("#D32F2F")); // Red
|
||||
holder.textStatus.setBackgroundColor(android.graphics.Color.parseColor("#FFCDD2"));
|
||||
} else {
|
||||
holder.textStatus.setTextColor(android.graphics.Color.parseColor("#F57C00")); // Orange
|
||||
holder.textStatus.setBackgroundColor(android.graphics.Color.parseColor("#FFE0B2"));
|
||||
holder.textStatus.setText("Pendente");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +57,7 @@ public class AppointmentAdapter extends RecyclerView.Adapter<AppointmentAdapter.
|
||||
}
|
||||
|
||||
public static class AppointmentViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView textType, textDate, textTime, textReason;
|
||||
TextView textType, textDate, textTime, textReason, textStatus;
|
||||
|
||||
public AppointmentViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -50,6 +65,7 @@ public class AppointmentAdapter extends RecyclerView.Adapter<AppointmentAdapter.
|
||||
textDate = itemView.findViewById(R.id.text_date);
|
||||
textTime = itemView.findViewById(R.id.text_time);
|
||||
textReason = itemView.findViewById(R.id.text_reason);
|
||||
textStatus = itemView.findViewById(R.id.text_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user