use of com.hci.carebase.domain.Appointment in project Carebase by robertsimoes.
the class InboxFragment method buildAppointments.
private void buildAppointments(Patient p) {
if (p.getAppointments() == null || p.getAppointments().isEmpty()) {
cvUpcomingAppts.setVisibility(View.GONE);
} else {
int in = Commons.getMostUpcomingAppointmentIndex(p);
Appointment a = p.getAppointments().get(in);
SimpleDateFormat f = new SimpleDateFormat("EEE, MMM dd yyyy, HH:mm");
String sdf = f.format(a.getDateFor());
tvDateAppts.setText(sdf);
String dr = a.getDoctor().getFirstName() + " " + a.getDoctor().getLastName();
tvDateAppts.setText(dr);
}
}
use of com.hci.carebase.domain.Appointment in project Carebase by robertsimoes.
the class LoginRegisterActivity method onExecSignUpButtonClick.
@OnClick(R.id.vs_signup_button_exec_signup)
public void onExecSignUpButtonClick(View v) {
PatientSource src = CollectionsProvider.patients();
if (signup_signUpPasswordEt.getText().toString().equals(signup_signUpConfirmEt.getText().toString())) {
progressDialog = ProgressDialog.show(this, "Please wait...", "Processing...", true);
(fauth.createUserWithEmailAndPassword(signup_signUpEmailEt.getText().toString(), signup_signUpPasswordEt.getText().toString())).addOnCompleteListener(task -> {
progressDialog.dismiss();
if (task.isSuccessful()) {
Toast.makeText(this, "Registration successful", Toast.LENGTH_LONG).show();
String uid = fauth.getUid();
cache.storeUserId(uid);
Doctor d = new Doctor(signup_signUpDoctorFnameEt.getText().toString(), signup_signUpDoctorLnameEt.getText().toString());
Appointment a = new Appointment(new Date(), "University Hospital", d, "", "");
Calendar c = Calendar.getInstance();
c.add(Calendar.YEAR, 1);
Date finishDate = c.getTime();
Patient p = new Patient(signup_patient_fname.getText().toString(), signup_patient_lname.getText().toString(), signup_signUpHCardNum.getText().toString(), d, new ArrayList<Appointment>() {
{
add(a);
}
}, new ArrayList<Summary>() {
{
add(Faker.fakeSummary());
}
}, new ArrayList<Prescription>() {
{
add(Faker.fakeScript());
}
}, Faker.fakeInfo(), finishDate);
src.createPatient(p, uid, task1 -> {
if (task1.isSuccessful()) {
Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent);
finish();
} else {
Toast.makeText(this, task1.getException().getMessage() != null ? task1.getException().getMessage() : "Error signing up, please try again", Toast.LENGTH_LONG).show();
}
});
} else {
Toast.makeText(this, task.getException().getMessage() != null ? task.getException().getMessage() : "Error signing up, please try again", Toast.LENGTH_LONG).show();
}
});
} else {
Toast.makeText(this, "Passwords not equal!", Toast.LENGTH_LONG).show();
signup_signUpPasswordEt.getText().clear();
signup_signUpConfirmEt.getText().clear();
}
}
use of com.hci.carebase.domain.Appointment in project Carebase by robertsimoes.
the class Commons method getMostUpcomingAppointmentIndex.
public static int getMostUpcomingAppointmentIndex(Patient p) {
ArrayList<Appointment> appointments = p.getAppointments();
Date smallest = appointments.get(0).getDateFor();
int index = 0;
for (int i = 0; i < appointments.size(); i++) {
if (appointments.get(i).getDateFor().before(smallest)) {
index = i;
smallest = appointments.get(i).getDateFor();
}
}
return index;
}
Aggregations