forked from nus-cs2103-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from LimJH2002/branch-ui
Branch UI
- Loading branch information
Showing
28 changed files
with
309 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,15 @@ professionals manage their patients' medical journey. | |
3. Copy the file to the folder you want to use as the home folder for CareCentral. | ||
4. Double-click the file to start the app. The GUI similar to the below should appear in a few seconds. | ||
![Ui](images/Ui.png) | ||
5. For Mac users encountering this issue, follow this[guide](https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Run-JAR-file-example-windows-linux-ubuntu). | ||
5. For Mac users encountering this issue, follow this [guide](https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Run-JAR-file-example-windows-linux-ubuntu). | ||
<img width="275" height="280" src="images/mac_issue.png"> | ||
6. Type the command in the command box and press Enter to execute it. | ||
e.g. typing `help` and pressing Enter will open the help window. | ||
Some example commands you can try: | ||
|
||
* `add-p n/John Doe ic/S1234567A a/45 p/91234567` | ||
* `list-p` | ||
* `delete-p 1` | ||
* `add-patient n/John Doe ic/S1234567A p/98765432 e/[email protected] a/25 t/Diabetic` | ||
* `list-pateints` | ||
* `delete-patient 1` | ||
* `exit` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ public class AddCommand extends Command { | |
public static final String COMMAND_WORD = "add-patient"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a patient to the clinic book. " | ||
+ "Parameters: " | ||
+ "\nParameters: " | ||
+ PREFIX_NAME + "NAME " | ||
+ PREFIX_NRIC + "NRIC " | ||
+ PREFIX_PHONE + "PHONE " | ||
|
@@ -32,10 +32,11 @@ public class AddCommand extends Command { | |
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ "Example: " + COMMAND_WORD + " " | ||
+ PREFIX_NAME + "John Doe " | ||
+ PREFIX_NRIC + "S1234567A " | ||
+ PREFIX_PHONE + "98765432 " | ||
+ PREFIX_EMAIL + "[email protected] " | ||
+ PREFIX_AGE + "25 " | ||
+ PREFIX_TAG + "friends " | ||
+ PREFIX_TAG + "Bad Breath " | ||
+ PREFIX_TAG + "owesMoney"; | ||
|
||
public static final String MESSAGE_SUCCESS = "New patient added: %1$s"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
src/main/java/seedu/cc/logic/commands/appointmentcommands/EditPrescriptionCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package seedu.cc.logic.commands.appointmentcommands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.cc.logic.commands.appointmentcommands.EditAppointmentEventCommand.createEditedAppointmentEvent; | ||
import static seedu.cc.logic.parser.CliSyntax.PREFIX_MEDICINE_NAME; | ||
import static seedu.cc.logic.parser.CliSyntax.PREFIX_PATIENT_INDEX; | ||
|
||
import java.util.List; | ||
|
||
import seedu.cc.commons.core.index.Index; | ||
import seedu.cc.commons.util.ToStringBuilder; | ||
import seedu.cc.logic.Messages; | ||
import seedu.cc.logic.commands.Command; | ||
import seedu.cc.logic.commands.CommandResult; | ||
import seedu.cc.logic.commands.exceptions.CommandException; | ||
import seedu.cc.model.Model; | ||
import seedu.cc.model.appointment.AppointmentEvent; | ||
import seedu.cc.model.patient.Patient; | ||
|
||
|
||
/** | ||
* Edit the prescription of an appointment event in the clinic book. | ||
*/ | ||
public class EditPrescriptionCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "edit-prescription"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edit a prescription in the appointment " | ||
+ "by the index number used in the displayed appointment list.\n" | ||
+ "Parameters: INDEX (must be a positive integer) " | ||
+ "[" + PREFIX_PATIENT_INDEX + "PATIENT INDEX] " | ||
+ "[" + PREFIX_MEDICINE_NAME + "MEDICINE NAME]" | ||
+ "\nExample: " + COMMAND_WORD + " 1 " | ||
+ PREFIX_PATIENT_INDEX + "1 " | ||
+ PREFIX_MEDICINE_NAME + "Panadol"; | ||
|
||
public static final String MESSAGE_ADD_APPOINTMENT_SUCCESS = "Successfully edited a prescription: \n%1$s"; | ||
private final Index patientIndex; | ||
private final Index eventIndex; | ||
private final EditAppointmentEventCommand.EditAppointmentEventDescriptor editAppointmentEventDescriptor; | ||
|
||
/** | ||
* Edits an appointment event to the patient at {@code index}. | ||
* @param eventIndex of the appointment event in the filtered appointment event list to edit | ||
* @param patientIndex of the patient in the filtered patient list to edit | ||
* @param editAppointmentEventDescriptor details to edit the appointment with | ||
*/ | ||
public EditPrescriptionCommand(Index eventIndex, Index patientIndex, | ||
EditAppointmentEventCommand | ||
.EditAppointmentEventDescriptor editAppointmentEventDescriptor) { | ||
requireNonNull(eventIndex); | ||
requireNonNull(eventIndex); | ||
this.patientIndex = patientIndex; | ||
this.eventIndex = eventIndex; | ||
this.editAppointmentEventDescriptor = editAppointmentEventDescriptor; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
List<Patient> lastShownList = model.getFilteredPatientList(); | ||
|
||
if (patientIndex.getZeroBased() >= lastShownList.size()) { | ||
throw new CommandException(Messages.MESSAGE_INVALID_PATIENT_DISPLAYED_INDEX); | ||
} | ||
|
||
if (eventIndex.getZeroBased() >= lastShownList.get(patientIndex.getZeroBased()).getClinicBookAppointmentList() | ||
.size()) { | ||
throw new CommandException(Messages.MESSAGE_INVALID_APPOINTMENT_EVENT_DISPLAYED_INDEX); | ||
} | ||
|
||
Patient patientToEditPrescription = lastShownList.get(patientIndex.getZeroBased()); | ||
AppointmentEvent appointmentEvent = patientToEditPrescription.getClinicBookAppointmentList() | ||
.get(eventIndex.getZeroBased()); | ||
|
||
AppointmentEvent editedEvent = createEditedAppointmentEvent(appointmentEvent, editAppointmentEventDescriptor); | ||
model.setAppointmentEventForPatient(patientToEditPrescription, appointmentEvent, editedEvent); | ||
return new CommandResult(String.format(MESSAGE_ADD_APPOINTMENT_SUCCESS, | ||
Messages.format(appointmentEvent, patientToEditPrescription))); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (other == this) { | ||
return true; | ||
} | ||
|
||
// instanceof handles nulls | ||
if (!(other instanceof EditPrescriptionCommand)) { | ||
return false; | ||
} | ||
|
||
EditPrescriptionCommand otherEditPrescriptionCommand = (EditPrescriptionCommand) other; | ||
return this.patientIndex.equals(otherEditPrescriptionCommand.patientIndex) | ||
&& this.eventIndex.equals(otherEditPrescriptionCommand.eventIndex); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this) | ||
.add("eventIndex", eventIndex) | ||
.add("patientIndex", patientIndex) | ||
.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.