Skip to content

Commit

Permalink
Merge ab88986 into 4dce0b9
Browse files Browse the repository at this point in the history
  • Loading branch information
SQwQ committed Oct 29, 2019
2 parents 4dce0b9 + ab88986 commit 928cf06
Show file tree
Hide file tree
Showing 10 changed files with 228 additions and 42 deletions.
74 changes: 52 additions & 22 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -226,35 +226,58 @@ Opens up a pop-up panel detailing the profile of the patient with the index of 2

==== Adding a new visitation report for a patient : `addvisit`
Opens a pop-up panel that enables the specification of a new visitation report for a particular patient. +
Format: `addvisit INDEX [v/DATE]`

* Date must be in the "dd/MM/yyyy" format (i.e. `v/19/10/2019`)
Format: `addvisit INDEX [v/DATE]`

[TIP]
If no date is specified, `addvisit` will default to the current local date of the computer.
*Example*:

*Examples*:
Let's say that you have just got a patient's folder of past visits and you want to record a house call made on 3rd January 2019.
The patient is 1st in the list.
//image of mainwindow with 1st patient boxed/circled in red
To enter the details of the report into VISIT:

* `addvisit 1` +
Adds new visitation report for the patient at index 1, defaulting to the current date on the computer. A new panel allowing the specifications of the visitation to be entered.

* `addvisit 1 v/19/10/2019` +
Adds new visitation report dated 19th of October 2019, will be added for the patient at index 1. A new panel allowing the specifications of the visitation to be entered.
1. Type `addvisit 1 v/03/01/2019` into the command box and press kbd:[Enter] to execute it.
//image here
* Date must be in the "dd/MM/2yyy" format (i.e. `v/19/10/2019`)
[TIP]
If no date is specified and the command is used without the prefix 'v/' (for example `addvisit 1`), the report will default to the current local date of the computer.
2. Key in the details in the respective fields of the pop-up form that appears.
//image here
* Press kbd:[CTRL] + kbd:[Tab] to navigate to the next field (down)
* Press kbd:[SHIFT] + kbd:[Tab] to navigate to the previous field (up)
3. Click the kbd:[Submit] button or press kbd:[F2] to save your entry.
4. The pop-up form closes and the display box will display a message indicating a successful entry.
//image here

[NOTE]
While `addvisit 1` is valid, typing in `addvisit 1 v/` without a valid date will give an error.
//error image here
==== Editing the particulars of a visitation report : `editvisit`

Opens a pop-up panel that enables the editing of an existing visitation report of a particular patient. +
Format: `editvisit INDEX [i/REPORT INDEX]`

[NOTE]
If no report index is specified, `editvisit INDEX` will open a panel showing the reports of that patient and the relevant indexes of the reports. To edit the visit, simply re-enter the command with the desired report index.
If no report index is specified, `editvisit INDEX` will open a panel showing the reports of that patient and the relevant indexes of the reports. To edit the visit report, simply re-enter the command with the desired report index.
//image of panel here

*Example*:

Let's say you want to edit the 2nd visit report of a patient and the patient is the 3rd name in the list.
//image of mainwindow with 3rd patient circled in red
1. Type `editvisit 3 i/2` into the command box and press kbd:[Enter] to execute it.
//image here
2. Key in the details in the respective fields of the pop-up form(which is pre-filled with the existing information of the report) that appears.
//image here
* Press kbd:[CTRL] + kbd:[Tab] to navigate to the next field (down)
* Press kbd:[SHIFT] + kbd:[Tab] to navigate to the previous field (up)
3. Click the kbd:[Submit] button or press kbd:[F2] to save your edits.
4. The pop-up form closes and the display box will display a message indicating a successful entry.
//image here

*Examples*:

* `editvisit 1` +
A panel will appear showing the list of visits for the patient at index 1 along with the relevant report indexes.
* `editvisit 1 i/1` +
A panel will appear to allow for the amendment of the 1st visitation report of the person at index 1.
[NOTE]
An error will be thrown if the report with the given report index does not exist or the index given is not a number.
//error image here

==== Deleting a visitation report : `deletevisit`

Expand All @@ -263,14 +286,21 @@ Format: `deletevisit INDEX [d/REPORT INDEX]`

[NOTE]
If no report index is specified, `deletevisit INDEX` will open a panel showing the reports of that patient and their relevant indexes of the reports. To delete the visit, simply re-enter the command with the desired report index.
//image of panel here
*Example*:

*Examples*:
Let's say you want to delete the 1st visit report of a patient and the patient is the 2nd name in the list.

1. Type `deletevisit 2 d/1` into the command box and press kbd:[Enter] to execute it.
//image here
2. A panel showing the list of reports will be shown, now without the deleted report and the display box will display a message indicating a successful deletion.
//image here

* `deletevisit 1` +
A panel will appear showing the list of visits for the patient at index 1 along with the relevant report indexes.
* `deletevisit 1 d/1` +
The 1st visitation report of the person at index 1 will be deleted.
[NOTE]
An error will be thrown if the report with the given report index does not exist or the index given is not a number.
//error image here

For both `deletevisit` and `editvisit` commands if the patient has no past records, a pop up with the message "Patient has no past records" will be shown instead of a list of reports when `editvisit [INDEX]` or `deletevisit [INDEX]` is run. Note that an error will be raised if the report index is provided to a patient with no past records, for example `editvisit [INDEX] i/1` or `deletevisit [INDEX] d/1`.

=== *Follow-Ups and Reminders*
VISIT also enables doctors to keep abreast and up-to-date on any events or deadlines as VISIT can be customized to remind them of any follow-up appointments or other timed reminders.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class DeleteVisitCommand extends Command {
+ PREFIX_DELETE_VISIT + "2";

public static final String MESSAGE_DELETE_VISIT_SUCCESS = "Removed visit from Person: %1$s";
public static final String MESSAGE_MISSING_INDEX_PROMPT = "Please specify index of report to be deleted";
public static final String MESSAGE_MISSING_INDEX_PROMPT = "Please specify index of report to be deleted\n"
+ "Usage: " + COMMAND_WORD + " [PERSON INDEX] "
+ PREFIX_DELETE_VISIT + "[REPORT INDEX]";;

private final Index index;
private final int id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ public class EditVisitCommand extends Command {
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Edits the visitation record of the person identified "
+ "by the index number used in the last person listing.\n "
+ COMMAND_WORD + "[PERSON INDEX] "
+ COMMAND_WORD + " [PERSON INDEX] "
+ PREFIX_EDIT_VISIT + "[REPORT INDEX]\n"
+ "Example: " + COMMAND_WORD + " 1 "
+ PREFIX_EDIT_VISIT + "2";

public static final String MESSAGE_EDIT_VISIT_PROMPT = "Please edit the form";
public static final String MESSAGE_MISSING_INDEX_PROMPT = "Please specify index of report to be edited";
public static final String MESSAGE_MISSING_INDEX_PROMPT = "Please specify index of report to be edited\n"
+ "Usage: " + COMMAND_WORD + " [PERSON INDEX] "
+ PREFIX_EDIT_VISIT + "[REPORT INDEX]\n";

private final Index index;
private final int id;
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/seedu/address/model/person/VisitList.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
public class VisitList {

public static final String MESSAGE_CONSTRAINTS = "Visit date should follow dd/mm/yyyy format";
public static final String VALIDATION_REGEX = "^(3[01]|[12][0-9]|0[1-9])/(1[0-2]|0[1-9])/[0-9]{4}$";

private ArrayList<VisitReport> records = new ArrayList<>();

Expand Down Expand Up @@ -54,13 +53,6 @@ public String toString() {
}
}

/**
* Returns true if a given string is a valid tag name.
*/
public static boolean isValidVisitDate(String test) {
return test.matches(VALIDATION_REGEX);
}

/**
* Edits record from the list by index.
*/
Expand Down
96 changes: 96 additions & 0 deletions src/main/java/seedu/address/ui/EmptyVisitList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package seedu.address.ui;

import java.util.logging.Logger;

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import seedu.address.commons.core.LogsCenter;

/**
* Controller for a help page
*/
public class EmptyVisitList extends UiPart<Stage> {

public static final String EMPTY_MESSAGE = "Patient has no past records!";

private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);
private static final String FXML = "EmptyVisitListWindow.fxml";

@FXML
private Button backButton;

@FXML
private Label message;

/**
* Creates a new HelpWindow.
*
* @param root Stage to use as the root of the HelpWindow.
*/
public EmptyVisitList(Stage root) {
super(FXML, root);
message.setText(EMPTY_MESSAGE);
}

/**
* Creates a new HelpWindow.
*/
public EmptyVisitList() {
this(new Stage());
}

/**
* Shows the help window.
* @throws IllegalStateException
* <ul>
* <li>
* if this method is called on a thread other than the JavaFX Application Thread.
* </li>
* <li>
* if this method is called during animation or layout processing.
* </li>
* <li>
* if this method is called on the primary stage.
* </li>
* <li>
* if {@code dialogStage} is already showing.
* </li>
* </ul>
*/
public void show() {
logger.fine("Showing help page about the application.");
getRoot().show();
getRoot().centerOnScreen();
}

/**
* Returns true if the help window is currently being shown.
*/
public boolean isShowing() {
return getRoot().isShowing();
}

/**
* Hides the help window.
*/
public void hide() {
getRoot().hide();
}

/**
* Focuses on the help window.
*/
public void focus() {
getRoot().requestFocus();
}

/**
* Copies the URL to the user guide to the clipboard.
*/
@FXML
private void back() {
this.hide();
}
}
29 changes: 27 additions & 2 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.MenuItem;
Expand All @@ -16,6 +17,7 @@
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.VisitReport;

/**
* The Main Window. Provides the basic application layout containing
Expand All @@ -38,6 +40,7 @@ public class MainWindow extends UiPart<Stage> {
private MotdWindow motdWindow;
private VisitRecordWindow visitWindow;
private VisitListPanel visitListPanel;
private EmptyVisitList emptyVisitList;
private AliasListWindow aliasListWindow;
private ProfileWindow profilePanel;

Expand Down Expand Up @@ -73,6 +76,7 @@ public MainWindow(Stage primaryStage, Logic logic) {
resultDisplay.setFeedbackToUser(visitWindow.getMessage());
});
visitListPanel = new VisitListPanel();
emptyVisitList = new EmptyVisitList();
aliasListWindow = new AliasListWindow();
profilePanel = new ProfileWindow();
}
Expand Down Expand Up @@ -184,6 +188,7 @@ private void handleExit() {
helpWindow.hide();
visitWindow.hide();
visitListPanel.hide();
emptyVisitList.hide();
profilePanel.hide();
primaryStage.hide();
}
Expand All @@ -206,6 +211,9 @@ public void handleProfilePanel() {
*/
@FXML
public void handleShowVisitForm() {
if (visitListPanel.isShowing()) {
visitListPanel.hide();
}
if (!visitWindow.isShowing()) {
visitWindow.show();
} else {
Expand All @@ -225,6 +233,18 @@ public void handleShowVisitList() {
}
}

/**
* Opens the empty visit list prompt window or focuses on it if it's already opened.
*/
@FXML
public void handleEmptyVisitList() {
if (!emptyVisitList.isShowing()) {
emptyVisitList.show();
} else {
emptyVisitList.focus();
}
}

/**
* Opens the list of existing user-defined aliases or focuses on it if it's already opened.
*/
Expand Down Expand Up @@ -275,8 +295,13 @@ private CommandResult executeCommand(String commandText) throws CommandException
}

if (commandResult.isShowVisitList()) {
visitListPanel.setup(commandResult.getObservableVisitList());
handleShowVisitList();
ObservableList<VisitReport> visits = commandResult.getObservableVisitList();
if (visits.isEmpty()) {
handleEmptyVisitList();
} else {
visitListPanel.setup(visits);
handleShowVisitList();
}
}

if (commandResult.isShowProfile()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/VisitCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import seedu.address.model.person.VisitReport;

/**
* An UI component that displays information of a {@code Person}.
* An UI component that displays information of a {@code VisitList}.
*/
public class VisitCard extends UiPart<Region> {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/ui/VisitListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import seedu.address.model.person.VisitReport;

/**
* Panel containing the list of persons.
* Panel containing the list of Visit Reports.
*/
public class VisitListPanel extends UiPart<Stage> {
private static final String FXML = "VisitListPanel.fxml";
Expand All @@ -27,7 +27,7 @@ public VisitListPanel(Stage root) {
}

/**
* Creates a new HelpWindow.
* Creates a new panel.
*/
public VisitListPanel() {
this(new Stage());
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/seedu/address/ui/VisitRecordWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public VisitRecordWindow(EventHandler<WindowEvent> e) {
}

/**
* Shows the help window.
* Shows the window.
* @throws IllegalStateException
* <ul>
* <li>
Expand All @@ -93,21 +93,21 @@ public void show() {
}

/**
* Returns true if the help window is currently being shown.
* Returns true if the window is currently being shown.
*/
public boolean isShowing() {
return getRoot().isShowing();
}

/**
* Hides the help window.
* Hides the window.
*/
public void hide() {
getRoot().hide();
}

/**
* Focuses on the help window.
* Focuses on the window.
*/
public void focus() {
getRoot().requestFocus();
Expand Down
Loading

0 comments on commit 928cf06

Please sign in to comment.