Skip to content

Commit

Permalink
Merge pull request #154 from Stratostorm/branch-ListAppt
Browse files Browse the repository at this point in the history
Implement listAppt and update UG
  • Loading branch information
clarlzx authored Mar 31, 2021
2 parents 72e6621 + f057128 commit da0d790
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 44 deletions.
124 changes: 80 additions & 44 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
layout: page
title: User Guide
---
Hello! Are you a parent whose phone's contact book is filling up with the contacts of teachers? Do you have trouble
remembering who exactly that contact in your contact book is referring to? Do you have multiple children and want
a centralised place to keep track of all their activities? Then HeliBook can be the app for you!

HeliBook is a **desktop app for managing your children's contacts and their related appointments,
optimized for use via a Command Line Interface** (CLI) while still having the benefits of a
Expand Down Expand Up @@ -97,18 +100,18 @@ Format: `exit`

### Address Book Commands

#### Adding a person: `add`
#### Adding a contact: `add`

Adds a person to the address book.
Adds a contact to the address book.

Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [tc/CHILDTAG]…​ [t/TAG]…​`

<div markdown="span" class="alert alert-primary">:bulb: **Tip:**
A person can have any number of tags (including 0)
A contact can have any number of tags (including 0)
</div>

<div markdown="span" class="alert alert-primary">:bulb: **Tip:**
You can add a person with only some of the information, you can fill in the rest later on.
You can add a contact with only some of the information, you can fill in the rest later on.
</div>

Examples:
Expand All @@ -117,88 +120,88 @@ Examples:

#### Adding/replacing tags to a contact: `tag`

Adds or replaces tags to the specified person by index.
Adds or replaces tags to the specified contact by index.

Format: `tag INDEX [o/OPTION] [tc/CHILDTAG]…​ [t/TAG]…​`

* Tags the person at the specified INDEX. The index refers to the index number shown in the displayed person list. The index must be a positive integer 1, 2, 3, …​
* Tags the contact at the specified INDEX. The index refers to the index number shown in the displayed contact list. The index must be a positive integer 1, 2, 3, …​

Currently available options for the `[OPTION]` field include:
* `rt` Replaces the currently existing tags with the given new set of tags

Examples:
* `tag 4 t/School t/English` Adds the tags School and English to the 4th person.
* `tag 2 o/rt tc/Alexa t/English` Replaces all existing tags of the 2nd person with the child tag Alexa and the tag English.
* `tag 4 t/School t/English` Adds the tags School and English to the 4th contact.
* `tag 2 o/rt tc/Alexa t/English` Replaces all existing tags of the 2nd contact with the child tag Alexa and the tag English.


#### Listing all persons : `list`
#### Listing all contacts : `list`

Shows a list of persons in the address book.
Shows a list of all contacts in the address book.

Format: `list [o/OPTION]`

Currently available options for the `[OPTION]` field include:
* `fav` Shows list of favourited persons in the address book
* `fav` Shows list of favourited contacts in the address book

Examples:
* `list` List all persons in the address book
* `list o/fav` Lists all favourited persons in the address book
* `list` List all contacts in the address book
* `list o/fav` Lists all favourited contacts in the address book

#### Editing a person : `edit`
#### Editing a contact : `edit`

Edits an existing person in the address book.
Edits an existing contact in the address book.

Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [tc/CHILDTAG]…​ [t/TAG]…​`

* Edits the person at the specified `INDEX`.
* The index refers to the index number shown in the displayed person list.
* Edits the contact at the specified `INDEX`.
* The index refers to the index number shown in the displayed contact list.
* The index **must be a positive integer** 1, 2, 3, …​
* At least one of the optional fields must be provided.
* Existing values will be updated to the input values.
* When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.
* You can remove all the person’s tags by typing `t/` without
* When editing tags, the existing tags of the contact will be removed i.e adding of tags is not cumulative.
* You can remove all the contact’s tags by typing `t/` without
specifying any tags after it. Note: all ChildTags will also be removed.

Examples:
* `edit 1 p/91234567 e/[email protected]` Edits the phone number and email address of the 1st person to be `91234567` and `[email protected]` respectively.
* `edit 2 n/Betsy Crower t/` Edits the name of the 2nd person to be `Betsy Crower` and clears all existing tags.
* `edit 1 p/91234567 e/[email protected]` Edits the phone number and email address of the 1st contact to be `91234567` and `[email protected]` respectively.
* `edit 2 n/Betsy Crower t/` Edits the name of the 2nd contact to be `Betsy Crower` and clears all existing tags.

#### Locating persons by name: `find`
#### Locating contacts by name: `find`

Finds persons whose names contain any of the given keywords.
Finds contacts whose names contain any of the given keywords.

Format: `find KEYWORD [MORE_KEYWORDS]`

* The search is case-insensitive. e.g `hans` will match `Hans`
* The order of the keywords does not matter. e.g. `Hans Bo` will match `Bo Hans`
* Only the name is searched.
* Incomplete words will also be matched e.g. `Han` will match `Hans`
* Persons matching at least one keyword will be returned (i.e. `OR` search).
* contacts matching at least one keyword will be returned (i.e. `OR` search).
e.g. `Hans Bo` will return `Hans Gruber`, `Bo Yang`
* If *n* persons can be found, message “*n* persons listed!” will be displayed
e.g. when 0 results, "0 persons listed!" is displayed
* If *n* contacts can be found, message “*n* contacts listed!” will be displayed
e.g. when 0 results, "0 contacts listed!" is displayed

Examples:
* `find John` returns `john` and `John Doe`
* `find alex david` returns `Alex Yeoh`, `David Li` when no exact matches are found

![result for 'find alex david'](images/findAlexDavidResult.png)

#### Deleting a person : `delete`
#### Deleting a contact : `delete`

Deletes the specified person from the address book.
Deletes the specified contact from the address book.

Format: `delete INDEX`

* Deletes the person at the specified `INDEX`.
* The index refers to the index number shown in the displayed person list.
* Deletes the contact at the specified `INDEX`.
* The index refers to the index number shown in the displayed contact list.
* The index **must be a positive integer** 1, 2, 3, …​

Examples:
* `list` followed by `delete 2` deletes the 2nd person in the address book.
* `find Betsy` followed by `delete 1` deletes the 1st person in the results of the `find` command.
* `list` followed by `delete 2` deletes the 2nd contact in the address book.
* `find Betsy` followed by `delete 1` deletes the 1st contact in the results of the `find` command.

#### Sorting all persons : `sort`
#### Sorting all contacts : `sort`

Sorts the address book in the order based on the given option.

Expand All @@ -212,25 +215,25 @@ Examples:
* `sort o/name` returns the contact list sorted in alphabetical order.
* `sort o/date` returns the contact list sorted in chronological order.

#### Favourite a person : `fav`
#### Favourite a contact : `fav`

Format: `fav INDEX [o/OPTION]`

* Favourite the person at the specified `INDEX`.
* The index refers to the index number shown in the displayed person list.
* Favourite the contact at the specified `INDEX`.
* The index refers to the index number shown in the displayed contact list.
* The index **must be a positive integer** 1, 2, 3, …​

Currently available options for the `[OPTION]` field include:
* `remove` Unfavourites the specified person
* `remove` Unfavourites the specified contact

Examples:
* `list` followed by `fav 2` favourites the 2nd person in the address book.
* `find Betsy` followed by `delete 1` favourites the 1st person in the results of the `find` command.
* `fav 3 o/remove` unfavourites the 3rd person in the address book.
* `list` followed by `fav 2` favourites the 2nd contact in the address book.
* `find Betsy` followed by `delete 1` favourites the 1st contact in the results of the `find` command.
* `fav 3 o/remove` unfavourites the 3rd contact in the address book.

<div markdown="span" class="alert alert-primary">:bulb: **Tip:**
When a person is favourited, the star next to their name will become filled/white.
When a person is unfavourited, the star will turn empty.
When a contact is favourited, the star next to their name will become filled/white.
When a contact is unfavourited, the star will turn empty.
</div>

#### Clearing all entries : `clear`
Expand Down Expand Up @@ -258,7 +261,7 @@ Adds an appointment to the appointment book.
Format: `addAppt n/NAME a/ADDRESS d/DATE [c/CONTACT_INDEX]…​ [tc/CHILDTAG]…​`

* Contact in the address book at the specified `CONTACT_INDEX` is added to the appointment.
* The index refers to the index number shown in the displayed person list.
* The index refers to the index number shown in the displayed contact list.
* The index **must be a positive integer** 1, 2, 3, …​
* `DATE` has to be in the format "`dd`/`MM`/`yyyy` `HH`:`mm`".

Expand All @@ -279,6 +282,28 @@ Examples:
* `list` followed by `deleteAppt 2` deletes the 2nd appointment in the appointment book.
* `findAppt ptm` followed by `deleteAppt 1` deletes the 1st appointment in the results of the `findAppt` command.

#### Editing an appointment : `editAppt`

Edits an existing appointment to the appointment book.

Format: `editAppt INDEX [n/NAME] [a/ADDRESS] [d/DATE] [c/CONTACT_INDEX]…​ [tc/CHILDTAG]…​`

* Contacts in the address book at the specified `CONTACT_INDEX` is added to the appointment.
* Edits the appointment at the specified `INDEX`.
* The index refers to the index number shown in the displayed appointment book.
* The index **must be a positive integer** 1, 2, 3, …​
* `DATE` has to be in the format "`dd`/`MM`/`yyyy` `HH`:`mm`".
* At least one of the optional fields must be provided.
* Existing values will be updated to the input values.
* When editing tags and contacts, the existing tags and contacts of the contact will be removed
i.e the operation is not cumulative.

Examples:

* `edit 1 n/PSG meeting a/ABC Secondary School c/1` Edits the name and address of the 1st appointment to
be `PSG meeting` and `ABC Secondary School` respectively and replaces all related contacts with the 1st contact
on the contact list.

#### Finding appointments by name: `findAppt`

Finds appointments whose names contain any of the given keywords.
Expand All @@ -289,14 +314,23 @@ Format: `findAppt KEYWORD [MORE_KEYWORDS]…​`
* The order of the keywords does not matter. e.g. `Teacher meeting` will match `Meeting teacher`
* Only the name is searched.
* Incomplete words will also be matched e.g. `PT` will match `PTM`
* Persons matching at least one keyword will be returned (i.e. `OR` search).
* Contacts matching at least one keyword will be returned (i.e. `OR` search).
e.g. `Teacher meeting` will return `Speak to ballet teacher`, `PSG meeting`
* If *n* appointments can be found, message “*n* appointments listed!” will be displayed
e.g. when 0 results, "0 appointments listed!" is displayed

Examples:
* `findAppt ptm` returns `PTM`

#### Listing all appointments : `listAppt`

Shows a list of all appointments in the appointment book.

Format: `listAppt`

Examples:
* `listAppt` List all appointments in the appointment book.

--------------------------------------------------------------------------------------------------------------------

## Managing HeliBook Data
Expand Down Expand Up @@ -362,4 +396,6 @@ Action | Format, Examples
​ | **Appointment Book Commands**
**Add** | `addAppt n/NAME a/ADDRESS d/DATE [c/CONTACT_INDEX]…​ [tc/CHILDTAG]…​` <br> e.g., `addAppt n/PTM a/ABC Primary School d/21/03/2021 10:00 c/2`
**Delete** | `deleteAppt INDEX` <br> e.g., `delete 2`
**Edit** | `editAppt INDEX [n/NAME] [a/ADDRESS] [d/DATE] [c/CONTACT_INDEX]…​ [tc/CHILDTAG]…​` <br> e.g., `edit 1 n/PSG meeting a/ABC Secondary School c/1`
**Find** | `find KEYWORD [MORE_KEYWORDS]…​` <br> e.g., `find PTM`
**List** | `listAppt`
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_OPTION;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_APPOINTMENTS;

import seedu.address.model.Model;

public class ListAppointmentCommand extends Command {
public static final String COMMAND_WORD = "listAppt";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Lists appointments in the appointment book.\n"
+ "Parameters: [" + PREFIX_OPTION + "OPTION]\n";
public static final String MESSAGE_SUCCESS = "Listed all persons";

public ListAppointmentCommand() {}

@Override
public CommandResult execute(Model model) {
requireNonNull(model);

model.updateFilteredAppointmentList(PREDICATE_SHOW_ALL_APPOINTMENTS);
return new CommandResult(MESSAGE_SUCCESS);
}
}
4 changes: 4 additions & 0 deletions src/main/java/seedu/address/logic/parser/HeliBookParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import seedu.address.logic.commands.FindAppointmentCommand;
import seedu.address.logic.commands.FindCommand;
import seedu.address.logic.commands.HelpCommand;
import seedu.address.logic.commands.ListAppointmentCommand;
import seedu.address.logic.commands.ListCommand;
import seedu.address.logic.commands.SortCommand;
import seedu.address.logic.commands.TagCommand;
Expand Down Expand Up @@ -97,6 +98,9 @@ public Command parseCommand(String userInput) throws ParseException {
case FindAppointmentCommand.COMMAND_WORD:
return new FindAppointmentCommandParser().parse(arguments);

case ListAppointmentCommand.COMMAND_WORD:
return new ListAppointmentCommand();

default:
throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
}
Expand Down

0 comments on commit da0d790

Please sign in to comment.